clio 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/CHANGES +66 -0
  2. data/MANIFEST +48 -169
  3. data/README +13 -17
  4. data/RELEASE +8 -0
  5. data/VERSION +1 -0
  6. data/lib/clio/buffer.rb +93 -0
  7. data/lib/clio/commandable.rb +71 -69
  8. data/lib/clio/commandline.rb +429 -230
  9. data/lib/clio/consoleutils.rb +0 -16
  10. data/lib/clio/facets/kernel.rb +13 -0
  11. data/lib/clio/facets/string.rb +25 -0
  12. data/lib/clio/layout.rb +14 -0
  13. data/lib/clio/layout/flow.rb +1 -0
  14. data/lib/clio/layout/line.rb +23 -0
  15. data/lib/clio/layout/list.rb +33 -0
  16. data/lib/clio/layout/split.rb +122 -0
  17. data/lib/clio/layout/stack.rb +17 -0
  18. data/lib/clio/layout/table.rb +46 -0
  19. data/lib/clio/progressbar.rb +189 -210
  20. data/lib/clio/string.rb +116 -109
  21. data/lib/clio/usage.rb +184 -0
  22. data/lib/clio/usage/argument.rb +84 -0
  23. data/lib/clio/usage/command.rb +440 -0
  24. data/lib/clio/usage/interface.rb +122 -0
  25. data/lib/clio/usage/main.rb +165 -0
  26. data/lib/clio/usage/option.rb +251 -0
  27. data/lib/clio/usage/parser.rb +191 -0
  28. data/lib/clio/usage/signature.rb +55 -0
  29. data/meta/abstract +3 -0
  30. data/meta/authors +1 -0
  31. data/meta/created +1 -0
  32. data/meta/homepage +1 -0
  33. data/meta/license +1 -0
  34. data/meta/repository +1 -0
  35. data/meta/summary +1 -0
  36. data/spec/commandline/autousage.rd +56 -0
  37. data/spec/commandline/bracket.rd +64 -0
  38. data/spec/commandline/completion.rd +38 -0
  39. data/spec/commandline/define.rd +44 -0
  40. data/spec/commandline/method.rd +60 -0
  41. data/spec/commandline/parse.rd +72 -0
  42. data/spec/commandline/scenario.rd +81 -0
  43. data/spec/commandline/subclass.rd +54 -0
  44. data/spec/string/unit.rd +58 -0
  45. data/spec/usage/define.rd +44 -0
  46. data/spec/usage/parse.rd +47 -0
  47. metadata +65 -196
  48. data/HISTORY +0 -11
  49. data/METADATA +0 -18
  50. data/NEWS +0 -10
  51. data/admin/config/reap.yaml +0 -30
  52. data/admin/depot/commandline.rb +0 -219
  53. data/admin/depot/multicommand.rb +0 -403
  54. data/admin/depot/test_multicommand.rb +0 -40
  55. data/admin/log/notes.xml +0 -28
  56. data/admin/log/stats.html +0 -25
  57. data/admin/log/syntax.log +0 -0
  58. data/admin/log/testunit.log +0 -16
  59. data/admin/pack/clio-0.0.1.gem +0 -0
  60. data/admin/share/reap/example.rb +0 -7
  61. data/admin/temps/lib/clio/about.rb.erb +0 -4
  62. data/lib/clio/command.rb +0 -296
  63. data/lib/clio/option.rb +0 -36
  64. data/lib/clio/runmode.rb +0 -126
  65. data/test/test_command.rb +0 -42
  66. data/test/test_commandline.rb +0 -83
  67. data/vendor/Console/Console.cpp +0 -1203
  68. data/vendor/Console/Console.rdoc +0 -690
  69. data/vendor/Console/Console_ANSI.rdoc +0 -302
  70. data/vendor/Console/HISTORY.txt +0 -7
  71. data/vendor/Console/INSTALL.txt +0 -18
  72. data/vendor/Console/Makefile +0 -162
  73. data/vendor/Console/README.txt +0 -26
  74. data/vendor/Console/doc/classes/Win32.html +0 -115
  75. data/vendor/Console/doc/classes/Win32/Console.html +0 -650
  76. data/vendor/Console/doc/classes/Win32/Console.src/M000001.html +0 -31
  77. data/vendor/Console/doc/classes/Win32/Console.src/M000002.html +0 -23
  78. data/vendor/Console/doc/classes/Win32/Console.src/M000003.html +0 -23
  79. data/vendor/Console/doc/classes/Win32/Console.src/M000004.html +0 -27
  80. data/vendor/Console/doc/classes/Win32/Console.src/M000005.html +0 -23
  81. data/vendor/Console/doc/classes/Win32/Console.src/M000006.html +0 -28
  82. data/vendor/Console/doc/classes/Win32/Console.src/M000007.html +0 -23
  83. data/vendor/Console/doc/classes/Win32/Console.src/M000008.html +0 -24
  84. data/vendor/Console/doc/classes/Win32/Console.src/M000009.html +0 -44
  85. data/vendor/Console/doc/classes/Win32/Console.src/M000010.html +0 -23
  86. data/vendor/Console/doc/classes/Win32/Console.src/M000011.html +0 -33
  87. data/vendor/Console/doc/classes/Win32/Console.src/M000012.html +0 -26
  88. data/vendor/Console/doc/classes/Win32/Console.src/M000013.html +0 -27
  89. data/vendor/Console/doc/classes/Win32/Console.src/M000014.html +0 -28
  90. data/vendor/Console/doc/classes/Win32/Console.src/M000015.html +0 -23
  91. data/vendor/Console/doc/classes/Win32/Console.src/M000016.html +0 -23
  92. data/vendor/Console/doc/classes/Win32/Console.src/M000017.html +0 -23
  93. data/vendor/Console/doc/classes/Win32/Console.src/M000018.html +0 -29
  94. data/vendor/Console/doc/classes/Win32/Console.src/M000019.html +0 -23
  95. data/vendor/Console/doc/classes/Win32/Console.src/M000020.html +0 -23
  96. data/vendor/Console/doc/classes/Win32/Console.src/M000021.html +0 -28
  97. data/vendor/Console/doc/classes/Win32/Console.src/M000022.html +0 -23
  98. data/vendor/Console/doc/classes/Win32/Console.src/M000023.html +0 -28
  99. data/vendor/Console/doc/classes/Win32/Console.src/M000024.html +0 -35
  100. data/vendor/Console/doc/classes/Win32/Console.src/M000025.html +0 -28
  101. data/vendor/Console/doc/classes/Win32/Console.src/M000026.html +0 -28
  102. data/vendor/Console/doc/classes/Win32/Console.src/M000027.html +0 -28
  103. data/vendor/Console/doc/classes/Win32/Console.src/M000028.html +0 -31
  104. data/vendor/Console/doc/classes/Win32/Console.src/M000029.html +0 -23
  105. data/vendor/Console/doc/classes/Win32/Console.src/M000030.html +0 -23
  106. data/vendor/Console/doc/classes/Win32/Console.src/M000031.html +0 -23
  107. data/vendor/Console/doc/classes/Win32/Console.src/M000032.html +0 -27
  108. data/vendor/Console/doc/classes/Win32/Console.src/M000033.html +0 -27
  109. data/vendor/Console/doc/classes/Win32/Console.src/M000034.html +0 -25
  110. data/vendor/Console/doc/classes/Win32/Console/ANSI.html +0 -103
  111. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.html +0 -220
  112. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000035.html +0 -32
  113. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000036.html +0 -205
  114. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000037.html +0 -40
  115. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000038.html +0 -25
  116. data/vendor/Console/doc/classes/Win32/Console/API.html +0 -758
  117. data/vendor/Console/doc/classes/Win32/Console/API.src/M000039.html +0 -27
  118. data/vendor/Console/doc/classes/Win32/Console/API.src/M000040.html +0 -27
  119. data/vendor/Console/doc/classes/Win32/Console/API.src/M000041.html +0 -27
  120. data/vendor/Console/doc/classes/Win32/Console/API.src/M000042.html +0 -32
  121. data/vendor/Console/doc/classes/Win32/Console/API.src/M000043.html +0 -32
  122. data/vendor/Console/doc/classes/Win32/Console/API.src/M000044.html +0 -28
  123. data/vendor/Console/doc/classes/Win32/Console/API.src/M000045.html +0 -26
  124. data/vendor/Console/doc/classes/Win32/Console/API.src/M000046.html +0 -26
  125. data/vendor/Console/doc/classes/Win32/Console/API.src/M000047.html +0 -27
  126. data/vendor/Console/doc/classes/Win32/Console/API.src/M000048.html +0 -30
  127. data/vendor/Console/doc/classes/Win32/Console/API.src/M000049.html +0 -29
  128. data/vendor/Console/doc/classes/Win32/Console/API.src/M000050.html +0 -27
  129. data/vendor/Console/doc/classes/Win32/Console/API.src/M000051.html +0 -28
  130. data/vendor/Console/doc/classes/Win32/Console/API.src/M000052.html +0 -30
  131. data/vendor/Console/doc/classes/Win32/Console/API.src/M000053.html +0 -27
  132. data/vendor/Console/doc/classes/Win32/Console/API.src/M000054.html +0 -29
  133. data/vendor/Console/doc/classes/Win32/Console/API.src/M000055.html +0 -29
  134. data/vendor/Console/doc/classes/Win32/Console/API.src/M000056.html +0 -28
  135. data/vendor/Console/doc/classes/Win32/Console/API.src/M000057.html +0 -27
  136. data/vendor/Console/doc/classes/Win32/Console/API.src/M000058.html +0 -47
  137. data/vendor/Console/doc/classes/Win32/Console/API.src/M000059.html +0 -32
  138. data/vendor/Console/doc/classes/Win32/Console/API.src/M000060.html +0 -47
  139. data/vendor/Console/doc/classes/Win32/Console/API.src/M000061.html +0 -34
  140. data/vendor/Console/doc/classes/Win32/Console/API.src/M000062.html +0 -32
  141. data/vendor/Console/doc/classes/Win32/Console/API.src/M000063.html +0 -32
  142. data/vendor/Console/doc/classes/Win32/Console/API.src/M000064.html +0 -35
  143. data/vendor/Console/doc/classes/Win32/Console/API.src/M000065.html +0 -26
  144. data/vendor/Console/doc/classes/Win32/Console/API.src/M000066.html +0 -27
  145. data/vendor/Console/doc/classes/Win32/Console/API.src/M000067.html +0 -29
  146. data/vendor/Console/doc/classes/Win32/Console/API.src/M000068.html +0 -27
  147. data/vendor/Console/doc/classes/Win32/Console/API.src/M000069.html +0 -27
  148. data/vendor/Console/doc/classes/Win32/Console/API.src/M000070.html +0 -28
  149. data/vendor/Console/doc/classes/Win32/Console/API.src/M000071.html +0 -27
  150. data/vendor/Console/doc/classes/Win32/Console/API.src/M000072.html +0 -26
  151. data/vendor/Console/doc/classes/Win32/Console/API.src/M000073.html +0 -27
  152. data/vendor/Console/doc/classes/Win32/Console/API.src/M000074.html +0 -31
  153. data/vendor/Console/doc/classes/Win32/Console/API.src/M000075.html +0 -27
  154. data/vendor/Console/doc/classes/Win32/Console/API.src/M000076.html +0 -32
  155. data/vendor/Console/doc/classes/Win32/Console/API.src/M000077.html +0 -27
  156. data/vendor/Console/doc/classes/Win32/Console/API.src/M000078.html +0 -32
  157. data/vendor/Console/doc/classes/Win32/Console/API.src/M000079.html +0 -32
  158. data/vendor/Console/doc/classes/Win32/Console/API.src/M000080.html +0 -32
  159. data/vendor/Console/doc/classes/Win32/Console/Constants.html +0 -360
  160. data/vendor/Console/doc/created.rid +0 -1
  161. data/vendor/Console/doc/files/Console_ANSI_rdoc.html +0 -407
  162. data/vendor/Console/doc/files/Console_cpp.html +0 -104
  163. data/vendor/Console/doc/files/Console_rdoc.html +0 -964
  164. data/vendor/Console/doc/files/lib/Win32/Console/ANSI_rb.html +0 -123
  165. data/vendor/Console/doc/files/lib/Win32/Console_rb.html +0 -297
  166. data/vendor/Console/doc/fr_class_index.html +0 -32
  167. data/vendor/Console/doc/fr_file_index.html +0 -31
  168. data/vendor/Console/doc/fr_method_index.html +0 -106
  169. data/vendor/Console/doc/index.html +0 -24
  170. data/vendor/Console/doc/rdoc-style.css +0 -172
  171. data/vendor/Console/extconf.rb +0 -18
  172. data/vendor/Console/lib/Term/ansicolor.rb +0 -76
  173. data/vendor/Console/lib/Win32/Console.rb +0 -970
  174. data/vendor/Console/lib/Win32/Console/ANSI.rb +0 -305
  175. data/vendor/Console/test/test_cursor.rb +0 -9
  176. data/vendor/Console/test/test_mouse.rb +0 -6
  177. data/vendor/Console/test/test_readinput.rb +0 -62
  178. data/vendor/Console/test/test_readoutput.rb +0 -52
  179. data/vendor/Console/test/test_sendevent.rb +0 -17
  180. data/vendor/Console/test/test_title.rb +0 -14
  181. data/vendor/Console/test/test_write.rb +0 -36
