Mercurial > hg > Members > kaito > longjump
comparison pointer_longjump.c @ 3:e6aa3b678e4a
remove ret from global_longjump.c
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 12 Nov 2013 15:22:04 +0900 |
parents | 76cd6ae48a1b |
children | d75a89b10176 |
comparison
equal
deleted
inserted
replaced
2:76cd6ae48a1b | 3:e6aa3b678e4a |
---|---|
5 __code code1(int n,void *__return,void *__enviroment,int *__ret_p){ | 5 __code code1(int n,void *__return,void *__enviroment,int *__ret_p){ |
6 void(*ret)(int,void *,int *); | 6 void(*ret)(int,void *,int *); |
7 printf("code1\n"); | 7 printf("code1\n"); |
8 ret = (void(*)(int,void *,int *))__return; | 8 ret = (void(*)(int,void *,int *))__return; |
9 ret(n,__enviroment,__ret_p); | 9 ret(n,__enviroment,__ret_p); |
10 //((void(*)(int,void *,int *))__return)(n,__enviroment,__ret_p); | |
10 } | 11 } |
11 | 12 |
12 void *return1 (int n,void* env,int* __ret_p){ | 13 void *return1 (int n,void* env,int* __ret_p){ |
13 printf("return1\n"); | 14 printf("return1\n"); |
14 *__ret_p = n; | 15 *__ret_p = n; |
16 } | 17 } |
17 | 18 |
18 int main1 (){ | 19 int main1 (){ |
19 void *__return; | 20 void *__return; |
20 void *__enviroment; | 21 void *__enviroment; |
21 int *__ret_p; | 22 int *__ret_p; |
22 printf("main1 entry\n"); | 23 printf("main1 entry\n"); |
23 __enviroment = (void*)malloc(sizeof(jmp_buf)); | 24 __enviroment = (void*)malloc(sizeof(jmp_buf)); |
24 __ret_p = (int*)malloc(sizeof(int)); | 25 __ret_p = (int*)malloc(sizeof(int)); |
25 if (setjmp(__enviroment)){ | 26 if (setjmp(__enviroment)){ |
26 free(__enviroment); | 27 free(__enviroment); |