Mercurial > projects > ddmd
comparison dmd/Util.d @ 129:010eb8f0e18d
further work on dmd test suite
author | korDen |
---|---|
date | Sun, 05 Sep 2010 15:32:22 +0400 |
parents | 9e39c7de8438 |
children | 60bb0fe4563e |
comparison
equal
deleted
inserted
replaced
128:e6e542f37b94 | 129:010eb8f0e18d |
---|---|
12 import dmd.TOK; | 12 import dmd.TOK; |
13 | 13 |
14 import std.process : getenv; | 14 import std.process : getenv; |
15 import std.c.string; | 15 import std.c.string; |
16 import std.stdio : writef, writefln, write; | 16 import std.stdio : writef, writefln, write; |
17 | |
18 import core.memory; | |
19 | |
17 version (Windows) | 20 version (Windows) |
18 { | 21 { |
19 import std.c.process : spawnl, spawnlp; | 22 import std.c.process : spawnl, spawnlp; |
20 } | 23 } |
21 version (POSIX) | 24 version (POSIX) |
95 writefln(format, t); | 98 writefln(format, t); |
96 | 99 |
97 //halt(); | 100 //halt(); |
98 } | 101 } |
99 global.errors++; | 102 global.errors++; |
103 } | |
104 | |
105 T cloneThis(T)(T ptr) | |
106 { | |
107 // similar code is used in Type.clone() | |
108 // TODO: move to Util or something... | |
109 size_t size = __traits(classInstanceSize, T); | |
110 void* mem = GC.malloc(size); | |
111 memcpy(mem, cast(void*)ptr, size); | |
112 | |
113 return cast(T)mem; | |
100 } | 114 } |
101 | 115 |
102 char* strupr(char* s) | 116 char* strupr(char* s) |
103 { | 117 { |
104 char* t = s; | 118 char* t = s; |