source: trunk/Include/basic.sbp@ 315

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

rev.299以降のバイナリでは下記のコードが必要であるため、コミットする。
#_core
#include <system\build_in.ab>

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