- Timestamp:
- Jun 21, 2008, 3:59:30 PM (16 years ago)
- Location:
- trunk/ab5.0/ablib/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/System/Console.ab
r473 r522 11 11 Public 12 12 /* 13 @brief 標準出力を設定する 14 @date 2008/06/21 15 @auther overtaker 16 */ 17 Static Sub SetOut(newOut As IO.TextWriter) 18 If ActiveBasic.IsNothing(newOut) Then 19 Throw New ArgumentNullException("newOut") 20 End If 21 out = newOut 22 End Sub 23 24 /* 25 @brief 標準出力を取得する 26 @date 2008/06/21 27 @auther overtaker 28 */ 29 Static Function Out() As IO.TextWriter 30 Out = out 31 End Function 32 33 /* 34 @brief 標準出力に1行書き込む 35 @date 2008/06/21 36 @auther overtaker 37 */ 38 Static Sub WriteLine(value As String) 39 out.WriteLine(value) 40 out.Flush() 41 End Sub 42 43 Static Sub WriteLine() 44 out.WriteLine() 45 out.Flush() 46 End Sub 47 48 Static Sub WriteLine(x As Boolean) 49 WriteLine(Str$(x)) 50 End Sub 51 52 Static Sub WriteLine(x As Char) 53 WriteLine(Chr$(x)) 54 End Sub 55 56 Static Sub WriteLine(x As Byte) 57 WriteLine(Str$(x)) 58 End Sub 59 #ifdef UNICODE 60 Static Sub WriteLine(x As SByte) 61 WriteLine(Str$(x)) 62 End Sub 63 #else 64 Static Sub WriteLine(x As Word) 65 WriteLine(Str$(x)) 66 End Sub 67 #endif 68 Static Sub WriteLine(x As Integer) 69 WriteLine(Str$(x)) 70 End Sub 71 72 Static Sub WriteLine(x As DWord) 73 WriteLine(Str$(x)) 74 End Sub 75 76 Static Sub WriteLine(x As Long) 77 WriteLine(Str$(x)) 78 End Sub 79 80 Static Sub WriteLine(x As QWord) 81 WriteLine(Str$(x)) 82 End Sub 83 84 Static Sub WriteLine(x As Int64) 85 WriteLine(Str$(x)) 86 End Sub 87 88 Static Sub WriteLine(x As Single) 89 WriteLine(Str$(x)) 90 End Sub 91 92 Static Sub WriteLine(x As Double) 93 WriteLine(Str$(x)) 94 End Sub 95 96 Static Sub WriteLine(x As Object) 97 WriteLine(x.ToString) 98 End Sub 99 100 /* 101 @brief 標準出力に書き込む 102 @date 2008/06/21 103 @auther overtaker 104 */ 105 Static Sub Write(s As String) 106 out.Write(s) 107 out.Flush() 108 End Sub 109 110 Static Sub Write(x As Boolean) 111 Write(Str$(x)) 112 End Sub 113 114 Static Sub Write(x As Char) 115 Write(Chr$(x)) 116 End Sub 117 118 Static Sub Write(x As Byte) 119 Write(Str$(x)) 120 End Sub 121 #ifdef UNICODE 122 Static Sub Write(x As SByte) 123 Write(Str$(x)) 124 End Sub 125 #else 126 Static Sub Write(x As Word) 127 Write(Str$(x)) 128 End Sub 129 #endif 130 Static Sub Write(x As Integer) 131 Write(Str$(x)) 132 End Sub 133 134 Static Sub Write(x As DWord) 135 Write(Str$(x)) 136 End Sub 137 138 Static Sub Write(x As Long) 139 Write(Str$(x)) 140 End Sub 141 142 Static Sub Write(x As QWord) 143 Write(Str$(x)) 144 End Sub 145 146 Static Sub Write(x As Int64) 147 Write(Str$(x)) 148 End Sub 149 150 /* 13 151 @brief 標準入力を設定する 14 152 @date 2008/02/26 … … 21 159 in = newIn 22 160 End Sub 161 23 162 /* 24 163 @brief 標準入力を取得する … … 47 186 Read = in.Read() 48 187 End Function 188 49 189 Private 50 190 Function enter() As ActiveBasic.Windows.CriticalSectionLock … … 64 204 65 205 Static in = Nothing As IO.TextReader 206 Static out = Nothing As IO.TextWriter 66 207 Static cs = Nothing As ActiveBasic.Windows.CriticalSection 67 208 End Class -
trunk/ab5.0/ablib/src/Classes/System/IO/TextWriter.ab
r473 r522 176 176 End Function 177 177 178 Static Function Synchronized(reader As TextWriter) As TextWriter 179 ' TODO: 実装。とりあえずそのまま返却 180 Return reader 181 End Function 178 182 Protected 179 183 Virtual Sub Dispose(disposing As Boolean) … … 184 188 End Class 185 189 190 186 191 End Namespace 187 192 End Namespace -
trunk/ab5.0/ablib/src/basic/dos_console.sbp
r497 r522 9 9 Dim _System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE) 10 10 Dim _System_hConsoleIn = GetStdHandle(STD_INPUT_HANDLE) 11 System.Console.SetOut( 12 System.IO.TextWriter.Synchronized(New System.IO.StreamWriter( 13 New System.IO.FileStream(_System_hConsoleOut, System.IO.FileAccess.Write, False)))) 11 14 System.Console.SetIn( 12 15 System.IO.TextReader.Synchronized(New System.IO.StreamReader( … … 57 60 58 61 Dim dwAccessBytes As DWord 59 WriteConsole(_System_hConsoleOut, buf.StrPtr, buf.Length, dwAccessBytes, 0) 62 System.Console.Write(buf) 63 ' WriteConsole(_System_hConsoleOut, buf.StrPtr, buf.Length, dwAccessBytes, 0) 60 64 End Sub 61 65 /* TODO: _System_GetUsingFormatを用意して実装する
Note:
See TracChangeset
for help on using the changeset viewer.