PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/external/C/c_glue2.c

http://github.com/tybor/Liberty
C | 40 lines | 25 code | 9 blank | 6 comment | 0 complexity | e0bca70ea86bdd25445c06e0751cb14f MD5 | raw file
 1/* Hand-written C code to be used with example2.e */
 2
 3#include <stdio.h>
 4
 5void write_integer_attribute(int*attribute) {
 6  /* 
 7     Assume an Eiffel INTEGER is really mapped as a C int.
 8     Have a look is sys/runtime/base.h
 9     One can also use the -cecil interface to be always compatible.
10  */
11  *attribute=2;
12}
13
14void call_back_1(void* target, void*routine_ptr) {
15  ((void (*)(void*))routine_ptr)(target);
16}
17
18int call_back_2(void* target, void*routine_ptr) {
19  return (((int (*)(void*))routine_ptr)(target));
20}
21
22int call_back_3(void* target, void*routine_ptr, void*eiffel_string) {
23  return (((int (*)(void*,void*))routine_ptr)(target,eiffel_string));
24}
25
26int call_back_4(void* target, void*routine_ptr, void*eiffel_string) {
27  return (((int (*)(void*,void*,char))routine_ptr)(target,eiffel_string,'G'));
28}
29
30void call_back_5(void* target, void*routine_ptr) {
31  (((void (*)(void*,void*))routine_ptr)(target,target));
32}
33
34void call_back_6(void* target, void*routine_ptr) {
35  (((void (*)(void*))routine_ptr)(target));
36}
37
38int call_back_7(void* target, void*routine_ptr) {
39  return ((((int (*)(void*))routine_ptr)(target)));
40}