Changeset 182 in dev for trunk/abdev/BasicCompiler_Common
- Timestamp:
- Jun 24, 2007, 6:49:13 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common
- Files:
-
- 29 deleted
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/BasicCompiler.cpp
r167 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include <Program.h> 2 4 … … 185 187 } 186 188 187 i3= baseDirPath.size();i4=0;189 i3=(int)baseDirPath.size();i4=0; 188 190 while(i4<i2){ 189 191 for(i3--;;i3--){ … … 550 552 char temporary[1024],temp2[MAX_PATH]; 551 553 552 //MessageBox(0,"starting compiler/debugger","ActiveBasic",MB_OK);554 MessageBox(0,"starting compiler/debugger","ActiveBasic",MB_OK); 553 555 trace( "Start ActiveBasic Compiler!" ); 554 556 … … 702 704 //Unicode 703 705 else if( lstrcmp( temp2, "unicode" ) ==0 ){ 704 isUnicode = true;706 Smoothie::SetUnicodeMark( true ); 705 707 typeOfPtrChar = MAKE_PTR_TYPE(DEF_WORD,1); 706 708 typeOfPtrUChar = MAKE_PTR_TYPE(DEF_WORD,1); -
trunk/abdev/BasicCompiler_Common/BasicCompiler.h
r167 r182 79 79 80 80 BOOL bDll; 81 bool isUnicode = false;82 81 int typeOfPtrChar = MAKE_PTR_TYPE(DEF_SBYTE,1); 83 82 int typeOfPtrUChar = MAKE_PTR_TYPE(DEF_BYTE,1); -
trunk/abdev/BasicCompiler_Common/Compile.cpp
r143 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 #include <jenga/include/smoothie/SmoothieException.h> 4 5 #include <LexicalScopingImpl.h> 6 #include <CodeGenerator.h> 7 1 8 #include "../BasicCompiler_Common/common.h" 2 9 … … 7 14 #endif 8 15 16 #include <Exception.h> 17 9 18 //ラベルアドレス 10 19 LABEL *pLabelNames; … … 33 42 WITHINFO WithInfo; 34 43 35 36 int obp,obp_AllocSize;37 int GlobalOpBufferSize;38 char *OpBuffer;39 void ReallocNativeCodeBuffer(){40 if(obp_AllocSize<obp+8192){41 obp_AllocSize+=8192;42 OpBuffer=(char *)HeapReAlloc(hHeap,0,OpBuffer,obp_AllocSize); //matea43 }44 }45 44 46 45 … … 177 176 break; 178 177 case ESC_EXITWHILE: 179 obj_LexScopes.ExitWhile(); 178 { 179 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_WHILE ); 180 if( !pScope ){ 181 SetError(12,"Exit While",cp); 182 return; 183 } 184 pScope->Break(); 185 } 180 186 break; 181 187 case ESC_EXITFOR: 182 obj_LexScopes.ExitFor(); 188 { 189 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_FOR ); 190 if( !pScope ){ 191 SetError(12,"Exit For",cp); 192 return; 193 } 194 pScope->Break(); 195 } 183 196 break; 184 197 case ESC_EXITDO: 185 obj_LexScopes.ExitDo(); 198 { 199 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_DO ); 200 if( !pScope ){ 201 SetError(12,"Exit Do",cp); 202 return; 203 } 204 pScope->Break(); 205 } 186 206 break; 187 207 case ESC_CONTINUE: … … 231 251 232 252 case ESC_NAMESPACE: 233 Smoothie:: Lexical::liveingNamespaceScopes.push_back( Command + 2 );253 Smoothie::Temp::liveingNamespaceScopes.push_back( Command + 2 ); 234 254 break; 235 255 case ESC_ENDNAMESPACE: 236 if( Smoothie:: Lexical::liveingNamespaceScopes.size() <= 0 ){256 if( Smoothie::Temp::liveingNamespaceScopes.size() <= 0 ){ 237 257 SetError(12,"End Namespace",cp); 238 258 } 239 Smoothie:: Lexical::liveingNamespaceScopes.pop_back();259 Smoothie::Temp::liveingNamespaceScopes.pop_back(); 240 260 break; 241 261 case ESC_IMPORTS: … … 641 661 } 642 662 643 ChangeOpcode(Command); 663 try 664 { 665 ChangeOpcode(Command); 666 } 667 catch( const SmoothieException &smoothieException ) 668 { 669 SetError( 670 smoothieException.GetErrorCode(), 671 smoothieException.GetKeyword(), 672 smoothieException.GetNowLine() 673 ); 674 } 644 675 645 676 #ifdef _DEBUG … … 651 682 if(bStopCompile) return 0; 652 683 653 if(obp_AllocSize<obp+8192){ 654 obp_AllocSize+=8192; 655 OpBuffer=(char *)HeapReAlloc(hHeap,0,OpBuffer,obp_AllocSize); 656 } 684 ReallocNativeCodeBuffer(); 657 685 658 686 if(basbuf[cp]=='\0'){ -
trunk/abdev/BasicCompiler_Common/Const.cpp
r103 r182 18 18 char AreaName[VN_SIZE] = ""; //オブジェクト変数 19 19 char NestName[VN_SIZE] = ""; //入れ子メンバ 20 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );20 bool isNest = CClass::SplitName( fullName.c_str(), AreaName, NestName ); 21 21 22 22 return IsEqualSymbol( NamespaceScopes( AreaName ), NestName ); … … 180 180 char ObjName[VN_SIZE]; //オブジェクト変数 181 181 char NestMember[VN_SIZE]; //入れ子メンバ 182 bool isObjectMember = SplitMemberName( name.c_str(), ObjName, NestMember );182 bool isObjectMember = CClass::SplitName( name.c_str(), ObjName, NestMember ); 183 183 184 184 //ハッシュ値を取得 -
trunk/abdev/BasicCompiler_Common/Const.h
r103 r182 1 #pragma once 1 2 3 #include <jenga/include/smoothie/Type.h> 2 4 3 5 //定数の基底クラス -
trunk/abdev/BasicCompiler_Common/DebugMiddleFile.cpp
r159 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 3 #include <ClassImpl.h> 4 1 5 #include "../BasicCompiler_Common/common.h" 2 6 … … 28 32 (*p)+=lstrlen(buffer+(*p))+1; 29 33 30 type.SetIndex( (LONG_PTR) pobj_DBClass->Find(szClassName) );34 type.SetIndex( (LONG_PTR)Smoothie::GetMeta().GetClasses().Find(szClassName) ); 31 35 } 32 36 else{ … … 115 119 116 120 //イテレータをリセット 117 extern Classes *pobj_DBClass; 118 pobj_DBClass->Iterator_Reset(); 121 Smoothie::GetMeta().GetClasses().Iterator_Reset(); 119 122 120 123 //個数 121 *(long *)(buffer+i2)= pobj_DBClass->Iterator_GetMaxCount();122 i2+=sizeof(long); 123 124 while( pobj_DBClass->Iterator_HasNext()){124 *(long *)(buffer+i2)=Smoothie::GetMeta().GetClasses().Iterator_GetMaxCount(); 125 i2+=sizeof(long); 126 127 while(Smoothie::GetMeta().GetClasses().Iterator_HasNext()){ 125 128 CClass *pobj_c; 126 pobj_c= pobj_DBClass->Iterator_GetNext();129 pobj_c=Smoothie::GetMeta().GetClasses().Iterator_GetNext(); 127 130 128 131 //クラス名 … … 136 139 // TypeDef情報 137 140 ////////////////// 138 *(long *)(buffer+i2)=(int)Smoothie:: meta.typeDefs.size();139 i2+=sizeof(long); 140 for(i3=0;i3<(int)Smoothie:: meta.typeDefs.size();i3++){141 lstrcpy(buffer+i2,Smoothie:: meta.typeDefs[i3].GetName().c_str() );142 i2+=lstrlen(buffer+i2)+1; 143 144 lstrcpy(buffer+i2,Smoothie:: meta.typeDefs[i3].GetBaseName().c_str() );141 *(long *)(buffer+i2)=(int)Smoothie::GetMeta().typeDefs.size(); 142 i2+=sizeof(long); 143 for(i3=0;i3<(int)Smoothie::GetMeta().typeDefs.size();i3++){ 144 lstrcpy(buffer+i2,Smoothie::GetMeta().typeDefs[i3].GetName().c_str() ); 145 i2+=lstrlen(buffer+i2)+1; 146 147 lstrcpy(buffer+i2,Smoothie::GetMeta().typeDefs[i3].GetBaseName().c_str() ); 145 148 i2+=lstrlen(buffer+i2)+1; 146 149 … … 156 159 *(long *)(buffer+i2)=(int)::globalVars.size(); 157 160 i2+=sizeof(long); 158 foreach( Variable *pVar, ::globalVars ){161 BOOST_FOREACH( Variable *pVar, ::globalVars ){ 159 162 //変数名 160 163 lstrcpy(buffer+i2,pVar->GetName().c_str()); … … 245 248 } 246 249 247 foreach( Variable *pVar, pUserProc->localVars ){250 BOOST_FOREACH( Variable *pVar, pUserProc->localVars ){ 248 251 lstrcpy(buffer+i2,pVar->GetName().c_str()); 249 252 i2+=lstrlen(buffer+i2)+1; … … 304 307 305 308 //イテレータをリセット 306 pobj_DBClass->Iterator_Reset();307 308 while( pobj_DBClass->Iterator_HasNext()){309 Smoothie::GetMeta().GetClasses().Iterator_Reset(); 310 311 while(Smoothie::GetMeta().GetClasses().Iterator_HasNext()){ 309 312 CClass *pobj_c; 310 pobj_c= pobj_DBClass->Iterator_GetNext();313 pobj_c=Smoothie::GetMeta().GetClasses().Iterator_GetNext(); 311 314 312 315 … … 324 327 325 328 //メンバ 326 *(long *)(buffer+i2)=(int)pobj_c-> dynamicMembers.size();327 i2+=sizeof(long); 328 foreach( CMember *member, pobj_c->dynamicMembers){329 *(long *)(buffer+i2)=(int)pobj_c->GetDynamicMembers().size(); 330 i2+=sizeof(long); 331 BOOST_FOREACH( CMember *member, pobj_c->GetDynamicMembers() ){ 329 332 // 名前 330 333 lstrcpy(buffer+i2,member->GetName().c_str()); … … 353 356 354 357 //メソッド 355 *(long *)(buffer+i2)=(long)pobj_c-> methods.size();356 i2+=sizeof(long); 357 foreach( const CMethod *pMethod, pobj_c->methods){358 *(long *)(buffer+i2)=(long)pobj_c->GetMethods().size(); 359 i2+=sizeof(long); 360 BOOST_FOREACH( const CMethod *pMethod, pobj_c->GetMethods() ){ 358 361 *(Prototype::Accessibility *)(buffer+i2)=pMethod->GetAccessibility(); 359 362 i2+=sizeof(Prototype::Accessibility); … … 371 374 372 375 //静的メンバ 373 *(long *)(buffer+i2)=(long)pobj_c-> staticMembers.size();374 i2+=sizeof(long); 375 foreach( CMember *member, pobj_c->staticMembers){376 *(long *)(buffer+i2)=(long)pobj_c->GetStaticMembers().size(); 377 i2+=sizeof(long); 378 BOOST_FOREACH( CMember *member, pobj_c->GetStaticMembers() ){ 376 379 // 名前 377 380 lstrcpy(buffer+i2,member->GetName().c_str()); … … 432 435 char temp2[MAX_PATH],*temp5; 433 436 434 pobj_CompilingClass = NULL;437 Smoothie::Temp::pCompilingClass = NULL; 435 438 436 439 i2=0; … … 482 485 /////////////////////////////////////////// 483 486 484 this->pobj_DBClass=new Classes ();487 this->pobj_DBClass=new ClassesImpl(); 485 488 486 489 int iMaxClassCount; … … 490 493 //クラス名 491 494 // TODO: 名前空間が未完成 492 pobj_DBClass->AddClass(NamespaceScopes(),NamespaceScopesCollection(),buffer+i2,0); 493 i2+=lstrlen(buffer+i2)+1; 494 } 495 496 extern Classes *pobj_DBClass; 497 pobj_DBClass=this->pobj_DBClass; 495 this->pobj_DBClass->Add(NamespaceScopes(),NamespaceScopesCollection(),buffer+i2,0); 496 i2+=lstrlen(buffer+i2)+1; 497 } 498 499 Smoothie::GetMeta().SetClasses( this->pobj_DBClass ); 498 500 499 501 … … 503 505 504 506 //初期化 505 Smoothie:: meta.typeDefs.clear();507 Smoothie::GetMeta().typeDefs.clear(); 506 508 507 509 //個数を取得 … … 513 515 514 516 // 名前空間に未対応 515 Smoothie:: meta.typeDefs.push_back( TypeDef( NamespaceScopes(), temp5, buffer+i2) );517 Smoothie::GetMeta().typeDefs.push_back( TypeDef( NamespaceScopes(), temp5, buffer+i2, -1 ) ); 516 518 517 519 i2+=lstrlen(buffer+i2)+1; … … 590 592 const CClass *pClass = NULL; 591 593 if(szParentClassName[0]){ 592 pClass= pobj_DBClass->Find(szParentClassName);594 pClass=Smoothie::GetMeta().GetClasses().Find(szParentClassName); 593 595 } 594 596 … … 695 697 i2+=lstrlen(buffer+i2)+1; 696 698 697 pobj_c = const_cast<CClass *>( pobj_DBClass->Find(szClassName) );699 pobj_c = const_cast<CClass *>( Smoothie::GetMeta().GetClasses().Find(szClassName) ); 698 700 699 701 //仮想関数の数 … … 724 726 i2+=sizeof(Prototype::Accessibility); 725 727 726 CMember *member=new CMember( accessibility, name, type, false );728 CMember *member=new CMember( accessibility, name, type, false, "", "" ); 727 729 728 730 memcpy(member->SubScripts,buffer+i2,sizeof(int)*MAX_ARRAYDIM); 729 731 i2+=sizeof(int)*MAX_ARRAYDIM; 730 732 731 pobj_c-> dynamicMembers.push_back( member );733 pobj_c->GetDynamicMembers().push_back( member ); 732 734 } 733 735 … … 746 748 const CClass *pobj_InheritsClass = NULL; 747 749 if(szInherits[0]){ 748 pobj_InheritsClass= pobj_DBClass->Find(szInherits);750 pobj_InheritsClass=Smoothie::GetMeta().GetClasses().Find(szInherits); 749 751 } 750 752 … … 764 766 CMethod *pMethod = new DynamicMethod( pUserProc, accessibility, 0,0,false, pobj_InheritsClass); 765 767 766 pobj_c-> methods.push_back( pMethod );768 pobj_c->GetMethods().push_back( pMethod ); 767 769 } 768 770 … … 786 788 i2+=sizeof(Prototype::Accessibility); 787 789 788 CMember *member=new CMember( accessibility, name, type, false );790 CMember *member=new CMember( accessibility, name, type, false, "", "" ); 789 791 790 792 memcpy(member->SubScripts,buffer+i2,sizeof(int)*MAX_ARRAYDIM); 791 793 i2+=sizeof(int)*MAX_ARRAYDIM; 792 794 793 pobj_c-> staticMembers.push_back( member );795 pobj_c->GetStaticMembers().push_back( member ); 794 796 } 795 797 } … … 943 945 944 946 // クラス情報 945 extern Classes *pobj_DBClass; 946 pobj_DBClass=this->pobj_DBClass; 947 Smoothie::GetMeta().SetClasses( this->pobj_DBClass ); 947 948 948 949 //定数を取得 … … 979 980 980 981 //クラスに関するメモリを解放 981 delete pobj_DBClass;982 pobj_DBClass=0;982 delete this->pobj_DBClass; 983 this->pobj_DBClass=0; 983 984 984 985 //サブルーチン情報のメモリ解放 … … 992 993 993 994 //コードバッファを解放 994 HeapDefaultFree(OpBuffer);995 free(OpBuffer); 995 996 OpBuffer=0; 996 997 -
trunk/abdev/BasicCompiler_Common/DebugSection.h
r159 r182 1 #pragma once 2 3 #include <jenga/include/smoothie/Source.h> 4 #include <jenga/include/smoothie/Class.h> 5 6 #include <ProcedureImpl.h> 7 1 8 2 9 class CDebugSection{ -
trunk/abdev/BasicCompiler_Common/Diagnose.cpp
r167 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include <Program.h> 2 4 … … 66 68 // イテレータをリセット 67 69 extern Classes *pobj_DBClass; 68 pobj_DBClass->Iterator_Reset();70 Smoothie::GetMeta().GetClasses().Iterator_Reset(); 69 71 70 while( pobj_DBClass->Iterator_HasNext() ){72 while( Smoothie::GetMeta().GetClasses().Iterator_HasNext() ){ 71 73 int codeSizeOfClass = 0; 72 74 73 CClass &objClass = * pobj_DBClass->Iterator_GetNext();75 CClass &objClass = *Smoothie::GetMeta().GetClasses().Iterator_GetNext(); 74 76 75 77 if( !objClass.IsEnum() ){ … … 79 81 80 82 // 動的メソッド 81 foreach( const CMethod *pMethod, objClass.GetMethods() ){83 BOOST_FOREACH( const CMethod *pMethod, objClass.GetMethods() ){ 82 84 if( pMethod->pUserProc->IsCompiled() ){ 83 85 codeSizeOfClass += pMethod->pUserProc->GetCodeSize(); … … 86 88 87 89 // 静的メソッド 88 foreach( const CMethod *pMethod, objClass.GetStaticMethods() ){90 BOOST_FOREACH( const CMethod *pMethod, objClass.GetStaticMethods() ){ 89 91 codeSizeOfClass += pMethod->pUserProc->GetCodeSize(); 90 92 } … … 106 108 // イテレータをリセット 107 109 extern Classes *pobj_DBClass; 108 pobj_DBClass->Iterator_Reset();110 Smoothie::GetMeta().GetClasses().Iterator_Reset(); 109 111 110 while( pobj_DBClass->Iterator_HasNext() ){112 while( Smoothie::GetMeta().GetClasses().Iterator_HasNext() ){ 111 113 int codeSizeOfClass = 0; 112 114 113 CClass &objClass = * pobj_DBClass->Iterator_GetNext();115 CClass &objClass = *Smoothie::GetMeta().GetClasses().Iterator_GetNext(); 114 116 115 117 // 動的メソッド 116 foreach( const CMethod *pMethod, objClass.GetMethods() ){118 BOOST_FOREACH( const CMethod *pMethod, objClass.GetMethods() ){ 117 119 if( pMethod->pUserProc->IsCompiled() ){ 118 120 codeSizeOfClass += pMethod->pUserProc->GetCodeSize(); … … 121 123 122 124 // 静的メソッド 123 foreach( const CMethod *pMethod, objClass.GetStaticMethods() ){125 BOOST_FOREACH( const CMethod *pMethod, objClass.GetStaticMethods() ){ 124 126 codeSizeOfClass += pMethod->pUserProc->GetCodeSize(); 125 127 } -
trunk/abdev/BasicCompiler_Common/Enum.cpp
r167 r182 1 1 #include <jenga/include/common/logger.h> 2 3 #include <jenga/include/smoothie/Smoothie.h> 4 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 5 3 6 #include "common.h" … … 112 115 113 116 // 名前空間管理 114 NamespaceScopes &namespaceScopes = Smoothie:: Lexical::liveingNamespaceScopes;117 NamespaceScopes &namespaceScopes = Smoothie::Temp::liveingNamespaceScopes; 115 118 namespaceScopes.clear(); 116 119 -
trunk/abdev/BasicCompiler_Common/Enum.h
r103 r182 1 #pragma once 1 2 3 #include <jenga/include/smoothie/Namespace.h> 2 4 3 5 class CEnumMember{ -
trunk/abdev/BasicCompiler_Common/Intermediate_Step1.cpp
r112 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 1 4 #include "../BasicCompiler_Common/common.h" 2 5 -
trunk/abdev/BasicCompiler_Common/Intermediate_Step2.cpp
r128 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 1 4 #include "../BasicCompiler_Common/common.h" 2 5 … … 247 250 248 251 // 名前空間管理 249 NamespaceScopes &namespaceScopes = Smoothie:: Lexical::liveingNamespaceScopes;252 NamespaceScopes &namespaceScopes = Smoothie::Temp::liveingNamespaceScopes; 250 253 namespaceScopes.clear(); 251 254 -
trunk/abdev/BasicCompiler_Common/MakeExe.cpp
r167 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "common.h" 2 4 … … 202 204 DeleteDeclareInfo(); 203 205 204 //関数ポインタ情報のメモリ解放205 DeleteProcPtrInfo();206 207 206 //定数に関する情報を解放 208 207 extern CONSTINFO **ppConstHash; -
trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
r159 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 1 4 #include "common.h" 2 5 … … 311 314 char member[VN_SIZE]; 312 315 CClass::RefType refType; 313 if( SplitMemberName( termFull, termLeft, member, refType ) ){316 if( CClass::SplitName( termFull, termLeft, member, refType ) ){ 314 317 /////////////////////////////////////////////////////////////////// 315 318 // オブジェクトとメンバに分解できるとき … … 323 326 Type leftType; 324 327 if( GetTermType( termLeft, leftType, isLiteral, &isClassName ) ){ 325 if( isClassName == false && Smoothie:: meta.blittableTypes.IsExist( leftType ) ){328 if( isClassName == false && Smoothie::GetMeta().blittableTypes.IsExist( leftType ) ){ 326 329 // 左側のオブジェクト部分がBlittable型のとき 327 330 … … 329 332 lstrcpy( temporary, termLeft ); 330 333 sprintf( termLeft, "%s(%s)", 331 Smoothie:: meta.blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(),334 Smoothie::GetMeta().blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(), 332 335 temporary ); 333 336 … … 393 396 394 397 if( pIsClassName ){ 395 if( pobj_DBClass->Find( termFull ) ){398 if( Smoothie::GetMeta().GetClasses().Find( termFull ) ){ 396 399 *pIsClassName = true; 397 400 return true; … … 408 411 if(lstrcmpi(termFull,"This")==0){ 409 412 //Thisオブジェクト 410 resultType.SetType( DEF_OBJECT, pobj_CompilingClass );413 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass ); 411 414 isLiteral = false; 412 415 return true; … … 670 673 //要求タイプがオブジェクト、または未定のとき 671 674 type_stack[sp]=DEF_OBJECT; 672 index_stack[sp]=(LONG_PTR) pobj_DBClass->GetStringClassPtr();675 index_stack[sp]=(LONG_PTR)Smoothie::GetMeta().GetClasses().GetStringClassPtr(); 673 676 bLiteralCalculation=0; 674 677 … … 715 718 } 716 719 else{ 717 index_stack[sp] = (LONG_PTR) pobj_DBClass->GetObjectClassPtr();720 index_stack[sp] = (LONG_PTR)Smoothie::GetMeta().GetClasses().GetObjectClassPtr(); 718 721 } 719 722 bLiteralCalculation = 0; -
trunk/abdev/BasicCompiler_Common/Object.cpp
r131 r182 1 #include <CodeGenerator.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 -
trunk/abdev/BasicCompiler_Common/Overload.cpp
r75 r182 26 26 27 27 char MethodName[VN_SIZE]; 28 if( ! SplitMemberName( name, NULL, MethodName ) ) lstrcpy( MethodName, name );28 if( !CClass::SplitName( name, NULL, MethodName ) ) lstrcpy( MethodName, name ); 29 29 /* 30 30 //メソッドの場合は静的かどうかを調べる -
trunk/abdev/BasicCompiler_Common/PESchedule.h
r75 r182 1 #pragma once 1 2 3 #include <jenga/include/smoothie/Procedure.h> 2 4 3 5 /////////////////////// -
trunk/abdev/BasicCompiler_Common/ParamImpl.cpp
r167 r182 78 78 { 79 79 ParmsNum = 0; 80 foreach( Parameter *pParam, params ){80 BOOST_FOREACH( Parameter *pParam, params ){ 81 81 Parms[ParmsNum]=0; 82 82 ParmsNum++; … … 204 204 for( int level=OVERLOAD_MIN_LEVEL; level<=OVERLOAD_MAX_LEVEL; level++ ){ 205 205 206 foreach( UserProc *pTempUserProc, subs ){206 BOOST_FOREACH( UserProc *pTempUserProc, subs ){ 207 207 208 208 if(EvaluateOverloadScore( level, pTempUserProc->Params(), isEnabledReturnType?pTempUserProc->ReturnType():Type() )){ … … 237 237 238 238 if(!sw){ 239 foreach( UserProc *pTempUserProc, subs ){239 BOOST_FOREACH( UserProc *pTempUserProc, subs ){ 240 240 241 241 //エラーチェック -
trunk/abdev/BasicCompiler_Common/Resource.cpp
r75 r182 1 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 1 3 #include "common.h" 2 4 -
trunk/abdev/BasicCompiler_Common/StrOperation.cpp
r77 r182 1 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 … … 167 169 free(temp); 168 170 } 169 _int8 IsCommandDelimitation(char c){170 if(c=='\n'||c==':'||c=='\0') return 1;171 return 0;172 }173 BOOL IsBlank(char c){174 if(c==' '||c=='\t') return 1;175 return 0;176 }177 int GetOneParameter(const char *Parameter,int pos,char *retAns){178 int i,i2,i3,IsStr;179 for(i=pos,i2=0,IsStr=0;;i++,i2++){180 if(Parameter[i]=='\"') IsStr^=1;181 else if(Parameter[i]=='('&&IsStr==0){182 i3=GetStringInPare(retAns+i2,Parameter+i);183 i+=i3-1;184 i2+=i3-1;185 continue;186 }187 else if(Parameter[i]=='['&&IsStr==0){188 i3=GetStringInBracket(retAns+i2,Parameter+i);189 i+=i3-1;190 i2+=i3-1;191 continue;192 }193 else if(Parameter[i]==','&&IsStr==0){194 retAns[i2]=0;195 i++;196 break;197 }198 199 if(IsCommandDelimitation(Parameter[i])&&IsStr==0200 || Parameter[i] == ')' && IsStr == 0 ){201 retAns[i2]=0;202 break;203 }204 205 retAns[i2]=Parameter[i];206 }207 return i;208 }209 int JumpOneParameter(char *Parameter,int i){210 int i2,IsStr;211 for(i2=0,IsStr=0;;i++,i2++){212 if(Parameter[i]=='\"') IsStr^=1;213 else if(Parameter[i]=='('&&IsStr==0){214 i=JumpStringInPare(Parameter,i+1);215 continue;216 }217 else if(Parameter[i]=='['&&IsStr==0){218 i=JumpStringInBracket(Parameter,i+1);219 continue;220 }221 else if(Parameter[i]==','&&IsStr==0){222 i++;223 break;224 }225 if(IsCommandDelimitation(Parameter[i])) break;226 }227 return i;228 }229 int GetStringInQuotation(char *buffer,char *ReadBuffer){230 int i;231 232 if(ReadBuffer[0]=='\"'){233 buffer[0]=ReadBuffer[0];234 i=1;235 }236 else i=0;237 238 for(;;i++){239 buffer[i]=ReadBuffer[i];240 if(IsDBCSLeadByte(ReadBuffer[i])){241 i++;242 buffer[i]=ReadBuffer[i];243 continue;244 }245 if(ReadBuffer[i]=='\"'){246 i++;247 buffer[i]=0;248 break;249 }250 if(ReadBuffer[i]=='\0') return 0;251 }252 return i;253 }254 int GetStringInPare(char *buffer,const char *ReadBuffer){255 int i,IsStr,PareNum;256 for(i=0,IsStr=0,PareNum=0;;i++){257 buffer[i]=ReadBuffer[i];258 if(IsDBCSLeadByte(ReadBuffer[i])){259 i++;260 buffer[i]=ReadBuffer[i];261 continue;262 }263 if(ReadBuffer[i]=='\"') IsStr^=1;264 else if(ReadBuffer[i]=='('&&IsStr==0) PareNum++;265 else if(ReadBuffer[i]==')'&&IsStr==0){266 PareNum--;267 if(PareNum==0){268 i++;269 buffer[i]=0;270 break;271 }272 }273 else if(ReadBuffer[i]=='\0') return 0;274 }275 return i;276 }277 int GetStringInPare_RemovePare(char *buffer,char *ReadBuffer){278 int i,IsStr,PareNum;279 for(i=0,IsStr=0,PareNum=1;;i++){280 buffer[i]=ReadBuffer[i];281 if(IsDBCSLeadByte(ReadBuffer[i])){282 i++;283 buffer[i]=ReadBuffer[i];284 continue;285 }286 if(ReadBuffer[i]=='\"') IsStr^=1;287 else if(ReadBuffer[i]=='('&&IsStr==0) PareNum++;288 else if(ReadBuffer[i]==')'&&IsStr==0){289 PareNum--;290 if(PareNum==0){291 buffer[i]=0;292 break;293 }294 }295 else if(ReadBuffer[i]=='\0') return 0;296 }297 return i;298 }299 int GetStringInBracket(char *buffer,const char *ReadBuffer){300 int i,IsStr,PareNum;301 for(i=0,IsStr=0,PareNum=0;;i++){302 buffer[i]=ReadBuffer[i];303 if(IsDBCSLeadByte(ReadBuffer[i])){304 i++;305 buffer[i]=ReadBuffer[i];306 continue;307 }308 if(ReadBuffer[i]=='\"') IsStr^=1;309 else if(ReadBuffer[i]=='['&&IsStr==0) PareNum++;310 else if(ReadBuffer[i]==']'&&IsStr==0){311 PareNum--;312 if(PareNum==0){313 i++;314 buffer[i]=0;315 break;316 }317 }318 else if(ReadBuffer[i]=='\0') return 0;319 }320 return i;321 }322 int JumpStringInPare(const char *buffer,int pos){323 int PareNum;324 for(PareNum=1;;pos++){325 if(buffer[pos]=='\"'){326 for(pos++;;pos++){327 if(buffer[pos]=='\"') break;328 }329 continue;330 }331 else if(buffer[pos]=='(') PareNum++;332 else if(buffer[pos]==')'){333 PareNum--;334 if(PareNum==0) return pos;335 }336 else if(buffer[pos]=='\0') break;337 }338 return 0;339 }340 int JumpStringInBracket(const char *buffer,int pos){341 int PareNum;342 for(PareNum=1;;pos++){343 if(buffer[pos]=='\"'){344 for(pos++;;pos++){345 if(buffer[pos]=='\"') break;346 }347 continue;348 }349 else if(buffer[pos]=='[') PareNum++;350 else if(buffer[pos]==']'){351 PareNum--;352 if(PareNum==0) return pos;353 }354 else if(buffer[pos]=='\0') break;355 }356 return 0;357 }358 171 359 172 int GetCpFromLine(int LineNum){ -
trunk/abdev/BasicCompiler_Common/Subroutine.cpp
r169 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 4 #include <ProcedureImpl.h> 5 1 6 #include "../BasicCompiler_Common/common.h" 2 7 … … 83 88 } 84 89 } 85 bool SplitMemberName( const char *desc, char *object, char *member, CClass::RefType &refType ){86 int lastIndex = -1;87 for( int i=0; desc[i]; i++ ){88 if( desc[i] == '(' ){89 i=JumpStringInPare(desc,i+1);90 continue;91 }92 else if( desc[i] == '[' ){93 i=JumpStringInBracket(desc,i+1);94 continue;95 }96 else if(desc[i]=='.'||(desc[i]==1&&desc[i+1]==ESC_PSMEM)){97 lastIndex = i;98 }99 }100 if( lastIndex == -1 ){101 lstrcpy( member, desc );102 return false;103 }104 105 if(desc[lastIndex]=='.'){106 lstrcpy(member,desc+lastIndex+1);107 refType = CClass::Dot;108 }109 else{110 lstrcpy(member,desc+lastIndex+2);111 refType = CClass::Pointer;112 }113 114 if( object ){115 lstrcpy( object, desc );116 object[lastIndex]=0;117 }118 119 return true;120 }121 bool SplitMemberName( const char *desc, char *object, char *member ){122 CClass::RefType dummyRefType;123 return SplitMemberName( desc, object, member, dummyRefType );124 }125 90 126 91 bool CallProc( int kind, const void *pProc, const char *fullCallName, const char *lpszParms, Type &resultType, bool isCallOn ){ … … 199 164 GetVarType(fullCallName,type,false); 200 165 201 ProcPointer *pProcPtr = Smoothie:: meta.procPointers[type.GetIndex()];166 ProcPointer *pProcPtr = Smoothie::GetMeta().GetProcPointers()[type.GetIndex()]; 202 167 resultType = pProcPtr->ReturnType(); 203 168 … … 402 367 403 368 // オブジェクトを生成 404 DllProc *pDllProc = new DllProc ( namespaceScopes, procName, kind, isCdecl, dllFileName, alias );369 DllProc *pDllProc = new DllProcImpl( namespaceScopes, procName, kind, isCdecl, dllFileName, alias ); 405 370 406 371 // パラメータを解析 … … 409 374 410 375 // パラメータのエラーチェック 411 foreach( const Parameter *pParam, pDllProc->Params() ){376 BOOST_FOREACH( const Parameter *pParam, pDllProc->Params() ){ 412 377 if( pParam->IsObject() ){ 413 378 SetError(25,pParam->GetVarName(),nowLine); … … 662 627 663 628 // 名前空間管理 664 NamespaceScopes &namespaceScopes = Smoothie:: Lexical::liveingNamespaceScopes;629 NamespaceScopes &namespaceScopes = Smoothie::Temp::liveingNamespaceScopes; 665 630 namespaceScopes.clear(); 666 631 … … 852 817 } 853 818 854 855 856 ///////////////////////857 // 関数ポインタの管理858 ///////////////////////859 860 int AddProcPtrInfo( const string &typeExpression, int nowLine ){861 DWORD dwProcType = (DWORD)typeExpression[2];862 const string ¶mStr = typeExpression.substr( 3 );863 864 Procedure::Kind kind = Procedure::Sub;865 if( dwProcType == ESC_FUNCTION ){866 kind = Procedure::Function;867 }868 869 ProcPointer *pProcPointer = new ProcPointer( kind );870 871 //buffer[0]は'('となっている872 pProcPointer->SetParamsAndReturnType( paramStr.c_str(), nowLine );873 874 Smoothie::meta.procPointers.push_back( pProcPointer );875 876 return (int)Smoothie::meta.procPointers.size()-1;877 }878 void DeleteProcPtrInfo(void){879 BOOST_FOREACH( ProcPointer *pProcPointer, Smoothie::meta.procPointers ){880 delete pProcPointer;881 }882 883 Smoothie::meta.procPointers.clear();884 }885 886 887 888 819 bool IsNeedProcCompile(){ 889 820 for(int i2=0;i2<MAX_HASH;i2++){ -
trunk/abdev/BasicCompiler_Common/VarList.cpp
r140 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 … … 266 268 extern int MemPos_RWSection; 267 269 268 foreach( Variable *pVar, globalVars ){270 BOOST_FOREACH( Variable *pVar, globalVars ){ 269 271 270 272 //スコープ外の場合は無視 … … 362 364 if(!pUserProc) return; 363 365 364 foreach( Variable *pVar, pUserProc->localVars ){366 BOOST_FOREACH( Variable *pVar, pUserProc->localVars ){ 365 367 366 368 //スコープ外の場合は無視 … … 725 727 726 728 if(pUserProc){ 727 pobj_CompilingClass = pUserProc->GetParentClassPtr();729 Smoothie::Temp::pCompilingClass = pUserProc->GetParentClassPtr(); 728 730 UserProc::CompileStartForUserProc( pUserProc ); 729 731 } -
trunk/abdev/BasicCompiler_Common/VariableOpe.cpp
r159 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 4 #include <LexicalScopingImpl.h> 5 1 6 #include "../BasicCompiler_Common/common.h" 2 7 … … 7 12 #endif 8 13 9 BOOL IsVariableTopChar(char c){10 if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||c=='_') return 1;11 return 0;12 }13 BOOL IsVariableChar(char c){14 if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9')||15 c=='%'||c=='!'||c=='#'||c=='$'||16 c=='_'||c=='.') return 1;17 return 0;18 }19 14 BOOL IsPtrType(int type){ 20 15 if(type==-1) return 0; … … 119 114 return DEF_QWORD; 120 115 case DEF_CHAR: 121 if( isUnicode) return DEF_WORD;116 if( Smoothie::IsUnicode() ) return DEF_WORD; 122 117 return DEF_BYTE; 123 118 } … … 150 145 //文字型 151 146 else if( type == DEF_CHAR ){ 152 if( isUnicode) return sizeof( WORD );147 if( Smoothie::IsUnicode() ) return sizeof( WORD ); 153 148 return sizeof( BYTE ); 154 149 } … … 220 215 if(lpIndex==-1) lstrcpy(name,"VoidPtr"); 221 216 else{ 222 if( Smoothie:: meta.procPointers[lpIndex]->ReturnType().IsNull() )217 if( Smoothie::GetMeta().GetProcPointers()[lpIndex]->ReturnType().IsNull() ) 223 218 lstrcpy(name,"*Sub"); 224 219 else lstrcpy(name,"*Function"); … … 235 230 236 231 Type GetStringTypeInfo(){ 237 Type type( DEF_OBJECT, * pobj_DBClass->GetStringClassPtr() );232 Type type( DEF_OBJECT, *Smoothie::GetMeta().GetClasses().GetStringClassPtr() ); 238 233 return type; 239 234 } … … 248 243 } 249 244 250 /*TODO: 消す 251 bool FormatUseProcReturnObject( const char *term, char *procName, char *parameter, CClass::RefType &refType, char *member ){ 252 int p1 = 0, p2 = 0; 253 254 for( int i=0; term[i]!='\0' ; i++ ){ 255 256 if( term[i] == '[' ){ 257 i = JumpStringInBracket( term, i + 1 ); 258 if( term[i] == '\0' ) break; 259 continue; 260 } 261 if( term[i] == '(' ){ 262 int temp_p = i; 263 i = JumpStringInPare( term, i + 1 ) + 1; 264 if( term[i] == '\0' ) break; 265 if( term[i] == '.' 266 || term[i] == 1 && term[i] == ESC_PSMEM ){ 267 p1 = temp_p; 268 p2 = i; 269 } 270 continue; 271 } 272 } 273 if( !p1 ) return false; 274 275 //メソッド名 276 memcpy( procName, term, p1 ); 277 procName[p1] = 0; 278 279 //パラメータ 280 memcpy( parameter, term + p1 + 1, p2 - p1 - 2 ); 281 parameter[ p2 - p1 - 2 ] = 0; 282 283 //参照タイプ 284 if( term[p2] == '.' ){ 285 refType = CClass::Dot; 286 } 287 else{ 288 refType = CClass::Pointer; 289 p2++; 290 } 291 292 //メンバ 293 lstrcpy( member, term + p2 + 1 ); 294 295 return true; 296 }*/ 245 246 void GetArrange(char *variable,char *variAnswer,int *SubScripts){ 247 extern int cp; 248 int i,i2,i3,i4; 249 double dbl; 250 _int64 i64data; 251 BOOL bBracket; 252 char temporary[VN_SIZE]; 253 254 for(i=0;;i++){ 255 if(variable[i]=='('||variable[i]=='['){ 256 if(variable[i]=='[') bBracket=1; 257 else bBracket=0; 258 259 variAnswer[i]=0; 260 for(i++,i2=0,i3=0;;i++,i2++){ 261 if(variable[i]==','){ 262 temporary[i2]=0; 263 264 Type resultType; 265 if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){ 266 return; 267 } 268 if(resultType.IsReal()){ 269 memcpy(&dbl,&i64data,sizeof(double)); 270 i64data=(_int64)dbl; 271 } 272 273 if(i64data<0){ 274 //error 275 SubScripts[i3]=0; 276 } 277 else SubScripts[i3]=(int)i64data; 278 i3++; 279 i2=-1; 280 continue; 281 } 282 if(variable[i]=='('){ 283 i4=GetStringInPare(temporary+i2,variable+i); 284 i2+=i4-1; 285 i+=i4-1; 286 continue; 287 } 288 if(variable[i]=='['){ 289 i4=GetStringInBracket(temporary+i2,variable+i); 290 i2+=i4-1; 291 i+=i4-1; 292 continue; 293 } 294 if(variable[i]==')'&&bBracket==0|| 295 variable[i]==']'&&bBracket){ 296 temporary[i2]=0; 297 if(i2==0){ 298 SubScripts[i3]=-2; 299 break; 300 } 301 302 Type resultType; 303 if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){ 304 return; 305 } 306 if(resultType.IsReal()){ 307 memcpy(&dbl,&i64data,sizeof(double)); 308 i64data=(_int64)dbl; 309 } 310 311 if(i64data<0){ 312 //error 313 SubScripts[i3]=0; 314 } 315 else SubScripts[i3]=(int)i64data; 316 SubScripts[i3+1]=-1; 317 break; 318 } 319 if(variable[i]=='\"'){ 320 SetError(1,NULL,cp); 321 return; 322 } 323 temporary[i2]=variable[i]; 324 } 325 break; 326 } 327 variAnswer[i]=variable[i]; 328 if(variable[i]=='\0'){ 329 SubScripts[0]=-1; 330 break; 331 } 332 } 333 } 334 297 335 298 336 BOOL GetVarFormatString(char *buffer,char *array,char *array2,char *NestMember,CClass::RefType &refType){ … … 427 465 return i2; 428 466 } 429 void GetArrange(char *variable,char *variAnswer,int *SubScripts){430 extern int cp;431 int i,i2,i3,i4;432 double dbl;433 _int64 i64data;434 BOOL bBracket;435 char temporary[VN_SIZE];436 437 for(i=0;;i++){438 if(variable[i]=='('||variable[i]=='['){439 if(variable[i]=='[') bBracket=1;440 else bBracket=0;441 442 variAnswer[i]=0;443 for(i++,i2=0,i3=0;;i++,i2++){444 if(variable[i]==','){445 temporary[i2]=0;446 447 Type resultType;448 if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){449 return;450 }451 if(resultType.IsReal()){452 memcpy(&dbl,&i64data,sizeof(double));453 i64data=(_int64)dbl;454 }455 456 if(i64data<0){457 //error458 SubScripts[i3]=0;459 }460 else SubScripts[i3]=(int)i64data;461 i3++;462 i2=-1;463 continue;464 }465 if(variable[i]=='('){466 i4=GetStringInPare(temporary+i2,variable+i);467 i2+=i4-1;468 i+=i4-1;469 continue;470 }471 if(variable[i]=='['){472 i4=GetStringInBracket(temporary+i2,variable+i);473 i2+=i4-1;474 i+=i4-1;475 continue;476 }477 if(variable[i]==')'&&bBracket==0||478 variable[i]==']'&&bBracket){479 temporary[i2]=0;480 if(i2==0){481 SubScripts[i3]=-2;482 break;483 }484 485 Type resultType;486 if( !StaticCalculation(true, temporary,0,&i64data,resultType) ){487 return;488 }489 if(resultType.IsReal()){490 memcpy(&dbl,&i64data,sizeof(double));491 i64data=(_int64)dbl;492 }493 494 if(i64data<0){495 //error496 SubScripts[i3]=0;497 }498 else SubScripts[i3]=(int)i64data;499 SubScripts[i3+1]=-1;500 break;501 }502 if(variable[i]=='\"'){503 SetError(1,NULL,cp);504 return;505 }506 temporary[i2]=variable[i];507 }508 break;509 }510 variAnswer[i]=variable[i];511 if(variable[i]=='\0'){512 SubScripts[0]=-1;513 break;514 }515 }516 }517 518 int GetTypeFromSimpleName(char *variable){519 extern char DefIntVari[26],DefSngVari[26],DefStrVari[26],divNum,dsvNum,dStrvNum;520 int i;521 char name[VN_SIZE];522 523 //構造体メンバの場合を考慮524 for(i=lstrlen(variable);i>0;i--){525 if(variable[i]=='.'){526 i++;527 break;528 }529 }530 531 for(;;i++){532 if(variable[i]=='('||variable[i]=='\0'){533 name[i]=0;534 break;535 }536 name[i]=variable[i];537 }538 //変数名から選択539 i--;540 if(name[i]=='#') return DEF_DOUBLE;541 if(name[i]=='!') return DEF_SINGLE;542 if(name[i]=='%') return DEF_INTEGER;543 return DEF_DOUBLE;544 }545 467 546 468 … … 571 493 572 494 //アクセシビリティをチェック 573 if( &objClass == pobj_CompilingClass ){495 if( &objClass == Smoothie::Temp::pCompilingClass ){ 574 496 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 575 497 if( pMember->IsNoneAccess() ){ … … 645 567 // 名前空間を分離 646 568 char namespaceStr[VN_SIZE]="", simpleName[VN_SIZE]; 647 Smoothie:: meta.namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName );569 Smoothie::GetMeta().namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName ); 648 570 649 571 // 先頭オブジェクトまたはクラス名と入れ子メンバに分割 … … 675 597 } 676 598 677 if( pobj_CompilingClass){599 if(Smoothie::Temp::pCompilingClass){ 678 600 /////////////////////// 679 601 // クラスメンバの参照 … … 682 604 if(lstrcmpi(variable,"This")==0){ 683 605 //Thisオブジェクト 684 resultType.SetType( DEF_OBJECT, pobj_CompilingClass );606 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass ); 685 607 return true; 686 608 } … … 695 617 696 618 bool isFound = false; 697 BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){619 BOOST_FOREACH( CMember *pMember, Smoothie::Temp::pCompilingClass->GetDynamicMembers() ){ 698 620 if( pMember->GetName() == VarName ){ 699 621 isFound = true; … … 704 626 } 705 627 706 return GetMemberType(* pobj_CompilingClass,variable,resultType,1,isErrorEnabled);628 return GetMemberType(*Smoothie::Temp::pCompilingClass,variable,resultType,1,isErrorEnabled); 707 629 } 708 630 … … 738 660 } 739 661 740 int typeDefIndex = Smoothie:: meta.typeDefs.GetIndex( VarName );662 int typeDefIndex = Smoothie::GetMeta().typeDefs.GetIndex( VarName ); 741 663 if( typeDefIndex != -1 ){ 742 664 // TypeDef後の型名だったとき 743 lstrcpy( VarName, Smoothie:: meta.typeDefs[typeDefIndex].GetBaseName().c_str() );665 lstrcpy( VarName, Smoothie::GetMeta().typeDefs[typeDefIndex].GetBaseName().c_str() ); 744 666 } 745 667 … … 755 677 } 756 678 757 if( pobj_CompilingClass){679 if(Smoothie::Temp::pCompilingClass){ 758 680 //自身のクラスから静的メンバを参照する場合 759 681 char temp2[VN_SIZE]; 760 sprintf(temp2,"%s.%s", pobj_CompilingClass->GetName().c_str(),VarName);682 sprintf(temp2,"%s.%s",Smoothie::Temp::pCompilingClass->GetName().c_str(),VarName); 761 683 762 684 pVar = globalVars.Find( Symbol( temp2 ) ); … … 972 894 if( InitBuf[0] == '\0' ){ 973 895 //As指定も、初期値指定もない場合 974 type.SetBasicType( GetTypeFromSimpleName(variable) );896 type.SetBasicType( Type::GetBasicTypeFromSimpleName(variable) ); 975 897 976 898 i2=lstrlen(variable)-1; … … 1015 937 1016 938 //クラス名 1017 if( pobj_CompilingClass){1018 lstrcat(FullName, pobj_CompilingClass->GetName().c_str());939 if(Smoothie::Temp::pCompilingClass){ 940 lstrcat(FullName,Smoothie::Temp::pCompilingClass->GetName().c_str()); 1019 941 lstrcat(FullName,"%"); 1020 942 } … … 1052 974 bool isConst = ( dwFlag & DIMFLAG_CONST ) ? true:false; 1053 975 1054 Variable *pVar = new Variable( Smoothie:: Lexical::liveingNamespaceScopes, name, type, isConst );976 Variable *pVar = new Variable( Smoothie::Temp::liveingNamespaceScopes, name, type, isConst ); 1055 977 1056 978 if( SubScripts[0] != -1 ){ … … 1063 985 1064 986 //レキシカルスコープ 1065 pVar->ScopeLevel= obj_LexScopes.GetNowLevel();1066 pVar->ScopeStartAddress= obj_LexScopes.GetStartAddress();987 pVar->ScopeLevel=GetLexicalScopes().GetNowLevel(); 988 pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress(); 1067 989 pVar->bLiving=TRUE; 1068 990 -
trunk/abdev/BasicCompiler_Common/VariableOpe.h
r138 r182 1 1 2 2 3 BOOL IsVariableTopChar(char c);4 BOOL IsVariableChar(char c);5 3 BOOL IsPtrType(int type); 6 4 BOOL IsSignedType(int type); … … 19 17 BOOL CheckVarNameError(char *name,int nowLine); 20 18 int JumpSubScripts(const int *ss); 21 void GetArrange(char *variable,char *variAnswer,int *SubScripts);22 int GetTypeFromSimpleName(char *variable);23 19 bool GetMemberType( const CClass &objClass, const char *lpszMember, Type &resultType, BOOL bPrivateAccess, bool isErrorEnabled); 24 20 bool GetVarType( const char *nameBuffer, Type &resultType, bool isError); -
trunk/abdev/BasicCompiler_Common/WatchList.cpp
r140 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "common.h" 2 4 … … 316 318 GlobalProc *pUserProc = GetSubFromObp(obp_Rip); 317 319 318 foreach( Variable *pVar, pUserProc->localVars ){320 BOOST_FOREACH( Variable *pVar, pUserProc->localVars ){ 319 321 if( pVar->GetName() == "_System_LocalThis" ){ 320 322 return pVar->offset; … … 369 371 } 370 372 371 if( pobj_CompilingClass){373 if(Smoothie::Temp::pCompilingClass){ 372 374 /////////////////////// 373 375 // クラスメンバの参照 … … 383 385 384 386 bool isFound = false; 385 BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){387 BOOST_FOREACH( CMember *pMember, Smoothie::Temp::pCompilingClass->GetDynamicMembers() ){ 386 388 if( pMember->GetName() == VarName ){ 387 389 isFound = true; … … 412 414 pRelativeVar->dwKind=VAR_DIRECTMEM; 413 415 414 i3=Debugging_GetMember(* pobj_CompilingClass,variable,pRelativeVar,resultType,1);416 i3=Debugging_GetMember(*Smoothie::Temp::pCompilingClass,variable,pRelativeVar,resultType,1); 415 417 if(i3==0){ 416 418 //式エラー -
trunk/abdev/BasicCompiler_Common/calculation.cpp
r128 r182 1 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 -
trunk/abdev/BasicCompiler_Common/common.h
r167 r182 19 19 #include <boost/foreach.hpp> 20 20 21 #define foreach BOOST_FOREACH22 23 21 using namespace std; 24 22 … … 39 37 #include "../BasicCompiler_Common/psapi.h" 40 38 #include "../BasicCompiler_Common/BreakPoint.h" 41 #include "../BasicCompiler_Common/LexicalScoping.h"42 39 43 40 … … 56 53 57 54 #define MAX_LEN 65535 58 #define VN_SIZE 51259 55 #define DIGIT_SIZE 128 60 56 #define MAX_PARMS 64 … … 91 87 extern HANDLE hHeap; 92 88 extern int cp; 93 extern bool isUnicode;94 89 extern int typeOfPtrChar; 95 90 extern int typeOfPtrUChar; … … 144 139 145 140 146 // クラス管理用のクラス147 #include "Class.h"148 149 141 // 列挙体管理用のクラス 150 142 #include "Enum.h" … … 152 144 // 定数管理用のクラス 153 145 #include "Const.h" 154 155 // 変数管理用のクラス156 #include "Variable.h"157 158 // パラメータ管理用のクラス159 #include "Parameter.h"160 161 // プロシージャ管理用のクラス162 #include "Procedure.h"163 164 // コンパイラが必要とするデータハウス165 #include <Smoothie.h>166 146 167 147 … … 170 150 char *FileName; 171 151 int line; 172 };173 struct INCLUDEFILEINFO{174 char **ppFileNames;175 int FilesNum;176 int LineOfFile[MAX_LEN];177 152 }; 178 153 … … 272 247 #include "../BasicCompiler_Common/DebugSection.h" 273 248 #include "../BasicCompiler_Common/VariableOpe.h" 274 #include <Exception.h>275 249 276 250 … … 388 362 void SlideString(char *str,int slide); 389 363 void SlideBuffer(char *buffer,int length,int slide); 390 _int8 IsCommandDelimitation(char c);391 BOOL IsBlank(char c);392 int GetOneParameter(const char *Parameter,int pos,char *retAns);393 int JumpOneParameter(char *Parameter,int i);394 int GetStringInQuotation(char *buffer,char *ReadBuffer);395 int GetStringInPare(char *buffer,const char *ReadBuffer);396 int GetStringInPare_RemovePare(char *buffer,char *ReadBuffer);397 int GetStringInBracket(char *buffer,const char *ReadBuffer);398 int JumpStringInPare(const char *buffer,int pos);399 int JumpStringInBracket(const char *buffer,int pos);400 364 int GetCpFromLine(int LineNum); 401 365 BOOL GetLineNum(int pos,int *pLine,char *FileName); … … 435 399 int GetProc(char *name,void **ppInfo); 436 400 void SplitObjectName(const char *name,char *ObjectName,int *pRefType); 437 bool SplitMemberName( const char *desc, char *object, char *member, CClass::RefType &refType );438 bool SplitMemberName( const char *desc, char *object, char *member );439 401 bool CallProc( int kind, const void *pProc, const char *fullCallName, const char *lpszParms, Type &resultType, bool isCallOn = true ); 440 402 bool CallPropertyMethod( const char *variable, const char *rightSide, Type &resultType); … … 446 408 void DeleteDeclareInfo(void); 447 409 int AddProcPtrInfo( const string &typeExpression, int nowLine ); 448 void DeleteProcPtrInfo(void);449 410 bool IsNeedProcCompile(); 450 411 … … 452 413 void Opcode_Input(const char *Parameter); 453 414 void Opcode_Print(const char *Parameter,BOOL bWrite); 454 455 //LoopRefCheck.cpp456 class CLoopRefCheck{457 char **names;458 int num;459 void init();460 public:461 CLoopRefCheck();462 ~CLoopRefCheck();463 void add(const char *lpszInheritsClass);464 void del(const char *lpszInheritsClass);465 BOOL check(const CClass &inheritsClass) const;466 };467 extern CLoopRefCheck *pobj_LoopRefCheck;468 469 //DataTable.cpp470 class DataTable{471 void *pdata;472 int size;473 474 public:475 DataTable();476 ~DataTable();477 void Init();478 479 int AddBinary( const void *pdata, int size );480 int Add( _int64 i64data );481 int Add( int i32data );482 int Add( double dbl );483 int Add( float flt );484 int AddString( const char *str, int length );485 int AddString( const char *str );486 487 const void *GetPtr() const;488 int GetSize() const;489 };490 extern DataTable dataTable;491 415 492 416 //error.cpp … … 499 423 500 424 //Compile.cpp 501 void ReallocNativeCodeBuffer();502 425 void GetIdentifierToken( char *token, const char *source, int &pos ); 503 426 int JumpStatement(const char *source, int &pos); -
trunk/abdev/BasicCompiler_Common/error.cpp
r167 r182 1 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 1 3 #include <Program.h> 2 4 -
trunk/abdev/BasicCompiler_Common/hash.cpp
r136 r182 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 … … 38 40 char ObjName[VN_SIZE]; //オブジェクト変数 39 41 char NestMember[VN_SIZE]; //入れ子メンバ 40 bool isObjectMember = SplitMemberName( fullName, ObjName, NestMember );42 bool isObjectMember = CClass::SplitName( fullName, ObjName, NestMember ); 41 43 42 44 //ハッシュ値を取得 … … 71 73 char ObjName[VN_SIZE]; //オブジェクト変数 72 74 char NestMember[VN_SIZE]; //入れ子メンバ 73 bool isObjectMember = SplitMemberName( name, ObjName, NestMember );75 bool isObjectMember = CClass::SplitName( name, ObjName, NestMember ); 74 76 75 77 if(isObjectMember){ … … 80 82 if(lstrcmpi(ObjName,"Super")==0){ 81 83 //クラスメンバ関数内から基底クラスの呼び出し 82 pobj_c= pobj_CompilingClass;84 pobj_c=Smoothie::Temp::pCompilingClass; 83 85 } 84 86 else{ … … 89 91 } 90 92 else{ 91 pobj_c= pobj_DBClass->Find(ObjName);93 pobj_c=Smoothie::GetMeta().GetClasses().Find(ObjName); 92 94 if( pobj_c ){ 93 95 isStatic = true; … … 110 112 111 113 112 if( pobj_CompilingClass){114 if(Smoothie::Temp::pCompilingClass){ 113 115 //自身のオブジェクトのメンバ関数を検索 114 116 115 117 // 静的メソッド 116 pobj_CompilingClass->GetStaticMethods().Enum( name, subs );118 Smoothie::Temp::pCompilingClass->GetStaticMethods().Enum( name, subs ); 117 119 118 120 // 動的メソッド 119 pobj_CompilingClass->GetMethods().Enum( name, subs );121 Smoothie::Temp::pCompilingClass->GetMethods().Enum( name, subs ); 120 122 } 121 123 … … 187 189 188 190 UserProc *GetClassMethod( const char *className, const char *methodName ){ 189 const CClass *pClass = pobj_DBClass->Find( className );191 const CClass *pClass = Smoothie::GetMeta().GetClasses().Find( className ); 190 192 if( pClass ){ 191 193 vector<UserProc *> userProcs; -
trunk/abdev/BasicCompiler_Common/include/option.h
r167 r182 23 23 24 24 // ログ生成しない場合はこの下の行をコメントアウトする 25 #define USE_TRACE25 //#define USE_TRACE 26 26 27 27 // オーバーロードに関するログを生成する
Note:
See TracChangeset
for help on using the changeset viewer.