Changeset 591 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/src
- Timestamp:
- May 10, 2008, 6:11:29 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev/BasicCompiler_Common/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.