Changeset 739 in dev for trunk/ab5.0
- Timestamp:
- Sep 6, 2008, 11:32:10 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp
r677 r739 644 644 extern HWND hMainDlg; 645 645 //"デバッグ情報の取得に失敗" 646 M essageBox(hMainDlg,STRING_DEBUG_FAILED,"ActiveBasic error",MB_OK);646 MyAssertMsg( false, STRING_DEBUG_FAILED ); 647 647 return 0; 648 648 } -
trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h
r735 r739 211 211 void _ResetLength() 212 212 { 213 length = strlen( buffer ); 214 } 213 length = static_cast<int>(strlen( buffer )); 214 } 215 216 // 指定したインデックスが何行目かを取得 217 bool GetLineFromIndex( int index, int &result ) const; 215 218 216 219 const IncludedFilesRelation &GetIncludedFilesRelation() const -
trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp
r735 r739 353 353 354 354 void BasicSource::ChangeReturnLineChar(){ 355 int i ,i2;355 int i; 356 356 357 357 bool isMustChange = false; … … 801 801 } 802 802 803 // 指定したインデックスが何行目かを取得 804 bool BasicSource::GetLineFromIndex( int index, int &result ) const 805 { 806 result = 0; 807 for( int i=2; i<index; i++ ) 808 { 809 if( this->buffer[i] == '\n' ) 810 { 811 result ++; 812 } 813 if( this->buffer[i] == '\0' ) 814 { 815 return false; 816 } 817 } 818 return true; 819 } 820 803 821 void BasicSource::SetBuffer( const char *buffer ){ 804 822 this->buffer = (char *)calloc( strlen(buffer) + 1, 1 ); … … 869 887 bool BasicSource::GetLineInfo( int sourceCodePos, int &line, std::string &filePath ) const 870 888 { 889 const char *buffer = this->GetBuffer(); 890 if( this->GetLength() < sourceCodePos ) 891 { 892 char temp[256]; 893 strncpy( temp, buffer, 100 ); 894 strcat( temp, "..." ); 895 MyAssertMsg( false, ( (std::string)"下記ソースコードの" + Jenga::Common::ToString( sourceCodePos ) + "バイト目(存在しない箇所)を参照しようとした。\n\n" + temp ).c_str() ); 896 return false; 897 } 898 899 int i = sourceCodePos; 871 900 int i2,i3,i4,i5; 872 873 const char *buffer = GetBuffer();874 int i = sourceCodePos;875 876 901 if(buffer[i]=='\n') i--; 877 for(i3=0,i2=0;i3<i;i3++){ 878 if(buffer[i3]=='\n') i2++; 879 if(buffer[i3]=='\0') return 0; 880 } 902 bool result = this->GetLineFromIndex( i, i2 ); 903 MyAssert( result ); 881 904 882 905 if( includedFilesRelation.GetLineCounts() <= i2 ) 883 906 { 884 //Jenga::Throw("BasicSource::GetLineInfoメソッドで不正な行の情報を取得しようとした" );907 MyAssertMsg( false, "BasicSource::GetLineInfoメソッドで不正な行の情報を取得しようとした" ); 885 908 886 909 //ファイル・行番号を特定できなかった場合 … … 897 920 for(i3=0,i5=0;i5<i4;i3++){ 898 921 if(buffer[i3]=='\n') i5++; 899 if(buffer[i3]=='\0') return 0; 922 if(buffer[i3]=='\0') 923 { 924 MyAssert( false ); 925 return false; 926 } 900 927 } 901 928 for(i5=0;i4<i2;i3++){ … … 910 937 } 911 938 } 912 if(buffer[i3]=='\0') return 0; 939 if(buffer[i3]=='\0') 940 { 941 MyAssert( false ); 942 return false; 943 } 913 944 } 914 945 … … 919 950 filePath = includedFilesRelation.GetFilePath( i2 ); 920 951 921 return 1;952 return true; 922 953 } 923 954
Note:
See TracChangeset
for help on using the changeset viewer.