Changeset 79 in dev
- Timestamp:
- Mar 25, 2007, 5:58:57 AM (18 years ago)
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/BasicCompiler.vcproj
r78 r79 147 147 Optimization="2" 148 148 InlineFunctionExpansion="1" 149 AdditionalIncludeDirectories="..\cpplibs\boost "149 AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include" 150 150 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN" 151 151 StringPooling="true" … … 245 245 Optimization="2" 246 246 InlineFunctionExpansion="1" 247 AdditionalIncludeDirectories="..\cpplibs\boost "247 AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include" 248 248 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ENG" 249 249 StringPooling="true" -
BasicCompiler32/Compile_Func.cpp
r78 r79 340 340 pUserProc->Using(); 341 341 } 342 void Opcode_Func_SizeOf(const char *Parameter){ 343 LONG_PTR lpIndex; 344 int type = GetTypeFixed(Parameter,&lpIndex); 345 346 int size; 347 if( type == DEF_OBJECT ){ 348 CClass *pClass = (CClass *)lpIndex; 349 size = pClass->GetSize(); 350 } 351 else{ 352 size=GetTypeSize(type,lpIndex); 353 } 342 void Opcode_Func_SizeOf( const string &typeName ){ 343 Type tempType; 344 if( !Type::StringToType( typeName, tempType ) ){ 345 SetError(3,typeName,cp); 346 return; 347 } 348 349 int typeSize = ( tempType.IsObject() ) ? 350 tempType.GetClass().GetSize() : tempType.GetSize(); 354 351 355 352 //mov eax,size 356 op_mov_RV( REG_EAX, size );353 op_mov_RV( REG_EAX, typeSize ); 357 354 } 358 355 void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){ -
BasicCompiler32/Compile_Var.cpp
r76 r79 1079 1079 } 1080 1080 1081 void dim( bool isRef,char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){1081 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){ 1082 1082 if( UserProc::IsGlobalAreaCompiling() ){ 1083 1083 ///////////////////////// … … 1085 1085 ///////////////////////// 1086 1086 1087 AddGlobalVariable( isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);1087 AddGlobalVariable(VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags); 1088 1088 } 1089 1089 else{ … … 1092 1092 ///////////////// 1093 1093 1094 if( UserProc::CompilingUserProc().localVars. BackSearch( VarName ) ){1094 if( UserProc::CompilingUserProc().localVars.DuplicateCheck( VarName ) ){ 1095 1095 //2重定義のエラー 1096 1096 SetError(15,VarName,cp); … … 1100 1100 bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false; 1101 1101 1102 Variable *pVar = new Variable( VarName, type, isConst , isRef);1102 Variable *pVar = new Variable( VarName, type, isConst ); 1103 1103 1104 1104 if( SubScripts[0] != -1 ){ -
BasicCompiler32/NumOpe.cpp
r76 r79 151 151 int sp; 152 152 int type_stack[255]; 153 bool isNothing_stack[255]; 153 154 LONG_PTR index_stack[255]; 154 155 BOOL bUseHeap[255]; … … 160 161 if(idCalc){ 161 162 if(type_stack[sp-2]==DEF_OBJECT){ 162 //オーバーロードされたオペレータを呼び出す 163 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp); 164 if(i2==0){ 165 if(idCalc==CALC_EQUAL) lstrcpy(temp2,"=="); 166 else GetCalcName(idCalc,temp2); 167 sprintf(temporary,"Operator %s",temp2); 168 SetError(27,temporary,cp); 169 goto error; 163 if( idCalc == CALC_AS 164 && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST ) 165 && index_stack[sp-1] == index_stack[sp-2] 166 || isNothing_stack[sp-2] ){ 167 // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない 170 168 } 171 else if(i2==-1) goto error; 172 173 continue; 169 else{ 170 //オーバーロードされたオペレータを呼び出す 171 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp); 172 if(i2==0){ 173 if(idCalc==CALC_EQUAL) lstrcpy(temp2,"=="); 174 else GetCalcName(idCalc,temp2); 175 sprintf(temporary,"Operator %s",temp2); 176 SetError(27,temporary,cp); 177 goto error; 178 } 179 else if(i2==-1) goto error; 180 181 continue; 182 } 174 183 } 175 184 … … 181 190 case 0: 182 191 index_stack[sp]=-1; 192 isNothing_stack[sp] = false; 183 193 bUseHeap[sp]=0; 184 194 … … 363 373 // Nothing 364 374 if( lstrcmp( term, "Nothing" ) == 0 ){ 375 isNothing_stack[sp] = true; 376 365 377 type_stack[sp] = DEF_OBJECT; 366 378 if( baseType.IsObject() ){ … … 489 501 // 型名の場合 490 502 ////////////// 491 492 LONG_PTR lp; 493 i3=GetTypeFixed(term,&lp); 494 if(i3!=-1){ 495 type_stack[sp]=i3|FLAG_CAST; 496 index_stack[sp]=lp; 503 Type tempType; 504 if( Type::StringToType( term, tempType ) ){ 505 type_stack[sp] = tempType.GetBasicType() | FLAG_CAST; 506 index_stack[sp] = tempType.GetIndex(); 497 507 sp++; 498 508 break; 499 509 } 500 501 510 502 511 -
BasicCompiler32/Opcode.h
r78 r79 190 190 #define DIMFLAG_STATIC 4 191 191 #define DIMFLAG_CONST 8 192 void dim( bool isRef,char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);192 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags); 193 193 void SetVarPtrToEax(RELATIVE_VAR *pRelativeVar); 194 194 -
BasicCompiler64/BasicCompiler.vcproj
r78 r79 152 152 Optimization="2" 153 153 InlineFunctionExpansion="1" 154 AdditionalIncludeDirectories="..\cpplibs\boost;..\ cpplibs\Base"154 AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include" 155 155 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN;_AMD64_;_WIN64" 156 156 StringPooling="true" … … 253 253 Optimization="2" 254 254 InlineFunctionExpansion="1" 255 AdditionalIncludeDirectories="..\cpplibs\boost;..\ cpplibs\Base"255 AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include" 256 256 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ENG" 257 257 StringPooling="true" … … 348 348 Name="VCCLCompilerTool" 349 349 Optimization="2" 350 AdditionalIncludeDirectories="..\cpplibs\boost;..\ cpplibs\Base"350 AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include" 351 351 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN;_AMD64_;_WIN64" 352 352 MinimalRebuild="false" -
BasicCompiler64/Compile_Func.cpp
r78 r79 185 185 pUserProc->Using(); 186 186 } 187 void Opcode_Func_SizeOf( const char *Parameter ){ 188 LONG_PTR lpIndex; 189 int type = GetTypeFixed(Parameter,&lpIndex); 190 191 int size; 192 if( type == DEF_OBJECT ){ 193 CClass *pClass = (CClass *)lpIndex; 194 size = pClass->GetSize(); 195 } 196 else{ 197 size=GetTypeSize(type,lpIndex); 198 } 187 void Opcode_Func_SizeOf( const string &typeName ){ 188 Type tempType; 189 if( !Type::StringToType( typeName, tempType ) ){ 190 SetError(3,typeName,cp); 191 return; 192 } 193 194 int typeSize = ( tempType.IsObject() ) ? 195 tempType.GetClass().GetSize() : tempType.GetSize(); 199 196 200 197 //mov rax,size 201 op_mov_RV(sizeof(_int64),REG_RAX, size);198 op_mov_RV(sizeof(_int64),REG_RAX,typeSize); 202 199 } 203 200 void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){ -
BasicCompiler64/Compile_Var.cpp
r76 r79 1074 1074 } 1075 1075 1076 void dim( bool isRef,char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){1076 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){ 1077 1077 if( UserProc::IsGlobalAreaCompiling() ){ 1078 1078 ///////////////////////// … … 1080 1080 ///////////////////////// 1081 1081 1082 AddGlobalVariable( isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);1082 AddGlobalVariable(VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags); 1083 1083 } 1084 1084 else{ … … 1095 1095 bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false; 1096 1096 1097 Variable *pVar = new Variable( VarName, type, isConst , isRef);1097 Variable *pVar = new Variable( VarName, type, isConst ); 1098 1098 1099 1099 if( SubScripts[0] != -1 ){ -
BasicCompiler64/NumOpe.cpp
r76 r79 177 177 int type_stack[255]; 178 178 LONG_PTR index_stack[255]; 179 bool isNothing_stack[255]; 179 180 BOOL bUseHeap[255]; 180 181 _int64 i64data; … … 187 188 if(idCalc){ 188 189 if(type_stack[sp-2]==DEF_OBJECT){ 189 //オーバーロードされたオペレータを呼び出す 190 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp); 191 if(i2==0){ 192 if(idCalc==CALC_EQUAL) lstrcpy(temp2,"=="); 193 else GetCalcName(idCalc,temp2); 194 sprintf(temporary,"Operator %s",temp2); 195 SetError(27,temporary,cp); 196 goto error; 190 if( idCalc == CALC_AS 191 && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST ) 192 && index_stack[sp-1] == index_stack[sp-2] 193 || isNothing_stack[sp-2] ){ 194 // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない 197 195 } 198 else if(i2==-1) goto error; 199 200 continue; 196 else{ 197 //オーバーロードされたオペレータを呼び出す 198 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp); 199 if(i2==0){ 200 if(idCalc==CALC_EQUAL) lstrcpy(temp2,"=="); 201 else GetCalcName(idCalc,temp2); 202 sprintf(temporary,"Operator %s",temp2); 203 SetError(27,temporary,cp); 204 goto error; 205 } 206 else if(i2==-1) goto error; 207 208 continue; 209 } 201 210 } 202 211 … … 208 217 case 0: 209 218 index_stack[sp]=-1; 219 isNothing_stack[sp] = false; 210 220 bUseHeap[sp]=0; 211 221 … … 424 434 // Nothing 425 435 if( lstrcmp( term, "Nothing" ) == 0 ){ 436 isNothing_stack[sp] = true; 437 426 438 type_stack[sp] = DEF_OBJECT; 427 439 if( baseType.IsObject() ){ … … 554 566 // 型名の場合 555 567 ////////////// 556 557 LONG_PTR lp; 558 i3=GetTypeFixed(term,&lp); 559 if(i3!=-1){ 560 type_stack[sp]=i3|FLAG_CAST; 561 index_stack[sp]=lp; 568 Type tempType; 569 if( Type::StringToType( term, tempType ) ){ 570 type_stack[sp] = tempType.GetBasicType() | FLAG_CAST; 571 index_stack[sp] = tempType.GetIndex(); 562 572 sp++; 563 573 break; 564 574 } 565 566 575 567 576 -
BasicCompiler64/Opcode.h
r78 r79 323 323 #define DIMFLAG_STATIC 0x04 324 324 #define DIMFLAG_CONST 0x08 325 void dim( bool isRef,char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);325 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags); 326 326 void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar); 327 327 -
BasicCompiler_Common/Class.cpp
r76 r79 106 106 sprintf(temporary,"%s.%s",pobj_c->name,member->name); 107 107 dim( 108 false,109 108 temporary, 110 109 member->SubScripts, -
BasicCompiler_Common/DebugMiddleFile.cpp
r78 r79 138 138 // TypeDef情報 139 139 ////////////////// 140 *(long *)(buffer+i2)= House::typeDefs.size();140 *(long *)(buffer+i2)=(int)House::typeDefs.size(); 141 141 i2+=sizeof(long); 142 142 for(i3=0;i3<(int)House::typeDefs.size();i3++){ -
BasicCompiler_Common/Intermediate_Step1.cpp
r67 r79 328 328 329 329 extern BOOL bStrict; 330 bStrict= 0;330 bStrict=1; 331 331 332 332 for(i=0;;i++){ … … 351 351 else if(lstrcmpi(temporary,"strict")==0){ 352 352 //#strict 353 //旧機能なので、無視 353 354 for(;;i2++){ 354 355 if(basbuf[i2]=='\n'||basbuf[i2]=='\0') break; 355 356 } 356 357 SlideString(basbuf+i2,i-i2); 357 358 //型チェックを厳密に行う359 bStrict=1;360 358 } 361 359 else if(lstrcmpi(temporary,"struct")==0){ -
BasicCompiler_Common/NumOpe_GetType.cpp
r75 r79 340 340 int type_stack[255]; 341 341 LONG_PTR index_stack[255]; 342 bool isNothing_stack[255]; 342 343 _int64 i64data; 343 344 int idCalc; … … 347 348 if(idCalc){ 348 349 if(type_stack[sp-2]==DEF_OBJECT){ 349 //オーバーロードされたオペレータを呼び出す 350 if(!GetReturnType_OperatorProc(idCalc,baseType,type_stack,index_stack,sp)){ 351 goto error; 350 if( idCalc == CALC_AS 351 && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST ) 352 && index_stack[sp-1] == index_stack[sp-2] 353 || isNothing_stack[sp-2] ){ 354 // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない 352 355 } 353 354 continue; 356 else{ 357 //オーバーロードされたオペレータを呼び出す 358 if(!GetReturnType_OperatorProc(idCalc,baseType,type_stack,index_stack,sp)){ 359 goto error; 360 } 361 362 continue; 363 } 355 364 } 356 365 … … 362 371 case 0: 363 372 index_stack[sp]=-1; 373 isNothing_stack[sp] = false; 364 374 365 375 char *term; … … 490 500 // Nothing 491 501 if( lstrcmp( term, "Nothing" ) == 0 ){ 502 isNothing_stack[sp] = true; 503 492 504 type_stack[sp] = DEF_OBJECT; 493 505 if( baseType.IsObject() ){ … … 558 570 ////////////// 559 571 560 LONG_PTR lp; 561 i3=GetTypeFixed(term,&lp); 562 if(i3!=-1){ 563 type_stack[sp]=i3|FLAG_CAST; 564 index_stack[sp]=lp; 572 Type tempType; 573 if( Type::StringToType( term, tempType ) ){ 574 type_stack[sp] = tempType.GetBasicType() | FLAG_CAST; 575 index_stack[sp] = tempType.GetIndex(); 565 576 sp++; 566 577 break; 567 578 } 568 569 579 570 580 -
BasicCompiler_Common/Procedure.cpp
r78 r79 120 120 Type::StringToType( temporary, type ); 121 121 122 /*123 TODO: 消す(TypeDef関連の変更)124 if(temporary[0]=='*'&&125 temporary[1]==1&&126 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){127 if(sourceOfParams[i]!='('){128 SetError(10,temporary,nowLine);129 break;130 }131 i3=GetStringInPare(temporary+i2,sourceOfParams+i);132 i+=i3;133 i2+=i3;134 135 if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){136 temporary[i2++]=sourceOfParams[i++];137 temporary[i2++]=sourceOfParams[i++];138 for(;;i++,i2++){139 if(!IsVariableChar(sourceOfParams[i])){140 temporary[i2]=0;141 break;142 }143 temporary[i2]=sourceOfParams[i];144 }145 }146 }147 else{148 //TypeDefをする前のベース型を取得149 GetOriginalTypeName_Old(temporary);150 }*/151 152 122 if( type.IsNull() ){ 153 123 SetError(3,temporary,nowLine); … … 159 129 SetError(-103,temporary,nowLine); 160 130 } 161 162 /*163 TODO: 消す(TypeDef関連の変更)164 if( type.IsProcPtr() ){165 //関数ポインタの場合166 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine) );167 }*/168 131 169 132 Parameter *pParam = new Parameter( name, type, isRef, initValue ); … … 278 241 Type::StringToType( temporary, type ); 279 242 280 /*281 TODO: 消す(TypeDef関連の変更)282 if(temporary[0]=='*'&&283 temporary[1]==1&&284 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){285 if(sourceOfParams[i]!='('){286 SetError(10,temporary,nowLine);287 break;288 }289 i3=GetStringInPare(temporary+i2,sourceOfParams+i);290 i+=i3;291 i2+=i3;292 293 if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){294 temporary[i2++]=sourceOfParams[i++];295 temporary[i2++]=sourceOfParams[i++];296 for(;;i++,i2++){297 if(!IsVariableChar(sourceOfParams[i])){298 temporary[i2]=0;299 break;300 }301 temporary[i2]=sourceOfParams[i];302 }303 }304 }305 else{306 //TypeDefをする前のベース型を取得307 GetOriginalTypeName_Old(temporary);308 }*/309 310 243 if( type.IsNull() ){ 311 244 SetError(3,temporary,nowLine); … … 317 250 SetError(-103,temporary,nowLine); 318 251 } 319 320 /*321 TODO: 消す(TypeDef関連の変更)322 if( type.IsProcPtr() ){323 //関数ポインタの場合324 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine) );325 }*/326 252 327 253 Parameter *pParam = new Parameter( name, type, isRef ); … … 535 461 Type::StringToType( temporary, type ); 536 462 537 /*538 TODO: 消す(TypeDef関連の変更)539 if(temporary[0]=='*'&&540 temporary[1]==1&&541 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){542 if(sourceOfParams[i]!='('){543 SetError(10,temporary,nowLine);544 break;545 }546 i3=GetStringInPare(temporary+i2,sourceOfParams+i);547 i+=i3;548 i2+=i3;549 550 if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){551 temporary[i2++]=sourceOfParams[i++];552 temporary[i2++]=sourceOfParams[i++];553 for(;;i++,i2++){554 if(!IsVariableChar(sourceOfParams[i])){555 temporary[i2]=0;556 break;557 }558 temporary[i2]=sourceOfParams[i];559 }560 }561 }562 else{563 //TypeDefをする前のベース型を取得564 GetOriginalTypeName_Old(temporary);565 }*/566 567 463 if( type.IsNull() ){ 568 464 SetError(3,temporary,nowLine); … … 574 470 SetError(-103,temporary,nowLine); 575 471 } 576 577 /*578 TODO: 消す(TypeDef関連の変更)579 if( type.IsProcPtr() ){580 //関数ポインタの場合581 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine ) );582 }*/583 472 584 473 Parameter *pParam = new Parameter( name, type, isRef ); … … 743 632 Type::StringToType( temporary, type ); 744 633 745 /*746 TODO: 消す(TypeDef関連の変更)747 if(temporary[0]=='*'&&748 temporary[1]==1&&749 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){750 if(sourceOfParams[i]!='('){751 SetError(10,temporary,nowLine);752 break;753 }754 i3=GetStringInPare(temporary+i2,sourceOfParams+i);755 i+=i3;756 i2+=i3;757 758 if(temporary[2]==ESC_FUNCTION&&sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){759 temporary[i2++]=sourceOfParams[i++];760 temporary[i2++]=sourceOfParams[i++];761 for(;;i++,i2++){762 if(!IsVariableChar(sourceOfParams[i])){763 temporary[i2]=0;764 break;765 }766 temporary[i2]=sourceOfParams[i];767 }768 }769 }770 else{771 //TypeDefをする前のベース型を取得772 GetOriginalTypeName_Old(temporary);773 }*/774 775 634 if( type.IsNull() ){ 776 635 SetError(3,temporary,nowLine); … … 782 641 SetError(-103,temporary,nowLine); 783 642 } 784 785 /*786 TODO: 消す(TypeDef関連の変更)787 if( type.IsProcPtr() ){788 //関数ポインタの場合789 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine ) );790 }*/791 643 792 644 Parameter *pParam = new Parameter( name, type, isRef ); -
BasicCompiler_Common/Subroutine.cpp
r78 r79 783 783 House::procPointers.push_back( pProcPointer ); 784 784 785 return House::procPointers.size()-1;785 return (int)House::procPointers.size()-1; 786 786 } 787 787 void DeleteProcPtrInfo(void){ -
BasicCompiler_Common/Type.h
r77 r79 4 4 5 5 class Type{ 6 static const int basicTypeList[];7 static const string basicTypeNameList[];8 9 10 6 int basicType; 11 7 union{ … … 15 11 16 12 public: 17 18 static bool StringToBasicType( const string &typeName, int &basicType );19 static bool StringToType( const string &typeName, Type &type );20 13 static int GetBasicSize( int basicType ); 21 14 … … 124 117 125 118 static Type String(); 119 120 121 private: 122 static const int basicTypeList[]; 123 static const string basicTypeNameList[]; 124 public: 125 static bool StringToBasicType( const string &typeName, int &basicType ); 126 static bool StringToType( const string &typeName, Type &type ); 126 127 }; -
BasicCompiler_Common/TypeDef.cpp
r78 r79 52 52 } 53 53 int TypeDefCollection::GetIndex( const string &typeName ) const{ 54 int max = ( *this).size();54 int max = (int)(*this).size(); 55 55 for( int i=0; i<max; i++ ){ 56 56 if( (*this)[i].newName == typeName ){ -
BasicCompiler_Common/VariableOpe.cpp
r78 r79 179 179 return MAKE_PTR_TYPE(NATURAL_TYPE(type),PTR_LEVEL(type)+1); 180 180 } 181 int GetTypeFixed(const char *TypeName,LONG_PTR *lpNum){182 int type;183 184 if(lpNum) *lpNum=-1;185 186 if(TypeName[0]=='*'){187 if(TypeName[1]==1&&(TypeName[2]==ESC_FUNCTION||TypeName[2]==ESC_SUB)){188 //関数ポインタ(*Function)189 return DEF_PTR_PROC;190 }191 192 type=GetTypeFixed(TypeName+1,lpNum);193 if(type==-1) return -1;194 195 return GetPtrType(type);196 }197 198 //整数型199 if(lstrcmpi(TypeName,"SByte")==0) return DEF_SBYTE;200 else if(lstrcmpi(TypeName,"Byte")==0) return DEF_BYTE;201 else if(lstrcmpi(TypeName,"Integer")==0) return DEF_INTEGER;202 else if(lstrcmpi(TypeName,"WORD")==0) return DEF_WORD;203 else if(lstrcmpi(TypeName,"Long")==0) return DEF_LONG;204 else if(lstrcmpi(TypeName,"DWORD")==0) return DEF_DWORD;205 else if(lstrcmpi(TypeName,"Int64")==0) return DEF_INT64;206 else if(lstrcmpi(TypeName,"QWORD")==0) return DEF_QWORD;207 208 //実数型209 else if(lstrcmpi(TypeName,"Single")==0) return DEF_SINGLE;210 else if(lstrcmpi(TypeName,"Double")==0) return DEF_DOUBLE;211 212 //文字型213 //else if( lstrcmpi( TypeName, "Char" ) == 0 ) return DEF_CHAR;214 215 //bool型216 else if( lstrcmpi( TypeName, "Boolean" ) == 0 ) return DEF_BOOLEAN;217 218 //ポインタ型219 //※VoidPtr型以外のポインタ型はTypeDef宣言により定義される220 else if(lstrcmpi(TypeName,"VoidPtr")==0) return DEF_PTR_VOID;221 222 //その他223 else if(lstrcmpi(TypeName,"Any")==0) return DEF_ANY;224 225 226 ////////////////////227 // TypeDefされた型228 ////////////////////229 int i;230 i=House::typeDefs.GetIndex(TypeName);231 if(i!=-1){232 *lpNum = House::typeDefs[i].GetBaseType().GetIndex();233 return House::typeDefs[i].GetBaseType().GetBasicType();234 }235 236 if(!lpNum) return -1;237 238 //クラス239 CClass *pobj_c;240 pobj_c=pobj_DBClass->check(TypeName);241 if(pobj_c){242 *lpNum=(LONG_PTR)pobj_c;243 244 if( pobj_c->IsStructure() ){245 return DEF_STRUCT;246 }247 else{248 return DEF_OBJECT;249 }250 }251 252 return -1;253 }254 /*255 TODO: 消す(TypeDef関連の変更)256 void GetOriginalTypeName_Old(char *buffer){257 // TypeDefされた型に対して、オリジナルの型の名前に変更する258 259 if(buffer[0]=='*'){260 if(buffer[1]==1&&(buffer[2]==ESC_FUNCTION||buffer[2]==ESC_SUB)) return;261 262 GetOriginalTypeName_Old(buffer+1);263 return;264 }265 266 int i;267 i=House::typeDefs.GetIndex(buffer);268 if(i!=-1){269 lstrcpy(buffer,House::typeDefs[i].GetBaseName().c_str());270 GetOriginalTypeName_Old(buffer);271 }272 }*/273 181 BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name){ 274 182 if(PTR_LEVEL(type)){ … … 948 856 // 初期化データが指定されいるとき 949 857 //////////////////////////////////// 950 951 for(i++,i2=0,IsStr=0;;i++,i2++){ 952 if(buffer[i]=='\"') IsStr^=1; 953 if(buffer[i]=='('&&IsStr==0){ 954 i3=GetStringInPare(InitBuf+i2,buffer+i); 955 i+=i3-1; 956 i2+=i3-1; 957 continue; 958 } 959 if(buffer[i]=='['&&IsStr==0){ 960 i3=GetStringInBracket(InitBuf+i2,buffer+i); 961 i+=i3-1; 962 i2+=i3-1; 963 continue; 964 } 965 if((buffer[i]==1&&buffer[i+1]==ESC_AS)|| 966 (buffer[i]==','&&IsStr==0)|| 967 buffer[i]=='\0'){ 968 InitBuf[i2]=0; 969 break; 970 } 971 InitBuf[i2]=buffer[i]; 858 i++; 859 860 if( buffer[i]=='[' ){ 861 // 構造初期データの場合 862 863 i3=GetStringInBracket(InitBuf,buffer+i); 864 i+=i3; 865 } 866 else{ 867 // 代入初期データの場合 868 869 for(i2=0,IsStr=0;;i++,i2++){ 870 if(buffer[i]=='\"') IsStr^=1; 871 if(buffer[i]=='('&&IsStr==0){ 872 i3=GetStringInPare(InitBuf+i2,buffer+i); 873 i+=i3-1; 874 i2+=i3-1; 875 continue; 876 } 877 if(buffer[i]=='['&&IsStr==0){ 878 i3=GetStringInBracket(InitBuf+i2,buffer+i); 879 i+=i3-1; 880 i2+=i3-1; 881 continue; 882 } 883 if((buffer[i]==','&&IsStr==0)|| 884 buffer[i]=='\0'){ 885 InitBuf[i2]=0; 886 break; 887 } 888 InitBuf[i2]=buffer[i]; 889 } 972 890 } 973 891 } … … 1052 970 return false; 1053 971 } 972 973 if( IS_LITERAL( type.GetIndex() ) ){ 974 type.SetIndex( -1 ); 975 } 1054 976 } 1055 977 … … 1099 1021 1100 1022 1101 void AddGlobalVariable( bool isRef,const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag){1023 void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag){ 1102 1024 ///////////////////////// 1103 1025 // グローバル変数を追加 … … 1114 1036 bool isConst = ( dwFlag & DIMFLAG_CONST ) ? true:false; 1115 1037 1116 Variable *pVar = new Variable( name, type, isConst , isRef);1038 Variable *pVar = new Variable( name, type, isConst ); 1117 1039 1118 1040 if( SubScripts[0] != -1 ){ … … 1217 1139 char VarName[VN_SIZE]; 1218 1140 1219 //参照型かどうか1220 bool isRef = false;1221 1222 1141 i2 = 0; 1223 1142 1224 1143 if( Parameter[i2] == 1 && Parameter[i2+1] == ESC_BYREF ){ 1225 1144 //参照型 1226 isRef = true;1145 SetError(); 1227 1146 Parameter += 2; 1228 1147 } … … 1290 1209 GetNowStaticVarFullName(VarName,temporary); 1291 1210 1292 dim( isRef,temporary,SubScripts,type,InitBuf,ConstractParameter,dwFlags );1211 dim( temporary,SubScripts,type,InitBuf,ConstractParameter,dwFlags ); 1293 1212 1294 1213 /* … … 1298 1217 } 1299 1218 else{ 1300 dim( isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags );1219 dim( VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags ); 1301 1220 } 1302 1221 } -
BasicCompiler_Common/VariableOpe.h
r78 r79 13 13 int GetTypeSize(int type,LONG_PTR lpIndex); 14 14 int GetPtrType(int type); 15 int GetTypeFixed(const char *TypeName,LONG_PTR *lpNum);16 /*17 TODO: 消す(TypeDef関連の変更)18 void GetOriginalTypeName_Old(char *buffer);19 void GetOriginalTypeName(char *buffer);20 */21 15 BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name); 22 16 bool FormatUseProcReturnObject( const char *term, char *procName, char *parameter, CClass::RefType &refType, char *member ); … … 37 31 char *ConstractParameter ); 38 32 BOOL GetNowStaticVarFullName(char *VarName,char *FullName); 39 void AddGlobalVariable( bool isRef,const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag);33 void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag); 40 34 void dim(char *Parameter,DWORD dwFlags); 41 35 void OpcodeDim(char *Parameter,DWORD dwFlags); -
BasicCompiler_Common/calculation.cpp
r78 r79 483 483 type[pnum]=DEF_LONG; 484 484 485 LONG_PTR lpIndex; 486 i3=GetTypeFixed(temp2,&lpIndex); 487 if(i3==-1){ 488 extern int cp; 485 Type tempType; 486 if( !Type::StringToType( temp2, tempType ) ){ 489 487 if(enableerror) SetError(3,temp2,cp); 490 488 return false; 491 489 } 492 i64nums[pnum] =GetTypeSize(i3,lpIndex);490 i64nums[pnum] = tempType.GetSize(); 493 491 StrPtr[pnum]=0; 494 492 } … … 688 686 ////////////// 689 687 690 type[pnum]=GetTypeFixed(Parms,&before_index[pnum]); 691 692 if(type[pnum]==-1){ 693 if(bDebuggingWatchList){ 694 if( pIsMemoryAccessError ) *pIsMemoryAccessError = true; 688 { 689 Type tempType; 690 if( !Type::StringToType( Parms, tempType ) ){ 691 if(bDebuggingWatchList){ 692 if( pIsMemoryAccessError ) *pIsMemoryAccessError = true; 693 return false; 694 } 695 //エラー 696 if(enableerror) SetError(3,Parms,cp); 695 697 return false; 696 698 } 697 //エラー 698 if(enableerror) SetError(3,Parms,cp);699 return false;699 700 type[pnum] = tempType.GetBasicType(); 701 before_index[pnum] = tempType.GetIndex(); 700 702 } 703 701 704 JumpConst:; 702 705 } -
BasicCompiler_Common/common.h
r78 r79 47 47 48 48 #ifdef _AMD64_ 49 #define VER_INFO "β1 6(x64)"49 #define VER_INFO "β17 (x64)" 50 50 #else 51 #define VER_INFO "β1 6"51 #define VER_INFO "β17" 52 52 #endif 53 53 -
ProjectEditor/Common.h
r70 r79 59 59 #define APPLICATION_NAME "ActiveBasic 5.0" 60 60 #define VERSION_APPLI_NAME APPLICATION_NAME 61 #define VERSION_STRING "5.00.00 β1 6"61 #define VERSION_STRING "5.00.00 β17" 62 62 63 63 #endif
Note:
See TracChangeset
for help on using the changeset viewer.