Mercurial > hg > CbC > old > device
annotate test/simp.c @ 928:96c53f76b360
fix
author | kono |
---|---|
date | Sun, 13 Apr 2014 10:21:40 +0900 |
parents | 5313ed059cee |
children |
rev | line source |
---|---|
618 | 1 // #include "stdio.h" |
868
c55337499f96
remove warnings and error from test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
748
diff
changeset
|
2 extern int printf(const char *,...); |
0 | 3 |
618 | 4 // #define UNDECL |
541 | 5 |
690 | 6 long long q = 122; |
7 | |
8 void | |
9 main5() | |
10 { | |
11 long long *p; | |
12 int r[10]; | |
13 double d; | |
14 | |
15 p = (long long *)&r; | |
16 *p = q; | |
17 | |
18 d= (double)(*(long long*)&r); | |
19 | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
20 printf("#0019:%lld %g\n",*p,d); |
690 | 21 } |
22 | |
23 | |
541 | 24 float f = 3; |
25 float g = 4096.0f; | |
26 | |
542 | 27 int kk = {-3}; |
28 | |
541 | 29 int |
30 main2(int i) | |
31 { | |
32 i+=f; | |
33 return +i; | |
34 } | |
35 | |
492 | 36 int |
0 | 37 alpha(c) |
38 char c; | |
39 { | |
40 return(('a'<=c&&c<='z')||('A'<=c&&c<='Z')||c=='_'); | |
41 } | |
42 char ch; | |
43 | |
492 | 44 void main1(); |
45 int main0() ; | |
46 | |
47 int | |
0 | 48 main(int ac,char *av[]) |
49 { | |
50 int i; | |
172 | 51 |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
52 printf("#0051:%d\n",ac); |
0 | 53 for(i=0;i<ac;i++) { |
880 | 54 printf("#0053:%s\n",&av[i][3]); |
0 | 55 } |
56 ch = 'E'; | |
442 | 57 main1(-8); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
58 printf("#0057:%d\n",main2(3)); |
615 | 59 #ifdef UNDECL |
60 j = k; // undeclared global variable | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
61 printf("#0060:%d\n",h); |
615 | 62 #endif |
690 | 63 main5(); |
172 | 64 return main0(ac,ch,av); |
0 | 65 } |
66 | |
492 | 67 int |
0 | 68 main0(ac,ch,av) |
69 int ac; | |
70 char ch; | |
71 char *av[]; | |
72 { | |
73 int i; | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
74 printf("#0073:%d %c\n",ac,ch); |
0 | 75 for(i=0;i<ac;i++) { |
880 | 76 printf("#0075:%s\n",&av[i][3]); |
0 | 77 } |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
78 printf("#0077:%d==1\n",alpha(ch)); |
172 | 79 return 0; |
0 | 80 } |
81 | |
492 | 82 void |
442 | 83 main1(int l) |
84 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
85 printf("#0084:%d\n", ((l+0)<-511||(l+0)>511)); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
86 if ((l+0)<-511||(l+0)>511) printf("#0085:yes\n"); |
442 | 87 l = -1; |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
690
diff
changeset
|
88 printf("#0087:%d\n", l==-1? 555:333); |
442 | 89 } |
90 | |
91 |