• R/O
  • SSH
  • HTTPS

ttssh2: 提交


Commit MetaInfo

修订版8662 (tree)
时间2020-03-31 00:20:20
作者zmatsuo

Log Message

無効化したコードを削除

- r8652 で無効化した部分

更改概述

差异

--- branches/unicode_macro_2/teraterm/ttpmacro/ttmparse.c (revision 8661)
+++ branches/unicode_macro_2/teraterm/ttpmacro/ttmparse.c (revision 8662)
@@ -68,37 +68,6 @@
6868 WORD level;
6969 } TLab;
7070
71-#if 0
72-// 変数の個数を128->256、ラベルの個数を256->512へ拡張した。(2006.2.1 yutaka)
73-// 変数の個数を、InitTTL で作っているシステム変数の分だけ追加した。(2006.7.26 maya)
74-#define MaxNumOfIntVar (LONG)(256+4)
75-#define MaxNumOfStrVar (LONG)(256+20)
76-#define MaxNumOfLabVar (LONG)512
77-#define MaxNumOfIntAryVar (LONG)256
78-#define MaxNumOfStrAryVar (LONG)256
79-
80-#define IntVarIdOff (LONG)0
81-#define StrVarIdOff (IntVarIdOff+MaxNumOfIntVar)
82-#define LabVarIdOff (StrVarIdOff+MaxNumOfStrVar)
83-#define IntAryVarIdOff (LabVarIdOff+MaxNumOfLabVar)
84-#define StrAryVarIdOff (IntAryVarIdOff+MaxNumOfIntAryVar)
85-#define MaxNumOfName (MaxNumOfIntVar+MaxNumOfStrVar+MaxNumOfLabVar+MaxNumOfIntAryVar+MaxNumOfStrAryVar)
86-#define NameBuffLen MaxNumOfName*MaxNameLen
87-#define StrBuffLen MaxNumOfStrVar*MaxStrLen
88-
89-static int IntVal[MaxNumOfIntVar];
90-static BINT LabVal[MaxNumOfLabVar];
91-static BYTE LabLevel[MaxNumOfLabVar];
92-static TIntAry IntAryVal[MaxNumOfIntAryVar];
93-static TStrAry StrAryVal[MaxNumOfStrAryVar];
94-
95-static HANDLE HNameBuff;
96-static PCHAR NameBuff;
97-static HANDLE HStrBuff;
98-static PCHAR StrBuff;
99-static WORD IntVarCount, StrVarCount, LabVarCount, IntAryVarCount, StrAryVarCount;
100-#endif
101-
10271 typedef enum {
10372 TypeUnknown = TypUnknown,
10473 TypeInteger = TypInteger,
@@ -133,33 +102,13 @@
133102
134103 BOOL InitVar()
135104 {
136-#if 0
137- HNameBuff = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,NameBuffLen);
138- if (HNameBuff==NULL) return FALSE;
139- NameBuff = NULL;
140-
141- HStrBuff = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,StrBuffLen);
142- if (HStrBuff==NULL) return FALSE;
143- StrBuff = NULL;
144-
145- IntVarCount = 0;
146- LabVarCount = 0;
147- StrVarCount = 0;
148- return TRUE;
149-#else
150105 Variables = NULL;
151106 VariableCount = 0;
152107 return TRUE;
153-#endif
154108 }
155109
156110 void EndVar()
157111 {
158-#if 0
159- UnlockVar();
160- GlobalFree(HNameBuff);
161- GlobalFree(HStrBuff);
162-#endif
163112 // TODO Variables をすべて free する
164113 }
165114
@@ -209,30 +158,10 @@
209158
210159 void LockVar()
211160 {
212-#if 0
213- if (NameBuff==NULL)
214- NameBuff = GlobalLock(HNameBuff);
215- if (NameBuff==NULL)
216- PostQuitMessage(0);
217-
218- if (StrBuff==NULL)
219- StrBuff = GlobalLock(HStrBuff);
220- if (StrBuff==NULL)
221- PostQuitMessage(0);
222-#endif
223161 }
224162
225163 void UnlockVar()
226164 {
227-#if 0
228- if (NameBuff!=NULL)
229- GlobalUnlock(HNameBuff);
230- NameBuff = NULL;
231-
232- if (StrBuff!=NULL)
233- GlobalUnlock(HStrBuff);
234- StrBuff = NULL;
235-#endif
236165 }
237166
238167 BOOL CheckReservedWord(PCHAR Str, LPWORD WordId)
@@ -903,60 +832,7 @@
903832
904833 BOOL CheckVar(const char *Name, LPWORD VarType, PVarId VarId)
905834 {
906-#if 0
907835 int i;
908- long P;
909-
910- *VarType = TypUnknown;
911-
912- for (i=0; i<IntVarCount; i++) {
913- P = (i + IntVarIdOff) * MaxNameLen;
914- if (_stricmp(&NameBuff[P], Name) == 0) {
915- *VarType = TypInteger;
916- *VarId = (TVarId)i;
917- return TRUE;
918- }
919- }
920-
921- for (i=0; i<StrVarCount; i++) {
922- P = (i + StrVarIdOff) * MaxNameLen;
923- if (_stricmp(&NameBuff[P], Name) == 0) {
924- *VarType = TypString;
925- *VarId = i;
926- return TRUE;
927- }
928- }
929-
930- for (i=0; i<LabVarCount; i++) {
931- P = (i + LabVarIdOff) * MaxNameLen;
932- if (_stricmp(&NameBuff[P], Name) == 0) {
933- *VarType = TypLabel;
934- *VarId = i;
935- return TRUE;
936- }
937- }
938-
939- for (i=0; i<IntAryVarCount; i++) {
940- P = (i + IntAryVarIdOff) * MaxNameLen;
941- if (_stricmp(&NameBuff[P], Name) == 0) {
942- *VarType = TypIntArray;
943- *VarId = i;
944- return TRUE;
945- }
946- }
947-
948- for (i=0; i<StrAryVarCount; i++) {
949- P = (i + StrAryVarIdOff) * MaxNameLen;
950- if (_stricmp(&NameBuff[P], Name) == 0) {
951- *VarType = TypStrArray;
952- *VarId = i;
953- return TRUE;
954- }
955- }
956-
957- return FALSE;
958-#else
959- int i;
960836 const Variable_t *v = Variables;
961837 for (i = 0; i < VariableCount; v++,i++) {
962838 if (_stricmp(v->Name, Name) == 0) {
@@ -968,7 +844,6 @@
968844 *VarType = TypUnknown;
969845 *VarId = 0;
970846 return FALSE;
971-#endif
972847 }
973848
974849 static Variable_t *NewVar(const char *name, VariableType_t type)
@@ -988,57 +863,20 @@
988863
989864 BOOL NewIntVar(const char *Name, int InitVal)
990865 {
991-#if 0
992- long P;
993-
994- if (IntVarCount>=MaxNumOfIntVar) return FALSE;
995- P = (IntVarIdOff+IntVarCount)*MaxNameLen;
996- strncpy_s(&NameBuff[P],MaxNameLen,Name,_TRUNCATE);
997- IntVal[IntVarCount] = InitVal;
998- IntVarCount++;
999- return TRUE;
1000-#else
1001866 Variable_t *v = NewVar(Name, TypeInteger);
1002867 v->Value.Int = InitVal;
1003868 return TRUE;
1004-#endif
1005869 }
1006870
1007871 BOOL NewStrVar(const char *Name, const char *InitVal)
1008872 {
1009-#if 0
1010- long P;
1011-
1012- if (StrVarCount>=MaxNumOfStrVar) return FALSE;
1013- P = (StrVarIdOff+StrVarCount)*MaxNameLen;
1014- strncpy_s(&NameBuff[P],MaxNameLen,Name,_TRUNCATE);
1015- P = StrVarCount*MaxStrLen;
1016- strncpy_s(&StrBuff[P],MaxStrLen,InitVal,_TRUNCATE);
1017- StrVarCount++;
1018- return TRUE;
1019-#else
1020873 Variable_t *v = NewVar(Name, TypeString);
1021874 v->Value.Str = strdup(InitVal);
1022875 return TRUE;
1023-#endif
1024876 }
1025877
1026878 int NewIntAryVar(const char *Name, int size)
1027879 {
1028-#if 0
1029- long P;
1030- if (IntAryVarCount >= MaxNumOfIntAryVar) return ErrTooManyVar;
1031- if (size <= 0 || size > 65536) return ErrOutOfRange;
1032-
1033- if ((IntAryVal[IntAryVarCount].val = calloc(size, sizeof(int))) == NULL) return ErrFewMemory;
1034- IntAryVal[IntAryVarCount].size = size;
1035-
1036- P = (IntAryVarIdOff + IntAryVarCount) * MaxNameLen;
1037- strncpy_s(&NameBuff[P], MaxNameLen, Name, _TRUNCATE);
1038-
1039- IntAryVarCount++;
1040- return 0;
1041-#else
1042880 Variable_t *v = NewVar(Name, TypeIntArray);
1043881 TIntAry *intAry = &v->Value.IntAry;
1044882 int *array = calloc(size, sizeof(int));
@@ -1048,25 +886,10 @@
1048886 intAry->val = array;
1049887 intAry->size = size;
1050888 return 0;
1051-#endif
1052889 }
1053890
1054891 int NewStrAryVar(const char *Name, int size)
1055892 {
1056-#if 0
1057- long P;
1058- if (StrAryVarCount >= MaxNumOfStrAryVar) return ErrTooManyVar;
1059- if (size <= 0 || size > 65536) return ErrOutOfRange;
1060-
1061- if ((StrAryVal[StrAryVarCount].val = calloc(size, sizeof(TStrVal))) == NULL) return ErrFewMemory;
1062- StrAryVal[StrAryVarCount].size = size;
1063-
1064- P = (StrAryVarIdOff + StrAryVarCount) * MaxNameLen;
1065- strncpy_s(&NameBuff[P], MaxNameLen, Name, _TRUNCATE);
1066-
1067- StrAryVarCount++;
1068- return 0;
1069-#else
1070893 Variable_t *v = NewVar(Name, TypeStrArray);
1071894 TStrAry *strAry = &v->Value.StrAry;
1072895 char **array = calloc(size, sizeof(char *));
@@ -1076,37 +899,19 @@
1076899 strAry->val = array;
1077900 strAry->size = size;
1078901 return 0;
1079-#endif
1080902 }
1081903
1082904 BOOL NewLabVar(const char *Name, BINT InitVal, WORD ILevel)
1083905 {
1084-#if 0
1085- long P;
1086-
1087- if (LabVarCount>=MaxNumOfLabVar) return FALSE;
1088-
1089- P = (LabVarIdOff+LabVarCount)*MaxNameLen;
1090- strncpy_s(&(NameBuff[P]),MaxNameLen,Name,_TRUNCATE);
1091- LabVal[LabVarCount] = InitVal;
1092- LabLevel[LabVarCount] = LOBYTE(ILevel);
1093- LabVarCount++;
1094- return TRUE;
1095-#else
1096906 Variable_t *v = NewVar(Name, TypeLabel);
1097907 TLab *lab = &v->Value.Lab;
1098908 lab->val = InitVal;
1099909 lab->level = ILevel;
1100910 return TRUE;
1101-#endif
1102911 }
1103912
1104913 void DelLabVar(WORD ILevel)
1105914 {
1106-#if 0
1107- while ((LabVarCount>0) && (LabLevel[LabVarCount-1]>=ILevel))
1108- LabVarCount--;
1109-#else
1110915 Variable_t *v = Variables;
1111916 for (;;) {
1112917 if (v == &Variables[VariableCount]) {
@@ -1132,19 +937,13 @@
1132937 v++;
1133938 }
1134939 Variables = realloc(Variables, sizeof(Variable_t) * VariableCount);
1135-#endif
1136940 }
1137941
1138942 void CopyLabel(WORD ILabel, BINT far *Ptr, LPWORD Level)
1139943 {
1140-#if 0
1141- *Ptr = LabVal[ILabel];
1142- *Level = (WORD)LabLevel[ILabel];
1143-#else
1144944 Variable_t *v = &Variables[ILabel];
1145945 *Ptr = v->Value.Lab.val;
1146946 *Level = v->Value.Lab.level;
1147-#endif
1148947 }
1149948
1150949 /*
@@ -1181,28 +980,17 @@
1181980 }
1182981 else if (CheckVar(Name, ValType, &VarId)) {
1183982 switch (*ValType) {
1184-#if 0
1185- case TypInteger: *Val = IntVal[VarId]; break;
1186-#else
1187983 case TypInteger:
1188984 *Val = Variables[VarId].Value.Int;
1189985 break;
1190-#endif
1191986 case TypString: *Val = VarId; break;
1192987 case TypIntArray:
1193988 if (GetIndex(&Index, Err)) {
1194-#if 0
1195- if (Index >= 0 && Index < IntAryVal[VarId].size) {
1196- *Val = IntAryVal[VarId].val[Index];
1197- *ValType = TypInteger;
1198- }
1199-#else
1200989 TIntAry *intAry = &Variables[VarId].Value.IntAry;
1201990 if (Index >= 0 && Index < intAry->size) {
1202991 *Val = intAry->val[Index];
1203992 *ValType = TypInteger;
1204993 }
1205-#endif
1206994 else {
1207995 *Err = ErrOutOfRange;
1208996 }
@@ -1831,15 +1619,7 @@
18311619
18321620 void SetIntVal(TVarId VarId, int Val)
18331621 {
1834-#if 0
18351622 if (VarId >> 16) {
1836- IntAryVal[(VarId>>16)-1].val[VarId & 0xffff] = Val;
1837- }
1838- else {
1839- IntVal[VarId] = Val;
1840- }
1841-#else
1842- if (VarId >> 16) {
18431623 Variable_t *v = &Variables[(VarId>>16)-1];
18441624 int *int_val = &v->Value.IntAry.val[VarId & 0xffff];
18451625 *int_val = Val;
@@ -1848,19 +1628,10 @@
18481628 Variable_t *v = &Variables[VarId];
18491629 v->Value.Int = Val;
18501630 }
1851-#endif
18521631 }
18531632
18541633 int CopyIntVal(TVarId VarId)
18551634 {
1856-#if 0
1857- if (VarId >> 16) {
1858- return IntAryVal[(VarId>>16)-1].val[VarId & 0xffff];
1859- }
1860- else {
1861- return IntVal[VarId];
1862- }
1863-#else
18641635 Variable_t *v;
18651636 if (VarId >> 16) {
18661637 v = &Variables[(VarId>>16)-1];
@@ -1870,7 +1641,6 @@
18701641 v = &Variables[VarId];
18711642 return v->Value.Int;
18721643 }
1873-#endif
18741644 }
18751645
18761646 void GetIntVar(PVarId VarId, LPWORD Err)
@@ -1983,11 +1753,6 @@
19831753
19841754 void SetStrVal(TVarId VarId, const char *Str)
19851755 {
1986-#if 0
1987- // StrBuf の運用上 MaxStrLen が正しいサイズなのでサイズを固定
1988- // (2007.6.23 maya)
1989- strncpy_s(StrVarPtr(VarId), MaxStrLen, Str, _TRUNCATE);
1990-#else
19911756 if (VarId >> 16) {
19921757 Variable_t *v = &Variables[(VarId>>16)-1];
19931758 char **str = &v->Value.StrAry.val[VarId & 0xffff];
@@ -2000,19 +1765,10 @@
20001765 free(*str);
20011766 *str = strdup(Str);
20021767 }
2003-#endif
20041768 }
20051769
20061770 const char *StrVarPtr(TVarId VarId)
20071771 {
2008-#if 0
2009- if (VarId >> 16) {
2010- return StrAryVal[(VarId>>16)-1].val[VarId & 0xffff];
2011- }
2012- else {
2013- return &StrBuff[VarId*MaxStrLen];
2014- }
2015-#else
20161772 Variable_t *v;
20171773 if (VarId >> 16) {
20181774 v = &Variables[(VarId>>16)-1];
@@ -2022,7 +1778,6 @@
20221778 v = &Variables[VarId];
20231779 return v->Value.Str;
20241780 }
2025-#endif
20261781 }
20271782
20281783 // for ifdefined (2006.9.23 maya)
@@ -2042,14 +1797,6 @@
20421797 switch (*ValType) {
20431798 case TypIntArray:
20441799 if (GetIndex(&Index, Err)) {
2045-#if 0
2046- if (Index >= 0 && Index < IntAryVal[VarId].size) {
2047- *ValType = TypInteger;
2048- }
2049- else {
2050- *ValType = TypUnknown;
2051- }
2052-#else
20531800 TIntAry *intAry = &Variables[VarId].Value.IntAry;
20541801 if (Index >= 0 && Index < intAry->size) {
20551802 *ValType = TypInteger;
@@ -2057,7 +1804,6 @@
20571804 else {
20581805 *ValType = TypUnknown;
20591806 }
2060-#endif
20611807 }
20621808 break;
20631809 case TypStrArray:
@@ -2104,14 +1850,6 @@
21041850
21051851 TVarId GetIntVarFromArray(TVarId VarId, int Index, LPWORD Err)
21061852 {
2107-#if 0
2108- if (Index < 0 || Index >= IntAryVal[VarId].size) {
2109- *Err = ErrOutOfRange;
2110- return -1;
2111- }
2112- *Err = 0;
2113- return ((VarId+1) << 16) | Index;
2114-#else
21151853 TIntAry *intAry = &Variables[VarId].Value.IntAry;
21161854 if (Index < 0 || Index >= intAry->size) {
21171855 *Err = ErrOutOfRange;
@@ -2119,19 +1857,10 @@
21191857 }
21201858 *Err = 0;
21211859 return ((VarId+1) << 16) | Index;
2122-#endif
21231860 }
21241861
21251862 TVarId GetStrVarFromArray(TVarId VarId, int Index, LPWORD Err)
21261863 {
2127-#if 0
2128- if (Index < 0 || Index >= StrAryVal[VarId].size) {
2129- *Err = ErrOutOfRange;
2130- return -1;
2131- }
2132- *Err = 0;
2133- return ((VarId+1) << 16) | Index;
2134-#else
21351864 TStrAry *strAry = &Variables[VarId].Value.StrAry;
21361865 if (Index < 0 || Index >= strAry->size) {
21371866 *Err = ErrOutOfRange;
@@ -2139,7 +1868,6 @@
21391868 }
21401869 *Err = 0;
21411870 return ((VarId+1) << 16) | Index;
2142-#endif
21431871 }
21441872
21451873 void GetAryVar(PVarId VarId, WORD VarType, LPWORD Err)
@@ -2192,20 +1920,12 @@
21921920
21931921 int GetIntAryVarSize(TVarId VarId)
21941922 {
2195-#if 0
2196- return IntAryVal[VarId].size;
2197-#else
21981923 TIntAry *intAry = &Variables[VarId].Value.IntAry;
21991924 return intAry->size;
2200-#endif
22011925 }
22021926
22031927 int GetStrAryVarSize(TVarId VarId)
22041928 {
2205-#if 0
2206- return StrAryVal[VarId].size;
2207-#else
22081929 TIntAry *strAry = &Variables[VarId].Value.IntAry;
22091930 return strAry->size;
2210-#endif
22111931 }
Show on old repository browser