/tutorial/cecil/array_of_references/example.e

http://github.com/tybor/Liberty · Specman e · 33 lines · 20 code · 5 blank · 8 comment · 0 complexity · 5bb15a55244ce613e0a9dd0d2e1b8003 MD5 · raw file

  1. class EXAMPLE
  2. --
  3. -- The Eiffel program is running first, then call the C program which is in charge to print the
  4. -- contents of `animals' using `lower'/`upper'/`item' of ARRAY[ANIMAL].
  5. --
  6. -- To compile this example, use command:
  7. --
  8. -- se c -cecil cecil.se example c_prog.c
  9. --
  10. create {ANY}
  11. make
  12. feature {ANY}
  13. make
  14. local
  15. cat: CAT; dog: DOG
  16. do
  17. create cat
  18. create dog
  19. animals := {ARRAY[ANIMAL] 1, << cat, dog, cat >> }
  20. call_c_prog(animals)
  21. end
  22. feature {}
  23. animals: ARRAY[ANIMAL]
  24. call_c_prog (a: like animals)
  25. external "C"
  26. alias "c_prog"
  27. end
  28. end -- class EXAMPLE