home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_show / cecil / example1 / example.e < prev    next >
Text File  |  1999-06-05  |  841b  |  40 lines

  1. class EXAMPLE
  2.    --
  3.    -- The Eiffel program is running first, create an empty STRING
  4.    -- which is passed to the C world.
  5.    -- The C program then modify the Eiffel STRING calling the Eiffel
  6.    -- feature `extend' of class STRING.
  7.    -- Finally, the modified STRING is printed.
  8.    --
  9.    -- To compile this example, use command :
  10.    --
  11.    --         compile -cecil cecil.se example c_prog.c
  12.    --
  13.    -- Is is also possible to do :
  14.    --
  15.    --         gcc -c c_prog.o
  16.    --         compile -cecil cecil.se example c_prog.o
  17.    --
  18.  
  19. creation make
  20.  
  21. feature
  22.  
  23.    make is
  24.       local
  25.          string: STRING;
  26.       do
  27.          !!string.make(0);
  28.          call_c_prog(string);
  29.          io.put_string(string);
  30.       end;
  31.  
  32. feature {NONE}
  33.  
  34.    call_c_prog(str: STRING) is
  35.       external "C_WithoutCurrent"
  36.       alias "c_prog"
  37.       end;
  38.  
  39. end -- EXAMPLE
  40.