source: trunk/Include/basic.sbp@ 300

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

trunkディレクトリを作成。bin、Include、TestCaseをtrunkに移動した。
標準ライブラリのビルドバッチを追加。

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