Changeset 29 in dev for BasicCompiler_Common
- Timestamp:
- Jan 10, 2007, 2:27:58 AM (18 years ago)
- Location:
- BasicCompiler_Common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/Class.cpp
r28 r29 215 215 } 216 216 } 217 void CClass::Inherits( CClass *pInheritsClass ){ 218 int i3; 219 220 //メンバをコピー 221 ppobj_Member=(CMember **)HeapReAlloc( 222 hHeap, 223 0, 224 ppobj_Member, 225 pInheritsClass->iMemberNum*sizeof(CMember *)); 226 iMemberNum=pInheritsClass->iMemberNum; 227 for(i3=0;i3<pInheritsClass->iMemberNum;i3++){ 228 ppobj_Member[i3]=new CMember(pInheritsClass->ppobj_Member[i3]); 229 230 //dwAccess 231 if(pInheritsClass->ppobj_Member[i3]->dwAccess==ACCESS_PRIVATE) 232 ppobj_Member[i3]->dwAccess=ACCESS_NON; 233 else ppobj_Member[i3]->dwAccess=pInheritsClass->ppobj_Member[i3]->dwAccess; 234 } 235 236 //メソッドをコピー 237 ppobj_Method=(CMethod **)HeapReAlloc( 238 hHeap, 239 0, 240 ppobj_Method, 241 pInheritsClass->iMethodNum*sizeof(CMethod *)); 242 iMethodNum=pInheritsClass->iMethodNum; 243 for(i3=0;i3<pInheritsClass->iMethodNum;i3++){ 244 ppobj_Method[i3]=new CMethod(pInheritsClass->ppobj_Method[i3]); 245 246 //dwAccess 247 if(pInheritsClass->ppobj_Method[i3]->dwAccess==ACCESS_PRIVATE) 248 ppobj_Method[i3]->dwAccess=ACCESS_NON; 249 else ppobj_Method[i3]->dwAccess=pInheritsClass->ppobj_Method[i3]->dwAccess; 250 251 //pobj_Inherits 252 // ※継承元のClassIndexをセット(入れ子継承を考慮する) 253 if(pInheritsClass->ppobj_Method[i3]->pobj_InheritsClass==0) 254 ppobj_Method[i3]->pobj_InheritsClass=pInheritsClass; 255 else 256 ppobj_Method[i3]->pobj_InheritsClass= 257 pInheritsClass->ppobj_Method[i3]->pobj_InheritsClass; 258 } 259 260 //仮想関数の数 261 vtbl_num=pInheritsClass->vtbl_num; 262 263 //継承先のクラスをメンバとして保持する 264 pobj_InheritsClass = pInheritsClass; 265 } 217 266 void CClass::AddMember( DWORD dwAccess, bool isConst, char *buffer ){ 218 267 ppobj_Member = (CMember **)HeapReAlloc( hHeap, 0, ppobj_Member, ( iMemberNum + 1 ) * sizeof(CMember *) ); … … 849 898 850 899 //継承元クラスを取得 851 pobj_c->pobj_InheritsClass=check(temporary);852 if( !pobj_c->pobj_InheritsClass){900 CClass *pInheritsClass = check(temporary); 901 if( !pInheritsClass ){ 853 902 SetError(106,temporary,i); 854 903 goto Interface_InheritsError; … … 861 910 } 862 911 863 if( pobj_c->pobj_InheritsClass->ppobj_Member==0){912 if( pInheritsClass->ppobj_Member == 0 ){ 864 913 //継承先が読み取られていないとき 865 914 pobj_LoopRefCheck->add(pobj_c->name); … … 868 917 } 869 918 870 //メンバ変数をコピー 871 pobj_c->ppobj_Member=(CMember **)HeapReAlloc( 872 hHeap, 873 0, 874 pobj_c->ppobj_Member, 875 pobj_c->pobj_InheritsClass->iMemberNum*sizeof(CMember *)); 876 pobj_c->iMemberNum=pobj_c->pobj_InheritsClass->iMemberNum; 877 for(i3=0;i3<pobj_c->pobj_InheritsClass->iMemberNum;i3++){ 878 pobj_c->ppobj_Member[i3]=new CMember(pobj_c->pobj_InheritsClass->ppobj_Member[i3]); 879 880 //dwAccess 881 if(pobj_c->pobj_InheritsClass->ppobj_Member[i3]->dwAccess==ACCESS_PRIVATE) 882 pobj_c->ppobj_Member[i3]->dwAccess=ACCESS_NON; 883 else pobj_c->ppobj_Member[i3]->dwAccess=pobj_c->pobj_InheritsClass->ppobj_Member[i3]->dwAccess; 884 } 885 886 //メンバ関数をコピー 887 pobj_c->ppobj_Method=(CMethod **)HeapReAlloc( 888 hHeap, 889 0, 890 pobj_c->ppobj_Method, 891 pobj_c->pobj_InheritsClass->iMethodNum*sizeof(CMethod *)); 892 pobj_c->iMethodNum=pobj_c->pobj_InheritsClass->iMethodNum; 893 for(i3=0;i3<pobj_c->pobj_InheritsClass->iMethodNum;i3++){ 894 pobj_c->ppobj_Method[i3]=new CMethod(pobj_c->pobj_InheritsClass->ppobj_Method[i3]); 895 896 //dwAccess 897 if(pobj_c->pobj_InheritsClass->ppobj_Method[i3]->dwAccess==ACCESS_PRIVATE) 898 pobj_c->ppobj_Method[i3]->dwAccess=ACCESS_NON; 899 else pobj_c->ppobj_Method[i3]->dwAccess=pobj_c->pobj_InheritsClass->ppobj_Method[i3]->dwAccess; 900 901 //pobj_Inherits 902 // ※継承元のClassIndexをセット(入れ子継承を考慮する) 903 if(pobj_c->pobj_InheritsClass->ppobj_Method[i3]->pobj_InheritsClass==0) 904 pobj_c->ppobj_Method[i3]->pobj_InheritsClass=pobj_c->pobj_InheritsClass; 905 else 906 pobj_c->ppobj_Method[i3]->pobj_InheritsClass= 907 pobj_c->pobj_InheritsClass->ppobj_Method[i3]->pobj_InheritsClass; 908 } 909 910 //仮想関数の数 911 pobj_c->vtbl_num=pobj_c->pobj_InheritsClass->vtbl_num; 919 //継承させる 920 pobj_c->Inherits( pInheritsClass ); 912 921 } 913 922 else{ … … 1039 1048 else dwAccess=ACCESS_PUBLIC; 1040 1049 1041 if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS){ 1042 //継承を行う場合 1043 for(i+=3,i2=0;;i++,i2++){ 1044 if(IsCommandDelimitation(basbuf[i])){ 1045 temporary[i2]=0; 1046 break; 1050 if( lstrcmp( pobj_c->name, "Object" ) == 0 || dwClassType == ESC_TYPE ){ 1051 //継承無し 1052 pobj_c->pobj_InheritsClass=0; 1053 1054 //仮想関数の数を初期化 1055 pobj_c->vtbl_num=0; 1056 } 1057 else{ 1058 if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS){ 1059 //継承を行う場合 1060 for(i+=3,i2=0;;i++,i2++){ 1061 if(IsCommandDelimitation(basbuf[i])){ 1062 temporary[i2]=0; 1063 break; 1064 } 1065 temporary[i2]=basbuf[i]; 1047 1066 } 1048 temporary[i2]=basbuf[i]; 1049 } 1050 1051 if(lstrcmpi(temporary,pobj_c->name)==0){ 1052 SetError(105,temporary,i); 1053 goto InheritsError; 1067 1068 if(lstrcmpi(temporary,pobj_c->name)==0){ 1069 SetError(105,temporary,i); 1070 goto InheritsError; 1071 } 1072 } 1073 else{ 1074 //Objectを継承する 1075 lstrcpy( temporary, "Object" ); 1054 1076 } 1055 1077 1056 1078 //継承元クラスを取得 1057 pobj_c->pobj_InheritsClass=check(temporary);1058 if( !pobj_c->pobj_InheritsClass){1079 CClass *pInheritsClass = check(temporary); 1080 if( !pInheritsClass ){ 1059 1081 SetError(106,temporary,i); 1060 1082 goto InheritsError; … … 1067 1089 } 1068 1090 1069 if( pobj_c->pobj_InheritsClass->ppobj_Member==0){1091 if( pInheritsClass->ppobj_Member == 0 ){ 1070 1092 //継承先が読み取られていないとき 1071 1093 pobj_LoopRefCheck->add(pobj_c->name); … … 1074 1096 } 1075 1097 1076 //メンバをコピー 1077 pobj_c->ppobj_Member=(CMember **)HeapReAlloc( 1078 hHeap, 1079 0, 1080 pobj_c->ppobj_Member, 1081 pobj_c->pobj_InheritsClass->iMemberNum*sizeof(CMember *)); 1082 pobj_c->iMemberNum=pobj_c->pobj_InheritsClass->iMemberNum; 1083 for(i3=0;i3<pobj_c->pobj_InheritsClass->iMemberNum;i3++){ 1084 pobj_c->ppobj_Member[i3]=new CMember(pobj_c->pobj_InheritsClass->ppobj_Member[i3]); 1085 1086 //dwAccess 1087 if(pobj_c->pobj_InheritsClass->ppobj_Member[i3]->dwAccess==ACCESS_PRIVATE) 1088 pobj_c->ppobj_Member[i3]->dwAccess=ACCESS_NON; 1089 else pobj_c->ppobj_Member[i3]->dwAccess=pobj_c->pobj_InheritsClass->ppobj_Member[i3]->dwAccess; 1090 } 1091 1092 //メソッドをコピー 1093 pobj_c->ppobj_Method=(CMethod **)HeapReAlloc( 1094 hHeap, 1095 0, 1096 pobj_c->ppobj_Method, 1097 pobj_c->pobj_InheritsClass->iMethodNum*sizeof(CMethod *)); 1098 pobj_c->iMethodNum=pobj_c->pobj_InheritsClass->iMethodNum; 1099 for(i3=0;i3<pobj_c->pobj_InheritsClass->iMethodNum;i3++){ 1100 pobj_c->ppobj_Method[i3]=new CMethod(pobj_c->pobj_InheritsClass->ppobj_Method[i3]); 1101 1102 //dwAccess 1103 if(pobj_c->pobj_InheritsClass->ppobj_Method[i3]->dwAccess==ACCESS_PRIVATE) 1104 pobj_c->ppobj_Method[i3]->dwAccess=ACCESS_NON; 1105 else pobj_c->ppobj_Method[i3]->dwAccess=pobj_c->pobj_InheritsClass->ppobj_Method[i3]->dwAccess; 1106 1107 //pobj_Inherits 1108 // ※継承元のClassIndexをセット(入れ子継承を考慮する) 1109 if(pobj_c->pobj_InheritsClass->ppobj_Method[i3]->pobj_InheritsClass==0) 1110 pobj_c->ppobj_Method[i3]->pobj_InheritsClass=pobj_c->pobj_InheritsClass; 1111 else 1112 pobj_c->ppobj_Method[i3]->pobj_InheritsClass= 1113 pobj_c->pobj_InheritsClass->ppobj_Method[i3]->pobj_InheritsClass; 1114 } 1115 1116 //仮想関数の数 1117 pobj_c->vtbl_num=pobj_c->pobj_InheritsClass->vtbl_num; 1118 } 1119 else{ 1120 //継承無し 1121 pobj_c->pobj_InheritsClass=0; 1122 1123 //仮想関数の数を初期化 1124 pobj_c->vtbl_num=0; 1098 //継承させる 1099 pobj_c->Inherits( pInheritsClass ); 1125 1100 } 1126 1101 InheritsError: -
BasicCompiler_Common/Class.h
r28 r29 95 95 ~CClass(); 96 96 97 //継承させる 98 void Inherits( CClass *pInheritsClass ); 99 97 100 void AddMember( DWORD dwAccess, bool idConst, char *buffer ); 98 101 void AddStaticMember( DWORD dwAccess, bool isConst, char *buffer, int NowLine ); -
BasicCompiler_Common/Enum.cpp
r4 r29 183 183 } 184 184 185 sprintf(buffer+length,"\t Function ToString() As String\n",parent->TypeName);185 sprintf(buffer+length,"\tOverride Function ToString() As String\n",parent->TypeName); 186 186 length+=lstrlen(buffer+length); 187 187 lstrcpy(buffer+length,"\t\tSelect Case m_Value\n"); -
BasicCompiler_Common/Object.cpp
r20 r29 256 256 extern SUBINFO *pSub_free; 257 257 op_call(pSub_free); 258 259 260 if(bCompilingGlobal){ 261 //ここには来ないハズ 262 SetError(300,NULL,cp); 263 } 258 264 } 259 265 else if(pVar[i3].type==DEF_OBJECT&&pVar[i3].fRef==0){ -
BasicCompiler_Common/Variable.cpp
r27 r29 1080 1080 1081 1081 lstrcpy(pVar->name,name); 1082 pVar->fRef = 0; 1082 1083 if(dwFlag & DIMFLAG_CONST) pVar->bConst = true; 1083 1084 else pVar->bConst = false; -
BasicCompiler_Common/common.h
r28 r29 38 38 39 39 #ifdef _AMD64_ 40 #define VER_INFO "β 9(x64)"40 #define VER_INFO "β10 (x64)" 41 41 #else 42 #define VER_INFO "β 9"42 #define VER_INFO "β10" 43 43 #endif 44 44
Note:
See TracChangeset
for help on using the changeset viewer.