--- spal60sr\src\TSSGCtrl\SSDoubleList.original.cpp	Sun Apr 20 17:57:38 2003
+++ spal60sr\src\TSSGCtrl\SSDoubleList.cpp	Sun Apr 20 17:57:38 2003
@@ -1,5 +1,27 @@
 #include "SSDoubleList.h"
 
+#define LOCAL_MEMORY_SUPPORT 1
+#define FIX_SPLIT_ELEMENT    1
+#define FIX_DOUBLE_LIST      1
+#define COMMON_LIST          1
+
+#if defined(LOCAL_MEMORY_SUPPORT) && LOCAL_MEMORY_SUPPORT
+#if defined(IO_FEP_SUPPORT) && IO_FEP_SUPPORT
+void __stdcall TSSGSubject_CheckFEPParam(TSSGSubject *_this, const string *s);
+BOOLEAN __stdcall TSSGCtrl_OneRead_with_CheckLocalMemory_CheckIO_FEP(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD Address, LPVOID Data, DWORD Size, const string &AddressStr);
+BOOLEAN __stdcall TSSGCtrl_OneWrite_with_CheckLocalMemory_CheckIO_FEP(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD Address, LPVOID Data, DWORD Size, const string &AddressStr);
+#else
+BOOLEAN __stdcall TSSGCtrl_OneRead_with_CheckLocalMemory(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD Address, LPVOID Data, DWORD Size, const string &AddressStr);
+BOOLEAN __stdcall TSSGCtrl_OneWrite_with_CheckLocalMemory(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD Address, LPVOID Data, DWORD Size, const string &AddressStr);
+#endif
+long __stdcall TSSGCtrl_Compare_with_CheckLocalMemory(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD *Address, vector<TProcessAccessElementBase*> &AEVec, const string &AddressStr);
+unsigned long __stdcall TSSGCtrl_Write_with_CheckLocalMemory(TSSGCtrl *_this, TSSGSubject *SSGS, HANDLE ProcessHandle, DWORD *Address, vector<TProcessAccessElementBase*> &AEVec, const string &AddressStr);
+#endif
+
+#if defined(FIX_SPLIT_ELEMENT) && FIX_SPLIT_ELEMENT
+string __cdecl SplitElement(LPVOID strD, string *Src, string Token, DWORD Index, DWORD Option);
+#endif
+
 //---------------------------------------------------------------------
 //uݒ֐v
 //
@@ -14,6 +36,10 @@
 
  //R[h̐؂蕪
  SSGC.strD.List(code+SSGC.GetEndWith(this), ",", &tmpV, strD::dtESCAPE+strD::etTRIM+strD::etREPLACE);
+#if defined(IO_FEP_SUPPORT) && IO_FEP_SUPPORT
+ if (tmpV.size() >= 7)
+	TSSGSubject_CheckFEPParam(this, &tmpV[6]);
+#endif
  tmpV.resize(6);	//K萔
 
  //Kp
@@ -37,6 +63,7 @@
 	}
  }
 
+#if !defined(FIX_DOUBLE_LIST) || !FIX_DOUBLE_LIST
  vector<string> *ListFile = SSGC.GetSSGDataFile(this, dataFileName, ".LST");
  if(ListFile!=NULL){
 	vector<byte> &StatusVec = statusVec;	//[Jϐ֒u
@@ -57,6 +84,7 @@
 		}
 	}
  }
+#endif
 
 
  
@@ -85,14 +113,26 @@
  Setting(SSGC);
 
  TSmartHandle SHandle;
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
  if(( SHandle=SSGC.Open(this, PROCESS_VM_READ) )==NULL)
 	return ssgCtrl::reOPEN_ERROR;	//vZX̃I[vG[
+#else
+ SHandle = SSGC.Open(this, PROCESS_VM_READ);
+#endif
 
+#if !defined(SUBJECT_STATUS) || !SUBJECT_STATUS
  if(!SSGC.IsEnabled(this)) return ssgCtrl::reNOT_ENABLED;	//LU
+#else
+ if(!SSGC.IsEnabled(this, TRUE)) return ssgCtrl::reNOT_ENABLED;	//LU
+#endif
 
 
  //ItZbgp̃AhXɂ́A[replace]̑tȂ
