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