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