1
|
1
|
|
2 // Compiler implementation of the D programming language
|
|
3 // Copyright (c) 1999-2006 by Digital Mars
|
|
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_ENUM_H
|
|
12 #define DMD_ENUM_H
|
|
13
|
|
14 #ifdef __DMC__
|
|
15 #pragma once
|
|
16 #endif /* __DMC__ */
|
|
17
|
|
18 #include "root.h"
|
|
19 #include "dsymbol.h"
|
|
20
|
|
21 struct Identifier;
|
|
22 struct Type;
|
|
23 struct Expression;
|
|
24 #ifdef _DH
|
|
25 struct HdrGenState;
|
|
26 #endif
|
|
27
|
|
28
|
|
29 struct EnumDeclaration : ScopeDsymbol
|
|
30 {
|
|
31 Type *type; // the TypeEnum
|
|
32 Type *memtype; // type of the members
|
|
33 integer_t maxval;
|
|
34 integer_t minval;
|
|
35 integer_t defaultval; // default initializer
|
|
36
|
|
37 EnumDeclaration(Loc loc, Identifier *id, Type *memtype);
|
|
38 Dsymbol *syntaxCopy(Dsymbol *s);
|
|
39 void semantic(Scope *sc);
|
|
40 int oneMember(Dsymbol **ps);
|
|
41 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
42 Type *getType();
|
|
43 char *kind();
|
|
44
|
|
45 void emitComment(Scope *sc);
|
|
46 void toDocBuffer(OutBuffer *buf);
|
|
47
|
|
48 EnumDeclaration *isEnumDeclaration() { return this; }
|
|
49
|
|
50 void toObjFile(); // compile to .obj file
|
|
51 void toDebug();
|
|
52 int cvMember(unsigned char *p);
|
|
53
|
|
54 Symbol *sinit;
|
|
55 Symbol *toInitializer();
|
|
56 };
|
|
57
|
|
58
|
|
59 struct EnumMember : Dsymbol
|
|
60 {
|
|
61 Expression *value;
|
|
62
|
|
63 EnumMember(Loc loc, Identifier *id, Expression *value);
|
|
64 Dsymbol *syntaxCopy(Dsymbol *s);
|
|
65 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
66 char *kind();
|
|
67
|
|
68 void emitComment(Scope *sc);
|
|
69 void toDocBuffer(OutBuffer *buf);
|
|
70
|
|
71 EnumMember *isEnumMember() { return this; }
|
|
72 };
|
|
73
|
|
74 #endif /* DMD_ENUM_H */
|