source: trunk/ab5.0/ablib/src/basic.sbp @ 560

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

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

File size: 3.5 KB
Line 
1'basic.sbp
2
3#_core
4
5Sub _System_InitDllGlobalVariables()    'dummy
6End Sub
7
8Const QWORD_MAX = &HFFFFFFFFFFFFFFFF As QWord
9Const INT64_MAX = &H7FFFFFFFFFFFFFFF As Int64
10Const INT64_MIN = &H8000000000000000 As Int64
11
12Const DWORD_MAX = &HFFFFFFFF As DWord
13Const LONG_MAX = &H7FFFFFFF As Long
14Const LONG_MIN = &H80000000 As Long
15
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
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
39'TypeDef Int32 = Long
40'DWord
41'Int64
42'QWord
43'Single
44'Double
45
46TypeDef Int16 = Integer
47TypeDef Int8 = SByte
48
49' Boolena型の定数
50Const True = 1 As Boolean
51Const False = 0 As Boolean
52
53' 文字型の定義
54TypeDef WCHAR = Word
55#ifdef UNICODE
56TypeDef Char = WCHAR
57#else
58TypeDef Char = SByte
59#endif
60
61'------------------
62' Types of pointer
63'------------------
64TypeDef BytePtr =   *Byte
65TypeDef WordPtr =   *Word
66TypeDef DWordPtr =  *DWord
67TypeDef SinglePtr = *Single
68TypeDef DoublePtr = *Double
69
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
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
94Sub SetChar(p As *WCHAR, c As WCHAR)
95    p[0] = c
96End Sub
97
98Function GetChar(p As *WCHAR) As WCHAR
99    GetChar = p[0]
100End Function
101
102Sub SetChar(p As *CHAR, c As CHAR)
103    p[0] = c
104End Sub
105
106Function GetChar(p As *CHAR) As CHAR
107    GetChar = p[0]
108End Function
109
110
111'--------------------------
112' Specify elements number
113'--------------------------
114Const ELM(n) = ((n) - 1)
115
116#require <windows.sbp>
117#require <crt.sbp>
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()
128    'Unsafe
129
130        'この関数はアプリケーションの起動時にシステムからコールバックされます
131
132        InitializeCriticalSection(_System_CriticalSection)
133
134        _System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
135
136        ' GC管理オブジェクトを初期化
137        _System_CGarbageCollection.Initialize()
138
139        ' 動的型情報を生成
140        ActiveBasic.Core._System_TypeBase.Initialize()
141
142        'Initialize static variables
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
151End Sub
152
153Sub _System_EndProgram()
154    'Unsafe
155
156        _System_Call_Destructor_of_GlobalObject()
157
158        ' GC管理オブジェクトを破棄
159        _System_pGC->Finish()
160'       _System_free( _System_pGC )
161
162        DeleteCriticalSection(_System_CriticalSection)
163
164        HeapDestroy( _System_hProcessHeap )
165
166    'End Unsafe
167End Sub
168
169
170#require <system\built_in.ab>
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>
176
177#require <Classes\index.ab>
178
179
180#require <basic\function.sbp>
181#require <basic\command.sbp>
Note: See TracBrowser for help on using the repository browser.