source: trunk/Include/basic.sbp@ 303

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

フルコンパイルでのミスあぶり出し。註:修正は全て@300や@301以前に行われた。

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