
                                   [Line]
                       This page is not finished yet

                                   Cecil

   Here is the information you need if you want to call some Eiffel
   features from C code. To call C functions/macros from Eiffel see the
   documentation about [1]externals (man/external in the distribution).

   In order to call some Eiffel feature from C, you must use the -cecil
   <cecil_file> option with command compile or compile_to_c. The
   <cecil_file> allows you to give the list of features you want to call
   from C. The corresponding stub routines will be automatically
   generated by SmartEiffel.
   When the -cecil option is used, command compile_to_c also produces an
   additional C heading file which includes the needed C prototypes.

   Your <cecil_file> must contain at least two lines. The first line is
   the name of the C heading file to produce (it may be useful if you
   need to create a C library). Other lines have the following structure:

                 <c_name> <live_eiffel_type> <feature_name>

   The <c_name> is the name of the C function defined by compile_to_c to
   wrap the Eiffel call. The couple <live_eiffel_type> <feature_name>
   gives the complete name of the Eiffel feature to call. For example:

                IsEiffelStringEmpty     STRING       empty
                    STRINGitem          STRING       item
                      strgrtr           STRING     infix ">"
                array_of_int_count  ARRAY[INTEGER]   count
                        X_f               X            f

   Keep in mind that the <live_eiffel_type> must be really live: if
   <live_eiffel_type> is ARRAY[INTEGER] for example, your Eiffel program
   is supposed to create at least one ARRAY[INTEGER].

   The name of the feature to call, <feature_name> may even be an infix
   or a prefix feature name. The syntax is the same as the one used in
   Eiffel source.

   Since attributes are features, if is of course possible to access them
   with this mechanism.

   A call to X_f in the C code is equivalent to a call to x.f in Eiffel,
   with x of type X or any descendant of X. Indeed, X_f takes care of
   late binding. This means that X_f can be called on any (Current)
   argument of type X or heir of X.

   As <cecil_file> is parsed by the SmartEiffel parser, it may contain
   Eiffel comments.

   Here is one example of a Cecil file (others can be found in
   directories SmartEiffel/tutorial/cecil/example*):
-- The name of the include C file :
eiffel.h
-- The features you want to call from C :
array_of_animal_item    ARRAY[ANIMAL]   item
array_of_animal_lower   ARRAY[ANIMAL]   lower
array_of_animal_upper   ARRAY[ANIMAL]   upper
cry                     ANIMAL          cry
string_to_external      STRING          to_external

   People who tinker with the C code generated by SmartEiffel, not
   limiting themselves to the Cecil and/or external interfaces, should
   also read [2]this page about the C code generated by SmartEiffel.
   Otherwise they might get into trouble.

                                   [Line]
             Copyright © Dominique COLNET and Suzanne COLLIN -
                         [3]<SmartEiffel@loria.fr>
               Last modified: Mon Sep 9 11:40:30 MET DST 2002
                                      

References

   1. file://localhost/home/colnet/man/external.html
   2. file://localhost/home/colnet/man/c_code.html
   3. mailto:SmartEiffel@loria.fr
