Changeset 254 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Jul 31, 2007, 4:30:31 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Statement.cpp
r253 r254 792 792 793 793 void OpcodeExitSub(void){ 794 extern HANDLE hHeap;795 796 794 if( UserProc::IsGlobalAreaCompiling() ){ 797 795 SetError(12,"Exit Sub/Function",cp); -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r253 r254 532 532 const Type &baseType, 533 533 Type &resultType, 534 BOOL *pbUseHeap ) {535 534 BOOL *pbUseHeap ) 535 { 536 536 int i,i2,i3; 537 537 char temporary[1024],temp2[1024]; … … 540 540 SetError(1,NULL,cp); 541 541 return false; 542 }543 544 if(expression[0]==1&& expression[1]==ESC_NEW ){545 //New演算子(オブジェクト生成)546 547 if( !Operator_New( expression+2, baseType, resultType ) ){548 return false;549 }550 551 return true;552 542 } 553 543 … … 603 593 //push eax 604 594 compiler.codeGenerator.op_push( REG_EAX ); 595 596 return true; 597 } 598 599 bool isLiteralCalculation; 600 if( !NumOpe_GetType( expression, baseType, resultType, &isLiteralCalculation ) ) 601 { 602 return false; 603 } 604 if( isLiteralCalculation ) 605 { 606 //右辺値が数値の定数式の場合 607 _int64 i64data; 608 StaticCalculation(true, expression,baseType.GetBasicType(),&i64data,resultType); 609 610 if( resultType.GetBasicSize() == sizeof(_int64) ){ 611 //64ビット(符号有り整数/実数) 612 613 //push HILONG(i64data) 614 compiler.codeGenerator.op_push_V((long)*(long *)(((char *)(&i64data))+4)); 615 616 //push LOLONG(i64data) 617 compiler.codeGenerator.op_push_V(*(long *)(&i64data)); 618 } 619 else if( resultType.IsSingle() ){ 620 //single実数 621 622 double dbl; 623 memcpy(&dbl,&i64data,sizeof(_int64)); 624 625 float flt; 626 flt=(float)dbl; 627 long l; 628 memcpy(&l,&flt,sizeof(long)); 629 630 //push flt 631 compiler.codeGenerator.op_push_V(l); 632 } 633 else{ 634 //整数(符号有り/無し) 635 636 long l = (long)i64data; 637 638 if(resultType.GetBasicSize()==sizeof(char)) l = l & 0x000000FF; 639 if(resultType.GetBasicSize()==sizeof(short)) l = l & 0x0000FFFF; 640 641 //push term 642 compiler.codeGenerator.op_push_V(l); 643 } 644 return true; 645 } 646 647 if(expression[0]==1&& expression[1]==ESC_NEW ){ 648 //New演算子(オブジェクト生成) 649 650 if( !Operator_New( expression+2, baseType, resultType ) ){ 651 return false; 652 } 605 653 606 654 return true; … … 1056 1104 if(bLiteralCalculation){ 1057 1105 //右辺値が数値の定数式の場合 1058 Type resultType; 1059 StaticCalculation(true, expression,baseType.GetBasicType(),&i64data,resultType); 1060 1061 obp=BeforeObp; 1062 pobj_SubAddrSchedule->num=Before_ProcAddrScheduleNum; 1063 pobj_DataTableSchedule->num=Before_DataTableScheduleNum; 1064 pobj_Reloc->copy(pobj_BackReloc); 1065 1066 if( resultType.GetBasicSize() == sizeof(_int64) ){ 1067 //64ビット(符号有り整数/実数) 1068 1069 //push HILONG(i64data) 1070 compiler.codeGenerator.op_push_V((long)*(long *)(((char *)(&i64data))+4)); 1071 1072 //push LOLONG(i64data) 1073 compiler.codeGenerator.op_push_V(*(long *)(&i64data)); 1074 } 1075 else if( resultType.IsSingle() ){ 1076 //single実数 1077 1078 memcpy(&dbl,&i64data,sizeof(_int64)); 1079 1080 float flt; 1081 flt=(float)dbl; 1082 memcpy(&i3,&flt,sizeof(long)); 1083 1084 //push flt 1085 compiler.codeGenerator.op_push_V(i3); 1086 } 1087 else{ 1088 //整数(符号有り/無し) 1089 1090 i3=(long)i64data; 1091 1092 if(resultType.GetBasicSize()==sizeof(char)) i3=i3&0x000000FF; 1093 if(resultType.GetBasicSize()==sizeof(short)) i3=i3&0x0000FFFF; 1094 1095 //push term 1096 compiler.codeGenerator.op_push_V(i3); 1097 } 1098 1099 type_stack[0]=resultType.GetBasicType(); 1100 index_stack[0]=resultType.GetIndex(); 1106 SetError(); 1101 1107 } 1102 1108 else{
Note:
See TracChangeset
for help on using the changeset viewer.