Mercurial > hg > CbC > CbC_examples
annotate normal2.c @ 14:7d168c1829c9
modify makefile
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Apr 2015 16:09:28 +0900 |
parents | 35d6eabeadb0 |
children |
rev | line source |
---|---|
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1 #include<stdio.h> |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2 #include<stdlib.h> |
0 | 3 |
4 struct abc { | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
5 int a; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
6 double b; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
7 char c; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
8 double *d; |
0 | 9 }; |
10 | |
11 struct def { | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
12 int d; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
13 struct abc e; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
14 struct abc *f; |
0 | 15 }; |
16 | |
17 void print_abc(struct abc a){ | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
18 printf("\tstruct abc:\n"); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
19 printf("\ta=%d, b=%lf, c=%d, d=%p\n", a.a, a.b, a.c, a.d); |
0 | 20 } |
21 void print_def(struct def b){ | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
22 printf("\tstruct def:\n"); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
23 printf("\ta=%d, b=%p\n", b.d, b.f); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
24 print_abc(b.e); |
0 | 25 } |
26 | |
27 void cs_exit(int a){ | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
28 printf("cs_exit : a=%d.\n", a); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
29 exit(a); |
0 | 30 } |
31 | |
32 void cs0(struct abc a, struct def b, int c){ | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
33 printf("cs0 :\n"); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
34 print_abc(a); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
35 print_def(b); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
36 return cs_exit( c*a.a+b.e.c ); |
0 | 37 } |
38 | |
39 | |
40 void cs_goto(int c, struct abc a, struct def b){ | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
41 printf("cs_return :\n"); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
42 print_abc(a); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
43 print_def(b); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
44 return cs0(a, b, c); |
0 | 45 } |
46 | |
47 int main(int argc, char **argv){ | |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
48 struct abc A; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
49 struct def B; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
50 //int a=10, b=20, c=30, d=40, e=50, f=60, g=70; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
51 A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
52 B.d = 30, B.f = &A; |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
53 B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0; |
0 | 54 |
2
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
55 printf("main :\n"); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
56 print_abc(A); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
57 print_def(B); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
58 //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
59 cs_goto(100, A, B); |
35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
60 return 0; |
0 | 61 } |
62 | |
63 | |
64 | |
65 |