source: Include/basic.sbp@ 299

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

【32bitコンパイラ】
静的リンクライブラリを実装
ジェネリクスを実装
※64bitコンパイラは未実装

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