/* Generated by CIL v. 1.5.1 */ /* print_CIL_Input is true */ #include int babel_wrapper_foo1(int n) // function name insert { // wrapper for function foo1 // function name insert int return_value; // return value type (how about array type) //rountine code int func; PlTerm arg[2]; // function variable + return value insert PlBool res; func = Pl_Find_Atom("foo1"); // function name insert //routine code Pl_Query_Begin(PL_TRUE); //prepare parameters //partial routine code, pass in parameter // we need to init arguments and return value // arg[0] = Pl_Mk_Integer(n); arg[0] = Pl_Mk_Integer(n); //routine code, reserve a place for return value arg[1] = Pl_Mk_Variable(); //partial routine code, 2 is not routine. (number of arguments) + 1 res = Pl_Query_Call(func, 2, arg); // insert (variable+return value) //get return value, partial routine code, 1 is not routine return_value = Pl_Rd_Integer(arg[1]); // insert () //routine code //Pl_Query_End(PL_KEEP_FOR_PROLOG); Pl_Query_End(PL_RECOVER); //routine code return return_value; } int babel_wrapper_foo() // function name insert { // wrapper for function foo // function name insert int return_value; // return value type (how about array type) //rountine code int func; PlTerm arg[1]; // function variable + return value insert PlBool res; func = Pl_Find_Atom("foo"); // function name insert //routine code Pl_Query_Begin(PL_TRUE); //prepare parameters //partial routine code, pass in parameter // we need to init arguments and return value // arg[0] = Pl_Mk_Integer(n); //routine code, reserve a place for return value arg[0] = Pl_Mk_Variable(); //partial routine code, 2 is not routine. (number of arguments) + 1 res = Pl_Query_Call(func, 1, arg); // insert (variable+return value) //get return value, partial routine code, 1 is not routine return_value = Pl_Rd_Integer(arg[0]); // insert () //routine code //Pl_Query_End(PL_KEEP_FOR_PROLOG); Pl_Query_End(PL_RECOVER); //routine code return return_value; } #line 3 "simple.c" int foo1(int n ) ; #line 4 extern int ( /* missing proto */ printf)() ; #line 1 "simple.c" int foo(void) { int a ; int tmp ; int __retres3 ; { #line 3 return babel_wrapper_foo(); #line 3 tmp = foo1(23); #line 3 a = tmp; #line 4 printf("%d\n", a); #line 5 __retres3 = 0; #line 1 return (__retres3); } } #line 8 "simple.c" int foo1(int n ) { int t ; { #line 10 return babel_wrapper_foo1(n); #line 10 t = n + 1; #line 11 return (t); } } #line 14 "simple.c" int main(int argc , char **argv ) { int __retres3 ; { Pl_Start_Prolog(argc, argv); #line 16 foo(); #line 18 __retres3 = 0; { Pl_Stop_Prolog(); #line 14 return (__retres3); } } }