Mercurial > projects > dil
annotate trunk/src/dil/Compilation.d @ 798:c24be8d4f6ab
Added documentation comments.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 01 Mar 2008 02:53:06 +0100 |
parents | edd217e14736 |
children |
rev | line source |
---|---|
777
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
1 /++ |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
2 Author: Aziz Köksal |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
3 License: GPL3 |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
4 +/ |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
5 module dil.Compilation; |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
6 |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
7 import common; |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
8 |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
9 /// A group of settings relevant to the compilation process. |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
10 class CompilationContext |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
11 { |
778
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
12 alias typeof(this) CC; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
13 CC parent; |
777
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
14 string[] importPaths; |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
15 uint debugLevel; |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
16 uint versionLevel; |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
17 bool[string] debugIds; |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
18 bool[string] versionIds; |
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
19 bool releaseBuild; |
778
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
20 uint structAlign = 4; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
21 |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
22 this(CC parent = null) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
23 { |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
24 this.parent = parent; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
25 if (parent) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
26 { |
780
edd217e14736
Using CompilationContext in command 'igraph'.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
778
diff
changeset
|
27 this.importPaths = parent.importPaths.dup; |
778
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
28 this.debugLevel = parent.debugLevel; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
29 this.versionLevel = parent.versionLevel; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
30 this.releaseBuild = parent.releaseBuild; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
31 this.structAlign = parent.structAlign; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
32 } |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
33 } |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
34 |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
35 void addDebugId(string id) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
36 { |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
37 debugIds[id] = true; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
38 } |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
39 |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
40 void addVersionId(string id) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
41 { |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
42 versionIds[id] = true; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
43 } |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
44 |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
45 bool findDebugId(string id) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
46 { |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
47 auto pId = id in debugIds; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
48 if (pId) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
49 return true; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
50 if (!isRoot()) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
51 return parent.findDebugId(id); |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
52 return false; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
53 } |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
54 |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
55 bool findVersionId(string id) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
56 { |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
57 auto pId = id in versionIds; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
58 if (pId) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
59 return true; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
60 if (!isRoot()) |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
61 return parent.findVersionId(id); |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
62 return false; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
63 } |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
64 |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
65 bool isRoot() |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
66 { |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
67 return parent is null; |
78be32e3e157
Implemented conditional compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
777
diff
changeset
|
68 } |
777
9f61e8af55d5
Added module dil.Compilation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
69 } |