comparison tests/mini/calls1.d @ 341:1bb99290e03a trunk

[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author lindquist
date Sun, 13 Jul 2008 02:51:19 +0200
parents test/calls1.d@068cb3c60afb
children
comparison
equal deleted inserted replaced
340:351c0077d0b3 341:1bb99290e03a
1 module calls1;
2 import tango.core.Vararg;
3 extern(C) int printf(char*, ...);
4 void main()
5 {
6 {int a = byVal1(3);}
7 {int a = void; byRef1(a);}
8 {char[] c = void; refType(c);}
9 {char[] c = void; refTypeByRef(c);}
10 {S s = void; structByVal(s);}
11 {S s = void; structByRef(s);}
12 {S s = void; structByPtr(&s);}
13 {printf("c-varargs %d %d %d\n", 1,2,3);}
14 {int i=3; float f=24.7; dvararg(i,f);}
15 {char[] s = "hello"; dvarargRefTy(s);}
16 {char[] ss = "hello world!"; dvarargRefTy(ss);}
17 }
18
19 int byVal1(int a)
20 {
21 return a;
22 }
23
24 void byRef1(ref int a)
25 {
26 a = 3;
27 }
28
29 void refType(char[] s)
30 {
31 }
32
33 void refTypeByRef(ref char[] s)
34 {
35 }
36
37 struct S
38 {
39 float f;
40 double d;
41 long l;
42 byte b;
43 }
44
45 void structByVal(S s)
46 {
47 }
48
49 void structByRef(ref S s)
50 {
51 }
52
53 void structByPtr(S* s)
54 {
55 }
56
57 void dvararg(...)
58 {
59 printf("%d %.1f\n", va_arg!(int)(_argptr), va_arg!(float)(_argptr));
60 }
61
62 void dvarargRefTy(...)
63 {
64 char[] s = va_arg!(char[])(_argptr);
65 printf("%.*s\n", s.length, s.ptr);
66 }