Mercurial > projects > ddmd
annotate dmd/Global.d @ 173:d237b38b5858
Small changes
author | korDen |
---|---|
date | Sun, 10 Oct 2010 01:55:35 +0400 |
parents | 96c0fff6897d |
children | af724d3510d7 |
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; |
170 | 11 import dmd.Scope; |
169 | 12 import dmd.Module; |
170 | 13 import dmd.Id; |
14 | |
15 import dmd.codegen.Util; | |
16 import dmd.backend.Classsym; | |
169 | 17 |
18 import core.stdc.time; | |
19 import core.stdc.stdio; | |
0 | 20 |
21 class Global | |
22 { | |
23 string mars_ext = "d"; | |
24 string sym_ext = "d"; | |
173 | 25 |
0 | 26 version (TARGET_WINDOS) { |
27 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
|
28 } else version (POSIX) { // TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS |
0 | 29 string obj_ext = "o"; |
30 } else version (TARGET_NET) { | |
31 } else { | |
32 static assert (false); | |
33 } | |
34 | |
35 version (TARGET_WINDOS) { | |
36 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
|
37 } else version (POSIX) { // TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS |
0 | 38 string lib_ext = "a"; |
39 } else version (TARGET_NET) { | |
40 } else { | |
41 static assert (false); | |
42 } | |
79 | 43 string doc_ext = "html"; // for Ddoc generated files |
44 string ddoc_ext = "ddoc"; // for Ddoc macro include files | |
45 string json_ext = "json"; | |
0 | 46 string hdr_ext = "di"; // for D 'header' import files |
47 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
|
48 string written = "written by Walter Bright, ported to D by community"; |
0 | 49 ///version (TARGET_NET) { |
50 /// "\nMSIL back-end (alpha release) by Cristian L. Vlasceanu and associates."; | |
51 ///} | |
173 | 52 |
0 | 53 string[] path; // Array of char*'s which form the import lookup path |
54 string[] filePath; // Array of char*'s which form the file import lookup path | |
55 int structalign = 8; | |
138 | 56 string version_ = "v2.039"; |
0 | 57 |
58 Param params; | |
59 uint errors; // number of errors reported so far | |
60 uint gag; // !=0 means gag reporting of errors | |
173 | 61 |
166
d8565fbd755c
Moved object and classinfo from ClassDeclaration to Global (as part of getting rid of the global state)
korDen
parents:
138
diff
changeset
|
62 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
|
63 ClassDeclaration classinfo; |
173 | 64 |
167
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
65 // Used in FuncDeclaration.genCfunc() |
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
66 DsymbolTable st; |
173 | 67 |
168
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
68 // Used in Lexer.uniqueId() |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
69 int num; |
173 | 70 |
168
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
71 // Used in Identifier.generateId() |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
72 size_t i; |
173 | 73 |
168
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
74 // Used in Lexer |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
75 StringTable stringtable; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
76 OutBuffer stringbuffer; |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
77 Token* freelist; |
173 | 78 |
169 | 79 char date[11+1]; |
80 char time[8+1]; | |
81 char timestamp[24+1]; | |
173 | 82 |
169 | 83 // Used in Module |
84 Module rootModule; | |
85 DsymbolTable modules; // symbol table of all modules | |
86 Array amodules; // array of all modules | |
87 Array deferred; // deferred Dsymbol's needing semantic() run on them | |
88 uint dprogress; // progress resolving the deferred list | |
170 | 89 int nested; |
90 Classsym* scc; | |
91 ClassDeclaration moduleinfo; | |
173 | 92 |
170 | 93 // Used in PowExp |
94 bool importMathChecked = false; | |
173 | 95 |
170 | 96 // Used in Scope |
97 Scope scope_freelist; | |
173 | 98 |
170 | 99 // Used in TemplateMixin |
100 int nest; | |
173 | 101 |
0 | 102 this() |
103 { | |
104 params.versionids = new Array(); | |
173 | 105 params.imppath = new Array(); |
106 | |
167
50a6d232176c
rewrite GlobalExpressions, moved DsymbolTable to Global, some cleanup
korDen
parents:
166
diff
changeset
|
107 st = new DsymbolTable(); |
168
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
108 stringtable = new StringTable(); |
ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
korDen
parents:
167
diff
changeset
|
109 stringbuffer = new OutBuffer(); |
173 | 110 |
169 | 111 modules = new DsymbolTable(); |
112 amodules = new Array(); | |
113 deferred = new Array(); | |
173 | 114 |
169 | 115 init_time(); |
116 } | |
173 | 117 |
170 | 118 void initClasssym() |
119 { | |
120 scc = fake_classsym(Id.ClassInfo); | |
121 } | |
173 | 122 |
169 | 123 void init_time() |
124 { | |
125 time_t tm; | |
126 char* p; | |
127 | |
128 .time(&tm); | |
129 p = ctime(&tm); | |
130 assert(p); | |
131 sprintf(date.ptr, "%.6s %.4s", p + 4, p + 20); | |
132 sprintf(time.ptr, "%.8s", p + 11); | |
133 sprintf(timestamp.ptr, "%.24s", p); | |
0 | 134 } |
135 } | |
136 | |
173 | 137 __gshared Global global; |