Changeset 78 in dev for BasicCompiler_Common
- Timestamp:
- Mar 25, 2007, 2:47:49 AM (18 years ago)
- Location:
- BasicCompiler_Common
- Files:
-
- 4 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/BasicCompiler.cpp
r69 r78 540 540 char temporary[1024],temp2[MAX_PATH]; 541 541 542 //MessageBox(0,"starting compiler/debugger","ActiveBasic",MB_OK); 543 542 544 //コモンコントロールを初期化 543 545 InitCommonControls(); -
BasicCompiler_Common/BasicCompiler.h
r75 r78 29 29 DllProc **ppDeclareHash; 30 30 CONSTINFO **ppConstHash; 31 ProcPointer **ppProcPointer;32 int ProcPtrInfoNum;33 31 34 32 ERRORINFO *pErrorInfo; -
BasicCompiler_Common/Class.h
r75 r78 1 #pragma once 2 1 3 #include <vector> 2 4 #include "Type.h" -
BasicCompiler_Common/Compile.cpp
r64 r78 154 154 155 155 case ESC_TYPEDEF: 156 //既に収集済み 156 157 break; 157 158 -
BasicCompiler_Common/DebugMiddleFile.cpp
r76 r78 138 138 // TypeDef情報 139 139 ////////////////// 140 141 extern CDBTypeDef *pobj_DBTypeDef; 142 *(long *)(buffer+i2)=pobj_DBTypeDef->iNum; 143 i2+=sizeof(long); 144 for(i3=0;i3<pobj_DBTypeDef->iNum;i3++){ 145 lstrcpy(buffer+i2,pobj_DBTypeDef->ppobj_TypeDef[i3]->lpszName); 146 i2+=lstrlen(buffer+i2)+1; 147 148 lstrcpy(buffer+i2,pobj_DBTypeDef->ppobj_TypeDef[i3]->lpszBaseName); 140 *(long *)(buffer+i2)=House::typeDefs.size(); 141 i2+=sizeof(long); 142 for(i3=0;i3<(int)House::typeDefs.size();i3++){ 143 lstrcpy(buffer+i2,House::typeDefs[i3].GetNewName().c_str() ); 144 i2+=lstrlen(buffer+i2)+1; 145 146 lstrcpy(buffer+i2,House::typeDefs[i3].GetBaseName().c_str() ); 149 147 i2+=lstrlen(buffer+i2)+1; 150 148 … … 507 505 508 506 //初期化 509 pobj_DBTypeDef=new CDBTypeDef;507 House::typeDefs.clear(); 510 508 511 509 //個数を取得 … … 516 514 i2+=lstrlen(buffer+i2)+1; 517 515 518 pobj_DBTypeDef->add(temp5,buffer+i2); 519 520 i2+=lstrlen(buffer+i2)+1; 521 } 522 523 extern CDBTypeDef *pobj_DBTypeDef; 524 pobj_DBTypeDef=this->pobj_DBTypeDef; 516 House::typeDefs.push_back( TypeDef( temp5, buffer+i2 ) ); 517 518 i2+=lstrlen(buffer+i2)+1; 519 } 525 520 526 521 //定数を取得 … … 954 949 pobj_DBClass=this->pobj_DBClass; 955 950 956 // TypeDef情報957 extern CDBTypeDef *pobj_DBTypeDef;958 pobj_DBTypeDef=this->pobj_DBTypeDef;959 960 951 //定数を取得 961 952 extern CONSTINFO **ppConstHash; -
BasicCompiler_Common/DebugSection.h
r75 r78 34 34 // クラス情報 35 35 CDBClass *pobj_DBClass; 36 37 // TypeDef情報38 CDBTypeDef *pobj_DBTypeDef;39 36 40 37 //定数を取得 -
BasicCompiler_Common/Intermediate_Step2.cpp
r75 r78 185 185 temporary[i2]=buffer[i]; 186 186 } 187 188 //新しい型情報を追加189 pobj_DBTypeDef->add(temporary,"Long");190 187 191 188 if(buffer[i]=='\0'){ … … 379 376 case ESC_TYPEDEF: 380 377 KillStringSpaces(Command+2); 381 AddTypeDefData(Command+2);382 378 break; 383 379 case ESC_DECLARE: -
BasicCompiler_Common/MakeExe.cpp
r76 r78 147 147 ppConstHash=(CONSTINFO **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(CONSTINFO *)); 148 148 */ 149 150 //TypeDef情報を初期化151 pobj_DBTypeDef=new CDBTypeDef();152 149 153 150 //コンパイルダイアログのプログレスバーを上げる … … 212 209 HeapDefaultFree(pLineInfo); 213 210 214 //TypeDef情報を初期化215 delete pobj_DBTypeDef;216 pobj_DBTypeDef=0;217 218 211 //サブルーチン(ユーザー定義)情報のメモリ解放 219 212 extern UserProc **ppSubHash; -
BasicCompiler_Common/ParamImpl.cpp
r77 r78 6 6 #include "../BasicCompiler32/opcode.h" 7 7 #endif 8 9 #define OVERLOAD_MIN_LEVEL 0 10 #define OVERLOAD_MAX_LEVEL 4 11 #define OVERLOAD_LEVEL0 0 // 型調整なし。厳密に等しい 12 #define OVERLOAD_LEVEL1 1 // 型調整なし。整数型/実数型レベルでの同一性チェック 13 #define OVERLOAD_LEVEL2 2 // 型調整あり。厳密に等しい 14 #define OVERLOAD_LEVEL3 3 // 型調整あり。整数型/実数型レベルでの同一性チェック 15 #define OVERLOAD_LEVEL4 4 // 型調整あり。数値型/クラス型レベルでの同一性チェック 8 16 9 17 ParamImpl::ParamImpl(const char *buffer): … … 119 127 120 128 NumOpe_GetType(Parms[i], 121 (level==OVERLOAD_LEVEL0 )? nullParam : param,129 (level==OVERLOAD_LEVEL0 || level == OVERLOAD_LEVEL1)? nullParam : param, 122 130 argType); 123 131 } … … 127 135 128 136 if(argType.GetBasicType()!=param.GetBasicType()){ 129 if( level==OVERLOAD_LEVEL1 || level == OVERLOAD_LEVEL0){137 if( level == OVERLOAD_LEVEL0 || level==OVERLOAD_LEVEL2 ){ 130 138 return false; 131 139 } 132 else if( level==OVERLOAD_LEVEL2){140 else if( level == OVERLOAD_LEVEL1 || level==OVERLOAD_LEVEL3){ 133 141 if(!( 134 IsWholeNumberType(argType.GetBasicType())&&IsWholeNumberType(param.GetBasicType())||135 IsRealNumberType(argType.GetBasicType())&&IsRealNumberType(param.GetBasicType())142 argType.IsWhole()&¶m.IsWhole()|| 143 argType.IsReal()&¶m.IsReal() 136 144 )){ 137 145 return false; 138 146 } 139 147 } 140 else if(level==OVERLOAD_LEVEL 3){141 if(argType. GetBasicType()==DEF_OBJECT||param.GetBasicType()==DEF_OBJECT) return false;148 else if(level==OVERLOAD_LEVEL4){ 149 if(argType.IsObject()||param.IsObject()) return false; 142 150 } 143 151 } -
BasicCompiler_Common/Parameter.h
r77 r78 1 #pragma once 2 1 3 #include "Type.h" 2 3 #ifndef _ACTIVEBASIC_COMPILER_PARAMETER_H4 #define _ACTIVEBASIC_COMPILER_PARAMETER_H5 4 6 5 class Parameter; … … 106 105 } 107 106 }; 108 109 #endif //_ACTIVEBASIC_COMPILER_PARAMETER_H -
BasicCompiler_Common/Procedure.cpp
r77 r78 120 120 Type::StringToType( temporary, type ); 121 121 122 /* 123 TODO: 消す(TypeDef関連の変更) 122 124 if(temporary[0]=='*'&& 123 125 temporary[1]==1&& … … 145 147 else{ 146 148 //TypeDefをする前のベース型を取得 147 GetOriginalTypeName (temporary);148 } 149 GetOriginalTypeName_Old(temporary); 150 }*/ 149 151 150 152 if( type.IsNull() ){ … … 158 160 } 159 161 162 /* 163 TODO: 消す(TypeDef関連の変更) 160 164 if( type.IsProcPtr() ){ 161 165 //関数ポインタの場合 162 166 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine) ); 163 } 167 }*/ 164 168 165 169 Parameter *pParam = new Parameter( name, type, isRef, initValue ); … … 274 278 Type::StringToType( temporary, type ); 275 279 280 /* 281 TODO: 消す(TypeDef関連の変更) 276 282 if(temporary[0]=='*'&& 277 283 temporary[1]==1&& … … 299 305 else{ 300 306 //TypeDefをする前のベース型を取得 301 GetOriginalTypeName (temporary);302 } 307 GetOriginalTypeName_Old(temporary); 308 }*/ 303 309 304 310 if( type.IsNull() ){ … … 312 318 } 313 319 320 /* 321 TODO: 消す(TypeDef関連の変更) 314 322 if( type.IsProcPtr() ){ 315 323 //関数ポインタの場合 316 324 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine) ); 317 } 325 }*/ 318 326 319 327 Parameter *pParam = new Parameter( name, type, isRef ); … … 527 535 Type::StringToType( temporary, type ); 528 536 537 /* 538 TODO: 消す(TypeDef関連の変更) 529 539 if(temporary[0]=='*'&& 530 540 temporary[1]==1&& … … 552 562 else{ 553 563 //TypeDefをする前のベース型を取得 554 GetOriginalTypeName (temporary);555 } 564 GetOriginalTypeName_Old(temporary); 565 }*/ 556 566 557 567 if( type.IsNull() ){ … … 565 575 } 566 576 577 /* 578 TODO: 消す(TypeDef関連の変更) 567 579 if( type.IsProcPtr() ){ 568 580 //関数ポインタの場合 569 581 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine ) ); 570 } 582 }*/ 571 583 572 584 Parameter *pParam = new Parameter( name, type, isRef ); … … 731 743 Type::StringToType( temporary, type ); 732 744 745 /* 746 TODO: 消す(TypeDef関連の変更) 733 747 if(temporary[0]=='*'&& 734 748 temporary[1]==1&& … … 756 770 else{ 757 771 //TypeDefをする前のベース型を取得 758 GetOriginalTypeName (temporary);759 } 772 GetOriginalTypeName_Old(temporary); 773 }*/ 760 774 761 775 if( type.IsNull() ){ … … 769 783 } 770 784 785 /* 786 TODO: 消す(TypeDef関連の変更) 771 787 if( type.IsProcPtr() ){ 772 788 //関数ポインタの場合 773 789 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], nowLine ) ); 774 } 790 }*/ 775 791 776 792 Parameter *pParam = new Parameter( name, type, isRef ); -
BasicCompiler_Common/Procedure.h
r76 r78 1 #pragma once 1 2 2 3 class Procedure{ -
BasicCompiler_Common/Subroutine.cpp
r75 r78 180 180 GetVarType(fullCallName,type,false); 181 181 182 extern ProcPointer **ppProcPointer; 183 ProcPointer *pProcPtr = ppProcPointer[type.GetIndex()]; 182 ProcPointer *pProcPtr = House::procPointers[type.GetIndex()]; 184 183 resultType = pProcPtr->ReturnType(); 185 184 … … 768 767 /////////////////////// 769 768 770 int AddProcPtrInfo( char *buffer, DWORD dwProcType, int nowLine ){ 769 int AddProcPtrInfo( const string &typeExpression, int nowLine ){ 770 DWORD dwProcType = (DWORD)typeExpression[2]; 771 const string ¶mStr = typeExpression.substr( 3 ); 771 772 772 773 Procedure::Kind kind = Procedure::Sub; … … 778 779 779 780 //buffer[0]は'('となっている 780 pProcPointer->SetParamsAndReturnType( buffer, nowLine ); 781 782 extern ProcPointer **ppProcPointer; 783 extern int ProcPtrInfoNum; 784 ppProcPointer=(ProcPointer **)HeapReAlloc(hHeap,0,ppProcPointer,(ProcPtrInfoNum+1)*sizeof(ProcPointer *)); 785 ppProcPointer[ProcPtrInfoNum] = pProcPointer; 786 ProcPtrInfoNum++; 787 788 return ProcPtrInfoNum-1; 781 pProcPointer->SetParamsAndReturnType( paramStr.c_str(), nowLine ); 782 783 House::procPointers.push_back( pProcPointer ); 784 785 return House::procPointers.size()-1; 789 786 } 790 787 void DeleteProcPtrInfo(void){ 791 extern ProcPointer **ppProcPointer; 792 extern int ProcPtrInfoNum; 793 794 for(int i=0;i<ProcPtrInfoNum;i++){ 795 delete ppProcPointer[i]; 796 } 797 798 HeapDefaultFree(ppProcPointer); 799 } 788 BOOST_FOREACH( ProcPointer *pProcPointer, House::procPointers ){ 789 delete pProcPointer; 790 } 791 792 House::procPointers.clear(); 793 } -
BasicCompiler_Common/Type.cpp
r77 r78 65 65 //関数ポインタ(*Function) 66 66 type.basicType = DEF_PTR_PROC; 67 type.index = AddProcPtrInfo( typeName, cp ); 67 68 return true; 68 69 } 69 70 70 stringnextTypeName = typeName.substr( 1 );71 const string &nextTypeName = typeName.substr( 1 ); 71 72 72 73 if( !StringToType( nextTypeName, type ) ){ … … 88 89 // TypeDefされた型 89 90 //////////////////// 90 int i= pobj_DBTypeDef->check( typeName.c_str() );91 int i=House::typeDefs.GetIndex( typeName.c_str() ); 91 92 if(i!=-1){ 92 return StringToType( pobj_DBTypeDef->ppobj_TypeDef[i]->lpszBaseName, type ); 93 type = House::typeDefs[i].GetBaseType(); 94 return true; 93 95 } 94 96 … … 461 463 } 462 464 else{ 463 extern ProcPointer **ppProcPointer; 464 if( ppProcPointer[index]->ReturnType().IsNull() ){ 465 if( House::procPointers[index]->ReturnType().IsNull() ){ 465 466 return "*Sub"; 466 467 } -
BasicCompiler_Common/TypeDef.cpp
r46 r78 1 #include " ../BasicCompiler_Common/common.h"1 #include "common.h" 2 2 3 3 4 CDBTypeDef *pobj_DBTypeDef; 5 6 7 CTypeDef::CTypeDef(const char *name,char *base){8 lpszName=(char *)malloc(lstrlen(name)+1);9 lstrcpy(lpszName,name);10 lpszBaseName=(char *)malloc(lstrlen(base)+1);11 lstrcpy(lpszBaseName,base);4 TypeDef::TypeDef( const string &newName, const string &baseName ): 5 newName( newName ), 6 baseName( baseName ) 7 { 8 if( !Type::StringToType( baseName, baseType ) ){ 9 SetError(3, baseName, cp ); 10 return; 11 } 12 12 } 13 CTypeDef::~CTypeDef(){ 14 free(lpszName); 15 free(lpszBaseName); 13 TypeDef::~TypeDef(){ 16 14 } 17 15 18 16 19 CDBTypeDef::CDBTypeDef(){ 20 ppobj_TypeDef=(CTypeDef **)malloc(1); 21 iNum=0; 17 TypeDefCollection::TypeDefCollection(){ 22 18 } 23 CDBTypeDef::~CDBTypeDef(){ 24 init(); 25 free(ppobj_TypeDef); 19 TypeDefCollection::~TypeDefCollection(){ 26 20 } 27 void CDBTypeDef::init(){ 28 int i; 29 for(i=0;i<iNum;i++){ 30 delete ppobj_TypeDef[i]; 31 } 32 iNum=0; 33 } 34 void CDBTypeDef::add(const char *name,char *base){ 35 ppobj_TypeDef=(CTypeDef **)realloc(ppobj_TypeDef,(iNum+1)*sizeof(CTypeDef *)); 36 ppobj_TypeDef[iNum]=new CTypeDef(name,base); 37 iNum++; 21 void TypeDefCollection::Add( const string &newName, const string &baseName ){ 22 TypeDef typeDef( newName, baseName ); 23 this->push_back( typeDef ); 38 24 39 25 26 /* 27 TODO: 消す1 40 28 //////////////////////// 41 29 // 循環参照をチェック … … 43 31 44 32 int i; 45 char temporary[1024]; 46 lstrcpy(temporary,base); 33 string tempName = newName; 47 34 48 35 while(1){ 49 i= check(temporary);36 i=GetIndex( tempName ); 50 37 if(i==-1) break; 51 38 52 if( lstrcmp(base,ppobj_TypeDef[i]->lpszBaseName)==0){39 if( (*this)[i].baseName == newName ){ 53 40 //循環エラー 54 41 extern int cp; … … 56 43 57 44 //不明な型として、Long型を指定しておく 58 ppobj_TypeDef[i]->lpszBaseName=(char *)realloc(ppobj_TypeDef[i]->lpszBaseName,5); 59 lstrcpy(ppobj_TypeDef[i]->lpszBaseName,"Long"); 45 (*this)[i].baseName = "Long"; 60 46 61 47 break; 62 48 } 63 49 64 lstrcpy(temporary,ppobj_TypeDef[i]->lpszBaseName);65 } 50 tempName = (*this)[i].baseName; 51 }*/ 66 52 } 67 int CDBTypeDef::check(const char *name){68 int i;69 for( i=0;i<iNum;i++){70 if( lstrcmp(ppobj_TypeDef[i]->lpszName,name)==0){53 int TypeDefCollection::GetIndex( const string &typeName ) const{ 54 int max = (*this).size(); 55 for( int i=0; i<max; i++ ){ 56 if( (*this)[i].newName == typeName ){ 71 57 return i; 72 58 } … … 75 61 } 76 62 77 78 79 void AddTypeDefData(char *Command){ 80 extern int cp; 63 void TypeDefCollection::Add( const string &expression, int nowLine ){ 81 64 int i; 82 char temporary[VN_SIZE] ,*pTemp;65 char temporary[VN_SIZE]; 83 66 84 67 for(i=0;;i++){ 85 if( Command[i]=='='||Command[i]=='\0'){68 if(expression[i]=='='||expression[i]=='\0'){ 86 69 temporary[i]=0; 87 70 break; 88 71 } 89 temporary[i]= Command[i];72 temporary[i]=expression[i]; 90 73 } 91 74 92 if( Command[i]!='='){93 SetError(10,"TypeDef", cp);75 if(expression[i]!='='){ 76 SetError(10,"TypeDef",nowLine); 94 77 return; 95 78 } 96 79 97 pTemp=Command+i+1;80 const char *pTemp=expression.c_str()+i+1; 98 81 99 82 //識別文字のエラーチェック(新しい型) … … 102 85 if(temporary[i]=='\0') break; 103 86 if(!IsVariableChar(temporary[i])){ 104 SetError(10,"TypeDef", cp);87 SetError(10,"TypeDef",nowLine); 105 88 return; 106 89 } … … 111 94 //関数ポインタ 112 95 if(pTemp[3]!='('){ 113 SetError(10,"TypeDef", cp);96 SetError(10,"TypeDef",nowLine); 114 97 return; 115 98 } … … 121 104 if(pTemp[i]=='\0') break; 122 105 if(!IsVariableChar(pTemp[i])){ 123 SetError(10,"TypeDef", cp);106 SetError(10,"TypeDef",nowLine); 124 107 return; 125 108 } … … 129 112 //識別子が重複している場合はエラーにする 130 113 if(lstrcmp(temporary,pTemp)==0){ 131 SetError(1,NULL, cp);114 SetError(1,NULL,nowLine); 132 115 return; 133 116 } … … 138 121 // TypeDef情報を追加 139 122 ////////////////////////// 140 pobj_DBTypeDef->add(temporary,pTemp); 123 124 //エラー用 125 extern int cp; 126 cp = nowLine; 127 128 House::typeDefs.Add(temporary,pTemp); 141 129 } 130 131 void TypeDefCollection::Init(){ 132 // 初期化 133 clear(); 134 135 int i=-1; 136 while(1){ 137 i++; 138 139 extern char *basbuf; 140 if( basbuf[i]==1 ){ 141 char temporary[VN_SIZE]; 142 if(basbuf[i+1]==ESC_TYPEDEF){ 143 int i2 = 0; 144 for(i+=2;;i2++,i++){ 145 if(basbuf[i]=='\n'){ 146 temporary[i2]=0; 147 break; 148 } 149 temporary[i2]=basbuf[i]; 150 if(basbuf[i]=='\0') break; 151 } 152 Add(temporary,i); 153 154 continue; 155 } 156 else if( basbuf[i+1] == ESC_CONST && basbuf[i+2] == 1 && basbuf[i+3] == ESC_ENUM ){ 157 int i2 = 0; 158 for(i+=4;;i2++,i++){ 159 if(!IsVariableChar(basbuf[i])){ 160 temporary[i2]=0; 161 break; 162 } 163 temporary[i2]=basbuf[i]; 164 if(basbuf[i]=='\0') break; 165 } 166 House::typeDefs.Add(temporary,"Long"); 167 } 168 } 169 170 //次の行 171 for(;;i++){ 172 if(IsCommandDelimitation(basbuf[i])) break; 173 } 174 if(basbuf[i]=='\0') break; 175 } 176 } -
BasicCompiler_Common/TypeDef.h
r46 r78 1 #pragma once 1 2 2 class CTypeDef{ 3 #include <vector> 4 #include <string> 5 6 #include "../Type.h" 7 8 using namespace std; 9 10 class TypeDefCollection; 11 12 class TypeDef{ 13 friend TypeDefCollection; 14 15 string newName; 16 string baseName; 17 Type baseType; 3 18 public: 4 char *lpszName; 5 char *lpszBaseName; 6 CTypeDef(const char *name,char *base); 7 ~CTypeDef(); 19 TypeDef( const string &newName, const string &baseName ); 20 ~TypeDef(); 21 22 const string &GetNewName(){ 23 return newName; 24 } 25 const string &GetBaseName(){ 26 return baseName; 27 } 28 const Type &GetBaseType(){ 29 return baseType; 30 } 8 31 }; 9 32 10 class CDBTypeDef{ 33 class TypeDefCollection : public vector<TypeDef> 34 { 11 35 public: 12 CTypeDef **ppobj_TypeDef; 13 int iNum; 14 CDBTypeDef(); 15 ~CDBTypeDef(); 36 TypeDefCollection(); 37 ~TypeDefCollection(); 16 38 17 void init(); 39 void Add( const string &newName, const string &baseName ); 40 int GetIndex( const string &typeName ) const; 18 41 19 void add(const char *name,char *base); 20 int check(const char *name); 42 private: 43 void Add( const string &expression, int nowLine ); 44 public: 45 void Init(); 21 46 }; 22 extern CDBTypeDef *pobj_DBTypeDef;23 24 25 void AddTypeDefData(char *Command); -
BasicCompiler_Common/VarList.cpp
r76 r78 29 29 } 30 30 31 sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_OBJECT,( DWORD64)offset);31 sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_OBJECT,(ULONG_PTR)offset); 32 32 lptv->item.iImage=1; 33 33 lptv->item.iSelectedImage=1; … … 40 40 i2=ReadProcessMemory(hDebugProcess,(void *)offset,&pData,sizeof(void *),&accessBytes); 41 41 42 sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_POINTEROFOBJECT,( DWORD64)pData);42 sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_POINTEROFOBJECT,(ULONG_PTR)pData); 43 43 lptv->item.iImage=4; 44 44 lptv->item.iSelectedImage=4; … … 62 62 } 63 63 } 64 if(i2==-1) sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,( DWORD64)pData,(DWORD64)pData);65 else sprintf(lptv->item.pszText,"%s %d(&H%X) \"%s\"",VarName,( DWORD64)pData,(DWORD64)pData,temporary);64 if(i2==-1) sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,(ULONG_PTR)pData,(ULONG_PTR)pData); 65 else sprintf(lptv->item.pszText,"%s %d(&H%X) \"%s\"",VarName,(ULONG_PTR)pData,(ULONG_PTR)pData,temporary); 66 66 } 67 67 else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS); … … 361 361 if(!pUserProc) return; 362 362 363 foreach( Variable *pVar, UserProc::CompilingUserProc().localVars ){363 foreach( Variable *pVar, pUserProc->localVars ){ 364 364 365 365 //スコープ外の場合は無視 … … 413 413 //Thisポインタを取得 414 414 LONG_PTR pThis; 415 const Variable *pVar = UserProc::CompilingUserProc().localVars.Find( "_System_LocalThis" );415 const Variable *pVar = pUserProc->localVars.Find( "_System_LocalThis" ); 416 416 if( !pVar ){ 417 417 return; … … 428 428 pUserProc->GetParentClassPtr()->ppobj_Member[i]->name, 429 429 STRING_ARRAY, 430 ( DWORD64)offset);430 (ULONG_PTR)offset); 431 431 tv.item.iImage=0; 432 432 tv.item.iSelectedImage=0; … … 559 559 for(i3=0;i3<(int)pobj_dti->iProcLevel+1;i3++){ 560 560 for(i2=0;i2<MaxLineInfoNum-1;i2++){ 561 if(( DWORD64)(pLineInfo[i2].TopObp+ImageBase+MemPos_CodeSection)<=pobj_dti->lplpObp[i3]&&562 pobj_dti->lplpObp[i3]<=( DWORD64)(pLineInfo[i2+1].TopObp+ImageBase+MemPos_CodeSection)) break;561 if((ULONG_PTR)(pLineInfo[i2].TopObp+ImageBase+MemPos_CodeSection)<=pobj_dti->lplpObp[i3]&& 562 pobj_dti->lplpObp[i3]<=(ULONG_PTR)(pLineInfo[i2+1].TopObp+ImageBase+MemPos_CodeSection)) break; 563 563 } 564 564 if(i2==MaxLineInfoNum) pobj_dti->lpdwCp[i3]=-1; -
BasicCompiler_Common/VariableOpe.cpp
r76 r78 228 228 //////////////////// 229 229 int i; 230 i= pobj_DBTypeDef->check(TypeName);230 i=House::typeDefs.GetIndex(TypeName); 231 231 if(i!=-1){ 232 return GetTypeFixed(pobj_DBTypeDef->ppobj_TypeDef[i]->lpszBaseName,lpNum); 232 *lpNum = House::typeDefs[i].GetBaseType().GetIndex(); 233 return House::typeDefs[i].GetBaseType().GetBasicType(); 233 234 } 234 235 … … 251 252 return -1; 252 253 } 253 void GetOriginalTypeName(char *buffer){ 254 /* 255 TODO: 消す(TypeDef関連の変更) 256 void GetOriginalTypeName_Old(char *buffer){ 254 257 // TypeDefされた型に対して、オリジナルの型の名前に変更する 255 258 … … 257 260 if(buffer[1]==1&&(buffer[2]==ESC_FUNCTION||buffer[2]==ESC_SUB)) return; 258 261 259 GetOriginalTypeName (buffer+1);262 GetOriginalTypeName_Old(buffer+1); 260 263 return; 261 264 } 262 265 263 266 int i; 264 i= pobj_DBTypeDef->check(buffer);267 i=House::typeDefs.GetIndex(buffer); 265 268 if(i!=-1){ 266 lstrcpy(buffer, pobj_DBTypeDef->ppobj_TypeDef[i]->lpszBaseName);267 GetOriginalTypeName (buffer);268 } 269 } 269 lstrcpy(buffer,House::typeDefs[i].GetBaseName().c_str()); 270 GetOriginalTypeName_Old(buffer); 271 } 272 }*/ 270 273 BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name){ 271 274 if(PTR_LEVEL(type)){ … … 309 312 if(lpIndex==-1) lstrcpy(name,"VoidPtr"); 310 313 else{ 311 extern ProcPointer **ppProcPointer; 312 if( ppProcPointer[lpIndex]->ReturnType().IsNull() ) 314 if( House::procPointers[lpIndex]->ReturnType().IsNull() ) 313 315 lstrcpy(name,"*Sub"); 314 316 else lstrcpy(name,"*Function"); … … 988 990 temporary[i2]=buffer[i]; 989 991 } 992 if(temporary[0]=='*'&& 993 temporary[1]==1&& 994 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){ 995 if(buffer[i]!='('){ 996 SetError(10,temporary,cp); 997 return false; 998 } 999 i3=GetStringInPare(temporary+3,buffer+i); 1000 i+=i3; 1001 i2+=i3; 1002 1003 if(temporary[2]==ESC_FUNCTION&&buffer[i]==1&&buffer[i+1]==ESC_AS){ 1004 temporary[i2++]=buffer[i++]; 1005 temporary[i2++]=buffer[i++]; 1006 for(;;i++,i2++){ 1007 if(!IsVariableChar(buffer[i])){ 1008 temporary[i2]=0; 1009 break; 1010 } 1011 temporary[i2]=buffer[i]; 1012 } 1013 } 1014 } 1015 990 1016 if( !Type::StringToType( temporary, type ) ){ 991 1017 SetError(3,temporary,cp); 992 1018 type.SetBasicType( DEF_LONG ); 993 }994 995 if( type.IsProcPtr() ){996 if(temporary[0]=='*'&&997 temporary[1]==1&&998 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){999 if(buffer[i]!='('){1000 SetError(10,temporary,cp);1001 return false;1002 }1003 i3=GetStringInPare(temporary+3,buffer+i);1004 i+=i3;1005 i2+=i3;1006 1007 if(temporary[2]==ESC_FUNCTION&&buffer[i]==1&&buffer[i+1]==ESC_AS){1008 temporary[i2++]=buffer[i++];1009 temporary[i2++]=buffer[i++];1010 for(;;i++,i2++){1011 if(!IsVariableChar(buffer[i])){1012 temporary[i2]=0;1013 break;1014 }1015 temporary[i2]=buffer[i];1016 }1017 }1018 }1019 else{1020 //TypeDefをする前のベース型を取得1021 GetOriginalTypeName(temporary);1022 }1023 1024 if(temporary[3]!='('){1025 SetError(10,temporary,cp);1026 return false;1027 }1028 1029 //関数ポインタ1030 type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2], cp) );1031 1019 } 1032 1020 -
BasicCompiler_Common/VariableOpe.h
r75 r78 14 14 int GetPtrType(int type); 15 15 int GetTypeFixed(const char *TypeName,LONG_PTR *lpNum); 16 /* 17 TODO: 消す(TypeDef関連の変更) 18 void GetOriginalTypeName_Old(char *buffer); 16 19 void GetOriginalTypeName(char *buffer); 20 */ 17 21 BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name); 18 22 bool FormatUseProcReturnObject( const char *term, char *procName, char *parameter, CClass::RefType &refType, char *member ); -
BasicCompiler_Common/WatchList.cpp
r76 r78 338 338 // ローカル変数 339 339 ///////////////// 340 const Variable *pVar = UserProc::CompilingUserProc().localVars.Find( VarName ); 341 if( pVar ){ 342 //ポインタ変数の場合 343 if( pVar->IsPointer() ){ 344 if( !pVar->IsArray() ){ 345 lstrcpy(lpPtrOffset,array); 346 array[0]=0; 347 } 340 if( UserProc::IsLocalAreaCompiling() ){ 341 const Variable *pVar = UserProc::CompilingUserProc().localVars.Find( VarName ); 342 343 if( pVar ){ 344 //ポインタ変数の場合 345 if( pVar->IsPointer() ){ 346 if( !pVar->IsArray() ){ 347 lstrcpy(lpPtrOffset,array); 348 array[0]=0; 349 } 350 } 351 else{ 352 if(lpPtrOffset[0]) return 0; 353 } 354 355 pRelativeVar->offset = pVar->offset; 356 if( pVar->IsRef() ){ 357 pRelativeVar->dwKind=VAR_REFLOCAL; 358 } 359 else{ 360 pRelativeVar->dwKind=VAR_LOCAL; 361 } 362 resultType = *pVar; 363 isArray = pVar->IsArray(); 364 pSubScripts = pVar->GetSubScriptsPtr(); 365 } 366 } 367 368 if(pobj_CompilingClass){ 369 /////////////////////// 370 // クラスメンバの参照 371 /////////////////////// 372 373 if(memicmp(variable,"This.",5)==0){ 374 //Thisオブジェクトのメンバを参照するとき 375 SlideString(variable+5,-5); 376 lstrcpy(VarName,variable); 348 377 } 349 378 else{ 350 if(lpPtrOffset[0]) return 0; 351 } 352 353 pRelativeVar->offset = pVar->offset; 354 if( pVar->IsRef() ){ 355 pRelativeVar->dwKind=VAR_REFLOCAL; 356 } 357 else{ 358 pRelativeVar->dwKind=VAR_LOCAL; 359 } 360 resultType = *pVar; 361 isArray = pVar->IsArray(); 362 pSubScripts = pVar->GetSubScriptsPtr(); 363 } 364 else{ 365 if(pobj_CompilingClass){ 366 /////////////////////// 367 // クラスメンバの参照 368 /////////////////////// 369 370 if(memicmp(variable,"This.",5)==0){ 371 //Thisオブジェクトのメンバを参照するとき 372 SlideString(variable+5,-5); 373 lstrcpy(VarName,variable); 374 } 375 else{ 376 //クラス内メンバを参照するとき(通常) 377 378 for(i=0;i<pobj_CompilingClass->iMemberNum;i++){ 379 if(lstrcmp(VarName,pobj_CompilingClass->ppobj_Member[i]->name)==0) break; 380 } 381 if(i==pobj_CompilingClass->iMemberNum) goto NonClassMember; 382 } 383 384 ///////////////////////////// 385 // thisポインタを取得 386 387 extern HWND hDebugWnd; 388 i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0); 389 i2=pobj_dti->iProcLevel-i2; 390 391 lpData=Debugging_GetThisPtrOffset(pobj_dti->lplpObp[i2]); 392 if(!lpData){ 393 //式エラー 394 return 0; 395 } 396 lpData+=pobj_dti->lplpSpBase[i2]; 397 if(!ReadProcessMemory(hDebugProcess,(void *)lpData,&pRelativeVar->offset,sizeof(LONG_PTR),&accessBytes)){ 398 //メモリにアクセスできないとき 399 return -1; 400 } 401 402 pRelativeVar->dwKind=VAR_DIRECTMEM; 403 404 i3=Debugging_GetMember(*pobj_CompilingClass,variable,pRelativeVar,resultType,1); 405 if(i3==0){ 406 //式エラー 407 return 0; 408 } 409 if(i3==-1){ 410 //アクセスエラー 411 return -1; 412 } 413 414 return 1; 415 } 379 //クラス内メンバを参照するとき(通常) 380 381 for(i=0;i<pobj_CompilingClass->iMemberNum;i++){ 382 if(lstrcmp(VarName,pobj_CompilingClass->ppobj_Member[i]->name)==0) break; 383 } 384 if(i==pobj_CompilingClass->iMemberNum) goto NonClassMember; 385 } 386 387 ///////////////////////////// 388 // thisポインタを取得 389 390 extern HWND hDebugWnd; 391 i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0); 392 i2=pobj_dti->iProcLevel-i2; 393 394 lpData=Debugging_GetThisPtrOffset(pobj_dti->lplpObp[i2]); 395 if(!lpData){ 396 //式エラー 397 return 0; 398 } 399 lpData+=pobj_dti->lplpSpBase[i2]; 400 if(!ReadProcessMemory(hDebugProcess,(void *)lpData,&pRelativeVar->offset,sizeof(LONG_PTR),&accessBytes)){ 401 //メモリにアクセスできないとき 402 return -1; 403 } 404 405 pRelativeVar->dwKind=VAR_DIRECTMEM; 406 407 i3=Debugging_GetMember(*pobj_CompilingClass,variable,pRelativeVar,resultType,1); 408 if(i3==0){ 409 //式エラー 410 return 0; 411 } 412 if(i3==-1){ 413 //アクセスエラー 414 return -1; 415 } 416 417 return 1; 418 } 416 419 417 420 NonClassMember: 418 421 422 { 419 423 /////////////////// 420 424 // グローバル変数 -
BasicCompiler_Common/calculation.cpp
r76 r78 502 502 503 503 Type tempType; 504 StaticCalculation( true, Parms,BaseType,&i64data,tempType);504 StaticCalculation(enableerror, Parms,BaseType,&i64data,tempType); 505 505 type[pnum] = tempType.GetBasicType(); 506 506 before_index[pnum] = tempType.GetIndex(); -
BasicCompiler_Common/common.h
r77 r78 35 35 #include "../BasicCompiler_Common/BasicFixed.h" 36 36 #include "../BasicCompiler_Common/NonVolatile.h" 37 #include "../BasicCompiler_Common/TypeDef.h"38 37 #include "../BasicCompiler_Common/psapi.h" 39 38 #include "../BasicCompiler_Common/BreakPoint.h" … … 162 161 // プロシージャ管理用のクラス 163 162 #include "Procedure.h" 163 164 // コンパイラが必要とするデータハウス 165 #include <House.h> 164 166 165 167 … … 441 443 void DeleteSubInfo(UserProc **ppSubHash,char **ppMacroNames,int MacroNum); 442 444 void DeleteDeclareInfo(void); 443 int AddProcPtrInfo( c har *buffer, DWORD dwProcType, int nowLine );445 int AddProcPtrInfo( const string &typeExpression, int nowLine ); 444 446 void DeleteProcPtrInfo(void); 445 447
Note:
See TracChangeset
for help on using the changeset viewer.