Sam Hu | 4 Aug 05:11 2008
Picon

Interface support?


Hi there,

I am absolutely a newbie and not an expert on computer programming,but
I do love the world of binary system.Just wanna know whether it is
possible for eC to implement the interface.

Thanks and best regards,
Sam
Jerome St-Louis | 4 Aug 10:49 2008
Picon

Re: Interface support?

Hi Sam,

I'm not sure exactly what you're asking...

Ecere includes a Graphical User Interface engine to build user interfaces,
which you can write in eC...

Is this what you want to know? Please give me more details of what you'd
like to do.

Regards,

Jerome

Sam Hu | 5 Aug 03:24 2008
Picon

Re: Interface support?


Hi Jerome,

It seems that I replied to your mailbox,sorry!

What I mean is that ,say,in C# and other OOP laguage,there is a key
word like Interface and Delegate/Event...,For Interface,act as a
bridge to implement multi-inheritance,
For example:
Interface IRun
{
   int Speed();
}
class Car:IRun
{
   int Speed();
   //Other member;
}
class Dog:IRun
{
   int Speed();
   //Other member;
}
Not sure whether it is clear.

Regards,
Sam

On Aug 4, 4:49 pm, "Jerome St-Louis" <jerstlo...@...> wrote:
> Hi Sam,
(Continue reading)

Sam Hu | 5 Aug 03:47 2008
Picon

characters/struct/enum/examples in the Dao


Hi Jerome ,

I am reading the Dao and really looking forward to your finishing it
as soon as possible.

Some questions from the book:
1.how to output Chinese set using printf(),in my pc,it does not work
properly,for example:
class appRun:Application
{
   void Main()
  {
    char* name="道德经";
    printf("You have input %s\n",name);
  }
}
2.Struct parameter in a function is passed by reference by default,if
want to pass by value,use add struct key word.For example:
struct Book{};
void Read(Book book);//pass by reference
void Read(struct Book book);//pass by value;
Am I right?if yes,then the problem I met is that compile failure with
below message:
structApp.ec:21: error: invalid type argument of '->' (have 'struct
Book')
   structApp.ec:22: error: invalid type argument of '->' (have 'struct
Book)
   structApp.ec:27: error: incompatible type for argument 1 of 'Read'

(Continue reading)

Jerome St-Louis | 5 Aug 04:27 2008
Picon

Re: Interface support?

Hi Sam,

Sorry I misunderstood your question :)

eC currently doesn't have an interface keyword, but I have been
contemplating including it in a future version of the language...

eC however currently has some special experimental features which does
something somewhat similar, which we might want to improve.

Here's some sample code demonstrating some of it:

class MyInterface
{
   virtual int any_object::Method1();
   virtual void any_object::Method2();
}

class Interface1 : MyInterface
{
   int MyClass::Method1()
   {
      printf("%d\n", a);
   }

   void MyClass::Method2()
   {

   }
}
(Continue reading)

Joseph Adams | 5 Aug 04:42 2008
Picon

Re: characters/struct/enum/examples in the Dao

> 1.how to output Chinese set using printf(),in my pc,it does not work
> properly,for example:
> class appRun:Application
> {
>   void Main()
>  {
>    char* name="道德经";
>    printf("You have input %s\n",name);
>  }
> }

My guess is that your command line may not be set to UTF-8, which is
the charset consistently used throughout Ecere.  Try making a form,
putting an EditBox in it, and using editBox.SetText to set it to the
contents.  My guess is that this will render correctly.  In any case,
see if you can configure your command line to use UTF-8.

> 3.
>  1).enum examples in the book
>  enum Planet{mercury,venus,earth,mars,jupiter,saturn,uranus,neptune};
> enum PlanetOrDwartPlanet:Planet{ceres,pluto,eris};
> Your comments in the book say that ceres will be 8,and so on.But when
> I pint it ,it is 0.

Indeed, I can confirm this.  Not only does ceres start at zero, but
PlanetOrDwartPlanet::enumSize is 3 instead of 8+3 = 11.

>  2).Is it possible to add implementation something like
> enum.toString() to print the enum variable's rep. content other than
> the value in integer.For example:
(Continue reading)

Jerome St-Louis | 5 Aug 04:37 2008
Picon

Re: characters/struct/enum/examples in the Dao


2008/8/4 Sam Hu <SamHu.SamHu <at> gmail.com>

Hi Jerome ,

I am reading the Dao and really looking forward to your finishing it
as soon as possible.

I'm sorry it might take a bit of time :(
I am quite busy with the development of the new features...
Right now working on the eC templates, and then I have to finish a few things for the open source release...
I will try to make some steady progress however.
 

Some questions from the book:
1.how to output Chinese set using printf(),in my pc,it does not work
properly,for example:
class appRun:Application
{
  void Main()
 {
   char* name="道德经";
   printf("You have input %s\n",name);
 }
}

