Changeset 49 in dev for BasicCompiler_Common
- Timestamp:
- Feb 10, 2007, 6:13:37 AM (18 years ago)
- Location:
- BasicCompiler_Common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/NumOpe_GetType.cpp
r41 r49 327 327 index_stack[sp]=-1; 328 328 329 if(values[i][0]=='\"'){ 329 char *term; 330 term = values[i]; 331 332 if(term[0]=='\"'){ 330 333 StrLiteral: 331 334 … … 349 352 bLiteralCalculation=0; 350 353 } 351 else if(( values[i][0]=='e'||values[i][0]=='E')&&352 ( values[i][1]=='x'||values[i][1]=='X')&&353 values[i][2]=='\"'){354 else if((term[0]=='e'||term[0]=='E')&& 355 (term[1]=='x'||term[1]=='X')&& 356 term[2]=='\"'){ 354 357 //拡張版リテラル文字列(エスケープシーケンス可能) 355 358 goto StrLiteral; 356 359 } 357 else if(IsVariableTopChar( values[i][0])||358 values[i][0]=='*'||359 ( values[i][0]=='.'&&IsVariableTopChar(values[i][1]))){360 else if(IsVariableTopChar(term[0])|| 361 term[0]=='*'|| 362 (term[0]=='.'&&IsVariableTopChar(term[1]))){ 360 363 ////////////////// 361 364 // 何らかの識別子 … … 365 368 ////////////////////////////////////// 366 369 367 i2=GetCallProcName( values[i],temporary);368 if( values[i][i2]=='('){369 i4=GetStringInPare_RemovePare(temp2, values[i]+i2+1);370 i2=GetCallProcName(term,temporary); 371 if(term[i2]=='('){ 372 i4=GetStringInPare_RemovePare(temp2,term+i2+1); 370 373 371 374 int idProc; … … 374 377 375 378 if(idProc){ 376 //閉じカッコ")"に続く文字がNULLでないときはエラーにする 377 if(values[i][i2+1+i4+1]!='\0') SetError(42,NULL,cp); 379 //閉じカッコ")"に続く文字がNULLでないとき 380 if(term[i2+1+i4+1]!='\0'){ 381 if( term[i2+1+i4+1] == '.' 382 || term[i2+1+i4+1] == 1 && term[i2+1+i4+2] == ESC_PSMEM ){ 383 goto NonProc; 384 } 385 else{ 386 SetError(42,NULL,cp); 387 } 388 } 378 389 379 390 … … 400 411 401 412 //閉じカッコ")"に続く文字がNULLでないときはエラーにする 402 if( values[i][i2+1+i4+1]!='\0') SetError(42,NULL,cp);413 if(term[i2+1+i4+1]!='\0') SetError(42,NULL,cp); 403 414 404 415 //マクロ関数の場合 … … 416 427 } 417 428 } 418 429 NonProc: 419 430 420 431 //インデクサ(getアクセサ) 421 432 char VarName[VN_SIZE],ArrayElements[VN_SIZE]; 422 GetArrayElement( values[i],VarName,ArrayElements);433 GetArrayElement(term,VarName,ArrayElements); 423 434 if(ArrayElements[0]){ 424 435 CClass *pobj_c; … … 440 451 441 452 442 i2=GetVarType( values[i],&index_stack[sp],0);453 i2=GetVarType(term,&index_stack[sp],0); 443 454 if(i2!=-1){ 444 455 ////////// … … 457 468 ////////////// 458 469 459 i3 = CDBConst::obj.GetType( values[i]);470 i3 = CDBConst::obj.GetType(term); 460 471 if(i3){ 461 472 type[sp]=i3; … … 488 499 489 500 LONG_PTR lp; 490 i3=GetTypeFixed( values[i],&lp);501 i3=GetTypeFixed(term,&lp); 491 502 if(i3!=-1){ 492 503 type[sp]=i3|FLAG_CAST; … … 503 514 504 515 //配列要素を排除 505 GetArrayElement( values[i],VarName,ArrayElements);516 GetArrayElement(term,VarName,ArrayElements); 506 517 507 518 if(GetSubHash(VarName,0)){ 508 519 TYPEINFO RetTypeInfo; 509 GetReturnTypeOfPropertyMethod( values[i],NULL,&RetTypeInfo);520 GetReturnTypeOfPropertyMethod(term,NULL,&RetTypeInfo); 510 521 511 522 //大きな型への暗黙の変換 … … 523 534 //該当する識別子が見当たらないときはエラー扱いにする 524 535 bError=1; 525 SetError(3, values[i],cp);536 SetError(3,term,cp); 526 537 type[sp]=DEF_DOUBLE; 527 538 } … … 531 542 base_type=0; 532 543 if(pBaseType) base_type=pBaseType->type; 533 type[sp]=GetLiteralValue( values[i],&i64data,base_type);544 type[sp]=GetLiteralValue(term,&i64data,base_type); 534 545 Literal: 535 546 if((long)i64data==0&&index_stack[sp]==-1) index_stack[sp]=LITERAL_NULL; -
BasicCompiler_Common/StrOperation.cpp
r41 r49 317 317 return i; 318 318 } 319 int JumpStringInPare(c har *buffer,int pos){319 int JumpStringInPare(const char *buffer,int pos){ 320 320 int PareNum; 321 321 for(PareNum=1;;pos++){ … … 335 335 return 0; 336 336 } 337 int JumpStringInBracket(c har *buffer,int pos){337 int JumpStringInBracket(const char *buffer,int pos){ 338 338 int PareNum; 339 339 for(PareNum=1;;pos++){ -
BasicCompiler_Common/Variable.cpp
r46 r49 297 297 TYPEINFO TypeInfo = { DEF_OBJECT, (LONG_PTR)pobj_StringClass }; 298 298 return TypeInfo; 299 } 300 301 bool FormatUseProcReturnObject( const char *term, char *procName, char *parameter, int &RefType, char *member ){ 302 int p1 = 0, p2 = 0; 303 304 for( int i=0; term[i]!='\0' ; i++ ){ 305 306 if( term[i] == '[' ){ 307 i = JumpStringInBracket( term, i + 1 ); 308 continue; 309 } 310 if( term[i] == '(' ){ 311 int temp_p = i; 312 i = JumpStringInPare( term, i + 1 ) + 1; 313 if( term[i] == '.' 314 || term[i] == 1 && term[i] == ESC_PSMEM ){ 315 p1 = temp_p; 316 p2 = i; 317 } 318 continue; 319 } 320 } 321 if( !p1 ) return false; 322 323 //メソッド名 324 memcpy( procName, term, p1 ); 325 procName[p1] = 0; 326 327 //パラメータ 328 memcpy( parameter, term + p1 + 1, p2 - p1 - 2 ); 329 parameter[ p2 - p1 - 2 ] = 0; 330 331 //参照タイプ 332 if( term[p2] == '.' ){ 333 RefType = DEF_OBJECT; 334 } 335 else{ 336 RefType = DEF_PTR_OBJECT; 337 p2++; 338 } 339 340 //メンバ 341 lstrcpy( member, term + p2 + 1 ); 342 343 return true; 299 344 } 300 345 … … 632 677 extern BOOL bCompilingGlobal; 633 678 int i; 679 LONG_PTR lpIndex; 634 680 char variable[VN_SIZE],member[VN_SIZE],VarName[VN_SIZE],array[VN_SIZE],lpPtrOffset[VN_SIZE]; 635 681 … … 640 686 else lstrcpy(variable,NameBuffer); 641 687 688 689 int RefType; 690 if( FormatUseProcReturnObject( variable, VarName, array, RefType, member ) ){ 691 // 戻り値オブジェクトのメンバを直接参照しているとき 692 //例: func().member 693 694 void *pInfo; 695 int idProc=GetProc(VarName,&pInfo); 696 697 if(idProc){ 698 699 int type=GetReturnTypeOfProc(idProc,pInfo,VarName,array,&lpIndex); 700 701 return GetMemberType((CClass *)lpIndex,member,plpIndex,1,bError); 702 } 703 } 704 705 706 642 707 lstrcpy(VarName,variable); 643 GetVarFormatString(VarName,array,lpPtrOffset,member,& i);708 GetVarFormatString(VarName,array,lpPtrOffset,member,&RefType); 644 709 645 710 int *pSubScripts; 646 711 int type; 647 LONG_PTR lpIndex;648 712 649 713 extern int MaxGlobalVarNum; -
BasicCompiler_Common/Variable.h
r46 r49 16 16 void GetOriginalTypeName(char *buffer); 17 17 BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name); 18 bool FormatUseProcReturnObject( const char *term, char *procName, char *parameter, int &RefType, char *member ); 18 19 BOOL GetVarFormatString(char *buffer,char *array,char *array2,char *NestMember,int *pRefType); 19 20 void GetArrayElement(char *buffer,char *variable,char *array_element); -
BasicCompiler_Common/calculation.cpp
r41 r49 519 519 i2=lstrlen(Parms); 520 520 521 StrLiteral:522 521 nums[pnum]=i2; 523 522 StrPtr[pnum]=(char *)HeapAlloc(hHeap,0,i2+1); -
BasicCompiler_Common/common.h
r46 r49 509 509 int GetStringInPare_RemovePare(char *buffer,char *ReadBuffer); 510 510 int GetStringInBracket(char *buffer,const char *ReadBuffer); 511 int JumpStringInPare(c har *buffer,int pos);512 int JumpStringInBracket(c har *buffer,int pos);511 int JumpStringInPare(const char *buffer,int pos); 512 int JumpStringInBracket(const char *buffer,int pos); 513 513 int GetCpFromLine(int LineNum); 514 514 BOOL GetLineNum(int pos,int *pLine,char *FileName);
Note:
See TracChangeset
for help on using the changeset viewer.