1 | 'basic.sbp
|
---|
2 |
|
---|
3 | #_core
|
---|
4 |
|
---|
5 | ' Unicodeが不安定な間の暫定対応
|
---|
6 | #define __STRING_IS_NOT_ALWAYS_UNICODE
|
---|
7 |
|
---|
8 | #ifndef _INC_BASIC
|
---|
9 | #define _INC_BASIC
|
---|
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 | ' Boolena型の定数
|
---|
56 | Const True = 1 As Boolean
|
---|
57 | Const False = 0 As Boolean
|
---|
58 |
|
---|
59 | ' 文字型の定義
|
---|
60 | TypeDef WCHAR = Word
|
---|
61 | #ifdef UNICODE
|
---|
62 | TypeDef Char = WCHAR
|
---|
63 | #else
|
---|
64 | TypeDef Char = SByte
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | ' 文字型
|
---|
68 | #ifdef UNICODE
|
---|
69 | TypeDef Char = Word
|
---|
70 | #else
|
---|
71 | TypeDef Char = SByte
|
---|
72 | #endif
|
---|
73 |
|
---|
74 |
|
---|
75 | '------------------
|
---|
76 | ' Types of pointer
|
---|
77 | '------------------
|
---|
78 | TypeDef BytePtr = *Byte
|
---|
79 | TypeDef WordPtr = *Word
|
---|
80 | TypeDef DWordPtr = *DWord
|
---|
81 | TypeDef SinglePtr = *Single
|
---|
82 | TypeDef DoublePtr = *Double
|
---|
83 |
|
---|
84 | Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
|
---|
85 | Set_LONG_PTR(pPtr, p As LONG_PTR)
|
---|
86 | End Sub
|
---|
87 |
|
---|
88 | Function GetPointer(pPtr As VoidPtr) As VoidPtr
|
---|
89 | GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
|
---|
90 | End Function
|
---|
91 |
|
---|
92 | Sub Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
|
---|
93 | #ifdef _WIN64
|
---|
94 | SetQWord(pPtr,lpData)
|
---|
95 | #else
|
---|
96 | SetDWord(pPtr,lpData)
|
---|
97 | #endif
|
---|
98 | End Sub
|
---|
99 |
|
---|
100 | Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR
|
---|
101 | #ifdef _WIN64
|
---|
102 | Get_LONG_PTR = GetQWord(pPtr)
|
---|
103 | #else
|
---|
104 | Get_LONG_PTR = GetDWord(pPtr)
|
---|
105 | #endif
|
---|
106 | End Function
|
---|
107 |
|
---|
108 | Sub SetChar(p As *WCHAR, c As WCHAR)
|
---|
109 | p[0] = c
|
---|
110 | End Sub
|
---|
111 |
|
---|
112 | Function GetChar(p As *WCHAR) As WCHAR
|
---|
113 | GetChar = p[0]
|
---|
114 | End Function
|
---|
115 |
|
---|
116 | Sub SetChar(p As *CHAR, c As CHAR)
|
---|
117 | p[0] = c
|
---|
118 | End Sub
|
---|
119 |
|
---|
120 | Function GetChar(p As *CHAR) As CHAR
|
---|
121 | GetChar = p[0]
|
---|
122 | End Function
|
---|
123 |
|
---|
124 |
|
---|
125 | '--------------------------
|
---|
126 | ' Specify elements number
|
---|
127 | '--------------------------
|
---|
128 | Const ELM(n) = ((n) - 1)
|
---|
129 |
|
---|
130 | #require <windows.sbp>
|
---|
131 | #require <crt.sbp>
|
---|
132 |
|
---|
133 |
|
---|
134 | Sub _System_GetEip() 'dummy
|
---|
135 | End Sub
|
---|
136 |
|
---|
137 |
|
---|
138 | Dim _System_CriticalSection As CRITICAL_SECTION
|
---|
139 | Dim _System_hProcessHeap As HANDLE
|
---|
140 |
|
---|
141 | Sub _System_StartupProgram()
|
---|
142 | 'Unsafe
|
---|
143 |
|
---|
144 | 'この関数はアプリケーションの起動時にシステムからコールバックされます
|
---|
145 |
|
---|
146 | InitializeCriticalSection(_System_CriticalSection)
|
---|
147 |
|
---|
148 | _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
|
---|
149 |
|
---|
150 | ' GC管理オブジェクトを初期化
|
---|
151 | _System_CGarbageCollection.Initialize()
|
---|
152 |
|
---|
153 | ' 動的型情報を生成
|
---|
154 | ActiveBasic.Core._System_TypeBase.Initialize()
|
---|
155 |
|
---|
156 | 'Initialize static variables
|
---|
157 | _System_InitStaticLocalVariables()
|
---|
158 |
|
---|
159 | 'TODO:
|
---|
160 | ' Set current thread priority
|
---|
161 | 'Dim thread = Thread.CurrentThread()
|
---|
162 | 'thread.Priority = ThreadPriority.Normal
|
---|
163 |
|
---|
164 | 'End Unsafe
|
---|
165 | End Sub
|
---|
166 |
|
---|
167 | Sub _System_EndProgram()
|
---|
168 | 'Unsafe
|
---|
169 |
|
---|
170 | _System_Call_Destructor_of_GlobalObject()
|
---|
171 |
|
---|
172 | ' GC管理オブジェクトを破棄
|
---|
173 | _System_pGC->Finish()
|
---|
174 | ' _System_free( _System_pGC )
|
---|
175 |
|
---|
176 | DeleteCriticalSection(_System_CriticalSection)
|
---|
177 |
|
---|
178 | HeapDestroy( _System_hProcessHeap )
|
---|
179 |
|
---|
180 | 'End Unsafe
|
---|
181 | End Sub
|
---|
182 |
|
---|
183 |
|
---|
184 | #require <system\built_in.ab>
|
---|
185 | #require <system\string.sbp>
|
---|
186 | #require <system\debug.sbp>
|
---|
187 | #require <system\gc.sbp>
|
---|
188 | #require <system\enum.sbp>
|
---|
189 | #require <system\exception.ab>
|
---|
190 |
|
---|
191 | #require <Classes\index.ab>
|
---|
192 |
|
---|
193 |
|
---|
194 | #require <basic\function.sbp>
|
---|
195 | #require <basic\command.sbp>
|
---|
196 |
|
---|
197 |
|
---|
198 | #endif '_INC_BASIC
|
---|