source: Include/basic.sbp@ 150

Last change on this file since 150 was 150, checked in by イグトランス (egtra), 17 years ago

参照型導入に備え、構造体 (Type)代わりにクラスを使っていた部分を構造体へ戻すほか

File size: 3.2 KB
Line 
1'basic.sbp
2
3
4#ifndef _INC_BASIC
5#define _INC_BASIC
6
7
8Sub _System_InitDllGlobalVariables() 'dummy
9End Sub
10
11
12Const LONG_MAX = &H7FFFFFFF
13Const LONG_MIN = &H80000000
14
15Const FLT_MAX = 3.402823466e+38
16Const FLT_MIN = 1.175494351e-38
17
18'-------------
19' Basic Types
20'-------------
21
22'Char
23'Byte
24'Integer
25'Word
26'Long
27TypeDef Int32 = Long
28'DWord
29'Int64
30'QWord
31'Single
32'Double
33
34TypeDef Int16 = Integer
35TypeDef Int8 = SByte
36
37TypeDef BOOL = Long
38
39
40' Boolena型の定数
41Const True = 1 As Boolean
42Const False = 0 As Boolean
43
44
45
46'------------------
47' Types of pointer
48'------------------
49TypeDef BytePtr = *Byte
50TypeDef WordPtr = *Word
51TypeDef DWordPtr = *DWord
52TypeDef SinglePtr = *Single
53TypeDef DoublePtr = *Double
54
55#ifdef _WIN64
56TypeDef LONG_PTR = Int64
57TypeDef ULONG_PTR = QWord
58TypeDef HALF_PTR = Long
59TypeDef UHALF_PTR = DWord
60#else
61TypeDef LONG_PTR = Long
62TypeDef ULONG_PTR = DWord
63TypeDef HALF_PTR = Integer
64TypeDef UHALF_PTR = Word
65#endif
66TypeDef DWORD_PTR = ULONG_PTR
67
68Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
69 Set_LONG_PTR(pPtr, p As LONG_PTR)
70End Sub
71
72Function GetPointer(pPtr As VoidPtr) As VoidPtr
73 GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
74End Function
75
76Sub 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
82End Sub
83
84Function 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
90End Function
91
92Sub SetChar(p As *Char, c As Char)
93 p[0] = c
94End Sub
95
96Function GetChar(p As *Char) As Char
97 GetChar = p[0]
98End Function
99
100TypeDef SIZE_T = ULONG_PTR
101TypeDef SSIZE_T = LONG_PTR
102
103TypeDef WCHAR = Word
104
105'--------------------------
106' Specify elements number
107'--------------------------
108Const ELM(n) = (n - 1)
109
110#include <windows.sbp>
111#include <crt.sbp>
112#include <objbase.sbp>
113
114
115Sub _System_GetEip() 'dummy
116End Sub
117
118
119Dim _System_CriticalSection As CRITICAL_SECTION
120Dim _System_hProcessHeap As HANDLE
121
122Sub _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
147End Sub
148
149Sub _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
163End 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
Note: See TracBrowser for help on using the repository browser.