That is a problem with the Windows operating system. The Windows console doesn't support UTF-8. Use Linux :)
Or forget about pritnf, and output to an Ecere EditBox control instead. (editBox.Printf() )

 
2.Struct parameter in a function is passed by reference by default,if
want to pass by value,use add struct key word.For example:
struct Book{};
void Read(Book book);//pass by reference
void Read(struct Book book);//pass by value;
Am I right?if yes,then the problem I met is that compile failure with
below message:
structApp.ec:21: error: invalid type argument of '->' (have 'struct
Book')
  structApp.ec:22: error: invalid type argument of '->' (have 'struct
Book)
  structApp.ec:27: error: incompatible type for argument 1 of 'Read'

It is possible that the book (Still unpublished, remember :P) assumes ideals which do not yet work properly.
However if it there is indeed some sample code in the book which does not compile, please report a bug on the bug tracker http://www.ecere.com/mantis/
and attach the offending source code as a file.
 

3.
 1).enum examples in the book
 enum Planet{mercury,venus,earth,mars,jupiter,saturn,uranus,neptune};
enum PlanetOrDwartPlanet:Planet{ceres,pluto,eris};
Your comments in the book say that ceres will be 8,and so on.But when
I pint it ,it is 0.

Interesting :) I will check it :) Maybe it is a bug also.
 
2).Is it possible to add implementation something like
enum.toString() to print the enum variable's rep. content other than
the value in integer.For example:
 Planet p=mercury;
 printf("%d\n",p)//===>output is 0;
 printf(%s\n",p.toString())===>output is :mercury.

In the new release I am working on facilitating this.
Right now every data type as an "OnGetString" method, which however requires a char buffer and 2 other parameters

char buffer[4096];
char * string;
Planet p = mercury;
string = p.OnGetString(buffer, null, null);

The problem with a simple ToString" method has to do with leaking the string... eC needs a better string solution which is unfortunately not there yet :(
But I am hoping to provide nicer utility function in the release 0.43 such as a "PrintLn" and an easier "ToString" method as well.

 
Cheers,

Jerome

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "eC Programming Language" group.
To post to this group, send email to ec-programming-language <at> googlegroups.com
To unsubscribe from this group, send email to ec-programming-language+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.ca/group/ec-programming-language?hl=en
-~----------~----~----~----~------~----~------~--~---

Sam Hu | 5 Aug 11:27 2008
Picon

Re: Interface support?


Hi Jerome,

Thanks so much for your quick response,really appreciated!.

Looking forward to your effort to equip eC more and more powerful
while retain the clean and performance of C.

Regards,
Sam

On Aug 5, 10:27 am, "Jerome St-Louis" <jerstlo...@...> wrote:
> Hi Sam,
>
> Sorry I misunderstood your question :)
>
> eC currently doesn't have an interface keyword, but I have been
> contemplating including it in a future version of the language...
>
> eC however currently has some special experimental features which does
> something somewhat similar, which we might want to improve.
>
> Here's some sample code demonstrating some of it:
>
> class MyInterface
> {
>    virtual int any_object::Method1();
>    virtual void any_object::Method2();
>
> }
>
> class Interface1 : MyInterface
> {
>    int MyClass::Method1()
>    {
>       printf("%d\n", a);
>    }
>
>    void MyClass::Method2()
>    {
>
>    }
>
> }
>
> class MyClass
> {
>    int a;
>    subclass(MyInterface) interface;
>    a = 5;
>    interface = class(Interface1);
>
>    void Test()
>    {
>       interface.Method1(this);
>       interface.Method2(this);
>    }
>
> }
>
> class MyApp : Application
> {
>    void Main()
>    {
>       MyClass object { };
>       object.Test();
>       getch();
>    }
>
> }
>
> This produces two warnings right now which would need to be removed, please
> don't mind them.
>
> The interesting part is that the data type "subclass(MyInterface)" can act
> like an object, and allows you to call the methods of that interface (In
> this example, implemented in Interface1).
> However there is no implied "this" pointer (I believe I've only used this so
> far with the methods with no this pointer (said static in C++), which would
> be defined as  virtual int ::Method1();)
> Using any_object here allows to override the function with the this pointer
> of our choice, in this case "MyClass".
>
> Although I know the basic workings of interfaces, I haven't had much chance
> to play with them since I've never programmed in C# or Java myself...
> I came up with these particular functionality while implementing the various
> "drivers" in eC, for example for various platforms, graphics engine etc.
> It needs to be polished, and maybe truer interface support should be added
> to eC. I hope this starts as a discussion point to go forward in deciding
> how to support the interface paradigm in eC.
>
> Regards,
>
> Jerome
Sam Hu | 5 Aug 11:30 2008
Picon

Re: characters/struct/enum/examples in the Dao


Hi both,

Appreciate again.

1.A silly question:how to set command line to UTF-8?-:)
2.I am more and more greedy now.How about operator overloading and
multi-cast delegate,-:)

Regards,
Sam

