Index: BasicCompiler_Common/Const.cpp
===================================================================
--- BasicCompiler_Common/Const.cpp	(revision 75)
+++ BasicCompiler_Common/Const.cpp	(revision 103)
@@ -7,34 +7,36 @@
 
 
-CConstBase::CConstBase(char *Name){
-	this->Name = (char *)malloc(lstrlen(Name)+1);
-	lstrcpy(this->Name, Name);
-}
-CConstBase::~CConstBase(){
-	free(Name);
-	Name=0;
-}
-
-char *CConstBase::GetName(){
-	return Name;
-}
-
-
-
-CConst::CConst(char *Name, int Type, _int64 i64data):CConstBase(Name)
-{
-	this->Type = Type;
-	this->i64data = i64data;
-
-	//連結リストを初期化
-	pNext = 0;
-}
-CConst::CConst(char *Name, int value):CConstBase(Name)
-{
-	Type = DEF_LONG;
-	i64data = value;
-
-	//連結リストを初期化
-	pNext = 0;
+bool ConstBase::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
+{
+	if( GetName() != name ){
+		return false;
+	}
+	return NamespaceScopes::IsSameArea( this->namespaceScopes, namespaceScopes );
+}
+bool ConstBase::IsEqualSymbol( const string &fullName ) const
+{
+	char AreaName[VN_SIZE] = "";		//オブジェクト変数
+	char NestName[VN_SIZE] = "";		//入れ子メンバ
+	bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
+
+	return IsEqualSymbol( NamespaceScopes( AreaName ), NestName );
+}
+
+
+
+
+CConst::CConst( const NamespaceScopes &namespaceScopes, const string &name, const Type &type, _int64 i64data)
+	: ConstBase( namespaceScopes, name )
+	, type( type )
+	, i64data( i64data )
+	, pNext( NULL )
+{
+}
+CConst::CConst( const NamespaceScopes &namespaceScopes, const string &name, int value)
+	: ConstBase( namespaceScopes, name )
+	, type( Type(DEF_LONG) )
+	, i64data( value )
+	, pNext( NULL )
+{
 }
 CConst::~CConst(){
@@ -46,6 +48,6 @@
 }
 
-int CConst::GetType(){
-	return Type;
+Type CConst::GetType(){
+	return type;
 }
 _int64 CConst::GetWholeData(){
@@ -60,5 +62,6 @@
 
 
-CConstMacro::CConstMacro(char *Name, char *Expression):CConstBase(Name)
+CConstMacro::CConstMacro( const NamespaceScopes &namespaceScopes, const string &name, char *Expression)
+	: ConstBase( namespaceScopes, name )
 {
 }
@@ -99,5 +102,5 @@
 
 void AddConstData(char *Command);
-void CDBConst::Add(char *buffer){
+void CDBConst::Add( const NamespaceScopes &namespaceScopes, char *buffer ){
 	int i;
 
@@ -117,5 +120,5 @@
 
 	//重複チェック
-	if(GetType(Name)){
+	if(GetBasicType(Name)){
 		SetError(15,Name,cp);
 		return;
@@ -132,10 +135,10 @@
 		char *Expression = buffer + i + 1;
 
-		AddConst(Name,Expression);
-	}
-}
-
-void CDBConst::AddConst(char *Name, CConst *newconst){
-	int key = hash_default(Name);
+		AddConst( namespaceScopes, Name,Expression);
+	}
+}
+
+void CDBConst::AddConst( const string &name, CConst *newconst){
+	int key = hash_default(name.c_str());
 
 	//ハッシュリストに追加
@@ -152,5 +155,5 @@
 	}
 }
-void CDBConst::AddConst(char *Name, char *Expression){
+void CDBConst::AddConst( const NamespaceScopes &namespaceScopes, const string &name , char *Expression){
 	_int64 i64data;
 	Type resultType;
@@ -164,18 +167,22 @@
 	//登録を行う
 
-	CConst *newconst = new CConst(Name, resultType.GetBasicType(), i64data);
-
-	AddConst(Name, newconst);
-}
-void CDBConst::AddConst(char *Name, int value){
-	CConst *newconst = new CConst(Name, value);
-
-	AddConst(Name, newconst);
-}
-
-CConst *CDBConst::GetObjectPtr(char *Name){
+	CConst *newconst = new CConst(namespaceScopes, name, resultType, i64data);
+
+	AddConst( name, newconst);
+}
+void CDBConst::AddConst(const NamespaceScopes &namespaceScopes, const string &name, int value){
+	CConst *newconst = new CConst( namespaceScopes, name, value);
+
+	AddConst(name, newconst);
+}
+
+CConst *CDBConst::GetObjectPtr( const string &name ){
+	char ObjName[VN_SIZE];		//オブジェクト変数
+	char NestMember[VN_SIZE];	//入れ子メンバ
+	bool isObjectMember = SplitMemberName( name.c_str(), ObjName, NestMember );
+
 	//ハッシュ値を取得
 	int key;
-	key=hash_default(Name);
+	key=hash_default( NestMember );
 
 	//格納位置を取得
@@ -183,5 +190,5 @@
 	pConst=ppHash[key];
 	while(pConst){
-		if(lstrcmp(pConst->GetName(),Name)==0) break;
+		if( pConst->IsEqualSymbol( name ) ) break;
 
 		pConst=pConst->pNext;
@@ -192,10 +199,10 @@
 
 
-int CDBConst::GetType(char *Name){
+int CDBConst::GetBasicType(char *Name){
 	CConst *pConst = GetObjectPtr(Name);
 
 	if(!pConst) return 0;
 
-	return pConst->GetType();
+	return pConst->GetType().GetBasicType();
 }
 _int64 CDBConst::GetWholeData(char *Name){
@@ -213,2 +220,11 @@
 	return pConst->GetDoubleData();
 }
+bool CDBConst::IsStringPtr( char *Name ){
+	CConst *pConst = GetObjectPtr(Name);
+
+	if(!pConst) return false;
+
+	const Type &type = pConst->GetType();
+
+	return ( type.GetBasicType() == typeOfPtrChar && type.GetIndex() == LITERAL_STRING );
+}
