Changeset 89 in dev for BasicCompiler_Common/src
- Timestamp:
- Apr 4, 2007, 2:03:09 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/src/Source.cpp
r88 r89 4 4 #include <windows.h> 5 5 6 7 const string BasicSource::generateDirectiveName = "#generate"; 6 8 7 9 … … 409 411 410 412 void BasicSource::ChangeReturnLineChar(){ 413 int i,i2; 414 411 415 #ifdef _DEBUG 412 416 //改行コードの整合性チェック 413 for( i nt i=0; ; i++ ){417 for( i=0; ; i++ ){ 414 418 if( buffer[i] == '\0' ){ 415 419 break; … … 433 437 434 438 //改行コードのCRLFをLFに変換 435 int i,i2;436 439 for(i=0,i2=0;;i++,i2++){ 437 440 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i++; … … 551 554 if(i>LastFileByte[layer]){ 552 555 HeapDefaultFree(LayerDir[layer]); 556 LayerDir[layer]=0; 553 557 layer--; 554 558 } … … 842 846 } 843 847 844 bool BasicSource::Generate( const string &genName, const char *buffer ){ 845 return true; 848 bool BasicSource::Generate( const string &genName, const char *genBuffer ){ 849 const int genBufferLength = lstrlen( genBuffer ); 850 851 #ifdef _DEBUG 852 // 挿入ソースに改行コードが含まれていないかを検査する 853 for( int i=0; genBuffer[i] ; i++ ){ 854 if( genBuffer[i] == '\n' ){ 855 SetError(); 856 break; 857 } 858 } 859 #endif 860 861 bool isFound = false; 862 863 for( int i=0; ; i++ ){ 864 if( i == 0 || buffer[i] == '\n' ){ 865 if( buffer[i] == '\n' ){ 866 i++; 867 } 868 while( IsBlank( buffer[i] ) ){ 869 i++; 870 } 871 872 int startIndex = i; 873 874 if( memicmp( buffer + i, generateDirectiveName.c_str(), generateDirectiveName.size() ) == 0 ){ 875 i += (int)generateDirectiveName.size(); 876 while( IsBlank( buffer[i] ) ){ 877 i++; 878 } 879 880 char temporary[VN_SIZE]; 881 for( int i2=0; ; i++, i2++ ){ 882 if( buffer[i] == '\n' ){ 883 temporary[i2] = 0; 884 break; 885 } 886 temporary[i2] = buffer[i]; 887 } 888 if( genName == temporary ){ 889 // 一致 890 891 int endIndex = i; 892 893 int lengthOffset = genBufferLength - ( endIndex - startIndex ); 894 895 Realloc( length + lengthOffset ); 896 SlideString( buffer + endIndex, lengthOffset ); 897 memcpy( buffer + startIndex, genBuffer, genBufferLength ); 898 899 isFound = true; 900 901 break; 902 } 903 } 904 } 905 } 906 907 return isFound; 846 908 } 847 909
Note:
See TracChangeset
for help on using the changeset viewer.