1 #include <stdio.h> 2 3 int test_func_1(int joe) { 4 return(joe * joe); 5 } 6 void test_func_1_end(void) { 7 return; 8 } 9 10 int test_func_2(int bob, int joe) { 11 return(joe + bob * 2); 12 } 13 void test_func_2_end(void) { 14 return; 15 } 16 17 int hax_it(void) { 18 return(42); 19 } 20 void hax_it_end(void) { 21 return; 22 } 23 24 #define print_func(x) { \ 25 unsigned char *fp; \ 26 printf("unsigned char" #x "[] = {"); \ 27 fp = x; \ 28 while (((void *) fp) < ((void *) x ## _end)) { \ 29 if (((void *) fp) != ((void *) x)) { \ 30 printf(", "); \ 31 }; \ 32 printf("\\x%02x", *fp); \ 33 fp++; \ 34 }; \ 35 printf("};\n"); \ 36 } 37 38 int main(int argc, char **argv) { 39 40 print_func(test_func_1); 41 print_func(test_func_2); 42 print_func(hax_it); 43 44 return(0); 45 } |