+#if !defined(SUBJECT_STATUS) || !SUBJECT_STATUS
  unsigned long OffsetAddress = (isOffset)? SSGC.GetAddress(this, addressStr, 0): 0;
+#else
+ unsigned long OffsetAddress = (isOffset) ? (unsigned long)(address = (const BYTE *)SSGC.GetAddress(this, addressStr, 0)) : 0;
+#endif
  
  //{AhX́AKp
  unsigned long BaseAddress = SSGC.GetAddress(this, addressStr);
@@ -102,13 +142,22 @@
  if(ListFile==NULL) return ssgCtrl::reOPTION_ERROR;	//Xgt@CȂI
 
  unsigned long Val=0;	//{AhX̒lB
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
  if(!SSGC.OneRead(this, SHandle, BaseAddress, &Val, size))
+#elif !defined(IO_FEP_SUPPORT) || !IO_FEP_SUPPORT
+ if (!TSSGCtrl_OneRead_with_CheckLocalMemory(&SSGC, this, SHandle, BaseAddress, &Val, size, addressStr))
+#else
+ if (!TSSGCtrl_OneRead_with_CheckLocalMemory_CheckIO_FEP(&SSGC, this, SHandle, BaseAddress, &Val, size, addressStr))
+#endif
 	return ssgCtrl::reACCESS_ERROR;	//G[Ȃ1Ԃ
 
 
+#if !defined(FIX_DOUBLE_LIST) || !FIX_DOUBLE_LIST
  vector<byte> &StatusVec = statusVec;	//[Jϐ֒u
+#endif
  unsigned long i=0, End=ListFile->size();
  for(; i<End; i++){
+#if !defined(FIX_DOUBLE_LIST) || !FIX_DOUBLE_LIST
 	//R[hɉ͂AYCfbNXT
 	if(StatusVec[i]==1){	//l
 		if(TStringDivision::ToULongDef(ListFile->at(i))==Val){
@@ -162,6 +211,110 @@
 			return ssgCtrl::reNO_ERROR;
 		}
 	}
+#else
+	// R[hɉ͂AYCfbNXT
+	switch (*ListFile->at(i).c_str())
+	{
+	case '\0':
+		break;
+	case ',':
+		// A
+		{
+			TSmartVector<TProcessAccessElementBase> CompareVec;
+			vector<string> tmpV;
+			unsigned long j = 1,
+				End2 = SSGC.strD.List(ListFile->at(i), ",", &tmpV);
+
+			for (; j < End2; j++)
+			{
+#if !defined(FIX_SPLIT_ELEMENT) || !FIX_SPLIT_ELEMENT
+				unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, SSGC.strD.Half(&tmpV[j], "="));
+#elif !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+				unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, SplitElement(&SSGC.strD, &tmpV[j], "=", 0, 0));
+#else
+				string addressStr(SplitElement(&SSGC.strD, &tmpV[j], "=", 0, 0));
+				unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, addressStr);
+#endif
+				// *+??ȂǂlȂAvector<TProcessAccessElementBase *>
+				CompareVec = SSGC.MakeDataCode(this, tmpV[j], string(""), true, ThisAddress, OffsetAddress);
+
+				// svȂ瑦
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+				if (SSGC.Compare(this, SHandle, &ThisAddress, *CompareVec.GetData()) != 0)
+#else
+				if (TSSGCtrl_Compare_with_CheckLocalMemory(&SSGC, this, SHandle, &ThisAddress, *CompareVec.GetData(), addressStr) != 0)
+#endif
+					break;
+			}
+
+			if (j == End2)
+			{
+				// SĈv
+				((TSSArgLongIndex*)Arg)->SetValue(i);
+				return ssgCtrl::reNO_ERROR;
+			}
+		}
+		break;
+	case '@':
+		// `FCt@Cw
+		{
+			TSmartVector<TProcessAccessElementBase> CompareVec;
+			vector<string> *tmpV
+				= SSGC.GetSSGDataFile(this, ListFile->at(i).substr(1, string::npos), ".CHN");
+			if (tmpV == NULL)
+				return ssgCtrl::reOPTION_ERROR;	// w̃`FCt@CȂI
+
+			vector<string>::iterator
+				VecIt = tmpV->begin(),
+				VecEnd = tmpV->end();
+			for (; VecIt != VecEnd; VecIt++)
+			{
+				unsigned long Pos = SSGC.strD.Find(*VecIt, ",");
+				if ((size_t)Pos == string::npos)
+					continue;
+
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+				unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, VecIt->substr(0, Pos));
+#else
+				string addressStr(VecIt->substr(0, Pos));
+				unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, addressStr);
+#endif
+				// *+??ȂǂlȂAvector<TProcessAccessElementBase *>
+				CompareVec = SSGC.MakeDataCode(this, VecIt->substr(Pos + 1, string::npos), string(""), true, ThisAddress, OffsetAddress);
+
+				// svȂ瑦
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+				if (SSGC.Compare(this, SHandle, &ThisAddress, *CompareVec.GetData()) != 0)
+#else
+				if (TSSGCtrl_Compare_with_CheckLocalMemory(&SSGC, this, SHandle, &ThisAddress, *CompareVec.GetData(), addressStr) != 0)
+#endif
+					break;
+			}
+
+			if (VecIt == VecEnd)
+			{
+				// SĈv
+				((TSSArgLongIndex*)Arg)->SetValue(i);
+				return ssgCtrl::reNO_ERROR;
+			}
+		}
+		break;
+	default:
+		// l
+#if !defined(COMMON_LIST) || !COMMON_LIST
+		if (TStringDivision::ToULongDef(ListFile->at(i)) == Val)
+#else
+		const char *s = ListFile->at(i).c_str();
+		char *endptr;
+		if (strtoul(s, &endptr, 0) == Val && endptr != s)
+#endif
+		{
+			((TSSArgLong*)Arg)->SetValue(i);
+			return ssgCtrl::reNO_ERROR;
+		}
+		break;
+	}
+#endif
  }
  ((TSSArgLongIndex*)Arg)->SetValue( -1 );	//Y
  
