source: trunk/Include/basic.sbp@ 425

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

_System_CThreadCollectionでのクラスインスタンスへのポインタの使用を除去、参照変数構文へ。

File size: 3.7 KB
Line 
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
11Sub _System_InitDllGlobalVariables() 'dummy
12End Sub
13
14Const QWORD_MAX = &HFFFFFFFFFFFFFFFF As QWord
15Const INT64_MAX = &H7FFFFFFFFFFFFFFF As Int64
16Const INT64_MIN = &H8000000000000000 As Int64
17
18Const DWORD_MAX = &HFFFFFFFF As DWord
19Const LONG_MAX = &H7FFFFFFF As Long
20Const LONG_MIN = &H80000000 As Long
21
22Const WORD_MAX = &HFFFF As Word
23Const INTEGER_MAX = &H7FFF As Integer
24Const INTEGER_MIN = &H8000 As Integer
25
26Const BYTE_MAX = &HFF As Byte
27Const SBYTE_MAX = &H7F As SByte
28Const SBYTE_MIN = &H80 As SByte
29
30Const DBL_MAX = 1.7976931348623158e+308
31Const DBL_MIN = 2.2250738585072014e-308
32
33Const FLT_MAX = 3.402823466e+38
34Const 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
52TypeDef Int16 = Integer
53TypeDef Int8 = SByte
54
55' Boolena型の定数
56Const True = 1 As Boolean
57Const False = 0 As Boolean
58
59' 文字型の定義
60TypeDef WCHAR = Word
61#ifdef UNICODE
62TypeDef Char = WCHAR
63#else
64TypeDef Char = SByte
65#endif
66
67' 文字型
68#ifdef UNICODE
69TypeDef Char = Word
70#else
71TypeDef Char = SByte
72#endif
73
74
75'------------------
76' Types of pointer
77'------------------
78TypeDef BytePtr = *Byte
79TypeDef WordPtr = *Word
80TypeDef DWordPtr = *DWord
81TypeDef SinglePtr = *Single
82TypeDef DoublePtr = *Double
83
84Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
85 Set_LONG_PTR(pPtr, p As LONG_PTR)
86End Sub
87
88Function GetPointer(pPtr As VoidPtr) As VoidPtr
89 GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
90End Function
91
92Sub 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
98End Sub
99
100Function 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
106End Function
107
108Sub SetChar(p As *WCHAR, c As WCHAR)
109 p[0] = c
110End Sub
111
112Function GetChar(p As *WCHAR) As WCHAR
113 GetChar = p[0]
114End Function
115
116Sub SetChar(p As *CHAR, c As CHAR)
117 p[0] = c
118End Sub
119
120Function GetChar(p As *CHAR) As CHAR
121 GetChar = p[0]
122End Function
123
124
125'--------------------------
126' Specify elements number
127'--------------------------
128Const ELM(n) = ((n) - 1)
129
130#require <windows.sbp>
131#require <crt.sbp>
132
133
134Sub _System_GetEip() 'dummy
135End Sub
136
137
138Dim _System_CriticalSection As CRITICAL_SECTION
139Dim _System_hProcessHeap As HANDLE
140
141Sub _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
165End Sub
166
167Sub _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
181End 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
Note: See TracBrowser for help on using the repository browser.