source: trunk/Include/basic.sbp@ 363

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

rev.299以降のバイナリでは下記のコードが必要であるため、コミットする。
#_core
#include <system\build_in.ab>

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