PageRenderTime 3ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/cecil/string/example.e

http://github.com/tybor/Liberty
Specman e | 36 lines | 18 code | 4 blank | 14 comment | 0 complexity | ac9b3b30843c603902105b7dc2666cd5 MD5 | raw file
 1class EXAMPLE
 2   --
 3   -- The Eiffel program is running first, creates an empty STRING which is passed to the C world.
 4   -- The C program then modifies the Eiffel STRING calling the Eiffel feature `extend' of class STRING.
 5   -- Finally, the modified STRING is printed.
 6   --
 7   -- To compile this example, use command:
 8   --
 9   --  se c -cecil cecil.se example c_prog.c
10   --
11   -- Is is also possible to C precompile the c_prog.c file doing:
12   --
13   --  gcc -c c_prog.c
14   --  se c -cecil cecil.se example c_prog.o
15   --
16
17create {ANY}
18   make
19
20feature {ANY}
21   make
22      local
23         string: STRING
24      do
25         create string.make(0)
26         call_c_prog(string)
27         io.put_string(string)
28      end
29
30feature {}
31   call_c_prog (str: STRING)
32      external "C"
33      alias "c_prog"
34      end
35
36end -- class EXAMPLE