Mercurial > hg > CbC > CbC_examples
changeset 27:586096c45873
clean up
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 May 2020 07:19:57 +0900 |
parents | 1db97badc4e0 |
children | 51f8521bc5d1 |
files | Makefile arg.c asmtest2.c assignment.c bug.c c-next.c c-next1.c code_segment_pointer_check/Makefile conv.c conv1.c conv1/Makefile conv1/benchmark.sh conv1/conv1.c conv1/conv1.h conv1/conv2.c fact-a.c fact-a2.c fact-rectype.c factorial/factorial.c goto.c ljtes/Makefile ljtes/a.out ljtes/benchmark.sh ljtes/lj ljtes/lj_as ljtes/ljtes.c ljtes/ljtes_as.c ljtes/ljtes_as2.c loto6.c matrix/compute_power.c matrix/matrix.c matrix/matrix.h normal.c normal2.c parallel_check/c-int-double.c parallel_check/c-int.c parallel_check/c-struct.c proto.c protoGenCheck/Makefile protoGenCheck/fibonacci.c protoGenCheck/noProtoFibonacci.c quicksort/Makefile quicksort/quicksort_c.c rectype/rectype.cbc rectype/struct.cbc rectypeTest/Makefile rectypeTest/inparm.cbc rectypeTest/instruct.cbc rectypeTest/rectypeTest1.c rectypeTest/rectypeTest1.cbc rectypeTest/segmentfault.c rectypeTest/struct.cbc rectypeTest/struct2.cbc rectypeTest/typedef.cbc rectypeTest/typedef2.cbc rectypeTest/typedef3.cbc regexp/dfareg return_check/test_return.c return_check/typedeffed.c return_check/variable_return_type.c selftype.c stack1.c test01.c test02.c test03.c test04.c test05.c test1.c test2.c test_array.c test_call.c test_cs.c test_csp1.c test_env.c test_func2code.c test_nest.c test_para.c test_para2.c test_para3.c test_para4.c test_return.c test_struct.c test_tailcall1.c test_tree.c tmp1.c tmp2.c tmp4.c tmpa.c too-long-argument.c |
diffstat | 89 files changed, 1136 insertions(+), 3546 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sat Mar 21 09:15:18 2020 +0900 +++ b/Makefile Sat May 23 07:19:57 2020 +0900 @@ -1,19 +1,14 @@ -CC=/Users/e105711/prog/seminar/CbC/llvmInst/bin/clang -TARGET=bug conv fact-a loto6 normal normal2 test01 test02 test04 test05 test_array test_call test_cs test_para test_para2 test_para4 test_return test_struct test_tailcall1 test_tree tmp1 tmp2 tmp4 test_csp1 test_func2code tmpa too-long-argument test1 stack1 test2 arg test_para3 proto assignment +TEST = arg.exe conv1.exe fact-a.exe goto.exe loto6.exe stack1.exe test02.exe test05.exe test1.exe test2.exe test_cs.exe test_csp1.exe test_func2code.exe test_para2.exe test_para3.exe test_para4.exe test_para.exe test_tree.exe tmp1.exe tmp2.exe tmp4.exe tmpa.exe too-long-argument.exe c-next.exe -CFLAGS= -D"CLANG" -.SUFFIXES: .c .s +.SUFFIXES: .exe -.PHONY: all -all: $(TARGET) +.c.exe : + ${CBC_COMPILER} $(CFLAGS) -o $@ $< -.c.s: - $(CC) $(CFLAGS) -S $< +test : $(TEST) + for exe in ${TEST} ; do \ + ./$${exe} ; \ + done -$(TARGET): $(TARGET:%=%.s) - $(CC) -o $@ $(@:%=%.s) - -.PHONY: clean -clean: - rm -f $(TARGET) - rm -f *.o *.s +clean : + rm -f ${TEST}
--- a/arg.c Sat Mar 21 09:15:18 2020 +0900 +++ b/arg.c Sat May 23 07:19:57 2020 +0900 @@ -1,7 +1,11 @@ #include "stdio.h" +#define __environment _CbC_environment +#define __return _CbC_return + + struct arg { - int a0;int a1;int a2;int a3;int a4; + int a0;int a1;int a2;int a3;int a4; }; extern void exit(int); @@ -9,72 +13,79 @@ void *exit_env; __code (*exit___code)(); -int main1(int n); +// #ifndef __llvm__ +__code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env); +__code cargs(struct arg args0,__code exit1(int, void*),void *env); +__code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l); +__code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l); +__code carg6(int i, int j,int k,int l,struct arg args0); +// #endif __code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env) { - printf("#0017:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env); - goto carg2(arg1,arg2,arg3,arg4,arg0,exit1,env); + printf("#0017:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env); + goto carg2(arg1,arg2,arg3,arg4,arg0,exit1,env); } __code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env) { - struct arg args0; - printf("#0024:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env ); - args0.a0 = arg0; - args0.a1 = arg1; - args0.a2 = arg2; - args0.a3 = arg3; - args0.a4 = arg4; - goto cargs(args0,exit1,env); + struct arg args0; + printf("#0024:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env ); + args0.a0 = arg0; + args0.a1 = arg1; + args0.a2 = arg2; + args0.a3 = arg3; + args0.a4 = arg4; + goto cargs(args0,exit1,env); } -__code cargs(struct arg args0,__code(*exit1)(int, void*),void *env) +__code cargs(struct arg args0,__code exit1(int, void*),void *env) { - printf("#0035:args: %d %d %d %d %d : %x %x\n", - args0.a0,args0.a1,args0.a2,args0.a3,args0.a4, - exit1==exit___code,env==exit_env); - goto (*exit1)(0,env); + printf("#0035:args: %d %d %d %d %d : %x %x\n", + args0.a0,args0.a1,args0.a2,args0.a3,args0.a4, + exit1==exit___code,env==exit_env); + // goto exit1(321),env; + goto (*exit1)(0,env); } __code carg3(struct arg args0,struct arg args1,int i, int j,int k,int l) { - printf("#0045:args3: %d %d %d %d %d : %x %x %x %x\n", - args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); - printf("#0047:args3: args0 %d %d %d %d %d : args1 %d %d %d %d %d : %x %x %x %x\n", - args0.a0,args0.a1,args0.a2,args0.a3,args0.a4, - args1.a0,args1.a1,args1.a2,args1.a3,args1.a4, - i,j,k,l); - if (args0.a0==args1.a0) exit(0); - goto carg4(args0,args1,j,k,l,i); + printf("#0045:args3: %d %d %d %d %d : %x %x %x %x\n", + args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); + printf("#0047:args3: args0 %d %d %d %d %d : args1 %d %d %d %d %d : %x %x %x %x\n", + args0.a0,args0.a1,args0.a2,args0.a3,args0.a4, + args1.a0,args1.a1,args1.a2,args1.a3,args1.a4, + i,j,k,l); + if (args0.a0==args1.a0) exit(0); + goto carg4(args0,args1,j,k,l,i); } __code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l) { - printf("#0057:args4: %d %d %d %d %d : %x %x %x %x\n", - args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); - goto carg5(args1,args0,j,k,l,i); + printf("#0057:args4: %d %d %d %d %d : %x %x %x %x\n", + args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); + goto carg5(args1,args0,j,k,l,i); } __code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l) { - printf("#0064:args5: %d %d %d %d %d : %x %x %x %x\n", - args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); - goto carg6(i,j,k,l,args0); + printf("#0064:args5: %d %d %d %d %d : %x %x %x %x\n", + args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); + goto carg6(i,j,k,l,args0); } __code carg6(int i, int j,int k,int l,struct arg args0) { - printf("#0071:args6: %d %d %d %d %d : %x %x %x %x\n", - args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); - goto carg3(args0,args0,i,j,k,l); + printf("#0071:args6: %d %d %d %d %d : %x %x %x %x\n", + args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); + goto carg3(args0,args0,i,j,k,l); } int main1(int n) { - goto carg1(0,1,2,3,4,exit___code=__return,exit_env=__environment); - return n; + goto carg1(0,1,2,3,4,exit___code=__return,exit_env=__environment); + return n; } struct arg a00; @@ -82,20 +93,20 @@ int main( int ac, char *av[]) { - int n; - n = main1(123); - printf("#0089:321=%d\n",n); + int n; + n = main1(123); + printf("#0089:321=%d\n",n); - a00.a0 = 11; - a00.a1 = 22; - a00.a2 = 33; - a00.a3 = 44; - a00.a4 = 55; - a01.a0 = 66; - a01.a1 = 77; - a01.a2 = 88; - a01.a3 = 99; - a01.a4 = 10; - goto carg3(a00,a01,1,2,3,4); + a00.a0 = 11; + a00.a1 = 22; + a00.a2 = 33; + a00.a3 = 44; + a00.a4 = 55; + a01.a0 = 66; + a01.a1 = 77; + a01.a2 = 88; + a01.a3 = 99; + a01.a4 = 10; + goto carg3(a00,a01,1,2,3,4); }
--- a/asmtest2.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#include <stdio.h> - - -struct __CbC_env{ - void *ret_p,*env; -}; - -__code factorial(int n,int result,int orig,__code(*print)(int,int,int,__code(*)(),void*), void *exit1env) -{ - if (n<0) { - printf("#0008:err %d!\n",n); - return; - goto return_cs(0, exit1env); - } - if (n==0) - goto (*print)(n,result,orig,print,exit1env); - else { - result *= n; - n--; - goto factorial(n,result,orig,print,exit1env); - } -} - -int main( int ac, char *av[]) -{ - int n; - n = 10; - void *env = ({ - struct __CbC_env __CbC_environment; - env = &__CbC_environment; - jmp_buf env_buf; - int retval; - __CbC_environment.ret_p = &retval; - __CbC_environment.env = &env_buf; - // if (setjmp(__CbC_environment.env)){ - /* if (save_env(__CbC_environment)){ */ - /* return retval; */ - /* } */ - asm volatile( - "movq 0x8(%%rdi), %%r10;" // %r10 = env.env; - "movq %%rbp, 0x8(%%r10);" // env.env[1] = %rbp; frame pointer - "movq %%rsp, 0x10(%%r10);" // env.env[2] = %rsp; stack pointer - "jmp MAIN_AFTER_SET;" // escape from asm - "MAIN_RET_POINT:;" // return point - "movq %%rbp, %%rsp;" // fix stack pointer - "popq %%rbp;" // pop - "retq;" // return - "MAIN_AFTER_SET:;" // escape point - :"+D"(env)::"r10","eax"); - &__CbC_environment; - }); - goto factorial(n,1,n,print,env); - return 10; -} - -__code return_cs(int val, void* env){ - asm volatile( - "movq 0x8(%%rdi), %%r10;" // %r10 = env.env (environment) - "movq 0x8(%%r10), %%rbp;" // restore frame pointer - "movq 0x10(%%r10), %%rsp;" // restore stack pointer - "movl $12, %%eax;" // return value - "jmp MAIN_RET_POINT;" // goto previous environment - :"+D"(env)::"r10","eax"); -} - -__code print(int n,int result,int orig,__code(*print)(),void*exit1env) -{ - printf("#0032:%d! = %d\n",orig, result); - goto return_cs(0, exit1env); -}
--- a/assignment.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -#include<stdio.h> - -int main(){ - goto test(1,'a'); -} - -__code test(int i, char c){ - __code (*csp)(int,char,double) = test2; - goto (*csp)(i,c,0.2); -} - -__code test2(int i, char c, double d){ - printf("i : %d \n",i); - printf("i : %c \n",c); - printf("i : %f \n",d); -}
--- a/bug.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#include<stdio.h> - -typedef void (*atexit_callback)(void); -typedef void (*cxa_atexit_callback)(void *); -struct one_atexit_routine -{ - int callback; -}; - - -static int -atexit_common (const struct one_atexit_routine *r, const void *dso) - - -{ - return 0; -} - -int main(){ - printf("hello\n"); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c-next.c Sat May 23 07:19:57 2020 +0900 @@ -0,0 +1,102 @@ +#define NEXT_OP(i) (i->op = *(MVMuint16 *)(i->cur_op), i->cur_op += 2, i->op) + +typedef unsigned short MVMuint16; +typedef unsigned char MVMuint8; +typedef long* MVMRegister; +typedef void* MVMCompUnit; +typedef void* MVMCallsite; + +typedef struct MVMThreadContext { + MVMuint8 **interp_cur_op; + MVMuint8 **interp_bytecode_start; + MVMRegister **interp_reg_base; + MVMCompUnit **interp_cu; +} MVMThreadContext; + + +typedef struct interp { + MVMuint16 op; + /* Points to the place in the bytecode right after the current opcode. */ + /* See the NEXT_OP macro for making sense of this */ + MVMuint8 *cur_op; + + /* The current frame's bytecode start. */ + MVMuint8 *bytecode_start; + + /* Points to the base of the current register set for the frame we + * are presently in. */ + MVMRegister *reg_base; + + /* Points to the current compilation unit. */ + MVMCompUnit *cu; + + /* The current call site we're constructing. */ + MVMCallsite *cur_callsite; + + MVMThreadContext *tc; + + __code (*main_ret)(int, void*); + void *env; + + } INTER,*INTERP; + +__code cbc_no_op(INTERP); +__code cbc_exit(INTERP); +__code cbc_next(INTERP); +__code cbc_gc(INTERP); + +__code (* CODES[])(INTERP) = { + cbc_no_op, + cbc_no_op, + cbc_gc, + cbc_exit, +}; + +void gc(int * p, INTERP i){ + i->reg_base = (MVMRegister *)p; + return; +} + +__code cbc_gc(INTERP i){ + int test = 3; + gc(&test,i); + goto cbc_next(i); +} + +__code cbc_next(INTERP i){ + __code (*c)(INTERP); + c = CODES[NEXT_OP(i)]; + // c(i); + goto c(i); +} + +__code cbc_no_op(INTERP i){ + goto cbc_next(i); +} + +__code cbc_exit(INTERP i){ + goto i->main_ret(0,i->env); +} + + +int interp_run(MVMThreadContext *tc){ + INTER inter = {0,0,0,0,0,0,0,0,0}; + INTERP i = &inter; + MVMuint16 cur_op[] = {0,1,1,0,1,2,3}; + i->main_ret = _CbC_return; + i->env = _CbC_environment; + i->cur_op = (MVMuint8 *)cur_op; + + tc->interp_cur_op = &i->cur_op; + tc->interp_bytecode_start = &i->bytecode_start; + tc->interp_reg_base = &i->reg_base; + tc->interp_cu = &i->cu; + goto cbc_next(i); + return 0; +} + +int main(int argc, char **argv){ + MVMThreadContext tct = {0,0,0,0}; + MVMThreadContext* tc = &tct; + interp_run(tc); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c-next1.c Sat May 23 07:19:57 2020 +0900 @@ -0,0 +1,100 @@ +#define NEXT_OP(i) (i->op = *(MVMuint16 *)(i->cur_op), i->cur_op += 2, i->op) + +typedef unsigned short MVMuint16; +typedef unsigned char MVMuint8; +typedef long* MVMRegister; +typedef void* MVMCompUnit; +typedef void* MVMCallsite; +//typedef void* MVMThreadContext; + +typedef struct MVMThreadContext { + MVMuint8 **interp_cur_op; + MVMuint8 **interp_bytecode_start; + MVMRegister **interp_reg_base; + MVMCompUnit **interp_cu; +} MVMThreadContext; + + +typedef struct interp { + MVMuint16 op; + /* Points to the place in the bytecode right after the current opcode. */ + /* See the NEXT_OP macro for making sense of this */ + MVMuint8 *cur_op; + + /* The current frame's bytecode start. */ + MVMuint8 *bytecode_start; + + /* Points to the base of the current register set for the frame we + * * are presently in. */ + MVMRegister *reg_base; + + /* Points to the current compilation unit. */ + MVMCompUnit *cu; + + /* The current call site we're constructing. */ + MVMCallsite *cur_callsite; + + MVMThreadContext *tc; + + //__code (*ret)(); + //__code (*main_ret)(); + __code (*ret)(int, void*); + __code (*main_ret)(int, void*); + void *env; + + } INTER,*INTERP; + +__code cbc_no_op(INTERP); +__code cbc_exit(INTERP); + +__code (* CODES[])(INTERP) = { + cbc_no_op, + cbc_no_op, + cbc_exit, +}; + +__code cbc_next(INTERP i){ + __code (*c)(INTERP); + c = CODES[NEXT_OP(i)]; + c(i); + goto c(i); +} + +__code cbc_no_op(INTERP i){ + goto cbc_next(i); +} + +__code cbc_exit(INTERP i){ + goto i->main_ret(0,i->env); +} + +//__code main_return(int i,stack sp) { +// if (loop-->0) +// goto f(233,sp); +// printf("#0103:%d\n",i); +// goto (( (struct main_continuation *)sp)->main_ret)(0, +// ((struct main_continuation *)sp)->env); +//} + +int interp_run(MVMThreadContext *tc){ + INTER inter = {0,0,0,0,0,0,0,0,0}; + INTERP i = &inter; + MVMuint8 cur_op[] = {0,1,1,0,1,2}; +// i->ret = main_return; + i->main_ret = _CbC_return; + i->env = _CbC_environment; + i->cur_op = cur_op; + + tc->interp_cur_op = &i->cur_op; + tc->interp_bytecode_start = &i->bytecode_start; + tc->interp_reg_base = &i->reg_base; + tc->interp_cu = &i->cu; + goto cbc_next(i); + return 0; +} + +int main(int argc, char **argv){ + MVMThreadContext tct = {0,0,0,0}; + MVMThreadContext* tc = &tct; + interp_run(tc); +}
--- a/code_segment_pointer_check/Makefile Sat Mar 21 09:15:18 2020 +0900 +++ b/code_segment_pointer_check/Makefile Sat May 23 07:19:57 2020 +0900 @@ -1,8 +1,8 @@ -CbCC=/Users/e105711/prog/seminar/CbC/gcc-inst/bin/gcc +CbCC=../../../build_cbc44/INSTALL_DIR/bin/gcc #CC=gcc -CC=/Users/e105711/prog/seminar/CbC/gcc-inst/bin/gcc +CC=../../../build_cbc44/INSTALL_DIR/bin/gcc # fastcall版では-O0,-O2は動作確認、-O3以上はだめ
--- a/conv.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -#include "stdio.h" - -#ifdef CLANG -#define _CbC_return __return -#define _CbC_environment __environment -#endif - -int g0(int i) { - return i+4; -} - -int f0(int i) { - int k,j; - k = 3+i; - j = g0(i+3); - return k+4+j; -} - -typedef void *stack; - -__code f_g0(int i,int k,stack sp) ; - -struct cont_interface { // General Return Continuation - __code (*ret)(int, void*); -}; - -__code f(int i,stack sp) { - int k,j; - k = 3+i; - goto f_g0(i,k,sp); -} - -struct f_g0_interface { // Specialized Return Continuation - __code (*ret)(); - int i_,k_,j_; -}; - -__code f_g1(int j,stack sp); -__code g(int i,stack sp) ; - -__code f_g0(int i,int k,stack sp) { // Caller - struct f_g0_interface *c = - (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface)); - - c->ret = f_g1; - c->k_ = k; - c->i_ = i; - - goto g(i+3,sp); -} - -__code f_g1(int j,stack sp) { // Continuation - struct f_g0_interface *c = (struct f_g0_interface *)sp; - int k = c->k_; - sp += sizeof(struct f_g0_interface); - goto (( (struct cont_interface *)sp)->ret)(k+4+j,sp); -} - -__code g(int i,stack sp) { - goto (( (struct cont_interface *)sp)->ret)(i+4,sp); -} - -struct main_continuation { // General Return Continuation - __code (*ret)(int, void*); - __code (*main_ret)(int, void*); - void *env; -}; - -__code main_return(int i,stack sp) { - printf("#0061:%d\n",i); - goto (( (struct main_continuation *)sp)->main_ret)(i, - ((struct main_continuation *)sp)->env); -} - -#define STACK_SIZE 2048 -char main_stack[STACK_SIZE]; -#define stack_last (&main_stack[STACK_SIZE]) - -typedef __code (*return_type)(int, void*); -int -main(int argc, char **argv) -{ - struct main_continuation *cont; - stack sp = stack_last; - - printf("#0075:%d\n",f0(233)); - - sp -= sizeof(*cont); - cont = (struct main_continuation *)sp; - cont->ret = main_return; - cont->main_ret = (return_type) _CbC_return; - cont->env = _CbC_environment; - goto f(233,sp); -} - -/* end */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conv1.c Sat May 23 07:19:57 2020 +0900 @@ -0,0 +1,246 @@ +#include "stdio.h" + +extern int atoi (const char *); + +static int loop; + +#if 1 // def __micro_c__ +#define CC_ONLY 0 +#else +#define CC_ONLY 1 +#endif + +/* classical function call case (0) */ +int g0(int); +int h0(int); + +int +f0(int i) { + int k,j; + k = 3+i; + j = g0(i+3); + return k+4+j; +} + +int +g0(int i) { + return h0(i+4)+i; +} + +int +h0(int i) { + return i+4; +} + +#if !CC_ONLY + +/* straight conversion case (1) */ + +typedef void *stack; + +struct cont_interface { // General Return Continuation + __code (*ret)(int, void *); +}; + +#ifndef __llvm__ +__code f_g0(int i,int k,stack sp); +__code f_g1(int j,stack sp); +__code g(int i,stack sp); +__code h(int i,stack sp); +__code f2(int i,char *sp); +__code g2(int i,int k,int j,char *sp); +__code h2(int i,int k,char *sp); +__code main_return2(int i,stack sp); +__code g2_1(int k,int i,stack *sp); +__code h2_11(int i,int k,stack *sp); +#endif + +__code f(int i,stack sp) { + int k,j; + k = 3+i; + goto f_g0(i,k,sp); +} + +struct f_g0_interface { // Specialized Return Continuation + __code (*ret)(int, void *); + int i_,k_,j_; +}; + +__code f_g1(int j,stack sp); + +__code f_g0(int i,int k,stack sp) { // Caller + struct f_g0_interface *c = + (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface)); + + c->ret = f_g1; + c->k_ = k; + c->i_ = i; + + goto g(i+3,sp); +} + +__code f_g1(int j,stack sp) { // Continuation + struct f_g0_interface *c = (struct f_g0_interface *)sp; + int k = c->k_; + sp+=sizeof(struct f_g0_interface); + c = (struct f_g0_interface *)sp; + goto (c->ret)(k+4+j,sp); +} + +__code g_h1(int j,stack sp); + +__code g(int i,stack sp) { // Caller + struct f_g0_interface *c = + (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface)); + + c->ret = g_h1; + c->i_ = i; + + goto h(i+3,sp); +} + +__code g_h1(int j,stack sp) { // Continuation + struct f_g0_interface *c = (struct f_g0_interface *)sp; + int i = c->i_; + sp+=sizeof(struct f_g0_interface); + c = (struct f_g0_interface *)sp; + goto (c->ret)(j+i,sp); +} + +__code h(int i,stack sp) { + struct f_g0_interface *c = (struct f_g0_interface *)sp; + goto (c->ret)(i+4,sp); +} + +struct main_continuation { // General Return Continuation + __code (*ret)(int, void*); + __code (*main_ret)(int, void*); + void *env; +}; + +__code main_return(int i,stack sp) { + if (loop-->0) + goto f(233,sp); + printf("#0103:%d\n",i); + goto (( (struct main_continuation *)sp)->main_ret)(0, + ((struct main_continuation *)sp)->env); +} + +/* little optimzation without stack continuation (2) */ + +__code f2(int i,char *sp) { + int k,j; + k = 3+i; + goto g2(i,k,i+3,sp); +} + +__code g2(int i,int k,int j,char *sp) { + j = j+4; + goto h2(i,k+4+j,sp); +} + +__code h2_1(int i,int k,int j,char *sp) { + goto main_return2(i+j,sp); +} + +__code h2(int i,int k,char *sp) { + goto h2_1(i,k,i+4,sp); +} + +__code main_return2(int i,stack sp) { + if (loop-->0) + goto f2(233,sp); + printf("#0132:%d\n",i); + goto (( (struct main_continuation *)sp)->main_ret)(0, + ((struct main_continuation *)sp)->env); +} + +/* little optimizaed case (3) */ + +__code f2_1(int i,stack *sp) { + int k,j; + k = 3+i; + goto g2_1(k,i+3,sp); +} + +__code g2_1(int k,int i,stack *sp) { + goto h2_11(k,i+4,sp); +} + +__code f2_0_1(int k,int j,stack *sp); +__code h2_1_1(int i,int k,int j,stack *sp) { + goto f2_0_1(k,i+j,sp); +} + +__code h2_11(int i,int k,stack *sp) { + goto h2_1_1(i,k,i+4,sp); +} + +__code f2_0_1(int k,int j,stack *sp) { + goto (( (struct cont_interface *)sp)->ret)(k+4+j,sp); +} + +__code main_return2_1(int i,stack sp) { + if (loop-->0) + goto f2_1(233,sp); + printf("#0165:%d\n",i); + goto (( (struct main_continuation *)sp)->main_ret)(0, + ((struct main_continuation *)sp)->env); +} + +#define STACK_SIZE 2048 +char main_stack[STACK_SIZE]; +#define stack_last (main_stack+STACK_SIZE) + +#endif + +#define LOOP_COUNT 10000000 + +int +main(int ac,char *av[]) +{ +#if !CC_ONLY + struct main_continuation *cont; + stack sp = stack_last; +#endif + int sw; + int j; + if (ac==2) sw = atoi(av[1]); + else sw=3; + + if (sw==0) { + for(loop=0;loop<LOOP_COUNT;loop++) { + j = f0(233); + } + printf("#0193:%d\n",j); +#if !CC_ONLY + } else if (sw==1) { + loop = LOOP_COUNT; + sp -= sizeof(*cont); + cont = (struct main_continuation *)sp; + cont->ret = main_return; + cont->main_ret = _CbC_return; + cont->env = _CbC_environment; + goto f(233,sp); + } else if (sw==2) { + loop = LOOP_COUNT; + sp -= sizeof(*cont); + cont = (struct main_continuation *)sp; + cont->ret = main_return2; + cont->main_ret = _CbC_return; + cont->env = _CbC_environment; + goto f2(233,sp); + } else if (sw==3) { + loop = LOOP_COUNT; + sp -= sizeof(*cont); + cont = (struct main_continuation *)sp; + cont->ret = main_return2_1; + cont->main_ret = _CbC_return; + cont->env = _CbC_environment; + goto f2_1(233,sp); +#endif + } +return 0; +} + +/* end */
--- a/conv1/Makefile Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -CC=/Users/e105711/prog/seminar/CbC/llvmInst/Debug+Asserts/bin/clang -TARGET=conv1 - -CFLAGS= -D"CLANG" -.SUFFIXES: .c .s - -.PHONY: all -all: $(TARGET) - -.c.s: - $(CC) $(CFLAGS) -S $< - -$(TARGET): $(TARGET:%=%.s) - $(CC) -o $@ $(@:%=%.s) - -.PHONY: clean -clean: - rm -f $(TARGET) - rm -f *.o *.s - -time: - for exe in *; do \ - if [ -x $$exe ]; then \ - echo $$exe; \ - time ./$$exe; \ - fi; \ - done -
--- a/conv1/benchmark.sh Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#!/usr/bin/env zsh - -time=/usr/bin/time -CONV1=./$1 -num=10 - -count=0 -amount=0 -max=0 -min=99999 - -echo "$CONV1 $2" -while [[ $count -lt $num ]]; do - # /usr/bin/time -p ./conv1 1 2>&1 >& - |grep '^user'|tr -s " "|cut -f2 -d" " - usertime=$( $time -p $CONV1 $2 2>&1 >& - |grep '^user'|tr -s " " |cut -f2 -d" ") - echo $usertime - - amount=$(($usertime+$amount)) - if [[ $usertime -lt $min ]]; then - min=$usertime - fi - if [[ $usertime -gt $max ]]; then - max=$usertime - fi - count=$(($count+1)) -done - -echo "amount time = $amount" -echo "maxtime = $max" -echo "mintime = $min" - - -amount=$(($amount - $max - $min)) -echo "amount time - mintime - maxtime = $amount" -count=$(($count-2)) -echo "count = $count" -averagetime=$(($amount/($count))) -echo "average time = $averagetime" -
--- a/conv1/conv1.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -static int loop; - -#if 1 // def __micro_c__ -#define CC_ONLY 0 -#else -#define CC_ONLY 1 -#endif - -#ifdef GCC // for GCC -#define __return _CbC_return -#define __environment _CbC_environment -#endif - -typedef char *stack; -int f0(int i); -int g0(int i); -int h0(int i); - -/* classical function call case (0) */ -int f0(int i) { - int k,j; - k = 3+i; - j = g0(i+3); - return k+4+j; -} - -int g0(int i) { - return h0(i+4)+i; -} - -int h0(int i) { - return i+4; -} - -#if !CC_ONLY - -/* straight conversion case (1) */ - -struct cont_interface { // General Return Continuation - __code (*ret)(int,stack); -}; - -__code f(int i,stack sp) { - int k,j; - k = 3+i; - goto f_g0(i,k,sp); -} - -struct f_g0_interface { // Specialized Return Continuation - __code (*ret)(int,stack); - int i_,k_,j_; -}; - - -__code f_g0(int i,int k,stack sp) { // Caller - struct f_g0_interface *c = - (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface)); - - c->ret = f_g1; - c->k_ = k; - c->i_ = i; - - goto g(i+3,sp); -} - -__code f_g1(int j,stack sp) { // Continuation - struct f_g0_interface *c = (struct f_g0_interface *)sp; - int k = c->k_; - sp+=sizeof(struct f_g0_interface); - c = (struct f_g0_interface *)sp; - goto (c->ret)(k+4+j,sp); -} - - -__code g(int i,stack sp) { // Caller - struct f_g0_interface *c = - (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface)); - - c->ret = g_h1; - c->i_ = i; - - goto h(i+3,sp); -} - -__code g_h1(int j,stack sp) { // Continuation - struct f_g0_interface *c = (struct f_g0_interface *)sp; - int i = c->i_; - sp+=sizeof(struct f_g0_interface); - c = (struct f_g0_interface *)sp; - goto (c->ret)(j+i,sp); -} - -__code h(int i,stack sp) { - struct f_g0_interface *c = (struct f_g0_interface *)sp; - goto (c->ret)(i+4,sp); -} - -struct main_continuation { // General Return Continuation - __code (*ret)(int,stack); - __code (*main_ret)(int,void*); - void *env; -}; - -__code main_return(int i,stack sp) { - if (loop-->0) - goto f(233,sp); - printf("#0103:%d\n",i); - goto (( (struct main_continuation *)sp)->main_ret)(0, - ((struct main_continuation *)sp)->env); -} - -/* little optimzation without stack continuation (2) */ - -__code f2(int i,char *sp) { - int k,j; - k = 3+i; - goto g2(i,k,i+3,sp); -} - -__code g2(int i,int k,int j,char *sp) { - j = j+4; - goto h2(i,k+4+j,sp); -} - -__code h2_1(int i,int k,int j,char *sp) { - goto main_return2(i+j,sp); -} - -__code h2(int i,int k,char *sp) { - goto h2_1(i,k,i+4,sp); -} - -__code main_return2(int i,stack sp) { - if (loop-->0) - goto f2(233,sp); - printf("#0132:%d\n",i); - goto (( (struct main_continuation *)sp)->main_ret)(0, - ((struct main_continuation *)sp)->env); -} - -/* little optimizaed case (3) */ - -__code f2_1(int i,char *sp) { - int k,j; - k = 3+i; - goto g2_1(k,i+3,sp); -} - -__code g2_1(int k,int i,char *sp) { - goto h2_11(k,i+4,sp); -} - -__code h2_1_1(int i,int k,int j,char *sp) { - goto f2_0_1(k,i+j,sp); -} - -__code h2_11(int i,int k,char *sp) { - goto h2_1_1(i,k,i+4,sp); -} - -__code f2_0_1(int k,int j,char *sp) { - goto (( (struct cont_interface *)sp)->ret)(k+4+j,sp); -} - -__code main_return2_1(int i,stack sp) { - if (loop-->0) - goto f2_1(233,sp); - printf("#0165:%d\n",i); - exit(0); - //goto (( (struct main_continuation *)sp)->main_ret)(0, - //((struct main_continuation *)sp)->env); -} - -#define STACK_SIZE 2048 -char main_stack[STACK_SIZE]; -#define stack_last (main_stack+STACK_SIZE) - -#endif - -#define LOOP_COUNT 500000000 -int -main(int ac,char *av[]) -{ -#if !CC_ONLY - struct main_continuation *cont; - stack sp = stack_last; -#endif - int sw; - int j; - if (ac==2) sw = atoi(av[1]); - else sw=3; - - if (sw==0) { - for(loop=0;loop<LOOP_COUNT;loop++) { - j = f0(loop); - } - printf("#0193:%d\n",j); -#if !CC_ONLY - } else if (sw==1) { - loop = LOOP_COUNT; - sp -= sizeof(*cont); - cont = (struct main_continuation *)sp; - cont->ret = main_return; - cont->main_ret = __return; - cont->env = __environment; - goto f(loop,sp); - } else if (sw==2) { - loop = LOOP_COUNT; - sp -= sizeof(*cont); - cont = (struct main_continuation *)sp; - cont->ret = main_return2; - cont->main_ret = __return; - cont->env = __environment; - goto f2(loop,sp); - } else if (sw==3) { - loop = LOOP_COUNT; - sp -= sizeof(*cont); - cont = (struct main_continuation *)sp; - cont->ret = main_return2_1; - cont->main_ret = __return; - cont->env = __environment; - goto f2_1(loop,sp); -#endif - } - return 0; -} - -/* end */
--- a/conv1/conv1.h Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* defined in file conv1.c at offset 468 */ -__code f (int i,stack sp); - -/* defined in file conv1.c at offset 680 */ -__code f_g0 (int i,int k,stack sp); - -/* defined in file conv1.c at offset 897 */ -__code f_g1 (int j,stack sp); - -/* defined in file conv1.c at offset 1162 */ -__code g (int i,stack sp); - -/* defined in file conv1.c at offset 1355 */ -__code g_h1 (int j,stack sp); - -/* defined in file conv1.c at offset 1588 */ -__code h (int i,stack sp); - -/* defined in file conv1.c at offset 1838 */ -__code main_return (int i,stack sp); - -/* defined in file conv1.c at offset 2107 */ -__code f2 (int i,char *sp); - -/* defined in file conv1.c at offset 2189 */ -__code g2 (int i,int k,int j,char *sp); - -/* defined in file conv1.c at offset 2270 */ -__code h2_1 (int i,int k,int j,char *sp); - -/* defined in file conv1.c at offset 2346 */ -__code h2 (int i,int k,char *sp); - -/* defined in file conv1.c at offset 2410 */ -__code main_return2 (int i,stack sp); - -/* defined in file conv1.c at offset 2658 */ -__code f2_1 (int i,char *sp); - -/* defined in file conv1.c at offset 2742 */ -__code g2_1 (int k,int i,char *sp); - -/* defined in file conv1.c at offset 2844 */ -__code h2_1_1 (int i,int k,int j,char *sp); - -/* defined in file conv1.c at offset 2918 */ -__code h2_11 (int i,int k,char *sp); - -/* defined in file conv1.c at offset 2987 */ -__code f2_0_1 (int k,int j,char *sp); - -/* defined in file conv1.c at offset 3086 */ -__code main_return2_1 (int i,stack sp); - -int f0(int i); -int g0(int i); -int h0(int i);
--- a/conv1/conv2.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -static int loop; - -#if 1 // def __micro_c__ -#define CC_ONLY 0 -#else -#define CC_ONLY 1 -#endif - -#ifdef GCC // for GCC -#define __return _CbC_return -#define __environment _CbC_environment -#endif - -typedef char *stack; -int f0(int i); -int g0(int i); -int h0(int i); - -/* classical function call case (0) */ -int f0(int i) { - int k,j; - k = 3+i; - j = g0(i+3); - return k+4+j; -} - -int g0(int i) { - return h0(i+4)+i; -} - -int h0(int i) { - return i+4; -} - -#if !CC_ONLY - -/* straight conversion case (1) */ - - -struct cont_interface { // General Return Continuation - __code (*ret)(int,stack); -}; - -__code f(int i,stack sp) { - int k,j; - k = 3+i; - goto f_g0(i,k,sp); -} - -struct f_g0_interface { // Specialized Return Continuation - __code (*ret)(int,stack); - int i_,k_,j_; -}; - -__code f_g0(int i,int k,stack sp) { // Caller - struct f_g0_interface *c = - (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface)); - - c->ret = f_g1; - c->k_ = k; - c->i_ = i; - - goto g(i+3,sp); -} - -__code f_g1(int j,stack sp) { // Continuation - struct f_g0_interface *c = (struct f_g0_interface *)sp; - int k = c->k_; - sp+=sizeof(struct f_g0_interface); - c = (struct f_g0_interface *)sp; - goto (c->ret)(k+4+j,sp); -} - - -__code g(int i,stack sp) { // Caller - struct f_g0_interface *c = - (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface)); - - c->ret = g_h1; - c->i_ = i; - - goto h(i+3,sp); -} - -__code g_h1(int j,stack sp) { // Continuation - struct f_g0_interface *c = (struct f_g0_interface *)sp; - int i = c->i_; - sp+=sizeof(struct f_g0_interface); - c = (struct f_g0_interface *)sp; - goto (c->ret)(j+i,sp); -} - -__code h(int i,stack sp) { - struct f_g0_interface *c = (struct f_g0_interface *)sp; - goto (c->ret)(i+4,sp); -} - -struct main_continuation { // General Return Continuation - __code (*ret)(int,stack); - __code (*main_ret)(int,void*); - void *env; -}; - -__code main_return(int i,stack sp) { - if (loop-->0) - goto f(233,sp); - printf("#0103:%d\n",i); - asm ( - "movq (%%rdi), %%r10;" - "movq $0, (%%r10);" - "movq 0x8(%%rdi), %%r10;" - "movq 0x8(%%r10), %%rbp;" - "movq 0x10(%%r10), %%rsp;" - "jmpq *0x38(%%r10);" - :"+D"(((struct main_continuation *)sp)->env)::"r10" - ); -} - -/* little optimzation without stack continuation (2) */ - -__code f2(int i,char *sp) { - int k,j; - k = 3+i; - goto g2(i,k,i+3,sp); -} - -__code g2(int i,int k,int j,char *sp) { - j = j+4; - goto h2(i,k+4+j,sp); -} - -__code h2_1(int i,int k,int j,char *sp) { - goto main_return2(i+j,sp); -} - -__code h2(int i,int k,char *sp) { - goto h2_1(i,k,i+4,sp); -} - -__code main_return2(int i,stack sp) { - if (loop-->0) - goto f2(233,sp); - printf("#0132:%d\n",i); - goto (( (struct main_continuation *)sp)->main_ret)(0, - ((struct main_continuation *)sp)->env); -} - -/* little optimizaed case (3) */ - -__code f2_1(int i,char *sp) { - int k,j; - k = 3+i; - goto g2_1(k,i+3,sp); -} - -__code g2_1(int k,int i,char *sp) { - goto h2_11(k,i+4,sp); -} - -__code h2_1_1(int i,int k,int j,char *sp) { - goto f2_0_1(k,i+j,sp); -} - -__code h2_11(int i,int k,char *sp) { - goto h2_1_1(i,k,i+4,sp); -} - -__code f2_0_1(int k,int j,char *sp) { - goto (( (struct cont_interface *)sp)->ret)(k+4+j,sp); -} - -__code main_return2_1(int i,stack sp) { - if (loop-->0) - goto f2_1(233,sp); - printf("#0165:%d\n",i); - exit(0); - //goto (( (struct main_continuation *)sp)->main_ret)(0, - //((struct main_continuation *)sp)->env); -} - -#define STACK_SIZE 2048 -char main_stack[STACK_SIZE]; -#define stack_last (main_stack+STACK_SIZE) - -#endif - -#define LOOP_COUNT 500000000 -int -main(int ac,char *av[]) -{ -#if !CC_ONLY - struct main_continuation *cont; - stack sp = stack_last; -#endif - int sw; - int j; - if (ac==2) sw = atoi(av[1]); - else sw=3; - - if (sw==0) { - for(loop=0;loop<LOOP_COUNT;loop++) { - j = f0(loop); - } - printf("#0193:%d\n",j); -#if !CC_ONLY - } else if (sw==1) { - loop = LOOP_COUNT; - sp -= sizeof(*cont); - cont = (struct main_continuation *)sp; - cont->ret = main_return; - cont->main_ret = __return; - cont->env = __environment; - goto f(loop,sp); - } else if (sw==2) { - loop = LOOP_COUNT; - sp -= sizeof(*cont); - cont = (struct main_continuation *)sp; - cont->ret = main_return2; - cont->main_ret = __return; - cont->env = __environment; - goto f2(loop,sp); - } else if (sw==3) { - loop = LOOP_COUNT; - sp -= sizeof(*cont); - cont = (struct main_continuation *)sp; - cont->ret = main_return2_1; - cont->main_ret = __return; - cont->env = __environment; - goto f2_1(loop,sp); -#endif - } - return 0; -} - -/* end */
--- a/fact-a.c Sat Mar 21 09:15:18 2020 +0900 +++ b/fact-a.c Sat May 23 07:19:57 2020 +0900 @@ -1,36 +1,36 @@ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif #include "stdio.h" -__code factorial(int n,int result,int orig,__code(*print)(int,int,int,__code(*)(),__code(*)(),void*),__code(*exit1)(int,void *), void *exit1env) +__code factorial(int n,int result,int orig,__code(*print)(),__code(*exit1)(), void *exit1env) { if (n<0) { - printf("#0008:err %d!\n",n); - goto (*exit1)(0,exit1env); + printf("#0008:err %d!\n",n); + goto (*exit1)(0,exit1env); } if (n==0) - goto (*print)(n,result,orig,print,exit1,exit1env); + goto (*print)(n,result,orig,print,exit1,exit1env); else { - result *= n; - n--; - goto factorial(n,result,orig,print,exit1,exit1env); + result *= n; + n--; + goto factorial(n,result,orig,print,exit1,exit1env); } } +__code print(int n,int result,int orig,__code(*print)(),__code (*exit1)(),void*exit1env); int main( int ac, char *av[]) { - int n; - n = 10; - goto factorial(n,1,n,print,__return,__environment); + int n; + // n = atoi(av[1]); + n = 10; + goto factorial(n,1,n,print,__return,__environment); } -__code print(int n,int result,int orig,__code(*print)(),__code (*exit1)(int, void*),void*exit1env) +__code print(int n,int result,int orig,__code(*print)(),__code (*exit1)(),void*exit1env) { - printf("#0032:%d! = %d\n",orig, result); - goto (*exit1)(0,exit1env); + printf("#0032:%d! = %d\n",orig, result); + goto (*exit1)(0,exit1env); }
--- a/fact-a2.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#ifdef GCC -#define __environment _CbC_environment -#define __return _CbC_return -#endif - -#include "stdio.h" - -__code factorial(int n,int result,int orig,__code(*print)(int,int,int,__code(*)(),__code(*)(),void*),__code(*exit1)(int,void *), void *exit1env) -{ - if (n<0) { - printf("#0008:err %d!\n",n); - goto (*exit1)(0,exit1env); - } - if (n==0) - goto (*print)(n,result,orig,print,exit1,exit1env); - else { - result *= n; - n--; - goto factorial(n,result,orig,print,exit1,exit1env); - } -} - - -int main( int ac, char *av[]) -{ - int n; - n = 10; - goto factorial(n,1,n,print,__return,__environment); -} - -__code print(int n,int result,int orig,__code(*print)(),__code (*exit1)(int, void*),void*exit1env) -{ - printf("#0032:%d! = %d\n",orig, result); - goto (*exit1)(0,exit1env); -} -
--- a/fact-rectype.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#include <stdio.h> -#define __environment _CbC_environment -#define __return _CbC_return - -__code factorial(int n, int result, __rectype *print, __rectype *exit1, void *envp) -{ - if(n<0) { - print("#0008:err %dn",n); - goto (*exit1)(0, envp); - } - if (n==0) - goto (*print)(n,result,print,exit1, envp); - else { - result *= n; - n--; - goto factorial(n, result, print,exit1, envp); - } -} - -__code print(int n, int result, __rectype *print ,__rectype *exit1 ,void *envp); - -int main(int argc, char *argv[]) { - int n; - n = 10; - goto factorial(n,1,print,__return,__environment); -} - - -__code print(int n, int result, __rectype *print ,__rectype *exit1,void *envp){ - printf("#0032:%d = %d\n", n, result); - goto (*exit1)(0,envp); -}
--- a/factorial/factorial.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -__code print_factorial(int prod) -{ - printf("factorial = %d\n",prod); - exit(0); -} - -__code factorial0(int prod, int x) -{ - if ( x >= 1) { - goto factorial0(prod*x, x-1); - }else{ - goto print_factorial(prod); - } -} - -__code factorial(int x) -{ - goto factorial0(1, x); -} - -int -main(int argc, char **argv) -{ - int i; - i = atoi(argv[1]); - - goto factorial(i); -}
--- a/goto.c Sat Mar 21 09:15:18 2020 +0900 +++ b/goto.c Sat May 23 07:19:57 2020 +0900 @@ -74,7 +74,7 @@ goto (*conv)(0,env); } -main(int ac,char *av[]) { +int main(int ac,char *av[]) { exit0 = __return; env = __environment; conv = a2;
--- a/ljtes/Makefile Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -CC=/Users/e105711/prog/seminar/CbC/llvmInst/Debug+Asserts/bin/clang -TARGET=conv1 - -CFLAGS= -D"CLANG" -.SUFFIXES: .c .s - -.PHONY: all -all: $(TARGET) - -.c.s: - $(CC) $(CFLAGS) -S $< - -$(TARGET): $(TARGET:%=%.s) - $(CC) -o $@ $(@:%=%.s) - -.PHONY: clean -clean: - rm -f $(TARGET) - rm -f *.o *.s - -time: - for exe in *; do \ - if [ -x $$exe ]; then \ - echo $$exe; \ - time ./$$exe; \ - fi; \ - done -
--- a/ljtes/benchmark.sh Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#!/usr/bin/env zsh - -time=/usr/bin/time -CONV1=./$1 -num=10 - -count=0 -amount=0 -max=0 -min=99999 - -echo "$CONV1" -while [[ $count -lt $num ]]; do - # /usr/bin/time -p ./conv1 1 2>&1 >& - |grep '^user'|tr -s " "|cut -f2 -d" " - usertime=$( $time -p $CONV1 2>&1 >& - |grep '^user'|tr -s " " |cut -f2 -d" ") - echo $usertime - - amount=$(($usertime+$amount)) - if [[ $usertime -lt $min ]]; then - min=$usertime - fi - if [[ $usertime -gt $max ]]; then - max=$usertime - fi - count=$(($count+1)) -done - -echo "amount time = $amount" -echo "maxtime = $max" -echo "mintime = $min" - - -amount=$(($amount - $max - $min)) -echo "amount time - mintime - maxtime = $amount" -count=$(($count-2)) -echo "count = $count" -averagetime=$(($amount/($count))) -echo "average time = $averagetime" -
--- a/ljtes/ljtes.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -#ifdef GCC -#define __environment _CbC_environment -#define __return _CbC_return -#endif - -#define LOOP 5000000 - -#include <stdio.h> - -__code factorial(int n,int result,int orig,__code(*print)(int,int,int,__code(*)(),__code(*)(),void*),__code(*exit1)(int,void *), void *exit1env) -{ - if (n<0) { - printf("#0008:err %d!\n",n); - goto (*exit1)(0,exit1env); - } - if (n==0) - goto (*print)(n,result,orig,print,exit1,exit1env); - else { - result += n; - n--; - goto factorial(n,result,orig,print,exit1,exit1env); - } -} - - -int calc(int n){ - goto factorial(n,1,n,print,__return,__environment); - return 0; -} - -int main( int ac, char *av[]) -{ - int i; - long ans; - for(i=LOOP,ans=0;i>0;i--){ - ans += calc(10); - } - - printf("%ld\n",ans); -} - -__code print(int n,int result,int orig,__code(*print)(),__code (*exit1)(int, void*),void*exit1env) -{ - goto (*exit1)(result,exit1env); -} -
--- a/ljtes/ljtes_as.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -#ifdef GCC -#define __environment _CbC_environment -#define __return _CbC_return -#endif - -#define LOOP 5000000 - -#include <stdio.h> -struct __CbC_env{ - void *ret_p,*env; -}; - -__code factorial(int n,int result,int orig,__code(*print)(int,int,int,__code(*)(),void*), void *exit1env) -{ - if (n<0) { - printf("#0008:err %d!\n",n); - goto return_cs(0,exit1env); - } - if (n==0) - goto (*print)(n,result,orig,print,exit1env); - else { - result += n; - n--; - goto factorial(n,result,orig,print,exit1env); - } -} - - -int calc(int n){ - void *env = ({ - struct __CbC_env __CbC_environment; - env = &__CbC_environment; - jmp_buf env_buf; - int retval; - __CbC_environment.ret_p = &retval; - __CbC_environment.env = &env_buf; - // if (setjmp(__CbC_environment.env)){ - /* return retval; */ - /* } */ - asm volatile( - "movq 0x8(%%rdi), %%r10;" // %r10 = env.env; - "movq %%rbp, 0x8(%%r10);" // env.env[1] = %rbp; frame pointer - "movq %%rsp, 0x10(%%r10);" // env.env[2] = %rsp; stack pointer - "jmp MAIN_AFTER_SET;" // escape from asm - "MAIN_RET_POINT:;" // return point - "movq %%rbp, %%rsp;" // fix stack pointer - "popq %%rbp;" // pop - "retq;" // return - "MAIN_AFTER_SET:;" // escape point - :"+D"(env)::"r10","eax"); - &__CbC_environment; - }); - goto factorial(n,1,n,print,env); - return 0; -} - -int main( int ac, char *av[]) -{ - int i; - long ans; - for(i=LOOP,ans=0;i>0;i--){ - int a = calc(10); - ans += a; - } - - printf("%ld\n",ans); -} - -__code return_cs(int val, void* env){ - asm volatile( - "movq 0x8(%%rdi), %%r10;" // %r10 = env.env (environment) - "movq 0x8(%%r10), %%rbp;" // restore frame pointer - "movq 0x10(%%r10), %%rsp;" // restore stack pointer - "movl %%ecx, %%eax;" // return value - "jmp MAIN_RET_POINT;" // goto previous environment - :"+D"(env):"c"(val):"r10","eax"); -} - -__code print(int n,int result,int orig,__code(*print)(),void*exit1env) -{ - goto return_cs(result, exit1env); -}
--- a/ljtes/ljtes_as2.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -#ifdef GCC -#define __environment _CbC_environment -#define __return _CbC_return -#endif - -#define LOOP 5000000 - -#include <stdio.h> -struct __CbC_env{ - void *ret_p,*env; -}; - -int save_env(void *env); -__code factorial(int n,int result,int orig,__code(*print)(int,int,int,__code(*)(),void*), void *exit1env) -{ - if (n<0) { - printf("#0008:err %d!\n",n); - goto return_cs(0,exit1env); - } - if (n==0) - goto (*print)(n,result,orig,print,exit1env); - else { - result += n; - n--; - goto factorial(n,result,orig,print,exit1env); - } -} - - -int calc(int n){ - volatile void *env = ({ - volatile struct __CbC_env __CbC_environment; - env = &__CbC_environment; - jmp_buf env_buf; - int retval; - __CbC_environment.ret_p = &retval; - __CbC_environment.env = &env_buf; - if (save_env(__CbC_environment.env)){ - return retval; - } - &__CbC_environment; - }); - goto factorial(n,1,n,print,(void*)env); - return 0; -} - -int main( int ac, char *av[]) -{ - int i; - long ans; - for(i=LOOP,ans=0;i>0;i--){ - int a = calc(10); - ans += a; - } - - printf("%ld\n",ans); -} - -int save_env(void *env){ - volatile int retval = 0; - asm volatile( - "movq %%rbp,(%%rdi);" // env.env[1] = %rbp; frame pointer - "movq (%%rsp), %%rax;" // get return addres - "movq %%rax, 0x8(%%rdi);" // set return addres - "popq %%rax;" // fix stack pointer - "movq %%rsp, 0x10(%%rdi);" // set stack pointer - "movl $0, %%eax;" // set return value - "jmpq *0x8(%%rdi);" // return - :"+D"(env)::"rax"); - return retval; -} - -__code return_cs(int val, void* env){ - asm volatile( - "movq (%%rdi), %%r10;" // %r10 = env.ret_p (return value) - "movq %%rcx ,(%%r10);" // set return value - "movq 0x8(%%rdi), %%r10;" // %r10 = env.env (environment) - "movq (%%r10), %%rbp;" // restore frame pointer - "movq 0x10(%%r10), %%rsp;" // restore stack pointer - "movl $1, %%eax;" // set return value - "jmpq *0x8(%%r10);" // return - :"+D"(env):"c"(val):"r10","eax"); -} - -__code print(int n,int result,int orig,__code(*print)(),void*exit1env) -{ - goto return_cs(result, exit1env); -}
--- a/loto6.c Sat Mar 21 09:15:18 2020 +0900 +++ b/loto6.c Sat May 23 07:19:57 2020 +0900 @@ -11,77 +11,71 @@ #include <string.h> #include <time.h> -#ifdef CLANG // for clang/LLVM -#define _CbC_return __return -#define _CbC_environment __environment -#endif - __code (*ret)(int, void*); -void *env; - +void* env; __code print(int *numbers) { - printf("%d-%d-%d-%d-%d-%d\n", numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5]); - free(numbers); - goto ret(0, env); + printf("%d-%d-%d-%d-%d-%d\n", numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5]); + free(numbers); + goto ret(0, env); } -__code + __code take(int *array, int size, int length) { - int *taked = (int*)malloc(sizeof(int)*length); + int *taked = (int*)malloc(sizeof(int)*length); - memcpy(taked, array, sizeof(int)*length); - free(array); + memcpy(taked, array, sizeof(int)*length); + free(array); - goto print(taked); + goto print(taked); } __code shuffle(int *array, int size, int idx) { - int j = random() % size; - int tmp = array[idx]; - array[idx] = array[j]; - array[j] = tmp; + int j = random() % size; + int tmp = array[idx]; + array[idx] = array[j]; + array[j] = tmp; - if (++idx < size) { - goto shuffle(array, size, idx); - } else { - goto take(array, size, 6); - } + if (++idx < size) { + goto shuffle(array, size, idx); + } else { + goto take(array, size, 6); + } } __code range_loop(int *array, int idx, int from, int to, int step, int size) { - array[idx] = from; + array[idx] = from; - if (from+step > to) { - goto shuffle(array, size, 0); - } else { - goto range_loop(array, idx+1, from+step, to, step, size); - } + if (from+step > to) { + goto shuffle(array, size, 0); + } else { + goto range_loop(array, idx+1, from+step, to, step, size); + } } __code range(int from, int to, int step) { - int size = (to-from+1)/step; - int *array = (int*)malloc(sizeof(int)*size); + int size = (to-from+1)/step; + int *array = (int*)malloc(sizeof(int)*size); - goto range_loop(array, 0, from, to, step, size); + goto range_loop(array, 0, from, to, step, size); } int main() { - srand(time(NULL)); - ret = _CbC_return; - env = _CbC_environment; + srand(time(NULL)); + ret = _CbC_return; + env = _CbC_environment; - goto range(1, 43, 1); + goto range(1, 43, 1); }
--- a/matrix/compute_power.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -#include <stdio.h> -#include "matrix.h" - -void compute(); -double ** create_identity_matrix(int size); -double ** multiply(double **a, double **b, int l, int m, int n); -void print_matrix(double **a, int row, int col); - -int -main(int argc, char **argv) -{ - compute(); - return 0; -} - -void -compute() -{ - double **A, **B, **C; - A = create_identity_matrix(4); - B = create_identity_matrix(4); - printf("A = \n"); - print_matrix(A, 4, 4); - printf("B = \n"); - print_matrix(B, 4, 4); - - C = multiply(A, B, 4,4,4); - printf("C = \n"); - print_matrix(C, 4, 4); - - - free(A); - free(B); - free(C); -} - -double ** -create_identity_matrix(int size) -{ - int i,j; - double **ret; - ret = create_matrix(sizeof(double), size, size); - - for (j=0; j<size; j++) { - for (i=0; i<size; i++) { - ret[j][i] = 0; - } - } - for (i=0; i<size; i++) { - ret[i][i] = 1.0f; - } - return ret; -} - -double ** -power_of_matrix(double **a, int n) -{ - int r,c,i; - double **result; - result = create_identity_matrix(n); - - for (r=0; r<l; r++) { - for (c=0; c<n; c++) { - result[r][c] = 0; - for (i=0; i<m; i++) { - result[r][c] += a[r][i] * b[i][c]; - } - } - } - return result; -} - -double ** -multiply(double **a, double **b, int l, int m, int n) -{ - int r,c,i; - double **result; - result = create_matrix(sizeof(double), l, n); - - for (r=0; r<l; r++) { - for (c=0; c<n; c++) { - result[r][c] = 0; - for (i=0; i<m; i++) { - result[r][c] += a[r][i] * b[i][c]; - } - } - } - return result; -} - -/** 表示用 */ -void -print_matrix(double **a, int row, int col) -{ - int i,j; - for( j=0; j<row; j++){ - printf("\t"); - for( i=0; i<col; i++){ - printf("%6.2f ", a[j][i]); - } - printf("\n"); - } -} - - - -
--- a/matrix/matrix.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#include "matrix.h" - -void -*create_matrix(size_t size, int row, int col) -{ - int i; - void *body; - void **ret; - - ret = malloc( size*row*col + sizeof(void*)*row ); - if (ret==NULL) return NULL; - - body = (void*)(ret+row); - for( i=0; i<row; i++){ - ret[i] = body + size*col*i; - } - return ret; -} - - -
--- a/matrix/matrix.h Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -#include "stdlib.h" - -void *create_matrix(size_t size, int row, int col);
--- a/normal.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -#include<stdio.h> -#include<stdlib.h> - -//size_t size; -int size; -typedef int test_int; - -test_int ti; - -void end(){ - exit(0); -} - -int main(int argc, char **argv){ - size=0; - ti=10; - - printf("main: "); - printf("normal:%d\n", argc); - - size = 10; - printf("size = %d\n", size); - printf(" ti = %d\n", ti); - end(); -} -
--- a/normal2.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -#include<stdio.h> -#include<stdlib.h> - -struct abc { - int a; - double b; - char c; - double *d; -}; - -struct def { - int d; - struct abc e; - struct abc *f; -}; - -void print_abc(struct abc a){ - printf("\tstruct abc:\n"); - printf("\ta=%d, b=%lf, c=%d, d=%p\n", a.a, a.b, a.c, a.d); -} -void print_def(struct def b){ - printf("\tstruct def:\n"); - printf("\ta=%d, b=%p\n", b.d, b.f); - print_abc(b.e); -} - -void cs_exit(int a){ - printf("cs_exit : a=%d.\n", a); - exit(a); -} - -void cs0(struct abc a, struct def b, int c){ - printf("cs0 :\n"); - print_abc(a); - print_def(b); - return cs_exit( c*a.a+b.e.c ); -} - - -void cs_goto(int c, struct abc a, struct def b){ - printf("cs_return :\n"); - print_abc(a); - print_def(b); - return cs0(a, b, c); -} - -int main(int argc, char **argv){ - struct abc A; - struct def B; - //int a=10, b=20, c=30, d=40, e=50, f=60, g=70; - A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0; - B.d = 30, B.f = &A; - B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0; - - printf("main :\n"); - print_abc(A); - print_def(B); - //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d); - cs_goto(100, A, B); - return 0; -} - - - -
--- a/parallel_check/c-int-double.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -#include<stdio.h> -#include<math.h> - -#define dprint(f, args...) \ - printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args) - -int -test(int a) -{ - return (int)pow(a, 2.0); -} - -int -callee(double a, double b, double c, int d) -{ - dprint("a=%d,b=%d,c=%d,d=%d\n", a,b,c,d); - return a+b+c+d; -} - -int -caller(int a, double b, double c, double d) -{ - int x; - double y,z,w; - //x = test(a); - //y = test(b); - //z = test(c); - //w = test(d); - x=a, y=b; - z=c, w=d; - - return callee(y,z,w,x); - //return callee(b,c,d, a); -} - -int -main (int argc, char **argv) -{ - int r; - r = caller(11,22,33,44); - //r = caller(11,22,33,44, 55,66,77,88); - printf("r = %d\n", r); -} - - -
--- a/parallel_check/c-int.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -#include<stdio.h> -#define dprint(f, args...) \ - printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args) - -void -callee(int a, int b, int c, int d) -{ - int r; - dprint("a=%d,b=%d,c=%d,d=%d\n", a,b,c,d); - r = a+b+c+d; - printf("r = %d\n", r); - return; -} - -void -caller1(int a, int b, int c, int d) -{ - int x,y,z,w; - x=a, y=b; - z=c, w=d; - - callee(x,y,z,w); - return; -} - -void -caller2(int a, int b, int c, int d) -{ - int x,y,z,w; - x=a, y=b; - z=c, w=d; - - callee(y,z,w,x); - return; -} - -void -caller3(int a, int b, int c, int d) -{ - callee(b,c,d,a); - return; -} - -void -caller4(int a, int b, int c, int d) -{ - callee(a+b,b+c,c+d,d+a); - return; -} - -void -caller5(int a, int b, int c, int d) -{ - int x,y,z,w; - x = a+b; - y = b+c; - z = c+d; - w = d+a; - - callee(x,y,z,w); - return; -} - -int -main (int argc, char **argv) -{ - int r; - caller(11,22,33,44); - //r = caller(11,22,33,44, 55,66,77,88); -} -
--- a/parallel_check/c-struct.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -#include<stdio.h> -#include<math.h> - -#define dprint(f, args...) \ - printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args) - -typedef struct { - int a; - double b; - char *c; -} STRUCT; - -int -test(int a) -{ - return (int)pow(a, 2.0); -} - - -int -callee(int a, STRUCT s, int b) - /* |-|----|-| */ -{ - dprint("a=%d,b=%d\n", a,b); - dprint("s.a=%d,s.b=%lf,s.c=%s\n", s.a, s.b, s.c); - return a+b+ s.a; -} - -int -caller(STRUCT s, int a, double b) - /* |----|-|--| */ -{ - STRUCT s0;// = {44, 55.5, "aiueo2"}; - //int a0 = 55; - //a0 = a; - s0 = s; - - return callee(10, s0, 20); -} - -int -main (int argc, char **argv) -{ - int r; - STRUCT s = { 33, 44.4, "aiueo" }; - - r = caller(s, 11, 22.2); - //r = caller(11,22,33,44, 55,66,77,88); - printf("r = %d\n", r); -} -
--- a/proto.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -int main(){ - goto ptes(1,2); -} - -__code ptes(int a,int b){ - printf("%d + %d = %d\n",a,b,a+b); -} -
--- a/protoGenCheck/Makefile Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -CC=/Users/e105711/prog/seminar/CbC/llvmInst/Debug+Asserts/bin/clang -TARGET=noProtoFibonacci fibonacci - -.SUFFIXES: .c .o - -.c.o: - $(CC) -o $< - -all: $(TARGET) - -clean: - rm -f $(TARGET) - rm -f *.o
--- a/protoGenCheck/fibonacci.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - calculate fibonacci progression. - Author : Kaito Tokumori -*/ - -#include <stdio.h> -#include <stdlib.h> - -__code fibonacci(int loop); -__code calcLoop(int before, int current, int loop); -__code print_answer(int answer); - -int main(int argc, char **argv) { - int i; - i = atoi(argv[1]); - - goto fibonacci(i); -} - -__code fibonacci(int loop) { - goto calcLoop(0, 1, loop); -} - -__code calcLoop(int before, int current, int loop) { - if ( loop > 1) { - goto calcLoop(current, before+current, loop-1); - }else{ - goto print_answer(current); - } -} - -__code print_answer(int answer) { - printf("factorial = %d\n",answer); - exit(0); -}
--- a/protoGenCheck/noProtoFibonacci.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - Prototype generator check. CbC compiler should compile this code without errors and warnings. - Author : Kaito Tokumori -*/ - -#include <stdio.h> -#include <stdlib.h> - -int main(int argc, char **argv) { - int i; - i = atoi(argv[1]); - - goto fibonacci(i); -} - -__code fibonacci(int loop) { - goto calcLoop(0, 1, loop); -} - -__code calcLoop(int before, int current, int loop) { - if ( loop > 1) { - goto calcLoop(current, before+current, loop-1); - }else{ - goto print_answer(current); - } -} - -__code print_answer(int answer) { - printf("factorial = %d\n",answer); - exit(0); -}
--- a/quicksort/Makefile Sat Mar 21 09:15:18 2020 +0900 +++ b/quicksort/Makefile Sat May 23 07:19:57 2020 +0900 @@ -1,11 +1,9 @@ -#CbCC=../../BUILD/INSTALL_DIR/bin/gcc -CbCC=/Users/e105711/prog/seminar/CbC/gcc-inst/bin/gcc +CbCC=../../BUILD/INSTALL_DIR/bin/gcc #CC=gcc #CC=../../../build_gcc/INSTALL_DIR/bin/gcc -#CC=../../BUILD/INSTALL_DIR/bin/gcc -CC=/Users/e105711/prog/seminar/CbC/gcc-inst/bin/gcc +CC=../../BUILD/INSTALL_DIR/bin/gcc HEADERMAKER=../../CbC-scripts/make_headers.py2
--- a/quicksort/quicksort_c.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -#include<stdio.h> -#include<stdlib.h> -#include<unistd.h> -#include<assert.h> - -static inline void -SWAP (int *a, int *b) -{ - int tmp; - tmp = *a; - *a = *b; - *b = tmp; -} - -static inline int -mid_point(int a, int b, int c) -{ - if (a < b) { - if (b < c) - return b; - else if (a < c) - return c; - else - return a; - } else { - if (a < c) - return a; - else if (b < c) - return c; - else - return b; - } -} - -void -selectsort(int *v, int s0, int e0) -{ - int i,j; - int m; - int size = e0-s0+1; - v += s0; - for (i=0; i<size; i++) { - m = i; - for (j=i+1; j<size; j++) { - if (v[m] > v[j]) - m = j; - } - if (m!=i) - SWAP(&v[i],&v[m]); - } - return; -} - -void -quicksort(int *v, int s0, int e0) -{ - int p; - int s=s0, e=e0; -#if 0 - if (e<=s) return; - if (e-s<5) { - selectsort(v,s0,e0); - return; - } -#else - if (e<=s) return; -#endif - - //p = (v[s]+v[(s+e)/2]+v[e])/3; - p = mid_point(v[s],v[e],v[(s+e)/2]); - - while (1) { - while (v[s]<p) s++; - while (p<v[e]) e--; - - if (!(s<e)) break; - SWAP(&v[s], &v[e]); - s++; e--; - } - assert(e+1==s || s==e); - - quicksort(v, s0, e); - quicksort(v, e+1, e0); - return; -} - -static void -print_array(int *v, int size) -{ - int i; - printf("["); - for (i=0; i<size; i++) { - printf("%s%4d", (i%10==0)? "\n ":" ", v[i]); - } - printf("]\n"); -} - -static int -check_sort(int *v, int size) -{ - int i; - for (i=0; i<size-1; i++) { - if (v[i] > v[i+1]) - return 0; - } - return 1; -} - -void -random_initialize(int *v, int size, int min, int max) -{ - int i; - int diff = max-min+1; - - for (i=0; i<size; i++) { - v[i] = min+random()%diff; - } - return; -} - -int -start_sort(int size) -{ - int *target; - - target = (int*)malloc(sizeof(int)*size); - if (!target) { - perror("malloc"); - exit(1); - } - - random_initialize(target, size, 0, 1); - - //print_array(target, size); - quicksort(target, 0, size-1); - //selectsort(target, 0, size-1); - //print_array(target, size); - return check_sort(target, size); -} - -int -main(int argc, char **argv) -{ - //unsigned int seed= -1074072728; - unsigned int seed; - int size=101; - int loop=1; - int opt, i; - - while ((opt = getopt(argc, argv, "t:s:n:")) != -1) { - switch (opt) { - case 'n': - size = atoi(optarg); - break; - case 't': - loop = atoi(optarg); - break; - case 's': - seed = atoi(optarg); - break; - default: - fprintf(stderr, "Usage: %s [-t times] [-n sizeofarray] [-s seed]\n", argv[0]); - exit(1); - } - } - - printf("start seed = %u\n", seed); - printf("sort size = %d\n", size); - for (i=0; i<loop; i++) { - srandom(seed+i); - int b = start_sort(size); - if (b) { - printf("seed = %d+%u, success\n", i, seed); - } else { - fprintf(stderr, "sorting failure! seed=%u+%d\n", seed,i); - exit(1); - } - } - exit(0); -} - - -
--- a/rectype/rectype.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -__code print(__rectype *p) -{ - printf("print\n"); - exit(0); -} -__code csA(__rectype *p) -{ - goto p(csA); -} - -void main1() -{ - goto csA(print); -} - -int main() -{ - main1(); - return 0; -}
--- a/rectype/struct.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -struct interface { - __code (*next)(struct interface); -}; - -__code print(struct interface p) -{ - printf("print\n"); - exit(0); -} -__code csA(struct interface p) -{ - struct interface ds; - ds.next = csA; - goto p.next(ds); -} - -void main1() -{ - struct interface ds; - ds.next = print; - goto csA(ds); -} - -int main() -{ - main1(); - return 0; -}
--- a/rectypeTest/Makefile Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -# Makefile -CbCC = /Users/e105711/prog/seminar/CbC/gcc-inst/bin/gcc - -CFLAGS = -g -O2 -Wall - - -.SUFFIXES: .cbc .o - -all: rectypeTest1 typedef struct instruct inparm - -.cbc.o: - $(CbCC) $(CFLAGS) -c -o $@ $< - -rectypeTest1.o: rectypeTest1.cbc -typedef.o: typedef.cbc -struct.o: struct.cbc -instruct.o: instruct.cbc -inparm.o: inparm.cbc - - -rectypeTest1: rectypeTest1.o - $(CbCC) $(CFLAGS) -o $@ $^ - -typedef: typedef.o - $(CbCC) $(CFLAGS) -o $@ $^ - -struct: struct.o - $(CbCC) $(CFLAGS) -o $@ $^ - -instruct: instruct.o - $(CbCC) $(CFLAGS) -o $@ $^ - -inparm: inparm.o - $(CbCC) $(CFLAGS) -o $@ $^ - -clean: - rm -rf *.o *.s typedef rectypeTest1 struct instruct inparm - -
--- a/rectypeTest/inparm.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -__code print(__rectype *p) { - puts("inparm: hello"); - exit(0); -} - -__code csA(__code (*p)(__rectype*)) { - goto p(csA); -} - -void main1() { - goto csA(print); -} - -int main() { - main1(); - return 0; -}
--- a/rectypeTest/instruct.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#include <stdlib.h> - -// miss -struct interface { - __rectype *next; -}; - -__code print(struct interface p) { - puts("print"); - exit(0); -} - -__code csA(struct interface p) { - struct interface ds; - ds.next = csA; - goto p.next(ds); -} - -void main1() { - struct interface ds; - ds.next = print; - goto csA(ds); -} - -int main() { - main1(); - return 0; -}
--- a/rectypeTest/rectypeTest1.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#include <stdio.h> -__code print(__rectype *p, int num) { - printf("num = %d\n",num); -} - -__code csA(__rectype *p, int num) { - goto p(csA,3,4); - goto p(2,3); - goto p(csA,3); - return; -} - -void funcA(__code (*p)()){ - goto p(print, 3); - return; -} - -int main() { - funcA(csA); - - return 0; -}
--- a/rectypeTest/rectypeTest1.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -__code print(__rectype *p, int num) { - printf("num = %d\n",num); - exit(0); -} - -//__code csA(__rectype *p, int num) { -__code csA(__code (*p)(void*,int), int num) {// goto p(csA,3,4); // error: too many arguments - goto p(2,3); // error : internal compiler error -// goto p(csA,3); - return; -} - -void funcA(__code (*p)()){ - goto p(print, 3); - return; -} - -int main() { - funcA(csA); - return 0; -}
--- a/rectypeTest/segmentfault.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#include <stdio.h> - -void func( void (*p)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)(void(*)()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) { - p(3); -} - - - - -int main() { - - return 0; -}
--- a/rectypeTest/struct.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -struct aaa { - __rectype *child; -}; -__code test() { - struct aaa b; -} - -struct interface { - __code (*next)(struct interface); -}; - - -#include <stdio.h> -#include <stdlib.h> -__code csB() { - exit(0); -} -__code print(struct interface p) { - puts("hello"); - exit(0); -} - -__code csA(struct interface p) { - struct interface ds = { csB }; - goto p.next(ds); -// goto p.next(3); // error -} - -int main() { - struct interface ds = { print }; - goto csA(ds); - return 0; -}
--- a/rectypeTest/struct2.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - -struct interface { - __code (*next)(); - __rectype child; - // __rectype *child; - // struct interface *child; -}; - -#include <stdio.h> -__code csA() -{ - printf("csA\n"); -} - -__code csB() -{ - printf("csB\n"); -} - -int main() -{ - struct interface p; - p.next = csA; - - struct interface pp; - pp.next = csB; - p.child = &pp; - - // goto p.child->next(); - goto p.child->next(); - - return 0; -}
--- a/rectypeTest/typedef.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -typedef __code (CS)(__rectype*); // CS *p - -//typedef __code (*CS)(__code(*p)()); -//typedef __code (CS)(__code(*p)()); // CS *p - -#include <stdio.h> -__code cs_end(CS *p) -{ - printf("end\n"); -} - -__code cs(CS *p) -{ - CS *b; - goto p(b); -// goto p("aaa"); //note: expected ‘void (*)’ but argument is of type ‘char -} - -int main() { - CS *p; - p = cs_end; - goto cs(p); - return 0; -}
--- a/rectypeTest/typedef2.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -typedef __code (*csPtr)(__rectype); - -//typedef __code (*csPtr)(__code(*p)()); -//typedef __code (csPtr)(__code(*p)()); // csPtr *p - -#include <stdio.h> -__code cs_end(csPtr p) -{ - printf("end\n"); -} - -__code cs(csPtr p) -{ - csPtr b; - goto p(b); - // goto p(3); // note: expected ‘void (*)()’ but argument is of type ‘int’ -} - -int main() { - csPtr p; - p = cs_end; - goto cs(p); - return 0; -}
--- a/rectypeTest/typedef3.cbc Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -typedef __code (*csPtr)(__rectype*); - -#include <stdio.h> -__code cs_end(csPtr *p) -{ - printf("end\n"); -} - -__code cs(csPtr p) -{ - csPtr *b; // <- This declaration please care. - goto p(b); - // goto p(3); // note: expected ‘void (**’ but argument is of type ‘int’ -} - -int main() { - csPtr p; - p = cs_end; - goto cs(p); - return 0; -}
--- a/return_check/test_return.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -#include<stdio.h> - -#if 0 -typedef float testtype; -testtype good = 33.3f; -testtype bad = 0.0f; -void print_testtype(testtype t) -{ - printf("return value = %2.3f good=%2.3f,bad=%2.3f\n", t,good,bad); -} -#elif 1 -typedef char testtype; -testtype good = 33; -testtype bad = 0; -void print_testtype(testtype t) -{ - printf("return value = %d, good=%d,bad=%d\n", t,good,bad); -} -#elif 0 -typedef double testtype; -testtype good = 333.3; -testtype bad = 0.00; -void print_testtype(testtype t) -{ - printf("return value = %3.3lf, good=%3.3lf,bad=%3.3lf\n", t,good,bad); -} -#elif 0 -typedef -struct { - int a; - float b; - int c[4]; -} testtype; -testtype good = {33, 33.3, {4,4,4,4}}; -testtype bad = {0, 00.0, {0,0,0,0}}; -void print_testtype(testtype t) -{ - printf( "return value = {\n" - " a = %d\n" - " b = %2.3f\n" - " c = { %d, %d, %d, %d }" - "}\n", t.a, t.b, - t.c[0],t.c[1],t.c[2],t.c[3]); -} -#else -typedef int testtype; -testtype good = 33; -testtype bad = 0; -void print_testtype(testtype t) -{ - printf("return value = %d, good=%d,bad=%d\n", t,good,bad); -} -#endif - -typedef void (*RET_FUNC)(testtype, void *); - -void g(RET_FUNC func) -{ - func(good, NULL); -} - -testtype f_cbc() -{ - //__label__ _cbc_exit0; - //int retval; - void *ret; - - ret = _CbC_return; - - printf("f0: fp = %p\n", __builtin_frame_address(0)); - printf("__return_func = %p\n", ret); - g(ret); - - printf("not good\n"); - return bad; -//_cbc_exit0: - //printf("f1: fp = 0x%x\n", __builtin_frame_address(0)); - //return retval; -} - -int main(int argc, char **argv) -{ - testtype t; - printf("main before: fp = %p\n", __builtin_frame_address(0)); - t = f_cbc(); - print_testtype(t); - printf("main after: fp = %p\n", __builtin_frame_address(0)); -} -
--- a/return_check/typedeffed.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -#include<stdio.h> - -#if 0 -typedef float testtype; -testtype good = 33.3f; -testtype bad = 0.0f; -void print_testtype(testtype t) -{ - printf("return value = %2.3f good=%2.3f,bad=%2.3f\n", t,good,bad); -} -#elif 1 -typedef char testtype; -testtype good = 33; -testtype bad = 0; -void print_testtype(testtype t) -{ - printf("return value = %d, good=%d,bad=%d\n", t,good,bad); -} -#elif 0 -typedef double testtype; -testtype good = 333.3; -testtype bad = 0.00; -void print_testtype(testtype t) -{ - printf("return value = %3.3lf, good=%3.3lf,bad=%3.3lf\n", t,good,bad); -} -#elif 0 -typedef -struct { - int a; - float b; - int c[4]; -} testtype; -testtype good = {33, 33.3, {4,4,4,4}}; -testtype bad = {0, 00.0, {0,0,0,0}}; -void print_testtype(testtype t) -{ - printf( "return value = {\n" - " a = %d\n" - " b = %2.3f\n" - " c = { %d, %d, %d, %d }" - "}\n", t.a, t.b, - t.c[0],t.c[1],t.c[2],t.c[3]); -} -#else -typedef int testtype; -testtype good = 33; -testtype bad = 0; -void print_testtype(testtype t) -{ - printf("return value = %d, good=%d,bad=%d\n", t,good,bad); -} -#endif - -typedef void (*RET_FUNC)(testtype, void *); - -void g(RET_FUNC func) -{ - func(good, NULL); -} - -testtype f_cbc() -{ - //__label__ _cbc_exit0; - //int retval; - void *ret; - - ret = _CbC_return; - - printf("f0: fp = %p\n", __builtin_frame_address(0)); - printf("__return_func = %p\n", ret); - g(ret); - - printf("not good\n"); - return bad; -//_cbc_exit0: - //printf("f1: fp = 0x%x\n", __builtin_frame_address(0)); - //return retval; -} - -int main(int argc, char **argv) -{ - testtype t; - printf("main before: fp = %p\n", __builtin_frame_address(0)); - t = f_cbc(); - print_testtype(t); - printf("main after: fp = %p\n", __builtin_frame_address(0)); -} -
--- a/return_check/variable_return_type.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -#include<stdio.h> -#include<assert.h> - -#define dprint(f, args...) \ - fprintf(stdout, "in %s\t: "f, __FUNCTION__, ## args) - - -/* for integer. */ -int goodint = 33; -int badint = 0; -typedef void (*RETINT_FUNC)(int, void *); -void g_int(RETINT_FUNC func) -{ - func(goodint, NULL); -} -int f_int() -{ - void *ret; - - ret = _CbC_return; - - dprint("fp = %p\n", __builtin_frame_address(0)); - dprint("__return_func = %p\n", ret); - g_int(ret); - //goto g(ret); - - dprint("not good\n"); - return badint; -} - - -/* for double. */ -double gooddouble = 333.3; -double baddouble = 0.00; -typedef void (*RETDOUBLE_FUNC)(double, void *); -void g_double(RETDOUBLE_FUNC func) -{ - func(gooddouble, NULL); -} -double f_double() -{ - void *ret; - ret = _CbC_return; - - dprint("fp = %p\n", __builtin_frame_address(0)); - dprint("__return_func = %p\n", ret); - g_double(ret); - //goto g_double(ret); - - dprint("not good\n"); - return baddouble; -} - -/* for float. */ -float goodfloat = 33.3f; -float badfloat = 0.0f; -typedef void (*RETFLOAT_FUNC)(float, void *); -void g_float(RETFLOAT_FUNC func) -{ - func(goodfloat, NULL); -} -float f_float() -{ - void *ret; - ret = _CbC_return; - - dprint("fp = %p\n", __builtin_frame_address(0)); - dprint("__return_func = %p\n", ret); - g_float(ret); - //goto g_float(ret); - - dprint("not good\n"); - return badfloat; -} - -/* for char. */ -char goodchar = 33; -char badchar = 0; -typedef void (*RETCHAR_FUNC)(char, void *); -void g_char(RETCHAR_FUNC func) -{ - func(goodchar, NULL); -} -char f_char() -{ - void *ret; - - ret = _CbC_return; - - dprint("fp = %p\n", __builtin_frame_address(0)); - dprint("__return_func = %p\n", ret); - g_char(ret); - //goto g(ret); - - dprint("not good\n"); - return badchar; -} - - -/* for struct. */ -struct ifid { - int a; - float b; - int c[4]; - double d; -}; -struct ifid goodstruct = {33, 33.3, {4,4,4,4}, 333.333}; -struct ifid badstruct = {0, 00.0, {0,0,0,0}, 0.0}; -typedef void (*RETSTRUCT_FUNC)(struct ifid, void *); -void g_struct(RETSTRUCT_FUNC func) -{ - func(goodstruct, NULL); -} -struct ifid f_struct() -{ - void *ret; - - ret = _CbC_return; - - dprint("fp = %p\n", __builtin_frame_address(0)); - dprint("__return_func = %p\n", ret); - g_struct(ret); - //goto g(ret); - - dprint("not good\n"); - return badstruct; -} - -int main(int argc, char **argv) -{ - void *bptr; - int rint; - float rfloat; - double rdouble; - char rchar; - struct ifid rstruct; - - bptr = __builtin_frame_address(0); - - dprint("before int: fp = %p\n", __builtin_frame_address(0)); - rint = f_int(); - dprint("f_int = %d, good=%d,bad=%d\n", rint,goodint,badint); - - dprint("before float: fp = %p\n", __builtin_frame_address(0)); - rfloat = f_float(); - dprint("f_float = %3.3f, good=%3.3f,bad=%3.3f\n", rfloat,goodfloat,badfloat); - assert(bptr==__builtin_frame_address(0)); - - dprint("before double: fp = %p\n", __builtin_frame_address(0)); - rdouble = f_double(); - dprint("f_double = %3.3lf, good=%3.3lf,bad=%3.3lf\n", rdouble,gooddouble,baddouble); - assert(bptr==__builtin_frame_address(0)); - - dprint("before char: fp = %p\n", __builtin_frame_address(0)); - rchar = f_char(); - dprint("f_char = %d, good=%d,bad=%d\n", rchar,goodchar,badchar); - assert(bptr==__builtin_frame_address(0)); - - dprint("before struct: fp = %p\n", __builtin_frame_address(0)); - rstruct = f_struct(); - dprint( "return value = {\n" - " a = %d\n" - " b = %2.3f\n" - " c = { %d, %d, %d, %d }\n" - " d = %3.3f\n" - "}\n", rstruct.a, rstruct.b, - rstruct.c[0],rstruct.c[1],rstruct.c[2],rstruct.c[3], rstruct.d); - - - - dprint("end: fp = %p\n", __builtin_frame_address(0)); - - if (bptr!=__builtin_frame_address(0)) { - dprint("CbC_return failure!\n"); - return 1; - } - if ( rint!=goodint - || rchar!=goodchar - || (rfloat < goodfloat-0.01 || goodfloat+0.01 < rfloat) - || (rdouble < gooddouble-0.01 || gooddouble+0.01 < rdouble) - || rstruct.a!=goodstruct.a - || (rstruct.b < goodstruct.b-0.01 || goodstruct.b+0.01 < rstruct.b) - || (rstruct.d < goodstruct.d-0.01 || goodstruct.d+0.01 < rstruct.d) - || rstruct.c[0]!=goodstruct.c[0] - || rstruct.c[1]!=goodstruct.c[1] - || rstruct.c[2]!=goodstruct.c[2] - || rstruct.c[3]!=goodstruct.c[3] ) { - dprint("CbC_return failure!\n"); - return 1; - } - - - dprint("CbC_return successful!\n"); - return 0; -} -
--- a/selftype.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - -/* -struct node { - int num; - struct node *child; - // struct node **array_node; -}; -*/ - -#include <stdio.h> - -struct node { - int num; - selftype *child; -}; - -int main() { - struct node n, nc; - n.num = 1; - nc.num = 2; - n.child = &nc; - - printf("n.num = %d\n",n.num); - printf("n.child.num = %d\n",n.child->num); - - return 0; -} - -
--- a/stack1.c Sat Mar 21 09:15:18 2020 +0900 +++ b/stack1.c Sat May 23 07:19:57 2020 +0900 @@ -1,125 +1,127 @@ /* - test for CbC converted __code from C -*/ + test for CbC converted __code from C + */ #include <stdio.h> -#include <stdlib.h> #define NULL 0 +extern int printf(const char*, ...); +extern void *malloc(size_t); typedef void *stack; void *stack0; /* size of void* == 1 */ struct cont_save { /* General Return Continuation */ - __code (*ret)(int, void*); + __code (*ret)(); }; -__code g(int,void *); -__code f_g0(int ,int ,void *); -__code f_g1(int,void *); -__code print(int i,int j,__code (*exit1)(),void*exit1env); -int main0( int ac, char *av[]); + __code g(int,void *); + __code f_g0(int ,int ,void *); + __code f_g1(int,void *); + __code print(int i,int j,__code (*exit1)(),void*exit1env); struct f_g0_save { /* Specialized Return Continuation */ - __code (*ret)(); - int ii,kk,jj; + __code (*ret)(); + int ii,kk,jj; }; __code g(int i,void *sp) { - goto (* ((struct cont_save *)sp)->ret)(i+4,sp); + goto (* ((struct cont_save *)sp)->ret)(i+4,sp); } __code __attribute__ ((fastcall)) f_g1(int j,void *sp) { /* Continuation */ - int k; - struct f_g0_save *c; + int k; + struct f_g0_save *c; - c = sp; - k = c->kk; - sp += sizeof(struct f_g0_save); - goto (* ((struct cont_save *)sp)->ret)(k+4+j,sp); + c = sp; + k = c->kk; + sp += sizeof(struct f_g0_save); + goto (* ((struct cont_save *)sp)->ret)(k+4+j,sp); } __code f(int i,void *sp) { - int k,j; - struct f_g0_save *c; - printf("#0042:f 0 sp: %lx\n",sp-stack0); + int k,j; + struct f_g0_save *c; +printf("#0042:f 0 sp: %x\n",sp-stack0); - k = 3+i; + k = 3+i; - printf("#0046:f 1 sp: %lx\n",sp-stack0); - sp -= sizeof(struct f_g0_save); - printf("#0048:f 2 sp: %lx\n",sp-stack0); - c = sp; - c->kk = k; - c->ii = i; - c->jj = j; - c->ret = f_g1; - goto g(i,sp); +printf("#0046:f 1 sp: %x\n",sp-stack0); + sp -= sizeof(struct f_g0_save); +printf("#0048:f 2 sp: %x\n",sp-stack0); + c = sp; + c->kk = k; + c->ii = i; + c->jj = j; + c->ret = f_g1; + goto g(i,sp); } struct f0_save { /* Specialized Return Continuation */ - __code (*ret)(int, void*); - __code (*exit1)(int, void*); - void *exit1env; - int jj; + __code (*ret)(); + __code (*exit1)(); + void *exit1env; + int jj; }; __code f1(int i,void *sp) ; -__code f0(int i,int j,__code(*exit2)(int, void*), void *exit2env,void *sp) +__code f0(int i,int j,__code(*exit2)(), void *exit2env,void *sp) { - struct f0_save *c; - printf("#0070:f0 1 sp: %lx\n",sp-stack0); - sp -= sizeof(struct f0_save); - printf("#0072:f0 2 sp: %lx\n",sp-stack0); - c = sp; - c->jj = j; - c->exit1 = exit2; - c->exit1env = exit2env; - c->ret = f1; - printf("#0078:f0 3 sp: %lx\n",sp-stack0); - goto f(i,sp); + struct f0_save *c; + printf("#0070:f0 1 sp: %x\n",sp-stack0); + sp -= sizeof(struct f0_save); + printf("#0072:f0 2 sp: %x\n",sp-stack0); + c = sp; + c->jj = j; + c->exit1 = exit2; + c->exit1env = exit2env; + c->ret = f1; + printf("#0078:f0 3 sp: %x\n",sp-stack0); + goto f(i,sp); } __code f1(int i,void *sp) { - int j; - int *exit2env; - __code (*exit2)(int, void*); - struct f0_save *c; + int j; + int *exit2env; + __code (*exit2)(); + struct f0_save *c; - c = sp; - j = c->jj; - exit2 = c->exit1; - exit2env = c->exit1env; + c = sp; + j = c->jj; + exit2 = c->exit1; + exit2env = c->exit1env; - sp += sizeof(struct f0_save); - goto print(i,j,exit2,exit2env); + sp += sizeof(struct f0_save); + goto print(i,j,exit2,exit2env); } int main(int ac, char*av[]){ - main0(ac,av); + main0(ac,av); } int main0( int ac, char *av[]) { - int i,j; - int *sp; + int i,j; + int *sp; - i = 1; - stack0 = ((char *)malloc(1024)+1024); - sp = stack0; - j = i; + // i = atoi(av[1]); + i = 1; + stack0 = ((char *)malloc(1024)+1024); + sp = stack0; + j = i; - printf("#0108:sp: %lx %lx\n",sp-(int*)stack0,sizeof(*stack0)); - goto f0(i,j,NULL,NULL,sp); - return 0; + printf("#0108:sp: %x %x\n",sp-(int*)stack0,sizeof(*stack0)); + //goto f0(i,j,_CbC_return,_CbC_environment,sp); + goto f0(i,j,NULL,NULL,sp); } __code print(int i,int j,__code (*exit1)(),void*exit1env) { - printf("#0114:%d %d\n",i,j); - exit(0); + printf("#0114:%d %d\n",i,j); + //goto (*exit1)(0),exit1env; + exit(0); }
--- a/test01.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -#include<stdio.h> - -int test_goto2(int a,int b,int c,int d,int e,int f,int g,int h,int i,int j); - -int test_code(void){ - printf("\t\ttest_code: return 10\n"); - return 10; -} - -int test_goto(int a){ - printf("\ttest_goto: a = %d\n", a); - return test_code(); -} - -int main(int argc, char **argv){ - int ret; - printf("test code\n"); - ret = test_goto(20); - printf("main: ret = %d\n", ret); - - return test_goto2(10,20,30,40,50,60,70,80,90,100); - return 0; -} - -int test_code2(int a,int b,int c,int d,int e,int f,int g,int h,int i,int j){ - printf("\t\ttest_code: return 10\n"); - printf("a=%d,b=%d,c=%d,d=%d,e=%d,f=%d,g=%d,h=%d,i=%d,j=%d\n",a,b,c,d,e,f,g,h,i,j); - return a+b+c+d+e+f+g+h+i+j; -} - -int test_goto2(int a,int b,int c,int d,int e,int f,int g,int h,int i,int j){ - printf("\ttest_goto: a = %d\n", a); - return test_code2(a,b,c,d,e,f,g,h,i,j); -}
--- a/test02.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test02.c Sat May 23 07:19:57 2020 +0900 @@ -1,21 +1,23 @@ #include<stdio.h> +extern int printf(const char*, ...); __code test_code(void){ - printf("\t\ttest_code: return 10\n"); - return; + printf("\t\ttest_code: return 10\n"); + return; } __code test_goto(int a){ - printf("\ttest_goto: a = %d\n", a); - goto test_code(); + printf("\ttest_goto: a = %d\n", a); + //return test_code(); + goto test_code(); } int main(int argc, char **argv){ - int ret=0; - printf("test code\n"); - test_goto(20); - printf("main: ret = %d\n", ret); - - return 0; + int ret=0; + printf("test code\n"); + test_goto(20); + printf("main: ret = %d\n", ret); + + return 0; }
--- a/test03.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -extern void test02() ; -extern void test03() ; - -extern int data; - -extern void -test01() { - test02(); -} - -extern void -test02() { - test03(); -} - -extern void -test03() { - data = 3; -} - -int -main() -{ - test01(); -}
--- a/test04.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#include<stdio.h> -int test01(int a, double b, int *c){ - return a+b- *c; -} - -int test(int *a, double b){ - int c; - c = *a*b + 10; - printf("a = %p, *a = %d, b = %f\n", a, *a, b); - *a = test01( *a+b, 0.02, &c); - return *a+b; -} - - -int test02(int a, int b){ - int i,sum=0; - i = a; - while ( i <= b ) { - sum += i; - i++; - } - return sum - a*b; -} - -int main(int argc, char **argv){ - int a=10; - - printf("= %d\n", test02(0, 10)); - test( &a, 10.1); - return 0; -} - -
--- a/test05.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test05.c Sat May 23 07:19:57 2020 +0900 @@ -1,10 +1,13 @@ -#include<stdio.h> -#include<stdlib.h> +//#include<stdio.h> +extern int printf(const char*, ...); #define dprint(f, args...) \ printf("in %s: "f, __FUNCTION__, ## args) +__code caller (int a); void f01 (int a); void f02 (int a, float b); +__code cs01 (int a); +__code cs02 (int a, float b); int main ();
--- a/test1.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test1.c Sat May 23 07:19:57 2020 +0900 @@ -1,127 +1,125 @@ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif /* - test for CbC converted __code from C -*/ + test for CbC converted __code from C + */ #include <stdio.h> -#include <stdlib.h> +extern void *malloc(size_t); typedef void *stack; void *stack0; /* size of void* == 1 */ struct cont_save { /* General Return Continuation */ - __code (*ret)(int,void*); + __code (*ret)(); }; /* - __code g(int,void *); - __code f_g0(int ,int ,void *); - __code f_g1(int,void *); + __code g(int,void *); + __code f_g0(int ,int ,void *); + __code f_g1(int,void *); */ struct f_g0_save { /* Specialized Return Continuation */ - __code (*ret)(int,void*); - int ii,kk,jj; + __code (*ret)(); + int ii,kk,jj; }; __code g(int i,void *sp) { - goto (* ((struct cont_save *)sp)->ret)(i+4,sp); + goto (* ((struct cont_save *)sp)->ret)(i+4,sp); } __code f_g1(int j,void *sp) { /* Continuation */ - int k; - struct f_g0_save *c; + int k; + struct f_g0_save *c; - c = sp; - k = c->kk; - sp += sizeof(struct f_g0_save); - goto (* ((struct cont_save *)sp)->ret)(k+4+j,sp); + c = sp; + k = c->kk; + sp += sizeof(struct f_g0_save); + goto (* ((struct cont_save *)sp)->ret)(k+4+j,sp); } __code f(int i,void *sp) { - int k,j; - struct f_g0_save *c; - printf("#0047:f 0 sp: %lx\n",sp-stack0); + int k,j; + struct f_g0_save *c; +printf("#0047:f 0 sp: %x\n",sp-stack0); - k = 3+i; + k = 3+i; - printf("#0051:f 1 sp: %lx\n",sp-stack0); - sp -= sizeof(struct f_g0_save); - printf("#0053:f 2 sp: %lx\n",sp-stack0); - c = sp; - c->kk = k; - c->ii = i; - c->jj = j; - c->ret = f_g1; - goto g(i,sp); +printf("#0051:f 1 sp: %x\n",sp-stack0); + sp -= sizeof(struct f_g0_save); +printf("#0053:f 2 sp: %x\n",sp-stack0); + c = sp; + c->kk = k; + c->ii = i; + c->jj = j; + c->ret = f_g1; + goto g(i,sp); } struct f0_save { /* Specialized Return Continuation */ - __code (*ret)(); - __code (*exit1)(); - void *exit1env; - int jj; + __code (*ret)(); + __code (*exit1)(); + void *exit1env; + int jj; }; __code f1(int i,void *sp) ; __code f0(int i,int j,__code(*exit2)(), void *exit2env,void *sp) { - struct f0_save *c; - printf("#0075:f0 1 sp: %lx\n",sp-stack0); - sp -= sizeof(struct f0_save); - printf("#0077:f0 2 sp: %lx\n",sp-stack0); - c = sp; - c->jj = j; - c->exit1 = exit2; - c->exit1env = exit2env; - c->ret = f1; - printf("#0083:f0 3 sp: %lx\n",sp-stack0); - goto f(i,sp); + struct f0_save *c; + printf("#0075:f0 1 sp: %x\n",sp-stack0); + sp -= sizeof(struct f0_save); + printf("#0077:f0 2 sp: %x\n",sp-stack0); + c = sp; + c->jj = j; + c->exit1 = exit2; + c->exit1env = exit2env; + c->ret = f1; + printf("#0083:f0 3 sp: %x\n",sp-stack0); + goto f(i,sp); } __code print(int i,int j,__code (*exit1)(),void*exit1env); __code f1(int i,void *sp) { - int j; - int *exit2env; - __code (*exit2)(); - struct f0_save *c; + int j; + int *exit2env; + __code (*exit2)(); + struct f0_save *c; - c = sp; - j = c->jj; - exit2 = c->exit1; - exit2env = c->exit1env; + c = sp; + j = c->jj; + exit2 = c->exit1; + exit2env = c->exit1env; - sp += sizeof(struct f0_save); - goto print(i,j,exit2,exit2env); + sp += sizeof(struct f0_save); + goto print(i,j,exit2,exit2env); } int main( int ac, char *av[]) { - int i,j; - int *sp; + int i,j; + int *sp; - // i = atoi(av[1]); - i = 1; - stack0 = ((char *)malloc(1024)+1024); - sp = stack0; - j = i; + // i = atoi(av[1]); + i = 1; + stack0 = ((char *)malloc(1024)+1024); + sp = stack0; + j = i; - printf("#0115:sp: %lx %lx\n",sp-(int*)stack0,sizeof(*stack0)); - goto f0(i,j,__return,__environment,sp); + printf("#0115:sp: %x %x\n",sp-(int*)stack0,sizeof(*stack0)); + goto f0(i,j,__return,__environment,sp); } -__code print(int i,int j,__code (*exit1)(int,void*),void*exit1env) +__code print(int i,int j,__code (*exit1)(),void*exit1env) { - printf("#0121:%d %d\n",i,j); - goto (*exit1)(0,exit1env); + printf("#0121:%d %d\n",i,j); + goto (*exit1)(0,exit1env); }
--- a/test2.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test2.c Sat May 23 07:19:57 2020 +0900 @@ -1,7 +1,5 @@ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif #include <stdio.h> int sender_bit; @@ -10,37 +8,38 @@ void *env; struct packet { - int bit; - char *msg; - __code (*next)(); + int bit; + char *msg; + __code (*next)(); }; __code print_struct(struct packet pkt) { - printf("#0017:bit: %d\n", pkt.bit); - printf("#0018:message: %s\n", pkt.msg); - goto ret(0, env); + printf("#0017:bit: %d\n", pkt.bit); + printf("#0018:message: %s\n", pkt.msg); + goto ret(0, env); } __code initSender(int init_bit, struct packet pkt) { - sender_bit = init_bit; - pkt.next = print_struct; - printf("#0026:initSender bit: %d\n", pkt.bit); - printf("#0027:initSender message: %s\n", pkt.msg); - printf("#0028:sender_bit: %d\n", sender_bit); - goto print_struct(pkt); + sender_bit = init_bit; + pkt.next = print_struct; + printf("#0026:initSender bit: %d\n", pkt.bit); + printf("#0027:initSender message: %s\n", pkt.msg); + printf("#0028:sender_bit: %d\n", sender_bit); + goto print_struct(pkt); } int main(void) { - struct packet pkt; - pkt.bit = 1; - pkt.msg = "hogehoge"; - pkt.next = initSender; - ret = __return; - env = __environment; - printf("#0040:main bit: %d\n", pkt.bit); - printf("#0041:main message: %s\n", pkt.msg); - goto initSender(0, pkt); + struct packet pkt; + pkt.bit = 1; + pkt.msg = "hogehoge"; + pkt.next = initSender; + ret = __return; + env = __environment; + printf("#0040:main bit: %d\n", pkt.bit); + printf("#0041:main message: %s\n", pkt.msg); + goto initSender(0, pkt); } +
--- a/test_array.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#include<stdio.h> -void print_array(int *, int); - -int main(int argc, char **argv){ - int array[10] = {10, 2, 3, 0, 7, 5}; - array[1] += array[2]+array[4]; - print_array(array, 10); - return 0; -} - -void print_array(int *a, int size){ - while( size-->0 ){ - printf(" %7d", *a++); - } - printf("\n"); -} -
--- a/test_call.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#include<stdio.h> -int test(int a){ - printf("a = %d\n", a); - return 10*a; -} - -int main(){ - test(10); - return 0; -} - -
--- a/test_cs.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_cs.c Sat May 23 07:19:57 2020 +0900 @@ -1,38 +1,45 @@ -#include<stdio.h> -#include<stdlib.h> +//#include<stdio.h> +//#include<stdlib.h> +extern int printf(const char*, ...); + +__code cs_exit(int , double , char ); +__code cs1(int, int, int, int); +__code cs2(double, double, int, double); void test_goto(void); int main(int argc, char **argv){ - printf("main start\n"); - test_goto(); - return 0; + printf("main start\n"); + //goto cs2(2.22, 3.33, 4, 5.55); + test_goto(); + return 0; } void test_goto(){ - goto cs1(10, 20, 30, 40); + goto cs1(10, 20, 30, 40); } __code cs1(int a, int b, int c, int d){ - printf("%4d, %4d, %4d, %4d\n", a, b, c, d); - a += 40, b += 40, c += 40, d += 40; - goto cs2((double)a, (double)b, c, (double)d); + printf("%4d, %4d, %4d, %4d\n", a, b, c, d); + a += 40, b += 40, c += 40, d += 40; + goto cs2((double)a, (double)b, c, (double)d); } __code cs2(double a, double b, int c, double d){ - printf("%4d, %4d, %4d, %4d\n", (int)a, (int)b, (int)c, (int)d); - a += 40, b += 40, c += 40, d += 40; - goto cs_exit((int)a, b, (char)c); + printf("%4d, %4d, %4d, %4d\n", (int)a, (int)b, (int)c, (int)d); + a += 40, b += 40, c += 40, d += 40; + goto cs_exit((int)a, b, (char)c); } __code cs_exit(int a, double b, char c){ - printf("%4d, %4d, %4d\n", (int)a, (int)b, (int)c); - printf("cs_exit was called!\n"); - exit(0); + printf("%4d, %4d, %4d\n", (int)a, (int)b, (int)c); + printf("cs_exit was called!\n"); + exit(0); } + void caller(int a, double b){ - cs2(b,20.0,a, 40.4); - cs1(10,20,30, 40); + cs2(b,20.0,a, 40.4); + cs1(10,20,30, 40); }
--- a/test_csp1.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_csp1.c Sat May 23 07:19:57 2020 +0900 @@ -1,49 +1,60 @@ #include<stdio.h> #include<stdlib.h> +//static __code (*csp)(int, int, int, int); +__code cs_end (int a); +__code cs0 (int a, int b, int c, int d); void* freturn (); -void function (double a, float b, int c); +__code cs_goto (int a, int b, int c, int d); +int function (double a, float b, int c); int main (int argc, char **argv); __code cs_goto(int a, int b, int c, int d){ - __code (*csp)(int, int, int, int); - csp = freturn(); - printf("csp = %p.\n", csp); + __code (*csp)(int, int, int, int); + csp = freturn(); + printf("csp = %x.\n", csp); + //printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d.\n", a, b, c, d, e, f, g); + //printf("cs_goto : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d); + //printf("cs_goto : a-4=%d, a-8=%d, a-12=%d, a-16=%d.\n", *(&a-4), *(&a-8), *(&a-12), *(&a-16)); + //printf("cs_goto : cs0(a, b, c, d)\n"); #ifdef INDIRECT - goto csp(b+a, d+b, a+c, c+d); + goto csp(b+a, d+b, a+c, c+d); #else - goto cs0(b+a, d+b, a+c, c+d); + goto cs0(b+a, d+b, a+c, c+d); #endif } __code cs_end(int a){ - printf("cs_exit : a=%d.\n", a); - exit(a); - goto cs_end(a); + printf("cs_exit : a=%d.\n", a); + exit(a); + goto cs_end(a); } __code cs0(int a, int b, int c, int d){ - printf("cs_cs0 : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d); - goto cs_end( (int)(20*a + 30*b + 40*c + 50*d) ); + //printf("cs0 : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d.\n", a, b, c, d, e, f, g); + printf("cs_cs0 : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d); + goto cs_end( (int)(20*a + 30*b + 40*c + 50*d) ); } void* freturn(){ - return cs0; + return cs0; } -void function(double a, float b, int c){ +int function(double a, float b, int c){ - printf("function:\n"); - printf("a=%lf, b=%f, c=%d\n", a, b, c); - goto cs_goto(10, 20, 30, 40); + printf("function:\n"); + printf("a=%lf, b=%f, c=%d\n", a, b, c); + //goto cs_goto(10, 20, 30, 40); + goto cs_goto(10, 20, 30, 40); } int main(int argc, char **argv){ - function(10.01, 20.02, 30); - return 0; + //csp = cs0; + function(10.01, 20.02, 30); + return 0; }
--- a/test_env.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -typedef void (*RET_FUNC)(int, void *); - -int main(int argc, char **argv) -{ - int r; - r = f(); - printf("%d\n", r); -} - -__code z(RET_FUNC ret, void *fp) -{ - printf("z: fp=0x%x\n", __builtin_frame_address(0)); - ret(5, fp); -} -__code i(RET_FUNC ret, void *fp) -{ - printf("i: fp=0x%x\n", __builtin_frame_address(0)); - goto z(ret, fp); -} -__code h(RET_FUNC ret, void *fp) -{ - printf("h: fp=0x%x\n", __builtin_frame_address(0)); - goto i(ret, fp); -} -__code g(RET_FUNC ret, void *fp) -{ - printf("g: fp=0x%x\n", __builtin_frame_address(0)); - goto h(ret, fp); -} - -int f() -{ - __label__ exit0; - int retval; - - printf("f0: fp = 0x%x\n", __builtin_frame_address(0)); - void __return_func(int retval_, void *fp){ - retval = retval_; - goto exit0; - } - - printf("f1: fp = 0x%x\n", __builtin_frame_address(0)); - - goto g(__return_func, __builtin_frame_address(0)); - - printf("bad\n"); - - exit0: - printf("f2: fp = 0x%x\n", __builtin_frame_address(0)); - return retval; -} - - -
--- a/test_func2code.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_func2code.c Sat May 23 07:19:57 2020 +0900 @@ -3,41 +3,41 @@ #define DEBUG 1 #ifdef DEBUG -#define log(f, args...) \ - fprintf(stderr, "in %s: "f, __FUNCTION__, ## args) + #define log(f, args...) \ + fprintf(stderr, "in %s: "f, __FUNCTION__, ## args) #else -#define log(f, args...) ; + #define log(f, args...) ; #endif __code exitter(int a) { - exit(0); + exit(0); } __code cs0(int x, int y) { - log("x = %d, y = %d.\n", x, y); - log("will exit with code %d.\n", x*y); - goto exitter(x*y); + log("x = %d, y = %d.\n", x, y); + log("will exit with code %d.\n", x*y); + goto exitter(x*y); } void continuation(int a) { - log("go code segment cs0\n"); - goto cs0(a, a*20); - log("Error: continuation reachs bad region.\n"); + log("go code segment cs0\n"); + goto cs0(a, a*20); + log("Error: continuation reachs bad region.\n"); } int main(int argc, char **argv) { - int a; - if (argc>2) { - a = atoi(argv[1]); - } - - continuation(20); + int a; + if (argc>2) { + a = atoi(argv[1]); + } + + continuation(20); }
--- a/test_nest.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -int printf(char *, ...); -typedef void (*RET_FUNC)(int, void *); - -void g(RET_FUNC func) -{ - func(33, 0); -} - -int f() -{ - void *ret; - ret = ({ - __label__ exit0; - int retval; - void __return_func(int retval_, void *fp){ - retval = retval_; - goto exit0; - } - if (0) { - exit0: - printf("f2: fp = 0x%x\n", __builtin_frame_address(0)); - return retval; - } - __return_func; - }); - - //g(__return_func, __builtin_frame_address(0)); - printf("f0: fp = 0x%x\n", __builtin_frame_address(0)); - printf("__return_func = %x\n", ret); - g(ret); - - printf("not good\n"); - return 0; - - //exit0: - //printf("f2: fp = 0x%x\n", __builtin_frame_address(0)); - //return retval; -} - -int main(int argc, char **argv) -{ - int t; - printf("main before: fp = 0x%x\n", __builtin_frame_address(0)); - t = f(); - printf("f = %d\n", t); - printf("main after: fp = 0x%x\n", __builtin_frame_address(0)); -}
--- a/test_para.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_para.c Sat May 23 07:19:57 2020 +0900 @@ -2,23 +2,25 @@ #include<stdlib.h> __code cs_exit(int a){ - printf("cs_exit was called: a=%d.\n", a); - exit(a); + printf("cs_exit was called: a=%d.\n", a); + exit(a); } __code cs0(int a, double b, int c, int d){ - printf("cs0 was called: a=%d, b=%lf, c=%d, d=%d.\n", a, b, c, d); - goto cs_exit( (int)(20*a + 4.4*b + 2022/c + 28*d) ); + printf("cs0 was called: a=%d, b=%lf, c=%d, d=%d.\n", a, b, c, d); + goto cs_exit( (int)(20*a + 4.4*b + 2022/c + 28*d) ); } + __code cs_goto(){ - goto cs0(11, 22.2, 33, 44); + goto cs0(11, 22.2, 33, 44); } int main(int argc, char **argv){ - printf("it is in main.\n"); - goto cs_goto(); - return 0; + + printf("it is in main.\n"); + goto cs_goto(); + return 0; }
--- a/test_para2.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_para2.c Sat May 23 07:19:57 2020 +0900 @@ -2,30 +2,39 @@ #include<stdlib.h> __code cs_end(int a){ - printf("cs_exit : a=%d.\n", a); - exit(a); + printf("cs_exit : a=%d.\n", a); + exit(a); } __code cs0(int a, int b, int c, int d); __code cs_goto(int a, int b, int c, int d){ - printf("cs_goto : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d); - goto cs0(b, c, d, a); + //printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d.\n", a, b, c, d, e, f, g); + printf("cs_goto : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d); + //printf("cs_goto : a-4=%d, a-8=%d, a-12=%d, a-16=%d.\n", *(&a-4), *(&a-8), *(&a-12), *(&a-16)); + //printf("cs_goto : cs0(a, b, c, d)\n"); + goto cs0(b, c, d, a); } __code cs0(int a, int b, int c, int d){ - printf("cs_cs0 : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d); - goto cs_end( (int)(20*a + 30*b + 40*c + 50*d) ); + //printf("cs0 : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d.\n", a, b, c, d, e, f, g); + printf("cs_cs0 : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d); + goto cs_end( (int)(20*a + 30*b + 40*c + 50*d) ); } -void function(double a, float b, int c){ - goto cs_goto(10, 20, 30, 40); +int function(double a, float b, int c){ + + //printf("function:\n"); + //printf("a=%lf, b=%f, c=%d\n", a, b, c); + //goto cs_goto(10, 20, 30, 40); + goto cs_goto(10, 20, 30, 40); } int main(int argc, char **argv){ - function(10.01, 20.02, 30); - return 0; + + function(10.01, 20.02, 30); + return 0; }
--- a/test_para3.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_para3.c Sat May 23 07:19:57 2020 +0900 @@ -2,73 +2,82 @@ #include<stdlib.h> struct abc { - int a; - double b; - char c; - double *d; + int a; + double b; + char c; + double *d; }; struct def { - int d; - struct abc e; - struct abc *f; + int d; + struct abc e; + struct abc *f; }; void print_abc(struct abc a){ - printf("\tstruct abc:\n"); - printf("\ta=%d, b=%lf, c=%d, d=%p\n", a.a, a.b, a.c, a.d); + printf("\tstruct abc:\n"); + printf("\ta=%d, b=%lf, c=%d, d=%p\n", a.a, a.b, a.c, a.d); } void print_def(struct def b){ - printf("\tstruct def:\n"); - printf("\td=%d, f=%p\n", b.d, b.f); - print_abc(b.e); + printf("\tstruct def:\n"); + printf("\td=%d, f=%p\n", b.d, b.f); + print_abc(b.e); } __code cs_exit(int a){ - printf("cs_exit : a=%d.\n", a); - exit(a); + printf("cs_exit : a=%d.\n", a); + exit(a); } __code cs0(struct abc a, struct def b, int c){ - printf("cs0 :\n"); - printf("c=%d\n", c); - print_abc(a); - print_def(b); - goto cs_exit( c*a.a+b.e.c ); + printf("cs0 :\n"); + printf("c=%d\n", c); + print_abc(a); + print_def(b); + goto cs_exit( c*a.a+b.e.c ); } __code cs_goto(int c, struct abc a, struct def b){ - printf("cs_goto :\n"); - printf("c=%d\n", c); - print_abc(a); - print_def(b); - goto cs0(a, b, c); + printf("cs_goto :\n"); + printf("c=%d\n", c); + print_abc(a); + print_def(b); + goto cs0(a, b, c); } int function(){ - struct abc A; - struct def B; - A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad; - B.d = 30, B.f = 0xbf; - B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed; + struct abc A; + struct def B; + A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad; + B.d = 30, B.f = 0xbf; + B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed; - printf("function :\n"); - print_abc(A); - print_def(B); - goto cs_goto(100, A, B); - return 0; + printf("function :\n"); + print_abc(A); + print_def(B); + //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d); + goto cs_goto(100, A, B); + return 0; } int main(int argc, char **argv){ - struct abc A; - struct def B; - A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad; - B.d = 30, B.f = 0xbf; - B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed; + struct abc A; + struct def B; + //int a=10, b=20, c=30, d=40, e=50, f=60, g=70; + A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad; + B.d = 30, B.f = 0xbf; + B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed; - function(); - return 0; + /* + printf("main :\n"); + print_abc(A); + print_def(B); + //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d); + goto cs_goto(100, A, B); + */ + function(); + return 0; }
--- a/test_para4.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_para4.c Sat May 23 07:19:57 2020 +0900 @@ -1,63 +1,76 @@ -#include<stdio.h> -#include<stdlib.h> +//#include<stdio.h> +//#include<stdlib.h> + +extern int printf(const char*, ...); #define DPRINT 1 #define NOINLINE __attribute__((noinline)) extern __code cs_goto(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, - int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2); + int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2); extern __code cs0(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, - int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2); + int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2); __code (*csp)(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, - int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2); + int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2); __code NOINLINE cs_exit(int a){ - int b = 20 * a + 3; - printf("cs_exit : a=%d. b=%d\n", a, b); - exit(a); + int b = 20 * a + 3; + printf("cs_exit : a=%d. b=%d\n", a, b); + exit(a); } __code NOINLINE cs0(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, - int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2){ + int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2){ #if DPRINT - printf("cs0 : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", - a, b, c, d, e, f, g, h, i, j); - printf("cs0 : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", - a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); + //printf("cs0 : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d.\n", a, b, c, d, e, f, g); + printf("cs0 : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a, b, c, d, e, f, g, h, i, j); + printf("cs0 : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); #endif - goto cs_exit( (int)(10*a + 10*b + 10*i2 + 10*j2) ); + goto cs_exit( (int)(10*a + 10*b + 10*i2 + 10*j2) ); } __code NOINLINE cs_goto(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, - int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2){ + int a2, int b2, int c2, int d2, int e2, int f2, int g2, int h2, int i2, int j2){ #if DPRINT - printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", - a, b, c, d, e, f, g, h, i, j); - printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", - a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); + printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a, b, c, d, e, f, g, h, i, j); + printf("cs_goto : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); #endif - goto cs0(b, c, d, e, f, g, h, i, j, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, a); + goto cs0(b, c, d, e, f, g, h, i, j, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, a); } -void function(double l, float m, int n){ - int a=10, b=20, c=30, d=40, e=50, f=60, g=70, h=80, i=90, j=100; - int a2=110, b2=120, c2=130, d2=140, e2=150, f2=160, g2=170, h2=180, i2=190, j2=200; +int function(double l, float m, int n){ + int a=10, b=20, c=30, d=40, e=50, f=60, g=70, h=80, i=90, j=100; + int a2=110, b2=120, c2=130, d2=140, e2=150, f2=160, g2=170, h2=180, i2=190, j2=200; #if DPRINT - printf("function: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", - a, b, c, d, e, f, g, h, i, j); - printf("function: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", - a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); + printf("function: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a, b, c, d, e, f, g, h, i, j); + printf("function: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); + //printf("l=%lf, m=%f, n=%d\n", l, m, n); #endif - goto cs_goto(a, b, c, d, e, f, g, h, i, j, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); + //goto cs_goto(10, 20, 30, 40); + goto cs_goto(a, b, c, d, e, f, g, h, i, j, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); } int main(int argc, char **argv){ - function(10.01, 20.02, 30); - return 0; + //printf("main :\n"); + /* + printf("main : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a, b, c, d, e, f, g, h, i, j); + printf("main : a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d, j=%d\n", + a2, b2, c2, d2, e2, f2, g2, h2, i2, j2); + */ + //csp = cs0; + function(10.01, 20.02, 30); + return 0; }
--- a/test_return.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -#include<stdio.h> - -#ifdef CLANG -#define _CbC_return __return -#define _CbC_environment __environment -#endif - - -#if 0 -typedef float testtype; -testtype good = 33.3f; -testtype bad = 0.0f; -void print_testtype(testtype t) -{ - printf("return value = %2.3f good=%2.3f,bad=%2.3f\n", t,good,bad); -} -#elif 1 -typedef char testtype; -testtype good = 33; -testtype bad = 0; -void print_testtype(testtype t) -{ - printf("return value = %d, good=%d,bad=%d\n", t,good,bad); -} -#elif 0 -typedef double testtype; -testtype good = 333.3; -testtype bad = 0.00; -void print_testtype(testtype t) -{ - printf("return value = %3.3lf, good=%3.3lf,bad=%3.3lf\n", t,good,bad); -} -#elif 0 -typedef -struct { - int a; - float b; - int c[4]; -} testtype; -testtype good = {33, 33.3, {4,4,4,4}}; -testtype bad = {0, 00.0, {0,0,0,0}}; -void print_testtype(testtype t) -{ - printf( "return value = {\n" - " a = %d\n" - " b = %2.3f\n" - " c = { %d, %d, %d, %d }" - "}\n", t.a, t.b, - t.c[0],t.c[1],t.c[2],t.c[3]); -} -#else -typedef int testtype; -testtype good = 33; -testtype bad = 0; -void print_testtype(testtype t) -{ - printf("return value = %d, good=%d,bad=%d\n", t,good,bad); -} -#endif - -typedef void (*RET_FUNC)(testtype, void *); - -void g(RET_FUNC func) -{ - func(good, NULL); -} - -testtype f_cbc() -{ - void *ret; - - ret = _CbC_return; - - printf("f0: fp = %p\n", __builtin_frame_address(0)); - printf("__return_func = %p\n", ret); - g(ret); - - printf("not good\n"); - return bad; -} - -int main(int argc, char **argv) -{ - testtype t; - printf("main before: fp = %p\n", __builtin_frame_address(0)); - t = f_cbc(); - print_testtype(t); - printf("main after: fp = %p\n", __builtin_frame_address(0)); -} -
--- a/test_struct.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#include<stdio.h> -struct aaa{ - int a; // 4 - char b; // 1 - int c; // 4 - double d; // 8 - char e[10]; //10 -}; //27 --> 32 - -void tset01(struct aaa B, int size); - -int main(int argc, char **argv){ - struct aaa A; - A.a = 10; - A.b = 'A'; - A.c = 20; - A.d = 1.11; - A.e[0] = 'A', A.e[1] = 'Z'; - - printf("sizeof aaa = %lu\n", sizeof(struct aaa)); - tset01(A, 10); - return 0; -} - -void tset01(struct aaa B, int size){ - printf("B.a = %d\n", B.a); - printf("B.b = %d\n", B.b); - printf("B.c = %d\n", B.c); - printf("B.d = %lf\n", B.d); - B.e[9] = '\0'; - printf("B.e = %s\n", B.e); - printf("size = %d\n", size); -}
--- a/test_tailcall1.c Sat Mar 21 09:15:18 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#include<stdio.h> - -void B(int a, int b, int c){ - printf("B: a=%d, b=%d, c=%d\n", a, b, c); - return ; -} - -void* freturn(){ - return B; -} -void A(int a, int b, int c, int d){ - void (*fp)(int, int, int); - fp = freturn(); - - printf("A: a=%d, b=%d, c=%d, d=%d\n", a, b, c, d); - return fp(a, b, c+d); -} - -int main(int argc, char **argv){ - printf("main: \n"); - A(10, 20, 30, 40); - return 0; -} - -
--- a/test_tree.c Sat Mar 21 09:15:18 2020 +0900 +++ b/test_tree.c Sat May 23 07:19:57 2020 +0900 @@ -1,55 +1,56 @@ -#include<stdio.h> -#include<stdlib.h> +//#include<stdio.h> +extern int printf(const char*, ...); +extern void exit(int); double test(char, char, int, double); __code cs(int , double , char ); void testvoid(double a); int testint(double a); -__code test_goto1(int a, int b, double c); __code cs(int a, double b, char c){ - printf("__code cs was called.\n"); - printf("a = %d, b = %lf, c = %d\n", a, b, c); - exit(0); + printf("__code cs was called.\n"); + printf("a = %d, b = %lf, c = %d\n", a, b, c); + exit(0); } __code cs1(int a, double b, char c, int d){ - printf("__code cs1 was called.\n"); - printf("a = %d, b = %lf, c = %d, d = %d\n", a, b, c, d); - exit(0); + printf("__code cs1 was called.\n"); + printf("a = %d, b = %lf, c = %d, d = %d\n", a, b, c, d); + exit(0); } int main(int argc, char **argv){ - double t; + double t; + //goto cs(2, 10.2, 2); - t = test('a', 'b', 10, 2.5); - printf("t = %lf\n", t); - testvoid(2.22); - testint(2.22); + t = test('a', 'b', 10, 2.5); + printf("t = %lf\n", t); + testvoid(2.22); + testint(2.22); - printf("test_goto\n"); - goto test_goto1(10, 20, 30.3); - return 0; + printf("test_goto\n"); + goto test_goto1(10, 20, 30.3); + return 0; } void test0(){ - exit(0); + exit(0); } void testvoid(double a){ - return ; + return ; } int testint(double a){ - int b; - b = (a*100-a) +2; - return 1; + int b; + b = (a*100-a) +2; + return 1; } double test(char c, char l, int a, double d){ - return (double)a*d+c+l; + return (double)a*d+c+l; } void test_goto(int a, int b, double c){ - goto cs(2, 10.2, 3); + goto cs(2, 10.2, 3); } __code test_goto1(int a, int b, double c){ - goto cs1(2, 10.2, 3, 4); + goto cs1(2, 10.2, 3, 4); }
--- a/tmp1.c Sat Mar 21 09:15:18 2020 +0900 +++ b/tmp1.c Sat May 23 07:19:57 2020 +0900 @@ -1,86 +1,102 @@ /* easy test */ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif + + extern int printf(const char *,...); -__code (*ret)(int, void*); -void *env; -__code exit1(int ac,void *vp); -__code code0(int ac,char *av[],__code (*ret)(int, void*)); -__code code1(int ac,char *av[],__code (*exit)(int,void*)); +#if 0 //currently gcc version dose not support void type full continuation. + +__code code0(int ac,char *av[],__code (*ret)(void*)); +__code code1(int ac,char *av[],__code (*exit)(void*)); __code code3(char a,char b,int c,int d,int e,int f); __code code4(char a,char b,int c,int d,int e,int f); -int main0(int ac,char *av[]) +__code (*ret)(void *); +void *env; +__code exit1(void *); + +void main0(ac,av) +int ac; +char *av[]; { - ret = __return; - env = __environment; - printf("#0017:main0 %d start.\n",ac); - if (ac>=1) - goto code0(ac,av,__return); - goto code1(ac,av,exit1); - // not reached. (warning?) - printf("#0022:main0 %d end.\n",ac); - return 0; + ret = __return; + env = __environment; + printf("#0017:main0 %d start.\n",ac); + if (ac>=1) + goto code0(ac,av,__return); + goto code1(ac,av,exit1); + // not reached. (warning?) + printf("#0022:main0 %d end.\n",ac); } -__code exit1(int ac,void *vp) +__code exit1(void *env) { - goto code3(0,1,2,3,4,5); + // exit(0); + goto code3(0,1,2,3,4,5); } -__code code3(char a,char b,int c,int d,int e,int f) +__code code3(a,b,c,d,e,f) +char a,b; +int c,d,e,f; { - printf("#0035:code3: %d %d %d %d %d %d\n",a,b,c,d,e,f); - if(a<10) - goto code3(a+1,b,c,d,e,f); - else - goto code4(a+3,b+3,c+3,d+3,e+3,f+3); + printf("#0035:code3: %d %d %d %d %d %d\n",a,b,c,d,e,f); + if(a<10) + goto code3(a+1,b,c,d,e,f); + else + goto code4(a+3,b+3,c+3,d+3,e+3,f+3); } -__code code4(char a,char b,int c,int d,int e,int f) +__code code4(a,b,c,d,e,f) +char a,b; +int c,d,e,f; { - int i=1,j=2; - printf("#0047:code4: %d %d %d %d %d %d\n",a,b,c,d,e,f); - if(a<20) // cyclic binary dependency - goto code3(a+b,b+c,c+d,d+e,e+f,f+a); - else if(a<30) - goto code3(a,b,c,d,e,f); - else if(a<40) // cyclic dependency - goto code3(b,c,a,e,f,d); - else if(a<50) - goto code4(a+i,b+j,c+i,d+3,e+3,f+3); - else goto ret(0,env); + int i=1,j=2; + printf("#0047:code4: %d %d %d %d %d %d\n",a,b,c,d,e,f); + if(a<20) // cyclic binary dependency + goto code3(a+b,b+c,c+d,d+e,e+f,f+a); + else if(a<30) + goto code3(a,b,c,d,e,f); + else if(a<40) // cyclic dependency + goto code3(b,c,a,e,f,d); + else if(a<50) + goto code4(a+i,b+j,c+i,d+3,e+3,f+3); + else goto ret(env); } -__code code0(int ac,char *av[],__code (*ret)(int, void*)) +__code code0(ac,av,ret) +int ac; +char *av[]; +__code (*ret)(void *env); { - goto code1(ac,av,ret); + goto code1(ac,av,ret); } -__code code1(int ac,char *av[], __code (*exit)(int,void*)) +__code code1(ac,av,exit) +int ac; +__code (*exit)(void*); +char *av[]; { - __code (*f)(int,void *); - printf("#0073:code1: %d\n",ac); - f = exit; - if (ac>3) - goto code1(ac,av,f); - else if (ac>2) - goto code1((int)av,(char**)ac,f); - else - goto (*f)(ac,env); + __code (*f)(void *); + printf("#0073:code1: %d\n",ac); + f = exit; + if (ac>3) + goto code1(ac,av,f); + else if (ac>2) + goto code1(ac,av,f); + else + goto (*f)(env); } -int -main(int ac,char *av[]) +#endif + +int main(int ac,char *av[]) { - main0(1,av); - printf("#0087:main continue.\n"); - main0(0,av); - printf("#0089:main end.\n"); - return 0; +// main0(1,av); + printf("#0087:main continue.\n"); +// main0(0,av); + printf("#0089:main end.\n"); +return 0; } /* end */
--- a/tmp2.c Sat Mar 21 09:15:18 2020 +0900 +++ b/tmp2.c Sat May 23 07:19:57 2020 +0900 @@ -1,16 +1,16 @@ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif #include "stdio.h" int main0(int ac,char *av[]); -__code code0(char *av[],__code (*ret)(),void *retenv); -__code code1(char *av[],__code (*ret)(),void *retenv); +__code code0(char *av[],__code (*ret)(int, void*),void *retenv); +__code code1(char *av[],__code (*ret)(int, void*),void *retenv); int -main(int ac,char *av[]) +main(ac,av) +int ac; +char *av[]; { int i; i=main0(ac,av); @@ -19,14 +19,18 @@ } int -main0(int ac,char *av[]) +main0(ac,av) +int ac; +char *av[]; { fprintf(stdout,"#0021:2: %s\n",av[0]); - goto code0(av,__return,__environment); - return 0; + goto code0(av,_CbC_return,_CbC_environment); } -__code code0(char *av[],__code (*ret)(int,void*),void *retenv) +__code code0(av,ret,retenv) +char *av[]; +__code (*ret)(int, void*); +void *retenv; { char *p; p = av[0]; @@ -34,7 +38,10 @@ goto code1(av,ret,retenv); } -__code code1(char *av[],__code (*ret)(int, void*),void *retenv) +__code code1(av,ret,retenv) +char *av[]; +__code (*ret)(int, void*); +void *retenv; { fprintf(stdout,"#0041:4: %s\n",av[0]); goto (*ret)(1234,retenv);
--- a/tmp4.c Sat Mar 21 09:15:18 2020 +0900 +++ b/tmp4.c Sat May 23 07:19:57 2020 +0900 @@ -1,17 +1,17 @@ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif #include "stdio.h" -int main0(int ac,char *av[]); -__code code0(int i,int j,int k,char *av[],__code (*ret)(int,void*),void*retenv); -__code code1(int i,int j,int k,char *av[],__code(*ret)(int,void*),void*retenv); -__code code2(int i,int j,int k,char *av[],__code (*ret)(int, void*),void *retenv); +int main0(int ac, char *av[]); +__code code0( int i,int j,int k, char *av[], __code (*ret)(), void *retenv); +__code code1( int i,int j,int k, char *av[], __code (*ret)(), void *retenv); +__code code2( int i,int j,int k, char *av[], __code (*ret)(), void *retenv); int -main(int ac,char *av[]) +main(ac,av) +int ac; +char *av[]; { int i; i=main0(ac,av); @@ -20,7 +20,9 @@ } int -main0(int ac,char *av[]) +main0(ac,av) +int ac; +char *av[]; { int i,j,k; i=123; @@ -28,10 +30,13 @@ k=789; fprintf(stdout,"#0025:2: %s\n",av[0]+2); goto code0(i,j,k,av,__return,__environment); - return 0; } -__code code0(int i,int j,int k,char *av[],__code (*ret)(int,void*),void*retenv) +__code code0(i,j,k,av,ret,retenv) +int i,j,k; +char *av[]; +__code (*ret)(); +void *retenv; { char *p; p = av[0]+2; @@ -39,13 +44,21 @@ goto code1(i,j,k,av,ret,retenv); } -__code code1(int i,int j,int k,char *av[],__code(*ret)(int,void*),void*retenv) +__code code1(i,j,k,av,ret,retenv) +int i,j,k; +char *av[]; +__code (*ret)(); +void *retenv; { fprintf(stdout,"#0047:4: %s\n",av[0]+2); goto code2(i,j,k,av,ret,retenv); } -__code code2(int i,int j,int k,char *av[],__code (*ret)(int,void*),void *retenv) +__code code2(i,j,k,av,ret,retenv) +int i,j,k; +char *av[]; +__code (*ret)(); +void *retenv; { fprintf(stdout,"#0057:5: %s\n",av[0]+2); fprintf(stdout,"#0058:5: i=%d j=%d k=%d\n",i,j,k);
--- a/tmpa.c Sat Mar 21 09:15:18 2020 +0900 +++ b/tmpa.c Sat May 23 07:19:57 2020 +0900 @@ -1,51 +1,49 @@ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif #include <stdio.h> struct enemy{ - int charno; // image number - float x; // x location - float y; // y location - int ap; // armor point + int charno; // image number + float x; // x location + float y; // y location + int ap; // armor point }; void print_param(struct enemy *e) { - printf("#0014:charno:%d x,y:%f,%f hp:%d\n", - e->charno,e->x,e->y,e->ap); + printf("#0014:charno:%d x,y:%f,%f hp:%d\n", + e->charno,e->x,e->y,e->ap); } typedef struct{ - char dest; - int VF01[4]; - __code (*ret)(int,void*); - void *env; + char dest; + int VF01[4]; + __code (*ret)(); + void *env; } interface; __code a0(interface a) { - printf("#0026:%d\n",a.dest); - goto a.ret(0,a.env); + printf("#0026:%d\n",a.dest); + goto a.ret(0,a.env); } int main(int argc,char *argv[]) { - struct enemy e; + struct enemy e; #if 0 - interface args = {15,{0,0,0,0},return,environment}; + interface args = {15,{0,0,0,0},return,environment}; #else - interface args = {15,{0,0,0,0},0,0}; - args.ret = __return; - args.env = __environment; + interface args = {15,{0,0,0,0},0,0}; + args.ret = __return; + args.env = __environment; #endif - e.charno=5; e.x=50.0; e.y=30.0; e.ap=100; - print_param(&e); + e.charno=5; e.x=50.0; e.y=30.0; e.ap=100; + print_param(&e); - printf("#0045:%d %d\n",args.VF01[2],args.VF01[1]); - goto a0(args); + printf("#0045:%d %d\n",args.VF01[2],args.VF01[1]); + goto a0(args); }
--- a/too-long-argument.c Sat Mar 21 09:15:18 2020 +0900 +++ b/too-long-argument.c Sat May 23 07:19:57 2020 +0900 @@ -1,7 +1,5 @@ -#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return -#endif #include <stdio.h> @@ -9,37 +7,37 @@ typedef __code (*CCC)( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff, - __code(*ret)(int,void *), - void *env); + __code(*ret)(int,void *), + void *env); __code tcode2( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff, - __code(*ret)(int,void *), - void *env) + __code(*ret)(int,void *), + void *env) { - fprintf(stdout,"#0017:tcode2: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n", - f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff); - goto ret(0,env); +fprintf(stdout,"#0017:tcode2: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n", +f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff); + goto ret(0,env); } __code tcode1(f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff,ret,env) - int f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff; - __code(*ret)(int,void *); - void *env; + int f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff; + __code(*ret)(int,void *); + void *env; { - fprintf(stdout,"#0028:tcode1: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n", - f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff); - goto ret(0,env); +fprintf(stdout,"#0028:tcode1: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n", +f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff); + goto ret(0,env); } __code tcode4(int x,int y,CCC junction,__code(*ret)(int,void *),void *env) { #ifdef WRONGNUMBER - goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,ret,env); + goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,ret,env); #else - goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env); + goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env); #endif } @@ -47,9 +45,9 @@ tcode0(int x,int y,__code(*junction)(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,__code(*)(int, void *),void *),__code(*ret)(int,void *),void *env) { #ifdef WRONGNUMBER - goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,ret,env); + goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,ret,env); #else - goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env); + goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,ret,env); #endif } @@ -57,52 +55,50 @@ main0() { #ifdef WRONGNUMBER - goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - __return,__environment); + goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + __return,__environment); #else - goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14, - __return,__environment); + goto tcode2(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14, + __return,__environment); #endif - return 0; } int main1() { #ifdef WRONGNUMBER - goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13, - __return,__environment); + goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13, + __return,__environment); #else - goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14, - __return,__environment); + goto tcode1(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14, + __return,__environment); #endif - return 0; } int main2() { - goto tcode0(0,1,tcode1,__return,__environment); - return 0; + goto tcode0(0,1,tcode1,__return,__environment); } int main4() { - goto tcode4(0,1,tcode2,__return,__environment); - return 0; + goto tcode4(0,1,tcode2,__return,__environment); } int main() { - printf("#0092:main4\n"); - main4(); - printf("#0094:main2\n"); - main2(); - printf("#0096:main0\n"); - main0(); - printf("#0098:main1\n"); - main1(); - return 0; + printf("#0092:main4\n"); + main4(); + printf("#0094:main2\n"); + main2(); + printf("#0096:main0\n"); + main0(); + printf("#0098:main1\n"); + main1(); +return 0; } + +//