Index: trunk/abdev/BasicCompiler_Common/VariableOpe.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 159)
+++ trunk/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 182)
@@ -1,2 +1,7 @@
+#include <jenga/include/smoothie/Smoothie.h>
+#include <jenga/include/smoothie/LexicalAnalysis.h>
+
+#include <LexicalScopingImpl.h>
+
 #include "../BasicCompiler_Common/common.h"
 
@@ -7,14 +12,4 @@
 #endif
 
-BOOL IsVariableTopChar(char c){
-	if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||c=='_') return 1;
-	return 0;
-}
-BOOL IsVariableChar(char c){
-	if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9')||
-		c=='%'||c=='!'||c=='#'||c=='$'||
-		c=='_'||c=='.') return 1;
-	return 0;
-}
 BOOL IsPtrType(int type){
 	if(type==-1) return 0;
@@ -119,5 +114,5 @@
 			return DEF_QWORD;
 		case DEF_CHAR:
-			if( isUnicode ) return DEF_WORD;
+			if( Smoothie::IsUnicode() ) return DEF_WORD;
 			return DEF_BYTE;
 	}
@@ -150,5 +145,5 @@
 	//文字型
 	else if( type == DEF_CHAR ){
-		if( isUnicode ) return sizeof( WORD );
+		if( Smoothie::IsUnicode() ) return sizeof( WORD );
 		return sizeof( BYTE );
 	}
@@ -220,5 +215,5 @@
 		if(lpIndex==-1) lstrcpy(name,"VoidPtr");
 		else{
-			if( Smoothie::meta.procPointers[lpIndex]->ReturnType().IsNull() )
+			if( Smoothie::GetMeta().GetProcPointers()[lpIndex]->ReturnType().IsNull() )
 				lstrcpy(name,"*Sub");
 			else lstrcpy(name,"*Function");
@@ -235,5 +230,5 @@
 
 Type GetStringTypeInfo(){
-	Type type( DEF_OBJECT, *pobj_DBClass->GetStringClassPtr() );
+	Type type( DEF_OBJECT, *Smoothie::GetMeta().GetClasses().GetStringClassPtr() );
 	return type;
 }
@@ -248,51 +243,94 @@
 }
 
-/*TODO: 消す
-bool FormatUseProcReturnObject( const char *term, char *procName, char *parameter, CClass::RefType &refType, char *member ){
-	int p1 = 0, p2 = 0;
-
-	for( int i=0; term[i]!='\0' ; i++ ){
-
-		if( term[i] == '[' ){
-			i = JumpStringInBracket( term, i + 1 );
-			if( term[i] == '\0' ) break;
-			continue;
-		}
-		if( term[i] == '(' ){
-			int temp_p = i;
-			i = JumpStringInPare( term, i + 1 ) + 1;
-			if( term[i] == '\0' ) break;
-			if( term[i] == '.'
-				|| term[i] == 1 && term[i] == ESC_PSMEM ){
-					p1 = temp_p;
-					p2 = i;
-			}
-			continue;
-		}
-	}
-	if( !p1 ) return false;
-
-	//メソッド名
-	memcpy( procName, term, p1 );
-	procName[p1] = 0;
-
-	//パラメータ
-	memcpy( parameter, term + p1 + 1, p2 - p1 - 2 );
-	parameter[ p2 - p1 - 2 ] = 0;
-
-	//参照タイプ
-	if( term[p2] == '.' ){
-		refType = CClass::Dot;
-	}
-	else{
-		refType = CClass::Pointer;
-		p2++;
-	}
-
-	//メンバ
-	lstrcpy( member, term + p2 + 1 );
-
-	return true;
-}*/
+
+void GetArrange(char *variable,char *variAnswer,int *SubScripts){
+	extern int cp;
+	int i,i2,i3,i4;
+	double dbl;
+	_int64 i64data;
+	BOOL bBracket;
+	char temporary[VN_SIZE];
+
+	for(i=0;;i++){
+		if(variable[i]=='('||variable[i]=='['){
+			if(variable[i]=='[') bBracket=1;
+			else bBracket=0;
+
+			variAnswer[i]=0;
+			for(i++,i2=0,i3=0;;i++,i2++){
+				if(variable[i]==','){
+					temporary[i2]=0;
+
+					Type resultType;
+					if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){
+						return;
+					}
+					if(resultType.IsReal()){
+						memcpy(&dbl,&i64data,sizeof(double));
+						i64data=(_int64)dbl;
+					}
+
+					if(i64data<0){
+						//error
+						SubScripts[i3]=0;
+					}
+					else SubScripts[i3]=(int)i64data;
+					i3++;
+					i2=-1;
+					continue;
+				}
+				if(variable[i]=='('){
+					i4=GetStringInPare(temporary+i2,variable+i);
+					i2+=i4-1;
+					i+=i4-1;
+					continue;
+				}
+				if(variable[i]=='['){
+					i4=GetStringInBracket(temporary+i2,variable+i);
+					i2+=i4-1;
+					i+=i4-1;
+					continue;
+				}
+				if(variable[i]==')'&&bBracket==0||
+					variable[i]==']'&&bBracket){
+					temporary[i2]=0;
+					if(i2==0){
+						SubScripts[i3]=-2;
+						break;
+					}
+
+					Type resultType;
+					if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){
+						return;
+					}
+					if(resultType.IsReal()){
+						memcpy(&dbl,&i64data,sizeof(double));
+						i64data=(_int64)dbl;
+					}
+
+					if(i64data<0){
+						//error
+						SubScripts[i3]=0;
+					}
+					else SubScripts[i3]=(int)i64data;
+					SubScripts[i3+1]=-1;
+					break;
+				}
+				if(variable[i]=='\"'){
+					SetError(1,NULL,cp);
+					return;
+				}
+				temporary[i2]=variable[i];
+			}
+			break;
+		}
+		variAnswer[i]=variable[i];
+		if(variable[i]=='\0'){
+			SubScripts[0]=-1;
+			break;
+		}
+	}
+}
+
 
 BOOL GetVarFormatString(char *buffer,char *array,char *array2,char *NestMember,CClass::RefType &refType){
@@ -427,120 +465,4 @@
 	return i2;
 }
