| 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 Load(const char* str); |
|---|
| 67 | void LoadSys(const char* str); |
|---|
| 68 | void Load(const char* str, bool sys); |
|---|
| 69 | |
|---|
| 70 | void Save(std::string& str); |
|---|
| 71 | void SaveSys(std::string& str); |
|---|
| 72 | }; |
|---|
| 73 | |
|---|
| 74 | #endif |
|---|