Changeset 497 for trunk/Include/basic
- Timestamp:
- Mar 28, 2008, 5:43:34 PM (17 years ago)
- Location:
- trunk/Include/basic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/basic/command.sbp
r478 r497 1 1 'command.sbp 2 3 4 #ifndef _INC_COMMAND5 #define _INC_COMMAND6 2 7 3 Const _System_Type_SByte = 1 … … 152 148 Sub INPUT_FromFile(FileNumber As Long) 153 149 FileNumber-- 154 150 155 151 Dim i = 0 As Long 156 152 Dim buffer = New System.Text.StringBuilder(256) 157 Dim temp[1] As StrChar153 Dim temp[1] As Char 158 154 Dim dwAccessBytes As DWord 159 155 Dim IsStr As Long … … 162 158 '次のデータをサーチ 163 159 Do 164 Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf ( StrChar),VarPtr(dwAccessBytes),ByVal 0)160 Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf (Char),VarPtr(dwAccessBytes),ByVal 0) 165 161 If ret=0 or dwAccessBytes=0 Then 166 162 'error … … 173 169 IsStr=0 174 170 While 1 175 Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf ( StrChar),VarPtr(dwAccessBytes),ByVal 0)171 Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf (Char),VarPtr(dwAccessBytes),ByVal 0) 176 172 If ret = 0 or dwAccessBytes = 0 Then 177 173 'error … … 183 179 If dwAccessBytes=0 or temp[0]=0 or temp[0]=13 or temp[0]=10 or (IsStr=0 and temp[0]=Asc(",")) or (IsStr=0 and (temp[0]=32 or temp[0]=9) and _System_InputDataType[i]<>_System_Type_String) Then 184 180 If temp[0]=13 Then 185 ReadFile(_System_hFile[FileNumber],temp,SizeOf ( StrChar),VarPtr(dwAccessBytes),ByVal 0)181 ReadFile(_System_hFile[FileNumber],temp,SizeOf (Char),VarPtr(dwAccessBytes),ByVal 0) 186 182 If Not(dwAccessBytes<>0 And temp[0]=10) Then 187 183 SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT) … … 202 198 End If 203 199 204 buffer.Append(0 As StrChar)200 buffer.Append(0 As Char) 205 201 Exit While 206 202 End If … … 252 248 Function _System_GetUsingFormat(UsingStr As String) As String 253 249 Dim i2 As Long, i3 As Long, i4 As Long, i5 As Long, ParmNum As Long 254 Dim temporary[255] As StrChar250 Dim temporary[255] As Char 255 251 Dim buffer = New System.Text.StringBuilder(1024) 256 252 … … 270 266 If UsingStr[i2]=Asc("#") Then 271 267 Dim dec As Long, sign As Long 272 Dim temp2 As * StrChar268 Dim temp2 As *Char 273 269 274 270 Dim length_num As Long, length_buf As Long … … 325 321 326 322 If dec > 0 Then 327 memcpy(VarPtr(buffer.Chars[i3]), temp2, SizeOf ( StrChar) * length_num)323 memcpy(VarPtr(buffer.Chars[i3]), temp2, SizeOf (Char) * length_num) 328 324 Else 329 325 buffer[i3] = &H30 … … 376 372 ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), i4, &h20) 'Asc(" ") 377 373 End If 378 memcpy(VarPtr(buffer.Chars[i3]), _System_UsingStrData[ParmNum], SizeOf ( StrChar) * i5)374 memcpy(VarPtr(buffer.Chars[i3]), _System_UsingStrData[ParmNum], SizeOf (Char) * i5) 379 375 i3 += i4 380 376 Else … … 416 412 RecodeNumber-- 417 413 418 SetFilePointer(_System_hFile(FileNumber), SizeOf ( StrChar) * RecodeNumber * _System_FieldSize(FileNumber), 0, FILE_BEGIN)414 SetFilePointer(_System_hFile(FileNumber), SizeOf (Char) * RecodeNumber * _System_FieldSize(FileNumber), 0, FILE_BEGIN) 419 415 Dim t = ZeroString(_System_FieldSize(FileNumber)) 420 ReadFile(_System_hFile(FileNumber), StrPtr(t), SizeOf ( StrChar) * _System_FieldSize(FileNumber), VarPtr(dwAccessByte), ByVal 0)416 ReadFile(_System_hFile(FileNumber), StrPtr(t), SizeOf (Char) * _System_FieldSize(FileNumber), VarPtr(dwAccessByte), ByVal 0) 421 417 If dwAccessByte = _System_FieldSize(FileNumber) Then 422 418 buffer = t.ToString … … 431 427 RecodeNumber-- 432 428 433 SetFilePointer(_System_hFile(FileNumber), SizeOf ( StrChar) * RecodeNumber*_System_FieldSize(FileNumber), 0, FILE_BEGIN)434 WriteFile(_System_hFile(FileNumber), StrPtr(buffer), SizeOf ( StrChar) * _System_FieldSize(FileNumber), VarPtr(dwAccessByte), ByVal 0)429 SetFilePointer(_System_hFile(FileNumber), SizeOf (Char) * RecodeNumber*_System_FieldSize(FileNumber), 0, FILE_BEGIN) 430 WriteFile(_System_hFile(FileNumber), StrPtr(buffer), SizeOf (Char) * _System_FieldSize(FileNumber), VarPtr(dwAccessByte), ByVal 0) 435 431 End Macro 436 432 … … 444 440 DeleteFile(ToTCStr(path)) 445 441 End Macro 446 447 448 #endif '_INC_COMMAND -
trunk/Include/basic/dos_console.sbp
r473 r497 30 30 31 31 'データを変数に格納 32 Const comma = &h2c As StrChar 'Asc(",")32 Const comma = &h2c As Char 'Asc(",") 33 33 Dim broken = ActiveBasic.Strings.Detail.Split(input, comma) 34 34 Dim i As Long -
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 -
trunk/Include/basic/prompt.sbp
r411 r497 8 8 Namespace Prompt 9 9 Namespace Detail 10 10 11 11 Function _PromptSys_GetTextExtentPoint32(hdc As HDC, psz As PCSTR, cb As Long, ByRef Size As SIZE) As Long 12 12 _PromptSys_GetTextExtentPoint32 = GetTextExtentPoint32A(hdc, psz, cb, Size) … … 47 47 Type _PromptSys_LineInformation 48 48 Length As Long 49 Text As * StrChar49 Text As *Char 50 50 CharInfo As *_PromptSys_CharacterInformation 51 51 End Type … … 53 53 Dim _PromptSys_hFont As HFONT 54 54 Dim _PromptSys_FontSize As SIZE 55 Dim _PromptSys_InputStr[255] As StrChar55 Dim _PromptSys_InputStr[255] As Char 56 56 Dim _PromptSys_InputLen = -1 As Long 57 57 Dim _PromptSys_KeyChar As Byte … … 97 97 Next 98 98 _PromptSys_TextLine[100].Length = 0 99 _PromptSys_TextLine[100].Text = _System_calloc(SizeOf ( StrChar) * 255)99 _PromptSys_TextLine[100].Text = _System_calloc(SizeOf (Char) * 255) 100 100 _PromptSys_TextLine[100].CharInfo = _System_calloc(SizeOf (_PromptSys_CharacterInformation) * 255) 101 101 _PromptSys_CurPos.y-- … … 136 136 End If 137 137 With _PromptSys_FontSize 138 _PromptSys_TextOut(hDC, currentLineCharInfo[i2].StartPos, i * .cy, VarPtr(_PromptSys_TextLine[i].Text[i2]) As * StrChar, tempLen)138 _PromptSys_TextOut(hDC, currentLineCharInfo[i2].StartPos, i * .cy, VarPtr(_PromptSys_TextLine[i].Text[i2]) As *Char, tempLen) 139 139 End With 140 140 i2 += tempLen … … 191 191 EndIf 192 192 Dim p = buf.StrPtr 193 _PromptSys_GetTextExtentPoint32(hdc, VarPtr(p[i2]) As * StrChar, charLen, sz)193 _PromptSys_GetTextExtentPoint32(hdc, VarPtr(p[i2]) As *Char, charLen, sz) 194 194 currentLineCharInfo[.x + 1].StartPos = currentLineCharInfo[.x].StartPos + sz.cx 195 195 End If … … 421 421 End If 422 422 Dim tempStr = Nothing As String 423 Dim str As *StrChar 424 #ifdef __STRING_IS_NOT_UNICODE 425 Dim size = _PromptWnd_GetCompositionStringA(himc, str) 426 tempStr = New String(str, size As Long) 427 #else 423 Dim str As *Char 424 #ifdef UNICODE 428 425 Dim osver = System.Environment.OSVersion 429 426 With osver 430 ' GetCompositionStringW is not implimented in Windows 95 427 ' GetCompositionStringW is not implimented in Windows 95 431 428 If .Version.Major = 4 And .Version.Minor = 0 And .Platform = System.PlatformID.Win32Windows Then 432 429 Dim strA As PCSTR … … 438 435 End If 439 436 End With 437 #else 438 Dim size = _PromptWnd_GetCompositionStringA(himc, str) 439 tempStr = New String(str, size As Long) 440 440 #endif 441 441 ImmReleaseContext(hwnd, himc) … … 460 460 With _PromptSys_TextLine[i] 461 461 .Length = 0 462 .Text = _System_calloc(SizeOf ( StrChar) * 255)462 .Text = _System_calloc(SizeOf (Char) * 255) 463 463 .CharInfo = _System_calloc(SizeOf (_PromptSys_CharacterInformation) * 255) 464 464 End With … … 543 543 For i = 0 To 100 544 544 With _PromptSys_TextLine[i] 545 .Text[0] = 0 '_System_FillChar(_PromptSys_TextLine[i].Text, -1 As StrChar, 0)545 .Text[0] = 0 '_System_FillChar(_PromptSys_TextLine[i].Text, -1 As Char, 0) 546 546 .Length = 0 547 547 End With … … 589 589 590 590 'Set value to variable 591 Const comma = &h2c As StrChar 'Asc(",")591 Const comma = &h2c As Char 'Asc(",") 592 592 Dim broken = ActiveBasic.Strings.Detail.Split(New String(_PromptSys_InputStr), comma) 593 593 Dim i As Long … … 617 617 Dim i = _PromptSys_TextLine[y].Length 618 618 If i < x Then 619 ActiveBasic.Strings.ChrFill(VarPtr(_PromptSys_TextLine[y].Text[i]), x - i, &h20 As StrChar) 'Asc(" ")619 ActiveBasic.Strings.ChrFill(VarPtr(_PromptSys_TextLine[y].Text[i]), x - i, &h20 As Char) 'Asc(" ") 620 620 Dim i2 As Long 621 621 For i2 = i To ELM(x)
Note:
See TracChangeset
for help on using the changeset viewer.