Changeset 171 in dev
- Timestamp:
- Jun 19, 2007, 1:58:06 AM (17 years ago)
- Location:
- trunk/jenga
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jenga/include/smoothie/Class.h
r170 r171 2 2 3 3 #include "Prototype.h" 4 #include "Member.h" 5 #include "Method.h" 6 7 class InheritedInterface 8 { 9 CClass *pInterfaceClass; 10 int vtblOffset; 11 public: 12 InheritedInterface( CClass *pInterfaceClass, int vtblOffset ) 13 : pInterfaceClass( pInterfaceClass ) 14 , vtblOffset( vtblOffset ) 15 { 16 } 17 18 CClass &GetInterfaceClass() const{ 19 return *pInterfaceClass; 20 } 21 int GetVtblOffset() const 22 { 23 return vtblOffset; 24 } 25 }; 26 typedef vector<InheritedInterface> Interfaces; 4 27 5 28 class CClass : public Prototype 6 29 { 7 30 public: 8 // メンバの参照方法31 // メンバの参照方法 9 32 enum RefType{ 10 33 Non = 0, // no reference member … … 12 35 Pointer, // obj->member 13 36 }; 37 38 // 型の種類 39 enum ClassType{ 40 Class, 41 Interface, 42 Enum, 43 Delegate, 44 Structure, 45 }; 46 47 private: 48 ClassType classType; 49 50 bool isReady; 51 void Readed(){ 52 isReady = true; 53 } 54 bool IsReady() const{ 55 return isReady; 56 } 57 58 // importされている名前空間 59 NamespaceScopesCollection importedNamespaces; 60 61 // 継承するインターフェイス 62 Interfaces interfaces; 63 64 // Blittable型情報 65 Type blittableType; 66 67 // 動的メンバ 68 Members dynamicMembers; 69 70 // 静的メンバ 71 Members staticMembers; 72 73 // 動的メソッド 74 Methods methods; 75 int ConstructorMemberSubIndex; 76 int DestructorMemberSubIndex; 77 int vtblNum; // 仮想関数の数 78 79 // 静的メソッド 80 Methods staticMethods; 81 82 public: 83 //継承クラスへのポインタ 84 const CClass *pobj_InheritsClass; 85 86 //アラインメント値 87 int iAlign; 88 89 CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name ); 90 ~CClass(); 91 92 const NamespaceScopesCollection &GetImportedNamespaces() const 93 { 94 return importedNamespaces; 95 } 96 97 // インターフェイス 98 bool HasInterfaces() const 99 { 100 return ( interfaces.size() != 0 ); 101 } 102 bool IsInheritsInterface( const CClass *pInterfaceClass ) const; 103 104 // Blittable型 105 bool IsBlittableType() const 106 { 107 return !blittableType.IsNull(); 108 } 109 const Type &GetBlittableType() const 110 { 111 return blittableType; 112 } 113 void SetBlittableType( const Type &type ){ 114 blittableType = type; 115 } 116 117 bool IsClass() const; 118 bool IsInterface() const; 119 bool IsEnum() const; 120 bool IsDelegate() const; 121 bool IsStructure() const; 122 123 //継承させる 124 bool Inherits( const char *inheritNames, int nowLine ); 125 bool InheritsClass( const CClass &inheritsClass, int nowLine ); 126 bool InheritsInterface( const CClass &inheritsClass, int nowLine ); 127 128 //メンバ、メソッドの追加 129 void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer ); 130 void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ); 131 132 //重複チェック 133 BOOL DupliCheckAll(const char *name); 134 BOOL DupliCheckMember(const char *name); 135 136 const Members &GetDynamicMembers() const 137 { 138 return dynamicMembers; 139 } 140 141 const Methods &GetMethods() const 142 { 143 return methods; 144 } 145 const Methods &GetStaticMethods() const 146 { 147 return staticMethods; 148 } 149 150 //デフォルト コンストラクタ メソッドを取得 151 const CMethod *GetConstructorMethod() const; 152 153 //デストラクタ メソッドを取得 154 const CMethod *GetDestructorMethod() const; 155 156 // vtblに存在する仮想関数の数 157 int GetVtblNum() const 158 { 159 return vtblNum; 160 } 161 void SetVtblNum( int vtblNum ) 162 { 163 this->vtblNum = vtblNum; 164 } 165 void AddVtblNum( int vtblNum ) 166 { 167 this->vtblNum += vtblNum; 168 } 169 bool IsExistVirtualFunctions() const 170 { 171 return ( vtblNum > 0 ); 172 } 173 174 // メンバの総合サイズを取得 175 int GetSize() const; 176 177 // メンバのオフセットを取得 178 int GetMemberOffset( const char *memberName, int *pMemberNum = NULL ) const; 179 180 private: 181 // アラインメント値を取得 182 int GetAlignment() const; 183 184 185 //vtbl 186 private: 187 mutable long vtbl_offset; 188 public: 189 int GetFuncNumInVtbl( const UserProc *pUserProc ) const; 190 LONG_PTR GetVtblGlobalOffset(void) const; 191 void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection); 192 bool IsAbstract() const; 193 194 195 //コンストラクタをコンパイルしているかどうかのチェックフラグ 196 private: 197 mutable bool isCompilingConstructor; 198 public: 199 void NotifyStartConstructorCompile() const; 200 void NotifyFinishConstructorCompile() const; 201 bool IsCompilingConstructor() const; 202 203 //デストラクタをコンパイルしているかどうかのチェックフラグ 204 private: 205 mutable bool isCompilingDestructor; 206 public: 207 void NotifyStartDestructorCompile() const; 208 void NotifyFinishDestructorCompile() const; 209 bool IsCompilingDestructor() const; 210 211 212 //自身の派生クラスかどうかを確認 213 bool IsSubClass( const CClass *pClass ) const; 214 215 //自身と等しいまたは派生クラスかどうかを確認 216 bool IsEqualsOrSubClass( const CClass *pClass ) const; 217 218 // 自身と等しいまたは派生クラス、基底クラスかどうかを確認 219 bool IsEqualsOrSubClassOrSuperClass( const CClass &objClass ) const; 220 221 222 //線形リスト用 223 CClass *pobj_NextClass; 224 225 226 static bool SplitName( const char *desc, char *object, char *member, CClass::RefType &refType ){ 227 int lastIndex = -1; 228 for( int i=0; desc[i]; i++ ){ 229 if( desc[i] == '(' ){ 230 i=BasicSource::JumpStringInPare(desc,i+1); 231 continue; 232 } 233 else if( desc[i] == '[' ){ 234 i=BasicSource::JumpStringInBracket(desc,i+1); 235 continue; 236 } 237 else if(desc[i]=='.'||(desc[i]==1&&desc[i+1]==ESC_PSMEM)){ 238 lastIndex = i; 239 } 240 } 241 if( lastIndex == -1 ){ 242 lstrcpy( member, desc ); 243 return false; 244 } 245 246 if(desc[lastIndex]=='.'){ 247 lstrcpy(member,desc+lastIndex+1); 248 refType = CClass::Dot; 249 } 250 else{ 251 lstrcpy(member,desc+lastIndex+2); 252 refType = CClass::Pointer; 253 } 254 255 if( object ){ 256 lstrcpy( object, desc ); 257 object[lastIndex]=0; 258 } 259 260 return true; 261 } 262 static bool SplitName( const char *desc, char *object, char *member ){ 263 CClass::RefType dummyRefType; 264 return SplitName( desc, object, member, dummyRefType ); 265 } 14 266 }; 15 267 -
trunk/jenga/include/smoothie/Member.h
r170 r171 60 60 { 61 61 } 62 CMember( CClass *pobj_c, Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine=-1 ); 63 CMember( CMember &member ); 64 ~CMember(); 62 CMember::CMember(CMember &member) 63 : MemberPrototype( member.GetAccessibility() ) 64 , name( member.GetName() ) 65 , type( member.GetType() ) 66 , isConst( member.IsConst() ) 67 { 68 //SubScripts 69 memcpy(SubScripts,member.SubScripts,MAX_ARRAYDIM*sizeof(int)); 70 71 //ソースコードの位置 72 source_code_address=member.source_code_address; 73 } 74 ~CMember() 75 { 76 } 65 77 static void InitStaticMember(void); 66 67 static bool SplitName( const char *desc, char *object, char *member, CClass::RefType &refType ){68 int lastIndex = -1;69 for( int i=0; desc[i]; i++ ){70 if( desc[i] == '(' ){71 i=BasicSource::JumpStringInPare(desc,i+1);72 continue;73 }74 else if( desc[i] == '[' ){75 i=BasicSource::JumpStringInBracket(desc,i+1);76 continue;77 }78 else if(desc[i]=='.'||(desc[i]==1&&desc[i+1]==ESC_PSMEM)){79 lastIndex = i;80 }81 }82 if( lastIndex == -1 ){83 lstrcpy( member, desc );84 return false;85 }86 87 if(desc[lastIndex]=='.'){88 lstrcpy(member,desc+lastIndex+1);89 refType = CClass::Dot;90 }91 else{92 lstrcpy(member,desc+lastIndex+2);93 refType = CClass::Pointer;94 }95 96 if( object ){97 lstrcpy( object, desc );98 object[lastIndex]=0;99 }100 101 return true;102 }103 static bool SplitName( const char *desc, char *object, char *member ){104 CClass::RefType dummyRefType;105 return SplitName( desc, object, member, dummyRefType );106 }107 78 }; 108 79 typedef std::vector<CMember *> Members; -
trunk/jenga/projects/smoothie/smoothie.vcproj
r170 r171 265 265 > 266 266 <File 267 RelativePath="..\..\src\smoothie\Member.cpp"268 >269 </File>270 <File271 267 RelativePath="..\..\src\smoothie\Method.cpp" 272 268 > -
trunk/jenga/src/smoothie/Prototype.cpp
r170 r171 1 #include <jenga/include/smoothie/Prototype.h>2 #include <jenga/include/smoothie/Member.h>3 1 #include <jenga/include/smoothie/BasicFixed.h> 2 #include <jenga/include/smoothie/Class.h> 4 3 5 4 bool Prototype::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const … … 19 18 char AreaName[VN_SIZE] = ""; //オブジェクト変数 20 19 char NestName[VN_SIZE] = ""; //入れ子メンバ 21 bool isNest = C Member::SplitName( fullName.c_str(), AreaName, NestName );20 bool isNest = CClass::SplitName( fullName.c_str(), AreaName, NestName ); 22 21 23 22 return IsEqualSymbol( NamespaceScopes( AreaName ), NestName ); -
trunk/jenga/src/smoothie/Symbol.cpp
r170 r171 1 1 #include <jenga/include/smoothie/BasicFixed.h> 2 2 #include <jenga/include/smoothie/Symbol.h> 3 #include <jenga/include/smoothie/ Member.h>3 #include <jenga/include/smoothie/Class.h> 4 4 5 5 Symbol::Symbol( const char *fullName ) … … 7 7 char areaName[VN_SIZE] = ""; //オブジェクト変数 8 8 char nestName[VN_SIZE] = ""; //入れ子メンバ 9 bool isNest = C Member::SplitName( fullName, areaName, nestName );9 bool isNest = CClass::SplitName( fullName, areaName, nestName ); 10 10 11 11 namespaceScopes = NamespaceScopes( areaName ); … … 16 16 char areaName[VN_SIZE] = ""; //オブジェクト変数 17 17 char nestName[VN_SIZE] = ""; //入れ子メンバ 18 bool isNest = C Member::SplitName( fullName.c_str(), areaName, nestName );18 bool isNest = CClass::SplitName( fullName.c_str(), areaName, nestName ); 19 19 20 20 namespaceScopes = NamespaceScopes( areaName );
Note:
See TracChangeset
for help on using the changeset viewer.