@@ -1,690 +0,0 @@
1
- #
2
- # = NAME
3
- #
4
- # Win32::Console - Win32 Console and Character Mode Functions
5
- #
6
- #
7
- # = DESCRIPTION
8
- #
9
- # This module implements the Win32 console and character mode
10
- # functions. They give you full control on the console input and output,
11
- # including: support of off-screen console buffers (eg. multiple screen
12
- # pages)
13
- #
14
- # - reading and writing of characters, attributes and whole portions of
15
- # the screen
16
- #
17
- # - complete processing of keyboard and mouse events
18
- #
19
- # - some very funny additional features :)
20
- #
21
- #
22
- # Those functions should also make possible a port of the Unix's curses
23
- # library; if there is anyone interested (and/or willing to contribute)
24
- # to this project, e-mail me. Thank you.
25
- #
26
- #
27
- # = REFERENCE
28
- #
29
- #
30
- # == Methods
31
- #
32
- # - Alloc
33
- #
34
- # Allocates a new console for the process. Returns C<nil> on errors, a
35
- # nonzero value on success. A process cannot be associated with more
36
- # than one console, so this method will fail if there is already an
37
- # allocated console. Use Free to detach the process from the console,
38
- # and then call Alloc to create a new console. See also: C<Free>
39
- #
40
- # Example:
41
- #
42
- # Win32::Console::Alloc()
43
- #
44
- # - Attr [attr]
45
- #
46
- # Gets or sets the current console attribute. This attribute is used by
47
- # the Write method.
48
- #
49
- # Example:
50
- #
51
- # attr = console.Attr()
52
- # console.Attr(FG_YELLOW | BG_BLUE)
53
- #
54
- # - Close
55
- #
56
- # Closes a shortcut object. Note that it is not "strictly" required to
57
- # close the objects you created, since the Win32::Shortcut objects are
58
- # automatically closed when the program ends (or when you elsehow
59
- # destroy such an object).
60
- #
61
- # Example:
62
- #
63
- # link.Close()
64
- #
65
- # - Cls [attr]
66
- #
67
- # Clear the console, with the specified I<attr> if given, or using
68
- # ATTR_NORMAL otherwise.
69
- #
70
- # Example:
71
- #
72
- # console.Cls()
73
- # console.Cls(FG_WHITE | BG_GREEN)
74
- #
75
- # - Cursor [x, y, size, visible]
76
- #
77
- # Gets or sets cursor position and appearance. Returns C<nil> on
78
- # errors, or a 4-element list containing: I<x>, I<y>, I<size>,
79
- # I<visible>. I<x> and I<y> are the current cursor position; ...
80
- #
81
- # Example:
82
- #
83
- # x, y, size, visible = console.Cursor()
84
- #
85
- # # Get position only
86
- # x, y = console.Cursor()
87
- #
88
- # console.Cursor(40, 13, 50, 1)
89
- #
90
- # # Set position only
91
- # console.Cursor(40, 13)
92
- #
93
- # # Set size and visibility without affecting position
94
- # console.Cursor(-1, -1, 50, 1)
95
- #
96
- # - Display
97
- #
98
- # Displays the specified console on the screen. Returns C<nil> on errors,
99
- # a nonzero value on success.
100
- #
101
- # Example:
102
- #
103
- # console.Display()
104
- #
105
- # - FillAttr [attribute, number, col, row]
106
- #
107
- # Fills the specified number of consecutive attributes, beginning at
108
- # I<col>, I<row>, with the value specified in I<attribute>. Returns the
109
- # number of attributes filled, or C<nil> on errors. See also:
110
- # C<FillChar>.
111
- #
112
- # Example:
113
- #
114
- # console.FillAttr(FG_BLACK | BG_BLACK, 80*25, 0, 0)
115
- #
116
- # - FillChar char, number, col, row
117
- #
118
- # Fills the specified number of consecutive characters, beginning at
119
- # I<col>, I<row>, with the character specified in I<char>. Returns the
120
- # number of characters filled, or C<nil> on errors. See also:
121
- # C<FillAttr>.
122
- #
123
- # Example:
124
- #
125
- # console.FillChar("X", 80*25, 0, 0)
126
- #
127
- # - Flush
128
- #
129
- # Flushes the console input buffer. All the events in the buffer are
130
- # discarded. Returns C<nil> on errors, a nonzero value on success.
131
- #
132
- # Example:
133
- #
134
- # console.Flush()
135
- #
136
- # - Free
137
- #
138
- # Detaches the process from the console. Returns C<nil> on errors, a
139
- # nonzero value on success. See also: C<Alloc>.
140
- #
141
- # Example:
142
- #
143
- # Win32::Console::Free()
144
- #
145
- # - GenerateCtrlEvent [type, processgroup]
146
- #
147
- # Sends a break signal of the specified I<type> to the specified
148
- # I<processgroup>. I<type> can be one of the following constants:
149
- #
150
- # CTRL_BREAK_EVENT
151
- # CTRL_C_EVENT
152
- #
153
- # they signal, respectively, the pressing of Control + Break and of
154
- # Control + C; if not specified, it defaults to CTRL_C_EVENT.
155
- # I<processgroup> is the pid of a process sharing the same console. If
156
- # omitted, it defaults to 0 (the current process), which is also the
157
- # only meaningful value that you can pass to this function. Returns
158
- # C<nil> on errors, a nonzero value on success.
159
- #
160
- # Example:
161
- #
162
- # # break this script now
163
- # Win32::Console::GenerateCtrlEvent()
164
- #
165
- # - GetEvents
166
- #
167
- # Returns the number of unread input events in the console's input
168
- # buffer, or C<nil> on errors. See also: C<Input>, C<InputChar>,
169
- # C<PeekInput>, C<WriteInput>.
170
- #
171
- # Example:
172
- #
173
- # events = console.GetEvents()
174
- #
175
- # - Info
176
- #
177
- # Returns an array of informations about the console (or C<nil> on
178
- # errors), which contains:
179
- #
180
- # * columns (X size) of the console buffer.
181
- #
182
- # * rows (Y size) of the console buffer.
183
- #
184
- # * current column (X position) of the cursor.
185
- #
186
- # * current row (Y position) of the cursor.
187
- #
188
- # * current attribute used for C<Write>.
189
- #
190
- # * left column (X of the starting point) of the current console window.
191
- #
192
- # * top row (Y of the starting point) of the current console window.
193
- #
194
- # * right column (X of the final point) of the current console window.
195
- #
196
- # * bottom row (Y of the final point) of the current console window.
197
- #
198
- # * maximum number of columns for the console window, given the current
199
- # buffer size, font and the screen size.
200
- #
201
- # * maximum number of rows for the console window, given the current
202
- # buffer size, font and the screen size.
203
- #
204
- #
205
- # See also: <b>Attr</b>, <b>Cursor</b>, <b>Size</b>, <b>Window</b>, <b>MaxWindow</b>.
206
- #
207
- # Example:
208
- #
209
- # info = console.Info()
210
- # puts "Cursor at #{info[3]}, #{info[4]}."
211
- #
212
- # - Input
213
- #
214
- # Reads an event from the input buffer. Returns an array of values, which
215
- # depending on the event's nature are:
216
- #
217
- # - keyboard event
218
- #
219
- # The array will contain:
220
- #
221
- # * event type: 1 for keyboard
222
- #
223
- # * key down: TRUE if the key is being pressed, FALSE if the key is being released
224
- #
225
- # * repeat count: the number of times the key is being held down
226
- #
227
- # * virtual keycode: the virtual key code of the key
228
- #
229
- # * virtual scancode: the virtual scan code of the key
230
- #
231
- # * char: the ASCII code of the character (if the key is a character key, 0 otherwise)
232
- #
233
- # * control key state: the state of the control keys (SHIFTs, CTRLs, ALTs, etc.)
234
- #
235
- #
236
- # - mouse event
237
- #
238
- # The array will contain:
239
- #
240
- # * event type: 2 for mouse
241
- #
242
- # * mouse pos. X: X coordinate (column) of the mouse location
243
- #
244
- # * mouse pos. Y: Y coordinate (row) of the mouse location
245
- #
246
- # * button state: the mouse button(s) which are pressed
247
- #
248
- # * control key state: the state of the control keys (SHIFTs, CTRLs, ALTs, etc.)
249
- #
250
- # * event flags: the type of the mouse event
251
- #
252
- #
253
- # This method will return <b>nil</b> on errors. Note that the events
254
- # returned are depending on the input <b>Mode</b> of the console; for example,
255
- # mouse events are not intercepted unless ENABLE_MOUSE_INPUT is
256
- # specified. See also: <b>GetEvents</b>, <b>InputChar</b>, <b>Mode</b>,
257
- # <b>PeekInput</b>, <b>WriteInput</b>.
258
- #
259
- # Example:
260
- #
261
- # event = console.Input()
262
- #
263
- # - InputChar number
264
- #
265
- # Reads and returns I<number> characters from the console input buffer,
266
- # or <b>nil</b> on errors. See also: <b>Input</b>, <b>Mode</b>.
267
- #
268
- # Example:
269
- #
270
- # key = console.InputChar(1)
271
- #
272
- # - InputCP [codepage]
273
- #
274
- # Gets or sets the input code page used by the console. Note that this
275
- # doesn't apply to a console object, but to the standard input
276
- # console. This attribute is used by the Write method. See also:
277
- # <b>OutputCP</b>.
278
- #
279
- # Example:
280
- #
281
- # codepage = Win32::Console::InputCP()
282
- # Win32::Console::InputCP(437)
283
- #
284
- # - MaxWindow
285
- #
286
- # Returns the size of the largest possible console window, based on the
287
- # current font and the size of the display. The result is <b>nil</b> on
288
- # errors, otherwise a 2-element list containing col, row.
289
- #
290
- # Example:
291
- #
292
- # maxCol, maxRow = console.MaxWindow()
293
- #
294
- # - Mode [flags]
295
- #
296
- # Gets or sets the input or output mode of a console. I<flags> can be a
297
- # combination of the following constants:
298
- #
299
- # ENABLE_LINE_INPUT
300
- # ENABLE_ECHO_INPUT
301
- # ENABLE_PROCESSED_INPUT
302
- # ENABLE_WINDOW_INPUT
303
- # ENABLE_MOUSE_INPUT
304
- # ENABLE_PROCESSED_OUTPUT
305
- # ENABLE_WRAP_AT_EOL_OUTPUT
306
- #
307
- # For more informations on the meaning of those flags, please refer to
308
- # the L<"Microsoft's Documentation">.
309
- #
310
- # Example:
311
- #
312
- # mode = console.Mode()
313
- # console.Mode(ENABLE_MOUSE_INPUT | ENABLE_PROCESSED_INPUT)
314
- #
315
- # - MouseButtons
316
- #
317
- # Returns the number of the buttons on your mouse, or <b>nil</b> on errors.
318
- #
319
- # Example:
320
- #
321
- # puts "Your mouse has #{Win32::Console::MouseButtons()} buttons."
322
- #
323
- # - Win32::Console.new standard_handle
324
- #
325
- # - Win32::Console.new [accessmode, sharemode]
326
- #
327
- # Creates a new console object. The first form creates a handle to a
328
- # standard channel, I<standard_handle> can be one of the following:
329
- #
330
- # STD_OUTPUT_HANDLE
331
- # STD_ERROR_HANDLE
332
- # STD_INPUT_HANDLE
333
- #
334
- # The second form, instead, creates a console screen buffer in memory,
335
- # which you can access for reading and writing as a normal console, and
336
- # then redirect on the standard output (the screen) with <b>Display</b>. In
337
- # this case, you can specify one or both of the following values for
338
- # I<accessmode>:
339
- #
340
- # GENERIC_READ
341
- # GENERIC_WRITE
342
- #
343
- # which are the permissions you will have on the created buffer, and one
344
- # or both of the following values for I<sharemode>:
345
- #
346
- # FILE_SHARE_READ
347
- # FILE_SHARE_WRITE
348
- #
349
- # which affect the way the console can be shared. If you don't specify
350
- # any of those parameters, all 4 flags will be used.
351
- #
352
- # Example:
353
- #
354
- # stdout = Win32::Console.new(STD_OUTPUT_HANDLE)
355
- # stderr = Win32::Console.new(STD_ERROR_HANDLE)
356
- # stdin = Win32::Console.new(STD_INPUT_HANDLE)
357
- #
358
- # buffer = Win32::Console.new()
359
- # buffer = Win32::Console.new(GENERIC_READ | GENERIC_WRITE)
360
- #
361
- # - OutputCP [codepage]
362
- #
363
- # Gets or sets the output code page used by the console. Note that this
364
- # doesn't apply to a console object, but to the standard output console.
365
- # See also: <b>InputCP</b>.
366
- #
367
- # Example:
368
- #
369
- # codepage = Win32::Console::OutputCP()
370
- # Win32::Console::OutputCP(437)
371
- #
372
- # - PeekInput
373
- #
374
- # Does exactly the same as <b>Input</b>, except that the event read is not
375
- # removed from the input buffer. See also: <b>GetEvents</b>, <b>Input</b>,
376
- # <b>InputChar</b>, <b>Mode</b>, <b>WriteInput</b>.
377
- #
378
- # Example:
379
- #
380
- # event = console.PeekInput()
381
- #
382
- # - ReadAttr [number, col, row]
383
- #
384
- # Reads the specified I<number> of consecutive attributes, beginning at
385
- # I<col>, I<row>, from the console. Returns the attributes read (a
386
- # variable containing one character for each attribute), or <b>nil</b> on
387
- # errors. You can then pass the returned variable to <b>WriteAttr</b> to
388
- # restore the saved attributes on screen. See also: <b>ReadChar</b>,
389
- # <b>ReadRect</b>.
390
- #
391
- # Example:
392
- #
393
- # colors = console.ReadAttr(80*25, 0, 0)
394
- #
395
- # - ReadChar [number, col, row]
396
- #
397
- # Reads the specified I<number> of consecutive characters, beginning at
398
- # I<col>, I<row>, from the console. Returns a string containing the
399
- # characters read, or <b>nil</b> on errors. You can then pass the
400
- # returned variable to <b>WriteChar</b> to restore the saved characters on
401
- # screen. See also: <b>ReadAttr</b>, <b>ReadRect</b>.
402
- #
403
- # Example:
404
- #
405
- # chars = console.ReadChar(80*25, 0, 0)
406
- #
407
- # - ReadRect left, top, right, bottom
408
- #
409
- # Reads the content (characters and attributes) of the rectangle
410
- # specified by I<left>, I<top>, I<right>, I<bottom> from the console.
411
- # Returns a string containing the rectangle read, or <b>nil</b> on errors.
412
- # You can then pass the returned variable to <b>WriteRect</b> to restore the
413
- # saved rectangle on screen (or on another console). See also:
414
- # <b>ReadAttr</b>, <b>ReadChar</b>.
415
- #
416
- # Example:
417
- #
418
- # rect = console.ReadRect(0, 0, 80, 25)
419
- #
420
- # - Scroll left, top, right, bottom, col, row, char, attr,
421
- # [cleft, ctop, cright, cbottom]
422
- #
423
- # Moves a block of data in a console buffer the block is identified by
424
- # I<left>, I<top>, I<right>, I<bottom>, while I<row>, I<col> identify
425
- # the new location of the block. The cells left empty as a result of
426
- # the move are filled with the character I<char> and attribute I<attr>.
427
- # Optionally you can specify a clipping region with I<cleft>, I<ctop>,
428
- # I<cright>, I<cbottom>, so that the content of the console outside this
429
- # rectangle are unchanged. Returns <b>nil</b> on errors, a nonzero value
430
- # on success.
431
- #
432
- # Example:
433
- #
434
- # # scrolls the screen 10 lines down, filling with black spaces
435
- # console.Scroll(0, 0, 80, 25, 0, 10, " ", FG_BLACK | BG_BLACK)
436
- #
437
- # - Select standard_handle
438
- #
439
- # Redirects a standard handle to the specified console.
440
- # I<standard_handle> can have one of the following values:
441
- #
442
- # STD_INPUT_HANDLE
443
- # STD_OUTPUT_HANDLE
444
- # STD_ERROR_HANDLE
445
- #
446
- # Returns <b>nil</b> on errors, a nonzero value on success.
447
- #
448
- # Example:
449
- #
450
- # console.Select(STD_OUTPUT_HANDLE)
451
- #
452
- # - Size [col, row]
453
- #
454
- # Gets or sets the console buffer size.
455
- #
456
- # Example:
457
- #
458
- # x, y = console.Size()
459
- # console.Size(80, 25)
460
- #
461
- # - Title [title]
462
- #
463
- # Gets or sets the title bar the string of the current console window.
464
- #
465
- # Example:
466
- #
467
- # title = console.Title()
468
- # console.Title("This is a title")
469
- #
470
- # - Window [flag, left, top, right, bottom]
471
- #
472
- # Gets or sets the current console window size. If called without
473
- # arguments, returns a 4-element list containing the current window
474
- # coordinates in the form of I<left>, I<top>, I<right>, I<bottom>. To
475
- # set the window size, you have to specify an additional I<flag>
476
- # parameter: if it is 0 (zero), coordinates are considered relative to
477
- # the current coordinates; if it is non-zero, coordinates are absolute.
478
- #
479
- # Example:
480
- #
481
- # left, top, right, bottom = console.Window()
482
- # console.Window(1, 0, 0, 80, 50)
483
- #
484
- # - Write string
485
- #
486
- # Writes I<string> on the console, using the current attribute, that you
487
- # can set with <b>Attr</b>, and advancing the cursor as needed. This isn't
488
- # so different from Perl's "print" statement. Returns the number of
489
- # characters written or <b>nil</b> on errors. See also: <b>WriteAttr</b>,
490
- # <b>WriteChar</b>, <b>WriteRect</b>.
491
- #
492
- # Example:
493
- #
494
- # console.Write("Hello, world!")
495
- #
496
- # - WriteAttr attrs, col, row
497
- #
498
- # Writes the attributes in the string I<attrs>, beginning at I<col>,
499
- # I<row>, without affecting the characters that are on screen. The
500
- # string attrs can be the result of a <b>ReadAttr</b> function, or you can
501
- # build your own attribute string; in this case, keep in mind that every
502
- # attribute is treated as a character, not a number (see example).
503
- # Returns the number of attributes written or <b>nil</b> on errors. See
504
- # also: <b>Write</b>, <b>WriteChar</b>, <b>WriteRect</b>.
505
- #
506
- # Example:
507
- #
508
- # console.WriteAttr($attrs, 0, 0)
509
- #
510
- # # note the use of chr()...
511
- # attrs = (FG_BLACK | BG_WHITE).chr() * 80
512
- # console.WriteAttr(attrs, 0, 0)
513
- #
514
- # - WriteChar chars, col, row
515
- #
516
- # Writes the characters in the string <i>attr</i>, beginning at <i>col</i>, <i>row</i>,
517
- # without affecting the attributes that are on screen. The string <i>chars</i>
518
- # can be the result of a <b>ReadChar</b> function, or a normal string. Returns
519
- # the number of characters written or <b>nil</b> on errors. See also:
520
- # <b>Write</b>, <b>WriteAttr</b>, <b>WriteRect</b>.
521
- #
522
- # Example:
523
- #
524
- # console.WriteChar("Hello, worlds!", 0, 0)
525
- #
526
- # - WriteInput (event)
527
- #
528
- # Pushes data in the console input buffer. I<(event)> is a list of values,
529
- # for more information see <b>Input</b>. The string chars can be the result of
530
- # a <b>ReadChar</b> function, or a normal string. Returns the number of
531
- # characters written or <b>nil</b> on errors. See also: <b>Write</b>,
532
- # <b>WriteAttr</b>, <b>WriteRect</b>.
533
- #
534
- # Example:
535
- #
536
- # console.WriteInput(event)
537
- #
538
- # - WriteRect rect, left, top, right, bottom
539
- #
540
- # Writes a rectangle of characters and attributes (contained in <i>rect</i>)
541
- # on the console at the coordinates specified by <i>left</i>, <i>top</i>,
542
- # <i>right</i>, <i>bottom</i>. <i>rect</i> can be the result of a <b>ReadRect</b>
543
- # function. Returns <b>nil</b> on errors, otherwise a 4-element list
544
- # containing the coordinates of the affected rectangle, in the format
545
- # <i>left</i>, <i>top</i>, <i>right</i>, <i>bottom</i>. See also: <b>Write</b>,
546
- # <b>WriteAttr</b>, <b>WriteChar</b>.
547
- #
548
- # Example:
549
- #
550
- # console.WriteRect(rect, 0, 0, 80, 25)
551
- #
552
- #
553
- # == Constants
554
- #
555
- # The following constants are defined in the namespace of
556
- # Win32::Console::Constants and are brought into the current
557
- # namespace when the module is required:
558
- #
559
- # BACKGROUND_BLUE
560
- # BACKGROUND_GREEN
561
- # BACKGROUND_INTENSITY
562
- # BACKGROUND_RED
563
- # CAPSLOCK_ON
564
- # CONSOLE_TEXTMODE_BUFFER
565
- # ENABLE_ECHO_INPUT
566
- # ENABLE_LINE_INPUT
567
- # ENABLE_MOUSE_INPUT
568
- # ENABLE_PROCESSED_INPUT
569
- # ENABLE_PROCESSED_OUTPUT
570
- # ENABLE_WINDOW_INPUT
571
- # ENABLE_WRAP_AT_EOL_OUTPUT
572
- # ENHANCED_KEY
573
- # FILE_SHARE_READ
574
- # FILE_SHARE_WRITE
575
- # FOREGROUND_BLUE
576
- # FOREGROUND_GREEN
577
- # FOREGROUND_INTENSITY
578
- # FOREGROUND_RED
579
- # LEFT_ALT_PRESSED
580
- # LEFT_CTRL_PRESSED
581
- # NUMLOCK_ON
582
- # GENERIC_READ
583
- # GENERIC_WRITE
584
- # RIGHT_ALT_PRESSED
585
- # RIGHT_CTRL_PRESSED
586
- # SCROLLLOCK_ON
587
- # SHIFT_PRESSED
588
- # STD_INPUT_HANDLE
589
- # STD_OUTPUT_HANDLE
590
- # STD_ERROR_HANDLE
591
- #
592
- # Additionally, these other constants are also added to your current
593
- # namespace when requiring the module:
594
- #
595
- # FG_BLACK
596
- # FG_BLUE
597
- # FG_LIGHTBLUE
598
- # FG_RED
599
- # FG_LIGHTRED
600
- # FG_GREEN
601
- # FG_LIGHTGREEN
602
- # FG_MAGENTA
603
- # FG_LIGHTMAGENTA
604
- # FG_CYAN
605
- # FG_LIGHTCYAN
606
- # FG_BROWN
607
- # FG_YELLOW
608
- # FG_GRAY
609
- # FG_WHITE
610
- #
611
- # BG_BLACK
612
- # BG_BLUE
613
- # BG_LIGHTBLUE
614
- # BG_RED
615
- # BG_LIGHTRED
616
- # BG_GREEN
617
- # BG_LIGHTGREEN
618
- # BG_MAGENTA
619
- # BG_LIGHTMAGENTA
620
- # BG_CYAN
621
- # BG_LIGHTCYAN
622
- # BG_BROWN
623
- # BG_YELLOW
624
- # BG_GRAY
625
- # BG_WHITE
626
- #
627
- # ATTR_NORMAL
628
- # ATTR_INVERSE
629
- #
630
- # ATTR_NORMAL is set to gray foreground on black background (DOS's
631
- # standard colors).
632
- #
633
- #
634
- # == Microsoft's Documentation
635
- #
636
- # Documentation for the Win32 Console and Character mode Functions can
637
- # be found on Microsoft's site at this URL:
638
- #
639
- # http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/sys/src/conchar.htm
640
- #
641
- # A reference of the available functions is at:
642
- #
643
- # http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/sys/src/conchar_34.htm
644
- #
645
- #
646
- # = VERSION HISTORY
647
- #
648
- # * 0.031 (24 Sep 1999)
649
- #
650
- # * Fixed typo in GenerateCtrlEvent().
651
- #
652
- # * Converted and added pod documentation (from Jan Dubois <jand@activestate.com>).
653
- #
654
- # * 0.03 (07 Apr 1997)
655
- #
656
- # * Added "GenerateCtrlEvent" method.
657
- #
658
- # * The PLL file now comes in 2 versions, one for Perl version 5.001
659
- # (build 110) and one for Perl version 5.003 (build 300 and higher,
660
- # EXCEPT 304).
661
- #
662
- # * added an installation program that will automatically copy the right
663
- # version in the right place.
664
- #
665
- # * 0.01 (09 Feb 1997)
666
- #
667
- # * First public release.
668
- #
669
- # = AUTHORS
670
- #
671
- # Aldo Calpini <a.calpini@romagiubileo.it> Perl module
672
- #
673
- # Gonzalo Garramu�o <GGarramuno@aol.com> Ruby Port
674
- #
675
- # = CREDITS
676
- #
677
- # Thanks to: Jesse Dougherty, Dave Roth, ActiveWare, and the
678
- # Perl-Win32-Users community.
679
- #
680
- #
681
- # = DISCLAIMER
682
- #
683
- # This program is FREE; you can redistribute, modify, disassemble, or
684
- # even reverse engineer this software at your will. Keep in mind,
685
- # however, that NOTHING IS GUARANTEED to work and everything you do is
686
- # AT YOUR OWN RISK - I will not take responsibility for any damage, loss
687
- # of money and/or health that may arise from the use of this program!
688
- #
689
- # This is distributed under the terms of Larry Wall's Artistic License.
690
- #