Changeset 207 for Include/Classes/System/TypeInfo.ab
- Timestamp:
- Apr 7, 2007, 3:03:38 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/TypeInfo.ab
r198 r207 10 10 11 11 Sub TypeInfo() 12 End Sub 13 Sub ~TypeInfo() 12 14 End Sub 13 15 … … 45 47 name As String 46 48 49 Protected 50 47 51 baseType As TypeInfo 48 52 'interfaces As f(^^;;; 49 50 Protected51 53 52 54 Sub TypeBaseImpl() … … 77 79 */ 78 80 81 Sub ~TypeBaseImpl() 82 End Sub 83 79 84 Public 80 85 … … 88 93 End Function 89 94 95 Sub SetBaseType( baseType As TypeInfo ) 96 This.baseType = baseType 97 End Sub 98 90 99 Override Function FullName() As String 91 100 Return strNamespace + "." + name … … 142 151 Public 143 152 Sub _System_TypeForValueType( name As String ) 144 Type Info( "", name )153 TypeBaseImpl( "", name ) 145 154 End Sub 146 155 … … 154 163 Inherits TypeBaseImpl 155 164 Public 156 Sub _System_TypeForClass( strNamespace As String, name As String , baseType As TypeInfo)157 TypeBaseImpl( strNamespace, name , baseType)165 Sub _System_TypeForClass( strNamespace As String, name As String ) 166 TypeBaseImpl( strNamespace, name ) 158 167 End Sub 159 168 Sub ~_System_TypeForClass() … … 162 171 Return True 163 172 End Function 164 165 Sub SetBaseType( baseType As TypeInfo )166 This.baseType = baseType167 End Sub168 173 End Class 169 174 … … 188 193 189 194 '-------------------------------------------------------------------- 190 ' プロセスに存在するすべての型を管理する (シングルトン クラス)195 ' プロセスに存在するすべての型を管理する 191 196 '-------------------------------------------------------------------- 192 197 Class _System_TypeBase 193 pTypes As *TypeInfo 194 count As Long 195 196 Sub _System_TypeBase() 197 pTypes = GC_malloc( 1 ) 198 count = 0 199 End Sub 200 Sub ~_System_TypeBase() 201 End Sub 202 203 Sub Add( typeInfo As TypeInfo ) 198 Static pTypes As *TypeBaseImpl 199 Static count As Long 200 Static isReady = False 201 202 Static Sub Add( typeInfo As TypeBaseImpl ) 204 203 pTypes = realloc( pTypes, ( count + 1 ) * SizeOf(*TypeInfo) ) 205 204 pTypes[count] = typeInfo … … 207 206 End Sub 208 207 209 Function Search( strNamespace As String, typeName As String ) As TypeInfo 208 Static Sub InitializeValueType() 209 ' 値型の追加 210 Add( New _System_TypeForValueType( "Byte" ) ) 211 Add( New _System_TypeForValueType( "SByte" ) ) 212 Add( New _System_TypeForValueType( "Word" ) ) 213 Add( New _System_TypeForValueType( "Integer" ) ) 214 Add( New _System_TypeForValueType( "DWord" ) ) 215 Add( New _System_TypeForValueType( "Long" ) ) 216 Add( New _System_TypeForValueType( "QWord" ) ) 217 Add( New _System_TypeForValueType( "Int64" ) ) 218 Add( New _System_TypeForValueType( "Boolean" ) ) 219 Add( New _System_TypeForValueType( "Single" ) ) 220 Add( New _System_TypeForValueType( "Double" ) ) 221 End Sub 222 223 Static Sub InitializeUserTypes() 224 ' このメソッドの実装はコンパイラが自動生成する 225 226 '例: 227 'Add( New _System_TypeForClass( "System", "String" ) ) 228 'Search( "String" ).SetBaseType( Search( "Object" ) ) 229 End Sub 230 231 Public 232 233 Static Sub Initialize() 234 pTypes = GC_malloc( 1 ) 235 count = 0 236 237 ' 値型を初期化 238 InitializeValueType() 239 240 isReady = True 241 ' Class / Interface / Enum / Delegate を初期化 242 InitializeUserTypes() 243 244 245 OutputDebugString( Ex"ready dynamic meta datas!\r\n" ) 246 End Sub 247 248 Static Sub _NextPointerForGC() 249 ' TODO: 実装 250 End Sub 251 252 Static Function Search( strNamespace As LPSTR, typeName As LPSTR ) As TypeBaseImpl 253 210 254 ' TODO: 名前空間に対応する 211 255 Dim i As Long … … 215 259 End If 216 260 Next 261 217 262 Return Nothing 218 263 End Function 219 264 220 ' シングルトン オブジェクト 221 Static obj As _System_TypeBase 222 223 Static Sub InitializeValueType() 224 ' 値型の追加 225 obj.Add( New _System_TypeForValueType( "Byte" ) ) 226 obj.Add( New _System_TypeForValueType( "SByte" ) ) 227 obj.Add( New _System_TypeForValueType( "Word" ) ) 228 obj.Add( New _System_TypeForValueType( "Integer" ) ) 229 obj.Add( New _System_TypeForValueType( "DWord" ) ) 230 obj.Add( New _System_TypeForValueType( "Long" ) ) 231 obj.Add( New _System_TypeForValueType( "QWord" ) ) 232 obj.Add( New _System_TypeForValueType( "Int64" ) ) 233 obj.Add( New _System_TypeForValueType( "Boolean" ) ) 234 obj.Add( New _System_TypeForValueType( "Single" ) ) 235 obj.Add( New _System_TypeForValueType( "Double" ) ) 236 End Sub 237 238 Static Sub InitializeUserTypes() 239 ' このメソッドの実装はコンパイラが自動生成する 240 241 #generate InitializeUserTypes 242 243 '例: 244 'obj.Add( New _System_TypeForClass( "System", "String" ) ) 245 'obj.Search( "String" ).SetBaseType( Search( "Object" ) ) 246 End Sub 247 248 Public 249 250 Static Sub _NextPointerForGC() 251 ' TODO: 実装 252 End Sub 253 254 Static Sub Initialize() 255 ' 値型を初期化 256 InitializeValueType() 257 258 ' Class / Interface / Enum / Delegate を初期化 259 InitializeUserTypes() 260 End Sub 261 End Class 265 Static Function IsReady() As Boolean 266 Return isReady 267 End Function 268 269 End Class 270 262 271 263 272 ' End Namespace ' System
Note:
See TracChangeset
for help on using the changeset viewer.