source: trunk/Include/basic/dos_console.sbp@ 473

Last change on this file since 473 was 473, checked in by イグトランス (egtra), 16 years ago

実験として書いていたControlクラスを追加(せめてコミット前に既存のContorolに混ぜようとしたがコンパイルできなかった)。
ほかForms, Drawing及びGDI+の修正。

File size: 2.0 KB
RevLine 
[1]1'dos_console.sbp
2'このファイルには、コンソール アプリケーション用のサポート プログラムが記載されます。
3
4
5#ifndef _INC_DOS_CONSOLE
6#define _INC_DOS_CONSOLE
7
8
[268]9Dim _System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
10Dim _System_hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
[432]11System.Console.SetIn(
[473]12 System.IO.TextReader.Synchronized(New System.IO.StreamReader(
13 New System.IO.FileStream(_System_hConsoleIn, System.IO.FileAccess.Read, False))))
[1]14
15'---------- command.sbp内で定義済み ----------
16'Dim _System_InputDataPtr[_System_MAX_PARMSNUM] As VoidPtr
17'Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
18'---------------------------------------------
19Sub INPUT_FromPrompt(ShowStr As String)
[432]20*InputReStart '多重Continueがあるので、これはループ構文に直せない。
[1]21 PRINT_ToPrompt(ShowStr)
22
23 '入力
[432]24 Dim input = System.Console.ReadLine()
25 If ActiveBasic.IsNothing(input) Then
26 Exit Sub
[110]27 End If
[1]28
[432]29 If input.Length = 0 Then Goto *InputReStart
[272]30
[1]31 'データを変数に格納
[272]32 Const comma = &h2c As StrChar 'Asc(",")
[432]33 Dim broken = ActiveBasic.Strings.Detail.Split(input, comma)
[272]34 Dim i As Long
35 For i = 0 To ELM(broken.Count)
36 If _System_InputDataPtr[i] = 0 Then
[142]37 PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n")
[432]38 Goto *InputReStart
[1]39 End If
[391]40 _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], broken[i])
[272]41 Next
[1]42
[272]43 If _System_InputDataPtr[i]<>0 Then
44 PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n")
[432]45 Goto *InputReStart
[272]46 End If
[1]47End Sub
48
49Macro LOCATE(x As Long, y As Long)
[110]50 SetConsoleCursorPosition(_System_hConsoleOut, MAKELONG(x, y))
[1]51End Macro
52
53Sub PRINT_ToPrompt(buf As String)
[432]54 If String.IsNullOrEmpty(buf) Then
55 Exit Sub
56 End If
57
[1]58 Dim dwAccessBytes As DWord
[272]59 WriteConsole(_System_hConsoleOut, buf.StrPtr, buf.Length, dwAccessBytes, 0)
[1]60End Sub
[288]61/* TODO: _System_GetUsingFormatを用意して実装する
[1]62Sub PRINTUSING_ToPrompt(UsingStr As String)
63 PRINT_ToPrompt(_System_GetUsingFormat(UsingStr))
64End Sub
[288]65*/
[1]66
67#endif '_INC_DOS_CONSOLE
Note: See TracBrowser for help on using the repository browser.