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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.DebugCondition;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 72
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.DVCondition;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Module;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.ScopeDsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.HdrGenState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.Array;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.String;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.Global;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.condition.util.findCondition;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 class DebugCondition : DVCondition
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 static void setGlobalLevel(uint level)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 static void addGlobalIdent(const(char)* ident)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 static void addPredefinedGlobalIdent(const(char)* ident)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 this(Module mod, uint level, Identifier ident)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 {
178
e3afd1303184 Many small bugs fixed
korDen
parents: 129
diff changeset
40 register();
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 super(mod, level, ident);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 0
diff changeset
44 override bool include(Scope sc, ScopeDsymbol s)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 //printf("DebugCondition::include() level = %d, debuglevel = %d\n", level, global.params.debuglevel);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 if (inc == 0)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 inc = 2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 if (ident)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 if (findCondition(mod.debugids, ident))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 inc = 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 else if (findCondition(global.params.debugids, ident))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 inc = 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 if (!mod.debugidsNot)
129
010eb8f0e18d further work on dmd test suite
korDen
parents: 114
diff changeset
60 mod.debugidsNot = new Vector!string();
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61
129
010eb8f0e18d further work on dmd test suite
korDen
parents: 114
diff changeset
62 mod.debugidsNot.push(ident.toChars());
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 else if (level <= global.params.debuglevel || level <= mod.debuglevel)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 inc = 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 return (inc == 1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 0
diff changeset
72 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 0
diff changeset
76 }