/tutorial/external/C/c_glue1.c

http://github.com/tybor/Liberty · C · 54 lines · 40 code · 13 blank · 1 comment · 3 complexity · 65a3f067a24527cf5acd7e9147d5809d MD5 · raw file

  1. /* Hand-written C code to be used with example1.e */
  2. #include <stdio.h>
  3. void integer_to_c(int i){
  4. printf("%d\n",i);
  5. }
  6. void character_to_c(char c){
  7. printf("'%c'\n",c);
  8. }
  9. void boolean_to_c(int b){
  10. printf("%d\n",b);
  11. }
  12. void real_32_to_c(float r){
  13. printf("%f\n",r);
  14. }
  15. void real_64_to_c(double d){
  16. printf("%f\n",d);
  17. }
  18. void string_storage_to_c(char *s){
  19. printf("%s",s);
  20. }
  21. void any_to_c(void *a){
  22. if (a == NULL) {
  23. printf("NULL\n");
  24. }
  25. else {
  26. printf("not NULL\n");
  27. }
  28. }
  29. int c_int2eiffel(void){
  30. return -6;
  31. }
  32. char c_char2eiffel(void){
  33. return '\n';
  34. }
  35. void set_integer_attribute(int*attribute){
  36. *attribute=2;
  37. }
  38. int hello(void) {
  39. printf("Hello");
  40. return 1;
  41. }