Changeset 432 for trunk/Include/basic


Ignore:
Timestamp:
Feb 27, 2008, 1:04:59 AM (17 years ago)
Author:
イグトランス (egtra)
Message:

StreamReaderの完成。StringReaderの追加。
Consoleの追加(現在入力関係の一部のみ)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/basic/dos_console.sbp

    r391 r432  
    99Dim _System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
    1010Dim _System_hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
     11System.Console.SetIn(
     12    New System.IO.StreamReader(
     13        New System.IO.FileStream(_System_hConsoleIn, System.IO.FileAccess.Read, False)))
    1114
    1215'---------- command.sbp内で定義済み ----------
     
    1518'---------------------------------------------
    1619Sub INPUT_FromPrompt(ShowStr As String)
    17     Dim InputBuf[1023] As TCHAR
    18     Dim dwAccessBytes As DWord
    19 
    20 *InputReStart
    21 
     20*InputReStart '多重Continueがあるので、これはループ構文に直せない。
    2221    PRINT_ToPrompt(ShowStr)
    2322
    2423    '入力
    25     ReadConsole(_System_hConsoleIn, InputBuf, Len(InputBuf), dwAccessBytes, 0)
    26     If InputBuf[dwAccessBytes-2] = &h0d And InputBuf[dwAccessBytes-1] = &h0a Then
    27         InputBuf[dwAccessBytes-2] = 0
    28         dwAccessBytes -= 2
     24    Dim input = System.Console.ReadLine()
     25    If ActiveBasic.IsNothing(input) Then
     26        Exit Sub
    2927    End If
    3028
    31     If dwAccessBytes = 0 Then Goto *InputReStart
     29    If input.Length = 0 Then Goto *InputReStart
    3230
    3331    'データを変数に格納
    3432    Const comma = &h2c As StrChar 'Asc(",")
    35     Dim broken = ActiveBasic.Strings.Detail.Split(New String(InputBuf, dwAccessBytes As Long), comma)
     33    Dim broken = ActiveBasic.Strings.Detail.Split(input, comma)
    3634    Dim i As Long
    3735    For i = 0 To ELM(broken.Count)
    3836        If _System_InputDataPtr[i] = 0 Then
    3937            PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n")
    40             Goto *InputReStart
     38             Goto *InputReStart
    4139        End If
    4240        _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], broken[i])
     
    4543    If _System_InputDataPtr[i]<>0 Then
    4644        PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n")
    47         Goto *InputReStart
     45         Goto *InputReStart
    4846    End If
    4947End Sub
     
    5452
    5553Sub PRINT_ToPrompt(buf As String)
     54    If String.IsNullOrEmpty(buf) Then
     55        Exit Sub
     56    End If
     57
    5658    Dim dwAccessBytes As DWord
    5759#ifdef __STRING_UNICODE_WINDOWS_ANSI
Note: See TracChangeset for help on using the changeset viewer.