Changeset 591 in dev
- Timestamp:
- May 10, 2008, 6:11:29 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/include/DataTable.h
r589 r591 94 94 int Add( double dbl ); 95 95 int Add( float flt ); 96 int AddString( const char *str, int length );97 96 int AddString( const char *str ); 98 97 int AddString( const std::string &str ); 98 int AddWString( const std::wstring &wstr ); 99 99 void Add( const DataTable &dataTable ) 100 100 { -
trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp
r589 r591 29 29 return retSize; 30 30 } 31 int DataTable::AddString( const char *str, int length ){32 int retSize = size;33 34 if( compiler.IsUnicode() ){35 //Shift-JIS → Unicode36 int size = MultiByteToWideChar(37 CP_ACP,38 0,39 str, length + 1,40 NULL, 0 ) * 2;41 42 LPWSTR pwstr = (LPWSTR)malloc( size );43 44 MultiByteToWideChar(45 CP_ACP,46 0,47 str, length + 1,48 pwstr, length + 1 );49 50 AddBinary( pwstr, size );51 52 free( pwstr );53 }54 else{55 AddBinary( str, length + 1 );56 }57 58 return retSize;59 }60 31 int DataTable::AddString( const char *str ) 61 32 { 62 return Add String( str, lstrlen( str) );33 return AddBinary( str, lstrlen( str ) + sizeof(char) ); 63 34 } 64 35 int DataTable::AddString( const std::string &str ) 65 36 { 66 return AddString( str.c_str(), static_cast<int>(str.length()) ); 37 return AddBinary( str.c_str(), static_cast<int>(str.size()) + sizeof(char) ); 38 } 39 int DataTable::AddWString( const std::wstring &wstr ) 40 { 41 return AddBinary( wstr.c_str(), static_cast<int>(wstr.size()) + sizeof(wchar_t) ); 67 42 } 68 43 int DataTable::AddSpace( int size ) -
trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTableGenerator.cpp
r589 r591 178 178 179 179 // 文字列バッファをデータ領域へ追加 180 dataTable.AddString( str ); 180 if( compiler.IsUnicode() ) 181 { 182 dataTable.AddWString( Jenga::Common::ToWString( str ) ); 183 } 184 else 185 { 186 dataTable.AddString( str ); 187 } 181 188 182 189 return dataTableOffset; … … 232 239 { 233 240 // Charポインタ 234 strOffset = dataTable.AddString( tempParamStr ); 241 if( compiler.IsUnicode() ) 242 { 243 strOffset = dataTable.AddWString( Jenga::Common::ToWString( tempParamStr ) ); 244 } 245 else 246 { 247 strOffset = dataTable.AddString( tempParamStr ); 248 } 235 249 } 236 250 -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp
r587 r591 201 201 lstrcpy( paramName, catchScope.GetParamType().GetClass().GetFullName().c_str() ); 202 202 } 203 paramNameDataTableOffset = compiler.GetObjectModule().dataTable.AddString( paramName ); 203 if( compiler.IsUnicode() ) 204 { 205 paramNameDataTableOffset = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( paramName ) ); 206 } 207 else 208 { 209 paramNameDataTableOffset = compiler.GetObjectModule().dataTable.AddString( paramName ); 210 } 204 211 *((LONG_PTR *)(buffer+pos)) = paramNameDataTableOffset; 205 212 pos += sizeof(LONG_PTR); -
trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp
r587 r591 876 876 char *temp; 877 877 temp=(char *)i64data; 878 i2=compiler.GetObjectModule().dataTable.AddString(temp,lstrlen(temp)); 878 if( compiler.IsUnicode() ) 879 { 880 i2 = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( temp ) ); 881 } 882 else 883 { 884 i2 = compiler.GetObjectModule().dataTable.AddString( temp ); 885 } 879 886 HeapDefaultFree(temp); 880 887 … … 1065 1072 char *temp; 1066 1073 temp=(char *)i64data; 1067 i2=compiler.GetObjectModule().dataTable.AddString(temp,lstrlen(temp)); 1074 if( compiler.IsUnicode() ) 1075 { 1076 i2 = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( temp ) ); 1077 } 1078 else 1079 { 1080 i2 = compiler.GetObjectModule().dataTable.AddString( temp ); 1081 } 1068 1082 HeapDefaultFree(temp); 1069 1083 -
trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp
r589 r591 957 957 bLiteralCalculation=0; 958 958 959 i2=compiler.GetObjectModule().dataTable.AddString(term,i3); 959 if( compiler.IsUnicode() ) 960 { 961 i2 = compiler.GetObjectModule().dataTable.AddWString( Jenga::Common::ToWString( std::string( term, i3 ) ) ); 962 } 963 else 964 { 965 i2 = compiler.GetObjectModule().dataTable.AddString( std::string( term, i3 ) ); 966 } 960 967 961 968 //push DataSize
Note:
See TracChangeset
for help on using the changeset viewer.