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

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

mlang.abの完成。objidl.sbp、oleidl.abの追加。
(#227)

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 <mlang.ab>
118#require <crt.sbp>
119
120
121Sub _System_GetEip()    'dummy
122End Sub
123
124
125Dim _System_CriticalSection As CRITICAL_SECTION
126Dim _System_hProcessHeap As HANDLE
127
128Sub _System_StartupProgram()
129    'Unsafe
130
131        'この関数はアプリケーションの起動時にシステムからコールバックされます
132
133        InitializeCriticalSection(_System_CriticalSection)
134
135        _System_hProcessHeap=HeapCreate(0,0,0)
136
137        ' GC管理オブジェクトを初期化
138        _System_CGarbageCollection.Initialize()
139
140        ' 動的型情報を生成
141        ActiveBasic.Core._System_TypeBase.Initialize()
142
143        'Initialize static variables
144        _System_InitStaticLocalVariables()
145
146        'TODO:
147        ' Set current thread priority
148        'Dim thread = Thread.CurrentThread()
149        'thread.Priority = ThreadPriority.Normal
150
151    'End Unsafe
152End Sub
153
154Sub _System_EndProgram()
155    'Unsafe
156
157        _System_Call_Destructor_of_GlobalObject()
158
159        ' GC管理オブジェクトを破棄
160        _System_pGC->Finish()
161'       _System_free( _System_pGC )
162
163        DeleteCriticalSection(_System_CriticalSection)
164
165        HeapDestroy( _System_hProcessHeap )
166
167    'End Unsafe
168End Sub
169
170
171#require <system\built_in.ab>
172#require <system\string.sbp>
173#require <system\debug.sbp>
174#require <system\gc.sbp>
175#require <system\enum.sbp>
176#require <system\exception.ab>
177
178#require <Classes\index.ab>
179
180
181#require <basic\function.sbp>
182#require <basic\command.sbp>
Note: See TracBrowser for help on using the repository browser.