annotate test/tstdarg.c @ 337:694cdf15c5bd

MIPS bit-field done.
author kono
date Fri, 25 Jun 2004 05:37:09 +0900
parents 1ec915dcd2d1
children 0c256ea2a97e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
285
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
1
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
2
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
3 #include <stdio.h>
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
4 #include <stdarg.h>
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
5
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
6 int
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
7 var_args(char *numtypes, ...)
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
8 {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
9 int t;
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
10 int i;
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
11 float f;
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
12 double d;
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
13 long long l;
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
14 char *s;
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
15 va_list ap;
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
16
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
17 va_start(ap,numtypes);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
18
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
19 while((t= *numtypes++)) {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
20 if (t=='i') {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
21 i = va_arg(ap,int);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
22 printf("int arg: %d\n",i);
305
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 285
diff changeset
23 #if 0
285
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
24 } else if (t=='f') {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
25 f = va_arg(ap,float);
305
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 285
diff changeset
26 printf("float arg: %g\n",f);
285
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
27 #endif
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
28 } else if (t=='d') {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
29 d = va_arg(ap,double);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
30 printf("double arg: %g\n",d);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
31 } else if (t=='l') {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
32 l = va_arg(ap,long long);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
33 printf("long long arg: %lld\n",l);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
34 } else if (t=='s') {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
35 s = va_arg(ap,char *);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
36 printf("char *arg: %s\n",s);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
37 } else {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
38 s = va_arg(ap,char *);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
39 printf("arg: error\n");
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
40 }
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
41 }
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
42 }
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
43
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
44
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
45 main()
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
46 {
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
47
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
48 var_args("iiiiii",1,2,3,4,5,6);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
49 var_args("llllll",(long long)1,(long long)2,(long long)3,(long long)4,(long long)5,(long long)6);
305
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 285
diff changeset
50 #if 0
285
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
51 var_args("ffffff",(float)1,(float)2,(float)3,(float)4,(float)5,(float)6);
305
117baacd1ed0 stdarg powerpc passed except long long (macro problem)
kono
parents: 285
diff changeset
52 #endif
285
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
53 var_args("dddddd",(double)1,(double)2,(double)3,(double)4,(double)5,(double)6);
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
54 var_args("ssssss","1","2","3","4","5","6");
306
1ec915dcd2d1 struct return size error
kono
parents: 305
diff changeset
55 return 0;
285
912b54949344 register assop const ( int/long )
kono
parents:
diff changeset
56 }