[169] | 1 | ' 実装中...
|
---|
| 2 | '(※ まだ組み込んでいません)
|
---|
| 3 |
|
---|
[195] | 4 |
|
---|
| 5 | 'Namespace System
|
---|
| 6 |
|
---|
| 7 |
|
---|
[169] | 8 | Class TypeInfo
|
---|
| 9 | Public
|
---|
| 10 |
|
---|
| 11 | Sub TypeInfo()
|
---|
| 12 | End Sub
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | '----------------------------------------------------------------
|
---|
| 16 | ' Public properties
|
---|
| 17 | '----------------------------------------------------------------
|
---|
| 18 |
|
---|
| 19 | Abstract Function BaseType() As TypeInfo
|
---|
| 20 | Abstract Function FullName() As String
|
---|
| 21 | Abstract Function IsArray() As Boolean
|
---|
| 22 | Abstract Function IsByRef() As Boolean
|
---|
| 23 | Abstract Function IsClass() As Boolean
|
---|
| 24 | Abstract Function IsEnum() As Boolean
|
---|
| 25 | Abstract Function IsInterface() As Boolean
|
---|
| 26 | Abstract Function IsPointer() As Boolean
|
---|
| 27 | Abstract Function IsValueType() As Boolean
|
---|
| 28 | Abstract Function Name() As String
|
---|
| 29 | Abstract Function Namespace() As String
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | '----------------------------------------------------------------
|
---|
| 34 | ' Public methods
|
---|
| 35 | '----------------------------------------------------------------
|
---|
| 36 |
|
---|
| 37 | End Class
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | ' 中間的な実装(継承専用)
|
---|
[195] | 41 | Class TypeBaseImpl
|
---|
[169] | 42 | Inherits TypeInfo
|
---|
| 43 |
|
---|
| 44 | name As String
|
---|
| 45 | strNamespace As String
|
---|
| 46 |
|
---|
[186] | 47 | baseType As TypeInfo
|
---|
[169] | 48 | 'interfaces As f(^^;;;
|
---|
| 49 |
|
---|
| 50 | Protected
|
---|
| 51 |
|
---|
[195] | 52 | Sub TypeBaseImpl()
|
---|
[169] | 53 | name = ""
|
---|
| 54 | strNamespace = ""
|
---|
| 55 | baseType = Nothing
|
---|
| 56 | End Sub
|
---|
| 57 |
|
---|
[195] | 58 | Sub TypeBaseImpl( name As String, strNamespace As String )
|
---|
[169] | 59 | This.name = name
|
---|
| 60 | This.strNamespace = strNamespace
|
---|
[195] | 61 | This.baseType = Nothing
|
---|
[169] | 62 | End Sub
|
---|
| 63 |
|
---|
[195] | 64 | Sub TypeBaseImpl( name As String, strNamespace As String, baseType As TypeInfo )
|
---|
| 65 | This.name = name
|
---|
| 66 | This.strNamespace = strNamespace
|
---|
[169] | 67 | This.baseType = baseType
|
---|
| 68 | End Sub
|
---|
| 69 |
|
---|
| 70 | /*
|
---|
[195] | 71 | Sub TypeBaseImpl( name As String, strNamespace As String, baseType As Type, interfaces As ... )
|
---|
| 72 | TypeBaseImpl( name, strNamespace, baseType )
|
---|
[169] | 73 | End Sub
|
---|
| 74 | */
|
---|
| 75 |
|
---|
| 76 | Public
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | '----------------------------------------------------------------
|
---|
| 80 | ' Public properties
|
---|
| 81 | '----------------------------------------------------------------
|
---|
| 82 |
|
---|
| 83 | Override Function BaseType() As TypeInfo
|
---|
| 84 | Return baseType
|
---|
| 85 | End Function
|
---|
| 86 |
|
---|
| 87 | Override Function FullName() As String
|
---|
| 88 | Return strNamespace + "." + name
|
---|
| 89 | End Function
|
---|
| 90 |
|
---|
| 91 | Override Function IsArray() As Boolean
|
---|
| 92 | Return False
|
---|
| 93 | End Function
|
---|
| 94 |
|
---|
| 95 | Override Function IsByRef() As Boolean
|
---|
| 96 | Return False
|
---|
| 97 | End Function
|
---|
| 98 |
|
---|
| 99 | Override Function IsClass() As Boolean
|
---|
| 100 | Return False
|
---|
| 101 | End Function
|
---|
| 102 |
|
---|
| 103 | Override Function IsEnum() As Boolean
|
---|
| 104 | Return False
|
---|
| 105 | End Function
|
---|
| 106 |
|
---|
| 107 | Override Function IsInterface() As Boolean
|
---|
| 108 | Return False
|
---|
| 109 | End Function
|
---|
| 110 |
|
---|
| 111 | Override Function IsPointer() As Boolean
|
---|
| 112 | Return False
|
---|
| 113 | End Function
|
---|
| 114 |
|
---|
| 115 | Override Function IsValueType() As Boolean
|
---|
| 116 | Return False
|
---|
| 117 | End Function
|
---|
| 118 |
|
---|
| 119 | Override Function Name() As String
|
---|
| 120 | Return name
|
---|
| 121 | End Function
|
---|
| 122 |
|
---|
| 123 | Override Function Namespace() As String
|
---|
| 124 | Return strNamespace
|
---|
| 125 | End Function
|
---|
| 126 |
|
---|
| 127 |
|
---|
| 128 |
|
---|
| 129 | '----------------------------------------------------------------
|
---|
| 130 | ' Public methods
|
---|
| 131 | '----------------------------------------------------------------
|
---|
| 132 |
|
---|
| 133 | End Class
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 | ' 値型を管理するためのクラス
|
---|
| 137 | Class _System_TypeForValueType
|
---|
[195] | 138 | Inherits TypeBaseImpl
|
---|
[169] | 139 | Public
|
---|
[195] | 140 | Sub _System_TypeForValueType( name As String )
|
---|
[169] | 141 | TypeInfo( name, "" )
|
---|
| 142 | End Sub
|
---|
| 143 |
|
---|
| 144 | Override Function IsValueType() As Boolean
|
---|
| 145 | Return True
|
---|
| 146 | End Function
|
---|
| 147 | End Class
|
---|
| 148 |
|
---|
| 149 | ' クラスを管理するためのクラス
|
---|
| 150 | Class _System_TypeForClass
|
---|
[195] | 151 | Inherits TypeBaseImpl
|
---|
[169] | 152 | Public
|
---|
[195] | 153 | Sub _System_TypeForClass( name As String, strNamespace As String, baseType As TypeInfo )
|
---|
| 154 | TypeBaseImpl( name, strNamespace, baseType )
|
---|
| 155 | End Sub
|
---|
| 156 | Sub ~_System_TypeForClass()
|
---|
| 157 | End Sub
|
---|
| 158 | Override Function IsClass() As Boolean
|
---|
| 159 | Return True
|
---|
| 160 | End Function
|
---|
[169] | 161 | End Class
|
---|
| 162 |
|
---|
| 163 | ' インターフェイスを管理するためのクラス
|
---|
| 164 | Class _System_TypeForInterface
|
---|
[195] | 165 | Inherits TypeBaseImpl
|
---|
[169] | 166 | Public
|
---|
| 167 | End Class
|
---|
| 168 |
|
---|
| 169 | ' 列挙体を管理するためのクラス
|
---|
| 170 | Class _System_TypeForEnum
|
---|
[195] | 171 | Inherits TypeBaseImpl
|
---|
[169] | 172 | Public
|
---|
| 173 | End Class
|
---|
| 174 |
|
---|
| 175 | ' デリゲートを管理するためのクラス
|
---|
| 176 | Class _System_TypeForDelegate
|
---|
[195] | 177 | Inherits TypeBaseImpl
|
---|
[169] | 178 | Public
|
---|
| 179 | End Class
|
---|
| 180 |
|
---|
| 181 |
|
---|
| 182 | '--------------------------------------------------------------------
|
---|
| 183 | ' プロセスに存在するすべての型を管理する(シングルトン クラス)
|
---|
| 184 | '--------------------------------------------------------------------
|
---|
| 185 | Class _System_TypeBase
|
---|
[195] | 186 | pTypes As *TypeInfo
|
---|
[169] | 187 | count As Long
|
---|
| 188 |
|
---|
| 189 | Sub _System_TypeBase()
|
---|
[195] | 190 | pTypes = GC_malloc( 1 )
|
---|
[169] | 191 | count = 0
|
---|
| 192 | End Sub
|
---|
| 193 | Sub ~_System_TypeBase()
|
---|
| 194 | End Sub
|
---|
| 195 |
|
---|
[195] | 196 | Sub _add( typeInfo As TypeInfo )
|
---|
| 197 | pTypes = realloc( pTypes, ( count + 1 ) * SizeOf(*TypeInfo) )
|
---|
| 198 | pTypes[count] = typeInfo
|
---|
| 199 | count++
|
---|
| 200 | End Sub
|
---|
| 201 |
|
---|
[169] | 202 | ' シングルトン オブジェクト
|
---|
| 203 | Static obj As _System_TypeBase
|
---|
| 204 |
|
---|
| 205 | Public
|
---|
| 206 |
|
---|
[195] | 207 | Static Sub Add( typeInfo As TypeInfo )
|
---|
| 208 | obj._add( typeInfo )
|
---|
[169] | 209 | End Sub
|
---|
| 210 |
|
---|
| 211 | Static Sub _NextPointerForGC()
|
---|
| 212 | ' TODO: 実装
|
---|
| 213 | End Sub
|
---|
| 214 |
|
---|
| 215 | Static Sub InitializeValueType()
|
---|
| 216 | ' 値型の追加
|
---|
| 217 | obj.Add( New _System_TypeForValueType( "Byte" ) )
|
---|
| 218 | obj.Add( New _System_TypeForValueType( "SByte" ) )
|
---|
| 219 | obj.Add( New _System_TypeForValueType( "Word" ) )
|
---|
| 220 | obj.Add( New _System_TypeForValueType( "Integer" ) )
|
---|
| 221 | obj.Add( New _System_TypeForValueType( "DWord" ) )
|
---|
| 222 | obj.Add( New _System_TypeForValueType( "Long" ) )
|
---|
| 223 | obj.Add( New _System_TypeForValueType( "QWord" ) )
|
---|
| 224 | obj.Add( New _System_TypeForValueType( "Int64" ) )
|
---|
| 225 | obj.Add( New _System_TypeForValueType( "Boolean" ) )
|
---|
| 226 | obj.Add( New _System_TypeForValueType( "Single" ) )
|
---|
| 227 | obj.Add( New _System_TypeForValueType( "Double" ) )
|
---|
| 228 | End Sub
|
---|
[195] | 229 |
|
---|
| 230 | Static Sub InitializeUserTypes()
|
---|
| 231 | ' このメソッドの実装はコンパイラが自動生成する
|
---|
| 232 | End Sub
|
---|
| 233 |
|
---|
| 234 | Static Sub Initialize()
|
---|
| 235 | ' 値型を初期化
|
---|
| 236 | InitializeValueType()
|
---|
| 237 |
|
---|
| 238 | ' Class / Interface / Enum / Delegate を初期化
|
---|
| 239 | InitializeUserTypes()
|
---|
| 240 | End Sub
|
---|
[169] | 241 | End Class
|
---|
[195] | 242 |
|
---|
| 243 | ' End Namespace ' System
|
---|