Zheng Hu | 10 Jun 17:13

Question about agent

Hi once again :)

I have still a problem with "agent". Here is an example:

functions: LINKED_LIST[ROUTINE[TUPLE]

f1(i: INTEGER) is 
do
    print(i.out)
end

f2(c: CHARACTER; n:INTEGER) is 
do
   print(c.to_string + n.out)
end

make is
   do
      create functions.make
      functions.add_last(agent f1(12))
      functions.add_last(agent f2('f',23))
   end

When I compile it to C, I get following line of code for last two lines of make function:

/*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
/*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);

Any suggestion again? 
Thanks in advance!
(Continue reading)

Paolo Redaelli | 10 Jun 17:25
Favicon

Re: Question about agent

Zheng Hu ha scritto:
> When I compile it to C, I get following line of code for last two lines of make function:
>
> /*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
> /*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
>
> Any suggestion again? 
>   
I suspect you are looking at the wrong lines.
Please remember that the produced C code is *NOT* meant to be read by 
humans.
If you really need to read the C code produced by SmartEiffel - for 
study or something else - compile puts comments like  /*l19c32/foo.e*/ 
in the produced C sources, meaning that that fragment is the translation 
of the source at line 19, character 32 of file "foo.e".
I guess you used the -no_split flag.

Would you please tell us - in details - what are you trying to do with 
Eiffel?
Cheers
    Paolo

Zheng Hu | 11 Jun 15:46

Re: Question about agent

Hi Paolo,

Infact, I am using Eiffel to write my higher level code which is compiled to C using SE, and then I run it on my
AtMega board! And I am using a real time operating system to run below. So I need to call some APIs of the
operating system from my Eiffel code. And when I compile my Eiffel code to C, using "se c2c -boost -no_split
-no_gc myfile.e tasks.c", the following mentioned lines are not correctly converted to C by SmartEiffel
and that is why it is showing Smart Eiffel runtime error!

I have tried without -no_split, but it has the same line of code translated into C. So what should be the problem?

Thanks,
--
Zheng

-------- Original-Nachricht --------
> Datum: Tue, 10 Jun 2008 17:25:09 +0200
> Von: Paolo Redaelli <paolo.redaelli <at> poste.it>
> An: Zheng Hu <zheng.hu <at> gmx.de>, SmartEiffel Mailing List <smarteiffel <at> loria.fr>
> Betreff: Re: Question about agent

> Zheng Hu ha scritto:
> > When I compile it to C, I get following line of code for last two lines
> of make function:
> >
> > /*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
> > /*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
> >
> > Any suggestion again? 
> >   
> I suspect you are looking at the wrong lines.
(Continue reading)

Cyril ADRIAN | 11 Jun 15:50

Re: Question about agent

Hi,

On Tue, Jun 10, 2008 at 5:15 PM, Zheng Hu <zheng.hu <at> gmx.de> wrote:
When I compile it to C, I get following line of code for last two lines of make function:

/*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
/*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);

"evobt" is an acronym: it means "Error Void or Bad Target". SmartEiffel is damn sure that your target is either Void or not of the good type, so it generates that instead of the code you expect.

IOW it usually means you forgot to create some object.

Best regards,
--
Cyril ADRIAN - http://www.cadrian.net/~cyril

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
Zheng Hu | 11 Jun 16:00

Re: Question about agent

Hi Cyril,

Hmmm, well as I mentioned in my first email that I am using following code:

functions: LINKED_LIST[ROUTINE[TUPLE]

f1(i: INTEGER) is 
do
    print(i.out)
end

f2(c: CHARACTER; n:INTEGER) is 
do
   print(c.to_string + n.out)
end

make is
   do
      create functions.make
      functions.add_last(agent f1(12))
      functions.add_last(agent f2('f',23))
   end

So I think that problem is with storing the routines using agent into a linked list! I had earlier asked how to
use Tuple and I was advised to use it in this way! May be it is not the correct way! Suggestions? :)

Regards,
--
Zheng

-------- Original-Nachricht --------
> Datum: Wed, 11 Jun 2008 15:50:28 +0200
> Von: "Cyril ADRIAN" <cyril.adrian <at> gmail.com>
> An: "Zheng Hu" <zheng.hu <at> gmx.de>
> CC: SmartEiffel <at> loria.fr
> Betreff: Re: Question about agent

> Hi,
> 
> On Tue, Jun 10, 2008 at 5:15 PM, Zheng Hu <zheng.hu <at> gmx.de> wrote:
> 
> > When I compile it to C, I get following line of code for last two lines
> of
> > make function:
> >
> > /*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
> > /*se_evobt*/(void*)0,se_print_run_time_stack(),exit(1);
> >
> 
> "evobt" is an acronym: it means "Error Void or Bad Target". SmartEiffel is
> damn sure that your target is either Void or not of the good type, so it
> generates that instead of the code you expect.
> 
> IOW it usually means you forgot to create some object.
> 
> Best regards,
> -- 
> Cyril ADRIAN - http://www.cadrian.net/~cyril
> 
> Debugging is twice as hard as writing the code in the first place.
> Therefore, if you write the code as cleverly as possible, you are, by
> definition, not smart enough to debug it.
> -- Brian W. Kernighan

--

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf <at> gmx

Cyril ADRIAN | 11 Jun 16:16

Re: Question about agent

On Wed, Jun 11, 2008 at 4:00 PM, Zheng Hu <zheng.hu <at> gmx.de> wrote:

So I think that problem is with storing the routines using agent into a linked list! I had earlier asked how to use Tuple and I was advised to use it in this way! May be it is not the correct way! Suggestions? :)

FWIW I tried it and it works perfectly. Am I missing something?

I even tried adding something useful to the make function (a loop that calls the agents) and I have the correct result: "12f23" whatever it means ;-)

Best regards,
--
Cyril ADRIAN - http://www.cadrian.net/~cyril

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
Zheng Hu | 11 Jun 16:58

Re: Question about agent


Hay,

Well, I figured out the problem! I was not doing "create functions.make" :) Smart Eiffel was really right :)
Many thanks for your time and help!

Regards,
--
Zheng

-------- Original-Nachricht --------
> Datum: Wed, 11 Jun 2008 16:16:31 +0200
> Von: "Cyril ADRIAN" <cyril.adrian <at> gmail.com>
> An: "Zheng Hu" <zheng.hu <at> gmx.de>
> CC: SmartEiffel <at> loria.fr
> Betreff: Re: Question about agent

> On Wed, Jun 11, 2008 at 4:00 PM, Zheng Hu <zheng.hu <at> gmx.de> wrote:
> 
> > So I think that problem is with storing the routines using agent into a
> > linked list! I had earlier asked how to use Tuple and I was advised to
> use
> > it in this way! May be it is not the correct way! Suggestions? :)
> 
> 
> FWIW I tried it and it works perfectly. Am I missing something?
> 
> I even tried adding something useful to the make function (a loop that
> calls
> the agents) and I have the correct result: "12f23" whatever it means ;-)
> 
> Best regards,
> -- 
> Cyril ADRIAN - http://www.cadrian.net/~cyril
> 
> Debugging is twice as hard as writing the code in the first place.
> Therefore, if you write the code as cleverly as possible, you are, by
> definition, not smart enough to debug it.
> -- Brian W. Kernighan

--

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


Gmane