Mercurial > projects > ddmd
annotate dmd/Id.d @ 161:584dc990e12f
type fixed
author | korDen |
---|---|
date | Mon, 20 Sep 2010 01:19:36 +0400 |
parents | af1bebfd96a4 |
children | 96c0fff6897d |
rev | line source |
---|---|
0 | 1 module dmd.Id; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.Identifier; |
5 import dmd.Lexer; | |
6 | |
103 | 7 private string idgen(T...)(T ts) |
0 | 8 { |
103 | 9 string res = "struct Id\n{\n"; |
0 | 10 |
103 | 11 foreach(entry; ts) |
99 | 12 res ~= "\tstatic Identifier " ~ entry.ident ~ ";\n"; |
13 | |
14 res ~= "\tstatic void initialize()\n\t{\n"; | |
15 string tmp; | |
103 | 16 foreach (entry; ts) |
0 | 17 { |
99 | 18 if (entry.name_ is null) |
19 tmp = entry.ident; | |
20 else | |
21 tmp = entry.name_; | |
22 res ~= "\t\t" ~ entry.ident ~ ` = Lexer.idPool("` ~ tmp ~ "\");\n"; | |
0 | 23 } |
99 | 24 |
25 res ~= "\t}\n}"; | |
26 return res; | |
27 } | |
28 | |
103 | 29 private struct ID |
30 { | |
31 string ident; // name to use in DMD source | |
32 string name_; // name in D executable | |
33 } | |
34 | |
35 mixin(idgen( | |
36 ID( "IUnknown" ), | |
37 ID( "Object_", "Object" ), | |
38 ID( "object" ), | |
39 ID( "max" ), | |
40 ID( "min" ), | |
41 ID( "This", "this" ), | |
42 ID( "ctor", "__ctor" ), | |
43 ID( "dtor", "__dtor" ), | |
44 ID( "cpctor", "__cpctor" ), | |
45 ID( "_postblit", "__postblit" ), | |
46 ID( "classInvariant", "__invariant" ), | |
47 ID( "unitTest", "__unitTest" ), | |
48 ID( "require", "__require" ), | |
49 ID( "ensure", "__ensure" ), | |
50 ID( "init_", "init" ), | |
51 ID( "size" ), | |
52 ID( "__sizeof", "sizeof" ), | |
53 ID( "alignof_", "alignof" ), | |
54 ID( "mangleof_", "mangleof" ), | |
55 ID( "stringof_", "stringof" ), | |
56 ID( "tupleof_", "tupleof" ), | |
57 ID( "length" ), | |
58 ID( "remove" ), | |
59 ID( "ptr" ), | |
60 ID( "funcptr" ), | |
61 ID( "dollar", "__dollar" ), | |
62 ID( "offset" ), | |
63 ID( "offsetof" ), | |
64 ID( "ModuleInfo" ), | |
65 ID( "ClassInfo" ), | |
66 ID( "classinfo_", "classinfo" ), | |
67 ID( "typeinfo_", "typeinfo" ), | |
68 ID( "outer" ), | |
69 ID( "Exception" ), | |
70 ID( "AssociativeArray" ), | |
71 ID( "Throwable" ), | |
72 ID( "withSym", "__withSym" ), | |
73 ID( "result", "__result" ), | |
74 ID( "returnLabel", "__returnLabel" ), | |
75 ID( "delegate_", "delegate" ), | |
76 ID( "line" ), | |
77 ID( "empty", "" ), | |
78 ID( "p" ), | |
79 ID( "coverage", "__coverage" ), | |
80 ID( "__vptr" ), | |
81 ID( "__monitor" ), | |
82 | |
83 ID( "TypeInfo" ), | |
84 ID( "TypeInfo_Class" ), | |
85 ID( "TypeInfo_Interface" ), | |
86 ID( "TypeInfo_Struct" ), | |
87 ID( "TypeInfo_Enum" ), | |
88 ID( "TypeInfo_Typedef" ), | |
89 ID( "TypeInfo_Pointer" ), | |
90 ID( "TypeInfo_Array" ), | |
91 ID( "TypeInfo_StaticArray" ), | |
92 ID( "TypeInfo_AssociativeArray" ), | |
93 ID( "TypeInfo_Function" ), | |
94 ID( "TypeInfo_Delegate" ), | |
95 ID( "TypeInfo_Tuple" ), | |
96 ID( "TypeInfo_Const" ), | |
97 ID( "TypeInfo_Invariant" ), | |
98 ID( "TypeInfo_Shared" ), | |
135 | 99 ID( "TypeInfo_Wild", "TypeInfo_Inout" ), |
100 | |
103 | 101 ID( "elements" ), |
102 ID( "_arguments_typeinfo" ), | |
103 ID( "_arguments" ), | |
104 ID( "_argptr" ), | |
105 ID( "_match" ), | |
106 ID( "destroy" ), | |
107 | |
108 ID( "LINE", "__LINE__" ), | |
109 ID( "FILE", "__FILE__" ), | |
110 ID( "DATE", "__DATE__" ), | |
111 ID( "TIME", "__TIME__" ), | |
112 ID( "TIMESTAMP", "__TIMESTAMP__" ), | |
113 ID( "VENDOR", "__VENDOR__" ), | |
114 ID( "VERSIONX", "__VERSION__" ), | |
115 ID( "EOFX", "__EOF__" ), | |
116 | |
117 ID( "nan" ), | |
118 ID( "infinity" ), | |
119 ID( "dig" ), | |
120 ID( "epsilon" ), | |
121 ID( "mant_dig" ), | |
122 ID( "max_10_exp" ), | |
123 ID( "max_exp" ), | |
124 ID( "min_10_exp" ), | |
125 ID( "min_exp" ), | |
126 ID( "min_normal" ), | |
127 ID( "re" ), | |
128 ID( "im" ), | |
129 | |
130 ID( "C" ), | |
131 ID( "D" ), | |
132 ID( "Windows" ), | |
133 ID( "Pascal" ), | |
134 ID( "System" ), | |
135 | |
136 ID( "exit" ), | |
137 ID( "success" ), | |
138 ID( "failure" ), | |
139 | |
140 ID( "keys" ), | |
141 ID( "values" ), | |
142 ID( "rehash" ), | |
143 | |
144 ID( "sort" ), | |
145 ID( "reverse" ), | |
146 ID( "dup" ), | |
147 ID( "idup" ), | |
148 | |
149 ID( "property" ), | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
150 ID( "safe" ), |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
151 ID( "trusted" ), |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
152 ID( "system" ), |
103 | 153 |
154 // For inline assembler | |
155 ID( "___out", "out" ), | |
156 ID( "___in", "in" ), | |
157 ID( "__int", "int" ), | |
158 ID( "__dollar", "$" ), | |
159 ID( "__LOCAL_SIZE" ), | |
160 | |
161 // For operator overloads | |
162 ID( "uadd", "opPos" ), | |
163 ID( "neg", "opNeg" ), | |
164 ID( "com", "opCom" ), | |
165 ID( "add", "opAdd" ), | |
166 ID( "add_r", "opAdd_r" ), | |
167 ID( "sub", "opSub" ), | |
168 ID( "sub_r", "opSub_r" ), | |
169 ID( "mul", "opMul" ), | |
170 ID( "mul_r", "opMul_r" ), | |
171 ID( "div", "opDiv" ), | |
172 ID( "div_r", "opDiv_r" ), | |
173 ID( "mod", "opMod" ), | |
174 ID( "mod_r", "opMod_r" ), | |
175 ID( "eq", "opEquals" ), | |
176 ID( "cmp", "opCmp" ), | |
177 ID( "iand", "opAnd" ), | |
178 ID( "iand_r", "opAnd_r" ), | |
179 ID( "ior", "opOr" ), | |
180 ID( "ior_r", "opOr_r" ), | |
181 ID( "ixor", "opXor" ), | |
182 ID( "ixor_r", "opXor_r" ), | |
183 ID( "shl", "opShl" ), | |
184 ID( "shl_r", "opShl_r" ), | |
185 ID( "shr", "opShr" ), | |
186 ID( "shr_r", "opShr_r" ), | |
187 ID( "ushr", "opUShr" ), | |
188 ID( "ushr_r", "opUShr_r" ), | |
189 ID( "cat", "opCat" ), | |
190 ID( "cat_r", "opCat_r" ), | |
191 ID( "assign", "opAssign" ), | |
192 ID( "addass", "opAddAssign" ), | |
193 ID( "subass", "opSubAssign" ), | |
194 ID( "mulass", "opMulAssign" ), | |
195 ID( "divass", "opDivAssign" ), | |
196 ID( "modass", "opModAssign" ), | |
197 ID( "andass", "opAndAssign" ), | |
198 ID( "orass", "opOrAssign" ), | |
199 ID( "xorass", "opXorAssign" ), | |
200 ID( "shlass", "opShlAssign" ), | |
201 ID( "shrass", "opShrAssign" ), | |
202 ID( "ushrass", "opUShrAssign" ), | |
203 ID( "catass", "opCatAssign" ), | |
204 ID( "postinc", "opPostInc" ), | |
205 ID( "postdec", "opPostDec" ), | |
206 ID( "index", "opIndex" ), | |
207 ID( "indexass", "opIndexAssign" ), | |
208 ID( "slice", "opSlice" ), | |
209 ID( "sliceass", "opSliceAssign" ), | |
210 ID( "call", "opCall" ), | |
211 ID( "cast_", "opCast" ), | |
212 ID( "match", "opMatch" ), | |
213 ID( "next", "opNext" ), | |
214 ID( "opIn" ), | |
215 ID( "opIn_r" ), | |
216 ID( "opStar" ), | |
217 ID( "opDot" ), | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
218 ID( "opDispatch" ), |
103 | 219 ID( "opImplicitCast" ), |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
220 ID( "pow", "opPow" ), |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
221 ID( "pow_r", "opPow_r" ), |
135 | 222 ID( "powass", "opPowAssign" ), |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
223 |
103 | 224 ID( "classNew", "new" ), |
225 ID( "classDelete", "delete" ), | |
226 | |
227 // For foreach | |
228 ID( "apply", "opApply" ), | |
229 ID( "applyReverse", "opApplyReverse" ), | |
230 | |
231 // #if 1 | |
232 ID( "Fempty", "empty" ), | |
233 ID( "Fhead", "front" ), | |
234 ID( "Ftoe", "back" ), | |
235 ID( "Fnext", "popFront" ), | |
236 ID( "Fretreat", "popBack" ), | |
237 /*#else | |
238 ID( "Fempty", "empty" ), | |
239 ID( "Fhead", "head" ), | |
240 ID( "Ftoe", "toe" ), | |
241 ID( "Fnext", "next" ), | |
242 ID( "Fretreat", "retreat" ), | |
243 #endif*/ | |
244 | |
245 ID( "adDup", "_adDupT" ), | |
246 ID( "adReverse", "_adReverse" ), | |
247 | |
248 // For internal functions | |
249 ID( "aaLen", "_aaLen" ), | |
250 ID( "aaKeys", "_aaKeys" ), | |
251 ID( "aaValues", "_aaValues" ), | |
252 ID( "aaRehash", "_aaRehash" ), | |
253 ID( "monitorenter", "_d_monitorenter" ), | |
254 ID( "monitorexit", "_d_monitorexit" ), | |
255 ID( "criticalenter", "_d_criticalenter" ), | |
256 ID( "criticalexit", "_d_criticalexit" ), | |
257 | |
258 // For pragma's | |
259 ID( "GNU_asm" ), | |
260 ID( "lib" ), | |
261 ID( "msg" ), | |
262 ID( "startaddress" ), | |
263 | |
264 // For special functions | |
265 ID( "tohash", "toHash" ), | |
266 ID( "tostring", "toString" ), | |
267 ID( "getmembers", "getMembers" ), | |
268 | |
269 // Special functions | |
270 ID( "alloca" ), | |
271 ID( "main" ), | |
272 ID( "WinMain" ), | |
273 ID( "DllMain" ), | |
274 ID( "tls_get_addr", "___tls_get_addr" ), | |
275 | |
276 // Builtin functions | |
277 ID( "std" ), | |
278 ID( "math" ), | |
279 ID( "sin" ), | |
280 ID( "cos" ), | |
281 ID( "tan" ), | |
282 ID( "_sqrt", "sqrt" ), | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
114
diff
changeset
|
283 ID( "_pow", "pow" ), |
103 | 284 ID( "fabs" ), |
285 | |
286 // Traits | |
287 ID( "isAbstractClass" ), | |
288 ID( "isArithmetic" ), | |
289 ID( "isAssociativeArray" ), | |
290 ID( "isFinalClass" ), | |
291 ID( "isFloating" ), | |
292 ID( "isIntegral" ), | |
293 ID( "isScalar" ), | |
294 ID( "isStaticArray" ), | |
295 ID( "isUnsigned" ), | |
296 ID( "isVirtualFunction" ), | |
297 ID( "isAbstractFunction" ), | |
298 ID( "isFinalFunction" ), | |
135 | 299 ID( "isRef" ), |
300 ID( "isOut" ), | |
301 ID( "isLazy" ), | |
103 | 302 ID( "hasMember" ), |
303 ID( "getMember" ), | |
304 ID( "getVirtualFunctions" ), | |
305 ID( "classInstanceSize" ), | |
306 ID( "allMembers" ), | |
307 ID( "derivedMembers" ), | |
308 ID( "isSame" ), | |
309 ID( "compiles" ) | |
310 )); |