Mercurial > projects > ldc
annotate dmd/module.h @ 86:fd32135dca3e trunk
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
Lots of bugfixes.
Added support for special foreach on strings.
Added std.array, std.utf, std.ctype and std.uni to phobos.
Changed all the .c files in the gen dir to .cpp (it *is* C++ after all)
author | lindquist |
---|---|
date | Sat, 03 Nov 2007 14:44:58 +0100 |
parents | 0c77619e803b |
children | 61615fa85940 |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2005 by Digital Mars | |
4 // All Rights Reserved | |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_MODULE_H | |
12 #define DMD_MODULE_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 #include "dsymbol.h" | |
20 | |
21 struct ModuleInfoDeclaration; | |
22 struct ClassDeclaration; | |
23 struct ModuleDeclaration; | |
24 struct Macro; | |
25 struct Escape; | |
26 struct VarDeclaration; | |
27 | |
28 // Back end | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
29 #if IN_LLVM |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
30 struct DValue; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
31 typedef DValue elem; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
32 #else |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
33 #ifdef IN_GCC |
1 | 34 union tree_node; typedef union tree_node elem; |
35 #else | |
36 struct elem; | |
37 #endif | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
52
diff
changeset
|
38 #endif |
1 | 39 |
40 struct Package : ScopeDsymbol | |
41 { | |
42 Package(Identifier *ident); | |
43 char *kind(); | |
44 | |
45 static DsymbolTable *resolve(Array *packages, Dsymbol **pparent, Package **ppkg); | |
46 | |
47 Package *isPackage() { return this; } | |
48 | |
49 virtual void semantic(Scope *sc) { } | |
50 }; | |
51 | |
52 struct Module : Package | |
53 { | |
54 static Module *rootModule; | |
55 static DsymbolTable *modules; // symbol table of all modules | |
56 static Array amodules; // array of all modules | |
57 static Array deferred; // deferred Dsymbol's needing semantic() run on them | |
58 static unsigned dprogress; // progress resolving the deferred list | |
59 static void init(); | |
60 | |
61 static ClassDeclaration *moduleinfo; | |
62 | |
63 | |
64 const char *arg; // original argument name | |
65 ModuleDeclaration *md; // if !NULL, the contents of the ModuleDeclaration declaration | |
66 File *srcfile; // input source file | |
67 File *objfile; // output .obj file | |
68 File *bcfile; // output .bc file | |
52 | 69 File *llfile; // output .ll file |
1 | 70 File *hdrfile; // 'header' file |
71 File *symfile; // output symbol file | |
72 File *docfile; // output documentation file | |
73 unsigned errors; // if any errors in file | |
74 unsigned numlines; // number of lines in source file | |
75 int isHtml; // if it is an HTML file | |
76 int isDocFile; // if it is a documentation input file, not D source | |
77 int needmoduleinfo; | |
78 #ifdef IN_GCC | |
79 int strictlyneedmoduleinfo; | |
80 #endif | |
81 | |
82 int insearch; | |
83 Identifier *searchCacheIdent; | |
84 Dsymbol *searchCacheSymbol; // cached value of search | |
85 int searchCacheFlags; // cached flags | |
86 | |
87 int semanticstarted; // has semantic() been started? | |
88 int semanticdone; // has semantic() been done? | |
89 int root; // != 0 if this is a 'root' module, | |
90 // i.e. a module that will be taken all the | |
91 // way to an object file | |
92 Module *importedFrom; // module from command line we're imported from, | |
93 // i.e. a module that will be taken all the | |
94 // way to an object file | |
95 | |
96 Array *decldefs; // top level declarations for this Module | |
97 | |
98 Array aimports; // all imported modules | |
99 | |
100 ModuleInfoDeclaration *vmoduleinfo; | |
101 | |
102 unsigned debuglevel; // debug level | |
103 Array *debugids; // debug identifiers | |
104 Array *debugidsNot; // forward referenced debug identifiers | |
105 | |
106 unsigned versionlevel; // version level | |
107 Array *versionids; // version identifiers | |
108 Array *versionidsNot; // forward referenced version identifiers | |
109 | |
110 Macro *macrotable; // document comment macros | |
111 Escape *escapetable; // document comment escapes | |
112 | |
113 Module(char *arg, Identifier *ident, int doDocComment, int doHdrGen); | |
114 ~Module(); | |
115 | |
116 static Module *load(Loc loc, Array *packages, Identifier *ident); | |
117 | |
118 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
119 char *kind(); | |
120 void setDocfile(); // set docfile member | |
121 void read(Loc loc); // read file | |
122 #if IN_GCC | |
123 void parse(bool dump_source = false); // syntactic parse | |
124 #else | |
125 void parse(); // syntactic parse | |
126 #endif | |
127 void semantic(); // semantic analysis | |
128 void semantic2(); // pass 2 semantic analysis | |
129 void semantic3(); // pass 3 semantic analysis | |
130 void inlineScan(); // scan for functions to inline | |
131 void setHdrfile(); // set hdrfile member | |
132 #ifdef _DH | |
133 void genhdrfile(); // generate D import file | |
134 #endif | |
135 void genobjfile(); | |
136 void gensymfile(); | |
137 void gendocfile(); | |
138 int needModuleInfo(); | |
139 Dsymbol *search(Loc loc, Identifier *ident, int flags); | |
140 void deleteObjFile(); | |
141 void addDeferredSemantic(Dsymbol *s); | |
142 void runDeferredSemantic(); | |
143 | |
144 // Back end | |
145 | |
146 Symbol *cov; // private uint[] __coverage; | |
147 unsigned *covb; // bit array of valid code line numbers | |
148 | |
149 Symbol *sctor; // module constructor | |
150 Symbol *sdtor; // module destructor | |
151 Symbol *stest; // module unit test | |
152 | |
153 Symbol *sfilename; // symbol for filename | |
154 | |
155 Symbol *massert; // module assert function | |
156 Symbol *toModuleAssert(); // get module assert function | |
157 | |
158 Symbol *marray; // module array bounds function | |
159 Symbol *toModuleArray(); // get module array bounds function | |
160 | |
161 | |
162 static Symbol *gencritsec(); | |
163 elem *toEfilename(); | |
164 elem *toEmodulename(); | |
165 | |
166 Symbol *toSymbol(); | |
167 void genmoduleinfo(); | |
168 | |
169 Module *isModule() { return this; } | |
170 }; | |
171 | |
172 | |
173 struct ModuleDeclaration | |
174 { | |
175 Identifier *id; | |
176 Array *packages; // array of Identifier's representing packages | |
177 | |
178 ModuleDeclaration(Array *packages, Identifier *id); | |
179 | |
180 char *toChars(); | |
181 }; | |
182 | |
183 #endif /* DMD_MODULE_H */ |