Changeset 497 for trunk/Include/basic/function.sbp
- Timestamp:
- Mar 28, 2008, 5:43:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/basic/function.sbp
r457 r497 1 1 'function.sbp 2 3 4 #ifndef _INC_FUNCTION5 #define _INC_FUNCTION6 7 2 8 3 Const _System_PI = 3.14159265358979323846264 … … 10 5 Const _System_SQRT2 = 1.41421356237309504880168872421 11 6 Const _System_Log_N = 7 As Long 12 13 14 #require <Classes/System/Math.ab>15 #require <Classes/System/DateTime.ab>16 #require <Classes/System/Text/StringBuilder.ab>17 #require <Classes/ActiveBasic/Math/Math.ab>18 #require <Classes/ActiveBasic/Strings/Strings.ab>19 20 7 21 8 '------------- サポート関数の定義 ------------- … … 243 230 '------------ 244 231 245 Function Asc(buf As String) As StrChar232 Function Asc(buf As String) As Char 246 233 Asc = buf[0] 247 234 End Function 248 235 249 Function Chr$(code As StrChar) As String236 Function Chr$(code As Char) As String 250 237 Chr$ = New String(code, 1) 251 238 End Function 252 239 253 #if ndef __STRING_IS_NOT_UNICODE240 #ifdef UNICODE 254 241 Function AscW(s As String) As UCSCHAR 255 242 If String.IsNullOrEmpty(s) Then … … 275 262 Function ChrW(c As UCSCHAR) As String 276 263 If c <= &hFFFF Then 277 Return New String(c As StrChar, 1)264 Return New String(c As Char, 1) 278 265 ElseIf c <= &h10FFFF Then 279 266 c -= &h10000 … … 390 377 391 378 Function Space$(length As Long) As String 392 Return New String(&h20 As StrChar, length)393 End Function 394 395 Sub _ecvt_support(buf As * StrChar, count As Long, size As Long)379 Return New String(&h20 As Char, length) 380 End Function 381 382 Sub _ecvt_support(buf As *Char, count As Long, size As Long) 396 383 Dim i As Long 397 384 If buf[count] = 9 Then … … 410 397 End Sub 411 398 412 Sub _ecvt(buffer As * StrChar, value As Double, count As Long, ByRef dec As Long, ByRef sign As Boolean)399 Sub _ecvt(buffer As *Char, value As Double, count As Long, ByRef dec As Long, ByRef sign As Boolean) 413 400 Dim i As Long, i2 As Long 414 401 415 402 '値が0の場合 416 403 If value = 0 Then 417 ActiveBasic.Strings.ChrFill(buffer, count As SIZE_T, &h30 As StrChar)404 ActiveBasic.Strings.ChrFill(buffer, count As SIZE_T, &h30 As Char) 418 405 buffer[count] = 0 419 406 dec = 0 … … 442 429 443 430 For i = 0 To count - 1 444 buffer[i] = Int(value) As StrChar431 buffer[i] = Int(value) As Char 445 432 value = (value-CDbl(Int(value))) * 10 446 433 Next … … 471 458 End If 472 459 Dim dec As Long, sign As Boolean 473 Dim buffer[32] As StrChar, temp[15] As StrChar460 Dim buffer[32] As Char, temp[15] As Char 474 461 Dim i = 0 As Long 475 462 … … 585 572 End Function 586 573 587 Function String$(n As Long, s As StrChar) As String574 Function String$(n As Long, s As Char) As String 588 575 Return New String(s, n) 589 576 End Function 590 577 591 578 #ifdef _AB4_COMPATIBILITY_STRING$_ 592 579 Function String$(n As Long, s As String) As String … … 594 581 'Throw ArgumentOutOfRangeException 595 582 End If 596 597 583 Dim buf = New System.Text.StringBuilder(s.Length * n) 598 584 Dim i As Long 599 For i = 0To n585 For i = 1 To n 600 586 buf.Append(s) 601 587 Next … … 603 589 #else 604 590 Function String$(n As Long, s As String) As String 591 Dim c As Char 605 592 If String.IsNullOrEmpty(s) Then 606 Return New String(0 As StrChar, n) 607 Else 608 Return New String(s[0], n) 609 End If 593 c = 0 594 Else 595 c = s[0] 596 End If 597 String$ = New String(c, n) 610 598 End Function 611 599 #endif … … 613 601 Function Time$() As String 614 602 Dim time = System.DateTime.Now 615 616 603 Dim buf = New System.Text.StringBuilder(8) 617 618 604 'hour 619 605 If time.Hour < 10 Then … … 640 626 End Function 641 627 642 Function Val(buf As * StrChar) As Double628 Function Val(buf As *Char) As Double 643 629 Dim i As Long, i2 As Long, i3 As Long, i4 As Long 644 630 Dim temporary As String 645 Dim TempPtr As * StrChar631 Dim TempPtr As *Char 646 632 Dim dbl As Double 647 633 Dim i64data As Int64 … … 665 651 If Not (0<=i3 And i3<=7) Then Exit While 666 652 667 TempPtr[i]=i3 As StrChar653 TempPtr[i]=i3 As Char 668 654 i++ 669 655 Wend … … 688 674 End If 689 675 690 TempPtr[i]=i3 As StrChar676 TempPtr[i]=i3 As Char 691 677 i++ 692 678 Wend … … 703 689 Else 704 690 '10進数 705 #ifdef __STRING_IS_NOT_UNICODE 691 #ifdef UNICODE 692 swscanf(buf,"%lf",VarPtr(Val)) 693 #else 706 694 sscanf(buf,"%lf",VarPtr(Val)) 707 #else708 swscanf(buf,ToWCStr("%lf"),VarPtr(Val))709 695 #endif 710 696 End If … … 981 967 982 968 Function _System_IsLowSurrogate(c As WCHAR) As Boolean 983 Return &hDC00 <= c And c < &hE000 969 Return &hDC00 <= c And c < &hE000 984 970 End Function 985 971 … … 1000 986 _System_GetHashFromWordArray = hash As Long 1001 987 End Function 1002 1003 #endif '_INC_FUNCTION
Note:
See TracChangeset
for help on using the changeset viewer.