@@ -182,14 +335,22 @@
  Setting(SSGC);
 
  TSmartHandle SHandle;
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
  if(( SHandle=SSGC.Open(this, PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_VM_OPERATION) )==NULL)
 	return ssgCtrl::reOPEN_ERROR;	//vZX̃I[vG[
+#else
+ SHandle = SSGC.Open(this, PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION);
+#endif
 
 if(!SSGC.IsEnabled(this)) return ssgCtrl::reNOT_ENABLED;	//LU
 
 
  //ItZbgp̃AhXɂ́A[replace]̑tȂ
+#if !defined(SUBJECT_STATUS) || !SUBJECT_STATUS
  unsigned long OffsetAddress = (isOffset)? SSGC.GetAddress(this, addressStr, 0): 0;
+#else
+ unsigned long OffsetAddress = (isOffset) ? (unsigned long)(address = (const BYTE *)SSGC.GetAddress(this, addressStr, 0)) : 0;
+#endif
 
  vector<string> *ListFile = SSGC.GetSSGDataFile(this, dataFileName, ".LST");
  if(ListFile==NULL) return ssgCtrl::reOPTION_ERROR;	//Xgt@CȂI
@@ -198,6 +359,7 @@
  //w̍sł
  if(ListFile->size() <= Index) return ssgCtrl::reINDEX_ERROR;
  
+#if !defined(FIX_DOUBLE_LIST) || !FIX_DOUBLE_LIST
  if(statusVec[Index]==1){	//l
 	long Val = TStringDivision::ToLongDef(ListFile->at(Index));
 	//G[Ȃ1Ԃ
@@ -220,7 +382,7 @@
 	TSmartVector<TProcessAccessElementBase> CompareVec;
 	vector<string> *tmpV 
 		= SSGC.GetSSGDataFile(this, ListFile->at(Index).substr(1,string::npos), ".CHN");
-	if(tmpV==NULL) return ssgCtrl::reOPTION_ERROR; 	//w̃`FCt@CȂI
+	if(tmpV==NULL) return ssgCtrl::reOPTION_ERROR;	//w̃`FCt@CȂI
 
 	vector<string>::iterator
 		VecIt = tmpV->begin(),
@@ -237,6 +399,99 @@
 			return ssgCtrl::reACCESS_ERROR;	//G[
 	}
  }
