source: dev/BasicCompiler_Common/Const.h@ 7

Last change on this file since 7 was 7, checked in by dai_9181, 17 years ago

Constステートメントで定数変数を宣言できるように改良。

File size: 1.2 KB
RevLine 
[4]1
2
3//定数の基底クラス
4class CConstBase{
5 char *Name;
6
7public:
8
9 CConstBase(char *Name);
10 ~CConstBase();
[7]11
12 char *GetName();
[4]13};
14
15//定数
16class CConst:public CConstBase{
17 int Type;
18 _int64 i64data;
[7]19
[4]20public:
[7]21 CConst *pNext;
[4]22
[7]23 CConst(char *Name, int Type, _int64 i64data);
24 CConst(char *Name, int value);
[4]25 ~CConst();
[7]26
27 int GetType();
28 _int64 GetWholeData();
29 double GetDoubleData();
[4]30};
31
32//定数マクロ
33class CConstMacro:public CConstBase{
34 int ParmNum;
35 char **ppParm;
36public:
37
[5]38 CConstMacro(char *Name, char *Expression);
[4]39 ~CConstMacro();
40};
41
42//定数管理クラス
43class CDBConst{
[7]44 CConst **ppHash;
[4]45
46 CConstMacro **ppobj_Macro;
47 int NumOfMacro;
48
[7]49 //シングルトンクラスなので、プライベートに置く
[4]50 CDBConst();
51 ~CDBConst();
[7]52 void _free();
53 void Free();
[4]54
[7]55public:
56
57 void Init();
58
[4]59 void Add(char *buffer);
[7]60private:
61 void AddConst(char *Name, CConst *newconst);
62public:
63 void AddConst(char *Name, char *Expression);
64 void AddConst(char *Name, int value);
[4]65
[7]66private:
67 CConst *GetObjectPtr(char *Name);
68public:
69
70 int GetType(char *Name);
71 _int64 GetWholeData(char *Name);
72 double GetDoubleData(char *Name);
73
74
75 //シングルトンオブジェクト
76 static CDBConst obj;
[4]77};
Note: See TracBrowser for help on using the repository browser.