Mercurial > projects > ldc
annotate test/calls1.d @ 270:d9d5d59873d8 trunk
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
Branch statements now emit a new block after it.
Fixed the _adSort runtime function had a bad signature.
Added a missing dot prefix on compiler generated string tables for string switch.
Fixed, PTRSIZE seems like it was wrong on 64bit, now it definitely gets set properly.
author | lindquist |
---|---|
date | Mon, 16 Jun 2008 16:01:19 +0200 |
parents | 5825d48b27d1 |
children | 068cb3c60afb |
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; |
131 | 3 void main() |
4 { | |
5 {int a = byVal1(3);} | |
6 {int a = void; byRef1(a);} | |
7 {char[] c = void; refType(c);} | |
8 {char[] c = void; refTypeByRef(c);} | |
9 {S s = void; structByVal(s);} | |
10 {S s = void; structByRef(s);} | |
11 {S s = void; structByPtr(&s);} | |
12 {printf("c-varargs %d %d %d\n", 1,2,3);} | |
13 {int i=3; float f=24.7; dvararg(i,f);} | |
14 {char[] s = "hello"; dvarargRefTy(s);} | |
15 {char[] ss = "hello world!"; dvarargRefTy(ss);} | |
16 } | |
17 | |
18 int byVal1(int a) | |
19 { | |
20 return a; | |
21 } | |
22 | |
23 void byRef1(ref int a) | |
24 { | |
25 a = 3; | |
26 } | |
27 | |
28 void refType(char[] s) | |
29 { | |
30 } | |
31 | |
32 void refTypeByRef(ref char[] s) | |
33 { | |
34 } | |
35 | |
36 struct S | |
37 { | |
38 float f; | |
39 double d; | |
40 long l; | |
41 byte b; | |
42 } | |
43 | |
44 void structByVal(S s) | |
45 { | |
46 } | |
47 | |
48 void structByRef(ref S s) | |
49 { | |
50 } | |
51 | |
52 void structByPtr(S* s) | |
53 { | |
54 } | |
55 | |
56 void dvararg(...) | |
57 { | |
58 printf("%d %.1f\n", va_arg!(int)(_argptr), va_arg!(float)(_argptr)); | |
59 } | |
60 | |
61 void dvarargRefTy(...) | |
62 { | |
63 char[] s = va_arg!(char[])(_argptr); | |
64 printf("%.*s\n", s.length, s.ptr); | |
65 } |