+#else
+ switch (*ListFile->at(Index).c_str())
+ {
+ case '\0':
+	break;
+ case ',':
+	// A
+	{
+		TSmartVector<TProcessAccessElementBase> CompareVec;
+		vector<string> tmpV;
+		unsigned long i = 1,
+			End = SSGC.strD.List(ListFile->at(Index), ",", &tmpV);
+
+		for (; i < End; i++)
+		{
+#if !defined(FIX_SPLIT_ELEMENT) || !FIX_SPLIT_ELEMENT
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, SSGC.strD.Half(&tmpV[i], "="));
+#elif !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, SplitElement(&SSGC.strD, &tmpV[i], "=", 0, 0));
+#else
+			string addressStr(SplitElement(&SSGC.strD, &tmpV[i], "=", 0, 0));
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, addressStr);
+#endif
+			// *+??ȂǂlȂAvector<TProcessAccessElementBase *>
+			CompareVec = SSGC.MakeDataCode(this, tmpV[i], string(""), true, ThisAddress, OffsetAddress);
+
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+			if (SSGC.Write(this, SHandle, &ThisAddress, *CompareVec.GetData()) != 0)
+#else
+			if (TSSGCtrl_Write_with_CheckLocalMemory(&SSGC, this, SHandle, &ThisAddress, *CompareVec.GetData(), addressStr) != 0)
+#endif
+				return ssgCtrl::reACCESS_ERROR;	// G[
+		}
+	}
+	break;
+ case '@':
+	// `FCt@Cw
+	{
+		TSmartVector<TProcessAccessElementBase> CompareVec;
+		vector<string> *tmpV
+			= SSGC.GetSSGDataFile(this, ListFile->at(Index).substr(1, string::npos), ".CHN");
+		if (tmpV == NULL) return ssgCtrl::reOPTION_ERROR;	// w̃`FCt@CȂI
+
+		vector<string>::iterator
+			VecIt = tmpV->begin(),
+			VecEnd = tmpV->end();
+		for (; VecIt != VecEnd; VecIt++)
+		{
+			unsigned long Pos = SSGC.strD.Find(*VecIt, ",");
+			if ((size_t)Pos == string::npos)
+				continue;
+
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, VecIt->substr(0, Pos));
+#else
+			string addressStr(VecIt->substr(0, Pos));
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, addressStr);
+#endif
+			// *+??ȂǂlȂAvector<TProcessAccessElementBase *>
+			CompareVec = SSGC.MakeDataCode(this, VecIt->substr(Pos + 1, string::npos), string(""), true, ThisAddress, OffsetAddress);
+
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+			if (SSGC.Write(this, SHandle, &ThisAddress, *CompareVec.GetData()) != 0)
+#else
+			if (TSSGCtrl_Write_with_CheckLocalMemory(&SSGC, this, SHandle, &ThisAddress, *CompareVec.GetData(), addressStr) != 0)
+#endif
+				return ssgCtrl::reACCESS_ERROR;	// G[
+		}
+	}
+	break;
+ default:
+	// l
+	{
+#if !defined(COMMON_LIST) || !COMMON_LIST
+		long Val = TStringDivision::ToLongDef(ListFile->at(Index));
+#else
+		const char *s = ListFile->at(Index).c_str();
+		char *endptr;
+		unsigned long Val = strtoul(s, &endptr, 0);
+		if (endptr == s)
+			break;
+#endif
+		// G[Ȃ1Ԃ
+#if !defined(LOCAL_MEMORY_SUPPORT) || !LOCAL_MEMORY_SUPPORT
+		return SSGC.OneWrite(this, SHandle, SSGC.GetAddress(this, addressStr), &Val, size) ? 0 : 1;
+#elif !defined(IO_FEP_SUPPORT) || !IO_FEP_SUPPORT
+		return TSSGCtrl_OneWrite_with_CheckLocalMemory(&SSGC, this, SHandle, SSGC.GetAddress(this, addressStr), &Val, size, addressStr) ? 0 : 1;
+#else
+		return TSSGCtrl_OneWrite_with_CheckLocalMemory_CheckIO_FEP(&SSGC, this, SHandle, SSGC.GetAddress(this, addressStr), &Val, size, addressStr) ? 0 : 1;
+#endif
+	}
+ }
+#endif
 
  
  return ssgCtrl::reNO_ERROR;
@@ -255,7 +510,11 @@
 	return "";	//|C^nĉ
 
  //ItZbgp̃AhXɂ́A[replace]̑tȂ
+#if !defined(SUBJECT_STATUS) || !SUBJECT_STATUS
  unsigned long OffsetAddress = (isOffset)? SSGC.GetAddress(this, addressStr, 0): 0;