On Aug 5, 10:42 am, "Joseph Adams" <joeyadams3.14...@...> wrote:
> > 1.how to output Chinese set using printf(),in my pc,it does not work
> > properly,for example:
> > class appRun:Application
> > {
> >   void Main()
> >  {
> >    char* name="道德经";
> >    printf("You have input %s\n",name);
> >  }
> > }
>
> My guess is that your command line may not be set to UTF-8, which is
> the charset consistently used throughout Ecere.  Try making a form,
> putting an EditBox in it, and using editBox.SetText to set it to the
> contents.  My guess is that this will render correctly.  In any case,
> see if you can configure your command line to use UTF-8.
>
> > 3.
> >  1).enum examples in the book
> >  enum Planet{mercury,venus,earth,mars,jupiter,saturn,uranus,neptune};
> > enum PlanetOrDwartPlanet:Planet{ceres,pluto,eris};
> > Your comments in the book say that ceres will be 8,and so on.But when
> > I pint it ,it is 0.
>
> Indeed, I can confirm this.  Not only does ceres start at zero, but
> PlanetOrDwartPlanet::enumSize is 3 instead of 8+3 = 11.
>
> >  2).Is it possible to add implementation something like
> > enum.toString() to print the enum variable's rep. content other than
> > the value in integer.For example:
> >  Planet p=mercury;
> >  printf("%d\n",p)//===>output is 0;
> >  printf(%s\n",p.toString())===>output is :mercury.
>
> I agree.  Moreover, perhaps the array of all the enum values should be
> available, too:
>
> char *enumNames[] = Planet::enumNames; //contains this array:
> {"mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus",
> "neptune"}
>
> However, I'd imagine the .toString would be convenient for a whole lot
> of applications, so this would be an extension rather than a
> substitute.  Planet::enumNames[p] is a little unclear :)
QUAN | 5 Aug 13:24 2008
Picon

Re: characters/struct/enum/examples in the Dao

Hi Sam,

For the UTF-8 question...

It seems that you are using Windows, then...

First, if you could check the
[ControlPanel->RegionalAndLanguageOptions->Language->TextServiceAndInputLanguages->Detail->Advanced],
then make sure that options in the [CompatibilityConfiguration] is
checked, and the [SystemConfiguration->TurnOffAdvancedTextServices] is
unchecked.

Then, go to [ControlPanel->Display->Appearance->Advanced], and make
sure all window texts are using a font that support UTF-8.

It could happen that the system wants you to put back in your
installation CD if you are using one of the European language versions
of Windows.

Try Ubuntu pal. If I can also suggest.

Regards
Quan

2008/8/5 Sam Hu <SamHu.SamHu <at> gmail.com>:
>
> Hi both,
>
> Appreciate again.
>
> 1.A silly question:how to set command line to UTF-8?-:)
> 2.I am more and more greedy now.How about operator overloading and
> multi-cast delegate,-:)
>
> Regards,
> Sam
>
> On Aug 5, 10:42 am, "Joseph Adams" <joeyadams3.14... <at> gmail.com> wrote:
>> > 1.how to output Chinese set using printf(),in my pc,it does not work
>> > properly,for example:
>> > class appRun:Application
>> > {
>> >   void Main()
>> >  {
>> >    char* name="道德经";
>> >    printf("You have input %s\n",name);
>> >  }
>> > }
>>
>> My guess is that your command line may not be set to UTF-8, which is
>> the charset consistently used throughout Ecere.  Try making a form,
>> putting an EditBox in it, and using editBox.SetText to set it to the
>> contents.  My guess is that this will render correctly.  In any case,
>> see if you can configure your command line to use UTF-8.
>>
>> > 3.
>> >  1).enum examples in the book
>> >  enum Planet{mercury,venus,earth,mars,jupiter,saturn,uranus,neptune};
>> > enum PlanetOrDwartPlanet:Planet{ceres,pluto,eris};
>> > Your comments in the book say that ceres will be 8,and so on.But when
>> > I pint it ,it is 0.
>>
>> Indeed, I can confirm this.  Not only does ceres start at zero, but
>> PlanetOrDwartPlanet::enumSize is 3 instead of 8+3 = 11.
>>
>> >  2).Is it possible to add implementation something like
>> > enum.toString() to print the enum variable's rep. content other than
>> > the value in integer.For example:
>> >  Planet p=mercury;
>> >  printf("%d\n",p)//===>output is 0;
>> >  printf(%s\n",p.toString())===>output is :mercury.
>>
>> I agree.  Moreover, perhaps the array of all the enum values should be
>> available, too:
>>
>> char *enumNames[] = Planet::enumNames; //contains this array:
>> {"mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus",
>> "neptune"}
>>
>> However, I'd imagine the .toString would be convenient for a whole lot
>> of applications, so this would be an extension rather than a
>> substitute.  Planet::enumNames[p] is a little unclear :)
> >
>

--

-- 
********************************************
What is a bird?
--"Grzimek's Encyclopedia of Birds".
********************************************

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "eC Programming Language" group.
To post to this group, send email to ec-programming-language <at> googlegroups.com
To unsubscribe from this group, send email to ec-programming-language+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.ca/group/ec-programming-language?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane