/tutorial/cecil/simple/example.e
Specman e | 49 lines | 30 code | 6 blank | 13 comment | 0 complexity | 9ad603ff8c4d9c8f74aaf2fbcd3da354 MD5 | raw file
1class EXAMPLE 2 -- 3 -- The Eiffel program is running first, then calls the C program which is in charge of calling the 4 -- Eiffel feature `show_values' of this EXAMPLE class. 5 -- 6 -- To compile this example, use command: 7 -- 8 -- se c -cecil cecil.se example c_prog.c 9 -- 10 -- Is is also possible to C precompile the c_prog.c file doing: 11 -- 12 -- gcc -c c_prog.c 13 -- se c -cecil cecil.se example c_prog.o 14 -- 15 16create {ANY} 17 make 18 19feature {ANY} 20 make 21 do 22 values := {ARRAY[INTEGER] 1, << 1, 2, 3 >> } 23 call_c_prog(Current) 24 end 25 26 show_values 27 local 28 i: INTEGER 29 do 30 from 31 i := values.lower 32 until 33 i > values.upper 34 loop 35 io.put_integer(values.item(i)) 36 io.put_new_line 37 i := i + 1 38 end 39 end 40 41feature {} 42 values: ARRAY[INTEGER] 43 44 call_c_prog (current_object: like Current) 45 external "C" 46 alias "c_prog" 47 end 48 49end -- class EXAMPLE