clio 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/COPYING +170 -0
  2. data/HISTORY +11 -0
  3. data/MANIFEST +181 -0
  4. data/METADATA +18 -0
  5. data/NEWS +10 -0
  6. data/README +52 -0
  7. data/admin/config/reap.yaml +30 -0
  8. data/admin/depot/commandline.rb +219 -0
  9. data/admin/depot/multicommand.rb +403 -0
  10. data/admin/depot/test_multicommand.rb +40 -0
  11. data/admin/log/notes.xml +28 -0
  12. data/admin/log/stats.html +25 -0
  13. data/admin/log/syntax.log +0 -0
  14. data/admin/log/testunit.log +16 -0
  15. data/admin/pack/clio-0.0.1.gem +0 -0
  16. data/admin/share/reap/example.rb +7 -0
  17. data/admin/temps/lib/clio/about.rb.erb +4 -0
  18. data/lib/clio/ansicode.rb +319 -0
  19. data/lib/clio/command.rb +296 -0
  20. data/lib/clio/commandable.rb +195 -0
  21. data/lib/clio/commandline.rb +275 -0
  22. data/lib/clio/consoleutils.rb +117 -0
  23. data/lib/clio/errors.rb +16 -0
  24. data/lib/clio/option.rb +36 -0
  25. data/lib/clio/progressbar.rb +253 -0
  26. data/lib/clio/runmode.rb +126 -0
  27. data/lib/clio/string.rb +147 -0
  28. data/test/test_command.rb +42 -0
  29. data/test/test_commandline.rb +83 -0
  30. data/vendor/Console/Console.cpp +1203 -0
  31. data/vendor/Console/Console.rdoc +690 -0
  32. data/vendor/Console/Console_ANSI.rdoc +302 -0
  33. data/vendor/Console/HISTORY.txt +7 -0
  34. data/vendor/Console/INSTALL.txt +18 -0
  35. data/vendor/Console/Makefile +162 -0
  36. data/vendor/Console/README.txt +26 -0
  37. data/vendor/Console/doc/classes/Win32.html +115 -0
  38. data/vendor/Console/doc/classes/Win32/Console.html +650 -0
  39. data/vendor/Console/doc/classes/Win32/Console.src/M000001.html +31 -0
  40. data/vendor/Console/doc/classes/Win32/Console.src/M000002.html +23 -0
  41. data/vendor/Console/doc/classes/Win32/Console.src/M000003.html +23 -0
  42. data/vendor/Console/doc/classes/Win32/Console.src/M000004.html +27 -0
  43. data/vendor/Console/doc/classes/Win32/Console.src/M000005.html +23 -0
  44. data/vendor/Console/doc/classes/Win32/Console.src/M000006.html +28 -0
  45. data/vendor/Console/doc/classes/Win32/Console.src/M000007.html +23 -0
  46. data/vendor/Console/doc/classes/Win32/Console.src/M000008.html +24 -0
  47. data/vendor/Console/doc/classes/Win32/Console.src/M000009.html +44 -0
  48. data/vendor/Console/doc/classes/Win32/Console.src/M000010.html +23 -0
  49. data/vendor/Console/doc/classes/Win32/Console.src/M000011.html +33 -0
  50. data/vendor/Console/doc/classes/Win32/Console.src/M000012.html +26 -0
  51. data/vendor/Console/doc/classes/Win32/Console.src/M000013.html +27 -0
  52. data/vendor/Console/doc/classes/Win32/Console.src/M000014.html +28 -0
  53. data/vendor/Console/doc/classes/Win32/Console.src/M000015.html +23 -0
  54. data/vendor/Console/doc/classes/Win32/Console.src/M000016.html +23 -0
  55. data/vendor/Console/doc/classes/Win32/Console.src/M000017.html +23 -0
  56. data/vendor/Console/doc/classes/Win32/Console.src/M000018.html +29 -0
  57. data/vendor/Console/doc/classes/Win32/Console.src/M000019.html +23 -0
  58. data/vendor/Console/doc/classes/Win32/Console.src/M000020.html +23 -0
  59. data/vendor/Console/doc/classes/Win32/Console.src/M000021.html +28 -0
  60. data/vendor/Console/doc/classes/Win32/Console.src/M000022.html +23 -0
  61. data/vendor/Console/doc/classes/Win32/Console.src/M000023.html +28 -0
  62. data/vendor/Console/doc/classes/Win32/Console.src/M000024.html +35 -0
  63. data/vendor/Console/doc/classes/Win32/Console.src/M000025.html +28 -0
  64. data/vendor/Console/doc/classes/Win32/Console.src/M000026.html +28 -0
  65. data/vendor/Console/doc/classes/Win32/Console.src/M000027.html +28 -0
  66. data/vendor/Console/doc/classes/Win32/Console.src/M000028.html +31 -0
  67. data/vendor/Console/doc/classes/Win32/Console.src/M000029.html +23 -0
  68. data/vendor/Console/doc/classes/Win32/Console.src/M000030.html +23 -0
  69. data/vendor/Console/doc/classes/Win32/Console.src/M000031.html +23 -0
  70. data/vendor/Console/doc/classes/Win32/Console.src/M000032.html +27 -0
  71. data/vendor/Console/doc/classes/Win32/Console.src/M000033.html +27 -0
  72. data/vendor/Console/doc/classes/Win32/Console.src/M000034.html +25 -0
  73. data/vendor/Console/doc/classes/Win32/Console/ANSI.html +103 -0
  74. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.html +220 -0
  75. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000035.html +32 -0
  76. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000036.html +205 -0
  77. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000037.html +40 -0
  78. data/vendor/Console/doc/classes/Win32/Console/ANSI/IO.src/M000038.html +25 -0
  79. data/vendor/Console/doc/classes/Win32/Console/API.html +758 -0
  80. data/vendor/Console/doc/classes/Win32/Console/API.src/M000039.html +27 -0
  81. data/vendor/Console/doc/classes/Win32/Console/API.src/M000040.html +27 -0
  82. data/vendor/Console/doc/classes/Win32/Console/API.src/M000041.html +27 -0
  83. data/vendor/Console/doc/classes/Win32/Console/API.src/M000042.html +32 -0
  84. data/vendor/Console/doc/classes/Win32/Console/API.src/M000043.html +32 -0
  85. data/vendor/Console/doc/classes/Win32/Console/API.src/M000044.html +28 -0
  86. data/vendor/Console/doc/classes/Win32/Console/API.src/M000045.html +26 -0
  87. data/vendor/Console/doc/classes/Win32/Console/API.src/M000046.html +26 -0
  88. data/vendor/Console/doc/classes/Win32/Console/API.src/M000047.html +27 -0
  89. data/vendor/Console/doc/classes/Win32/Console/API.src/M000048.html +30 -0
  90. data/vendor/Console/doc/classes/Win32/Console/API.src/M000049.html +29 -0
  91. data/vendor/Console/doc/classes/Win32/Console/API.src/M000050.html +27 -0
  92. data/vendor/Console/doc/classes/Win32/Console/API.src/M000051.html +28 -0
  93. data/vendor/Console/doc/classes/Win32/Console/API.src/M000052.html +30 -0
  94. data/vendor/Console/doc/classes/Win32/Console/API.src/M000053.html +27 -0
  95. data/vendor/Console/doc/classes/Win32/Console/API.src/M000054.html +29 -0
  96. data/vendor/Console/doc/classes/Win32/Console/API.src/M000055.html +29 -0
  97. data/vendor/Console/doc/classes/Win32/Console/API.src/M000056.html +28 -0
  98. data/vendor/Console/doc/classes/Win32/Console/API.src/M000057.html +27 -0
  99. data/vendor/Console/doc/classes/Win32/Console/API.src/M000058.html +47 -0
  100. data/vendor/Console/doc/classes/Win32/Console/API.src/M000059.html +32 -0
  101. data/vendor/Console/doc/classes/Win32/Console/API.src/M000060.html +47 -0
  102. data/vendor/Console/doc/classes/Win32/Console/API.src/M000061.html +34 -0
  103. data/vendor/Console/doc/classes/Win32/Console/API.src/M000062.html +32 -0
  104. data/vendor/Console/doc/classes/Win32/Console/API.src/M000063.html +32 -0
  105. data/vendor/Console/doc/classes/Win32/Console/API.src/M000064.html +35 -0
  106. data/vendor/Console/doc/classes/Win32/Console/API.src/M000065.html +26 -0
  107. data/vendor/Console/doc/classes/Win32/Console/API.src/M000066.html +27 -0
  108. data/vendor/Console/doc/classes/Win32/Console/API.src/M000067.html +29 -0
  109. data/vendor/Console/doc/classes/Win32/Console/API.src/M000068.html +27 -0
  110. data/vendor/Console/doc/classes/Win32/Console/API.src/M000069.html +27 -0
  111. data/vendor/Console/doc/classes/Win32/Console/API.src/M000070.html +28 -0
  112. data/vendor/Console/doc/classes/Win32/Console/API.src/M000071.html +27 -0
  113. data/vendor/Console/doc/classes/Win32/Console/API.src/M000072.html +26 -0
  114. data/vendor/Console/doc/classes/Win32/Console/API.src/M000073.html +27 -0
  115. data/vendor/Console/doc/classes/Win32/Console/API.src/M000074.html +31 -0
  116. data/vendor/Console/doc/classes/Win32/Console/API.src/M000075.html +27 -0
  117. data/vendor/Console/doc/classes/Win32/Console/API.src/M000076.html +32 -0
  118. data/vendor/Console/doc/classes/Win32/Console/API.src/M000077.html +27 -0
  119. data/vendor/Console/doc/classes/Win32/Console/API.src/M000078.html +32 -0
  120. data/vendor/Console/doc/classes/Win32/Console/API.src/M000079.html +32 -0
  121. data/vendor/Console/doc/classes/Win32/Console/API.src/M000080.html +32 -0
  122. data/vendor/Console/doc/classes/Win32/Console/Constants.html +360 -0
  123. data/vendor/Console/doc/created.rid +1 -0
  124. data/vendor/Console/doc/files/Console_ANSI_rdoc.html +407 -0
  125. data/vendor/Console/doc/files/Console_cpp.html +104 -0
  126. data/vendor/Console/doc/files/Console_rdoc.html +964 -0
  127. data/vendor/Console/doc/files/lib/Win32/Console/ANSI_rb.html +123 -0
  128. data/vendor/Console/doc/files/lib/Win32/Console_rb.html +297 -0
  129. data/vendor/Console/doc/fr_class_index.html +32 -0
  130. data/vendor/Console/doc/fr_file_index.html +31 -0
  131. data/vendor/Console/doc/fr_method_index.html +106 -0
  132. data/vendor/Console/doc/index.html +24 -0
  133. data/vendor/Console/doc/rdoc-style.css +172 -0
  134. data/vendor/Console/extconf.rb +18 -0
  135. data/vendor/Console/lib/Term/ansicolor.rb +76 -0
  136. data/vendor/Console/lib/Win32/Console.rb +970 -0
  137. data/vendor/Console/lib/Win32/Console/ANSI.rb +305 -0
  138. data/vendor/Console/test/test_cursor.rb +9 -0
  139. data/vendor/Console/test/test_mouse.rb +6 -0
  140. data/vendor/Console/test/test_readinput.rb +62 -0
  141. data/vendor/Console/test/test_readoutput.rb +52 -0
  142. data/vendor/Console/test/test_sendevent.rb +17 -0
  143. data/vendor/Console/test/test_title.rb +14 -0
  144. data/vendor/Console/test/test_write.rb +36 -0
  145. metadata +253 -0
