win32console 1.0.8-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/Console-i386-mswin32.def +2 -0
  2. data/Console.cpp +1203 -0
  3. data/Console.rdoc +690 -0
  4. data/Console_ANSI.rdoc +302 -0
  5. data/HISTORY.txt +7 -0
  6. data/INSTALL.txt +18 -0
  7. data/README.txt +26 -0
  8. data/Rakefile +38 -0
  9. data/doc/classes/Win32.html +115 -0
  10. data/doc/classes/Win32/Console.html +650 -0
  11. data/doc/classes/Win32/Console.src/M000001.html +31 -0
  12. data/doc/classes/Win32/Console.src/M000002.html +23 -0
  13. data/doc/classes/Win32/Console.src/M000003.html +23 -0
  14. data/doc/classes/Win32/Console.src/M000004.html +27 -0
  15. data/doc/classes/Win32/Console.src/M000005.html +23 -0
  16. data/doc/classes/Win32/Console.src/M000006.html +28 -0
  17. data/doc/classes/Win32/Console.src/M000007.html +23 -0
  18. data/doc/classes/Win32/Console.src/M000008.html +24 -0
  19. data/doc/classes/Win32/Console.src/M000009.html +44 -0
  20. data/doc/classes/Win32/Console.src/M000010.html +23 -0
  21. data/doc/classes/Win32/Console.src/M000011.html +33 -0
  22. data/doc/classes/Win32/Console.src/M000012.html +26 -0
  23. data/doc/classes/Win32/Console.src/M000013.html +27 -0
  24. data/doc/classes/Win32/Console.src/M000014.html +28 -0
  25. data/doc/classes/Win32/Console.src/M000015.html +23 -0
  26. data/doc/classes/Win32/Console.src/M000016.html +23 -0
  27. data/doc/classes/Win32/Console.src/M000017.html +23 -0
  28. data/doc/classes/Win32/Console.src/M000018.html +29 -0
  29. data/doc/classes/Win32/Console.src/M000019.html +23 -0
  30. data/doc/classes/Win32/Console.src/M000020.html +23 -0
  31. data/doc/classes/Win32/Console.src/M000021.html +28 -0
  32. data/doc/classes/Win32/Console.src/M000022.html +23 -0
  33. data/doc/classes/Win32/Console.src/M000023.html +28 -0
  34. data/doc/classes/Win32/Console.src/M000024.html +35 -0
  35. data/doc/classes/Win32/Console.src/M000025.html +28 -0
  36. data/doc/classes/Win32/Console.src/M000026.html +28 -0
  37. data/doc/classes/Win32/Console.src/M000027.html +28 -0
  38. data/doc/classes/Win32/Console.src/M000028.html +31 -0
  39. data/doc/classes/Win32/Console.src/M000029.html +23 -0
  40. data/doc/classes/Win32/Console.src/M000030.html +23 -0
  41. data/doc/classes/Win32/Console.src/M000031.html +23 -0
  42. data/doc/classes/Win32/Console.src/M000032.html +27 -0
  43. data/doc/classes/Win32/Console.src/M000033.html +27 -0
  44. data/doc/classes/Win32/Console.src/M000034.html +25 -0
  45. data/doc/classes/Win32/Console/ANSI.html +103 -0
  46. data/doc/classes/Win32/Console/ANSI/IO.html +220 -0
  47. data/doc/classes/Win32/Console/ANSI/IO.src/M000035.html +32 -0
  48. data/doc/classes/Win32/Console/ANSI/IO.src/M000036.html +205 -0
  49. data/doc/classes/Win32/Console/ANSI/IO.src/M000037.html +40 -0
  50. data/doc/classes/Win32/Console/ANSI/IO.src/M000038.html +25 -0
  51. data/doc/classes/Win32/Console/API.html +758 -0
  52. data/doc/classes/Win32/Console/API.src/M000039.html +27 -0
  53. data/doc/classes/Win32/Console/API.src/M000040.html +27 -0
  54. data/doc/classes/Win32/Console/API.src/M000041.html +27 -0
  55. data/doc/classes/Win32/Console/API.src/M000042.html +32 -0
  56. data/doc/classes/Win32/Console/API.src/M000043.html +32 -0
  57. data/doc/classes/Win32/Console/API.src/M000044.html +28 -0
  58. data/doc/classes/Win32/Console/API.src/M000045.html +26 -0
  59. data/doc/classes/Win32/Console/API.src/M000046.html +26 -0
  60. data/doc/classes/Win32/Console/API.src/M000047.html +27 -0
  61. data/doc/classes/Win32/Console/API.src/M000048.html +30 -0
  62. data/doc/classes/Win32/Console/API.src/M000049.html +29 -0
  63. data/doc/classes/Win32/Console/API.src/M000050.html +27 -0
  64. data/doc/classes/Win32/Console/API.src/M000051.html +28 -0
  65. data/doc/classes/Win32/Console/API.src/M000052.html +30 -0
  66. data/doc/classes/Win32/Console/API.src/M000053.html +27 -0
  67. data/doc/classes/Win32/Console/API.src/M000054.html +29 -0
  68. data/doc/classes/Win32/Console/API.src/M000055.html +29 -0
  69. data/doc/classes/Win32/Console/API.src/M000056.html +28 -0
  70. data/doc/classes/Win32/Console/API.src/M000057.html +27 -0
  71. data/doc/classes/Win32/Console/API.src/M000058.html +47 -0
  72. data/doc/classes/Win32/Console/API.src/M000059.html +32 -0
  73. data/doc/classes/Win32/Console/API.src/M000060.html +47 -0
  74. data/doc/classes/Win32/Console/API.src/M000061.html +34 -0
  75. data/doc/classes/Win32/Console/API.src/M000062.html +32 -0
  76. data/doc/classes/Win32/Console/API.src/M000063.html +32 -0
  77. data/doc/classes/Win32/Console/API.src/M000064.html +35 -0
  78. data/doc/classes/Win32/Console/API.src/M000065.html +26 -0
  79. data/doc/classes/Win32/Console/API.src/M000066.html +27 -0
  80. data/doc/classes/Win32/Console/API.src/M000067.html +29 -0
  81. data/doc/classes/Win32/Console/API.src/M000068.html +27 -0
  82. data/doc/classes/Win32/Console/API.src/M000069.html +27 -0
  83. data/doc/classes/Win32/Console/API.src/M000070.html +28 -0
  84. data/doc/classes/Win32/Console/API.src/M000071.html +27 -0
  85. data/doc/classes/Win32/Console/API.src/M000072.html +26 -0
  86. data/doc/classes/Win32/Console/API.src/M000073.html +27 -0
  87. data/doc/classes/Win32/Console/API.src/M000074.html +31 -0
  88. data/doc/classes/Win32/Console/API.src/M000075.html +27 -0
  89. data/doc/classes/Win32/Console/API.src/M000076.html +32 -0
  90. data/doc/classes/Win32/Console/API.src/M000077.html +27 -0
  91. data/doc/classes/Win32/Console/API.src/M000078.html +32 -0
  92. data/doc/classes/Win32/Console/API.src/M000079.html +32 -0
  93. data/doc/classes/Win32/Console/API.src/M000080.html +32 -0
  94. data/doc/classes/Win32/Console/Constants.html +360 -0
  95. data/doc/created.rid +1 -0
  96. data/doc/files/Console_ANSI_rdoc.html +407 -0
  97. data/doc/files/Console_cpp.html +104 -0
  98. data/doc/files/Console_rdoc.html +964 -0
  99. data/doc/files/lib/Win32/Console/ANSI_rb.html +123 -0
  100. data/doc/files/lib/Win32/Console_rb.html +297 -0
  101. data/doc/fr_class_index.html +32 -0
  102. data/doc/fr_file_index.html +31 -0
  103. data/doc/fr_method_index.html +106 -0
  104. data/doc/index.html +24 -0
  105. data/doc/rdoc-style.css +172 -0
  106. data/lib/Console.so +0 -0
  107. data/lib/README_GEM.txt +64 -0
  108. data/lib/Term/ansicolor.rb +76 -0
  109. data/lib/Win32/Console.rb +970 -0
  110. data/lib/Win32/Console/ANSI.rb +305 -0
  111. data/lib/win32console.rb +3 -0
  112. data/test/test_cursor.rb +9 -0
  113. data/test/test_mouse.rb +6 -0
  114. data/test/test_readinput.rb +62 -0
  115. data/test/test_readoutput.rb +52 -0
  116. data/test/test_sendevent.rb +17 -0
  117. data/test/test_title.rb +14 -0
  118. data/test/test_write.rb +36 -0
  119. metadata +180 -0
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "DTD/xhtml1-transitional.dtd">
5
+
6
+ <!--
7
+
8
+ OutputCP (Win32::Console)
9
+
10
+ -->
11
+ <html>
12
+ <head>
13
+ <title>OutputCP (Win32::Console)</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ <link rel="stylesheet" href="http://www.FaerieMUD.org/stylesheets/rdoc.css" type="text/css" />
16
+ </head>
17
+ <body>
18
+ <pre><span class="ruby-comment cmt"># File lib\Win32/Console.rb, line 872</span>
19
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Console</span>.<span class="ruby-constant">OutputCP</span>(<span class="ruby-identifier">codepage</span>=<span class="ruby-keyword kw">nil</span>)
20
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">codepage</span>
21
+ <span class="ruby-constant">API</span>.<span class="ruby-constant">SetConsoleOutputCP</span>(<span class="ruby-identifier">codepage</span>)
22
+ <span class="ruby-keyword kw">else</span>
23
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">API</span>.<span class="ruby-constant">GetConsoleOutputCP</span>()
24
+ <span class="ruby-keyword kw">end</span>
25
+ <span class="ruby-keyword kw">end</span></pre>
26
+ </body>
27
+ </html>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "DTD/xhtml1-transitional.dtd">
5
+
6
+ <!--
7
+
8
+ GenerateCtrlEvent (Win32::Console)
9
+
10
+ -->
11
+ <html>
12
+ <head>
13
+ <title>GenerateCtrlEvent (Win32::Console)</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ <link rel="stylesheet" href="http://www.FaerieMUD.org/stylesheets/rdoc.css" type="text/css" />
16
+ </head>
17
+ <body>
18
+ <pre><span class="ruby-comment cmt"># File lib\Win32/Console.rb, line 880</span>
19
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Console</span>.<span class="ruby-constant">GenerateCtrlEvent</span>( <span class="ruby-identifier">type</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">pid</span>=<span class="ruby-keyword kw">nil</span> )
20
+ <span class="ruby-identifier">type</span> = <span class="ruby-constant">API</span>.<span class="ruby-identifier">constant</span>(<span class="ruby-value str">'CTRL_C_EVENT'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
21
+ <span class="ruby-identifier">pid</span> = <span class="ruby-value">0</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
22
+ <span class="ruby-constant">API</span>.<span class="ruby-constant">GenerateConsoleCtrlEvent</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">pid</span>)
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,103 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Win32::Console::ANSI</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <h1>Win32::Console::ANSI <sup class="type-note">(Module)</sup></h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>In:</strong></td>
54
+ <td>
55
+ <a href="../../../files/lib\Win32/Console/ANSI_rb.html">
56
+ lib\Win32/Console/ANSI.rb
57
+ </a>
58
+ <br />
59
+ </td>
60
+ </tr>
61
+
62
+ </table>
63
+ </div>
64
+ <!-- banner header -->
65
+
66
+ <div id="bodyContent">
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ <div id="class-list">
79
+ <h2 class="section-bar">Classes and Modules</h2>
80
+
81
+ Class <a href="ANSI/IO.html" class="link">Win32::Console::ANSI::IO</a><br />
82
+
83
+ </div>
84
+
85
+ </div>
86
+
87
+
88
+
89
+ <!-- if includes -->
90
+
91
+
92
+ <!-- if method_list -->
93
+
94
+
95
+ </div>
96
+
97
+
98
+ <div id="validator-badges">
99
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
100
+ </div>
101
+
102
+ </body>
103
+ </html>
@@ -0,0 +1,220 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Win32::Console::ANSI::IO</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <h1>Win32::Console::ANSI::IO <sup class="type-note">(Class)</sup></h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>In:</strong></td>
54
+ <td>
55
+ <a href="../../../../files/lib\Win32/Console/ANSI_rb.html">
56
+ lib\Win32/Console/ANSI.rb
57
+ </a>
58
+ <br />
59
+ </td>
60
+ </tr>
61
+
62
+ <tr class="top-aligned-row">
63
+ <td><strong>Parent:</strong></td>
64
+ <td>
65
+ <a href="IO.html">
66
+ IO
67
+ </a>
68
+ </td>
69
+ </tr>
70
+ </table>
71
+ </div>
72
+ <!-- banner header -->
73
+
74
+ <div id="bodyContent">
75
+
76
+
77
+ <div id="contextContent">
78
+
79
+
80
+
81
+ <div id="method-list">
82
+ <h2 class="section-bar">Methods</h2>
83
+
84
+ <div class="name-list">
85
+ <a href="#M000036">_PrintString</a>&nbsp;&nbsp;
86
+ <a href="#M000037">_conv</a>&nbsp;&nbsp;
87
+ <a href="#M000035">new</a>&nbsp;&nbsp;
88
+ <a href="#M000038">write</a>&nbsp;&nbsp;
89
+ </div>
90
+ </div>
91
+
92
+ <div id="constants-list">
93
+ <h2 class="section-bar">Constants</h2>
94
+
95
+ <div class="name-list">
96
+ <table summary="Constants">
97
+ <tr class="top-aligned-row context-row">
98
+ <td class="context-item-name">VERSION</td>
99
+ <td>=</td>
100
+ <td class="context-item-value">'0.04'</td>
101
+ </tr>
102
+ <tr class="top-aligned-row context-row">
103
+ <td class="context-item-name">DEBUG</td>
104
+ <td>=</td>
105
+ <td class="context-item-value">nil</td>
106
+ </tr>
107
+ <tr class="top-aligned-row context-row">
108
+ <td class="context-item-name">EncodeOk</td>
109
+ <td>=</td>
110
+ <td class="context-item-value">false</td>
111
+ </tr>
112
+ <tr class="top-aligned-row context-row">
113
+ <td>&nbsp;</td>
114
+ <td colspan="2" class="context-item-desc">
115
+ @todo: encode is another perl module
116
+
117
+ </td>
118
+ </tr>
119
+ <tr class="top-aligned-row context-row">
120
+ <td class="context-item-name">OEM</td>
121
+ <td>=</td>
122
+ <td class="context-item-value">Win32::Console::OutputCP()</td>
123
+ </tr>
124
+ </table>
125
+ </div>
126
+ </div>
127
+
128
+
129
+
130
+
131
+
132
+ </div>
133
+
134
+
135
+
136
+ <!-- if includes -->
137
+ <div id="includes">
138
+ <h2 class="section-bar">Included Modules</h2>
139
+
140
+ <div id="includes-list">
141
+ <span class="include-name"><a href="../Constants.html">Win32::Console::Constants</a></span>
142
+ </div>
143
+ </div>
144
+
145
+
146
+ <!-- if method_list -->
147
+ <div id="methods">
148
+ <h2 class="section-bar">Public Class methods</h2>
149
+
150
+ <div id="method-M000035" class="method-detail">
151
+ <a name="M000035"></a>
152
+
153
+ <div class="method-heading">
154
+ <a href="IO.src/M000035.html" target="Code" class="method-signature"
155
+ onclick="popupCode('IO.src/M000035.html');return false;">
156
+ <span class="method-name">new</span><span class="method-args">()</span>
157
+ </a>
158
+ </div>
159
+
160
+ <div class="method-description">
161
+ </div>
162
+ </div>
163
+
164
+ <h2 class="section-bar">Public Instance methods</h2>
165
+
166
+ <div id="method-M000036" class="method-detail">
167
+ <a name="M000036"></a>
168
+
169
+ <div class="method-heading">
170
+ <a href="IO.src/M000036.html" target="Code" class="method-signature"
171
+ onclick="popupCode('IO.src/M000036.html');return false;">
172
+ <span class="method-name">_PrintString</span><span class="method-args">(s)</span>
173
+ </a>
174
+ </div>
175
+
176
+ <div class="method-description">
177
+ </div>
178
+ </div>
179
+
180
+ <div id="method-M000037" class="method-detail">
181
+ <a name="M000037"></a>
182
+
183
+ <div class="method-heading">
184
+ <a href="IO.src/M000037.html" target="Code" class="method-signature"
185
+ onclick="popupCode('IO.src/M000037.html');return false;">
186
+ <span class="method-name">_conv</span><span class="method-args">(s)</span>
187
+ </a>
188
+ </div>
189
+
190
+ <div class="method-description">
191
+ </div>
192
+ </div>
193
+
194
+ <div id="method-M000038" class="method-detail">
195
+ <a name="M000038"></a>
196
+
197
+ <div class="method-heading">
198
+ <a href="IO.src/M000038.html" target="Code" class="method-signature"
199
+ onclick="popupCode('IO.src/M000038.html');return false;">
200
+ <span class="method-name">write</span><span class="method-args">(*s)</span>
201
+ </a>
202
+ </div>
203
+
204
+ <div class="method-description">
205
+ </div>
206
+ </div>
207
+
208
+
209
+ </div>
210
+
211
+
212
+ </div>
213
+
214
+
215
+ <div id="validator-badges">
216
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
217
+ </div>
218
+
219
+ </body>
220
+ </html>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "DTD/xhtml1-transitional.dtd">
5
+
6
+ <!--
7
+
8
+ new (Win32::Console::ANSI::IO)
9
+
10
+ -->
11
+ <html>
12
+ <head>
13
+ <title>new (Win32::Console::ANSI::IO)</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ <link rel="stylesheet" href="http://www.FaerieMUD.org/stylesheets/rdoc.css" type="text/css" />
16
+ </head>
17
+ <body>
18
+ <pre><span class="ruby-comment cmt"># File lib\Win32/Console/ANSI.rb, line 55</span>
19
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
20
+ <span class="ruby-keyword kw">super</span>(<span class="ruby-value">1</span>,<span class="ruby-value str">'w'</span>)
21
+ <span class="ruby-ivar">@Out</span> = <span class="ruby-constant">Win32</span><span class="ruby-operator">::</span><span class="ruby-constant">Console</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STD_OUTPUT_HANDLE</span>)
22
+ <span class="ruby-ivar">@x</span> = <span class="ruby-ivar">@y</span> = <span class="ruby-value">0</span> <span class="ruby-comment cmt"># to save cursor position</span>
23
+ <span class="ruby-ivar">@foreground</span> = <span class="ruby-value">7</span>
24
+ <span class="ruby-ivar">@background</span> = <span class="ruby-value">0</span>
25
+ <span class="ruby-ivar">@bold</span> =
26
+ <span class="ruby-ivar">@underline</span> =
27
+ <span class="ruby-ivar">@revideo</span> =
28
+ <span class="ruby-ivar">@concealed</span> = <span class="ruby-keyword kw">nil</span>
29
+ <span class="ruby-ivar">@conv</span> = <span class="ruby-value">1</span> <span class="ruby-comment cmt"># char conversion by default</span>
30
+ <span class="ruby-keyword kw">end</span></pre>
31
+ </body>
32
+ </html>
@@ -0,0 +1,205 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "DTD/xhtml1-transitional.dtd">
5
+
6
+ <!--
7
+
8
+ _PrintString (Win32::Console::ANSI::IO)
9
+
10
+ -->
11
+ <html>
12
+ <head>
13
+ <title>_PrintString (Win32::Console::ANSI::IO)</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ <link rel="stylesheet" href="http://www.FaerieMUD.org/stylesheets/rdoc.css" type="text/css" />
16
+ </head>
17
+ <body>
18
+ <pre><span class="ruby-comment cmt"># File lib\Win32/Console/ANSI.rb, line 68</span>
19
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_PrintString</span>(<span class="ruby-identifier">s</span>)
20
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">''</span>
21
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>( <span class="ruby-regexp re">/([^\e]*)?\e([\[\(])([0-9\;\=]*)([a-zA-Z@])(.*)/s</span>,<span class="ruby-value str">'\5'</span>)
22
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Write</span>((<span class="ruby-identifier">_conv</span>(<span class="ruby-value str">&quot;#$1&quot;</span>)))
23
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$2</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'['</span>
24
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">$4</span>
25
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'m'</span> <span class="ruby-comment cmt"># ESC[#;#;....;#m Set display attributes</span>
26
+ <span class="ruby-identifier">attributs</span> = <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">';'</span>)
27
+ <span class="ruby-identifier">attributs</span>.<span class="ruby-identifier">push</span>(<span class="ruby-keyword kw">nil</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">attributs</span> <span class="ruby-comment cmt"># ESC[m == ESC[;m ==...==ESC[0m</span>
28
+ <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">attr</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">attributs</span>
29
+ <span class="ruby-identifier">atv</span> = <span class="ruby-identifier">attr</span>.<span class="ruby-identifier">to_i</span>
30
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
31
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
32
+ <span class="ruby-ivar">@bold</span> = <span class="ruby-value">1</span>
33
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">21</span>
34
+ <span class="ruby-ivar">@bold</span> = <span class="ruby-keyword kw">nil</span>
35
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>
36
+ <span class="ruby-ivar">@underline</span> = <span class="ruby-value">1</span>
37
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">24</span>
38
+ <span class="ruby-ivar">@underline</span> = <span class="ruby-keyword kw">nil</span>
39
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">7</span>
40
+ <span class="ruby-ivar">@revideo</span> = <span class="ruby-value">1</span>
41
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">27</span>
42
+ <span class="ruby-ivar">@revideo</span> = <span class="ruby-keyword kw">nil</span>
43
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">8</span>
44
+ <span class="ruby-ivar">@concealed</span> = <span class="ruby-value">1</span>
45
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">==</span> <span class="ruby-value">28</span>
46
+ <span class="ruby-ivar">@concealed</span> = <span class="ruby-keyword kw">nil</span>
47
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">30</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">37</span>
48
+ <span class="ruby-ivar">@foreground</span> = <span class="ruby-identifier">atv</span> <span class="ruby-operator">-</span> <span class="ruby-value">30</span>
49
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">&gt;=</span><span class="ruby-value">40</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">atv</span> <span class="ruby-operator">&lt;=</span><span class="ruby-value">47</span>
50
+ <span class="ruby-ivar">@background</span> = <span class="ruby-identifier">atv</span> <span class="ruby-operator">-</span> <span class="ruby-value">40</span>
51
+ <span class="ruby-keyword kw">end</span>
52
+ <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># ESC[0m reset</span>
53
+ <span class="ruby-ivar">@foreground</span> = <span class="ruby-value">7</span>
54
+ <span class="ruby-ivar">@background</span> = <span class="ruby-value">0</span>
55
+ <span class="ruby-ivar">@bold</span> =
56
+ <span class="ruby-ivar">@underline</span> =
57
+ <span class="ruby-ivar">@revideo</span> =
58
+ <span class="ruby-ivar">@concealed</span> = <span class="ruby-keyword kw">nil</span>
59
+ <span class="ruby-keyword kw">end</span>
60
+ <span class="ruby-keyword kw">end</span>
61
+
62
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@revideo</span>
63
+ <span class="ruby-identifier">attribut</span> = @<span class="ruby-ivar">@color</span>[<span class="ruby-value">40</span><span class="ruby-operator">+</span><span class="ruby-ivar">@foreground</span>] <span class="ruby-operator">|</span>
64
+ @<span class="ruby-ivar">@color</span>[<span class="ruby-value">30</span><span class="ruby-operator">+</span><span class="ruby-ivar">@background</span>]
65
+ <span class="ruby-keyword kw">else</span>
66
+ <span class="ruby-identifier">attribut</span> = @<span class="ruby-ivar">@color</span>[<span class="ruby-value">30</span><span class="ruby-operator">+</span><span class="ruby-ivar">@foreground</span>] <span class="ruby-operator">|</span>
67
+ @<span class="ruby-ivar">@color</span>[<span class="ruby-value">40</span><span class="ruby-operator">+</span><span class="ruby-ivar">@background</span>]
68
+ <span class="ruby-keyword kw">end</span>
69
+ <span class="ruby-identifier">attribut</span> <span class="ruby-operator">|=</span> <span class="ruby-constant">FOREGROUND_INTENSITY</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@bold</span>
70
+ <span class="ruby-identifier">attribut</span> <span class="ruby-operator">|=</span> <span class="ruby-constant">BACKGROUND_INTENSITY</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@underline</span>
71
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Attr</span>(<span class="ruby-identifier">attribut</span>)
72
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'J'</span>
73
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$3</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span> <span class="ruby-comment cmt"># ESC[0J from cursor to end of display</span>
74
+ <span class="ruby-identifier">info</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Info</span>()
75
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> ((<span class="ruby-identifier">info</span>[<span class="ruby-value">1</span>]<span class="ruby-operator">-</span><span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>)<span class="ruby-operator">*</span><span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">-</span><span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>)
76
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">WriteChar</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
77
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
78
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'1'</span> <span class="ruby-comment cmt"># ESC[1J erase from start to cursor.</span>
79
+ <span class="ruby-identifier">info</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Info</span>()
80
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>]<span class="ruby-operator">*</span><span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">+</span><span class="ruby-value">1</span>)
81
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">WriteChar</span>(<span class="ruby-identifier">s</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)
82
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
83
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'2'</span> <span class="ruby-comment cmt"># ESC[2J Clear screen and home cursor</span>
84
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cls</span>()
85
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>)
86
+ <span class="ruby-keyword kw">else</span>
87
+ <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">print</span> <span class="ruby-value str">&quot;\e#$2#$3#$4&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">DEBUG</span> <span class="ruby-comment cmt"># if ESC-code not implemented</span>
88
+ <span class="ruby-keyword kw">end</span>
89
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'K'</span>
90
+ <span class="ruby-identifier">info</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Info</span>()
91
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">$3</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span> <span class="ruby-comment cmt"># ESC[0K Clear to end of line</span>
92
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">info</span>[<span class="ruby-value">7</span>]<span class="ruby-operator">-</span><span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">+</span><span class="ruby-value">1</span>)
93
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Write</span>(<span class="ruby-identifier">s</span>)
94
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
95
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">$3</span><span class="ruby-operator">==</span><span class="ruby-value str">'1'</span> <span class="ruby-comment cmt"># ESC[1K Clear from start of line to cursor</span>
96
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">' '</span><span class="ruby-operator">*</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">+</span><span class="ruby-value">1</span>)
97
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">WriteChar</span>(<span class="ruby-identifier">s</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
98
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
99
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">$3</span><span class="ruby-operator">==</span><span class="ruby-value str">'2'</span> <span class="ruby-comment cmt"># ESC[2K Clear whole line.</span>
100
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">' '</span><span class="ruby-operator">*</span> <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]
101
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">WriteChar</span>(<span class="ruby-identifier">s</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
102
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
103
+ <span class="ruby-keyword kw">end</span>
104
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'L'</span> <span class="ruby-comment cmt"># ESC[#L Insert # blank lines.</span>
105
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-comment cmt"># ESC[L == ESC[1L</span>
106
+ <span class="ruby-identifier">info</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Info</span>()
107
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Scroll</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">1</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>,
108
+ <span class="ruby-value">0</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,
109
+ <span class="ruby-value str">' '</span>[<span class="ruby-value">0</span>], <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Attr</span>(),
110
+ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">10000</span>, <span class="ruby-value">10000</span>)
111
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
112
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'M'</span> <span class="ruby-comment cmt"># ESC[#M Delete # line.</span>
113
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-comment cmt"># ESC[M == ESC[1M</span>
114
+ <span class="ruby-identifier">info</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Info</span>();
115
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Scroll</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">1</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>,
116
+ <span class="ruby-value">0</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>],
117
+ <span class="ruby-value str">' '</span>[<span class="ruby-value">0</span>], <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Attr</span>(),
118
+ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">10000</span>, <span class="ruby-value">10000</span>)
119
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
120
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'P'</span> <span class="ruby-comment cmt"># ESC[#P Delete # characters.</span>
121
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-comment cmt"># ESC[P == ESC[1P</span>
122
+ <span class="ruby-identifier">info</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Info</span>()
123
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">-</span><span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>
124
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Scroll</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>] , <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">-</span><span class="ruby-value">1</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>],
125
+ <span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>],
126
+ <span class="ruby-value str">' '</span>[<span class="ruby-value">0</span>], <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Attr</span>(),
127
+ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">10000</span>, <span class="ruby-value">10000</span>)
128
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>
129
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">-</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
130
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Write</span>(<span class="ruby-identifier">s</span>)
131
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
132
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'@'</span> <span class="ruby-comment cmt"># ESC[#@ Insert # blank Characters</span>
133
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>
134
+ <span class="ruby-identifier">info</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Info</span>()
135
+ <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">ReadChar</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">7</span>]<span class="ruby-operator">-</span><span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">+</span><span class="ruby-value">1</span>, <span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
136
+ <span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-operator">-</span>(<span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>)]
137
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Write</span>(<span class="ruby-identifier">s</span>);
138
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>], <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>])
139
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'A'</span> <span class="ruby-comment cmt"># ESC[#A Moves cursor up # lines</span>
140
+ (<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
141
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-comment cmt"># ESC[A == ESC[1A</span>
142
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">-</span><span class="ruby-identifier">n</span>)
143
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'B'</span> <span class="ruby-comment cmt"># ESC[#B Moves cursor down # lines</span>
144
+ (<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
145
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-comment cmt"># ESC[B == ESC[1B</span>
146
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">+</span><span class="ruby-identifier">n</span>)
147
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'C'</span> <span class="ruby-comment cmt"># ESC[#C Moves cursor forward # spaces</span>
148
+ (<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
149
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-comment cmt"># ESC[C == ESC[1C</span>
150
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">x</span><span class="ruby-operator">+</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">y</span>)
151
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'D'</span> <span class="ruby-comment cmt"># ESC[#D Moves cursor back # spaces</span>
152
+ (<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
153
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-comment cmt"># ESC[D == ESC[1D</span>
154
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">x</span><span class="ruby-operator">-</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">y</span>)
155
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'E'</span> <span class="ruby-comment cmt"># ESC[#E Moves cursor down # lines, column 1.</span>
156
+ <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
157
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-comment cmt"># ESC[E == ESC[1E</span>
158
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">+</span><span class="ruby-identifier">n</span>)
159
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'F'</span> <span class="ruby-comment cmt"># ESC[#F Moves cursor up # lines, column 1.</span>
160
+ <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
161
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-comment cmt"># ESC[F == ESC[1F</span>
162
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">-</span><span class="ruby-identifier">n</span>)
163
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'G'</span> <span class="ruby-comment cmt"># ESC[#G Moves cursor column # in current row.</span>
164
+ <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span> = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
165
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">$3</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span><span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-comment cmt"># ESC[G == ESC[1G</span>
166
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>, <span class="ruby-identifier">y</span>)
167
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'f'</span> <span class="ruby-comment cmt"># ESC[#;#f Moves cursor to line #, column #</span>
168
+ <span class="ruby-identifier">y</span>, <span class="ruby-identifier">x</span> = <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">';'</span>)
169
+ <span class="ruby-identifier">x</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">x</span> <span class="ruby-comment cmt"># ESC[;5H == ESC[1;5H ...etc</span>
170
+ <span class="ruby-identifier">y</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">y</span>
171
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>, <span class="ruby-identifier">y</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-comment cmt"># origin (0,0) in DOS console</span>
172
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'H'</span> <span class="ruby-comment cmt"># ESC[#;#H Moves cursor to line #, column #</span>
173
+ <span class="ruby-identifier">y</span>, <span class="ruby-identifier">x</span> = <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">';'</span>)
174
+ <span class="ruby-identifier">x</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">x</span> <span class="ruby-comment cmt"># ESC[;5H == ESC[1;5H ...etc</span>
175
+ <span class="ruby-identifier">y</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">y</span>
176
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>, <span class="ruby-identifier">y</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-comment cmt"># origin (0,0) in DOS console</span>
177
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'s'</span> <span class="ruby-comment cmt"># ESC[s Saves cursor position for recall later</span>
178
+ (<span class="ruby-ivar">@x</span>, <span class="ruby-ivar">@y</span>) = <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>()
179
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'u'</span> <span class="ruby-comment cmt"># ESC[u Return to saved cursor position</span>
180
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Cursor</span>(<span class="ruby-ivar">@x</span>, <span class="ruby-ivar">@y</span>)
181
+ <span class="ruby-keyword kw">else</span>
182
+ <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;\e#$2#$3#$4 not implemented&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">DEBUG</span> <span class="ruby-comment cmt"># ESC-code not implemented</span>
183
+ <span class="ruby-keyword kw">end</span>
184
+ <span class="ruby-keyword kw">else</span>
185
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">$4</span>
186
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'U'</span> <span class="ruby-comment cmt"># ESC(U no mapping</span>
187
+ <span class="ruby-ivar">@conv</span> = <span class="ruby-keyword kw">nil</span>
188
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'K'</span> <span class="ruby-comment cmt"># ESC(K mapping if it exist</span>
189
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">OutputCP</span>(<span class="ruby-constant">OEM</span>) <span class="ruby-comment cmt"># restore original codepage</span>
190
+ <span class="ruby-ivar">@conv</span> = <span class="ruby-value">1</span>
191
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'X'</span> <span class="ruby-comment cmt"># ESC(#X codepage **EXPERIMENTAL**</span>
192
+ <span class="ruby-ivar">@conv</span> = <span class="ruby-keyword kw">nil</span>
193
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">OutputCP</span>(<span class="ruby-identifier">$3</span>)
194
+ <span class="ruby-keyword kw">else</span>
195
+ <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;\e#$2#$3#$4 not implemented&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">DEBUG</span> <span class="ruby-comment cmt"># ESC-code not implemented</span>
196
+ <span class="ruby-keyword kw">end</span>
197
+ <span class="ruby-keyword kw">end</span>
198
+ <span class="ruby-keyword kw">else</span>
199
+ <span class="ruby-ivar">@Out</span>.<span class="ruby-constant">Write</span>(<span class="ruby-identifier">_conv</span>(<span class="ruby-identifier">s</span>.<span class="ruby-identifier">dup</span>))
200
+ <span class="ruby-identifier">s</span>=<span class="ruby-value str">''</span>
201
+ <span class="ruby-keyword kw">end</span>
202
+ <span class="ruby-keyword kw">end</span>
203
+ <span class="ruby-keyword kw">end</span></pre>
204
+ </body>
205
+ </html>