Changeset 700 in dev for trunk/ab5.0
- Timestamp:
- Jul 21, 2008, 1:04:12 AM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h
r637 r700 84 84 { 85 85 buffer = (char *)realloc( buffer, length + str.size() + 1 ); 86 lstrcpy( buffer + length, str.c_str() );86 strcpy( buffer + length, str.c_str() ); 87 87 length += (int)str.size(); 88 88 } … … 90 90 { 91 91 buffer = (char *)realloc( buffer, length + str.size() + 1 ); 92 lstrcpy( buffer + length, &str[0] );92 strcpy( buffer + length, &str[0] ); 93 93 length += (int)str.size(); 94 94 } … … 97 97 98 98 static void Text::SlideString(char *buffer, int slide){ 99 char *temp; 100 temp=(char *)malloc(lstrlen(buffer)+1); 101 lstrcpy(temp,buffer); 102 lstrcpy(buffer+slide,temp); 103 free(temp); 99 memmove(buffer+slide, buffer, strlen(buffer)+1); 104 100 } 105 101 }; … … 213 209 void _ResetLength() 214 210 { 215 length = lstrlen( buffer );211 length = strlen( buffer ); 216 212 } 217 213 … … 231 227 void operator = ( const BasicSource &source ){ 232 228 Realloc( source.length ); 233 lstrcpy( buffer, source.buffer );229 strcpy( buffer, source.buffer ); 234 230 } 235 231 -
trunk/ab5.0/abdev/ab_common/src/Lexical/Const.cpp
r640 r700 123 123 124 124 //データ 125 lstrcpy(temporary,parameterStr+i+1);125 strcpy(temporary,parameterStr+i+1); 126 126 127 127 this->Put( new ConstMacro( symbol, parameters, temporary ) ); -
trunk/ab5.0/abdev/ab_common/src/Lexical/DataTable.cpp
r640 r700 31 31 int DataTable::AddString( const char *str ) 32 32 { 33 return AddBinary( str, lstrlen( str ) + sizeof(char) );33 return AddBinary( str, strlen( str ) + sizeof(char) ); 34 34 } 35 35 int DataTable::AddString( const std::string &str ) -
trunk/ab5.0/abdev/ab_common/src/Lexical/Namespace.cpp
r669 r700 67 67 } 68 68 69 lstrcpy( namespaceStr, namespaceScopes.ToString().c_str() );69 strcpy( namespaceStr, namespaceScopes.ToString().c_str() ); 70 70 71 71 bool hasNamespace = false; … … 79 79 } 80 80 81 lstrcpy( simpleName, fullName + lstrlen( namespaceStr ) + dotLength );81 strcpy( simpleName, fullName + strlen( namespaceStr ) + dotLength ); 82 82 } 83 83 -
trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp
r696 r700 1 1 #include "stdafx.h" 2 #include <hash_set> 2 3 3 4 const std::string BasicSource::generateDirectiveName = "#generate"; … … 10 11 void Init( bool isDebug, bool isDll, bool isUnicode, int majorVer ); 11 12 12 BOOL add(char *name);13 BOOL undef(char *name);14 BOOL check(char *name);13 BOOL add(char const *name); 14 BOOL undef(char const *name); 15 BOOL check(char const *name); 15 16 void preprocessor_ifdef(char *buffer,bool isNot); 16 17 void DirectiveIfdef(char *buffer); … … 22 23 // #requireの管理 23 24 ////////////////////////////////////// 25 namespace 26 { 24 27 class CRequireFiles{ 25 Jenga::Common::Stringsfilepaths;28 stdext::hash_set<std::string> filepaths; 26 29 public: 27 28 30 void clear(){ 29 31 filepaths.clear(); 30 32 } 31 bool IsIncluded( const std::string &includeFilePath ){32 // '/' → '\\'33 //既に存在するものを追加しようとするとfalseを返す(旧IsIncludedと逆なことに注意) 34 bool TryAdd( const std::string &includeFilePath ){ 33 35 char tempPath[MAX_PATH]; 34 lstrcpy( tempPath, includeFilePath.c_str() ); 35 for( int i=0; tempPath[i]; i++ ){ 36 if( tempPath[i] == '/' ){ 36 DWORD len = GetShortPathName(includeFilePath.c_str(), tempPath, MAX_PATH); 37 if (len >= MAX_PATH){ 38 return false; 39 } 40 for( DWORD i = 0; i < len; ++i ){ 41 char c = toupper(tempPath[i]); 42 if (c == '/'){ 37 43 tempPath[i] = '\\'; 38 44 } 39 } 40 41 BOOST_FOREACH( const std::string &filepath, filepaths ) 42 { 43 if( lstrcmpi( filepath.c_str(), tempPath ) == 0 ) 44 { 45 return true; 46 } 47 } 48 return false; 49 } 50 void Add( const std::string &includeFilePath ){ 51 // '/' → '\\' 52 char tempPath[MAX_PATH]; 53 lstrcpy( tempPath, includeFilePath.c_str() ); 54 for( int i=0; tempPath[i]; i++ ){ 55 if( tempPath[i] == '/' ){ 56 tempPath[i] = '\\'; 57 } 58 } 59 60 //既に読み込まれているとき 61 if( IsIncluded( tempPath ) ) return; 62 63 //追加 64 filepaths.push_back( tempPath ); 45 else{ 46 tempPath[i] = c; 47 } 48 } 49 return filepaths.insert( tempPath ).second; 65 50 } 66 51 }; 67 52 CRequireFiles requireFiles; 68 53 } //namespace 69 54 70 55 ////////////////////////////////////// … … 99 84 add(temporary); 100 85 } 101 BOOL CDefine::add(char *name)86 BOOL CDefine::add(char const *name) 102 87 { 103 88 //重複チェック … … 109 94 return 1; 110 95 } 111 BOOL CDefine::undef(char *name){96 BOOL CDefine::undef(char const *name){ 112 97 std::vector<std::string>::iterator i = names.begin(); 113 98 BOOST_FOREACH( const std::string &temp, names ){ … … 121 106 return 0; 122 107 } 123 BOOL CDefine::check(char *name){108 BOOL CDefine::check(char const *name){ 124 109 125 110 //重複チェック … … 132 117 } 133 118 134 int Search_endif(char *buffer,int i, int *pLine = 0){119 int Search_endif(char const *buffer,int i, int *pLine = 0){ 135 120 for(;;i++){ 136 121 if(buffer[i]=='\0') break; … … 143 128 144 129 if(buffer[i-1]=='\n'){ 145 if( memicmp(buffer+i,"#ifdef",6)==0||memicmp(buffer+i,"#ifndef",7)==0){130 if(_memicmp(buffer+i,"#ifdef",6)==0||_memicmp(buffer+i,"#ifndef",7)==0){ 146 131 i=Search_endif(buffer,i+6, pLine); 147 132 if(buffer[i]=='\0') break; 148 133 continue; 149 134 } 150 else if( memicmp(buffer+i,"#endif",6)==0){135 else if(_memicmp(buffer+i,"#endif",6)==0){ 151 136 break; 152 137 } … … 160 145 char temporary[VN_SIZE]; 161 146 162 if(isNot) i= lstrlen("#ifndef");163 else i= lstrlen("#ifdef");147 if(isNot) i=strlen("#ifndef"); 148 else i=strlen("#ifdef"); 164 149 while(buffer[i]==' '||buffer[i]=='\t') i++; 165 150 … … 445 430 void BasicSource::RemoveComments(){ 446 431 int i,i2,i3,IsStr; 447 char *temporary; 448 temporary=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(buffer)+1); 432 char *temporary=static_cast<char *>(malloc(strlen(buffer)+1)); 449 433 for(i=0,i2=0,i3=0,IsStr=0;;i++,i2++){ 450 434 if(buffer[i]=='\"') IsStr^=1; … … 487 471 if(buffer[i]=='\0') break; 488 472 } 489 lstrcpy(buffer,temporary);490 GlobalFree(temporary);473 strcpy(buffer,temporary); 474 free(temporary); 491 475 } 492 476 … … 538 522 std::string mainSourceFileDir = Jenga::Common::Path::ExtractDirPath( mainSourceFilePath ); 539 523 LayerDir[0]=(char *)malloc(mainSourceFileDir.size()+1); 540 lstrcpy(LayerDir[0],mainSourceFileDir.c_str());524 strcpy(LayerDir[0],mainSourceFileDir.c_str()); 541 525 542 526 for(i=0;;i++){ … … 584 568 if(sw1){ 585 569 sprintf(temp2,"%s\\%s", includeDirPath.c_str(), temporary ); 586 lstrcpy(findStr,temp2);570 strcpy(findStr,temp2); 587 571 } 588 572 else{ 589 573 Jenga::Common::Directory dir( LayerDir[layer] ); 590 lstrcpy( findStr, dir.GetFullPath( temporary ).c_str() );574 strcpy( findStr, dir.GetFullPath( temporary ).c_str() ); 591 575 } 592 576 } … … 611 595 // インクルードファイルを列挙(ワイルドカード指定を想定) 612 596 Jenga::Common::Strings resultOfFullPath; 613 Jenga::Common::FileSystem::SearchFiles( resultOfFullPath, findStr ); 597 // Jenga::Common::FileSystem::SearchFiles( resultOfFullPath, findStr ); 598 resultOfFullPath.push_back(findStr); 614 599 615 600 if( resultOfFullPath.empty() ) … … 644 629 645 630 //#requireの場合では、既に読み込まれているファイルは読み込まないようにする 631 /* 646 632 bool isFake = false; 647 633 if( isRequire ){ 648 if( requireFiles. IsIncluded( sourceFilePath ) ){634 if( requireFiles.TryAdd( sourceFilePath ) ){ 649 635 //既に読み込まれているとき 650 636 isFake = true; … … 668 654 } 669 655 } 670 671 Realloc( lstrlen(buffer) + source.GetLength() ); 656 */ 657 BasicSource source; 658 659 if( !requireFiles.TryAdd( sourceFilePath ) && isRequire ){ 660 //既に読み込まれているときは空データ 661 source.SetBuffer( "" ); 662 } 663 else{ 664 //インクルードファイルを読み込む 665 if( !source.ReadFile_InIncludeDirective( sourceFilePath ) ) 666 { 667 throw; 668 } 669 } 670 671 Realloc( strlen(buffer) + source.GetLength() ); 672 672 Text::SlideString( 673 673 buffer + headIndex + includeDirectiveLength, … … 683 683 char temp4[MAX_PATH]; 684 684 _splitpath(sourceFilePath.c_str(),temp2,temp4,0,0); 685 lstrcat(temp2,temp4);686 LayerDir[layer]=(char *)malloc( lstrlen(temp2)+1);687 lstrcpy(LayerDir[layer],temp2);685 strcat(temp2,temp4); 686 LayerDir[layer]=(char *)malloc(strlen(temp2)+1); 687 strcpy(LayerDir[layer],temp2); 688 688 689 689 //ファイル範囲をスライド … … 702 702 free(LayerDir[0]); 703 703 704 length = lstrlen(buffer);704 length = strlen(buffer); 705 705 } 706 706 … … 825 825 } 826 826 827 length = lstrlen(buffer);827 length = strlen(buffer); 828 828 } 829 829 … … 840 840 841 841 //最終行には文字を含ませないようにする 842 if( lstrlen(buffer)>0 && buffer[lstrlen(buffer)-1] != '\n' )842 if( strlen(buffer)>0 && buffer[strlen(buffer)-1] != '\n' ) 843 843 { 844 844 Realloc( length + 1 ); 845 lstrcat( buffer, "\n" );845 strcat( buffer, "\n" ); 846 846 } 847 847 … … 851 851 852 852 void BasicSource::SetBuffer( const char *buffer ){ 853 this->buffer = (char *)calloc( lstrlen(buffer) + 1, 1 );854 lstrcpy( this->buffer, buffer );855 length = lstrlen(buffer);853 this->buffer = (char *)calloc( strlen(buffer) + 1, 1 ); 854 strcpy( this->buffer, buffer ); 855 length = strlen(buffer); 856 856 857 857 // ダミー改行をセット … … 874 874 //const char *headCode = "#include <basic.sbp>\n"; 875 875 const char *headCode = ""; 876 Realloc( length + lstrlen(headCode) );877 Text::SlideString( buffer, lstrlen(headCode) );878 memcpy( buffer, headCode, lstrlen(headCode) );876 Realloc( length + strlen(headCode) ); 877 Text::SlideString( buffer, strlen(headCode) ); 878 memcpy( buffer, headCode, strlen(headCode) ); 879 879 880 880 // #defineと#requireを初期化 … … 891 891 //最終行には文字を含ませないようにする 892 892 Realloc( length + 1 ); 893 lstrcat( buffer, "\n" );893 strcat( buffer, "\n" ); 894 894 895 895 // #include / #require ディレクティブを処理 … … 912 912 913 913 void BasicSource::Addition( const char *buffer ){ 914 Realloc( length + lstrlen(buffer) );915 lstrcat( this->buffer, buffer );914 Realloc( length + strlen(buffer) ); 915 strcat( this->buffer, buffer ); 916 916 } 917 917 -
trunk/ab5.0/abdev/ab_common/stdafx.h
r519 r700 1 1 #pragma once 2 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 2 3 3 4 #include <map> … … 29 30 #include "include/ab_common.h" 30 31 32 size_t strlenSSE2(const char *); 33 #define strlen strlenSSE2 34 #define lstrlenA strlenSSE2 -
trunk/ab5.0/abdev/abdev/Common.h
r697 r700 949 949 void GetItemClassName(char *buffer,int Control); 950 950 void SaveWindowProgram(); 951 void SaveWindowFile( char *path, const ActiveBasic::PM::WindowInfos &windowInfos);951 void SaveWindowFile(char const *path, const ActiveBasic::PM::WindowInfos &windowInfos); 952 952 _int8 OpenWindowFile(char *path); 953 953 void GetDefaultWindowFont(LOGFONT *LogFont); -
trunk/ab5.0/abdev/abdev/FileOperation.cpp
r697 r700 16 16 return; 17 17 } 18 } 19 else{ 20 FindClose(hFind); 18 21 } 19 22 } … … 334 337 return NewTextEditWindow(OpenFileName,DocumentType,TabColor); 335 338 } 339 340 BOOL GetFileInformationByHandleWrap(HANDLE hFile, BY_HANDLE_FILE_INFORMATION& fi){ 341 typedef BOOL WINAPI GFIBH(HANDLE, LPBY_HANDLE_FILE_INFORMATION); 342 GFIBH *const pgfibh = reinterpret_cast<GFIBH*>( 343 GetProcAddress(GetModuleHandle("kernel32"), "GetFileInformationByHandle")); 344 if(pgfibh){ 345 return pgfibh(hFile, &fi); 346 } 347 else{ 348 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 349 return FALSE; 350 } 351 } 352 353 //重複チェック用のデータを設定 354 void SetFileIdentity(FILEIDENTITY &fi, BY_HANDLE_FILE_INFORMATION const &bhfi){ 355 fi.VolumeSerialNumber = bhfi.dwVolumeSerialNumber; 356 fi.FileIndexHigh = bhfi.nFileIndexHigh; 357 fi.FileIndexLow = bhfi.nFileIndexLow; 358 } 359 360 void SetFileIdentityFromFile(MDIINFO &mi, HANDLE hFile){ 361 BY_HANDLE_FILE_INFORMATION fi; 362 if(GetFileInformationByHandleWrap(hFile, fi)){ 363 SetFileIdentity(mi.FileIdentity, fi); 364 } 365 } 366 336 367 BOOL SaveDocument(HWND hChild,char *SaveFileName){ //ウィンドウからバッファを読み取り、ファイルに保存 368 //SaveFileNameがNULLのときは上書き保存を試みる。 337 369 extern LPSTR IconFileFilter; 338 370 extern HWND hClient,hDocCombo; … … 344 376 WndNum=GetWndNum(hChild); 345 377 346 char szOldTitle[MAX_PATH]; 347 lstrcpy(szOldTitle,MdiInfo[WndNum]->title.c_str()); 378 std::string oldTitle = MdiInfo[WndNum]->title; 348 379 349 380 if(MdiInfo[WndNum]->DocType==WNDTYPE_RAD||MdiInfo[WndNum]->DocType==WNDTYPE_MENU){ … … 353 384 354 385 if(projectInfo.ModifyOfMaterial){ 355 sprintf(temporary,"%s%s.wnd",projectInfo.GetWorkDir().GetPath().c_str(),projectInfo.GetName().c_str()); 356 SaveWindowFile( temporary, projectInfo.windowInfos ); 386 std::string const& workDir = projectInfo.GetWorkDir().GetPath(); 387 std::string const& projName = projectInfo.GetName(); 388 std::string t; 389 t.reserve( workDir.size() + projName.size() + 4 ); 390 t += workDir; 391 t += projName; 392 t += ".wnd"; 393 SaveWindowFile( t.c_str(), projectInfo.windowInfos ); 357 394 358 395 //.wbpファイルを生成 … … 370 407 sprintf(str,STRING_FILE_OVERWRIDE,temporary); 371 408 if(MessageBox(hOwner,str,APPLICATION_NAME,MB_YESNO|MB_ICONINFORMATION)==IDNO){ 372 CloseHandle(fh);373 409 return 0; 374 410 } … … 377 413 378 414 //ドキュメント セレクト コンボボックスから消去 379 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,( long)MdiInfo[WndNum]->title.c_str());415 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LONG_PTR)MdiInfo[WndNum]->title.c_str()); 380 416 SendMessage(hDocCombo,CB_DELETESTRING,i2,0); 381 417 … … 387 423 lstrcat(str,str2); 388 424 MdiInfo[WndNum]->title = str; 389 SendMessage(hDocCombo,CB_ADDSTRING,0,( long)MdiInfo[WndNum]->title.c_str());390 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,( long)MdiInfo[WndNum]->title.c_str());425 SendMessage(hDocCombo,CB_ADDSTRING,0,(LONG_PTR)MdiInfo[WndNum]->title.c_str()); 426 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LONG_PTR)MdiInfo[WndNum]->title.c_str()); 391 427 SendMessage(hDocCombo,CB_SETCURSEL,i2,0); 392 428 … … 448 484 return 0; 449 485 } 450 WriteFile(fh,pBuf,lstrlen(pBuf),&dummy,NULL); 486 WriteFile(fh,pBuf,strlen(pBuf),&dummy,NULL); 487 SetFileIdentityFromFile(*MdiInfo[WndNum], fh); 451 488 CloseHandle(fh); 452 489 … … 473 510 CloseHandle(fh); 474 511 MdiInfo[WndNum]->path = temporary; 475 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,( long)MdiInfo[WndNum]->title.c_str());512 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LONG_PTR)MdiInfo[WndNum]->title.c_str()); 476 513 SendMessage(hDocCombo,CB_DELETESTRING,i2,0); 477 514 _splitpath(temporary,NULL,NULL,str,str2); 478 515 lstrcat(str,str2); 479 516 MdiInfo[WndNum]->title = str; 480 SendMessage(hDocCombo,CB_ADDSTRING,0,( long)MdiInfo[WndNum]->title.c_str());481 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,( long)MdiInfo[WndNum]->title.c_str());517 SendMessage(hDocCombo,CB_ADDSTRING,0,(LONG_PTR)MdiInfo[WndNum]->title.c_str()); 518 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LONG_PTR)MdiInfo[WndNum]->title.c_str()); 482 519 SendMessage(hDocCombo,CB_SETCURSEL,i2,0); 483 520 SetWindowText(hChild,MdiInfo[WndNum]->title.c_str()); … … 501 538 if(pobj_nv->bSaveTabToHead){ 502 539 COLORREF color; 503 color=pobj_MainTab->GetItemColor( szOldTitle);504 pobj_MainTab->DeleteItem( szOldTitle, false );540 color=pobj_MainTab->GetItemColor(oldTitle.c_str()); 541 pobj_MainTab->DeleteItem( oldTitle.c_str(), false ); 505 542 pobj_MainTab->InsertItem( MdiInfo[WndNum]->title.c_str(), false, color ); 506 543 } 507 544 else{ 508 pobj_MainTab->RenameItem( szOldTitle, MdiInfo[WndNum]->title.c_str() );545 pobj_MainTab->RenameItem( oldTitle.c_str(), MdiInfo[WndNum]->title.c_str() ); 509 546 } 510 547 -
trunk/ab5.0/abdev/abdev/IconEditor.cpp
r629 r700 446 446 ResetState_DocMenu(); 447 447 } 448 void SetFileIdentityFromFile(MDIINFO &mi, HANDLE hFile); 449 448 450 void SaveIconFile(char *filepath,HWND hwnd){ 449 451 int i,i2,WndNum; … … 526 528 } 527 529 WriteFile(hFile,buffer,i2,&dummy,NULL); 530 SetFileIdentityFromFile(*MdiInfo[WndNum], hFile); 528 531 CloseHandle(hFile); 529 532 } -
trunk/ab5.0/abdev/abdev/TabCtrl.cpp
r629 r700 234 234 } 235 235 236 COLORREF CMainTab::GetItemColor( char *ItemText ){236 COLORREF CMainTab::GetItemColor( char const *ItemText ){ 237 237 //インデックスを取得 238 238 int index = SearchItemIndex( ItemText ); 239 if( index == -1 ) return -1;239 if( index == -1 ) return static_cast<COLORREF>(-1); 240 240 241 241 TC_ITEM tcItem; -
trunk/ab5.0/abdev/abdev/TabCtrl.h
r626 r700 37 37 void NofityUnModifyDocument( const char *ItemText ); 38 38 39 COLORREF GetItemColor( char *ItemText );39 COLORREF GetItemColor( char const *ItemText ); 40 40 41 41 void SelChangeEvent(); -
trunk/ab5.0/abdev/abdev/WindowControl.cpp
r655 r700 1653 1653 return i2; 1654 1654 } 1655 void SaveWindowFile( char *path, const ActiveBasic::PM::WindowInfos &windowInfos )1655 void SaveWindowFile( char const *path, const ActiveBasic::PM::WindowInfos &windowInfos ) 1656 1656 { 1657 1657 extern HANDLE hHeap; -
trunk/ab5.0/abdev/abdev/abdev.cpp
r697 r700 739 739 { 740 740 DWORD shortFilepathLen = GetShortPathName(path, buf, bufSize); 741 CharUpper(buf); 741 742 std::replace(buf, buf + shortFilepathLen, '/', '\\'); 742 743 } 744 745 BOOL GetFileInformationByHandleWrap(HANDLE hFile, BY_HANDLE_FILE_INFORMATION& fi); 746 void SetFileIdentity(FILEIDENTITY &mi, BY_HANDLE_FILE_INFORMATION const &bhfi); 743 747 744 748 HWND NewTextEditWindow(const char *filepath,_int8 DocumentType,COLORREF TabColor) … … 761 765 DWORD length; 762 766 763 typedef BOOL WINAPI GFIBH(HANDLE, LPBY_HANDLE_FILE_INFORMATION);764 767 BY_HANDLE_FILE_INFORMATION fi; 765 GFIBH *const pgfibh = reinterpret_cast<GFIBH*>( 766 GetProcAddress(GetModuleHandle("kernel32"), "GetFileInformationByHandle")); 767 if(pgfibh && pgfibh(hFile, &fi)){ 768 fileIdentity.VolumeSerialNumber = fi.dwVolumeSerialNumber; 769 fileIdentity.FileIndexHigh = fi.nFileIndexHigh; 770 fileIdentity.FileIndexLow = fi.nFileIndexLow; 768 if(GetFileInformationByHandleWrap(hFile, fi)){ 769 SetFileIdentity(fileIdentity, fi); 771 770 length=fi.nFileSizeLow; 772 771 } … … 807 806 ////////////////////////////////////////////////////// 808 807 809 char *temp; 810 temp=(char *)HeapAlloc(hHeap,0,length+1); 808 char *temp=(char *)HeapAlloc(hHeap,0,length+1); 811 809 DWORD dw; 812 810 ReadFile(hFile,temp,length,&dw,NULL); -
trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp
r676 r700 353 353 bool _TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, bool &isNeedHeapFreeStructure, bool *pIsClassName, bool isProcedureCallOnly, bool &isVariable, RELATIVE_VAR &relativeVar, bool isWriteAccess ) 354 354 { 355 extern void GetWithName(std::string&); 356 355 357 char parameter[VN_SIZE]; 356 357 358 // Withを解決 358 char termFull[VN_SIZE];359 std::string termFull; 359 360 if(term[0]=='.'){ 360 361 GetWithName(termFull); 361 lstrcat(termFull,term);362 } 363 else lstrcpy(termFull,term);364 365 char termLeft[VN_SIZE];366 lstrcpy(termLeft,termFull);362 termFull.insert(termFull.end(),term,term+strlen(term)); 363 } 364 else termFull.assign(term,term+strlen(term)); 365 366 std::vector<char> termLeft(termFull.begin(), termFull.end()); 367 termLeft.push_back('\0'); 367 368 368 369 // パース 369 370 char member[VN_SIZE]; 370 371 ReferenceKind refType; 371 if( SplitMemberName( termFull , termLeft, member, refType ) ){372 if( SplitMemberName( termFull.c_str(), &termLeft[0], member, refType ) ){ 372 373 /////////////////////////////////////////////////////////////////// 373 374 // オブジェクトとメンバに分解できるとき … … 380 381 bool isClassName = false; 381 382 Type leftType; 382 if( GetTermType( termLeft, Type(), leftType, isLiteral, &isClassName ) ){383 if( GetTermType( &termLeft[0], Type(), leftType, isLiteral, &isClassName ) ){ 383 384 if( isClassName == false && compiler.GetObjectModule().meta.GetBlittableTypes().IsExist( leftType ) ){ 384 385 // 左側のオブジェクト部分がBlittable型のとき 385 386 /* 386 387 char temporary[VN_SIZE]; 387 388 lstrcpy( temporary, termLeft ); … … 389 390 compiler.GetObjectModule().meta.GetBlittableTypes().Find( leftType ).GetCreateStaticMethodFullName().c_str(), 390 391 temporary ); 391 } 392 } 393 394 if( !TermOpe( termLeft, baseType, leftType, isLiteral, isNeedHeapFreeStructure, &isClassName ) ){ 392 */ 393 std::vector<char> temporary; 394 const std::string& staticMethodFullName = compiler.GetObjectModule().meta.GetBlittableTypes().Find( leftType ).GetCreateStaticMethodFullName(); 395 temporary.reserve(VN_SIZE); 396 temporary.assign(staticMethodFullName.begin(), staticMethodFullName.end()); 397 temporary.push_back('('); 398 temporary.insert(temporary.end(), termLeft.begin(), termLeft.end()); 399 temporary.push_back(')'); 400 temporary.swap(termLeft); 401 } 402 } 403 404 if( !TermOpe( &termLeft[0], baseType, leftType, isLiteral, isNeedHeapFreeStructure, &isClassName ) ){ 395 405 goto globalArea; 396 406 } … … 410 420 } 411 421 412 return TermMemberOpe( leftType, isNeedHeapFreeStructure, baseType, resultType, termFull , termLeft, member, isVariable, relativeVar );422 return TermMemberOpe( leftType, isNeedHeapFreeStructure, baseType, resultType, termFull.c_str(), &termLeft[0], member, isVariable, relativeVar ); 413 423 } 414 424 globalArea: … … 420 430 421 431 if( pIsClassName ){ 422 if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( termFull ) ) ){432 if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( termFull.c_str() ) ) ){ 423 433 *pIsClassName = true; 424 434 return true; … … 434 444 435 445 436 if(lstrcmpi(termFull ,"This")==0 && isProcedureCallOnly == false ){446 if(lstrcmpi(termFull.c_str(),"This")==0 && isProcedureCallOnly == false ){ 437 447 if( !compiler.IsCompilingClass() ) 438 448 { … … 458 468 char temporary[8192]; 459 469 460 int i2=GetCallProcName(termFull ,procName);470 int i2=GetCallProcName(termFull.c_str(),procName); 461 471 if(termFull[i2]=='('){ 462 int i4=GetStringInPare_RemovePare(parameter,termFull +i2+1);472 int i4=GetStringInPare_RemovePare(parameter,termFull.c_str()+i2+1); 463 473 464 474 void *pInfo; … … 557 567 558 568 char VarName[VN_SIZE],ArrayElements[VN_SIZE]; 559 GetArrayElement(termFull ,VarName,ArrayElements);569 GetArrayElement(termFull.c_str(),VarName,ArrayElements); 560 570 if(ArrayElements[0]){ 561 571 Type classType; … … 579 589 false, //エラー表示なし 580 590 isWriteAccess, 581 termFull ,591 termFull.c_str(), 582 592 &relativeVar,resultType)){ 583 593 ////////// … … 599 609 600 610 //配列要素を排除 601 GetArrayElement(termFull ,VarName,ArrayElements);611 GetArrayElement(termFull.c_str(),VarName,ArrayElements); 602 612 603 613 if(GetSubHash(VarName,0)){ 604 614 605 615 { 606 CallPropertyMethod(termFull ,NULL,resultType);616 CallPropertyMethod(termFull.c_str(),NULL,resultType); 607 617 608 618 //大きな型への暗黙の変換 … … 636 646 if( isProcedureCallOnly ) 637 647 { 638 compiler.errorMessenger.Output(3, termFull , cp );648 compiler.errorMessenger.Output(3, termFull.c_str(), cp ); 639 649 } 640 650
Note:
See TracChangeset
for help on using the changeset viewer.