Changeset 79 in dev for BasicCompiler32
- Timestamp:
- Mar 25, 2007, 5:58:57 AM (18 years ago)
- Location:
- BasicCompiler32
- Files:
-
- 5 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
Note:
See TracChangeset
for help on using the changeset viewer.