source: trunk/Include/basic.sbp@ 483

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

TextWriter, StreamWriterの追加。
SPrintfの浮動小数点数変換で、NaN, Infiniteの出力に対応。
PathとDirectoryInfoのCreateDirectoryで、対象が既に存在するときには例外を投げないように修正。
SimpleTestCase内で使用する一時フォルダの場所にGetTempPathで取得する版を追加(コメントアウト)。

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