@@ -0,0 +1,31 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/Console_cpp.html">Console.cpp</a><br />
24
+ <a href="files/Console_rdoc.html">Console.rdoc</a><br />
25
+ <a href="files/Console_ANSI_rdoc.html">Console_ANSI.rdoc</a><br />
26
+ <a href="files/lib\Win32/Console_rb.html">lib\Win32/Console.rb</a><br />
27
+ <a href="files/lib\Win32/Console/ANSI_rb.html">lib\Win32/Console/ANSI.rb</a><br />
28
+ </div>
29
+ </div>
30
+ </body>
31
+ </html>
@@ -0,0 +1,106 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/Win32/Console.html#M000030">Alloc (Win32::Console)</a><br />
24
+ <a href="classes/Win32/Console/API.html#M000040">AllocConsole (Win32::Console::API)</a><br />
25
+ <a href="classes/Win32/Console.html#M000023">Attr (Win32::Console)</a><br />
26
+ <a href="classes/Win32/Console.html#M000028">Cls (Win32::Console)</a><br />
27
+ <a href="classes/Win32/Console/API.html#M000041">CreateConsoleScreenBuffer (Win32::Console::API)</a><br />
28
+ <a href="classes/Win32/Console.html#M000009">Cursor (Win32::Console)</a><br />
29
+ <a href="classes/Win32/Console.html#M000002">Display (Win32::Console)</a><br />
30
+ <a href="classes/Win32/Console.html#M000026">FillAttr (Win32::Console)</a><br />
31
+ <a href="classes/Win32/Console.html#M000027">FillChar (Win32::Console)</a><br />
32
+ <a href="classes/Win32/Console/API.html#M000042">FillConsoleOutputAttribute (Win32::Console::API)</a><br />
33
+ <a href="classes/Win32/Console/API.html#M000043">FillConsoleOutputCharacter (Win32::Console::API)</a><br />
34
+ <a href="classes/Win32/Console.html#M000017">Flush (Win32::Console)</a><br />
35
+ <a href="classes/Win32/Console/API.html#M000044">FlushConsoleInputBuffer (Win32::Console::API)</a><br />
36
+ <a href="classes/Win32/Console.html#M000029">Free (Win32::Console)</a><br />
37
+ <a href="classes/Win32/Console/API.html#M000045">FreeConsole (Win32::Console::API)</a><br />
38
+ <a href="classes/Win32/Console/API.html#M000046">GenerateConsoleCtrlEvent (Win32::Console::API)</a><br />
39
+ <a href="classes/Win32/Console.html#M000034">GenerateCtrlEvent (Win32::Console)</a><br />
40
+ <a href="classes/Win32/Console/API.html#M000047">GetConsoleCP (Win32::Console::API)</a><br />
41
+ <a href="classes/Win32/Console/API.html#M000048">GetConsoleCursorInfo (Win32::Console::API)</a><br />
42
+ <a href="classes/Win32/Console/API.html#M000049">GetConsoleMode (Win32::Console::API)</a><br />
43
+ <a href="classes/Win32/Console/API.html#M000050">GetConsoleOutputCP (Win32::Console::API)</a><br />
44
+ <a href="classes/Win32/Console/API.html#M000051">GetConsoleScreenBufferInfo (Win32::Console::API)</a><br />
45
+ <a href="classes/Win32/Console/API.html#M000052">GetConsoleTitle (Win32::Console::API)</a><br />
46
+ <a href="classes/Win32/Console/API.html#M000053">GetConsoleWindow (Win32::Console::API)</a><br />
47
+ <a href="classes/Win32/Console.html#M000016">GetEvents (Win32::Console)</a><br />
48
+ <a href="classes/Win32/Console/API.html#M000054">GetLargestConsoleWindowSize (Win32::Console::API)</a><br />
49
+ <a href="classes/Win32/Console/API.html#M000055">GetNumberOfConsoleInputEvents (Win32::Console::API)</a><br />
50
+ <a href="classes/Win32/Console/API.html#M000056">GetNumberOfConsoleMouseButtons (Win32::Console::API)</a><br />
51
+ <a href="classes/Win32/Console/API.html#M000057">GetStdHandle (Win32::Console::API)</a><br />
52
+ <a href="classes/Win32/Console.html#M000015">Info (Win32::Console)</a><br />
53
+ <a href="classes/Win32/Console.html#M000019">Input (Win32::Console)</a><br />
54
+ <a href="classes/Win32/Console.html#M000032">InputCP (Win32::Console)</a><br />
55
+ <a href="classes/Win32/Console.html#M000018">InputChar (Win32::Console)</a><br />
56
+ <a href="classes/Win32/Console.html#M000014">MaxWindow (Win32::Console)</a><br />
57
+ <a href="classes/Win32/Console.html#M000021">Mode (Win32::Console)</a><br />
58
+ <a href="classes/Win32/Console.html#M000031">MouseButtons (Win32::Console)</a><br />
59
+ <a href="classes/Win32/Console.html#M000033">OutputCP (Win32::Console)</a><br />
60
+ <a href="classes/Win32/Console/API.html#M000058">PeekConsoleInput (Win32::Console::API)</a><br />
61
+ <a href="classes/Win32/Console.html#M000020">PeekInput (Win32::Console)</a><br />
62
+ <a href="classes/Win32/Console.html#M000008">ReadAttr (Win32::Console)</a><br />
63
+ <a href="classes/Win32/Console.html#M000006">ReadChar (Win32::Console)</a><br />
64
+ <a href="classes/Win32/Console/API.html#M000059">ReadConsole (Win32::Console::API)</a><br />
65
+ <a href="classes/Win32/Console/API.html#M000060">ReadConsoleInput (Win32::Console::API)</a><br />
66
+ <a href="classes/Win32/Console/API.html#M000061">ReadConsoleOutput (Win32::Console::API)</a><br />
67
+ <a href="classes/Win32/Console/API.html#M000062">ReadConsoleOutputAttribute (Win32::Console::API)</a><br />
68
+ <a href="classes/Win32/Console/API.html#M000063">ReadConsoleOutputCharacter (Win32::Console::API)</a><br />
69
+ <a href="classes/Win32/Console.html#M000011">ReadRect (Win32::Console)</a><br />
70
+ <a href="classes/Win32/Console.html#M000013">Scroll (Win32::Console)</a><br />
71
+ <a href="classes/Win32/Console/API.html#M000064">ScrollConsoleScreenBuffer (Win32::Console::API)</a><br />
72
+ <a href="classes/Win32/Console.html#M000003">Select (Win32::Console)</a><br />
73
+ <a href="classes/Win32/Console/API.html#M000065">SetConsoleActiveScreenBuffer (Win32::Console::API)</a><br />
74
+ <a href="classes/Win32/Console/API.html#M000066">SetConsoleCP (Win32::Console::API)</a><br />
75
+ <a href="classes/Win32/Console/API.html#M000067">SetConsoleCursorInfo (Win32::Console::API)</a><br />
76
+ <a href="classes/Win32/Console/API.html#M000068">SetConsoleCursorPosition (Win32::Console::API)</a><br />
77
+ <a href="classes/Win32/Console/API.html#M000069">SetConsoleMode (Win32::Console::API)</a><br />
78
+ <a href="classes/Win32/Console/API.html#M000070">SetConsoleOutputCP (Win32::Console::API)</a><br />
79
+ <a href="classes/Win32/Console/API.html#M000071">SetConsoleScreenBufferSize (Win32::Console::API)</a><br />
80
+ <a href="classes/Win32/Console/API.html#M000072">SetConsoleTextAttribute (Win32::Console::API)</a><br />
81
+ <a href="classes/Win32/Console/API.html#M000073">SetConsoleTitle (Win32::Console::API)</a><br />
82
+ <a href="classes/Win32/Console/API.html#M000074">SetConsoleWindowInfo (Win32::Console::API)</a><br />
83
+ <a href="classes/Win32/Console/API.html#M000075">SetStdHandle (Win32::Console::API)</a><br />
84
+ <a href="classes/Win32/Console.html#M000024">Size (Win32::Console)</a><br />
85
+ <a href="classes/Win32/Console.html#M000004">Title (Win32::Console)</a><br />
86
+ <a href="classes/Win32/Console.html#M000025">Window (Win32::Console)</a><br />
87
+ <a href="classes/Win32/Console.html#M000010">Write (Win32::Console)</a><br />
88
+ <a href="classes/Win32/Console.html#M000007">WriteAttr (Win32::Console)</a><br />
89
+ <a href="classes/Win32/Console.html#M000005">WriteChar (Win32::Console)</a><br />
90
+ <a href="classes/Win32/Console/API.html#M000076">WriteConsole (Win32::Console::API)</a><br />
91
+ <a href="classes/Win32/Console/API.html#M000077">WriteConsoleInput (Win32::Console::API)</a><br />
92
+ <a href="classes/Win32/Console/API.html#M000078">WriteConsoleOutput (Win32::Console::API)</a><br />
93
+ <a href="classes/Win32/Console/API.html#M000079">WriteConsoleOutputAttribute (Win32::Console::API)</a><br />
94
+ <a href="classes/Win32/Console/API.html#M000080">WriteConsoleOutputCharacter (Win32::Console::API)</a><br />
95
+ <a href="classes/Win32/Console.html#M000022">WriteInput (Win32::Console)</a><br />
96
+ <a href="classes/Win32/Console.html#M000012">WriteRect (Win32::Console)</a><br />
97
+ <a href="classes/Win32/Console/ANSI/IO.html#M000036">_PrintString (Win32::Console::ANSI::IO)</a><br />
98
+ <a href="classes/Win32/Console/ANSI/IO.html#M000037">_conv (Win32::Console::ANSI::IO)</a><br />
99
+ <a href="classes/Win32/Console/API.html#M000039">constant (Win32::Console::API)</a><br />
100
+ <a href="classes/Win32/Console/ANSI/IO.html#M000035">new (Win32::Console::ANSI::IO)</a><br />
101
+ <a href="classes/Win32/Console.html#M000001">new (Win32::Console)</a><br />
102
+ <a href="classes/Win32/Console/ANSI/IO.html#M000038">write (Win32::Console::ANSI::IO)</a><br />
103
+ </div>
104
+ </div>
105
+ </body>
106
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ RDoc Documentation
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>RDoc Documentation</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/Console_ANSI_rdoc.html" name="docwin" />
23
+ </frameset>
24
+ </html>
@@ -0,0 +1,172 @@
1
+
2
+ body {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
8
+ h1 { font-size: 120%; }
9
+ h2,h3,h4 { margin-top: 1em; }
10
+
11
+ a { background: #eef; color: #039; text-decoration: none; }
12
+ a:hover { background: #039; color: #eef; }
13
+
14
+ /* Override the base stylesheet's Anchor inside a table cell */
15
+ td > a {
16
+ background: transparent;
17
+ color: #039;
18
+ text-decoration: none;
19
+ }
20
+
21
+ /* === Structural elements =================================== */
22
+
23
+ div#index {
24
+ margin: 0;
25
+ padding: 0;
26
+ font-size: 0.9em;
27
+ }
28
+
29
+ div#index a {
30
+ margin-left: 0.7em;
31
+ }
32
+
33
+ div#classHeader {
34
+ width: auto;
35
+ background: #039;
36
+ color: white;
37
+ padding: 0.5em 1.5em 0.5em 1.5em;
38
+ margin: 0;
39
+ border-bottom: 3px solid #006;
40
+ }
41
+
42
+ div#classHeader a {
43
+ background: inherit;
44
+ color: white;
45
+ }
46
+
47
+ div#classHeader td {
48
+ background: inherit;
49
+ color: white;
50
+ }
51
+
52
+ div#fileHeader {
53
+ width: auto;
54
+ background: #039;
55
+ color: white;
56
+ padding: 0.5em 1.5em 0.5em 1.5em;
57
+ margin: 0;
58
+ border-bottom: 3px solid #006;
59
+ }
60
+
61
+ div#fileHeader a {
62
+ background: inherit;
63
+ color: white;
64
+ }
65
+
66
+ div#fileHeader td {
67
+ background: inherit;
68
+ color: white;
69
+ }
70
+
71
+ div#bodyContent {
72
+ padding: 0 1.5em 0 1.5em;
73
+ }
74
+
75
+ div#description {
76
+ padding: 0.5em 1.5em;
77
+ background: #efefef;
78
+ border: 1px dotted #999;
79
+ }
80
+
81
+ div#description h1,h2,h3,h4,h5,h6 {
82
+ color: black;
83
+ background: transparent;
84
+ }
85
+
86
+ div#validator-badges {
87
+ text-align: center;
88
+ }
89
+ div#validator-badges img { border: 0; }
90
+
91
+ div#copyright {
92
+ color: #333;
93
+ background: #efefef;
94
+ font: 0.75em sans-serif;
95
+ margin-top: 5em;
96
+ margin-bottom: 0;
97
+ padding: 0.5em 2em;
98
+ }
99
+
100
+
101
+ /* === Classes =================================== */
102
+
103
+ table.header-table {
104
+ color: white;
105
+ font-size: small;
106
+ }
107
+
108
+ .type-note {
109
+ font-size: small;
110
+ color: #DEDEDE;
111
+ }
112
+
113
+ .section-bar {
114
+ background: #eee;
115
+ color: #333;
116
+ padding: 3px;
117
+ border: 1px solid #999;
118
+ }
119
+
120
+ .top-aligned-row { vertical-align: vertical-align: top }
121
+
122
+ /* --- Context section classes ----------------------- */
123
+
124
+ .context-row { }
125
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
126
+ .context-item-value { font-size: x-small; color: #448; }
127
+ .context-item-desc { background: #efefef; }
128
+
129
+ /* --- Method classes -------------------------- */
130
+ .method-detail {
131
+ background: #EFEFEF;
132
+ padding: 0;
133
+ margin-top: 0.5em;
134
+ margin-bottom: 0.5em;
135
+ border: 1px dotted #DDD;
136
+ }
137
+ .method-heading {
138
+ color: black;
139
+ background: #AAA;
140
+ border-bottom: 1px solid #666;
141
+ padding: 0.2em 0.5em 0 0.5em;
142
+ }
143
+ .method-signature { color: black; background: inherit; }
144
+ .method-name { font-weight: bold; }
145
+ .method-args { font-style: italic; }
146
+ .method-description { padding: 0 0.5em 0 0.5em; }
147
+
148
+ /* --- Source code sections -------------------- */
149
+
150
+ a.source-toggle { font-size: 90%; }
151
+ div.method-source-code {
152
+ background: #262626;
153
+ color: #ffdead;
154
+ margin: 1em;
155
+ padding: 0.5em;
156
+ border: 1px dashed #999;
157
+ overflow: hidden;
158
+ }
159
+
160
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
161
+
162
+ /* --- Ruby keyword styles --------------------- */
163
+ /* (requires a hacked html_generator.rb to add more class-types) */
164
+ .ruby-constant { color: #7fffd4; background: transparent; }
165
+ .ruby-keyword { color: #00ffff; background: transparent; }
166
+ .ruby-ivar { color: #eedd82; background: transparent; }
167
+ .ruby-operator { color: #00ffee; background: transparent; }
168
+ .ruby-identifier { color: #ffdead; background: transparent; }
169
+ .ruby-node { color: #ffa07a; background: transparent; }
170
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
171
+ .ruby-regexp { color: #ffa07a; background: transparent; }
172
+ .ruby-value { color: #7fffd4; background: transparent; }
@@ -0,0 +1,18 @@
1
+ #################################################################
2
+ #
3
+ # To compile and install, do this:
4
+ #
5
+ # Make sure your compiling environment is in your path.
6
+ # In the case of MSVC, this involves running vcvars32.bat first
7
+ # which is located in the bin directory of MS Visual C++.
8
+ #
9
+ # Then:
10
+ #
11
+ # > ruby extconf.rb
12
+ # > nmake Makefile
13
+ # > nmake install
14
+ #
15
+ #
16
+ ##################################################################
17
+ require 'mkmf'
18
+ create_makefile('Console')
@@ -0,0 +1,76 @@
1
+ module Term
2
+
3
+ module ANSIColor
4
+
5
+ @@attributes = [
6
+ [ :clear , 0 ],
7
+ [ :reset , 0 ], # synonym for :clear
8
+ [ :bold , 1 ],
9
+ [ :dark , 2 ],
10
+ [ :italic , 3 ], # not widely implemented
11
+ [ :underline , 4 ],
12
+ [ :underscore , 4 ], # synonym for :underline
13
+ [ :blink , 5 ],
14
+ [ :rapid_blink , 6 ], # not widely implemented
15
+ [ :negative , 7 ], # no reverse because of String#reverse
16
+ [ :concealed , 8 ],
17
+ [ :strikethrough, 9 ], # not widely implemented
18
+ [ :black , 30 ],
19
+ [ :red , 31 ],
20
+ [ :green , 32 ],
21
+ [ :yellow , 33 ],
22
+ [ :blue , 34 ],
23
+ [ :magenta , 35 ],
24
+ [ :cyan , 36 ],
25
+ [ :white , 37 ],
26
+ [ :on_black , 40 ],
27
+ [ :on_red , 41 ],
28
+ [ :on_green , 42 ],
29
+ [ :on_yellow , 43 ],
30
+ [ :on_blue , 44 ],
31
+ [ :on_magenta , 45 ],
32
+ [ :on_cyan , 46 ],
33
+ [ :on_white , 47 ],
34
+ ]
35
+
36
+ @@attributes.each do |c, v|
37
+ eval %Q{
38
+ def #{c.to_s}(string = nil)
39
+ result = "\e[#{v}m"
40
+ if block_given?
41
+ result << yield
42
+ result << "\e[0m"
43
+ elsif string
44
+ result << string
45
+ result << "\e[0m"
46
+ elsif respond_to?(:to_str)
47
+ result << self
48
+ result << "\e[0m"
49
+ end
50
+ return result
51
+ end
52
+ }
53
+ end
54
+
55
+ ColoredRegexp = /\e\[([34][0-7]|[0-9])m/
56
+ def uncolored(string = nil)
57
+ if block_given?
58
+ yield.gsub(ColoredRegexp, '')
59
+ elsif string
60
+ string.gsub(ColoredRegexp, '')
61
+ elsif respond_to?(:to_str)
62
+ gsub(ColoredRegexp, '')
63
+ else
64
+ ''
65
+ end
66
+ end
67
+
68
+ def attributes
69
+ @@attributes.map { |c| c[0] }
70
+ end
71
+ module_function :attributes
72
+
73
+ end
74
+
75
+ end
76
+ # vim: set cin sw=4 ts=4:
@@ -0,0 +1,970 @@
1
+ # Win32::Console: an object implementing the Win32 API Console functions
2
+ # Copyright (C) 2003 Gonzalo Garramuno (ggarramuno@aol.com)
3
+ #
4
+ # Original Win32API_Console was:
5
+ # Copyright (C) 2001 Michael L. Semon (mlsemon@sega.net)
6
+
7
+ begin
8
+ # If Console.so is available, use that. Otherwise, we define
9
+ # equivalent functions in ruby (a tad slower)
10
+ # That dll should define everything in an identical interface
11
+ # to all the ruby code that the rescue below defines.
12
+ require "Console.so"
13
+ STDERR.print "Using faster, DLL Console.so\n" if $DEBUG
14
+
15
+ rescue Exception
16
+
17
+ STDERR.print "Using slower, non-DLL Console.rb\n" if $DEBUG
18
+
19
+ module Win32
20
+ class Console
21
+ end
22
+ end
23
+
24
+ # The WINDOWS constants
25
+ module Win32::Console::Constants
26
+ STD_INPUT_HANDLE = 0xFFFFFFF6
27
+ STD_OUTPUT_HANDLE = 0xFFFFFFF5
28
+ STD_ERROR_HANDLE = 0xFFFFFFF4
29
+ INVALID_HANDLE_VALUE = 0xFFFFFFFF
30
+ GENERIC_READ = 0x80000000
31
+ GENERIC_WRITE = 0x40000000
32
+ FILE_SHARE_READ = 0x00000001
33
+ FILE_SHARE_WRITE = 0x00000002
34
+ CONSOLE_TEXTMODE_BUFFER = 0x00000001
35
+
36
+ FOREGROUND_BLUE = 0x0001
37
+ FOREGROUND_GREEN = 0x0002
38
+ FOREGROUND_RED = 0x0004
39
+ FOREGROUND_INTENSITY = 0x0008
40
+ BACKGROUND_BLUE = 0x0010
41
+ BACKGROUND_GREEN = 0x0020
42
+ BACKGROUND_RED = 0x0040
43
+ BACKGROUND_INTENSITY = 0x0080
44
+
45
+ ENABLE_PROCESSED_INPUT = 0x0001
46
+ ENABLE_LINE_INPUT = 0x0002
47
+ ENABLE_ECHO_INPUT = 0x0004
48
+ ENABLE_WINDOW_INPUT = 0x0008
49
+ ENABLE_MOUSE_INPUT = 0x0010
50
+ ENABLE_PROCESSED_OUTPUT = 0x0001
51
+ ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002
52
+
53
+ KEY_EVENT = 0x0001
54
+ MOUSE_EVENT = 0x0002
55
+ WINDOW_BUFFER_SIZE_EVENT = 0x0004
56
+ MENU_EVENT = 0x0008
57
+ FOCUS_EVENT = 0x0010
58
+
59
+ CAPSLOCK_ON = 0x0080
60
+ ENHANCED_KEY = 0x0100
61
+ NUMLOCK_ON = 0x0020
62
+ SHIFT_PRESSED = 0x0010
63
+ LEFT_CTRL_PRESSED = 0x0008
64
+ RIGHT_CTRL_PRESSED = 0x0004
65
+ LEFT_ALT_PRESSED = 0x0002
66
+ RIGHT_ALT_PRESSED = 0x0001
67
+ SCROLLLOCK_ON = 0x0040
68
+
69
+ MOUSE_WHEELED = 0x0004
70
+ DOUBLE_CLICK = 0x0002
71
+ MOUSE_MOVED = 0x0001
72
+
73
+ FROM_LEFT_1ST_BUTTON_PRESSED = 0x0001
74
+ FROM_LEFT_2ND_BUTTON_PRESSED = 0x0004
75
+ FROM_LEFT_3RD_BUTTON_PRESSED = 0x0008
76
+ FROM_LEFT_4TH_BUTTON_PRESSED = 0x0010
77
+ RIGHTMOST_BUTTON_PRESSED = 0x0002
78
+
79
+ CTRL_C_EVENT = 0x0000
80
+ CTRL_BREAK_EVENT = 0x0001
81
+ CTRL_CLOSE_EVENT = 0x0002
82
+ CTRL_LOGOFF_EVENT = 0x0005
83
+ CTRL_SHUTDOWN_EVENT = 0x0006
84
+ end
85
+
86
+ # The actual api to access windows functions
87
+ class Win32::Console::API
88
+ require 'Win32API'
89
+
90
+ private
91
+ # This is a class-wide cache that will hold Win32API objects. As each
92
+ # Win32API object is about 920 bytes, I didn't want to initialize all of
93
+ # them at one time. That would waste about 42 kB for this object because
94
+ # it has 47 functions. However, to not have a cache at all would reduce
95
+ # the speed of this object by 164%.
96
+ @@m_AllocConsole = nil
97
+ @@m_CreateConsoleScreenBuffer = nil
98
+ @@m_FillConsoleOutputAttribute = nil
99
+ @@m_FillConsoleOutputCharacter = nil
100
+ @@m_FlushConsoleInputBuffer = nil
101
+ @@m_FreeConsole = nil
102
+ @@m_GenerateConsoleCtrlEvent = nil
103
+ @@m_GetConsoleCP = nil
104
+ @@m_GetConsoleCursorInfo = nil
105
+ @@m_GetConsoleMode = nil
106
+ @@m_GetConsoleOutputCP = nil
107
+ @@m_GetConsoleScreenBufferInfo = nil
108
+ @@m_GetConsoleTitle = nil
109
+ @@m_GetConsoleWindow = nil
110
+ @@m_GetLargestConsoleWindowSize = nil
111
+ @@m_GetNumberOfConsoleInputEvents = nil
112
+ @@m_GetNumberOfConsoleMouseButtons = nil
113
+ @@m_GetStdHandle = nil
114
+ @@m_PeekConsoleInput = nil
115
+ @@m_ReadConsole = nil
116
+ @@m_ReadConsoleInput = nil
117
+ @@m_ReadConsoleOutput = nil
118
+ @@m_ReadConsoleOutputAttribute = nil
119
+ @@m_ReadConsoleOutputCharacter = nil
120
+ @@m_ScrollConsoleScreenBuffer = nil
121
+ @@m_SetConsoleActiveScreenBuffer = nil
122
+ @@m_SetConsoleCP = nil
123
+ @@m_SetConsoleCursorInfo = nil
124
+ @@m_SetConsoleCursorPosition = nil
125
+ @@m_SetConsoleMode = nil
126
+ @@m_SetConsoleOutputCP = nil
127
+ @@m_SetConsoleScreenBufferSize = nil
128
+ @@m_SetConsoleTextAttribute = nil
129
+ @@m_SetConsoleTitle = nil
130
+ @@m_SetConsoleWindowInfo = nil
131
+ @@m_SetStdHandle = nil
132
+ @@m_WriteConsole = nil
133
+ @@m_WriteConsoleInput = nil
134
+ @@m_WriteConsoleOutput = nil
135
+ @@m_WriteConsoleOutputAttribute = nil
136
+ @@m_WriteConsoleOutputCharacter = nil
137
+
138
+ public
139
+
140
+ class << self
141
+
142
+
143
+ def constant(t)
144
+ begin
145
+ eval "return Win32::Console::Constants::#{t}"
146
+ rescue
147
+ return nil
148
+ end
149
+ end
150
+
151
+
152
+ def AllocConsole()
153
+ if @@m_AllocConsole == nil
154
+ @@m_AllocConsole = Win32API.new( "kernel32", "AllocConsole",
155
+ [], 'l' )
156
+ end
157
+ @@m_AllocConsole.call()
158
+ end
159
+
160
+ def CreateConsoleScreenBuffer( dwDesiredAccess, dwShareMode, dwFlags )
161
+ if @@m_CreateConsoleScreenBuffer == nil
162
+ @@m_CreateConsoleScreenBuffer = Win32API.new( "kernel32", "CreateConsoleScreenBuffer", ['l', 'l', 'p', 'l', 'p'], 'l' )
163
+ end
164
+ @@m_CreateConsoleScreenBuffer.call( dwDesiredAccess, dwShareMode,
165
+ nil, dwFlags, nil )
166
+ end
167
+
168
+
169
+
170
+ def FillConsoleOutputAttribute( hConsoleOutput, wAttribute, nLength,
171
+ col, row )
172
+ if @@m_FillConsoleOutputAttribute == nil
173
+ @@m_FillConsoleOutputAttribute = Win32API.new( "kernel32", "FillConsoleOutputAttribute", ['l', 'i', 'l', 'l', 'p'], 'l' )
174
+ end
175
+ dwWriteCoord = (row << 16) + col
176
+ lpNumberOfAttrsWritten = ' ' * 4
177
+ @@m_FillConsoleOutputAttribute.call( hConsoleOutput, wAttribute,
178
+ nLength, dwWriteCoord,
179
+ lpNumberOfAttrsWritten )
180
+ return lpNumberOfAttrsWritten.unpack('L')
181
+ end
182
+
183
+
184
+
185
+ def FillConsoleOutputCharacter( hConsoleOutput, cCharacter, nLength,
186
+ col, row )
187
+ if @@m_FillConsoleOutputCharacter == nil
188
+ @@m_FillConsoleOutputCharacter = Win32API.new( "kernel32", "FillConsoleOutputCharacter", ['l', 'i', 'l', 'l', 'p'], 'l' )
189
+ end
190
+ dwWriteCoord = (row << 16) + col
191
+ lpNumberOfAttrsWritten = ' ' * 4
192
+ @@m_FillConsoleOutputCharacter.call( hConsoleOutput, cCharacter,
193
+ nLength, dwWriteCoord,
194
+ lpNumberOfAttrsWritten )
195
+ return lpNumberOfAttrsWritten.unpack('L')
196
+ end
197
+
198
+
199
+ def FlushConsoleInputBuffer( hConsoleInput )
200
+ if @@m_FlushConsoleInputBuffer == nil
201
+ @@m_FlushConsoleInputBuffer = Win32API.new( "kernel32",
202
+ "FillConsoleInputBuffer",
203
+ ['l'], 'l' )
204
+ end
205
+ @@m_FlushConsoleInputBuffer.call( hConsoleInput )
206
+ end
207
+
208
+
209
+ def FreeConsole()
210
+ if @@m_FreeConsole == nil
211
+ @@m_FreeConsole = Win32API.new( "kernel32", "FreeConsole", [], 'l' )
212
+ end
213
+ @@m_FreeConsole.call()
214
+ end
215
+
216
+
217
+ def GenerateConsoleCtrlEvent( dwCtrlEvent, dwProcessGroupId )
218
+ if @@m_GenerateConsoleCtrlEvent == nil
219
+ @@m_GenerateConsoleCtrlEvent = Win32API.new( "kernel32", "GenerateConsoleCtrlEvent", ['l', 'l'], 'l' )
220
+ end
221
+ @@m_GenerateConsoleCtrlEvent.call( dwCtrlEvent, dwProcessGroupId )
222
+ end
223
+
224
+ def GetConsoleCP()
225
+ if @@m_GetConsoleCP == nil
226
+ @@m_GetConsoleCP = Win32API.new( "kernel32", "GetConsoleCP",
227
+ [], 'l' )
228
+ end
229
+ @@m_GetConsoleCP.call()
230
+ end
231
+
232
+ def GetConsoleCursorInfo( hConsoleOutput )
233
+ if @@m_GetConsoleCursorInfo == nil
234
+ @@m_GetConsoleCursorInfo = Win32API.new( "kernel32",
235
+ "GetConsoleCursorInfo",
236
+ ['l', 'p'], 'l' )
237
+ end
238
+ lpConsoleCursorInfo = ' ' * 8
239
+ @@m_GetConsoleCursorInfo.call( hConsoleOutput, lpConsoleCursorInfo )
240
+ return lpConsoleCursorInfo.unpack('LL')
241
+ end
242
+
243
+ def GetConsoleMode( hConsoleHandle )
244
+ if @@m_GetConsoleMode == nil
245
+ @@m_GetConsoleMode = Win32API.new( "kernel32", "GetConsoleMode",
246
+ ['l', 'p'], 'l' )
247
+ end
248
+ lpMode = ' ' * 4
249
+ @@m_GetConsoleMode.call( hConsoleHandle, lpMode )
250
+ return lpMode.unpack('L')
251
+ end
252
+
253
+ def GetConsoleOutputCP()
254
+ if @@m_GetConsoleOutputCP == nil
255
+ @@m_GetConsoleOutputCP = Win32API.new( "kernel32",
256
+ "GetConsoleOutputCP", [], 'l' )
257
+ end
258
+ @@m_GetConsoleOutputCP.call()
259
+ end
260
+
261
+ def GetConsoleScreenBufferInfo( hConsoleOutput )
262
+ if @@m_GetConsoleScreenBufferInfo == nil
263
+ @@m_GetConsoleScreenBufferInfo = Win32API.new( "kernel32", "GetConsoleScreenBufferInfo", ['l', 'p'], 'l' )
264
+ end
265
+ lpBuffer = ' ' * 22
266
+ @@m_GetConsoleScreenBufferInfo.call( hConsoleOutput, lpBuffer )
267
+ return lpBuffer.unpack('SSSSSssssSS')
268
+ end
269
+
270
+ def GetConsoleTitle()
271
+ if @@m_GetConsoleTitle == nil
272
+ @@m_GetConsoleTitle = Win32API.new( "kernel32", "GetConsoleTitle",
273
+ ['p', 'l'], 'l' )
274
+ end
275
+ nSize = 120
276
+ lpConsoleTitle = ' ' * nSize
277
+ @@m_GetConsoleTitle.call( lpConsoleTitle, nSize )
278
+ return lpConsoleTitle.strip
279
+ end
280
+
281
+ def GetConsoleWindow()
282
+ if @@m_GetConsoleWindow == nil
283
+ @@m_GetConsoleWindow = Win32API.new( "kernel32", "GetConsoleWindow",
284
+ [], 'l' )
285
+ end
286
+ @@m_GetConsoleWindow.call()
287
+ end
288
+
289
+ def GetLargestConsoleWindowSize( hConsoleOutput )
290
+ if @@m_GetLargestConsoleWindowSize == nil
291
+ @@m_GetLargestConsoleWindowSize = Win32API.new( "kernel32", "GetLargestConsoleWindowSize", ['l'], 'l' )
292
+ end
293
+ coord = @@m_GetLargestConsoleWindowSize.call( hConsoleOutput )
294
+ x = coord >> 16
295
+ y = coord & 0x0000ffff
296
+ return [x,y]
297
+ end
298
+
299
+ def GetNumberOfConsoleInputEvents( hConsoleInput )
300
+ if @@m_GetNumberOfConsoleInputEvents == nil
301
+ @@m_GetNumberOfConsoleInputEvents = Win32API.new( "kernel32", "GetNumberOfConsoleInputEvents", ['l', 'p'], 'l' )
302
+ end
303
+ lpcNumberOfEvents = 0
304
+ @@m_GetNumberOfConsoleInputEvents.call( hConsoleInput,
305
+ lpcNumberOfEvents )
306
+ return lpcNumberOfEvents
307
+ end
308
+
309
+ def GetNumberOfConsoleMouseButtons( )
310
+ if @@m_GetNumberOfConsoleMouseButtons == nil
311
+ @@m_GetNumberOfConsoleMouseButtons = Win32API.new( "kernel32", "GetNumberOfConsoleMouseButtons", ['p'], 'l' )
312
+ end
313
+ lpNumberOfMouseButtons = 0
314
+ @@m_GetNumberOfConsoleMouseButtons.call( lpNumberOfMouseButtons )
315
+ return lpNumberOfMouseButtons
316
+ end
317
+
318
+ def GetStdHandle( nStdHandle )
319
+ if @@m_GetStdHandle == nil
320
+ @@m_GetStdHandle = Win32API.new( "kernel32", "GetStdHandle",
321
+ ['l'], 'l' )
322
+ end
323
+ @@m_GetStdHandle.call( nStdHandle )
324
+ end
325
+
326
+ # <<HandlerRoutine>> : This is not an actual API function, just a concept description in the SDK.
327
+
328
+ def PeekConsoleInput( hConsoleInput )
329
+ if @@m_PeekConsoleInput == nil
330
+ @@m_PeekConsoleInput = Win32API.new( "kernel32", "PeekConsoleInput",
331
+ ['l', 'p', 'l', 'p'], 'l' )
332
+ end
333
+ lpNumberOfEventsRead = ' ' * 4
334
+ lpBuffer = ' ' * 20
335
+ nLength = 20
336
+ @@m_PeekConsoleInput.call( hConsoleInput, lpBuffer, nLength,
337
+ lpNumberOfEventsRead )
338
+ type = lpBuffer.unpack('s')[0]
339
+
340
+ case type
341
+ when KEY_EVENT
342
+ return lpBuffer.unpack('sSSSSCS')
343
+ when MOUSE_EVENT
344
+ return lpBuffer.unpack('sSSSS')
345
+ when WINDOW_BUFFER_SIZE_EVENT
346
+ return lpBuffer.unpack('sS')
347
+ when MENU_EVENT
348
+ return lpBuffer.unpack('sS')
349
+ when FOCUS_EVENT
350
+ return lpBuffer.unpack('sS')
351
+ else
352
+ return []
353
+ end
354
+ end
355
+
356
+ def ReadConsole( hConsoleInput, lpBuffer, nNumberOfCharsToRead )
357
+ if @@m_ReadConsole == nil
358
+ @@m_ReadConsole = Win32API.new( "kernel32", "ReadConsole",
359
+ ['l', 'p', 'l', 'p', 'p'], 'l' )
360
+ end
361
+ lpBuffer = ' ' * nNumberOfCharsToRead unless lpBuffer
362
+ lpNumberOfCharsRead = ' ' * 4
363
+ lpReserved = ' ' * 4
364
+ @@m_ReadConsole.call( hConsoleInput, lpBuffer, nNumberOfCharsToRead,
365
+ lpNumberOfCharsRead, lpReserved )
366
+ return lpNumberOfCharsRead.unpack('L')
367
+ end
368
+
369
+ def ReadConsoleInput( hConsoleInput )
370
+ if @@m_ReadConsoleInput == nil
371
+ @@m_ReadConsoleInput = Win32API.new( "kernel32", "ReadConsoleInput",
372
+ ['l', 'p', 'l', 'p'], 'l' )
373
+ end
374
+ lpNumberOfEventsRead = ' ' * 4
375
+ lpBuffer = ' ' * 20
376
+ nLength = 20
377
+ @@m_ReadConsoleInput.call( hConsoleInput, lpBuffer, nLength,
378
+ lpNumberOfEventsRead )
379
+ type = lpBuffer.unpack('s')[0]
380
+
381
+ case type
382
+ when KEY_EVENT
383
+ return lpBuffer.unpack('sSSSSCS')
384
+ when MOUSE_EVENT
385
+ return lpBuffer.unpack('sSSSS')
386
+ when WINDOW_BUFFER_SIZE_EVENT
387
+ return lpBuffer.unpack('sS')
388
+ when MENU_EVENT
389
+ return lpBuffer.unpack('sS')
390
+ when FOCUS_EVENT
391
+ return lpBuffer.unpack('sS')
392
+ else
393
+ return []
394
+ end
395
+ end
396
+
397
+ def ReadConsoleOutput( hConsoleOutput, lpBuffer, cols, rows,
398
+ bufx, bufy, left, top, right, bottom )
399
+ if @@m_ReadConsoleOutput == nil
400
+ @@m_ReadConsoleOutput = Win32API.new( "kernel32",
401
+ "ReadConsoleOutput",
402
+ ['l', 'p', 'l', 'l', 'p'], 'l' )
403
+ end
404
+ dwBufferSize = cols * rows * 4
405
+ lpBuffer = ' ' * dwBufferSize
406
+ dwBufferCoord = (bufy << 16) + bufx
407
+ lpReadRegion = [ left, top, right, bottom ].pack('ssss')
408
+ @@m_ReadConsoleOutput.call( hConsoleOutput, lpBuffer, dwBufferSize,
409
+ dwBufferCoord, lpReadRegion )
410
+ end
411
+
412
+ def ReadConsoleOutputAttribute( hConsoleOutput, nLength, col, row )
413
+ if @@m_ReadConsoleOutputAttribute == nil
414
+ @@m_ReadConsoleOutputAttribute = Win32API.new( "kernel32", "ReadConsoleOutputAttribute", ['l', 'p', 'l', 'l', 'p'], 'l' )
415
+ end
416
+ lpAttribute = ' ' * nLength
417
+ dwReadCoord = (row << 16) + col
418
+ lpNumberOfAttrsRead = ' ' * 4
419
+ @@m_ReadConsoleOutputAttribute.call( hConsoleOutput, lpAttribute,
420
+ nLength, dwReadCoord,
421
+ lpNumberOfAttrsRead )
422
+ return lpAttribute
423
+ end
424
+
425
+ def ReadConsoleOutputCharacter( hConsoleOutput, lpCharacter, nLength,
426
+ col, row )
427
+ if @@m_ReadConsoleOutputCharacter == nil
428
+ @@m_ReadConsoleOutputCharacter = Win32API.new( "kernel32", "ReadConsoleOutputCharacter", ['l', 'p', 'l', 'l', 'p'], 'l' )
429
+ end
430
+ dwReadCoord = (row << 16) + col
431
+ lpNumberOfCharsRead = ' ' * 4
432
+ @@m_ReadConsoleOutputCharacter.call( hConsoleOutput, lpCharacter,
433
+ nLength, dwReadCoord,
434
+ lpNumberOfCharsRead )
435
+ return lpNumberOfCharsRead.unpack('L')
436
+ end
437
+
438
+ def ScrollConsoleScreenBuffer( hConsoleOutput,
439
+ left1, top1, right1, bottom1,
440
+ col, row, char, attr,
441
+ left2, top2, right2, bottom2 )
442
+ if @@m_ScrollConsoleScreenBuffer == nil
443
+ @@m_ScrollConsoleScreenBuffer = Win32API.new( "kernel32", "ScrollConsoleScreenBuffer", ['l', 'p', 'p', 'l', 'p'], 'l' )
444
+ end
445
+ lpScrollRectangle = [left1, top1, right1, bottom1].pack('ssss')
446
+ lpClipRectangle = [left2, top2, right2, bottom2].pack('ssss')
447
+ dwDestinationOrigin = (row << 16) + col
448
+ lpFill = [char, attr].pack('ss')
449
+ @@m_ScrollConsoleScreenBuffer.call( hConsoleOutput, lpScrollRectangle,
450
+ lpClipRectangle,
451
+ dwDestinationOrigin, lpFill )
452
+ end
453
+
454
+ def SetConsoleActiveScreenBuffer( hConsoleOutput )
455
+ if @@m_SetConsoleActiveScreenBuffer == nil
456
+ @@m_SetConsoleActiveScreenBuffer = Win32API.new( "kernel32", "SetConsoleActiveScreenBuffer", ['l'], 'l' )
457
+ end
458
+ @@m_SetConsoleActiveScreenBuffer.call( hConsoleOutput )
459
+ end
460
+
461
+ # <<SetConsoleCtrlHandler>>: Will probably not be implemented.
462
+
463
+ def SetConsoleCP( wCodePageID )
464
+ if @@m_SetConsoleCP == nil
465
+ @@m_SetConsoleCP = Win32API.new( "kernel32", "SetConsoleCP",
466
+ ['l'], 'l' )
467
+ end
468
+ @@m_SetConsoleCP.call( wCodePageID )
469
+ end
470
+
471
+ def SetConsoleCursorInfo( hConsoleOutput, col, row )
472
+ if @@m_SetConsoleCursorInfo == nil
473
+ @@m_SetConsoleCursorInfo = Win32API.new( "kernel32",
474
+ "SetConsoleCursorInfo",
475
+ ['l', 'p'], 'l' )
476
+ end
477
+ lpConsoleCursorInfo = [size,visi].pack('LL')
478
+ @@m_SetConsoleCursorInfo.call( hConsoleOutput, lpConsoleCursorInfo )
479
+ end
480
+
481
+ def SetConsoleCursorPosition( hConsoleOutput, col, row )
482
+ if @@m_SetConsoleCursorPosition == nil
483
+ @@m_SetConsoleCursorPosition = Win32API.new( "kernel32", "SetConsoleCursorPosition", ['l', 'p'], 'l' )
484
+ end
485
+ dwCursorPosition = (row << 16) + col
486
+ @@m_SetConsoleCursorPosition.call( hConsoleOutput, dwCursorPosition )
487
+ end
488
+
489
+ def SetConsoleMode( hConsoleHandle, lpMode )
490
+ if @@m_SetConsoleMode == nil
491
+ @@m_SetConsoleMode = Win32API.new( "kernel32", "SetConsoleMode",
492
+ ['l', 'p'], 'l' )
493
+ end
494
+ @@m_SetConsoleMode.call( hConsoleHandle, lpMode )
495
+ end
496
+
497
+ def SetConsoleOutputCP( wCodePageID )
498
+ if @@m_SetConsoleOutputCP == nil
499
+ @@m_SetConsoleOutputCP = Win32API.new( "kernel32",
500
+ "GetConsoleOutputCP",
501
+ ['l'], 'l' )
502
+ end
503
+ @@m_SetConsoleOutputCP.call( wCodePageID )
504
+ end
505
+
506
+ def SetConsoleScreenBufferSize( hConsoleOutput, col, row )
507
+ if @@m_SetConsoleScreenBufferSize == nil
508
+ @@m_SetConsoleScreenBufferSize = Win32API.new( "kernel32", "SetConsoleScreenBufferSize", ['l', 'l'], 'l' )
509
+ end
510
+ dwSize = (row << 16) + col
511
+ @@m_SetConsoleScreenBufferSize.call( hConsoleOutput, dwSize )
512
+ end
513
+
514
+ def SetConsoleTextAttribute( hConsoleOutput, wAttributes )
515
+ if @@m_SetConsoleTextAttribute == nil
516
+ @@m_SetConsoleTextAttribute = Win32API.new( "kernel32", "SetConsoleTextAttribute", ['l', 'i'], 'l' )
517
+ end
518
+ @@m_SetConsoleTextAttribute.call( hConsoleOutput, wAttributes )
519
+ end
520
+
521
+ def SetConsoleTitle( lpConsoleTitle )
522
+ if @@m_SetConsoleTitle == nil
523
+ @@m_SetConsoleTitle = Win32API.new( "kernel32", "SetConsoleTitle",
524
+ ['p'], 'l' )
525
+ end
526
+ @@m_SetConsoleTitle.call( lpConsoleTitle )
527
+ end
528
+
529
+ def SetConsoleWindowInfo( hConsoleOutput, bAbsolute,
530
+ left, top, right, bottom )
531
+ if @@m_SetConsoleWindowInfo == nil
532
+ @@m_SetConsoleWindowInfo = Win32API.new( "kernel32",
533
+ "SetConsoleWindowInfo",
534
+ ['l', 'l', 'p'], 'l' )
535
+ end
536
+ lpConsoleWindow = [ left, top, right, bottom ].pack('ssss')
537
+ @@m_SetConsoleWindowInfo.call( hConsoleOutput, bAbsolute,
538
+ lpConsoleWindow )
539
+ end
540
+
541
+ def SetStdHandle( nStdHandle, hHandle )
542
+ if @@m_SetStdHandle == nil
543
+ @@m_SetStdHandle = Win32API.new( "kernel32", "SetStdHandle",
544
+ ['l', 'l'], 'l' )
545
+ end
546
+ @@m_SetStdHandle.call( nStdHandle, hHandle )
547
+ end
548
+
549
+ def WriteConsole( hConsoleOutput, lpBuffer )
550
+ if @@m_WriteConsole == nil
551
+ @@m_WriteConsole = Win32API.new( "kernel32", "WriteConsole",
552
+ ['l', 'p', 'l', 'p', 'p'], 'l' )
553
+ end
554
+ nNumberOfCharsToWrite = lpBuffer.length()
555
+ lpNumberOfCharsWritten = ' ' * 4
556
+ lpReserved = ' ' * 4
557
+ @@m_WriteConsole.call( hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
558
+ lpNumberOfCharsWritten, lpReserved )
559
+ return lpNumberOfCharsWritten
560
+ end
561
+
562
+ def WriteConsoleInput( hConsoleInput, lpBuffer )
563
+ if @@m_WriteConsoleInput == nil
564
+ @@m_WriteConsoleInput = Win32API.new( "kernel32", "WriteConsoleInput", ['l', 'p', 'l', 'p'], 'l' )
565
+ end
566
+ @@m_WriteConsoleInput.call( hConsoleInput, lpBuffer, nLength,
567
+ lpNumberOfEventsWritten )
568
+ end
569
+
570
+ # @@ Todo: Test this
571
+ def WriteConsoleOutput( hConsoleOutput, buffer, cols, rows,
572
+ bufx, bufy, left, top, right, bottom )
573
+ if @@m_WriteConsoleOutput == nil
574
+ @@m_WriteConsoleOutput = Win32API.new( "kernel32", "WriteConsoleOutput", ['l', 'p', 'l', 'l', 'p'], 'l' )
575
+ end
576
+ lpBuffer = buffer.flatten.pack('ss' * buffer.length() * 2)
577
+ dwBufferSize = (buffer.length() << 16) + 2
578
+ dwBufferCoord = (row << 16) + col
579
+ lpWriteRegion = [ left, top, right, bottom ].pack('ssss')
580
+ @@m_WriteConsoleOutput.call( hConsoleOutput, lpBuffer, dwBufferSize,
581
+ dwBufferCoord, lpWriteRegion )
582
+ end
583
+
584
+ def WriteConsoleOutputAttribute( hConsoleOutput, lpAttribute, col, row )
585
+ if @@m_WriteConsoleOutputAttribute == nil
586
+ @@m_WriteConsoleOutputAttribute = Win32API.new( "kernel32", "WriteConsoleOutputAttribute", ['l', 'p', 'l', 'l', 'p'], 'l' )
587
+ end
588
+ nLength = lpAttribute.length()
589
+ dwWriteCoord = (row << 16) + col
590
+ lpNumberOfAttrsWritten = ' ' * 4
591
+ @@m_WriteConsoleOutputAttribute.call( hConsoleOutput, lpAttribute,
592
+ nLength, dwWriteCoord,
593
+ lpNumberOfAttrsWritten )
594
+ return lpNumberOfAttrsWritten.unpack('L')
595
+ end
596
+
597
+ def WriteConsoleOutputCharacter( hConsoleOutput, lpCharacter, col, row )
598
+ if @@m_WriteConsoleOutputCharacter == nil
599
+ @@m_WriteConsoleOutputCharacter = Win32API.new( "kernel32", "WriteConsoleOutputCharacter", ['l', 'p', 'l', 'l', 'p'], 'l' )
600
+ end
601
+ nLength = lpCharacter.length()
602
+ dwWriteCoord = (row << 16) + col
603
+ lpNumberOfCharsWritten = ' ' * 4
604
+ @@m_WriteConsoleOutputCharacter.call( hConsoleOutput, lpCharacter,
605
+ nLength, dwWriteCoord,
606
+ lpNumberOfCharsWritten )
607
+ return lpNumberOfCharsWritten.unpack('L')
608
+ end
609
+
610
+ end
611
+ end
612
+
613
+ end # rescue
614
+
615
+
616
+
617
+ module Win32
618
+ class Console
619
+
620
+ VERSION = '1.0'
621
+
622
+ include Win32::Console::Constants
623
+
624
+ def initialize( t = nil )
625
+ if t and ( t == STD_INPUT_HANDLE or t == STD_OUTPUT_HANDLE or
626
+ t == STD_ERROR_HANDLE )
627
+ @handle = API.GetStdHandle( t )
628
+ else
629
+ param1 = GENERIC_READ | GENERIC_WRITE
630
+ param2 = FILE_SHARE_READ | FILE_SHARE_WRITE
631
+ @handle = API.CreateConsoleScreenBuffer( param1, param2,
632
+ CONSOLE_TEXTMODE_BUFFER )
633
+ end
634
+ end
635
+
636
+
637
+ def Display
638
+ return API.SetConsoleActiveScreenBuffer(@handle)
639
+ end
640
+
641
+ def Select(type)
642
+ return API.SetStdHandle(type,@handle)
643
+ end
644
+
645
+ def Title(title = nil)
646
+ if title
647
+ return API.SetConsoleTitle(title)
648
+ else
649
+ return API.GetConsoleTitle()
650
+ end
651
+ end
652
+
653
+ def WriteChar(s, col, row)
654
+ API.WriteConsoleOutputCharacter( @handle, s, col, row )
655
+ end
656
+
657
+ def ReadChar(size, col, row)
658
+ buffer = ' ' * size
659
+ if API.ReadConsoleOutputCharacter( @handle, buffer, size, col, row )
660
+ return buffer
661
+ else
662
+ return nil
663
+ end
664
+ end
665
+
666
+ def WriteAttr(attr, col, row)
667
+ API.WriteConsoleOutputAttribute( @handle, attr, col, row )
668
+ end
669
+
670
+ def ReadAttr(size, col, row)
671
+ x = API.ReadConsoleOutputAttribute( @handle, size, col, row )
672
+ return x.unpack('c'*size)
673
+ end
674
+
675
+
676
+ def Cursor(*t)
677
+ col, row, size, visi = t
678
+ if col
679
+ row = -1 if !row
680
+ if col < 0 or row < 0
681
+ curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
682
+ col = curr_col if col < 0
683
+ row = curr_row if row < 0
684
+ end
685
+ API.SetConsoleCursorPosition( @handle, col, row )
686
+ if size and visi
687
+ curr_size, curr_visi = API.GetConsoleCursorInfo( @handle )
688
+ size = curr_size if size < 0
689
+ visi = curr_visi if visi < 0
690
+ size = 1 if size < 1
691
+ size = 99 if size > 99
692
+ API.SetConsoleCursorInfo( @handle, size, visi )
693
+ end
694
+ else
695
+ d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
696
+ curr_size, curr_visi = API.GetConsoleCursorInfo( @handle )
697
+ return [ curr_col, curr_row, curr_size, curr_visi ]
698
+ end
699
+ end
700
+
701
+ def Write(s)
702
+ API.WriteConsole( @handle, s )
703
+ end
704
+
705
+ def ReadRect( left, top, right, bottom )
706
+ col = right - left + 1
707
+ row = bottom - top + 1
708
+ size = col * row
709
+ buffer = ' ' * size * 4
710
+ if API.ReadConsoleOutput( @handle, buffer, col, row, 0, 0,
711
+ left, top, right, bottom )
712
+ #return buffer.unpack('US'*size) # for unicode
713
+ return buffer.unpack('axS'*size) # for ascii
714
+ else
715
+ return nil
716
+ end
717
+ end
718
+
719
+ def WriteRect( buffer, left, top, right, bottom )
720
+ col = right - left + 1
721
+ row = bottom - top + 1
722
+ API.WriteConsoleOutput( @handle, buffer, col, row, 0, 0,
723
+ left, top, right, bottom )
724
+ end
725
+
726
+
727
+
728
+ def Scroll( left1, top1, right1, bottom1,
729
+ col, row, char, attr,
730
+ left2, top2, right2, bottom2 )
731
+ API.ScrollConsoleScreenBuffer(@handle, left1, top1, right1, bottom1,
732
+ col, row, char, attr,
733
+ left2, top2, right2, bottom2)
734
+ end
735
+
736
+
737
+ def MaxWindow(flag = nil)
738
+ if !flag
739
+ info = API.GetConsoleScreenBufferInfo(@handle)
740
+ return info[9], info[10]
741
+ else
742
+ return API.GetLargestConsoleWindowSize(@handle)
743
+ end
744
+ end
745
+
746
+
747
+ def Info()
748
+ return API.GetConsoleScreenBufferInfo( @handle )
749
+ end
750
+
751
+
752
+ def GetEvents()
753
+ return API.GetNumberOfConsoleInputEvents(@handle)
754
+ end
755
+
756
+
757
+ def Flush()
758
+ return API.FlushConsoleInputBuffer(@handle)
759
+ end
760
+
761
+ def InputChar(number = nil)
762
+ number = 1 unless number
763
+ buffer = ' ' * number
764
+ if API.ReadConsole(@handle, buffer, number) == number
765
+ return buffer
766
+ else
767
+ return nil
768
+ end
769
+ end
770
+
771
+
772
+ def Input()
773
+ API.ReadConsoleInput(@handle)
774
+ end
775
+
776
+
777
+ def PeekInput()
778
+ API.PeekConsoleInput(@handle)
779
+ end
780
+
781
+
782
+ def Mode(mode = nil)
783
+ if mode
784
+ mode = mode.pack('L') if mode === Array
785
+ API.SetConsoleMode(@handle, mode)
786
+ else
787
+ return API.GetConsoleMode(@handle)
788
+ end
789
+ end
790
+
791
+ def WriteInput(*t)
792
+ API.WriteConsoleInput(@handle, *t)
793
+ end
794
+
795
+ def Attr(*attr)
796
+ if attr.size > 0
797
+ API.SetConsoleTextAttribute( @handle, attr[0] )
798
+ else
799
+ info = API.GetConsoleScreenBufferInfo( @handle )
800
+ return info[4]
801
+ end
802
+ end
803
+
804
+
805
+ def Size(*t)
806
+ if t.size == 0
807
+ col, row = API.GetConsoleScreenBufferInfo(@handle )
808
+ return [col, row]
809
+ else
810
+ row = -1 if !t[1]
811
+ col = -1 if !t[0]
812
+ if col < 0 or row < 0
813
+ curr_col, curr_row = Size()
814
+ col = curr_col if col < 0
815
+ row = curr_row if row < 0
816
+ end
817
+ API.SetConsoleScreenBufferSize(@handle, row, col)
818
+ end
819
+ end
820
+
821
+ def Window(*t)
822
+ if t.size != 5
823
+ info = API.GetConsoleScreenBufferInfo( @handle )
824
+ return info[5..8]
825
+ else
826
+ API.SetConsoleWindowInfo(@handle, t[0], t[1], t[2], t[3], t[4])
827
+ end
828
+ end
829
+
830
+ def FillAttr(attr, number = 1, col = -1, row = -1)
831
+ if col < 0 or row < 0
832
+ d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
833
+ col = curr_col if col < 0
834
+ row = curr_row if row < 0
835
+ end
836
+ API.FillConsoleOutputAttribute(@handle, attr, number, col, row)
837
+ end
838
+
839
+ def FillChar(char, number, col = -1, row = -1)
840
+ if col < 0 or row < 0
841
+ d, d, curr_col, curr_row = API.GetConsoleScreenBufferInfo(@handle)
842
+ col = curr_col if col < 0
843
+ row = curr_row if row < 0
844
+ end
845
+ API.FillConsoleOutputCharacter(@handle, char[0], number, col, row)
846
+ end
847
+
848
+ def Cls()
849
+ attr = ATTR_NORMAL
850
+ x, y = Size()
851
+ left, top, right , bottom = Window()
852
+ vx = right - left
853
+ vy = bottom - top
854
+ FillChar(' ', x*y, 0, 0)
855
+ FillAttr(attr, x*y, 0, 0)
856
+ Cursor(0,0)
857
+ Window(1,0,0,vx,vy)
858
+ end
859
+
860
+ def Console.Free()
861
+ API.FreeConsole()
862
+ end
863
+
864
+ def Console.Alloc()
865
+ API.AllocConsole()
866
+ end
867
+
868
+ def Console.MouseButtons()
869
+ API.GetNumberOfConsoleMouseButtons()
870
+ end
871
+
872
+ def Console.InputCP(codepage=nil)
873
+ if codepage
874
+ API.SetConsoleCP(codepage)
875
+ else
876
+ return API.GetConsoleCP()
877
+ end
878
+ end
879
+
880
+ def Console.OutputCP(codepage=nil)
881
+ if codepage
882
+ API.SetConsoleOutputCP(codepage)
883
+ else
884
+ return API.GetConsoleOutputCP()
885
+ end
886
+ end
887
+
888
+ def Console.GenerateCtrlEvent( type=nil, pid=nil )
889
+ type = API.constant('CTRL_C_EVENT') if type == nil
890
+ pid = 0 if pid == nil
891
+ API.GenerateConsoleCtrlEvent(type, pid)
892
+ end
893
+
894
+ end
895
+ end
896
+
897
+
898
+
899
+
900
+
901
+ FG_BLACK = 0
902
+ FG_BLUE = Win32::Console::API.constant("FOREGROUND_BLUE")
903
+ FG_LIGHTBLUE = Win32::Console::API.constant("FOREGROUND_BLUE")|
904
+ Win32::Console::API.constant("FOREGROUND_INTENSITY")
905
+ FG_RED = Win32::Console::API.constant("FOREGROUND_RED")
906
+ FG_LIGHTRED = Win32::Console::API.constant("FOREGROUND_RED")|
907
+ Win32::Console::API.constant("FOREGROUND_INTENSITY")
908
+ FG_GREEN = Win32::Console::API.constant("FOREGROUND_GREEN")
909
+ FG_LIGHTGREEN = Win32::Console::API.constant("FOREGROUND_GREEN")|
910
+ Win32::Console::API.constant("FOREGROUND_INTENSITY")
911
+ FG_MAGENTA = Win32::Console::API.constant("FOREGROUND_RED")|
912
+ Win32::Console::API.constant("FOREGROUND_BLUE")
913
+ FG_LIGHTMAGENTA = Win32::Console::API.constant("FOREGROUND_RED")|
914
+ Win32::Console::API.constant("FOREGROUND_BLUE")|
915
+ Win32::Console::API.constant("FOREGROUND_INTENSITY")
916
+ FG_CYAN = Win32::Console::API.constant("FOREGROUND_GREEN")|
917
+ Win32::Console::API.constant("FOREGROUND_BLUE")
918
+ FG_LIGHTCYAN = Win32::Console::API.constant("FOREGROUND_GREEN")|
919
+ Win32::Console::API.constant("FOREGROUND_BLUE")|
920
+ Win32::Console::API.constant("FOREGROUND_INTENSITY")
921
+ FG_BROWN = Win32::Console::API.constant("FOREGROUND_RED")|
922
+ Win32::Console::API.constant("FOREGROUND_GREEN")
923
+ FG_YELLOW = Win32::Console::API.constant("FOREGROUND_RED")|
924
+ Win32::Console::API.constant("FOREGROUND_GREEN")|
925
+ Win32::Console::API.constant("FOREGROUND_INTENSITY")
926
+ FG_GRAY = Win32::Console::API.constant("FOREGROUND_RED")|
927
+ Win32::Console::API.constant("FOREGROUND_GREEN")|
928
+ Win32::Console::API.constant("FOREGROUND_BLUE")
929
+ FG_WHITE = Win32::Console::API.constant("FOREGROUND_RED")|
930
+ Win32::Console::API.constant("FOREGROUND_GREEN")|
931
+ Win32::Console::API.constant("FOREGROUND_BLUE")|
932
+ Win32::Console::API.constant("FOREGROUND_INTENSITY")
933
+
934
+ BG_BLACK = 0
935
+ BG_BLUE = Win32::Console::API.constant("BACKGROUND_BLUE")
936
+ BG_LIGHTBLUE = Win32::Console::API.constant("BACKGROUND_BLUE")|
937
+ Win32::Console::API.constant("BACKGROUND_INTENSITY")
938
+ BG_RED = Win32::Console::API.constant("BACKGROUND_RED")
939
+ BG_LIGHTRED = Win32::Console::API.constant("BACKGROUND_RED")|
940
+ Win32::Console::API.constant("BACKGROUND_INTENSITY")
941
+ BG_GREEN = Win32::Console::API.constant("BACKGROUND_GREEN")
942
+ BG_LIGHTGREEN = Win32::Console::API.constant("BACKGROUND_GREEN")|
943
+ Win32::Console::API.constant("BACKGROUND_INTENSITY")
944
+ BG_MAGENTA = Win32::Console::API.constant("BACKGROUND_RED")|
945
+ Win32::Console::API.constant("BACKGROUND_BLUE")
946
+ BG_LIGHTMAGENTA = Win32::Console::API.constant("BACKGROUND_RED")|
947
+ Win32::Console::API.constant("BACKGROUND_BLUE")|
948
+ Win32::Console::API.constant("BACKGROUND_INTENSITY")
949
+ BG_CYAN = Win32::Console::API.constant("BACKGROUND_GREEN")|
950
+ Win32::Console::API.constant("BACKGROUND_BLUE")
951
+ BG_LIGHTCYAN = Win32::Console::API.constant("BACKGROUND_GREEN")|
952
+ Win32::Console::API.constant("BACKGROUND_BLUE")|
953
+ Win32::Console::API.constant("BACKGROUND_INTENSITY")
954
+ BG_BROWN = Win32::Console::API.constant("BACKGROUND_RED")|
955
+ Win32::Console::API.constant("BACKGROUND_GREEN")
956
+ BG_YELLOW = Win32::Console::API.constant("BACKGROUND_RED")|
957
+ Win32::Console::API.constant("BACKGROUND_GREEN")|
958
+ Win32::Console::API.constant("BACKGROUND_INTENSITY")
959
+ BG_GRAY = Win32::Console::API.constant("BACKGROUND_RED")|
960
+ Win32::Console::API.constant("BACKGROUND_GREEN")|
961
+ Win32::Console::API.constant("BACKGROUND_BLUE")
962
+ BG_WHITE = Win32::Console::API.constant("BACKGROUND_RED")|
963
+ Win32::Console::API.constant("BACKGROUND_GREEN")|
964
+ Win32::Console::API.constant("BACKGROUND_BLUE")|
965
+ Win32::Console::API.constant("BACKGROUND_INTENSITY")
966
+
967
+ ATTR_NORMAL = FG_GRAY | BG_BLACK
968
+ ATTR_INVERSE = FG_BLACK | BG_GRAY
969
+
970
+ include Win32::Console::Constants