Changeset 272 for Include/basic
- Timestamp:
- Jun 12, 2007, 7:24:38 PM (17 years ago)
- Location:
- Include/basic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/basic/command.sbp
r269 r272 163 163 Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord 164 164 Sub INPUT_FromFile(FileNumber As Long) 165 Dim i As Long ,i2 As Long, i3 As Long 166 Dim buffer As String 165 FileNumber-- 166 167 Dim i = 0 As Long 168 Dim i2 As Long, i3 As Long 169 Dim buffer = New System.Text.StringBuilder(GetFileSize(_System_hFile[FileNumber], 0) + 1) 167 170 Dim temp[1] As StrChar 168 171 Dim dwAccessBytes As DWord 169 172 Dim IsStr As Long 170 173 171 FileNumber--172 173 buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0) + 1)174 175 i=0176 174 While 1 177 175 '次のデータをサーチ … … 226 224 227 225 'データを変数に格納 228 _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], buffer , i3)226 _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], buffer.ToString) 229 227 230 228 … … 234 232 End Sub 235 233 236 Sub _System_Input_SetArgument(arg As VoidPtr, dataType As DWord, ByRef buf As String, bufLen As Long)234 Sub _System_Input_SetArgument(arg As VoidPtr, dataType As DWord, buf As String) 237 235 Select Case dataType 238 236 Case _System_Type_Double … … 253 251 Dim pTempStr As *String 254 252 pTempStr = arg As *String 255 pTempStr->ReSize(bufLen) 256 memcpy(pTempStr->Chars, buf.Chars, SizeOf (StrChar) * pTempStr->Length) 257 pTempStr->Chars[pTempStr->Length] = 0 253 pTempStr[0] = buf 258 254 End Select 259 255 End Sub … … 269 265 Dim _System_UsingStrData[_System_MAX_PARMSNUM] As *Char 'TODO: 暫定対応(動作未確認) 270 266 Dim _System_UsingDataType[_System_MAX_PARMSNUM] As DWord 267 /* 271 268 Function _System_GetUsingFormat(UsingStr As String) As String 272 269 Dim i2 As Long, i3 As Long, i4 As Long, i5 As Long, ParmNum As Long 273 270 Dim temporary[255] As StrChar 274 Dim buffer As String 275 276 buffer = ZeroString(1024) 271 Dim buffer = New System.Text.StringBuilder(1024) 277 272 278 273 ParmNum = 0 … … 334 329 If length_buf>=length_num Then 335 330 '通常時 336 _System_FillChar(VarPtr(buffer.Chars[i3]), length_buf - length_num, &h20) 'Asc(" ")331 ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), length_buf - length_num, &h20) 'Asc(" ") 337 332 338 333 i3 += length_buf - length_num … … 354 349 Else 355 350 '表示桁が足りないとき 356 _System_FillChar(VarPtr(buffer.Chars[i3]), length_buf, &h23) 'Asc("#")351 ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), length_buf, &h23) 'Asc("#") 357 352 i3 += length_buf 358 353 End If … … 395 390 i5=i4 396 391 Else 397 _System_FillChar(VarPtr(buffer.Chars[i3]), i4, &h20) 'Asc(" ")392 ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), i4, &h20) 'Asc(" ") 398 393 End If 399 394 memcpy(VarPtr(buffer.Chars[i3]), _System_UsingStrData[ParmNum], SizeOf (StrChar) * i5) … … 411 406 Wend 412 407 413 _System_GetUsingFormat = Left$(buffer, lstrlen(buffer))408 _System_GetUsingFormat = buffer.ToString(0, lstrlen(StrBPtr(buffer))) 414 409 End Function 410 */ 415 411 Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String) 416 412 Dim dwAccessByte As DWord -
Include/basic/dos_console.sbp
r268 r272 8 8 9 9 #include <api_console.sbp> 10 #include <Classes/ActiveBasic/Strings/Strings.ab> 10 11 11 12 Dim _System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE) … … 17 18 '--------------------------------------------- 18 19 Sub INPUT_FromPrompt(ShowStr As String) 19 Dim i As Long, i2 As Long, i3 As Long20 Dim buf As String21 20 Dim InputBuf[1023] As TCHAR 22 21 Dim dwAccessBytes As DWord … … 30 29 If InputBuf[dwAccessBytes-2] = &h0d And InputBuf[dwAccessBytes-1] = &h0a Then 31 30 InputBuf[dwAccessBytes-2] = 0 31 dwAccessBytes -= 2 32 32 End If 33 Dim InputStr As String(InputBuf) 33 34 If dwAccessBytes = 0 Then Goto *InputReStart 34 35 35 36 'データを変数に格納 36 i=0 37 i2=0 38 buf.ReSize(lstrlen(InputStr) + 1, 0) 39 Dim comma As Char 40 comma = &h2c 'Asc(",") 41 While 1 42 i3=0 43 While 1 44 If InputStr[i2]=comma Then 45 buf[i3]=0 46 Exit While 47 End If 48 49 buf[i3]=InputStr[i2] 50 51 If InputStr[i2]=0 Then Exit While 52 53 i2++ 54 i3++ 55 Wend 56 57 _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], buf, i3) 58 59 i++ 60 If _System_InputDataPtr[i]=0 And InputStr[i2]=comma Then 37 Const comma = &h2c As StrChar 'Asc(",") 38 Dim broken = ActiveBasic.Strings.Detail.Split(New String(InputBuf, dwAccessBytes As Long), comma) 39 Dim i As Long 40 For i = 0 To ELM(broken.Count) 41 If _System_InputDataPtr[i] = 0 Then 61 42 PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n") 62 43 Goto *InputReStart 63 ElseIf InputStr[i2]=0 Then64 If _System_InputDataPtr[i]<>0 Then65 PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n")66 Goto *InputReStart67 Else68 Exit While69 End If70 44 End If 45 _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], broken[i].ToString) 46 Next 71 47 72 i2++ 73 Wend 48 If _System_InputDataPtr[i]<>0 Then 49 PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n") 50 Goto *InputReStart 51 End If 74 52 End Sub 75 53 … … 90 68 _System_free(pszOut) 91 69 #else 92 WriteConsole(_System_hConsoleOut, buf. Chars, buf.Length, dwAccessBytes, 0)70 WriteConsole(_System_hConsoleOut, buf.StrPtr, buf.Length, dwAccessBytes, 0) 93 71 #endif 94 72 End Sub -
Include/basic/function.sbp
r269 r272 13 13 14 14 #require <Classes/System/Math.ab> 15 #require <Classes/System/DateTime.ab> 16 #require <Classes/System/Text/StringBuilder.ab> 15 17 #require <Classes/ActiveBasic/Math/Math.ab> 18 #require <Classes/ActiveBasic/Strings/Strings.ab> 16 19 17 20 … … 92 95 End Function 93 96 94 Const RAND_MAX =&H7FFFFFFF95 Dim _System_RndNext =1 As DWord97 Const RAND_MAX = &H7FFFFFFF 98 Dim _System_RndNext = 1 As DWord 96 99 97 100 Function rand() As Long 98 101 _System_RndNext = _System_RndNext * 1103515245 + 12345 99 rand = _System_RndNext >> 1102 rand = (_System_RndNext >> 1) As Long 100 103 End Function 101 104 … … 233 236 234 237 Function Chr$(code As StrChar) As String 235 Chr$ = ZeroString(1) 236 Chr$[0] = code 238 Chr$ = New String(code, 1) 237 239 End Function 238 240 … … 252 254 Function ChrW(c As UCSCHAR) As String 253 255 If c <= &hFFFF Then 254 ChrW.ReSize(1) 255 ChrW[0] = c As WCHAR 256 Return New String(c As StrChar, 1) 256 257 ElseIf c < &h10FFFF Then 257 ChrW.ReSize(2) 258 ChrW[0] = &hD800 Or (c >> 10) 259 ChrW[1] = &hDC00 Or (c And &h3FF) 260 Else 261 ' OutOfRangeException 258 Dim t[1] = [&hD800 Or (c >> 10), &hDC00 Or (c And &h3FF)] As StrChar 259 Return New String(t, 2) 260 Else 261 'ArgumentOutOfRangeException 262 262 End If 263 263 End Function … … 265 265 266 266 Function Date$() As String 267 Dim st As SYSTEMTIME268 GetLocalTime(st)267 Dim date = DateTime.Now 268 Dim buf = New System.Text.StringBuilder(10) 269 269 270 270 'year 271 Date$=Str$(st.wYear)271 buf.Append(date.Year) 272 272 273 273 'month 274 If st.wMonth<10 Then275 Date$=Date$+"/0"276 Else 277 Date$=Date$+"/"278 End If 279 Date$=Date$+Str$(st.wMonth)274 If date.Month < 10 Then 275 buf.Append("/0") 276 Else 277 buf.Append("/") 278 End If 279 buf.Append(date.Month) 280 280 281 281 'day 282 If st.wDay<10 Then 283 Date$=Date$+"/0" 284 Else 285 Date$=Date$+"/" 286 End If 287 Date$=Date$+Str$(st.wDay) 282 If date.Day < 10 Then 283 buf.Append("/0") 284 Else 285 buf.Append("/") 286 End If 287 buf.Append(date.Day) 288 289 Date$ = buf.ToString 288 290 End Function 289 291 … … 358 360 End Function 359 361 360 Function Left$(buf As String, length As Long) As String 361 Left$ = ZeroString(length) 362 memcpy(StrPtr(Left$), StrPtr(buf), SizeOf (StrChar) * length) 363 End Function 364 365 Function Mid$(buf As String, StartPos As Long)(ReadLength As Long) As String 366 Dim length As Long 367 368 StartPos-- 369 If StartPos<0 Then 370 'error 371 'Debug 372 Exit Function 373 End If 374 375 length=Len(buf) 376 If length<=StartPos Then Exit Function 377 378 If ReadLength=0 Then 379 ReadLength=length-StartPos 380 End If 381 382 If ReadLength>length-StartPos Then 383 ReadLength=length-StartPos 384 End If 385 386 Mid$=ZeroString(ReadLength) 387 memcpy(StrPtr(Mid$), VarPtr(buf.Chars[StartPos]), SizeOf (StrChar) * ReadLength) 388 End Function 389 390 Function Oct$(num As DWord) As String 391 Dim i As DWord, i2 As DWord 392 393 For i=10 To 1 Step -1 394 If (num \ CDWord(8^i)) And &H07 Then 395 Exit For 396 End If 397 Next 398 399 Oct$=ZeroString(i+1) 400 i2=0 362 Function Left$(s As String, length As Long) As String 363 Left$ = s.Substring(0, System.Math.Min(s.Length, length)) 364 End Function 365 366 Function Mid$(s As String, startPos As Long) As String 367 startPos-- 368 Mid$ = s.Substring(startPos) 369 End Function 370 371 Function Mid$(s As String, startPos As Long, readLength = 0 As Long) As String 372 startPos-- 373 Dim length = s.Length 374 Mid$ = s.Substring(System.Math.Min(startPos, length), System.Math.Min(readLength, length - startPos)) 375 End Function 376 377 Const _System_MaxFigure_Oct_QW = 22 As DWord 'QWORD_MAX = &o1,777,777,777,777,777,777,777 378 Function Oct$(n As QWord) As String 379 Dim s[ELM(_System_MaxFigure_Oct_QW)] As StrChar 380 Dim i = ELM(_System_MaxFigure_Oct_QW) As Long 401 381 Do 402 Oct$[i2] = &h30 + ((num \ CDWord(8 ^ i)) And &H07) As StrChar ' &h30 = Asc("0") 403 If i=0 Then Exit Do 382 s[i] = ((n And &o7) + &h30) As StrChar '&h30 = Asc("0") 383 n >>= 3 384 If n = 0 Then 385 Return New String(s + i, _System_MaxFigure_Oct_QW - i) 386 End If 404 387 i-- 405 i2++406 388 Loop 407 389 End Function 408 390 409 Function Right$(buf As String, length As Long) As String 410 Dim i As Long 411 412 i=Len(buf) 413 If i>length Then 414 Right$=ZeroString(length) 415 memcpy(StrPtr(Right$), VarPtr(buf.Chars[i-length]), SizeOf (StrChar) * length) 416 Else 417 Right$=buf 418 End If 391 Const _System_MaxFigure_Oct_DW = 11 As DWord 'DWORD_MAX = &o37,777,777,777 392 Function Oct$(n As DWord) As String 393 Dim s[ELM(_System_MaxFigure_Oct_DW)] As StrChar 394 Dim i = ELM(_System_MaxFigure_Oct_DW) As Long 395 Do 396 s[i] = ((n And &o7) + &h30) As StrChar '&h30 = Asc("0") 397 n >>= 3 398 If n = 0 Then 399 Return New String(s + i, _System_MaxFigure_Oct_DW - i) 400 End If 401 i-- 402 Loop 403 End Function 404 405 Function Right$(s As String, length As Long) As String 406 Right$ = s.Substring(System.Math.Max(0, s.Length - length), s.Length) 419 407 End Function 420 408 … … 447 435 '値が0の場合 448 436 If value = 0 Then 449 _System_FillChar(_System_ecvt_buffer, count As SIZE_T, &H30 As StrChar)437 ActiveBasic.Strings.ChrFill(_System_ecvt_buffer, count As SIZE_T, &H30 As StrChar) 450 438 _System_ecvt_buffer[count] = 0 451 439 dec = 0 … … 523 511 buffer[i] = Asc(".") 524 512 i++ 525 memcpy(VarPtr(buffer[i]), VarPtr(temp[1]), SizeOf (StrChar) *14)513 ActiveBasic.Strings.ChrCopy(VarPtr(buffer[i]), VarPtr(temp[1]), 14) 526 514 i += 14 527 515 buffer[i] = Asc("e") 528 516 i++ 529 _stprintf(VarPtr(buffer[i]), "+%03d", dec - 1) 517 _stprintf(VarPtr(buffer[i]), "+%03d", dec - 1) 'ToDo: __STRING_UNICODE_WINDOWS_ANSI状態への対応 530 518 531 519 Return MakeStr(buffer) … … 538 526 buffer[i] = Asc(".") 539 527 i++ 540 memcpy(VarPtr(buffer[i]), VarPtr(temp[1]), SizeOf (StrChar) *14)528 ActiveBasic.Strings.ChrCopy(VarPtr(buffer[i]), VarPtr(temp[1]), 14) 541 529 i+=14 542 530 buffer[i] = Asc("e") 543 531 i++ 544 _stprintf(VarPtr(buffer[i]), "+%03d", dec - 1) 532 _stprintf(VarPtr(buffer[i]), "+%03d", dec - 1) 'ToDo: __STRING_UNICODE_WINDOWS_ANSI状態への対応 545 533 546 534 Return MakeStr(buffer) … … 603 591 604 592 Dim buf[20] As StrChar 605 buf[20] = 0593 'buf[20] = 0 606 594 Dim i = 19 As Long 607 595 Do … … 640 628 Dim i = 9 As Long 641 629 Do 642 buf[i] = (x Mod 10 + &h30) As StrChar630 buf[i] = (x As Int64 Mod 10 + &h30) As StrChar 'Int64への型変換は#117対策 643 631 x \= 10 644 632 If x = 0 Then 645 Exit Do633 Return New String(VarPtr(buf[i]), 10 - i) 646 634 End If 647 635 i-- 648 Loop 649 Return New String(VarPtr(buf[i]), 10 - i) 636 Loop 650 637 #endif 651 638 End Function … … 679 666 End Function 680 667 681 Function String$(num As Long, buf As String) As String 682 Dim dwStrPtr As DWord 683 Dim length As Long 684 685 length=Len(buf) 686 687 'バッファ領域を確保 688 String$=ZeroString(length*num) 689 690 '文字列をコピー 668 Function String$(n As Long, s As StrChar) As String 669 Return New String(s, n) 670 End Function 671 672 #ifdef _AB4_COMPATIBILITY_STRING$_ 673 Function String$(n As Long, s As String) As String 674 If n < 0 Then 675 'Throw ArgumentOutOfRangeException 676 End If 677 678 Dim buf = New System.Text.StringBuilder(s.Length * n) 691 679 Dim i As Long 692 For i =0 To num-1693 memcpy(VarPtr(String$.Chars[i*length]), StrPtr(buf), SizeOf (StrChar) * length)680 For i = 0 To n 681 buf.Append(s) 694 682 Next 695 683 End Function 684 #else 685 Function String$(n As Long, s As String) As String 686 If String.IsNullOrEmpty(s) Then 687 Return New String(0 As StrChar, n) 688 Else 689 Return New String(s[0], n) 690 End If 691 End Function 692 #endif 696 693 697 694 Function Time$() As String 698 Dim st As SYSTEMTIME699 700 GetLocalTime(st)695 Dim time = DateTime.Now 696 697 Dim buf = New System.Text.StringBuilder(8) 701 698 702 699 'hour 703 If st.wHour<10 Then704 Time$="0"705 End If 706 Time$=Time$+Str$(st.wHour)700 If time.Hour < 10 Then 701 buf.Append("0") 702 End If 703 buf.Append(time.Hour) 707 704 708 705 'minute 709 If st.wMinute<10 Then710 Time$=Time$+":0"711 Else 712 Time$=Time$+":"713 End If 714 Time$=Time$+Str$(st.wMinute)706 If time.Minute < 10 Then 707 buf.Append(":0") 708 Else 709 buf.Append(":") 710 End If 711 buf.Append(time.Minute) 715 712 716 713 'second 717 If st.wSecond<10 Then 718 Time$=Time$+":0" 719 Else 720 Time$=Time$+":" 721 End If 722 Time$=Time$+Str$(st.wSecond) 714 If time.Second < 10 Then 715 buf.Append(":0") 716 Else 717 buf.Append(":") 718 End If 719 buf.Append(time.Second) 720 Time$ = buf.ToString 723 721 End Function 724 722 … … 738 736 If buf[0]=Asc("&") Then 739 737 temporary = New String( buf ) 740 temporary .ToUpper()738 temporary = temporary.ToUpper() 741 739 TempPtr = StrPtr(temporary) 742 740 If TempPtr(1)=Asc("O") Then … … 816 814 817 815 Function Loc(FileNum As Long) As Long 818 Dim NowPos As Long, BeginPos As Long819 820 816 FileNum-- 821 817 822 NowPos=SetFilePointer(_System_hFile(FileNum),0,NULL,FILE_CURRENT)823 BeginPos=SetFilePointer(_System_hFile(FileNum),0,NULL,FILE_BEGIN)824 SetFilePointer(_System_hFile(FileNum), NowPos-BeginPos,NULL,FILE_BEGIN)825 826 Loc =NowPos-BeginPos818 Dim NowPos = SetFilePointer(_System_hFile(FileNum), 0, 0, FILE_CURRENT) 819 Dim BeginPos = SetFilePointer(_System_hFile(FileNum), 0, 0, FILE_BEGIN) 820 SetFilePointer(_System_hFile(FileNum), NowPos - BeginPos, 0, FILE_BEGIN) 821 822 Loc = NowPos - BeginPos 827 823 End Function 828 824 … … 851 847 _System_pGC->__free(lpMem) 852 848 End Sub 853 854 849 855 850 Function _System_malloc(stSize As SIZE_T) As VoidPtr … … 1044 1039 End Function 1045 1040 1046 Sub _System_FillChar(p As PWSTR, n As SIZE_T, c As WCHAR)1047 Dim i As SIZE_T1048 For i = 0 To ELM(n)1049 p[i] = c1050 Next1051 End Sub1052 1053 Sub _System_FillChar(p As PSTR, n As SIZE_T, c As SByte)1054 Dim i As SIZE_T1055 For i = 0 To ELM(n)1056 p[i] = c1057 Next1058 End Sub1059 1060 1041 Function _System_ASCII_IsUpper(c As WCHAR) As Boolean 1061 1042 Return c As DWord - &h41 < 26 ' &h41 = Asc("A") … … 1096 1077 Function _System_ASCII_ToUpper(c As SByte) As SByte 1097 1078 Return _System_ASCII_ToUpper(c As Byte As WCHAR) As Byte As SByte 1098 End Function1099 1100 Function _System_ChrCpy(dst As PCWSTR, src As PCWSTR, size As SIZE_T) As PCWSTR1101 memcpy(dst, src, size * SizeOf (WCHAR))1102 Return dst1103 End Function1104 1105 Function _System_ChrCpy(dst As PCSTR, src As PCSTR, size As SIZE_T) As PCSTR1106 memcpy(dst, src, size)1107 Return dst1108 End Function1109 1110 Function _System_StrCmp(s1 As PCSTR, s2 As PCSTR) As Long1111 Dim i = 0 As SIZE_T1112 While s1[i] = s2[i]1113 If s1[i] = 0 Then1114 Exit While1115 End If1116 i++1117 Wend1118 _System_StrCmp = s1[i] - s2[i]1119 End Function1120 1121 Function _System_StrCmp(s1 As PCWSTR, s2 As PCWSTR) As Long1122 Dim i = 0 As SIZE_T1123 While s1[i] = s2[i]1124 If s1[i] = 0 Then1125 Exit While1126 End If1127 i++1128 Wend1129 _System_StrCmp = s1[i] - s2[i]1130 End Function1131 1132 Function _System_StrCmpN(s1 As PCSTR, s2 As PCSTR, size As SIZE_T) As Long1133 Dim i = 0 As SIZE_T1134 For i = 0 To ELM(size)1135 _System_StrCmpN = s1[i] - s2[i]1136 If _System_StrCmpN <> 0 Then1137 Exit Function1138 End If1139 Next1140 End Function1141 1142 Function _System_StrCmpN(s1 As PCWSTR, s2 As PCWSTR, size As SIZE_T) As Long1143 Dim i = 0 As SIZE_T1144 For i = 0 To ELM(size)1145 _System_StrCmpN = s1[i] - s2[i]1146 If _System_StrCmpN <> 0 Then1147 Exit Function1148 End If1149 Next1150 End Function1151 1152 Function _System_MemChr(s As PCSTR, c As CHAR, size As SIZE_T) As PCSTR1153 Dim i As SIZE_T1154 For i = 0 To ELM(size)1155 If s[i] = c Then1156 Return VarPtr(s[i])1157 End If1158 Next1159 Return 01160 End Function1161 1162 Function _System_MemChr(s As PCWSTR, c As WCHAR, size As SIZE_T) As PCWSTR1163 Dim i As SIZE_T1164 For i = 0 To ELM(size)1165 If s[i] = c Then1166 Return VarPtr(s[i])1167 End If1168 Next1169 Return 01170 End Function1171 1172 Function _System_MemPBrk(str As PCSTR, cStr As SIZE_T, Chars As PCSTR, cChars As SIZE_T) As PCSTR1173 Dim i As SIZE_T1174 For i = 0 To ELM(cStr)1175 If _System_MemChr(Chars, str[i], cChars) Then1176 Return VarPtr(str[i])1177 End If1178 Next1179 Return 01180 End Function1181 1182 Function _System_MemPBrk(str As PCWSTR, cStr As SIZE_T, Chars As PCWSTR, cChars As SIZE_T) As PCWSTR1183 Dim i As SIZE_T1184 For i = 0 To ELM(cStr)1185 If _System_MemChr(Chars, str[i], cChars) Then1186 Return VarPtr(str[i])1187 End If1188 Next1189 Return 01190 1079 End Function 1191 1080 -
Include/basic/prompt.sbp
r269 r272 75 75 76 76 Sub _PromptSys_Initialize() 77 _PromptSys_hInitFinish = CreateEvent(0, FALSE, FALSE, 0)78 Dim _PromptSys_hThread = CreateThread(0, 0, AddressOf(PromptMain), 0, 0, _PromptSys_dwThreadID)79 If _PromptSys_hThread = 0 Then80 Debug81 ExitProcess(1)82 End If83 WaitForSingleObject(_PromptSys_hInitFinish, INFINITE)77 _PromptSys_hInitFinish = CreateEvent(0, FALSE, FALSE, 0) 78 Dim _PromptSys_hThread = CreateThread(0, 0, AddressOf(PromptMain), 0, 0, _PromptSys_dwThreadID) 79 If _PromptSys_hThread = 0 Then 80 Debug 81 ExitProcess(1) 82 End If 83 WaitForSingleObject(_PromptSys_hInitFinish, INFINITE) 84 84 End Sub 85 85 … … 191 191 charLen = 1 192 192 EndIf 193 _PromptSys_GetTextExtentPoint32(hdc, VarPtr(buf.Chars[i2]) As *StrChar, charLen, sz) 193 Dim p = buf.StrPtr 194 _PromptSys_GetTextExtentPoint32(hdc, VarPtr(p[i2]) As *StrChar, charLen, sz) 194 195 currentLineCharInfo[.x + 1].StartPos = currentLineCharInfo[.x].StartPos + sz.cx 195 196 /* … … 363 364 */ 364 365 Else 365 _PromptSys_InputStr[_PromptSys_InputLen] = wParam As Byte 366 Dim t = wParam As TCHAR 367 TempStr = New String(VarPtr(t), 1) 368 _PromptSys_InputStr[_PromptSys_InputLen] = TempStr[0] 366 369 _PromptSys_InputLen++ 367 368 TempStr.ReSize(1)369 TempStr[0] = wParam As Char370 370 End If 371 371 … … 403 403 Return 0 404 404 End If 405 Dim tempStr As String405 Dim tempStr = Nothing As String 406 406 Dim str As *StrChar 407 407 #ifdef __STRING_IS_NOT_UNICODE 408 408 Dim size = _PromptWnd_GetCompositionStringA(himc, str) 409 tempStr .Assign(str, size)409 tempStr = New String(str, size As Long) 410 410 #else 411 411 Dim osver = System.Environment.OSVersion … … 415 415 Dim strA As PCSTR 416 416 Dim sizeA = _PromptWnd_GetCompositionStringA(himc, strA) 417 tempStr .AssignFromMultiByte(strA, sizeA)417 tempStr = New String(strA, sizeA As Long) 418 418 Else 419 419 Dim size = _PromptWnd_GetCompositionStringW(himc, str) 420 tempStr .Assign(str, size \ SizeOf (WCHAR))420 tempStr = New String(str, (size \ SizeOf (WCHAR)) As Long) 421 421 End If 422 422 End With … … 425 425 _System_free(str) 426 426 427 memcpy(VarPtr(_PromptSys_InputStr[_PromptSys_InputLen]), tempStr.Chars, SizeOf (StrChar) * tempStr.Length)427 ActiveBasic.Strings.ChrCopy(VarPtr(_PromptSys_InputStr[_PromptSys_InputLen]), tempStr.StrPtr, tempStr.Length As SIZE_T) 428 428 _PromptSys_InputLen += tempStr.Length 429 429 … … 583 583 584 584 Sub INPUT_FromPrompt(showStr As String) 585 Dim i As Long, i2 As Long, i3 As Long586 Dim buf As String587 588 585 *InputReStart 589 586 … … 599 596 600 597 'Set value to variable 601 i = 0 602 i2 = 0 603 buf = ZeroString(lstrlen(_PromptSys_InputStr)) 604 While 1 605 i3 = 0 606 While 1 607 If _PromptSys_InputStr[i2] = &h2c Then 608 buf.Chars[i3] = 0 609 Exit While 610 End If 611 612 buf.Chars[i3] = _PromptSys_InputStr[i2] 613 614 If _PromptSys_InputStr[i2] = 0 Then Exit While 615 616 i2++ 617 i3++ 618 Wend 619 620 _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], buf, i3) 621 622 i++ 623 If _System_InputDataPtr[i] = 0 and _PromptSys_InputStr[i2] = &h2c Then 'Asc(",") 598 Const comma = &h2c As StrChar 'Asc(",") 599 Dim broken = ActiveBasic.Strings.Detail.Split(New String(_PromptSys_InputStr), comma) 600 Dim i As Long 601 For i = 0 To ELM(broken.Count) 602 If _System_InputDataPtr[i] = 0 Then 624 603 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n") 625 604 Goto *InputReStart 626 ElseIf _PromptSys_InputStr[i2] = 0 Then 627 If _System_InputDataPtr[i]<>0 Then 628 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n") 629 Goto *InputReStart 630 Else 631 Exit While 632 End If 633 End If 634 635 i2++ 636 Wend 605 End If 606 _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], broken[i].ToString) 607 Next 608 609 If _System_InputDataPtr[i]<>0 Then 610 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n") 611 Goto *InputReStart 612 End If 637 613 End Sub 638 614
Note:
See TracChangeset
for help on using the changeset viewer.