win32console 1.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,302 @@
1
+ #
2
+ # = NAME
3
+ #
4
+ # Win32::Console::ANSI - Ruby extension to emulate ANSI console on Win32 system.
5
+ #
6
+ # = SYNOPSIS
7
+ #
8
+ # require "Win32::Console::ANSI"
9
+ #
10
+ # puts "\e[1;34mThis text is bold blue.\e[0m"
11
+ # puts "This text is normal.""
12
+ # puts "\e[33;45;1mBold yellow on magenta.\e[0m"
13
+ # puts "This text is normal."
14
+ #
15
+ # With the Term::ANSIColor module one increases the readability:
16
+ #
17
+ # require "Win32::Console::ANSI"
18
+ # require "Term::ANSIColor"
19
+ #
20
+ # puts color 'bold blue'
21
+ # puts "This text is bold blue."
22
+ # puts color 'reset'
23
+ # puts "This text is normal."
24
+ # puts colored ("Bold yellow on magenta.", 'bold yellow on_magenta')
25
+ # puts "This text is normal."
26
+ #
27
+ # And even more with Term::ANSIScreen:
28
+ #
29
+ # require "Win32::Console::ANSI;
30
+ # require "Term::ANSIScreen qw/:color :cursor :screen/;
31
+ #
32
+ # locate 1, 1; puts "@ This is (1,1)", savepos;
33
+ # puts locate(24,60), "@ This is (24,60)"; loadpos;
34
+ # puts down(2), clline, "@ This is (3,16)";
35
+ # setscroll 1, 20;
36
+ # color 'black on white'; clline;
37
+ # puts "This line is black on white.";
38
+ # puts color 'reset'; puts "This text is normal.";
39
+ # puts colored ("This text is bold blue.", 'bold blue');
40
+ # puts "This text is normal.";
41
+ # puts colored ['bold blue'], "This text is bold blue.";
42
+ # puts "This text is normal.";
43
+ #
44
+ # = DESCRIPTION
45
+ #
46
+ # Windows NT/2000/XP does not support ANSI escape sequences in Win32 Console
47
+ # applications. This module emulates an ANSI console for the script which
48
+ # uses it.
49
+ #
50
+ #
51
+ # == Escape sequences for Cursor Movement
52
+ #
53
+ # * \e[#A
54
+ #
55
+ # CUU: CUrsor Up: Moves the cursor up by the specified number of lines without
56
+ # changing columns. If the cursor is already on the top line, this sequence
57
+ # is ignored. \e[A is equivalent to \e[1A.
58
+ #
59
+ # * \e[#B
60
+ #
61
+ # CUD: CUrsor Down: Moves the cursor down by the specified number of lines
62
+ # without changing columns. If the cursor is already on the bottom line,
63
+ # this sequence is ignored. \e[B is equivalent to \e[1B.
64
+ #
65
+ # * \e[#C
66
+ #
67
+ # CUF: CUrsor Forward: Moves the cursor forward by the specified number of
68
+ # columns without changing lines. If the cursor is already in the
69
+ # rightmost column, this sequence is ignored. \e[C is equivalent to \e[1C.
70
+ #
71
+ # * \e[#D
72
+ #
73
+ # CUB: CUrsor Backward: Moves the cursor back by the specified number of
74
+ # columns without changing lines. If the cursor is already in the leftmost
75
+ # column, this sequence is ignored. \e[D is equivalent to \e[1D.
76
+ #
77
+ # * \e[#E
78
+ #
79
+ # CNL: Cursor Next Line: Moves the cursor down the indicated # of rows, to
80
+ # column 1. \e[E is equivalent to \e[1E.
81
+ #
82
+ # * \e[#F
83
+ #
84
+ # CPL: Cursor Preceding Line: Moves the cursor up the indicated # of rows,
85
+ # to column 1. \e[F is equivalent to \e[1F.
86
+ #
87
+ # * \e[#G
88
+ #
89
+ # CHA: Cursor Horizontal Absolute: Moves the cursor to indicated column in
90
+ # current row. \e[G is equivalent to \e[1G.
91
+ #
92
+ # * \e[#;#H
93
+ #
94
+ # CUP: CUrsor Position: Moves the cursor to the specified position. The first #
95
+ # specifies the line number, the second # specifies the column.
96
+ # If you do not specify a position, the cursor moves to the
97
+ # home position: the upper-left corner of the screen (line 1, column 1).
98
+ #
99
+ # * \e[#;#f
100
+ #
101
+ # HVP: Horizontal and Vertical Position.
102
+ # Works the same way as the preceding escape sequence.
103
+ #
104
+ # * \e[s
105
+ #
106
+ # SCP: Save Cursor Position: Saves the current cursor position. You can move
107
+ # the cursor to the saved cursor position by using the Restore Cursor
108
+ # Position sequence.
109
+ #
110
+ # * \e[u
111
+ #
112
+ # RCP: Restore Cursor Position: Returns the cursor to the position stored
113
+ # by the Save Cursor Position sequence.
114
+ #
115
+ # == Escape sequences for Display Edition
116
+ #
117
+ # * \e[#J
118
+ #
119
+ # ED: Erase Display:
120
+ #
121
+ # * \e[0J
122
+ #
123
+ # Clears the screen from cursor to end of display. The cursor position is unchanged.
124
+ #
125
+ # * \e[1J
126
+ #
127
+ # Clears the screen from start to cursor. The cursor position is unchanged.
128
+ #
129
+ # * \e[2J
130
+ #
131
+ # Clears the screen and moves the cursor to the home position (line 1, column 1).
132
+ #
133
+ # \e[J is equivalent to \e[0J. (Some terminal/emulators respond to \e[J as if
134
+ # it were \e[2J. Here, the default is 0; it's the norm)
135
+ #
136
+ # * \e[#K
137
+ #
138
+ # EL: Erase Line:
139
+ #
140
+ # * \e[0K
141
+ #
142
+ # Clears all characters from the cursor position to the end of the line
143
+ # (including the character at the cursor position).
144
+ # The cursor position is unchanged.
145
+ #
146
+ # * \e[1K
147
+ #
148
+ # Clears all characters from start of line to the cursor position.
149
+ # (including the character at the cursor position).
150
+ # The cursor position is unchanged.
151
+ #
152
+ # * \e[2K
153
+ #
154
+ # Clears all characters of the whole line.
155
+ # The cursor position is unchanged.
156
+ #
157
+ # \e[K is equivalent to \e[0K.
158
+ #
159
+ # * \e[#L
160
+ #
161
+ # IL: Insert Lines: The cursor line and all lines below it move down # lines,
162
+ # leaving blank space. The cursor position is unchanged. The bottommost #
163
+ # lines are lost. \e[L is equivalent to \e[1L.
164
+ #
165
+ # * \e[#M
166
+ #
167
+ # DL: Delete Line: The block of # lines at and below the cursor are deleted;
168
+ # all lines below them move up # lines to fill in the gap, leaving # blank
169
+ # lines at the bottom of the screen. The cursor position is unchanged.
170
+ # \e[M is equivalent to \e[1M.
171
+ #
172
+ # * \e#\@
173
+ #
174
+ # ICH: Insert CHaracter: The cursor character and all characters to the right
175
+ # of it move right # columns, leaving behind blank space.
176
+ # The cursor position is unchanged. The rightmost # characters on the line are lost.
177
+ #
178
+ # * \e[#P
179
+ #
180
+ # DCH: Delete CHaracter: The block of # characters at and to the right of the
181
+ # cursor are deleted; all characters to the right of it move left # columns,
182
+ # leaving behind blank space. The cursor position is unchanged.
183
+ # \e[P is equivalent to \e[1P.
184
+ #
185
+ #
186
+ # == Escape sequences for Set Graphics Rendition
187
+ #
188
+ # * \e[#;...;#m
189
+ #
190
+ # SGM: Set Graphics Mode: Calls the graphics functions specified by the
191
+ # following values. These specified functions remain active until the next
192
+ # occurrence of this escape sequence. Graphics mode changes the colors and
193
+ # attributes of text (such as bold and underline) displayed on the
194
+ # screen.
195
+ #
196
+ # * Text attributes
197
+ #
198
+ # 0 All attributes off
199
+ # 1 Bold on
200
+ # 4 Underscore on
201
+ # 7 Reverse video on
202
+ # 8 Concealed on
203
+ #
204
+ # 21 Bold off
205
+ # 24 Underscore off
206
+ # 27 Reverse video off
207
+ # 28 Concealed off
208
+ #
209
+ # * Foreground colors
210
+ #
211
+ # 30 Black
212
+ # 31 Red
213
+ # 32 Green
214
+ # 33 Yellow
215
+ # 34 Blue
216
+ # 35 Magenta
217
+ # 36 Cyan
218
+ # 37 White
219
+ #
220
+ # * Background colors
221
+ #
222
+ # 40 Black
223
+ # 41 Red
224
+ # 42 Green
225
+ # 43 Yellow
226
+ # 44 Blue
227
+ # 45 Magenta
228
+ # 46 Cyan
229
+ # 47 White
230
+ #
231
+ # \e[m is equivalent to \e0m.
232
+ #
233
+ # == Escape sequences for Select Character Set
234
+ #
235
+ # * \e(U
236
+ #
237
+ # Select null mapping - straight to character from the codepage of the console.
238
+ #
239
+ # * \e(K
240
+ #
241
+ # Select Windows to DOS mapping, if the corresponding map exist; no effect
242
+ # otherwise. This is the default mapping (if the map exist, of course). It's
243
+ # useful becarequire "one types the script with a Windows-based editor (using a
244
+ # Windows codepage) and the script prints its messages on the console using
245
+ # another codepage: without translation, the characters with a code greatest
246
+ # than 127 are different and the printed messages may be not readable.
247
+ #
248
+ # The conversion is done by the module Encode if it is installed (it's a
249
+ # standard module with Perl5.8, not Ruby yet). Otherwise, the conversion is limited to the
250
+ # following couples:
251
+ #
252
+ # WinLatin1 (cp1252) to DOSLatin1 (cp850)
253
+ # WinLatin1 (cp1252) to DOSLatinUS (cp437)
254
+ # WinLatin2 (cp1250) to DOSLatin2 (cp852)
255
+ # WinCyrillic(cp1251) to DOSCyrillic (cp855)
256
+ #
257
+ # * \e(#X
258
+ #
259
+ # This escape sequence is I<not> standard! It's an experimental one, just for
260
+ # fun :-)
261
+ #
262
+ # If <i>and only if</i> the console uses an Unicode police, it is possible to
263
+ # change its codepage with this escape sequence. No effect with an ordinary
264
+ # "Raster Font". (For Windows NT/2000/XP the currently available Unicode
265
+ # console font is the Lucida Console TrueType font.)
266
+ # # is the number of the codepage needed, 855 for cp855 for instance.
267
+ #
268
+ #
269
+ # = LIMITATIONS
270
+ #
271
+ # * Due to DOS-console limitations, the blink mode (text attributes 5 and 25) is not implemented.
272
+ #
273
+ # = SEE ALSO
274
+ #
275
+ # <b>Win32::Console</b>, <b>Term::ANSIColor</b>, <b>Term::ANSIScreen</b>.
276
+ #
277
+ # = AUTHOR
278
+ #
279
+ # J-L Morel jl_morel@bribes.org
280
+ #
281
+ # Home page: http://www.bribes.org/perl/wANSIConsole.html
282
+ #
283
+ # Gonzalo Garramu�o GGarramuno@aol.com Ruby port
284
+ #
285
+ # = CREDITS
286
+ #
287
+ # Render unto C�sar the things which are C�sar's...
288
+ #
289
+ # This module requires the module Win32::Console. Thanks to Aldo Calpini.
290
+ #
291
+ # The method used to overload the print function is due to Matt Sergeant
292
+ # (see his module Win32::ASP).
293
+ #
294
+ # = COPYRIGHT
295
+ #
296
+ # Copyright (c) 2004 Gonzalo Garramu�o. All rights reserved.
297
+ # Copyright (c) 2003 J-L Morel. All rights reserved.
298
+ #
299
+ # This program is free software; you can redistribute it and/or modify it under
300
+ # the terms of the Artistic License.
301
+ #
302
+ #