Changeset 735 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/Intermediate_Step1.cpp
- Timestamp:
- Aug 25, 2008, 5:26:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/Intermediate_Step1.cpp
r465 r735 7 7 void ChangeReturnCode(char *buffer) 8 8 { 9 int i;10 11 9 bool isMustChange = false; 12 for( i =0; ; i++ ){10 for( int i=0; ; i++ ){ 13 11 if( buffer[i] == '\0' ){ 14 12 break; … … 53 51 #endif 54 52 55 //改行コードのCRLFをLFに変換 56 for(int i=0,i2=0;;i++,i2++){ 57 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i++; 58 buffer[i2]=buffer[i]; 59 if(buffer[i]=='\0') break; 60 } 53 ChangeReturnCodeImpl(buffer); 61 54 } 62 55 void DeleteComment(char *buffer){ //注釈「'」の取り除き 63 56 int i,i2,i3,IsStr; 64 char *temporary; 65 temporary=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(buffer)+1); 57 char *temporary=(char *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,lstrlen(buffer)+1); 66 58 for(i=0,i2=0,i3=0,IsStr=0;;i++,i2++){ 67 59 if(buffer[i]=='\"') IsStr^=1; 68 60 if(buffer[i]=='\n'||buffer[i]=='\0'){ 69 i2--; 70 while(temporary[i2]==' '||temporary[i2]=='\t') i2--; 71 i2++; 61 if(i2 > 0){ 62 i2--; 63 while(temporary[i2]==' '||temporary[i2]=='\t') i2--; 64 i2++; 65 } 72 66 73 67 if(i3){ … … 105 99 } 106 100 lstrcpy(buffer,temporary); 107 GlobalFree(temporary);101 HeapDefaultFree(temporary); 108 102 } 109 103 void CheckParenthesis(char *buffer){ … … 237 231 return 1; 238 232 } 233 234 inline int FindLineEnd(char const *basbuf, int i2){ 235 for(;;i2++){ 236 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 237 } 238 return i2; 239 } 240 239 241 void DirectiveCheck(void){ 240 242 extern char *basbuf; … … 273 275 compiler.staticLibraryFilePaths.push_back( temporary ); 274 276 275 for(;;i2++){ 276 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 277 } 277 i2 = FindLineEnd(basbuf, i2); 278 278 SlideString(basbuf+i2,i-i2); 279 279 } … … 284 284 compiler.SetCoreMark( true ); 285 285 286 for(;;i2++){ 287 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 288 } 286 i2 = FindLineEnd(basbuf, i2); 289 287 SlideString(basbuf+i2,i-i2); 290 288 } … … 292 290 //#noprompt 293 291 //旧機能なので、無視 294 for(;;i2++){ 295 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 296 } 292 i2 = FindLineEnd(basbuf, i2); 297 293 SlideString(basbuf+i2,i-i2); 298 294 } … … 300 296 //#strict 301 297 //旧機能なので、無視 302 for(;;i2++){ 303 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 304 } 298 i2 = FindLineEnd(basbuf, i2); 305 299 SlideString(basbuf+i2,i-i2); 306 300 } … … 308 302 //#struct code 309 303 //旧機能なので、無視 310 for(;;i2++){ 311 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 312 } 304 i2 = FindLineEnd(basbuf, i2); 313 305 SlideString(basbuf+i2,i-i2); 314 306 } … … 332 324 lstrcpy(ResourceFileName,temporary); 333 325 334 for(;;i2++){ 335 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 336 } 326 i2 = FindLineEnd(basbuf, i2); 337 327 SlideString(basbuf+i2,i-i2); 338 328 }
Note:
See TracChangeset
for help on using the changeset viewer.