source: Include/basic.sbp@ 285

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

(32ビットコンパイラ)
クラス情報取得時のクラス先読み処理で名前空間の関係が崩れてしまうバグを修正。
インクルードパスに'/'文字を含めたときに'
'として判断するようにした。

(ライブラリ)
ActiveBasic.Core名前空間を作成した(動的型情報に関する内部コードをここに移動)。
DateTimeクラスをSystem名前空間に入れた。
TimeSpanクラスをSystem名前空間に入れた。
TimeInfoクラスをSystem名前空間に入れた。

File size: 3.6 KB
Line 
1'basic.sbp
2
3' Unicodeが不安定な間の暫定対応
4#define __STRING_IS_NOT_ALWAYS_UNICODE
5
6
7#ifndef _INC_BASIC
8#define _INC_BASIC
9
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
55TypeDef BOOL = Long
56
57' Boolena型の定数
58Const True = 1 As Boolean
59Const False = 0 As Boolean
60
61' 文字型の定義
62TypeDef WCHAR = Word
63#ifdef UNICODE
64TypeDef Char = WCHAR
65#else
66TypeDef Char = SByte
67#endif
68
69' 文字型
70#ifdef UNICODE
71TypeDef Char = Word
72#else
73TypeDef Char = SByte
74#endif
75
76
77'------------------
78' Types of pointer
79'------------------
80TypeDef BytePtr = *Byte
81TypeDef WordPtr = *Word
82TypeDef DWordPtr = *DWord
83TypeDef SinglePtr = *Single
84TypeDef DoublePtr = *Double
85
86Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
87 Set_LONG_PTR(pPtr, p As LONG_PTR)
88End Sub
89
90Function GetPointer(pPtr As VoidPtr) As VoidPtr
91 GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
92End Function
93
94Sub Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
95#ifdef _WIN64
96 SetQWord(pPtr,lpData)
97#else
98 SetDWord(pPtr,lpData)
99#endif
100End Sub
101
102Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR
103#ifdef _WIN64
104 Get_LONG_PTR = GetQWord(pPtr)
105#else
106 Get_LONG_PTR = GetDWord(pPtr)
107#endif
108End Function
109
110Sub SetChar(p As *Char, c As Char)
111 p[0] = c
112End Sub
113
114Function GetChar(p As *Char) As Char
115 GetChar = p[0]
116End Function
117
118
119'--------------------------
120' Specify elements number
121'--------------------------
122Const ELM(n) = (n - 1)
123
124#include <windows.sbp>
125#include <crt.sbp>
126#include <objbase.sbp>
127
128
129Sub _System_GetEip() 'dummy
130End Sub
131
132
133Dim _System_CriticalSection As CRITICAL_SECTION
134Dim _System_hProcessHeap As HANDLE
135
136Sub _System_StartupProgram()
137 'Unsafe
138
139 'この関数はアプリケーションの起動時にシステムからコールバックされます
140
141 InitializeCriticalSection(_System_CriticalSection)
142
143 _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
144
145 ' GC管理オブジェクトを初期化
146 _System_CGarbageCollection.Initialize()
147
148 ' 動的型情報を生成
149 ActiveBasic.Core._System_TypeBase.Initialize()
150
151 'Initialize static variables
152 _System_InitStaticLocalVariables()
153
154 'TODO:
155 ' Set current thread priority
156 'Dim thread = Thread.CurrentThread()
157 'thread.Priority = ThreadPriority.Normal
158
159 'End Unsafe
160End Sub
161
162Sub _System_EndProgram()
163 'Unsafe
164
165 _System_Call_Destructor_of_GlobalObject()
166
167 ' GC管理オブジェクトを破棄
168 _System_pGC->Finish()
169 _System_free( _System_pGC )
170
171 DeleteCriticalSection(_System_CriticalSection)
172
173 HeapDestroy( _System_hProcessHeap )
174
175 'End Unsafe
176End Sub
177
178
179
180#include <system\string.sbp>
181#include <system\debug.sbp>
182#include <system\gc.sbp>
183#include <system\enum.sbp>
184#include <system\exception.ab>
185
186#include <Classes\index.ab>
187
188
189#include <basic\function.sbp>
190#include <basic\command.sbp>
191
192
193#endif '_INC_BASIC
Note: See TracBrowser for help on using the repository browser.