Mercurial > projects > ldc
annotate tests/mini/calls1.d @ 655:93433f4b6963
Added -version=Tango in default llvmdc.conf
Fixed problem with array casts, all DWT modules needed for HelloWorld1 samples now compile. Still some linking issues.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 06 Oct 2008 12:46:57 +0200 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
131 | 1 module calls1; |
270
d9d5d59873d8
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
lindquist
parents:
131
diff
changeset
|
2 import tango.core.Vararg; |
291
068cb3c60afb
[svn r312] Changed assert codegen to insert an unreachable terminator after the call to the assert function, which currently calls abort().
lindquist
parents:
270
diff
changeset
|
3 extern(C) int printf(char*, ...); |
131 | 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 } |