annotate CbC_examples/arg.c @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 5f20bc1ed4ff
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
231
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "stdio.h"
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #define __environment _CbC_environment
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #define __return _CbC_return
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 struct arg {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 int a0;int a1;int a2;int a3;int a4;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 };
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 extern void exit(int);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 void *exit_env;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 __code (*exit___code)();
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 // #ifndef __llvm__
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 __code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 __code cargs(struct arg args0,__code exit1(int, void*),void *env);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 __code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 __code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 __code carg6(int i, int j,int k,int l,struct arg args0);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 // #endif
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 __code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 printf("#0017:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 goto carg2(arg1,arg2,arg3,arg4,arg0,exit1,env);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 __code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(int, void*),void *env)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 struct arg args0;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 printf("#0024:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env );
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 args0.a0 = arg0;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 args0.a1 = arg1;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 args0.a2 = arg2;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 args0.a3 = arg3;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 args0.a4 = arg4;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 goto cargs(args0,exit1,env);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 __code cargs(struct arg args0,__code exit1(int, void*),void *env)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 printf("#0035:args: %d %d %d %d %d : %x %x\n",
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 exit1==exit___code,env==exit_env);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 // goto exit1(321),env;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 goto (*exit1)(0,env);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 __code carg3(struct arg args0,struct arg args1,int i, int j,int k,int l)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 printf("#0045:args3: %d %d %d %d %d : %x %x %x %x\n",
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 printf("#0047:args3: args0 %d %d %d %d %d : args1 %d %d %d %d %d : %x %x %x %x\n",
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 args1.a0,args1.a1,args1.a2,args1.a3,args1.a4,
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 i,j,k,l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 if (args0.a0==args1.a0) exit(0);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 goto carg4(args0,args1,j,k,l,i);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 __code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 printf("#0057:args4: %d %d %d %d %d : %x %x %x %x\n",
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 goto carg5(args1,args0,j,k,l,i);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 __code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 printf("#0064:args5: %d %d %d %d %d : %x %x %x %x\n",
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 goto carg6(i,j,k,l,args0);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 __code carg6(int i, int j,int k,int l,struct arg args0)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 printf("#0071:args6: %d %d %d %d %d : %x %x %x %x\n",
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 goto carg3(args0,args0,i,j,k,l);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 int main1(int n)
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 goto carg1(0,1,2,3,4,exit___code=__return,exit_env=__environment);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 return n;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 struct arg a00;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 struct arg a01;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 int main( int ac, char *av[])
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 {
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 int n;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 n = main1(123);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 printf("#0089:321=%d\n",n);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 a00.a0 = 11;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 a00.a1 = 22;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 a00.a2 = 33;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 a00.a3 = 44;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 a00.a4 = 55;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 a01.a0 = 66;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 a01.a1 = 77;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 a01.a2 = 88;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 a01.a3 = 99;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 a01.a4 = 10;
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 goto carg3(a00,a01,1,2,3,4);
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 }
5f20bc1ed4ff orignal merge with github
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112