source: trunk/Include/basic.sbp@ 497

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

インクルードガードとその他不要な前処理定義などの削除

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