Index: trunk/ab5.0/abdev/BasicCompiler_Common/include/DataTable.h
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/include/DataTable.h	(revision 589)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/include/DataTable.h	(revision 591)
@@ -94,7 +94,7 @@
 	int Add( double dbl );
 	int Add( float flt );
-	int AddString( const char *str, int length );
 	int AddString( const char *str );
 	int AddString( const std::string &str );
+	int AddWString( const std::wstring &wstr );
 	void Add( const DataTable &dataTable )
 	{
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp	(revision 589)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp	(revision 591)
@@ -29,40 +29,15 @@
 	return retSize;
 }
-int DataTable::AddString( const char *str, int length ){
-	int retSize = size;
-
-	if( compiler.IsUnicode() ){
-		//Shift-JIS → Unicode
-		int size = MultiByteToWideChar(
-			CP_ACP,
-			0,
-			str, length + 1,
-			NULL, 0 ) * 2;
-
-		LPWSTR pwstr = (LPWSTR)malloc( size );
-
-		MultiByteToWideChar(
-			CP_ACP,
-			0,
-			str, length + 1,
-			pwstr, length + 1 );
-
-		AddBinary( pwstr, size );
-
-		free( pwstr );
-	}
-	else{
-		AddBinary( str, length + 1 );
-	}
-
-	return retSize;
-}
 int DataTable::AddString( const char *str )
 {
-	return AddString( str, lstrlen( str ) );
+	return AddBinary( str, lstrlen( str ) + sizeof(char) );
 }
 int DataTable::AddString( const std::string &str )
 {
-	return AddString( str.c_str(), static_cast<int>(str.length()) );
+	return AddBinary( str.c_str(), static_cast<int>(str.size()) + sizeof(char) );
+}
+int DataTable::AddWString( const std::wstring &wstr )
+{
+	return AddBinary( wstr.c_str(), static_cast<int>(wstr.size()) + sizeof(wchar_t) );
 }
 int DataTable::AddSpace( int size )
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTableGenerator.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTableGenerator.cpp	(revision 589)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTableGenerator.cpp	(revision 591)
@@ -178,5 +178,12 @@
 
 	// 文字列バッファをデータ領域へ追加
-	dataTable.AddString( str );
+	if( compiler.IsUnicode() )
+	{
+		dataTable.AddWString( Jenga::Common::ToWString( str ) );
+	}
+	else
+	{
+		dataTable.AddString( str );
+	}
 
 	return dataTableOffset;
@@ -232,5 +239,12 @@
 			{
 				// Charポインタ
-				strOffset = dataTable.AddString( tempParamStr );
+				if( compiler.IsUnicode() )
+				{
+					strOffset = dataTable.AddWString( Jenga::Common::ToWString( tempParamStr ) );
+				}
+				else
+				{
+					strOffset = dataTable.AddString( tempParamStr );
+				}
 			}
 
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp	(revision 589)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp	(revision 591)
@@ -201,5 +201,12 @@
 				lstrcpy( paramName, catchScope.GetParamType().GetClass().GetFullName().c_str() );
 			}
-			paramNameDataTableOffset = compiler.GetObjectModule().dataTable.AddString( paramName );
+			if( compiler.IsUnicode() )
+			{
+				paramNameDataTableOffset = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( paramName ) );
+			}
+			else
+			{
+				paramNameDataTableOffset = compiler.GetObjectModule().dataTable.AddString( paramName );
+			}
 			*((LONG_PTR *)(buffer+pos)) = paramNameDataTableOffset;
 			pos += sizeof(LONG_PTR);
Index: trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 589)
+++ trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 591)
@@ -876,5 +876,12 @@
 			char *temp;
 			temp=(char *)i64data;
-			i2=compiler.GetObjectModule().dataTable.AddString(temp,lstrlen(temp));
+			if( compiler.IsUnicode() )
+			{
+				i2 = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( temp ) );
+			}
+			else
+			{
+				i2 = compiler.GetObjectModule().dataTable.AddString( temp );
+			}
 			HeapDefaultFree(temp);
 
@@ -1065,5 +1072,12 @@
 			char *temp;
 			temp=(char *)i64data;
-			i2=compiler.GetObjectModule().dataTable.AddString(temp,lstrlen(temp));
+			if( compiler.IsUnicode() )
+			{
+				i2 = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( temp ) );
+			}
+			else
+			{
+				i2 = compiler.GetObjectModule().dataTable.AddString( temp );
+			}
 			HeapDefaultFree(temp);
 
Index: trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp	(revision 589)
+++ trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp	(revision 591)
@@ -957,5 +957,12 @@
 					bLiteralCalculation=0;
 
-					i2=compiler.GetObjectModule().dataTable.AddString(term,i3);
+					if( compiler.IsUnicode() )
+					{
+						i2 = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( std::string( term, i3 ) ) );
+					}
+					else
+					{
+						i2 = compiler.GetObjectModule().dataTable.AddString( std::string( term, i3 ) );
+					}
 
 					//push DataSize
