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