annotate test/simp.c @ 928:96c53f76b360

fix
author kono
date Sun, 13 Apr 2014 10:21:40 +0900
parents 5313ed059cee
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
618
a7f5796e540a fix link error on undefined
kono
parents: 615
diff changeset
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
d35df41eac69 Initial revision
kono
parents:
diff changeset
3
618
a7f5796e540a fix link error on undefined
kono
parents: 615
diff changeset
4 // #define UNDECL
541
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
5
690
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
6 long long q = 122;
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
7
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
8 void
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
9 main5()
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
10 {
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
11 long long *p;
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
12 int r[10];
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
13 double d;
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
14
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
15 p = (long long *)&r;
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
16 *p = q;
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
17
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
18 d= (double)(*(long long*)&r);
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
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
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
21 }
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
22
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
23
541
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
24 float f = 3;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
25 float g = 4096.0f;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
26
542
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
27 int kk = {-3};
492f06738550 working... (struct init fix)
kono
parents: 541
diff changeset
28
541
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
29 int
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
30 main2(int i)
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
31 {
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
32 i+=f;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
33 return +i;
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
34 }
4d853ee76ad6 minor fixes for s-dandy
kono
parents: 496
diff changeset
35
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
36 int
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
37 alpha(c)
d35df41eac69 Initial revision
kono
parents:
diff changeset
38 char c;
d35df41eac69 Initial revision
kono
parents:
diff changeset
39 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
40 return(('a'<=c&&c<='z')||('A'<=c&&c<='Z')||c=='_');
d35df41eac69 Initial revision
kono
parents:
diff changeset
41 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
42 char ch;
d35df41eac69 Initial revision
kono
parents:
diff changeset
43
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
44 void main1();
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
45 int main0() ;
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
46
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
47 int
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
48 main(int ac,char *av[])
d35df41eac69 Initial revision
kono
parents:
diff changeset
49 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
50 int i;
172
096559f07a70 some check
kono
parents: 0
diff changeset
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
d35df41eac69 Initial revision
kono
parents:
diff changeset
53 for(i=0;i<ac;i++) {
880
5313ed059cee no tabs in source
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 868
diff changeset
54 printf("#0053:%s\n",&av[i][3]);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
55 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
56 ch = 'E';
442
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
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
2dee957ef988 test case on undeclared name
kono
parents: 542
diff changeset
59 #ifdef UNDECL
2dee957ef988 test case on undeclared name
kono
parents: 542
diff changeset
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
2dee957ef988 test case on undeclared name
kono
parents: 542
diff changeset
62 #endif
690
5d3b4669854c fix prindirect
kono
parents: 618
diff changeset
63 main5();
172
096559f07a70 some check
kono
parents: 0
diff changeset
64 return main0(ac,ch,av);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
65 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
66
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
67 int
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
68 main0(ac,ch,av)
d35df41eac69 Initial revision
kono
parents:
diff changeset
69 int ac;
d35df41eac69 Initial revision
kono
parents:
diff changeset
70 char ch;
d35df41eac69 Initial revision
kono
parents:
diff changeset
71 char *av[];
d35df41eac69 Initial revision
kono
parents:
diff changeset
72 {
d35df41eac69 Initial revision
kono
parents:
diff changeset
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
d35df41eac69 Initial revision
kono
parents:
diff changeset
75 for(i=0;i<ac;i++) {
880
5313ed059cee no tabs in source
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 868
diff changeset
76 printf("#0075:%s\n",&av[i][3]);
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
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
096559f07a70 some check
kono
parents: 0
diff changeset
79 return 0;
0
d35df41eac69 Initial revision
kono
parents:
diff changeset
80 }
d35df41eac69 Initial revision
kono
parents:
diff changeset
81
492
cc1a5f764782 *** empty log message ***
kono
parents: 444
diff changeset
82 void
442
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
83 main1(int l)
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
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
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
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
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
89 }
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
90
86b04fb4562e minor fix...
kono
parents: 427
diff changeset
91