source: Include/basic.sbp@ 266

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

※本コミットがCP4バージョンのベースになります
_System_StartupProgramの呼び出しタイミングを変更。

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