- Timestamp:
- Apr 7, 2007, 10:20:40 PM (18 years ago)
- Location:
- Include
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Environment.ab
r173 r208 21 21 Dim size = GetCurrentDirectory(0, 0) 22 22 Dim p = _System_malloc(SizeOf (TCHAR) * size) As PCTSTR 23 GetCurrentDirectory(size, p) 24 CurrentDirectory = p 25 _System_free(p) 23 Dim len = GetCurrentDirectory(size, p) 24 If len < size Then 25 CurrentDirectory = New String(p, size As Long) 26 _System_free(p) 27 End If 26 28 End Function 27 29 … … 72 74 Dim size = GetSystemDirectory(0, 0) 73 75 Dim p = _System_malloc(SizeOf (TCHAR) * size) 74 GetSystemDirectory(size, p)75 sysDir = p76 Dim len = GetSystemDirectory(size, p) 77 sysDir = New String(p, len As Long) 76 78 _System_free(p) 77 79 End IF … … 117 119 Dim dst = _System_malloc(SizeOf (TCHAR) * size) 118 120 ExpandEnvironmentStrings(src, dst, size) 119 ExpandEnvironmentVariables = dst121 ExpandEnvironmentVariables = New String(dst, size - 1) 120 122 _System_free(dst) 121 123 End Function 122 124 123 125 Static Sub FailFast(message As String) 124 OutputDebugString(ToTCStr(message)) 125 ExitProcess(-1) 126 FatalAppExit(0, ToTCStr(message)) 126 127 End Sub 127 128 -
Include/Classes/System/Math.ab
r162 r208 17 17 18 18 Static Function Abs(value As Double) As Double 19 If value<0 then 20 return -value 21 Else 22 return value 23 End If 19 SetQWord(VarPtr(value), GetQWord(VarPtr(value)) And &h7fffffffffffffff) 24 20 End Function 25 21 26 22 Static Function Abs(value As Single) As Single 27 If value<0 then 28 return -value 29 Else 30 return value 31 End If 23 SetDWord(VarPtr(value), GetDWord(VarPtr(value)) And &h7fffffff) 32 24 End Function 33 25 … … 209 201 'GetType 210 202 211 Static Function IEEERemainder(value1 As Double, value2 As Double) As Double203 Static Function IEEERemainder(value1 As Double, value2 As Double) As Double 212 204 Dim q As Double 213 205 If value2=0 then return _System_GetNaN() … … 616 608 Const _System_Atan_N = 20 617 609 Const _System_UrTan_N = 17 618 Const _System_D 610 Const _System_D = 4.4544551033807686783083602485579e-6 619 611 Const _System_HalfPI = (_System_PI * 0.5) 620 612 Const _System_InverseHalfPI = (2 / _System_PI) '1 / (PI / 2) -
Include/Classes/System/OperatingSystem.ab
r175 r208 1 ' System/OperatingSystem.ab1 ' Classes/System/OperatingSystem.ab 2 2 3 #ifndef _ SYSYTEM_OPERATINGSYSTEM_AB_4 #define _ SYSYTEM_OPERATINGSYSTEM_AB_3 #ifndef __SYSYTEM_OPERATINGSYSTEM_AB__ 4 #define __SYSYTEM_OPERATINGSYSTEM_AB__ 5 5 6 6 #require <Classes/System/Version.ab> … … 83 83 End Enum 84 84 85 #endif '_ SYSYTEM_OPERATINGSYSTEM_AB_85 #endif '__SYSYTEM_OPERATINGSYSTEM_AB__ -
Include/Classes/System/Runtime/InteropServices/GCHandle.ab
r203 r208 46 46 End Function 47 47 48 Function Operator = (y As GCHandle) As Boolean48 Function Operator == (y As GCHandle) As Boolean 49 49 Return Equals(y) 50 50 End Function … … 52 52 Function Operator <> (y As GCHandle) As Boolean 53 53 Return Not Equals(y) 54 End Function 55 56 Override Function ToString() As String 57 Return "System.Runtime.InteropServices.GCHandle" 54 58 End Function 55 59 -
Include/basic/function.sbp
r203 r208 528 528 529 529 Function Space$(length As Long) As String 530 Space$.ReSize(length, &H20 As StrChar)530 Return New String(&h20 As StrChar, length) 531 531 End Function 532 532 -
Include/basic/prompt.sbp
r192 r208 509 509 510 510 '強制的に終了する 511 E xitProcess(0)511 End 'ExitProcess(0) 512 512 513 513 EnterCriticalSection(_PromptSys_SectionOfBufferAccess) … … 522 522 DeleteCriticalSection(_PromptSys_SectionOfBufferAccess) 523 523 524 E xitProcess(0)524 End 'ExitProcess(0) 525 525 End Function 526 526 -
Include/com/bstring.ab
r192 r208 31 31 32 32 Sub BString(s As PCSTR, len As DWord) 33 Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len , 0, 0)33 Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0) 34 34 bs = SysAllocStringLen(0, lenBS) 35 MultiByteToWideChar(CP_THREAD_ACP, 0, s, len , bs, lenBS)35 MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS) 36 36 End Sub 37 37 … … 92 92 BStr = bs 93 93 End Function 94 /* 95 Static Function Assgin(bs As BSTR) As BString 96 Assgin = New BString 97 Assgin.Assgin(bs) 98 End Function 94 99 100 Static Function Attach(bs As BSTR) As BString 101 Attach = New BString 102 Attach.Attach(bs) 103 End Function 104 */ 95 105 Const Function Length() As DWord 96 106 Length = SysStringLen(bs) … … 116 126 117 127 Override Function ToString() As String 118 Dim s As String(bs As PCWSTR, Length As Long) 119 Return s 128 Return New String(bs As PCWSTR, Length As Long) 120 129 End Function 121 130 -
Include/com/currency.ab
r200 r208 71 71 End Function 72 72 73 Static Function Compare(x As Currency, y As Currency) As HRESULT 74 Return VarCyCmp(x, y) 75 End Function 76 77 Static Function Compare(x As Currency, y As Double) As HRESULT 78 Return VarCyCmpR8(x, y) 79 End Function 80 81 Static Function Compare(x As Double, y As Currency) As HRESULT 82 Dim ret = VarCyCmpR8(y, x) 83 Select Case ret 84 Case VARCMP_LT 85 Return VARCMP_GT 86 Case VARCMP_GT 87 Return VARCMP_LT 88 Case Else 89 Return ret 90 End Select 91 End Function 92 93 Const Function Operator ==(y As Currency) As Boolean 94 Dim c = Compare(This, y) 95 Return c = VARCMP_EQ 96 End Function 97 98 Const Function Operator ==(y As Double) As Boolean 99 Dim c = Compare(This, y) 100 Return c = VARCMP_EQ 101 End Function 102 103 Const Function Operator <>(y As Currency) As Boolean 104 Dim c = Compare(This, y) 105 Return c <> VARCMP_EQ 106 End Function 107 108 Const Function Operator <>(y As Double) As Boolean 109 Dim c = Compare(This, y) 110 Return c <> VARCMP_EQ 111 End Function 112 113 Const Function Operator <(y As Currency) As Boolean 114 Dim c = Compare(This, y) 115 Return c = VARCMP_LT 116 End Function 117 118 Const Function Operator <(y As Double) As Boolean 119 Dim c = Compare(This, y) 120 Return c = VARCMP_LT 121 End Function 122 /* 123 Const Function Operator >(y As Currency) As Boolean 124 Dim c = Compare(This, y) 125 Return c = VARCMP_GT 126 End Function 127 128 Const Function Operator >(y As Double) As Boolean 129 Dim c = Compare(This, y) 130 Return c = VARCMP_GT 131 End Function 132 */ 133 Const Function Operator <=(y As Currency) As Boolean 134 Dim c = Compare(This, y) 135 Return result = VARCMP_LT Or result = VARCMP_EQ 136 End Function 137 138 Const Function Operator <=(y As Double) As Boolean 139 Dim c = Compare(This, y) 140 Return result = VARCMP_LT Or result = VARCMP_EQ 141 End Function 142 143 Const Function Operator >=(y As Currency) As Boolean 144 Dim c = Compare(This, y) 145 Return result = VARCMP_GT Or result = VARCMP_EQ 146 End Function 147 148 Const Function Operator >=(y As Double) As Boolean 149 Dim c = Compare(This, y) 150 Return result = VARCMP_GT Or result = VARCMP_EQ 151 End Function 152 73 153 Const Function Abs() As Currency 154 Abs = New Currency 74 155 VarCyAbs(This.cy, Abs.cy) 75 156 End Function 76 157 77 158 Const Function Fix() As Currency 159 Fix = New Currency 78 160 VarCyFix(This.cy, Fix.cy) 79 161 End Function 80 162 81 163 Const Function Int() As Currency 164 Int = New Currency 82 165 VarCyInt(This.cy, Int.cy) 83 166 End Function 84 167 85 168 Const Function Round(c = 0 As Long) As Currency 169 Round = New Currency 86 170 VarCyRound(This.cy, c, Round.cy) 87 171 End Function -
Include/com/variant.ab
r200 r208 156 156 Variant.Move(Detach, v) 157 157 End Function 158 158 /* 159 Static Function Assgin(ByRef from As VARIANT) As Variant 160 Assign = New Variant 161 Assgin.Assign(from) 162 End Function 163 164 Static Function Attach(ByRef from As VARIANT) As Variant 165 Attach = New Variant 166 Attach.Attach(from) 167 End Function 168 */ 159 169 'Operators 160 170 161 171 Const Function Operator ^(y As Variant) As Variant 162 Dim ret AsVariant172 Dim ret = New Variant 163 173 VarPow(This.v, y.v, ret.v) 164 174 Return ret … … 170 180 171 181 Const Function Operator -() As Variant 172 Dim ret AsVariant182 Dim ret = New Variant 173 183 VarNeg(This.v, ret.v) 174 184 Return ret … … 176 186 177 187 Const Function Operator *(y As Variant) As Variant 178 Dim ret AsVariant188 Dim ret = New Variant 179 189 VarMul(This.v, y.v, ret.v) 180 190 Return ret … … 182 192 183 193 Const Function Operator /(y As Variant) As Variant 184 Dim ret AsVariant194 Dim ret = New Variant 185 195 VarDiv(This.v, y.v, ret.v) 186 196 Return ret … … 188 198 189 199 Const Function Operator \(y As Variant) As Variant 190 Dim ret AsVariant200 Dim ret = New Variant 191 201 VarIDiv(This.v, y.v, ret.v) 192 202 Return ret … … 194 204 195 205 Const Function Operator Mod(y As Variant) As Variant 196 Dim ret AsVariant206 Dim ret = New Variant 197 207 VarMod(This.v, y.v, ret.v) 198 208 Return ret … … 200 210 201 211 Const Function Operator +(y As Variant) As Variant 202 Dim ret AsVariant212 Dim ret = New Variant 203 213 VarAdd(This.v, y.v, ret.v) 204 214 Return ret … … 206 216 207 217 Const Function Operator -(y As Variant) As Variant 208 Dim ret AsVariant218 Dim ret = New Variant 209 219 VarSub(This.v, y.v, ret.v) 210 220 Return ret … … 212 222 213 223 Const Function Operator &(y As Variant) As Variant 214 Dim ret AsVariant224 Dim ret = New Variant 215 225 VarCat(This.v, y.v, ret.v) 216 226 Return ret … … 218 228 219 229 Const Function Operator And(y As Variant) As Variant 220 Dim ret AsVariant230 Dim ret = New Variant 221 231 VarAnd(This.v, y.v, ret.v) 222 232 Return ret … … 224 234 225 235 Const Function Operator Or(y As Variant) As Variant 226 Dim ret AsVariant236 Dim ret = New Variant 227 237 VarOr(This.v, y.v, ret.v) 228 238 Return ret … … 230 240 231 241 Const Function Operator Xor(y As Variant) As Variant 232 Dim ret AsVariant242 Dim ret = New Variant 233 243 VarXor(This.v, y.v, ret.v) 234 244 Return ret … … 236 246 237 247 Const Function Operator Not() As Variant 238 Dim ret AsVariant248 Dim ret = New Variant 239 249 VarNot(This.v, ret.v) 240 250 Return ret … … 242 252 243 253 Static Function Imp(x As Variant, y As Variant) As Variant 244 Dim ret AsVariant254 Dim ret = New Variant 245 255 VarImp(x.v, y.v, ret.v) 246 256 Return ret … … 248 258 249 259 Static Function Eqv(x As Variant, y As Variant) As Variant 250 Dim ret AsVariant260 Dim ret = New Variant 251 261 VarEqv(x.v, y.v, ret.v) 252 262 Return ret … … 254 264 255 265 Const Function Abs() As Variant 256 Dim ret AsVariant266 Dim ret = New Variant 257 267 VarAbs(This.v, ret.v) 258 268 Return ret … … 260 270 261 271 Const Function Fix() As Variant 262 Dim ret AsVariant272 Dim ret = New Variant 263 273 VarFix(This.v, ret.v) 264 274 Return ret … … 266 276 267 277 Const Function Int() As Variant 268 Dim ret AsVariant278 Dim ret = New Variant 269 279 VarInt(This.v, ret.v) 270 280 Return ret … … 272 282 273 283 Const Function Round(cDecimals As Long) As Variant 274 Dim ret AsVariant284 Dim ret = New Variant 275 285 VarRound(This.v, cDecimals, ret) 276 286 Return ret … … 286 296 287 297 Static Function Compare(x As Variant, y As Variant) As HRESULT 288 Return VarCmp(x.v, y.v, GetUserDefaultLCID(), 0) 'VARCMP_NULL = 3を返す場合があるので注意298 Return VarCmp(x.v, y.v, LOCALE_USER_DEFAULT, 0) 'VARCMP_NULL = 3を返す場合があるので注意 289 299 End Function 290 300 … … 344 354 345 355 Const Function ChangeType(vt As VARTYPE, flags As Word) As Variant 346 Dim ret AsVariant356 Dim ret = New Variant 347 357 ChangeType(ret, flags, vt) 348 358 Return ret … … 368 378 Dim tmp = ChangeType(VT_BSTR) 369 379 Dim bs = ((tmp.v.val As ULONG_PTR) As BSTR) 370 Dim s As String(bs As PCWSTR, SysStringLen(bs) As Long) 371 Return s 380 Return New String(bs As PCWSTR, SysStringLen(bs) As Long) 372 381 End Function 373 382 … … 520 529 Dim r As VARIANT 521 530 ChangeType(r, 0, VT_BSTR) 522 Dim bs AsBString531 Dim bs = New BString 523 532 bs.Attach(GetPointer(VarPtr(r.val)) As BSTR) 524 533 Return bs … … 528 537 Clear() 529 538 v.vt = VT_BSTR 539 SetPointer(VarPtr(v.val), x.Copy()) 530 540 End Sub 531 541 … … 588 598 End Class 589 599 590 Dim _System_VariantOptionalParam = Nothing As Variant600 'Dim _System_VariantOptionalParam = Nothing As Variant 591 601 592 602 /* -
Include/com/vbobject.ab
r200 r208 157 157 Dim hr = pdisp->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, dispParams, ret, 0, 0) 158 158 Dispose() 159 Dim v= New Variant159 Prop = New Variant 160 160 v.Attach(ret) 161 161 Return v … … 288 288 Dim ret As VARIANT 289 289 hr = obj->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, dispParams, ret, ByVal 0, 0) 290 CallByName = New Variant 290 291 CallByName.Attach(ret) 291 292 Return CallByName -
Include/system/string.sbp
r192 r208 10 10 11 11 Function ZeroString(length As Long) As String 12 Dim str As String 13 str.ReSize(length) 14 Return str 12 Return New String(0, length) 15 13 End Function 16 14 -
Include/windows/WindowHandle.sbp
r192 r208 1 ' Windows/WindowHandle.sbp 2 1 3 #ifndef __WINDOWS_WINDOWHANDLE_SBP__ 2 4 #define __WINDOWS_WINDOWHANDLE_SBP__ … … 65 67 End Function 66 68 67 Const Function ChildFromPoint(x As Long, y As Long) As HWND68 Return ChildWindowFromPoint(hwnd, x, y)69 End Function 70 71 Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As HWND72 Return ChildWindowFromPointEx(hwnd, x, y, flags)69 Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle 70 Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y)) 71 End Function 72 73 Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As WindowHandle 74 Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags)) 73 75 End Function 74 76 … … 390 392 End Function 391 393 392 Function SetActiveWindow() As HWND393 Return SetActiveWindow(hwnd)394 Function SetActiveWindow() As WindowHandle 395 Return New WindowHandle(SetActiveWindow(hwnd)) 394 396 End Function 395 397 … … 398 400 End Function 399 401 400 Function SetCapture() As HWND401 Return SetCapture(hwnd) As HWND402 Function SetCapture() As WindowHandle 403 Return New WindowHandle(SetCapture(hwnd)) 402 404 End Function 403 405 … … 406 408 End Function 407 409 408 Function SetFocus() As HWND409 Return SetFocus(hwnd)410 Function SetFocus() As WindowHandle 411 Return New WindowHandle(SetFocus(hwnd)) 410 412 End Function 411 413 … … 418 420 End Function 419 421 420 Function SetParent(hwndNewParent As HWND) As HWND421 Return _System_SetParent(hwnd, hwndNewParent)422 Function SetParent(hwndNewParent As HWND) As WindowHandle 423 Return New WindowHandle(_System_SetParent(hwnd, hwndNewParent)) 422 424 End Function 423 425
Note:
See TracChangeset
for help on using the changeset viewer.