2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2006 by Digital Mars
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.
21 #include "lexer.h" // dmdhg
28 int findCondition(Array
*ids
, Identifier
*ident
);
33 int inc
; // 0: not computed yet
39 virtual Condition
*syntaxCopy() = 0;
40 virtual int include(Scope
*sc
, ScopeDsymbol
*s
) = 0;
41 virtual void toCBuffer(OutBuffer
*buf
, HdrGenState
*hgs
) = 0;
44 struct DVCondition
: Condition
50 DVCondition(Module
*mod
, unsigned level
, Identifier
*ident
);
52 Condition
*syntaxCopy();
55 struct DebugCondition
: DVCondition
57 static void setGlobalLevel(unsigned level
);
58 static void addGlobalIdent(char *ident
);
59 static void addPredefinedGlobalIdent(char *ident
);
61 DebugCondition(Module
*mod
, unsigned level
, Identifier
*ident
);
63 int include(Scope
*sc
, ScopeDsymbol
*s
);
64 void toCBuffer(OutBuffer
*buf
, HdrGenState
*hgs
);
67 struct VersionCondition
: DVCondition
69 static void setGlobalLevel(unsigned level
);
70 static void checkPredefined(Loc loc
, char *ident
);
71 static void addGlobalIdent(char *ident
);
72 static void addPredefinedGlobalIdent(char *ident
);
74 VersionCondition(Module
*mod
, unsigned level
, Identifier
*ident
);
76 int include(Scope
*sc
, ScopeDsymbol
*s
);
77 void toCBuffer(OutBuffer
*buf
, HdrGenState
*hgs
);
80 struct StaticIfCondition
: Condition
84 StaticIfCondition(Loc loc
, Expression
*exp
);
85 Condition
*syntaxCopy();
86 int include(Scope
*sc
, ScopeDsymbol
*s
);
87 void toCBuffer(OutBuffer
*buf
, HdrGenState
*hgs
);
90 struct IftypeCondition
: Condition
92 /* iftype (targ id tok tspec)
95 Identifier
*id
; // can be NULL
96 enum TOK tok
; // ':' or '=='
97 Type
*tspec
; // can be NULL
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
);