source: Include/basic.sbp@ 146

Last change on this file since 146 was 146, checked in by dai, 17 years ago

プロセスの初期化と終了処理を修正。

File size: 3.0 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 Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
69#ifdef _WIN64
70 SetQWord(pPtr,lpData)
71#else
72 SetDWord(pPtr,lpData)
73#endif
74End Sub
75
76Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR
77#ifdef _WIN64
78 Get_LONG_PTR = GetQWord(pPtr)
79#else
80 Get_LONG_PTR = GetDWord(pPtr)
81#endif
82End Function
83
84Sub SetChar(p As *Char, c As Char)
85 p[0] = c
86End Sub
87
88Function GetChar(p As *Char) As Char
89 GetChar = p[0]
90End Function
91
92TypeDef SIZE_T = ULONG_PTR
93TypeDef SSIZE_T = LONG_PTR
94
95TypeDef WCHAR = Word
96
97'--------------------------
98' Specify elements number
99'--------------------------
100Const ELM(n) = (n - 1)
101
102#include <windows.sbp>
103#include <crt.sbp>
104#include <objbase.sbp>
105
106
107Sub _System_GetEip() 'dummy
108End Sub
109
110
111Dim _System_CriticalSection As CRITICAL_SECTION
112Dim _System_hProcessHeap As HANDLE
113
114Sub _System_StartupProgram()
115 'Unsafe
116
117 'この関数はアプリケーションの起動時にシステムからコールバックされます
118
119 InitializeCriticalSection(_System_CriticalSection)
120
121 _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
122
123 ' GC管理オブジェクトを生成
124 _System_pGC = _System_calloc( SizeOf( _System_CGarbageCollection ) )
125 _System_pGC->Begin()
126
127 'Initialize global variables
128 _System_InitDllGlobalVariables()
129
130 'Initialize static variables
131 _System_InitStaticLocalVariables()
132
133 'TODO:
134 ' Set current thread priority
135 'Dim thread = Thread.CurrentThread()
136 'thread.Priority = ThreadPriority.Normal
137
138 'End Unsafe
139End Sub
140
141Sub _System_EndProgram()
142 'Unsafe
143
144 _System_Call_Destructor_of_GlobalObject()
145
146 ' GC管理オブジェクトを破棄
147 _System_pGC->Finish()
148 _System_free( _System_pGC )
149
150 DeleteCriticalSection(_System_CriticalSection)
151
152 HeapDestroy( _System_hProcessHeap )
153
154 'End Unsafe
155End Sub
156
157
158
159#include <system\string.sbp>
160#include <system\debug.sbp>
161#include <system\gc.sbp>
162#include <system\enum.sbp>
163#include <system\exception.ab>
164
165#include <Classes\index.ab>
166
167
168#include <basic\function.sbp>
169#include <basic\command.sbp>
170
171
172#endif '_INC_BASIC
Note: See TracBrowser for help on using the repository browser.