-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.d
72 lines (56 loc) · 1.1 KB
/
main.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
r3 := 0x20000024
r2 := 0x20000000
r1 := *r3
*r3 := r2
*r2 := r1
r1 = _Dmodule_ref
_Dmodule_ref = &__mod_ref.3657
__mod_ref.3657.next = r1
*/
import sh;
import libd;
__gshared extern(C) int x;
__gshared extern(C) int y;
shared static this()
{
x = libd.sharedvar;
}
static this()
{
y = 0xf4ce;
}
class Foo
{
static __gshared int z;
shared static this()
{
z = 0xbeef;
}
string name() { return "foo"; }
}
class Bar : Foo
{
override string name() { return "bar"; }
}
__gshared ubyte[100] _currentexception;
void main()
{
shprint("Hello, world!\n");
shprintnum(0xdeadbeef, 16);
shprint("\n");
ulong a = cast(ulong) &Foo.z; //0xbadc0ffee0ddf00dUL;
scope(exit) writefln("exiting");
scope(success) writefln("success");
writefln("foo %#050x", a);
writefln("bar %40x %*d", cast(ulong) &Foo.z, 15, 15);
writefln("baz %40s %d", 0xbddf00d12123123UL, 15);
writefln("quux %40s %d %10b %s %s %d %d %s", 0xbddf00d12123123UL, 15, 20, true, false, true, false, null);
Throwable t = cast(Throwable) (_currentexception.ptr);
// try {
// throw t; //new Throwable("dupa");
// }
// catch (Throwable e)
// {
// }
}