[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 |
|
---|
| 13 | Sub _System_InitDllGlobalVariables() 'dummy
|
---|
| 14 | End Sub
|
---|
| 15 |
|
---|
[258] | 16 | Const QWORD_MAX = &HFFFFFFFFFFFFFFFF As QWord
|
---|
| 17 | Const INT64_MAX = &H7FFFFFFFFFFFFFFF As Int64
|
---|
| 18 | Const INT64_MIN = &H8000000000000000 As Int64
|
---|
[1] | 19 |
|
---|
[258] | 20 | Const DWORD_MAX = &HFFFFFFFF As DWord
|
---|
| 21 | Const LONG_MAX = &H7FFFFFFF As Long
|
---|
| 22 | Const LONG_MIN = &H80000000 As Long
|
---|
[1] | 23 |
|
---|
[258] | 24 | Const WORD_MAX = &HFFFF As Word
|
---|
| 25 | Const INTEGER_MAX = &H7FFF As Integer
|
---|
| 26 | Const INTEGER_MIN = &H8000 As Integer
|
---|
| 27 |
|
---|
| 28 | Const BYTE_MAX = &HFF As Byte
|
---|
| 29 | Const SBYTE_MAX = &H7F As SByte
|
---|
| 30 | Const SBYTE_MIN = &H80 As SByte
|
---|
| 31 |
|
---|
| 32 | Const DBL_MAX = 1.7976931348623158e+308
|
---|
| 33 | Const DBL_MIN = 2.2250738585072014e-308
|
---|
| 34 |
|
---|
[1] | 35 | Const FLT_MAX = 3.402823466e+38
|
---|
| 36 | Const 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] | 54 | TypeDef Int16 = Integer
|
---|
| 55 | TypeDef Int8 = SByte
|
---|
| 56 |
|
---|
[179] | 57 | TypeDef BOOL = Long
|
---|
| 58 |
|
---|
| 59 | ' Boolena型の定数
|
---|
[79] | 60 | Const True = 1 As Boolean
|
---|
| 61 | Const False = 0 As Boolean
|
---|
[1] | 62 |
|
---|
[179] | 63 | ' 文字型の定義
|
---|
| 64 | TypeDef WCHAR = Word
|
---|
| 65 | #ifdef UNICODE
|
---|
| 66 | TypeDef Char = WCHAR
|
---|
| 67 | #else
|
---|
| 68 | TypeDef Char = SByte
|
---|
| 69 | #endif
|
---|
[170] | 70 |
|
---|
[168] | 71 | ' 文字型
|
---|
| 72 | #ifdef UNICODE
|
---|
| 73 | TypeDef Char = Word
|
---|
| 74 | #else
|
---|
| 75 | TypeDef Char = SByte
|
---|
| 76 | #endif
|
---|
[48] | 77 |
|
---|
| 78 |
|
---|
[1] | 79 | '------------------
|
---|
| 80 | ' Types of pointer
|
---|
| 81 | '------------------
|
---|
| 82 | TypeDef BytePtr = *Byte
|
---|
| 83 | TypeDef WordPtr = *Word
|
---|
| 84 | TypeDef DWordPtr = *DWord
|
---|
| 85 | TypeDef SinglePtr = *Single
|
---|
| 86 | TypeDef DoublePtr = *Double
|
---|
| 87 |
|
---|
[150] | 88 | Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
|
---|
| 89 | Set_LONG_PTR(pPtr, p As LONG_PTR)
|
---|
| 90 | End Sub
|
---|
| 91 |
|
---|
| 92 | Function GetPointer(pPtr As VoidPtr) As VoidPtr
|
---|
| 93 | GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
|
---|
| 94 | End Function
|
---|
| 95 |
|
---|
[1] | 96 | Sub 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
|
---|
| 102 | End Sub
|
---|
| 103 |
|
---|
| 104 | Function 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
|
---|
| 110 | End Function
|
---|
| 111 |
|
---|
[121] | 112 | Sub SetChar(p As *Char, c As Char)
|
---|
| 113 | p[0] = c
|
---|
| 114 | End Sub
|
---|
| 115 |
|
---|
| 116 | Function GetChar(p As *Char) As Char
|
---|
| 117 | GetChar = p[0]
|
---|
| 118 | End Function
|
---|
| 119 |
|
---|
[179] | 120 |
|
---|
[1] | 121 | '--------------------------
|
---|
| 122 | ' Specify elements number
|
---|
| 123 | '--------------------------
|
---|
[121] | 124 | Const ELM(n) = (n - 1)
|
---|
[1] | 125 |
|
---|
| 126 | #include <windows.sbp>
|
---|
| 127 | #include <crt.sbp>
|
---|
| 128 | #include <objbase.sbp>
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 | Sub _System_GetEip() 'dummy
|
---|
| 132 | End Sub
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 | Dim _System_CriticalSection As CRITICAL_SECTION
|
---|
| 136 | Dim _System_hProcessHeap As HANDLE
|
---|
| 137 |
|
---|
| 138 | Sub _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] | 161 | End Sub
|
---|
| 162 |
|
---|
| 163 | Sub _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] | 177 | End 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
|
---|