Mercurial > projects > ddmd
annotate dmd/Global.d @ 169:e7769d53e750
Moves static variables from Module to Global
author | korDen |
---|---|
date | Thu, 30 Sep 2010 13:29:54 +0400 |
parents | ceed63f310fb |
children | 96c0fff6897d |
rev | line source |
---|---|
0 | 1 module dmd.Global; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.Array; |
5 import dmd.Param; | |
166
d8565fbd755c
Moved object and classinfo from ClassDeclaration to Global (as part of getting rid of the global state)
korDen
parents:
138
diff
changeset
|
6 import dmd.ClassDeclaration; |
167
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
7 import dmd.DsymbolTable; |
168
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
8 import dmd.StringTable; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
9 import dmd.OutBuffer; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
10 import dmd.Token; |
169 | 11 import dmd.Module; |
12 | |
13 import core.stdc.time; | |
14 import core.stdc.stdio; | |
0 | 15 |
16 class Global | |
17 { | |
18 string mars_ext = "d"; | |
19 string sym_ext = "d"; | |
20 | |
21 version (TARGET_WINDOS) { | |
22 string obj_ext = "obj"; | |
14
2cc604139636
Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
23 } else version (POSIX) { // TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS |
0 | 24 string obj_ext = "o"; |
25 } else version (TARGET_NET) { | |
26 } else { | |
27 static assert (false); | |
28 } | |
29 | |
30 version (TARGET_WINDOS) { | |
31 string lib_ext = "lib"; | |
14
2cc604139636
Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
32 } else version (POSIX) { // TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS |
0 | 33 string lib_ext = "a"; |
34 } else version (TARGET_NET) { | |
35 } else { | |
36 static assert (false); | |
37 } | |
79 | 38 string doc_ext = "html"; // for Ddoc generated files |
39 string ddoc_ext = "ddoc"; // for Ddoc macro include files | |
40 string json_ext = "json"; | |
0 | 41 string hdr_ext = "di"; // for D 'header' import files |
42 string copyright= "Copyright (c) 1999-2009 by Digital Mars"; | |
75
cfa3747ebe4c
Changed dmd to ddmd in the "usage" message and added "ported to D by community" to desription to distinguish from pure dmd build
korDen
parents:
73
diff
changeset
|
43 string written = "written by Walter Bright, ported to D by community"; |
0 | 44 ///version (TARGET_NET) { |
45 /// "\nMSIL back-end (alpha release) by Cristian L. Vlasceanu and associates."; | |
46 ///} | |
47 | |
48 string[] path; // Array of char*'s which form the import lookup path | |
49 string[] filePath; // Array of char*'s which form the file import lookup path | |
50 int structalign = 8; | |
138 | 51 string version_ = "v2.039"; |
0 | 52 |
53 Param params; | |
54 uint errors; // number of errors reported so far | |
55 uint gag; // !=0 means gag reporting of errors | |
56 | |
166
d8565fbd755c
Moved object and classinfo from ClassDeclaration to Global (as part of getting rid of the global state)
korDen
parents:
138
diff
changeset
|
57 ClassDeclaration object; |
d8565fbd755c
Moved object and classinfo from ClassDeclaration to Global (as part of getting rid of the global state)
korDen
parents:
138
diff
changeset
|
58 ClassDeclaration classinfo; |
d8565fbd755c
Moved object and classinfo from ClassDeclaration to Global (as part of getting rid of the global state)
korDen
parents:
138
diff
changeset
|
59 |
167
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
60 // Used in FuncDeclaration.genCfunc() |
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
61 DsymbolTable st; |
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
62 |
168
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
63 // Used in Lexer.uniqueId() |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
64 int num; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
65 |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
66 // Used in Identifier.generateId() |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
67 size_t i; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
68 |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
69 // Used in Lexer |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
70 StringTable stringtable; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
71 OutBuffer stringbuffer; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
72 Token* freelist; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
73 |
169 | 74 char date[11+1]; |
75 char time[8+1]; | |
76 char timestamp[24+1]; | |
77 | |
78 // Used in Module | |
79 Module rootModule; | |
80 DsymbolTable modules; // symbol table of all modules | |
81 Array amodules; // array of all modules | |
82 Array deferred; // deferred Dsymbol's needing semantic() run on them | |
83 uint dprogress; // progress resolving the deferred list | |
84 | |
85 ClassDeclaration moduleinfo; | |
86 | |
0 | 87 this() |
88 { | |
89 params.versionids = new Array(); | |
167
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
90 st = new DsymbolTable(); |
168
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
91 stringtable = new StringTable(); |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
92 stringbuffer = new OutBuffer(); |
169 | 93 |
94 modules = new DsymbolTable(); | |
95 amodules = new Array(); | |
96 deferred = new Array(); | |
97 | |
98 init_time(); | |
99 } | |
100 | |
101 void init_time() | |
102 { | |
103 time_t tm; | |
104 char* p; | |
105 | |
106 .time(&tm); | |
107 p = ctime(&tm); | |
108 assert(p); | |
109 sprintf(date.ptr, "%.6s %.4s", p + 4, p + 20); | |
110 sprintf(time.ptr, "%.8s", p + 11); | |
111 sprintf(timestamp.ptr, "%.24s", p); | |
0 | 112 } |
113 } | |
114 | |
14
2cc604139636
Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
115 Global global; |