source: Include/basic.sbp@ 168

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

CharをTypeDefで定義した。
Unicode版Stringが不安定なため、basic.sbpにて "#define STRING_IS_NOT_ALWAYS_UNICODE" を定義した(暫定対応)。

File size: 3.3 KB
RevLine 
[1]1'basic.sbp
2
[168]3' Unicodeが不安定な間の暫定対応
4#define __STRING_IS_NOT_ALWAYS_UNICODE
[1]5
[168]6
[1]7#ifndef _INC_BASIC
8#define _INC_BASIC
9
10
11Sub _System_InitDllGlobalVariables() 'dummy
12End Sub
13
14
15Const LONG_MAX = &H7FFFFFFF
16Const LONG_MIN = &H80000000
17
18Const FLT_MAX = 3.402823466e+38
19Const FLT_MIN = 1.175494351e-38
20
21'-------------
22' Basic Types
23'-------------
24
25'Char
26'Byte
27'Integer
28'Word
29'Long
30TypeDef Int32 = Long
31'DWord
32'Int64
33'QWord
34'Single
35'Double
36
[142]37TypeDef Int16 = Integer
38TypeDef Int8 = SByte
39
[1]40TypeDef BOOL = Long
41
[79]42' Boolena型の定数
43Const True = 1 As Boolean
44Const False = 0 As Boolean
[1]45
[168]46' 文字型
47#ifdef UNICODE
48TypeDef Char = Word
49#else
50TypeDef Char = SByte
51#endif
[48]52
53
[168]54
[1]55'------------------
56' Types of pointer
57'------------------
58TypeDef BytePtr = *Byte
59TypeDef WordPtr = *Word
60TypeDef DWordPtr = *DWord
61TypeDef SinglePtr = *Single
62TypeDef DoublePtr = *Double
63
64#ifdef _WIN64
65TypeDef LONG_PTR = Int64
66TypeDef ULONG_PTR = QWord
67TypeDef HALF_PTR = Long
[35]68TypeDef UHALF_PTR = DWord
[1]69#else
70TypeDef LONG_PTR = Long
71TypeDef ULONG_PTR = DWord
72TypeDef HALF_PTR = Integer
73TypeDef UHALF_PTR = Word
74#endif
75TypeDef DWORD_PTR = ULONG_PTR
76
[150]77Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
78 Set_LONG_PTR(pPtr, p As LONG_PTR)
79End Sub
80
81Function GetPointer(pPtr As VoidPtr) As VoidPtr
82 GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
83End Function
84
[1]85Sub Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
86#ifdef _WIN64
87 SetQWord(pPtr,lpData)
88#else
89 SetDWord(pPtr,lpData)
90#endif
91End Sub
92
93Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR
94#ifdef _WIN64
95 Get_LONG_PTR = GetQWord(pPtr)
96#else
97 Get_LONG_PTR = GetDWord(pPtr)
98#endif
99End Function
100
[121]101Sub SetChar(p As *Char, c As Char)
102 p[0] = c
103End Sub
104
105Function GetChar(p As *Char) As Char
106 GetChar = p[0]
107End Function
108
[1]109TypeDef SIZE_T = ULONG_PTR
110TypeDef SSIZE_T = LONG_PTR
111
112
[168]113
[1]114'--------------------------
115' Specify elements number
116'--------------------------
[121]117Const ELM(n) = (n - 1)
[1]118
119#include <windows.sbp>
120#include <crt.sbp>
121#include <objbase.sbp>
122
123
124Sub _System_GetEip() 'dummy
125End Sub
126
127
128Dim _System_CriticalSection As CRITICAL_SECTION
129Dim _System_hProcessHeap As HANDLE
130
131Sub _System_StartupProgram()
[146]132 'Unsafe
[1]133
[146]134 'この関数はアプリケーションの起動時にシステムからコールバックされます
[1]135
[146]136 InitializeCriticalSection(_System_CriticalSection)
[1]137
[146]138 _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
[1]139
[146]140 ' GC管理オブジェクトを生成
141 _System_pGC = _System_calloc( SizeOf( _System_CGarbageCollection ) )
142 _System_pGC->Begin()
[1]143
[146]144 'Initialize global variables
145 _System_InitDllGlobalVariables()
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
[1]156End Sub
157
158Sub _System_EndProgram()
[146]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
[1]172End Sub
173
174
175
176#include <system\string.sbp>
177#include <system\debug.sbp>
178#include <system\gc.sbp>
179#include <system\enum.sbp>
[58]180#include <system\exception.ab>
[1]181
182#include <Classes\index.ab>
183
184
185#include <basic\function.sbp>
186#include <basic\command.sbp>
187
188
189#endif '_INC_BASIC
Note: See TracBrowser for help on using the repository browser.