/tutorial/cecil/integer/example.e
Specman e | 36 lines | 24 code | 4 blank | 8 comment | 0 complexity | 36d22241aa0015d529cdd75f4f8a7a86 MD5 | raw file
1class EXAMPLE 2 -- 3 -- The Eiffel program is running first, then calls the C program, which is in charge of adding 4 -- two INTEGERs using the infix "+" feature of class INTEGER. 5 -- 6 -- To compile this example, use command: 7 -- 8 -- se c -cecil cecil.se example c_prog.c 9 -- 10 11create {ANY} 12 make 13 14feature {ANY} 15 make 16 local 17 i1, i2, sum: INTEGER 18 do 19 i1 := 2 20 i2 := 3 21 io.put_integer(i1) 22 io.put_string(" + ") 23 io.put_integer(i2) 24 io.put_string(" = ") 25 sum := call_c_prog(i1, i2) 26 io.put_integer(sum) 27 io.put_string("%N") 28 end 29 30feature {} 31 call_c_prog (i1, i2: INTEGER): INTEGER 32 external "C" 33 alias "c_prog" 34 end 35 36end -- class EXAMPLE