1 | 'basic.sbp
|
---|
2 |
|
---|
3 | #_core
|
---|
4 |
|
---|
5 | ' Unicodeが不安定な間の暫定対応
|
---|
6 | #define __STRING_IS_NOT_ALWAYS_UNICODE
|
---|
7 |
|
---|
8 |
|
---|
9 | #ifndef _INC_BASIC
|
---|
10 | #define _INC_BASIC
|
---|
11 |
|
---|
12 |
|
---|
13 | Sub _System_InitDllGlobalVariables() 'dummy
|
---|
14 | End Sub
|
---|
15 |
|
---|
16 | Const QWORD_MAX = &HFFFFFFFFFFFFFFFF As QWord
|
---|
17 | Const INT64_MAX = &H7FFFFFFFFFFFFFFF As Int64
|
---|
18 | Const INT64_MIN = &H8000000000000000 As Int64
|
---|
19 |
|
---|
20 | Const DWORD_MAX = &HFFFFFFFF As DWord
|
---|
21 | Const LONG_MAX = &H7FFFFFFF As Long
|
---|
22 | Const LONG_MIN = &H80000000 As Long
|
---|
23 |
|
---|
24 | Const WORD_MAX = &HFFFF As Word
|
---|
25 | Const INTEGER_MAX = &H7FFF As Integer
|
---|
26 | Const INTEGER_MIN = &H8000 As Integer
|
---|
27 |
|
---|
28 | Const BYTE_MAX = &HFF As Byte
|
---|
29 | Const SBYTE_MAX = &H7F As SByte
|
---|
30 | Const SBYTE_MIN = &H80 As SByte
|
---|
31 |
|
---|
32 | Const DBL_MAX = 1.7976931348623158e+308
|
---|
33 | Const DBL_MIN = 2.2250738585072014e-308
|
---|
34 |
|
---|
35 | Const FLT_MAX = 3.402823466e+38
|
---|
36 | Const FLT_MIN = 1.175494351e-38
|
---|
37 |
|
---|
38 | '-------------
|
---|
39 | ' Basic Types
|
---|
40 | '-------------
|
---|
41 |
|
---|
42 | 'Char
|
---|
43 | 'Byte
|
---|
44 | 'Integer
|
---|
45 | 'Word
|
---|
46 | 'Long
|
---|
47 | 'TypeDef Int32 = Long
|
---|
48 | 'DWord
|
---|
49 | 'Int64
|
---|
50 | 'QWord
|
---|
51 | 'Single
|
---|
52 | 'Double
|
---|
53 |
|
---|
54 | TypeDef Int16 = Integer
|
---|
55 | TypeDef Int8 = SByte
|
---|
56 |
|
---|
57 | TypeDef BOOL = Long
|
---|
58 |
|
---|
59 | ' Boolena型の定数
|
---|
60 | Const True = 1 As Boolean
|
---|
61 | Const False = 0 As Boolean
|
---|
62 |
|
---|
63 | ' 文字型の定義
|
---|
64 | TypeDef WCHAR = Word
|
---|
65 | #ifdef UNICODE
|
---|
66 | TypeDef Char = WCHAR
|
---|
67 | #else
|
---|
68 | TypeDef Char = SByte
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | ' 文字型
|
---|
72 | #ifdef UNICODE
|
---|
73 | TypeDef Char = Word
|
---|
74 | #else
|
---|
75 | TypeDef Char = SByte
|
---|
76 | #endif
|
---|
77 |
|
---|
78 |
|
---|
79 | '------------------
|
---|
80 | ' Types of pointer
|
---|
81 | '------------------
|
---|
82 | TypeDef BytePtr = *Byte
|
---|
83 | TypeDef WordPtr = *Word
|
---|
84 | TypeDef DWordPtr = *DWord
|
---|
85 | TypeDef SinglePtr = *Single
|
---|
86 | TypeDef DoublePtr = *Double
|
---|
87 |
|
---|
88 | Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
|
---|
89 | Set_LONG_PTR(pPtr, p As LONG_PTR)
|
---|
90 | End Sub
|
---|
91 |
|
---|
92 | Function GetPointer(pPtr As VoidPtr) As VoidPtr
|
---|
93 | GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
|
---|
94 | End Function
|
---|
95 |
|
---|
96 | Sub Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
|
---|
97 | #ifdef _WIN64
|
---|
98 | SetQWord(pPtr,lpData)
|
---|
99 | #else
|
---|
100 | SetDWord(pPtr,lpData)
|
---|
101 | #endif
|
---|
102 | End Sub
|
---|
103 |
|
---|
104 | Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR
|
---|
105 | #ifdef _WIN64
|
---|
106 | Get_LONG_PTR = GetQWord(pPtr)
|
---|
107 | #else
|
---|
108 | Get_LONG_PTR = GetDWord(pPtr)
|
---|
109 | #endif
|
---|
110 | End Function
|
---|
111 |
|
---|
112 | Sub SetChar(p As *Char, c As Char)
|
---|
113 | p[0] = c
|
---|
114 | End Sub
|
---|
115 |
|
---|
116 | Function GetChar(p As *Char) As Char
|
---|
117 | GetChar = p[0]
|
---|
118 | End Function
|
---|
119 |
|
---|
120 |
|
---|
121 | '--------------------------
|
---|
122 | ' Specify elements number
|
---|
123 | '--------------------------
|
---|
124 | Const ELM(n) = (n - 1)
|
---|
125 |
|
---|
126 | #include <windows.sbp>
|
---|
127 | #include <crt.sbp>
|
---|
128 | #include <objbase.sbp>
|
---|
129 |
|
---|
130 |
|
---|
131 | Sub _System_GetEip() 'dummy
|
---|
132 | End Sub
|
---|
133 |
|
---|
134 |
|
---|
135 | Dim _System_CriticalSection As CRITICAL_SECTION
|
---|
136 | Dim _System_hProcessHeap As HANDLE
|
---|
137 |
|
---|
138 | Sub _System_StartupProgram()
|
---|
139 | 'Unsafe
|
---|
140 | 'この関数はアプリケーションの起動時にシステムからコールバックされます
|
---|
141 |
|
---|
142 | InitializeCriticalSection(_System_CriticalSection)
|
---|
143 |
|
---|
144 | _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
|
---|
145 |
|
---|
146 | ' GC管理オブジェクトを初期化
|
---|
147 | _System_CGarbageCollection.Initialize()
|
---|
148 |
|
---|
149 | ' 動的型情報を生成
|
---|
150 | ActiveBasic.Core._System_TypeBase.Initialize()
|
---|
151 |
|
---|
152 | ' Initialize static variables
|
---|
153 | _System_InitStaticLocalVariables()
|
---|
154 |
|
---|
155 | 'TODO:
|
---|
156 | ' Set current thread priority
|
---|
157 | 'Dim thread = Thread.CurrentThread()
|
---|
158 | 'thread.Priority = ThreadPriority.Normal
|
---|
159 |
|
---|
160 | 'End Unsafe
|
---|
161 | End Sub
|
---|
162 |
|
---|
163 | Sub _System_EndProgram()
|
---|
164 | 'Unsafe
|
---|
165 |
|
---|
166 | _System_Call_Destructor_of_GlobalObject()
|
---|
167 |
|
---|
168 | ' GC管理オブジェクトを破棄
|
---|
169 | _System_pGC->Finish()
|
---|
170 | _System_free( _System_pGC )
|
---|
171 |
|
---|
172 | DeleteCriticalSection(_System_CriticalSection)
|
---|
173 |
|
---|
174 | HeapDestroy( _System_hProcessHeap )
|
---|
175 |
|
---|
176 | 'End Unsafe
|
---|
177 | End Sub
|
---|
178 |
|
---|
179 |
|
---|
180 | #include <system\interface.ab>
|
---|
181 | #include <system\built_in.ab>
|
---|
182 | #include <system\string.sbp>
|
---|
183 | #include <system\debug.sbp>
|
---|
184 | #include <system\gc.sbp>
|
---|
185 | #include <system\enum.sbp>
|
---|
186 | #include <system\exception.ab>
|
---|
187 |
|
---|
188 | #include <Classes\index.ab>
|
---|
189 |
|
---|
190 |
|
---|
191 | #include <basic\function.sbp>
|
---|
192 | #include <basic\command.sbp>
|
---|
193 |
|
---|
194 |
|
---|
195 | #endif '_INC_BASIC
|
---|