'dos_console.sbp 'このファイルには、コンソール アプリケーション用のサポート プログラムが記載されます。 #ifndef _INC_DOS_CONSOLE #define _INC_DOS_CONSOLE Dim _System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE) Dim _System_hConsoleIn = GetStdHandle(STD_INPUT_HANDLE) System.Console.SetOut( System.IO.TextWriter.Synchronized(New System.IO.StreamWriter( New System.IO.FileStream(_System_hConsoleOut, System.IO.FileAccess.Write, False)))) System.Console.SetIn( System.IO.TextReader.Synchronized(New System.IO.StreamReader( New System.IO.FileStream(_System_hConsoleIn, System.IO.FileAccess.Read, False)))) '---------- command.sbp内で定義済み ---------- 'Dim _System_InputDataPtr[_System_MAX_PARMSNUM] As VoidPtr 'Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord '--------------------------------------------- Sub INPUT_FromPrompt(ShowStr As String) *InputReStart '多重Continueがあるので、これはループ構文に直せない。 PRINT_ToPrompt(ShowStr) '入力 Dim input = System.Console.ReadLine() If ActiveBasic.IsNothing(input) Then Exit Sub End If If input.Length = 0 Then Goto *InputReStart 'データを変数に格納 Const comma = &h2c As Char 'Asc(",") Dim broken = ActiveBasic.Strings.Detail.Split(input, comma) Dim i As Long For i = 0 To ELM(broken.Count) If _System_InputDataPtr[i] = 0 Then PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n") Goto *InputReStart End If _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], broken[i]) Next If _System_InputDataPtr[i]<>0 Then PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n") Goto *InputReStart End If End Sub Macro LOCATE(x As Long, y As Long) SetConsoleCursorPosition(_System_hConsoleOut, MAKELONG(x, y)) End Macro Sub PRINT_ToPrompt(buf As String) If String.IsNullOrEmpty(buf) Then Exit Sub End If System.Console.Write(buf) End Sub /* TODO: _System_GetUsingFormatを用意して実装する Sub PRINTUSING_ToPrompt(UsingStr As String) PRINT_ToPrompt(_System_GetUsingFormat(UsingStr)) End Sub */ #endif '_INC_DOS_CONSOLE