Changeset 206 in dev for trunk/abdev/BasicCompiler_Common/StrOperation.cpp
- Timestamp:
- Jul 12, 2007, 2:58:26 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/StrOperation.cpp
r182 r206 1 #include "stdafx.h" 2 1 3 #include <jenga/include/smoothie/LexicalAnalysis.h> 4 #include <jenga/include/smoothie/Source.h> 2 5 3 6 #include "../BasicCompiler_Common/common.h" … … 406 409 } 407 410 } 408 void GetCalcName(int idCalc,char *name){ 409 switch(idCalc){ 410 case CALC_XOR: 411 lstrcpy(name,"xor"); 412 break; 413 case CALC_OR: 414 lstrcpy(name,"or"); 415 break; 416 case CALC_AND: 417 lstrcpy(name,"and"); 418 break; 419 case CALC_NOT: 420 lstrcpy(name,"Not"); 421 break; 422 423 case CALC_PE: 424 lstrcpy(name,"<="); 425 break; 426 case CALC_QE: 427 lstrcpy(name,">="); 428 break; 429 case CALC_NOTEQUAL: 430 lstrcpy(name,"<>"); 431 break; 432 case CALC_SUBSITUATION: 433 case CALC_EQUAL: 434 lstrcpy(name,"="); 435 break; 436 case CALC_P: 437 lstrcpy(name,"<"); 438 break; 439 case CALC_Q: 440 lstrcpy(name,">"); 441 break; 442 443 case CALC_SHL: 444 lstrcpy(name,"<<"); 445 break; 446 case CALC_SHR: 447 lstrcpy(name,">>"); 448 break; 449 case CALC_ADDITION: 450 lstrcpy(name,"+"); 451 break; 452 case CALC_SUBTRACTION: 453 lstrcpy(name,"-"); 454 break; 455 case CALC_MOD: 456 lstrcpy(name,"mod"); 457 break; 458 case CALC_PRODUCT: 459 lstrcpy(name,"*"); 460 break; 461 case CALC_QUOTIENT: 462 lstrcpy(name,"/"); 463 break; 464 case CALC_INTQUOTIENT: 465 lstrcpy(name,"\\"); 466 break; 467 case CALC_AS: 468 lstrcpy(name,"As"); 469 break; 470 case CALC_BYVAL: 471 lstrcpy(name,"ByVal"); 472 break; 473 case CALC_MINUSMARK: 474 lstrcpy(name,"-"); 475 break; 476 case CALC_POWER: 477 lstrcpy(name,"^"); 478 break; 479 480 case CALC_ARRAY_GET: 481 lstrcpy(name,"[]"); 482 break; 483 case CALC_ARRAY_SET: 484 lstrcpy(name,"[]="); 485 break; 486 } 411 const std::string &FormatEscapeSequenceStringToDefaultString( const std::string &source ) 412 { 413 int maxLength = (int)source.size(); 414 415 char *temporary = (char *)malloc( source.size() + 8192 ); 416 lstrcpy( temporary, source.c_str() ); 417 418 for( int i=0; i<maxLength-1; i++ ) 419 { 420 if( temporary[i] == 1 ) 421 { 422 char temp2[255]; 423 GetDefaultNameFromES( temporary[i+1], temp2 ); 424 if( i>0 ) 425 { 426 char temp3[255]; 427 wsprintf( temp3, " %s", temp2 ); 428 lstrcpy( temp2, temp3 ); 429 } 430 if( i<maxLength-2 ) 431 { 432 lstrcat( temp2, " " ); 433 } 434 435 int length = lstrlen( temp2 ); 436 SlideString( temporary + i+2, length-2 ); 437 memcpy( temporary + i, temp2, length ); 438 maxLength = lstrlen( temporary ); 439 } 440 } 441 442 static std::string resultStr = ""; 443 resultStr = temporary; 444 445 free( temporary ); 446 447 return resultStr; 487 448 } 488 449
Note:
See TracChangeset
for help on using the changeset viewer.