source: Include/basic.sbp@ 176

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

winnt.ab, windef.ab, guiddef.abを導入

File size: 3.1 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
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
37TypeDef Int16 = Integer
38TypeDef Int8 = SByte
39
40' Boolean型の定数
41Const True = 1 As Boolean
42Const False = 0 As Boolean
43
44' BOOL型の定数(Booleanへの移行を推奨)
45Const _System_TRUE = -1
46Const _System_FALSE = 0
47
48' 文字型
49#ifdef UNICODE
50TypeDef Char = Word
51#else
52TypeDef Char = SByte
53#endif
54
55
56'------------------
57' Types of pointer
58'------------------
59TypeDef BytePtr = *Byte
60TypeDef WordPtr = *Word
61TypeDef DWordPtr = *DWord
62TypeDef SinglePtr = *Single
63TypeDef DoublePtr = *Double
64
65Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
66 Set_LONG_PTR(pPtr, p As LONG_PTR)
67End Sub
68
69Function GetPointer(pPtr As VoidPtr) As VoidPtr
70 GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
71End Function
72
73Sub Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
74#ifdef _WIN64
75 SetQWord(pPtr,lpData)
76#else
77 SetDWord(pPtr,lpData)
78#endif
79End Sub
80
81Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR
82#ifdef _WIN64
83 Get_LONG_PTR = GetQWord(pPtr)
84#else
85 Get_LONG_PTR = GetDWord(pPtr)
86#endif
87End Function
88
89Sub SetChar(p As *Char, c As Char)
90 p[0] = c
91End Sub
92
93Function GetChar(p As *Char) As Char
94 GetChar = p[0]
95End Function
96
97'--------------------------
98' Specify elements number
99'--------------------------
100Const ELM(n) = (n - 1)
101
102#include <windows.sbp>
103#include <crt.sbp>
104#include <objbase.sbp>
105
106
107Sub _System_GetEip() 'dummy
108End Sub
109
110
111Dim _System_CriticalSection As CRITICAL_SECTION
112Dim _System_hProcessHeap As HANDLE
113
114Sub _System_StartupProgram()
115 'Unsafe
116
117 'この関数はアプリケーションの起動時にシステムからコールバックされます
118
119 InitializeCriticalSection(_System_CriticalSection)
120
121 _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
122
123 ' GC管理オブジェクトを生成
124 _System_pGC = _System_calloc( SizeOf( _System_CGarbageCollection ) )
125 _System_pGC->Begin()
126
127 'Initialize global variables
128 _System_InitDllGlobalVariables()
129
130 'Initialize static variables
131 _System_InitStaticLocalVariables()
132
133 'TODO:
134 ' Set current thread priority
135 'Dim thread = Thread.CurrentThread()
136 'thread.Priority = ThreadPriority.Normal
137
138 'End Unsafe
139End Sub
140
141Sub _System_EndProgram()
142 'Unsafe
143
144 _System_Call_Destructor_of_GlobalObject()
145
146 ' GC管理オブジェクトを破棄
147 _System_pGC->Finish()
148 _System_free( _System_pGC )
149
150 DeleteCriticalSection(_System_CriticalSection)
151
152 HeapDestroy( _System_hProcessHeap )
153
154 'End Unsafe
155End Sub
156
157
158
159#include <system\string.sbp>
160#include <system\debug.sbp>
161#include <system\gc.sbp>
162#include <system\enum.sbp>
163#include <system\exception.ab>
164
165#include <Classes\index.ab>
166
167
168#include <basic\function.sbp>
169#include <basic\command.sbp>
170
171
172#endif '_INC_BASIC
Note: See TracBrowser for help on using the repository browser.