Changeset 137 in dev
- Timestamp:
- Jun 8, 2007, 3:11:47 AM (17 years ago)
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_CallProc.cpp
r135 r137 170 170 // アクセスエラーチェック 171 171 ////////////////////////////// 172 DWORD dwAccess = pMethod->dwAccess;173 172 174 173 if(ObjectName[0]){ … … 176 175 if(pobj_c==pobj_CompilingClass){ 177 176 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 178 if( dwAccess==ACCESS_NON){177 if( pMethod->IsNoneAccess() ){ 179 178 SetError(109,pUserProc->GetName(),cp); 180 179 return false; … … 182 181 } 183 182 else{ 184 if( dwAccess==ACCESS_PRIVATE||185 dwAccess==ACCESS_NON){183 if( pMethod->IsPrivate() 184 || pMethod->IsNoneAccess() ){ 186 185 SetError(109,pUserProc->GetName(),cp); 187 186 return false; 188 187 } 189 if( dwAccess==ACCESS_PROTECTED){188 if( pMethod->IsProtected() ){ 190 189 SetError(110,pUserProc->GetName(),cp); 191 190 return false; … … 195 194 else{ 196 195 //クラス内部からの呼び出し(継承によるACCESS_NONのみをエラーとする) 197 if( dwAccess==ACCESS_NON){196 if( pMethod->IsNoneAccess() ){ 198 197 SetError(109,pUserProc->GetName(),cp); 199 198 return false; -
BasicCompiler32/Compile_Var.cpp
r135 r137 190 190 if(&objClass==pobj_CompilingClass){ 191 191 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 192 if(pMember-> dwAccess==ACCESS_NON){192 if(pMember->IsNoneAccess()){ 193 193 if(isErrorEnabled) SetError(107,VarName,cp); 194 194 return false; … … 196 196 } 197 197 else{ 198 if((bPrivateAccess==0&&pMember-> dwAccess==ACCESS_PRIVATE)||199 pMember-> dwAccess==ACCESS_NON){198 if((bPrivateAccess==0&&pMember->IsPrivate())|| 199 pMember->IsNoneAccess()){ 200 200 if(isErrorEnabled) SetError(107,VarName,cp); 201 201 return false; 202 202 } 203 else if(bPrivateAccess==0&&pMember-> dwAccess==ACCESS_PROTECTED){203 else if(bPrivateAccess==0&&pMember->IsProtected()){ 204 204 if(isErrorEnabled) SetError(108,VarName,cp); 205 205 return false; … … 217 217 } 218 218 219 resultType = *pMember;219 resultType = pMember->GetType(); 220 220 221 221 //ポインタ変数の場合 … … 243 243 if(array[0]){ 244 244 //配列オフセット 245 if(!GetArrayOffset(pMember->SubScripts,array, *pMember)){245 if(!GetArrayOffset(pMember->SubScripts,array,pMember->GetType())){ 246 246 if(isErrorEnabled) SetError(14,member,cp); 247 247 } … … 323 323 isErrorEnabled, 324 324 isWriteAccess, 325 pMember->Get Class(),325 pMember->GetType().GetClass(), 326 326 NestMember, 327 327 pRelativeVar, … … 755 755 756 756 if(!SetInitGlobalData(offset+i3, 757 *objClass.ppobj_Member[i2],757 objClass.ppobj_Member[i2]->GetType(), 758 758 objClass.ppobj_Member[i2]->SubScripts, 759 759 temporary)) return false; … … 891 891 892 892 if(!InitLocalVar(offset+i3, 893 *objClass.ppobj_Member[i2],893 objClass.ppobj_Member[i2]->GetType(), 894 894 objClass.ppobj_Member[i2]->SubScripts, 895 895 temporary)) return false; -
BasicCompiler64/BasicCompiler.vcproj
r135 r137 480 480 > 481 481 <File 482 RelativePath="..\BasicCompiler_Common\include\Member.h"483 >484 </File>485 <File486 RelativePath="..\BasicCompiler_Common\include\Method.h"487 >488 </File>489 <File490 482 RelativePath="..\BasicCompiler_Common\include\Namespace.h" 491 483 > … … 500 492 </File> 501 493 <File 502 RelativePath="..\BasicCompiler_Common\include\Prototype.h"503 >504 </File>505 <File506 494 RelativePath="..\BasicCompiler_Common\Type.h" 507 495 > … … 515 503 > 516 504 </File> 505 <Filter 506 Name="Prototype" 507 > 508 <File 509 RelativePath="..\BasicCompiler_Common\include\Member.h" 510 > 511 </File> 512 <File 513 RelativePath="..\BasicCompiler_Common\include\Method.h" 514 > 515 </File> 516 <File 517 RelativePath="..\BasicCompiler_Common\include\Prototype.h" 518 > 519 </File> 520 </Filter> 517 521 </Filter> 518 522 <Filter -
BasicCompiler64/Compile_CallProc.cpp
r135 r137 175 175 // アクセスエラーチェック 176 176 ////////////////////////////// 177 DWORD dwAccess = pMethod->dwAccess;178 177 179 178 if(ObjectName[0]){ … … 181 180 if(pobj_c==pobj_CompilingClass){ 182 181 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 183 if( dwAccess==ACCESS_NON){182 if( pMethod->IsNoneAccess() ){ 184 183 SetError(109,pUserProc->GetName(),cp); 185 184 return false; … … 187 186 } 188 187 else{ 189 if( dwAccess==ACCESS_PRIVATE||190 dwAccess==ACCESS_NON){188 if( pMethod->IsPrivate() 189 || pMethod->IsNoneAccess() ){ 191 190 SetError(109,pUserProc->GetName(),cp); 192 191 return false; 193 192 } 194 if( dwAccess==ACCESS_PROTECTED){193 if( pMethod->IsProtected() ){ 195 194 SetError(110,pUserProc->GetName(),cp); 196 195 return false; … … 200 199 else{ 201 200 //クラス内部からの呼び出し(継承によるACCESS_NONのみをエラーとする) 202 if( dwAccess==ACCESS_NON){201 if( pMethod->IsNoneAccess() ){ 203 202 SetError(109,pUserProc->GetName(),cp); 204 203 return false; -
BasicCompiler64/Compile_Var.cpp
r135 r137 219 219 if(&objClass==pobj_CompilingClass){ 220 220 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 221 if(pMember-> dwAccess==ACCESS_NON){221 if(pMember->IsNoneAccess()){ 222 222 if(isErrorEnabled) SetError(107,VarName,cp); 223 223 return false; … … 225 225 } 226 226 else{ 227 if((bPrivateAccess==0&&pMember-> dwAccess==ACCESS_PRIVATE)||228 pMember-> dwAccess==ACCESS_NON){227 if((bPrivateAccess==0&&pMember->IsPrivate())|| 228 pMember->IsNoneAccess()){ 229 229 if(isErrorEnabled) SetError(107,VarName,cp); 230 230 return false; 231 231 } 232 else if(bPrivateAccess==0&&pMember-> dwAccess==ACCESS_PROTECTED){232 else if(bPrivateAccess==0&&pMember->IsProtected()){ 233 233 if(isErrorEnabled) SetError(108,VarName,cp); 234 234 return false; … … 246 246 } 247 247 248 resultType = *pMember;248 resultType = pMember->GetType(); 249 249 250 250 //ポインタ変数の場合 … … 273 273 if(array[0]){ 274 274 //配列オフセット 275 if(!GetArrayOffset(pMember->SubScripts,array, *pMember)){275 if(!GetArrayOffset(pMember->SubScripts,array,pMember->GetType())){ 276 276 if(isErrorEnabled) SetError(14,member,cp); 277 277 } … … 352 352 isErrorEnabled, 353 353 isWriteAccess, 354 pMember->Get Class(),354 pMember->GetType().GetClass(), 355 355 NestMember, 356 356 pRelativeVar, … … 777 777 778 778 if(!SetInitGlobalData(offset+i3, 779 *objClass.ppobj_Member[i2],779 objClass.ppobj_Member[i2]->GetType(), 780 780 objClass.ppobj_Member[i2]->SubScripts, 781 781 temporary)) return false; … … 913 913 914 914 if(!InitLocalVar(offset+i3, 915 *objClass.ppobj_Member[i2],915 objClass.ppobj_Member[i2]->GetType(), 916 916 objClass.ppobj_Member[i2]->SubScripts, 917 917 temporary)) return false; -
BasicCompiler_Common/Class.cpp
r135 r137 165 165 ppobj_Member[iMemberNum]=new CMember( *inheritsClass.ppobj_Member[i3] ); 166 166 167 //dwAccess 168 if(inheritsClass.ppobj_Member[i3]->dwAccess==ACCESS_PRIVATE) 169 ppobj_Member[iMemberNum]->dwAccess=ACCESS_NON; 170 else ppobj_Member[iMemberNum]->dwAccess=inheritsClass.ppobj_Member[i3]->dwAccess; 167 // アクセシビリティ 168 if( inheritsClass.ppobj_Member[i3]->IsPrivate() ){ 169 ppobj_Member[iMemberNum]->SetAccessibility( Prototype::None ); 170 } 171 else{ 172 ppobj_Member[iMemberNum]->SetAccessibility( inheritsClass.ppobj_Member[i3]->GetAccessibility() ); 173 } 171 174 172 175 iMemberNum++; … … 177 180 CMethod *pMethod = new DynamicMethod( *pBaseMethod ); 178 181 179 //dwAccess 180 if(pBaseMethod->dwAccess==ACCESS_PRIVATE) 181 pMethod->dwAccess=ACCESS_NON; 182 else pMethod->dwAccess=pBaseMethod->dwAccess; 182 // アクセシビリティ 183 if(pBaseMethod->GetAccessibility() == Prototype::Private){ 184 pMethod->SetAccessibility( Prototype::None ); 185 } 186 else{ 187 pMethod->SetAccessibility( pBaseMethod->GetAccessibility() ); 188 } 183 189 184 190 //pobj_Inherits … … 221 227 CMethod *pMethod = new DynamicMethod( *pBaseMethod ); 222 228 223 //dwAccess 224 if(pBaseMethod->dwAccess==ACCESS_PRIVATE) 225 pMethod->dwAccess=ACCESS_NON; 226 else pMethod->dwAccess=pBaseMethod->dwAccess; 229 // アクセシビリティ 230 if(pBaseMethod->GetAccessibility() == Prototype::Private){ 231 pMethod->SetAccessibility( Prototype::None ); 232 } 233 else{ 234 pMethod->SetAccessibility( pBaseMethod->GetAccessibility() ); 235 } 227 236 228 237 //pobj_Inherits … … 245 254 return true; 246 255 } 247 void CClass::AddMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer ){256 void CClass::AddMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer ){ 248 257 ppobj_Member = (CMember **)HeapReAlloc( hHeap, 0, ppobj_Member, ( iMemberNum + 1 ) * sizeof(CMember *) ); 249 ppobj_Member[iMemberNum] = new CMember( this, dwAccess, isConst, isRef, buffer );258 ppobj_Member[iMemberNum] = new CMember( this, accessibility, isConst, isRef, buffer ); 250 259 iMemberNum++; 251 260 } 252 void CClass::AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int nowLine ){253 CMember *member = new CMember( this, dwAccess, isConst, isRef, buffer, nowLine );261 void CClass::AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){ 262 CMember *member = new CMember( this, accessibility, isConst, isRef, buffer, nowLine ); 254 263 staticMembers.push_back( member ); 255 264 } … … 326 335 CMember *pMember = ppobj_Member[i]; 327 336 328 i2 = pMember->Get Size();337 i2 = pMember->GetType().GetSize(); 329 338 330 339 //アラインメントを算出 331 340 int member_size; 332 if( pMember-> IsStruct() ){341 if( pMember->GetType().IsStruct() ){ 333 342 //メンバクラスのアラインメントを取得 334 member_size=pMember->Get Class().GetAlignment();343 member_size=pMember->GetType().GetClass().GetAlignment(); 335 344 } 336 345 else{ … … 393 402 CMember *pMember = ppobj_Member[i]; 394 403 395 if(pMember-> IsStruct()){404 if(pMember->GetType().IsStruct()){ 396 405 //メンバクラスのアラインメントを取得 397 member_size=pMember->Get Class().GetAlignment();406 member_size=pMember->GetType().GetClass().GetAlignment(); 398 407 } 399 408 else{ 400 409 //メンバサイズを取得 401 member_size = pMember->Get Size();410 member_size = pMember->GetType().GetSize(); 402 411 } 403 412 … … 837 846 838 847 839 void CDBClass::AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, bool isAbstract,848 void CDBClass::AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract, 840 849 bool isVirtual, bool isOverride, char *buffer, int nowLine){ 841 850 int i,i2; … … 932 941 SetError(127,NULL,nowLine); 933 942 } 934 if(pMethod-> dwAccess!=dwAccess){943 if(pMethod->GetAccessibility() != accessibility ){ 935 944 SetError(128,NULL,nowLine); 936 945 } … … 952 961 953 962 if(bStatic){ 954 pobj_c->staticMethods.AddStatic( pUserProc,dwAccess);963 pobj_c->staticMethods.AddStatic( pUserProc, accessibility ); 955 964 } 956 965 else{ 957 pobj_c->methods.Add(pUserProc, dwAccess, isConst, isAbstract, isVirtual);966 pobj_c->methods.Add(pUserProc, accessibility, isConst, isAbstract, isVirtual); 958 967 } 959 968 } … … 963 972 for(i=0;i<objClass.iMemberNum;i++){ 964 973 const CMember *pMember = objClass.ppobj_Member[i]; 965 if(pMember-> IsStruct()){974 if(pMember->GetType().IsStruct()){ 966 975 //循環参照でないかをチェック 967 if(pobj_LoopRefCheck->check(pMember->Get Class())){976 if(pobj_LoopRefCheck->check(pMember->GetType().GetClass())){ 968 977 extern int cp; 969 SetError(124,pMember->Get Class().GetName(),cp);978 SetError(124,pMember->GetType().GetClass().GetName(),cp); 970 979 return 0; 971 980 } … … 973 982 pobj_LoopRefCheck->add(objClass.GetName().c_str()); 974 983 975 i2=MemberVar_LoopRefCheck(pMember->Get Class());984 i2=MemberVar_LoopRefCheck(pMember->GetType().GetClass()); 976 985 if(bRet==1) bRet=i2; 977 986 … … 986 995 extern char *basbuf; 987 996 int i,i2,i3,sub_address,top_pos; 988 DWORD dwAccess;989 997 char temporary[8192]; 990 998 … … 1140 1148 //メンバ関数を追加 1141 1149 AddMethod(pobj_c, 1142 ACCESS_PUBLIC,//Publicアクセス権1150 Prototype::Public, //Publicアクセス権 1143 1151 0, //Static指定なし 1144 1152 false, //Constではない … … 1212 1220 1213 1221 //アクセス制限の初期値をセット 1214 if(dwClassType==ESC_CLASS) dwAccess=ACCESS_PRIVATE; 1215 else dwAccess=ACCESS_PUBLIC; 1222 Prototype::Accessibility accessibility; 1223 if(dwClassType==ESC_CLASS){ 1224 accessibility = Prototype::Private; 1225 } 1226 else{ 1227 accessibility = Prototype::Public; 1228 } 1216 1229 1217 1230 if( pobj_c->GetName() == "Object" || dwClassType == ESC_TYPE ){ … … 1342 1355 //アクセスを変更 1343 1356 if(lstrcmpi(temporary,"Private")==0){ 1344 dwAccess=ACCESS_PRIVATE;1357 accessibility = Prototype::Private; 1345 1358 continue; 1346 1359 } 1347 1360 if(lstrcmpi(temporary,"Public")==0){ 1348 dwAccess=ACCESS_PUBLIC;1361 accessibility = Prototype::Public; 1349 1362 continue; 1350 1363 } 1351 1364 if(lstrcmpi(temporary,"Protected")==0){ 1352 dwAccess=ACCESS_PROTECTED;1365 accessibility = Prototype::Protected; 1353 1366 continue; 1354 1367 } … … 1359 1372 //静的メンバを追加 1360 1373 cp=i; //エラー用 1361 pobj_c->AddStaticMember( dwAccess, isConst, false, temporary, i);1374 pobj_c->AddStaticMember( accessibility, isConst, false, temporary, i); 1362 1375 } 1363 1376 else{ 1364 1377 //メンバを追加 1365 1378 cp=i; //エラー用 1366 pobj_c->AddMember( dwAccess, isConst, false, temporary );1367 1368 1369 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]-> IsStruct()){1370 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->Get Class().ppobj_Member==0){1379 pobj_c->AddMember( accessibility, isConst, false, temporary ); 1380 1381 1382 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){ 1383 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().ppobj_Member==0){ 1371 1384 //参照先が読み取られていないとき 1372 GetClass_recur(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->Get Class().GetName().c_str());1385 GetClass_recur(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().GetName().c_str()); 1373 1386 } 1374 1387 } 1375 1388 1376 1389 1377 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]-> IsStruct()){1390 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){ 1378 1391 //循環参照のチェック 1379 1392 pobj_LoopRefCheck->add(pobj_c->GetName().c_str()); 1380 if(!MemberVar_LoopRefCheck(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->Get Class())){1393 if(!MemberVar_LoopRefCheck(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass())){ 1381 1394 //エラー回避 1382 pobj_c->ppobj_Member[pobj_c->iMemberNum-1]-> SetBasicType( DEF_PTR_VOID );1395 pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().SetBasicType( DEF_PTR_VOID ); 1383 1396 } 1384 1397 pobj_LoopRefCheck->del(pobj_c->GetName().c_str()); … … 1390 1403 cp=i; //エラー用 1391 1404 AddMethod(pobj_c, 1392 dwAccess,1405 accessibility, 1393 1406 bStatic, 1394 1407 isConst, … … 1466 1479 CMember &member = *objClass.ppobj_Member[i]; 1467 1480 1468 if( member. IsObject() || member.IsPointer() ){1481 if( member.GetType().IsObject() || member.GetType().IsPointer() ){ 1469 1482 if( referenceOffsetsBuffer[0] ){ 1470 1483 lstrcat( referenceOffsetsBuffer, "," ); -
BasicCompiler_Common/Class.h
r135 r137 8 8 #include <Member.h> 9 9 #include "Procedure.h" 10 11 #define ACCESS_NON 012 #define ACCESS_PRIVATE 113 #define ACCESS_PUBLIC 214 #define ACCESS_PROTECTED 315 10 16 11 class CDBClass; … … 88 83 int iAlign; 89 84 90 91 public:92 85 CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name ); 93 86 ~CClass(); … … 130 123 131 124 //メンバ、メソッドの追加 132 void AddMember( DWORD dwAccess, bool idConst, bool isRef, char *buffer );133 void AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int nowLine );125 void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer ); 126 void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ); 134 127 135 128 //重複チェック … … 230 223 231 224 private: 232 void AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, bool isAbstract,225 void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract, 233 226 bool isVirtual, bool isOverride, char *buffer, int nowLine); 234 227 BOOL MemberVar_LoopRefCheck(const CClass &objClass); -
BasicCompiler_Common/DebugMiddleFile.cpp
r135 r137 327 327 i2+=sizeof(long); 328 328 for(i4=0;i4<pobj_c->iMemberNum;i4++){ 329 // 名前 329 330 lstrcpy(buffer+i2,pobj_c->ppobj_Member[i4]->GetName().c_str()); 330 331 i2+=lstrlen(buffer+i2)+1; 331 332 333 // 型 334 *(long *)(buffer+i2)=pobj_c->ppobj_Member[i4]->GetType().GetBasicType(); 335 i2+=sizeof(long); 336 337 // 型の拡張情報 338 SetLpIndex_DebugFile(buffer,&i2,pobj_c->ppobj_Member[i4]->GetType()); 339 340 // アクセシビリティ 341 *(Prototype::Accessibility *)(buffer+i2)=pobj_c->ppobj_Member[i4]->GetAccessibility(); 342 i2+=sizeof(Prototype::Accessibility); 343 332 344 memcpy(buffer+i2,pobj_c->ppobj_Member[i4]->SubScripts,sizeof(int)*MAX_ARRAYDIM); 333 345 i2+=sizeof(int)*MAX_ARRAYDIM; 334 335 //型336 *(long *)(buffer+i2)=pobj_c->ppobj_Member[i4]->GetBasicType();337 i2+=sizeof(long);338 339 //型の拡張情報340 SetLpIndex_DebugFile(buffer,&i2,*pobj_c->ppobj_Member[i4]);341 342 *(long *)(buffer+i2)=pobj_c->ppobj_Member[i4]->dwAccess;343 i2+=sizeof(long);344 346 345 347 //バッファが足りない場合は再確保 … … 354 356 i2+=sizeof(long); 355 357 foreach( const CMethod *pMethod, pobj_c->methods ){ 356 *( long *)(buffer+i2)=pMethod->dwAccess;357 i2+=sizeof( long);358 *(Prototype::Accessibility *)(buffer+i2)=pMethod->GetAccessibility(); 359 i2+=sizeof(Prototype::Accessibility); 358 360 if( pMethod->GetInheritsClassPtr() ){ 359 361 lstrcpy(buffer+i2,pMethod->GetInheritsClassPtr()->GetName().c_str()); … … 372 374 i2+=sizeof(long); 373 375 foreach( CMember *member, pobj_c->staticMembers ){ 376 // 名前 374 377 lstrcpy(buffer+i2,member->GetName().c_str()); 375 378 i2+=lstrlen(buffer+i2)+1; 376 379 380 // 型 381 *(long *)(buffer+i2)=member->GetType().GetBasicType(); 382 i2+=sizeof(long); 383 384 // 型の拡張情報 385 SetLpIndex_DebugFile(buffer,&i2,member->GetType()); 386 387 // アクセシビリティ 388 *(Prototype::Accessibility *)(buffer+i2)=member->GetAccessibility(); 389 i2+=sizeof(Prototype::Accessibility); 390 377 391 memcpy(buffer+i2,member->SubScripts,sizeof(int)*MAX_ARRAYDIM); 378 392 i2+=sizeof(int)*MAX_ARRAYDIM; 379 380 //型381 *(long *)(buffer+i2)=member->GetBasicType();382 i2+=sizeof(long);383 384 //型の拡張情報385 SetLpIndex_DebugFile(buffer,&i2,*member);386 387 *(long *)(buffer+i2)=member->dwAccess;388 i2+=sizeof(long);389 393 390 394 //バッファが足りない場合は再確保 … … 707 711 (CMember **)HeapAlloc(hHeap,0,pobj_c->iMemberNum*sizeof(CMember *)); 708 712 for(i4=0;i4<pobj_c->iMemberNum;i4++){ 709 pobj_c->ppobj_Member[i4]=new CMember(); 710 711 pobj_c->ppobj_Member[i4]->SetName( (char *)(buffer+i2));713 714 // 名前 715 string name = (char *)(buffer+i2); 712 716 i2+=lstrlen(buffer+i2)+1; 717 718 // 型 719 Type type( *(long *)(buffer+i2) ); 720 i2+=sizeof(long); 721 722 // 型の拡張情報 723 GetLpIndex_DebugFile(buffer,&i2,type); 724 725 // アクセシビリティ 726 Prototype::Accessibility accessibility = *(Prototype::Accessibility *)(buffer+i2); 727 i2+=sizeof(Prototype::Accessibility); 728 729 pobj_c->ppobj_Member[i4]=new CMember( accessibility, name, type, false ); 713 730 714 731 memcpy(pobj_c->ppobj_Member[i4]->SubScripts,buffer+i2,sizeof(int)*MAX_ARRAYDIM); 715 732 i2+=sizeof(int)*MAX_ARRAYDIM; 716 717 //型718 Type type( *(long *)(buffer+i2) );719 i2+=sizeof(long);720 721 //型の拡張情報722 GetLpIndex_DebugFile(buffer,&i2,type);723 724 pobj_c->ppobj_Member[i4]->SetType( type.GetBasicType(), type.GetIndex() );725 726 pobj_c->ppobj_Member[i4]->dwAccess=*(long *)(buffer+i2);727 i2+=sizeof(long);728 733 } 729 734 … … 733 738 for( i4=0; i4<nMethod; i4++ ){ 734 739 735 DWORD dwAccess=*(long*)(buffer+i2);736 i2+=sizeof( long);740 Prototype::Accessibility accessibility=*(Prototype::Accessibility *)(buffer+i2); 741 i2+=sizeof(Prototype::Accessibility); 737 742 738 743 char szInherits[VN_SIZE]; … … 758 763 } 759 764 760 CMethod *pMethod = new DynamicMethod( pUserProc, dwAccess, 0,0,false, pobj_InheritsClass);765 CMethod *pMethod = new DynamicMethod( pUserProc, accessibility, 0,0,false, pobj_InheritsClass); 761 766 762 767 pobj_c->methods.push_back( pMethod ); … … 767 772 i2+=sizeof(long); 768 773 for( i4=0; i4<nStaticMember; i4++ ){ 769 CMember *member=new CMember(); 770 771 member->SetName( (char *)(buffer+i2) ); 774 // 名前 775 string name = (char *)(buffer+i2); 772 776 i2+=lstrlen(buffer+i2)+1; 777 778 // 型 779 Type type( *(long *)(buffer+i2) ); 780 i2+=sizeof(long); 781 782 // 型の拡張情報 783 GetLpIndex_DebugFile(buffer,&i2,type); 784 785 // アクセシビリティ 786 Prototype::Accessibility accessibility = *(Prototype::Accessibility *)(buffer+i2); 787 i2+=sizeof(Prototype::Accessibility); 788 789 CMember *member=new CMember( accessibility, name, type, false ); 773 790 774 791 memcpy(member->SubScripts,buffer+i2,sizeof(int)*MAX_ARRAYDIM); 775 792 i2+=sizeof(int)*MAX_ARRAYDIM; 776 777 //型778 Type type( *(long *)(buffer+i2) );779 i2+=sizeof(long);780 781 //型の拡張情報782 GetLpIndex_DebugFile(buffer,&i2,type);783 784 member->SetType( type.GetBasicType(), type.GetIndex() );785 786 member->dwAccess=*(long *)(buffer+i2);787 i2+=sizeof(long);788 793 789 794 pobj_c->staticMembers.push_back( member ); -
BasicCompiler_Common/VarList.cpp
r135 r137 188 188 VarList_Array(hVarTree,hParent, 189 189 pTopOffset+offset, 190 *objClass.ppobj_Member[i],190 objClass.ppobj_Member[i]->GetType(), 191 191 objClass.ppobj_Member[i]->SubScripts); 192 192 } … … 196 196 &tv, 197 197 VarName, 198 *objClass.ppobj_Member[i],198 objClass.ppobj_Member[i]->GetType(), 199 199 pTopOffset+offset); 200 200 } … … 437 437 VarList_Array(hVarTree_This,hParent, 438 438 pThis+offset, 439 *pUserProc->GetParentClassPtr()->ppobj_Member[i],439 pUserProc->GetParentClassPtr()->ppobj_Member[i]->GetType(), 440 440 pUserProc->GetParentClassPtr()->ppobj_Member[i]->SubScripts); 441 441 } … … 443 443 VarList_Insert(hVarTree_This,&tv, 444 444 pUserProc->GetParentClassPtr()->ppobj_Member[i]->GetName().c_str(), 445 *pUserProc->GetParentClassPtr()->ppobj_Member[i],445 pUserProc->GetParentClassPtr()->ppobj_Member[i]->GetType(), 446 446 pThis+offset); 447 447 } -
BasicCompiler_Common/VariableOpe.cpp
r135 r137 571 571 if( &objClass == pobj_CompilingClass ){ 572 572 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 573 if( objClass.ppobj_Member[i]->dwAccess==ACCESS_NON){573 if( objClass.ppobj_Member[i]->IsNoneAccess() ){ 574 574 if(isErrorEnabled) SetError(107,VarName,cp); 575 575 return false; … … 577 577 } 578 578 else{ 579 if(( bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)||580 objClass.ppobj_Member[i]-> dwAccess==ACCESS_NON){579 if(( bPrivateAccess==0 && objClass.ppobj_Member[i]->IsPrivate() )|| 580 objClass.ppobj_Member[i]->IsNoneAccess() ){ 581 581 if(isErrorEnabled) SetError(107,VarName,cp); 582 582 return false; 583 583 } 584 else if( bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PROTECTED){584 else if( bPrivateAccess==0 && objClass.ppobj_Member[i]->IsProtected() ){ 585 585 if(isErrorEnabled) SetError(108,VarName,cp); 586 586 return false; … … 588 588 } 589 589 590 resultType = *objClass.ppobj_Member[i];590 resultType = objClass.ppobj_Member[i]->GetType(); 591 591 592 592 //ポインタ変数の場合 … … 607 607 //入れ子構造の場合 608 608 609 return GetMemberType( objClass.ppobj_Member[i]->Get Class(),609 return GetMemberType( objClass.ppobj_Member[i]->GetType().GetClass(), 610 610 NestMember, 611 611 resultType, -
BasicCompiler_Common/WatchList.cpp
r135 r137 129 129 130 130 //アクセシビリティをチェック 131 if(( bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)||132 objClass.ppobj_Member[i]-> dwAccess==ACCESS_NON){131 if(( bPrivateAccess==0 && objClass.ppobj_Member[i]->IsPrivate() )|| 132 objClass.ppobj_Member[i]->IsNoneAccess() ){ 133 133 return 0; 134 134 } 135 else if(bPrivateAccess==0&&objClass.ppobj_Member[i]-> dwAccess==ACCESS_PROTECTED)135 else if(bPrivateAccess==0&&objClass.ppobj_Member[i]->IsProtected()) 136 136 return 0; 137 137 138 resultType = *objClass.ppobj_Member[i];138 resultType = objClass.ppobj_Member[i]->GetType(); 139 139 140 140 //ポインタ変数の場合 … … 209 209 } 210 210 211 i2=Debugging_GetMember(objClass.ppobj_Member[i]->Get Class(),211 i2=Debugging_GetMember(objClass.ppobj_Member[i]->GetType().GetClass(), 212 212 NestMember, 213 213 pRelativeVar, -
BasicCompiler_Common/include/Member.h
r136 r137 10 10 class CClass; 11 11 12 class CMember : public Type12 class CMember : public MemberPrototype 13 13 { 14 14 string name; 15 Type type; 15 16 bool isConst; 16 17 public: 17 18 int SubScripts[MAX_ARRAYDIM]; 18 19 DWORD dwAccess;20 19 21 20 char *InitBuf; … … 33 32 } 34 33 34 Type GetType() const 35 { 36 return type; 37 } 38 35 39 bool IsConst() 36 40 { … … 38 42 } 39 43 40 CMember() 44 CMember( Prototype::Accessibility accessibility, const string &name, const Type &type, bool isConst ) 45 : MemberPrototype( accessibility ) 46 , name( name ) 47 , type( type ) 48 , isConst( isConst ) 41 49 { 42 50 } 43 CMember( CClass *pobj_c, DWORD access, bool idConst, bool isRef, char *buffer, int nowLine=-1 );51 CMember( CClass *pobj_c, Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine=-1 ); 44 52 CMember( CMember &member ); 45 53 ~CMember(); -
BasicCompiler_Common/include/Method.h
r136 r137 4 4 #include <vector> 5 5 6 #include "../Class.h" 6 7 #include <windows.h> 7 8 … … 12 13 void SetError(); 13 14 14 class CMethod 15 class CMethod : public MemberPrototype 15 16 { 16 17 public: 17 18 UserProc *pUserProc; 18 DWORD dwAccess;19 19 20 CMethod( UserProc *pUserProc, DWORD dwAccess)21 : pUserProc( pUserProc)22 , dwAccess( dwAccess)20 CMethod( UserProc *pUserProc, Prototype::Accessibility accessibility ) 21 : MemberPrototype( accessibility ) 22 , pUserProc( pUserProc ) 23 23 { 24 24 } … … 41 41 42 42 public: 43 DynamicMethod( UserProc *pUserProc, DWORD dwAccess, bool isAbstract, bool isVirtual, bool isConst, const CClass *pInheritsClass = NULL )44 : CMethod( pUserProc, dwAccess)43 DynamicMethod( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isAbstract, bool isVirtual, bool isConst, const CClass *pInheritsClass = NULL ) 44 : CMethod( pUserProc, accessibility ) 45 45 , isAbstract( isAbstract ) 46 46 , isVirtual( isVirtual ) … … 50 50 } 51 51 DynamicMethod( const CMethod &method ) 52 : CMethod( method.pUserProc, method. dwAccess)52 : CMethod( method.pUserProc, method.GetAccessibility() ) 53 53 , isAbstract( method.IsAbstract() ) 54 54 , isVirtual( method.IsVirtual() ) … … 90 90 { 91 91 public: 92 StaticMethod( UserProc *pUserProc, DWORD dwAccess)93 : CMethod( pUserProc, dwAccess)92 StaticMethod( UserProc *pUserProc, Prototype::Accessibility accessibility ) 93 : CMethod( pUserProc, accessibility ) 94 94 { 95 95 } … … 116 116 117 117 //メンバ、メソッドの追加 118 void Add( UserProc *pUserProc, DWORD dwAccess, bool isConst, bool isAbstract, bool isVirtual );119 void AddStatic(UserProc *pUserProc, DWORD dwAccess);118 void Add( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isConst, bool isAbstract, bool isVirtual ); 119 void AddStatic(UserProc *pUserProc,Prototype::Accessibility accessibility); 120 120 121 121 const CMethod *GetMethodPtr( UserProc *pUserProc ) const; -
BasicCompiler_Common/include/Prototype.h
r135 r137 13 13 class Prototype 14 14 { 15 public: 16 enum Accessibility{ 17 None, 18 Private, 19 Protected, 20 Public, 21 }; 22 23 private: 15 24 // 名前空間 16 25 NamespaceScopes namespaceScopes; … … 69 78 70 79 }; 80 81 class MemberPrototype 82 { 83 Prototype::Accessibility accessibility; 84 public: 85 MemberPrototype( Prototype::Accessibility accessibility ) 86 : accessibility( accessibility ) 87 { 88 } 89 90 Prototype::Accessibility GetAccessibility() const 91 { 92 return accessibility; 93 } 94 void SetAccessibility( Prototype::Accessibility accessibility ){ 95 this->accessibility = accessibility; 96 } 97 98 bool IsNoneAccess() const 99 { 100 return ( accessibility == Prototype::None ); 101 } 102 bool IsPrivate() const 103 { 104 return ( accessibility == Prototype::Private ); 105 } 106 bool IsProtected() const 107 { 108 return ( accessibility == Prototype::Protected ); 109 } 110 bool IsPublic() const 111 { 112 return ( accessibility == Prototype::Public ); 113 } 114 }; -
BasicCompiler_Common/src/Member.cpp
r136 r137 7 7 #include <Member.h> 8 8 9 CMember::CMember( CClass *pobj_c, DWORD access, bool isConst, bool isRef, char *buffer, int nowLine ){ 9 CMember::CMember( CClass *pobj_c, Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ) 10 : MemberPrototype( accessibility ) 11 { 10 12 extern int cp; 11 13 … … 14 16 char init_buf[VN_SIZE]; 15 17 char constract_parameter[VN_SIZE]; 16 GetDimentionFormat(buffer,VarName,SubScripts, *this,init_buf,constract_parameter);18 GetDimentionFormat(buffer,VarName,SubScripts,type,init_buf,constract_parameter); 17 19 18 20 //重複チェック … … 23 25 //メンバ名 24 26 name = VarName; 25 26 //アクセス権27 dwAccess=access;28 27 29 28 //定数扱いかどうか … … 41 40 source_code_address=nowLine; 42 41 } 43 CMember::CMember(CMember &member): 44 Type( member ) 42 CMember::CMember(CMember &member) 43 : MemberPrototype( member.GetAccessibility() ) 44 , name( member.GetName() ) 45 , type( member.GetType() ) 46 , isConst( member.IsConst() ) 45 47 { 46 47 //name48 name = member.name;49 50 //定数扱いかどうか51 isConst = member.isConst;52 53 48 //SubScripts 54 49 memcpy(SubScripts,member.SubScripts,MAX_ARRAYDIM*sizeof(int)); … … 84 79 temporary, 85 80 member->SubScripts, 86 *member,81 member->GetType(), 87 82 member->InitBuf, 88 83 member->ConstractParameter, -
BasicCompiler_Common/src/Method.cpp
r136 r137 14 14 } 15 15 16 void Methods::Add( UserProc *pUserProc, DWORD dwAccess, bool isConst, bool isAbstract, bool isVirtual ){17 CMethod *pMethod = new DynamicMethod( pUserProc, dwAccess, isAbstract, isVirtual, isConst );16 void Methods::Add( UserProc *pUserProc,Prototype::Accessibility accessibility, bool isConst, bool isAbstract, bool isVirtual ){ 17 CMethod *pMethod = new DynamicMethod( pUserProc, accessibility, isAbstract, isVirtual, isConst ); 18 18 this->push_back( pMethod ); 19 19 pUserProc->SetMethod( pMethod ); 20 20 } 21 void Methods::AddStatic(UserProc *pUserProc, DWORD dwAccess){22 CMethod *pMethod = new StaticMethod( pUserProc, dwAccess);21 void Methods::AddStatic(UserProc *pUserProc, Prototype::Accessibility accessibility ){ 22 CMethod *pMethod = new StaticMethod( pUserProc, accessibility ); 23 23 this->push_back( pMethod ); 24 24 pUserProc->SetMethod( pMethod );
Note:
See TracChangeset
for help on using the changeset viewer.