| 1 |
// Compiler implementation of the D programming language |
|---|
| 2 |
// Copyright (c) 1999-2006 by Digital Mars |
|---|
| 3 |
// All Rights Reserved |
|---|
| 4 |
// written by Walter Bright |
|---|
| 5 |
// http://www.digitalmars.com |
|---|
| 6 |
// License for redistribution is by either the Artistic License |
|---|
| 7 |
// in artistic.txt, or the GNU General Public License in gnu.txt. |
|---|
| 8 |
// See the included readme.txt for details. |
|---|
| 9 |
|
|---|
| 10 |
#ifndef DMD_ENUM_H |
|---|
| 11 |
#define DMD_ENUM_H |
|---|
| 12 |
|
|---|
| 13 |
#ifdef __DMC__ |
|---|
| 14 |
#pragma once |
|---|
| 15 |
#endif /* __DMC__ */ |
|---|
| 16 |
|
|---|
| 17 |
#include "root.h" |
|---|
| 18 |
#include "dsymbol.h" |
|---|
| 19 |
|
|---|
| 20 |
struct Identifier; |
|---|
| 21 |
struct Type; |
|---|
| 22 |
struct Expression; |
|---|
| 23 |
#ifdef _DH |
|---|
| 24 |
struct HdrGenState; |
|---|
| 25 |
#endif |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
struct EnumDeclaration : ScopeDsymbol |
|---|
| 29 |
{ |
|---|
| 30 |
Type *type; // the TypeEnum |
|---|
| 31 |
Type *memtype; // type of the members |
|---|
| 32 |
integer_t maxval; |
|---|
| 33 |
integer_t minval; |
|---|
| 34 |
integer_t defaultval; // default initializer |
|---|
| 35 |
|
|---|
| 36 |
EnumDeclaration(Loc loc, Identifier *id, Type *memtype); |
|---|
| 37 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 38 |
void semantic(Scope *sc); |
|---|
| 39 |
int oneMember(Dsymbol **ps); |
|---|
| 40 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 41 |
Type *getType(); |
|---|
| 42 |
char *kind(); |
|---|
| 43 |
|
|---|
| 44 |
void emitComment(Scope *sc); |
|---|
| 45 |
void toDocBuffer(OutBuffer *buf); |
|---|
| 46 |
|
|---|
| 47 |
EnumDeclaration *isEnumDeclaration() { return this; } |
|---|
| 48 |
|
|---|
| 49 |
void toDebug(); |
|---|
| 50 |
|
|---|
| 51 |
Symbol *sinit; |
|---|
| 52 |
Symbol *toInitializer(); |
|---|
| 53 |
}; |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
struct EnumMember : Dsymbol |
|---|
| 57 |
{ |
|---|
| 58 |
Expression *value; |
|---|
| 59 |
|
|---|
| 60 |
EnumMember(Loc loc, Identifier *id, Expression *value); |
|---|
| 61 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 62 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 63 |
char *kind(); |
|---|
| 64 |
|
|---|
| 65 |
void emitComment(Scope *sc); |
|---|
| 66 |
void toDocBuffer(OutBuffer *buf); |
|---|
| 67 |
|
|---|
| 68 |
EnumMember *isEnumMember() { return this; } |
|---|
| 69 |
}; |
|---|
| 70 |
|
|---|
| 71 |
#endif /* DMD_ENUM_H */ |
|---|