Mercurial > projects > ddmd
annotate dmd/DebugCondition.d @ 187:b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
author | Abscissa |
---|---|
date | Tue, 07 Jun 2011 23:37:34 -0400 |
parents | e3afd1303184 |
children |
rev | line source |
---|---|
0 | 1 module dmd.DebugCondition; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.DVCondition; |
5 import dmd.Module; | |
6 import dmd.Identifier; | |
7 import dmd.Scope; | |
8 import dmd.ScopeDsymbol; | |
9 import dmd.OutBuffer; | |
10 import dmd.HdrGenState; | |
11 import dmd.Array; | |
12 import dmd.String; | |
13 import dmd.Global; | |
14 | |
15 import dmd.condition.util.findCondition; | |
16 | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
17 import dmd.DDMDExtensions; |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
18 |
0 | 19 class DebugCondition : DVCondition |
20 { | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
21 mixin insertMemberExtension!(typeof(this)); |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
22 |
0 | 23 static void setGlobalLevel(uint level) |
24 { | |
25 assert(false); | |
26 } | |
27 | |
28 static void addGlobalIdent(const(char)* ident) | |
29 { | |
30 assert(false); | |
31 } | |
32 | |
33 static void addPredefinedGlobalIdent(const(char)* ident) | |
34 { | |
35 assert(false); | |
36 } | |
37 | |
38 this(Module mod, uint level, Identifier ident) | |
39 { | |
178 | 40 register(); |
0 | 41 super(mod, level, ident); |
42 } | |
43 | |
72 | 44 override bool include(Scope sc, ScopeDsymbol s) |
0 | 45 { |
46 //printf("DebugCondition::include() level = %d, debuglevel = %d\n", level, global.params.debuglevel); | |
47 if (inc == 0) | |
48 { | |
49 inc = 2; | |
50 | |
51 if (ident) | |
52 { | |
53 if (findCondition(mod.debugids, ident)) | |
54 inc = 1; | |
55 else if (findCondition(global.params.debugids, ident)) | |
56 inc = 1; | |
57 else | |
58 { | |
59 if (!mod.debugidsNot) | |
129 | 60 mod.debugidsNot = new Vector!string(); |
0 | 61 |
129 | 62 mod.debugidsNot.push(ident.toChars()); |
0 | 63 } |
64 } | |
65 else if (level <= global.params.debuglevel || level <= mod.debuglevel) | |
66 inc = 1; | |
67 } | |
68 | |
69 return (inc == 1); | |
70 } | |
71 | |
72 | 72 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 73 { |
74 assert(false); | |
75 } | |
72 | 76 } |