-void GetArrange(char *variable,char *variAnswer,int *SubScripts){
-	extern int cp;
-	int i,i2,i3,i4;
-	double dbl;
-	_int64 i64data;
-	BOOL bBracket;
-	char temporary[VN_SIZE];
-
-	for(i=0;;i++){
-		if(variable[i]=='('||variable[i]=='['){
-			if(variable[i]=='[') bBracket=1;
-			else bBracket=0;
-
-			variAnswer[i]=0;
-			for(i++,i2=0,i3=0;;i++,i2++){
-				if(variable[i]==','){
-					temporary[i2]=0;
-
-					Type resultType;
-					if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){
-						return;
-					}
-					if(resultType.IsReal()){
-						memcpy(&dbl,&i64data,sizeof(double));
-						i64data=(_int64)dbl;
-					}
-
-					if(i64data<0){
-						//error
-						SubScripts[i3]=0;
-					}
-					else SubScripts[i3]=(int)i64data;
-					i3++;
-					i2=-1;
-					continue;
-				}
-				if(variable[i]=='('){
-					i4=GetStringInPare(temporary+i2,variable+i);
-					i2+=i4-1;
-					i+=i4-1;
-					continue;
-				}
-				if(variable[i]=='['){
-					i4=GetStringInBracket(temporary+i2,variable+i);
-					i2+=i4-1;
-					i+=i4-1;
-					continue;
-				}
-				if(variable[i]==')'&&bBracket==0||
-					variable[i]==']'&&bBracket){
-					temporary[i2]=0;
-					if(i2==0){
-						SubScripts[i3]=-2;
-						break;
-					}
-
-					Type resultType;
-					if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){
-						return;
-					}
-					if(resultType.IsReal()){
-						memcpy(&dbl,&i64data,sizeof(double));
-						i64data=(_int64)dbl;
-					}
-
-					if(i64data<0){
-						//error
-						SubScripts[i3]=0;
-					}
-					else SubScripts[i3]=(int)i64data;
-					SubScripts[i3+1]=-1;
-					break;
-				}
-				if(variable[i]=='\"'){
-					SetError(1,NULL,cp);
-					return;
-				}
-				temporary[i2]=variable[i];
-			}
-			break;
-		}
-		variAnswer[i]=variable[i];
-		if(variable[i]=='\0'){
-			SubScripts[0]=-1;
-			break;
-		}
-	}
-}
-
-int GetTypeFromSimpleName(char *variable){
-	extern char DefIntVari[26],DefSngVari[26],DefStrVari[26],divNum,dsvNum,dStrvNum;
-	int i;
-	char name[VN_SIZE];
-
-	//構造体メンバの場合を考慮
-	for(i=lstrlen(variable);i>0;i--){
-		if(variable[i]=='.'){
-			i++;
-			break;
-		}
-	}
-
-	for(;;i++){
-		if(variable[i]=='('||variable[i]=='\0'){
-			name[i]=0;
-			break;
-		}
-		name[i]=variable[i];
-	}
-	//変数名から選択
-	i--;
-	if(name[i]=='#') return DEF_DOUBLE;
-	if(name[i]=='!') return DEF_SINGLE;
-	if(name[i]=='%') return DEF_INTEGER;
-	return DEF_DOUBLE;
-}
 
 
@@ -571,5 +493,5 @@
 
 	//アクセシビリティをチェック
