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