Re: Re: GEC Compilation of Externals

Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]>
Newsgroups gmane.comp.lang.eiffel.gobo.general
Organization Gobo
Message-ID <[email protected]>
Brian Heilig wrote:
> The disadvantage to the ECMA approach with inline functions is that
> things like stack tracing and assertions are more difficult to
> implement. 

The idea behind ECMA's specification is to allow the inclusion of
the code of C functions into Eiffel classes without having to
write a C file. That's why in case of complex algorithm it was
deemed necessary to allow not just an expression (for functions)
or a statement (for procedures).

> Take a look at the code generated by SE and ISE when the
> Eiffel routine is implemented as Eric suggested:
> 
> SE with assertions:
> 
> /*COM_TIMEOUTS*/
> void r232make_new_unshared(T232* C){
> {T230*n=((T230*)se_malloc(sizeof(*n))/*8*/);
> *n=M230;
> r230make_new_unshared(n,/*l274c4\com_timeouts.e*/return (sizeof
> (struct _COMMTIMEOUTS));
> /*l274c4\com_timeouts.e*/);
> /*SFN*/(C->_managed_data/*0*/)=((T0*)n);
> }
> }

[...]

> I'd like to suggest the following change to ECMA. I don't want to
> confuse the situation more, but I think it's a good idea.
> 
> First the content of C_text must be a sequence of valid C statements.
> If you want to return a value you can assign the value to $Result as in...
> 
> sizeof: INTEGER is
>     -- Size to allocate (in bytes)
>   external
>     "C inline use <windows.h>"
>   alias
>     "$Result = sizeof (struct _COMMTIMEOUTS);"
>   end
> 
> This would generate:
> 
> EIF_INTEGER_32 Fa9f3k0 (EIF_REFERENCE Current)
> {
> ...
>   EIF_INTEGER_32 Result = (EIF_INTEGER_32) 0;
> ...
> Result = sizeof (struct _COMMTIMEOUTS);
> ...
> 	return Result;
> }

But that won't work in case with SE with assertions above when
we have:

  sizeof: INTEGER is
      -- Size to allocate (in bytes)
    external
      "C inline use <windows.h>"
    alias
      "[
          if (somecondition)
             $Result = sizeof (struct _COMMTIMEOUTS);
          else
             $Result = some_other_value;
       ]"
    end

'r230make_new_unshared' expects an expression.

-- 
Eric Bezault
mailto:ericb-D6Qt/9opevxWk0Htik3J/[email protected]
http://www.gobosoft.com




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

To Post a message, send it to:   [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/gobo-eiffel/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.