comparison scn2k/scn2k_flags.h @ 56:c7bcc0ec2267

* replaced Grp and Text classes by the TextImpl and GrpImpl ones * splitted scn2k.h into smaller header files * moved some definitions from scn2k_*.cc to the header files * moved opcode implementation to scn2k_*impl.cc
author thib
date Thu, 30 Apr 2009 19:05:09 +0000
parents
children 4b9ffe15a87d
comparison
equal deleted inserted replaced
55:f1a27ee7e03c 56:c7bcc0ec2267
1 #ifndef __SCN2K_FLAGS_H__
2 #define __SCN2K_FLAGS_H__
3
4 #include <set>
5 #include <string>
6
7 struct VarInfo {
8 #define TYPE_NONSYSVARMAX 5
9 #define TYPE_VARMAX 9
10 #define TYPE_VARLOCSTR 10
11 #define TYPE_VARSYSSTR 12
12 #define TYPE_VARSTR 18
13 #define TYPE_STR 58
14 #define TYPE_VAL 68
15 #define TYPE_SYS 0xc8
16 #define TYPE_END 0x7f
17
18 #define TYPE_SYS_SYS 0
19 #define TYPE_SYS_SKIPMODE 1
20 int type;
21 int number;
22 int value;
23 VarInfo() { type = TYPE_VAL; value = 0;}
24 VarInfo(int n) { type = TYPE_VAL; value = n;}
25 VarInfo(const VarInfo& i) { type = i.type; number = i.number; value = i.value;}
26 };
27
28 class Flags {
29 /* flag:
30 ** type 0-5 : ¥í¡Œ¥«¥ëÀ°¿ô¡¢³Æ2000žÄ
31 ** type 6, 25 : ¥°¥í¡Œ¥Ð¥ëÀ°¿ô¡¢2000žÄ
32 ** type 10,11: ¥í¡Œ¥«¥ëÀ°¿ô??¡¢³Æ2000žÄ
33 ** type 12 : ¥°¥í¡Œ¥Ð¥ëÊž»úÎó¡¢2000žÄ (º£€Ï̵»ë€·€Æ€âÎÉ€€€¬)
34 ** type 18 : ¥í¡Œ¥«¥ëÊž»úÎó¡¢2000žÄ
35 ** type 25: ¥·¥¹¥Æ¥àÊÑ¿ô¡Ê¥Þ¥Š¥¹ºÂÉž€Ê€É¡©¡Ë 1000 žÄ¡©
36 ** type 26-32, 51 : 1-bit access to 0-6, 25
37 ** type 52-58, 77 : 2-bit access to 0-6, 25
38 ** type 78-84, 103 : 4-bit access to 0-6, 25
39 ** type 104-110, 129 : 8-bit access to 0-6, 25
40 */
41 private:
42 typedef unsigned int uint;
43 int sys;
44 int var[TYPE_VARMAX+1][2000];
45 std::string str[2000];
46 std::string sys_str[2000];
47 std::string loc_str[3];
48 public:
49 Flags(void);
50 int operator () () const;
51 int operator () (VarInfo info) const;
52 void Str(int type, unsigned int number, char* buf, int sz) const;
53 std::string Str(int type, unsigned int number) const;
54 std::set<int> cgm_data;
55
56 bool IsInt(int type) const;
57 int MaxIndex(int type) const;
58
59 void Set(VarInfo info, int value);
60 int Get(int type, int number) const;
61 void SetSys(int value);
62 void SetStr(VarInfo info, std::string val);
63
64 bool Exec(class Cmd& cmd);
65
66 void Save(std::string& str);
67 void Load(const char* str);
68
69 void SaveSys(std::string& str);
70 void LoadSys(const char* str);
71 };
72
73 #endif