+#else
+ unsigned long OffsetAddress = (isOffset) ? (unsigned long)(address = (const BYTE *)SSGC.GetAddress(this, addressStr, 0)) : 0;
+#endif
 
  vector<string> *ListFile = SSGC.GetSSGDataFile(this, dataFileName, ".LST");
  if(ListFile==NULL) return JumpedStr;	//Xgt@CȂI
@@ -265,6 +524,7 @@
  if(ListFile->size() <= Index) return JumpedStr;
  
  
+#if !defined(FIX_DOUBLE_LIST) || !FIX_DOUBLE_LIST
  if(statusVec[Index]==1){	//l
 	long Val = TStringDivision::ToLongDef(ListFile->at(Index));
 	return TStringDivision::ToString( Val,("%0"+TStringDivision::ToString(size*2)+"X").c_str());
@@ -312,6 +572,88 @@
 	}
 	return tmpS;
  }
+#else
+ switch (*ListFile->at(Index).c_str())
+ {
+ case '\0':
+	break;
+ case ',':
+	// A
+	{
+		vector<string> tmpV;
+		unsigned long i = 1,
+			End = SSGC.strD.List(ListFile->at(Index), ",", &tmpV);
+
+		string tmpS;
+		unsigned long Base = OffsetAddress;
+		for (; i < End; i++)
+		{
+#if !defined(FIX_SPLIT_ELEMENT) || !FIX_SPLIT_ELEMENT
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, SSGC.strD.Half(&tmpV[i], "="));
+#else
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, SplitElement(&SSGC.strD, &tmpV[i], "=", 0, 0));
+#endif
+			if (ThisAddress != Base)
+				tmpS += "*+04" + TStringDivision::ToString(ThisAddress - Base, "%08X");
+			tmpS += SSGC.LoopCodeToByteCode(this, tmpV[i], ThisAddress, OffsetAddress);
+			Base = ThisAddress + size;
+		}
+		if (Base != (OffsetAddress + size))
+		{
+			// sizei񂾂ƂֈړB
+			tmpS += "*+04" + TStringDivision::ToString(OffsetAddress + size - Base, "%08X");
+		}
+		return tmpS;
+	}
+ case '@':
+	// `FCt@Cw
+	{
+		vector<string> *tmpV
+			= SSGC.GetSSGDataFile(this, ListFile->at(Index).substr(1, string::npos), ".CHN");
+		if (tmpV == NULL)
+			return JumpedStr;	// w̃`FCt@CȂI
+
+		string tmpS;
+		unsigned long Base = OffsetAddress;
+		vector<string>::iterator
+			VecIt = tmpV->begin(),
+			VecEnd = tmpV->end();
+		for (; VecIt != VecEnd; VecIt++)
+		{
+			unsigned long Pos = SSGC.strD.Find(*VecIt, ",");
+			if ((size_t)Pos == string::npos)
+				continue;
+
+			unsigned long ThisAddress = OffsetAddress + SSGC.GetAddress(this, VecIt->substr(0, Pos));
+			if (ThisAddress != Base)
+				tmpS += "*+04" + TStringDivision::ToString(ThisAddress - Base, "%08X");
+			tmpS += SSGC.LoopCodeToByteCode(this, VecIt->substr(Pos + 1, string::npos), ThisAddress, OffsetAddress);
+
+			Base = ThisAddress + size;
+		}
+		if (Base != (OffsetAddress + size))
+		{
+			// sizei񂾂ƂֈړB
+			tmpS += "*+04" + TStringDivision::ToString(OffsetAddress + size - Base, "%08X");
+		}
+		return tmpS;
+	}
+ default:
+	// l
+	{
+#if !defined(COMMON_LIST) || !COMMON_LIST
+		long Val = TStringDivision::ToLongDef(ListFile->at(Index));
+#else
+		const char *s = ListFile->at(Index).c_str();
+		char *endptr;
+		unsigned long Val = strtoul(s, &endptr, 0);
+		if (endptr == s)
+			break;
+#endif
+		return TStringDivision::ToString(Val, ("%0" + TStringDivision::ToString(size * 2) + "X").c_str());
+	}
+ }
+#endif
  return JumpedStr;
 }
 //---------------------------------------------------------------------