-	if( &objClass == pobj_CompilingClass ){
+	if( &objClass == Smoothie::Temp::pCompilingClass ){
 		//同一クラスオブジェクトの場合はプライベートアクセスを容認する
 		if( pMember->IsNoneAccess() ){
@@ -645,5 +567,5 @@
 	// 名前空間を分離
 	char namespaceStr[VN_SIZE]="", simpleName[VN_SIZE];
-	Smoothie::meta.namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName );
+	Smoothie::GetMeta().namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName );
 
 	// 先頭オブジェクトまたはクラス名と入れ子メンバに分割
@@ -675,5 +597,5 @@
 	}
 
-	if(pobj_CompilingClass){
+	if(Smoothie::Temp::pCompilingClass){
 		///////////////////////
 		// クラスメンバの参照
@@ -682,5 +604,5 @@
 		if(lstrcmpi(variable,"This")==0){
 			//Thisオブジェクト
-			resultType.SetType( DEF_OBJECT, pobj_CompilingClass );
+			resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass );
 			return true;
 		}
@@ -695,5 +617,5 @@
 
 			bool isFound = false;
-			BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){
+			BOOST_FOREACH( CMember *pMember, Smoothie::Temp::pCompilingClass->GetDynamicMembers() ){
 				if( pMember->GetName() == VarName ){
 					isFound = true;
@@ -704,5 +626,5 @@
 		}
 
-		return GetMemberType(*pobj_CompilingClass,variable,resultType,1,isErrorEnabled);
+		return GetMemberType(*Smoothie::Temp::pCompilingClass,variable,resultType,1,isErrorEnabled);
 	}
 
@@ -738,8 +660,8 @@
 		}
 
-		int typeDefIndex = Smoothie::meta.typeDefs.GetIndex( VarName );
+		int typeDefIndex = Smoothie::GetMeta().typeDefs.GetIndex( VarName );
 		if( typeDefIndex != -1 ){
 			// TypeDef後の型名だったとき
-			lstrcpy( VarName, Smoothie::meta.typeDefs[typeDefIndex].GetBaseName().c_str() );
+			lstrcpy( VarName, Smoothie::GetMeta().typeDefs[typeDefIndex].GetBaseName().c_str() );
 		}
 
@@ -755,8 +677,8 @@
 	}
 
-	if(pobj_CompilingClass){
+	if(Smoothie::Temp::pCompilingClass){
 		//自身のクラスから静的メンバを参照する場合
 		char temp2[VN_SIZE];
-		sprintf(temp2,"%s.%s",pobj_CompilingClass->GetName().c_str(),VarName);
+		sprintf(temp2,"%s.%s",Smoothie::Temp::pCompilingClass->GetName().c_str(),VarName);
 
 		pVar = globalVars.Find( Symbol( temp2 ) );
@@ -972,5 +894,5 @@
 		if( InitBuf[0] == '\0' ){
 			//As指定も、初期値指定もない場合
-			type.SetBasicType( GetTypeFromSimpleName(variable) );
+			type.SetBasicType( Type::GetBasicTypeFromSimpleName(variable) );
 
 			i2=lstrlen(variable)-1;
@@ -1015,6 +937,6 @@
 
 	//クラス名
-	if(pobj_CompilingClass){
-		lstrcat(FullName,pobj_CompilingClass->GetName().c_str());
+	if(Smoothie::Temp::pCompilingClass){
+		lstrcat(FullName,Smoothie::Temp::pCompilingClass->GetName().c_str());
 		lstrcat(FullName,"%");
 	}
@@ -1052,5 +974,5 @@
 	bool isConst = ( dwFlag & DIMFLAG_CONST ) ? true:false;
 
-	Variable *pVar = new Variable( Smoothie::Lexical::liveingNamespaceScopes, name, type, isConst );
+	Variable *pVar = new Variable( Smoothie::Temp::liveingNamespaceScopes, name, type, isConst );
 
 	if( SubScripts[0] != -1 ){
@@ -1063,6 +985,6 @@
 
 	//レキシカルスコープ
-	pVar->ScopeLevel=obj_LexScopes.GetNowLevel();
-	pVar->ScopeStartAddress=obj_LexScopes.GetStartAddress();
+	pVar->ScopeLevel=GetLexicalScopes().GetNowLevel();
+	pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress();
 	pVar->bLiving=TRUE;
 
