Mercurial > projects > ldc
annotate dmd/cond.h @ 1218:7977096f0e49
Name some types.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 15 Apr 2009 21:37:01 +0200 |
parents | b30fe7e1dbb9 |
children |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
988
diff
changeset
|
3 // Copyright (c) 1999-2008 by Digital Mars |
1 | 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_DEBCOND_H | |
12 #define DMD_DEBCOND_H | |
13 | |
14 struct Expression; | |
15 struct Identifier; | |
16 struct OutBuffer; | |
17 struct Module; | |
18 struct Scope; | |
19 struct ScopeDsymbol; | |
20 #ifdef _DH | |
21 #include "lexer.h" // dmdhg | |
22 #endif | |
23 enum TOK; | |
24 #ifdef _DH | |
25 struct HdrGenState; | |
26 #endif | |
27 | |
28 int findCondition(Array *ids, Identifier *ident); | |
29 | |
30 struct Condition | |
31 { | |
32 Loc loc; | |
33 int inc; // 0: not computed yet | |
34 // 1: include | |
35 // 2: do not include | |
36 | |
37 Condition(Loc loc); | |
38 | |
39 virtual Condition *syntaxCopy() = 0; | |
40 virtual int include(Scope *sc, ScopeDsymbol *s) = 0; | |
41 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs) = 0; | |
42 }; | |
43 | |
44 struct DVCondition : Condition | |
45 { | |
46 unsigned level; | |
47 Identifier *ident; | |
48 Module *mod; | |
49 | |
50 DVCondition(Module *mod, unsigned level, Identifier *ident); | |
51 | |
52 Condition *syntaxCopy(); | |
53 }; | |
54 | |
55 struct DebugCondition : DVCondition | |
56 { | |
57 static void setGlobalLevel(unsigned level); | |
988
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1
diff
changeset
|
58 static void addGlobalIdent(const char *ident); |
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1
diff
changeset
|
59 static void addPredefinedGlobalIdent(const char *ident); |
1 | 60 |
61 DebugCondition(Module *mod, unsigned level, Identifier *ident); | |
62 | |
63 int include(Scope *sc, ScopeDsymbol *s); | |
64 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
65 }; | |
66 | |
67 struct VersionCondition : DVCondition | |
68 { | |
69 static void setGlobalLevel(unsigned level); | |
988
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1
diff
changeset
|
70 static void checkPredefined(Loc loc, const char *ident); |
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1
diff
changeset
|
71 static void addGlobalIdent(const char *ident); |
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
1
diff
changeset
|
72 static void addPredefinedGlobalIdent(const char *ident); |
1 | 73 |
74 VersionCondition(Module *mod, unsigned level, Identifier *ident); | |
75 | |
76 int include(Scope *sc, ScopeDsymbol *s); | |
77 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
78 }; | |
79 | |
80 struct StaticIfCondition : Condition | |
81 { | |
82 Expression *exp; | |
83 | |
84 StaticIfCondition(Loc loc, Expression *exp); | |
85 Condition *syntaxCopy(); | |
86 int include(Scope *sc, ScopeDsymbol *s); | |
87 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
88 }; | |
89 | |
90 struct IftypeCondition : Condition | |
91 { | |
92 /* iftype (targ id tok tspec) | |
93 */ | |
94 Type *targ; | |
95 Identifier *id; // can be NULL | |
96 enum TOK tok; // ':' or '==' | |
97 Type *tspec; // can be NULL | |
98 | |
99 IftypeCondition(Loc loc, Type *targ, Identifier *id, enum TOK tok, Type *tspec); | |
100 Condition *syntaxCopy(); | |
101 int include(Scope *sc, ScopeDsymbol *s); | |
102 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
103 }; | |
104 | |
105 | |
106 #endif |