annotate goto.c @ 2:35d6eabeadb0

modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Wed, 22 Oct 2014 02:06:29 +0900
parents bacef8675607
children 586096c45873
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #define __environment _CbC_environment
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #define __return _CbC_return
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 extern int printf(const char *,...);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 __code (*conv)(int,__code (*)());
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 __code a2(int i,__code conv());
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 __code a3(int i,__code conv());
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 __code a4(int i,__code conv());
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 __code a5(int i,__code conv());
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 __code a6();
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 __code a7();
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 __code a8();
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 __code a9();
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 char* print_conv(__code conv());
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 __code (*exit0)(int,void*);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 void *env;
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 a2(int i,__code conv())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 printf("#0023:a2 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 goto conv(i+1,a4);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 a3(int i,__code (*conv)())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 printf("#0030:a3 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 goto conv(i+1,a5);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 a4(int i,__code conv())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 printf("#0037:a4 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 goto (*conv)(i+1,a6);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 a5(int i,__code (*conv)())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 printf("#0044:a5 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 goto (*conv)(i+1,i+2,i+3,a7);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 a6(int i,int j,int k,__code conv())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 printf("#0051:a6 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 goto conv(i+1,j,k,a8);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 a7(int i,int j,int k,__code (*conv)())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 printf("#0058:a7 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 goto conv(i+1,j,k,a9);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 a8(int i,int j,int k,__code conv())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 printf("#0065:a8 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 goto (*conv)(i+1,j,k,exit0);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 __code
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 a9(int i,int j,int k,__code (*conv)())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 printf("#0072:a9 %d %s\n",i,print_conv(conv));
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 goto (*conv)(0,env);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 main(int ac,char *av[]) {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 exit0 = __return;
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 env = __environment;
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 conv = a2;
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 goto conv(1,a3);
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 }
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 char*
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 print_conv(__code conv())
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 {
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 if(conv==a2) return "a2";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 if(conv==a3) return "a3";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 if(conv==a4) return "a4";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 if(conv==a5) return "a5";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 if(conv==a6) return "a6";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 if(conv==a7) return "a7";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 if(conv==a8) return "a8";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 if(conv==a9) return "a9";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 else return "xx";
bacef8675607 init repository
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 }