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