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