scriptty 0.5.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitattributes +1 -0
- data/.gitignore +3 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/README.rdoc +31 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/bin/scriptty-capture +5 -0
- data/bin/scriptty-dump-screens +4 -0
- data/bin/scriptty-replay +5 -0
- data/bin/scriptty-term-test +4 -0
- data/bin/scriptty-transcript-parse +4 -0
- data/examples/captures/xterm-overlong-line-prompt.bin +9 -0
- data/examples/captures/xterm-vim-session.bin +262 -0
- data/examples/demo-capture.rb +19 -0
- data/examples/telnet-nego.rb +55 -0
- data/lib/scriptty/apps/capture_app/console.rb +104 -0
- data/lib/scriptty/apps/capture_app/password_prompt.rb +65 -0
- data/lib/scriptty/apps/capture_app.rb +213 -0
- data/lib/scriptty/apps/dump_screens_app.rb +166 -0
- data/lib/scriptty/apps/replay_app.rb +229 -0
- data/lib/scriptty/apps/term_test_app.rb +124 -0
- data/lib/scriptty/apps/transcript_parse_app.rb +143 -0
- data/lib/scriptty/cursor.rb +39 -0
- data/lib/scriptty/exception.rb +38 -0
- data/lib/scriptty/expect.rb +392 -0
- data/lib/scriptty/multiline_buffer.rb +192 -0
- data/lib/scriptty/net/event_loop.rb +610 -0
- data/lib/scriptty/screen_pattern/generator.rb +398 -0
- data/lib/scriptty/screen_pattern/parser.rb +558 -0
- data/lib/scriptty/screen_pattern.rb +104 -0
- data/lib/scriptty/term/dg410/dg410-client-escapes.txt +37 -0
- data/lib/scriptty/term/dg410/dg410-escapes.txt +82 -0
- data/lib/scriptty/term/dg410/parser.rb +162 -0
- data/lib/scriptty/term/dg410.rb +489 -0
- data/lib/scriptty/term/xterm/xterm-escapes.txt +73 -0
- data/lib/scriptty/term/xterm.rb +661 -0
- data/lib/scriptty/term.rb +40 -0
- data/lib/scriptty/util/fsm/definition_parser.rb +111 -0
- data/lib/scriptty/util/fsm/scriptty_fsm_definition.treetop +189 -0
- data/lib/scriptty/util/fsm.rb +177 -0
- data/lib/scriptty/util/transcript/reader.rb +96 -0
- data/lib/scriptty/util/transcript/writer.rb +111 -0
- data/test/apps/capture_app_test.rb +123 -0
- data/test/apps/transcript_parse_app_test.rb +118 -0
- data/test/cursor_test.rb +51 -0
- data/test/fsm_definition_parser_test.rb +220 -0
- data/test/fsm_test.rb +322 -0
- data/test/multiline_buffer_test.rb +275 -0
- data/test/net/event_loop_test.rb +402 -0
- data/test/screen_pattern/generator_test.rb +408 -0
- data/test/screen_pattern/parser_test/explicit_cursor_pattern.txt +14 -0
- data/test/screen_pattern/parser_test/explicit_fields.txt +22 -0
- data/test/screen_pattern/parser_test/multiple_patterns.txt +42 -0
- data/test/screen_pattern/parser_test/simple_pattern.txt +14 -0
- data/test/screen_pattern/parser_test/truncated_heredoc.txt +12 -0
- data/test/screen_pattern/parser_test/utf16bebom_pattern.bin +0 -0
- data/test/screen_pattern/parser_test/utf16lebom_pattern.bin +0 -0
- data/test/screen_pattern/parser_test/utf8_pattern.bin +14 -0
- data/test/screen_pattern/parser_test/utf8_unix_pattern.bin +14 -0
- data/test/screen_pattern/parser_test/utf8bom_pattern.bin +14 -0
- data/test/screen_pattern/parser_test.rb +266 -0
- data/test/term/dg410/parser_test.rb +139 -0
- data/test/term/xterm_test.rb +327 -0
- data/test/test_helper.rb +3 -0
- data/test/util/transcript/reader_test.rb +131 -0
- data/test/util/transcript/writer_test.rb +126 -0
- data/test.watchr +29 -0
- metadata +175 -0
data/COPYING.LESSER
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.rdoc
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
= Introduction
|
2
|
+
|
3
|
+
ScripTTY is a library for JRuby that lets you write scripts to control
|
4
|
+
full-screen terminal-based applications.
|
5
|
+
|
6
|
+
= Terminals supported
|
7
|
+
|
8
|
+
Limited DG410 and XTerm support.
|
9
|
+
|
10
|
+
= Requirements
|
11
|
+
|
12
|
+
- JRuby
|
13
|
+
- Treetop
|
14
|
+
- Multibyte
|
15
|
+
|
16
|
+
= License
|
17
|
+
|
18
|
+
Copyright © 2010 Infonium Inc.
|
19
|
+
|
20
|
+
ScripTTY is free software: you can redistribute it and/or modify
|
21
|
+
it under the terms of the GNU Lesser General Public License as published
|
22
|
+
by the Free Software Foundation, either version 3 of the License, or
|
23
|
+
(at your option) any later version.
|
24
|
+
|
25
|
+
ScripTTY is distributed in the hope that it will be useful,
|
26
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
27
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
28
|
+
GNU Lesser General Public License for more details.
|
29
|
+
|
30
|
+
You should have received a copy of the GNU Lesser General Public License
|
31
|
+
along with ScripTTY. If not, see <http://www.gnu.org/licenses/>.
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gemspec|
|
4
|
+
gemspec.name = "scriptty"
|
5
|
+
gemspec.summary = "write expect-like script to control full-screen terminal-based applications"
|
6
|
+
gemspec.description = <<EOF
|
7
|
+
ScripTTY is a JRuby application and library that lets you control full-screen
|
8
|
+
terminal applications using an expect-like scripting language and a full-screen
|
9
|
+
matching engine.
|
10
|
+
EOF
|
11
|
+
gemspec.platform = "java"
|
12
|
+
gemspec.email = "dlitz@infonium.ca"
|
13
|
+
gemspec.homepage = "http://github.com/infonium/scriptty"
|
14
|
+
gemspec.authors = ["Dwayne Litzenberger"]
|
15
|
+
gemspec.add_dependency "treetop"
|
16
|
+
gemspec.add_dependency "multibyte"
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'rake/rdoctask'
|
24
|
+
Rake::RDocTask.new do |t|
|
25
|
+
t.rdoc_files = Dir.glob(%w( README* COPYING* lib/**/*.rb *.rdoc )).uniq
|
26
|
+
t.main = "README.rdoc"
|
27
|
+
t.title = "ScripTTY - RDoc Documentation"
|
28
|
+
t.options = %w( --charset -UTF-8 --line-numbers )
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'rake/testtask'
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.pattern = 'test/**/*_test.rb'
|
34
|
+
end
|
35
|
+
|
36
|
+
begin
|
37
|
+
require 'rcov/rcovtask'
|
38
|
+
Rcov::RcovTask.new do |t|
|
39
|
+
t.pattern = 'test/**/*_test.rb'
|
40
|
+
t.rcov_opts = ['--text-report', '--exclude', 'gems,rcov,jruby.*,\(eval\)']
|
41
|
+
end
|
42
|
+
rescue LoadError
|
43
|
+
$stderr.puts "warning: rcov not installed; coverage testing not available."
|
44
|
+
end
|
45
|
+
|
46
|
+
task :clobber do
|
47
|
+
rm "scriptty.gemspec"
|
48
|
+
rm_r "pkg"
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.0
|
data/bin/scriptty-replay
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Script started on Thu Mar 4 16:08:52 2010
|
2
|
+
iMac-002:[94m~/components/scriptty/main[39m
|
3
|
+
dwaynelitzenberger$
|
4
|
+
dwaynelitzenberger$ git commit -m 'FSM: include input_sequence instead of just in
|
5
|
+
|
6
|
+
iMac-002:[94m~/components/scriptty/main[39m
|
7
|
+
dwaynelitzenberger$ exit
|
8
|
+
|
9
|
+
Script done on Thu Mar 4 16:09:08 2010
|
@@ -0,0 +1,262 @@
|
|
1
|
+
Script started on Mon Mar 1 17:14:33 2010
|
2
|
+
iMac-002:[94m~/components/scriptty/main[39m
|
3
|
+
dwaynelitzenberger$ clear
|
4
|
+
[H[2JiMac-002:[94m~/components/scriptty/main[39m
|
5
|
+
dwaynelitzenberger$
|
6
|
+
iMac-002:[94m~/components/scriptty/main[39m
|
7
|
+
dwaynelitzenberger$ ls
|
8
|
+
Rakefile lots_of_operations.bin xterm-vim-session.bin
|
9
|
+
dg410only.bin mytest.rb
|
10
|
+
[1m[34mlib[m[m test.txt
|
11
|
+
iMac-002:[94m~/components/scriptty/main[39m
|
12
|
+
dwaynelitzenberger$ vim mytest.rb
|
13
|
+
7[?47h[?1h=[1;24r[m[H[2J[24;1H[1m[37m[41mE325: ATTENTION[m
|
14
|
+
Found a swap file by the name ".mytest.rb.swp"
|
15
|
+
owned by: dwaynelitzenberger dated: Mon Mar 1 16:23:54 2010
|
16
|
+
file name: ~dwaynelitzenberger/components/scriptty/main/mytest.rb
|
17
|
+
modified: no
|
18
|
+
user name: dwaynelitzenberger host name: iMac-002.local
|
19
|
+
process ID: 21299 (still running)
|
20
|
+
While opening file "mytest.rb"
|
21
|
+
dated: Mon Mar 1 16:23:51 2010
|
22
|
+
|
23
|
+
(1) Another program may be editing the same file.
|
24
|
+
If this is the case, be careful not to end up with two
|
25
|
+
different instances of the same file when making changes.
|
26
|
+
Quit, or continue with caution.
|
27
|
+
|
28
|
+
(2) An edit session for this file crashed.
|
29
|
+
If this is the case, use ":recover" or "vim -r mytest.rb"
|
30
|
+
to recover the changes (see ":help recovery").
|
31
|
+
If you did this already, delete the swap file ".mytest.rb.swp"
|
32
|
+
to avoid this message.
|
33
|
+
|
34
|
+
[32mSwap file ".mytest.rb.swp" already exists![m
|
35
|
+
[32m[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: [m[24;1H[K[24;1H"mytest.rb"
|
36
|
+
[33m 2 [m[2;5H[K[3;1H[33m 3 [m[1m[34m$LOAD_PATH[m.unshift [1m[35m"lib"[m[3;29H[K[4;1H[33m 4 [m[4;11H[K[5;1H[33m 5 [m[1m[31m#require 'scriptty/async_sockets'[m[5;38H[K[6;1H[33m 6 [m[1m[35mrequire[m [1m[35m'scriptty/dg410-transition-table'[m
|
37
|
+
[33m 7 [m[1m[35mrequire[m [1m[35m'scriptty/screen_buffer'[m[7;37H[K[8;1H[33m 8 [m[8;9H[K[9;1H[33m 9 [m[1m[35mmodule[m [1m[34mScriptty[m[9;20H[K[10;1H[33m 10 [m [1m[35mmodule[m [1m[34mTerm[m[10;18H[K[11;1H[33m 11 [m [1m[35mclass[m [1m[34mDG410[m
|
38
|
+
[33m 12 [m[12;5H[K[13;1H[33m 13 [m [1m[35mclass[m [1m[34mProprietaryEscapeParser[m[13;41H[K[14;1H[33m 14 [m [1m[35mdef[m [1m[34minitialize[m(target)[14;35H[K[15;1H[33m 15 [m [1m[34m@target[m = target[15;31H[K[16;1H[33m 16 [m[9C [1m[34m@state[m = [1m[35m:opcode[m
|
39
|
+
[33m 17 [m [1m[34m@opcode[m = [1m[35m""[m[17;27H[K[18;1H[33m 18 [m [1m[34m@n[m = [1m[35mnil[m[18;23H[K[19;1H[33m 19 [m [1m[34m@payload[m = [1m[35m""[m[19;28H[K[20;1H[33m 20 [m [1m[35mend[m[20;16H[K[21;1H[33m 21 [m[21;5H[K[22;1H[33m 22 [m[7C [1m[31m# <036> ~ <2-byte-opcode> <n> <n*bytes>[m
|
40
|
+
[1m[33m[40mmytest.rb [RO] 1,1 Top[1;5H[23;63H2,0-1 Top[2;5H[23;63H3,1 Top[3;5H[23;63H4,0-1 Top[4;5H[23;63H5,1 Top[5;5H[23;63H6,1 Top[6;5H[23;63H7,1 Top[7;5H[23;63H8,0-1 Top[8;5H[23;63H9,1 Top[9;5H[23;63H10,1 Top[10;5H[23;63H11,1 Top[11;5H[23;63H12,0-1 Top[12;5H[23;63H13,1 Top[13;5H[23;63H14,1 Top[14;5H[23;63H15,1 Top[15;5H[23;63H16,1 Top[16;5H[23;63H17,1 Top[17;5H[23;63H18,1 Top[18;5H[23;63H19,1 Top[19;5H[23;63H20,1 Top[20;5H[23;63H21,0-1 Top[21;5H[23;63H22,1 Top[22;5H[1;22r[m[22;1H
|
41
|
+
[1;24r[22;1H[33m 23 [m[7C [1m[35mdef[m [1m[34mfeed_byte[m(input_byte)[24;1H[K[23;63H[1m[33m[40m23,1 0%[22;5H[1;22r[m[22;1H
|
42
|
+
[1;24r[22;1H[33m 24 [m[9C [31mcase[m [1m[34m@state[m[23;63H[1m[33m[40m24,1 1%[22;5H[1;22r[m[22;1H
|
43
|
+
[1;24r[22;1H[33m 25 [m[9C [31mwhen[m [1m[35m:opcode[m[23;63H[1m[33m[40m25,1 1%[22;5H[1;22r[m[22;1H
|
44
|
+
[1;24r[22;1H[33m 26 [m[11C [1m[34m@opcode[m << input_byte[23;63H[1m[33m[40m26,1 2%[22;5H[1;22r[m[22;1H
|
45
|
+
[1;24r[22;1H[33m 27 [m[11C [31mif[m [1m[34m@opcode[m.length >= [1m[35m2[m[23;63H[1m[33m[40m27,1 3%[22;5H[1;22r[m[22;1H
|
46
|
+
[1;24r[22;1H[33m 28 [m[13C [1m[34m@state[m = [1m[35m:n[m[23;63H[1m[33m[40m28,1 3%[22;5H[1;22r[m[22;1H
|
47
|
+
[1;24r[22;1H[33m 29 [m[11C [31mend[m[23;63H[1m[33m[40m29,1 4%[22;5H[1;22r[m[22;1H
|
48
|
+
[1;24r[22;1H[33m 30 [m[9C [31mwhen[m [1m[35m:n[m[23;63H[1m[33m[40m30,1 5%[22;5H[1;22r[m[22;1H
|
49
|
+
[1;24r[22;1H[33m 31 [m[11C [1m[34m@n[m = input_byte.unpack([1m[35m"C*"[m)[[1m[35m0[m][23;63H[1m[33m[40m31,1 5%[22;5H[1;22r[m[22;1H
|
50
|
+
[1;24r[22;1H[33m 32 [m[11C [31mif[m [1m[34m@n[m > [1m[35m0[m[23;63H[1m[33m[40m32,1 6%[22;5H[1;22r[m[22;1H
|
51
|
+
[1;24r[22;1H[33m 33 [m[13C [1m[34m@state[m = [1m[35m:payload[m[23;63H[1m[33m[40m33,1 6%[22;5H[1;22r[m[22;1H
|
52
|
+
[1;24r[22;1H[33m 34 [m[11C [31melse[m[23;63H[1m[33m[40m34,1 7%[22;5H[1;22r[m[22;1H
|
53
|
+
[1;24r[22;1H[33m 35 [m[13C [1m[34m@state[m = [1m[35m:done[m[23;63H[1m[33m[40m35,1 8%[22;5H[1;22r[m[22;1H
|
54
|
+
[1;24r[22;1H[33m 36 [m[11C [31mend[m[23;63H[1m[33m[40m36,1 8%[22;5H[1;22r[m[22;1H
|
55
|
+
[1;24r[22;1H[33m 37 [m[9C [31mwhen[m [1m[35m:payload[m[23;63H[1m[33m[40m37,1 9%[22;5H[1;22r[m[22;1H
|
56
|
+
[1;24r[22;1H[33m 38 [m[11C [1m[34m@payload[m << input_byte[23;63H[1m[33m[40m38,1 10%[22;5H[1;22r[m[22;1H
|
57
|
+
[1;24r[22;1H[33m 39 [m[11C [31mif[m [1m[34m@payload[m.length >= [1m[34m@n[m[23;63H[1m[33m[40m39,1 10%[22;5H[1;22r[m[22;1H
|
58
|
+
[1;24r[22;1H[33m 40 [m[13C [1m[34m@state[m = [1m[35m:done[m[23;63H[1m[33m[40m40,1 11%[22;5H[1;22r[m[22;1H
|
59
|
+
[1;24r[22;1H[33m 41 [m[11C [31mend[m[23;63H[1m[33m[40m41,1 11%[22;5H[1;22r[m[22;1H
|
60
|
+
[1;24r[22;1H[33m 42 [m[9C [31melse[m[23;63H[1m[33m[40m42,1 12%[22;5H[1;22r[m[22;1H
|
61
|
+
[1;24r[22;1H[33m 43 [m[11C [31mraise[m [1m[35m"BUG"[m[23;63H[1m[33m[40m43,1 13%[22;5H[1;22r[m[22;1H
|
62
|
+
[1;24r[22;1H[33m 44 [m[9C [31mend[m[23;63H[1m[33m[40m44,1 13%[22;5H[1;22r[m[22;1H
|
63
|
+
[1;24r[22;1H[33m 45 [m[9C [31mif[m [1m[34m@state[m == [1m[35m:done[m[23;63H[1m[33m[40m45,1 14%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m 46 [m[11C [1m[34m@target[m.handle([1m[35m:proprietary_escape[m, [1m[35m"#{[m[1m[34m@opcode[m[1m[35m}#{[m[[1m[34m@n[m].pack([1m[35m"C*"[m))[22;1H[33m [m[1m[35m}#{[m[1m[34m@payload[m[1m[35m}"[m)[23;63H[1m[33m[40m46,1 15%[21;5H[1;22r[m[22;1H
|
64
|
+
[1;24r[22;1H[33m 47 [m[11C [31mreturn[m [1m[35mtrue[m[23;63H[1m[33m[40m47,1 16%[22;5H[1;22r[m[22;1H
|
65
|
+
[1;24r[22;1H[33m 48 [m[9C [31melse[m[23;63H[1m[33m[40m48,1 16%[22;5H[1;22r[m[22;1H
|
66
|
+
[1;24r[22;1H[33m 49 [m[11C [31mreturn[m [1m[35mfalse[m[23;63H[1m[33m[40m49,1 17%[22;5H[1;22r[m[22;1H
|
67
|
+
[1;24r[22;1H[33m 50 [m[9C [31mend[m[23;63H[1m[33m[40m50,1 18%[22;5H[1;22r[m[22;1H
|
68
|
+
[1;24r[22;1H[33m 51 [m[7C [1m[35mend[m[23;63H[1m[33m[40m51,1 18%[22;5H[1;22r[m[22;1H
|
69
|
+
[1;24r[22;1H[33m 52 [m [1m[35mend[m[23;63H[1m[33m[40m52,1 19%[22;5H[1;22r[m[22;1H
|
70
|
+
[1;24r[22;1H[33m 53 [m[23;63H[1m[33m[40m53,0-1 20%[22;5H[1;22r[m[22;1H
|
71
|
+
[1;24r[22;1H[33m 54 [m [1m[35mdef[m [1m[34minitialize[m(target)[23;63H[1m[33m[40m54,1 20%[22;5H[1;22r[m[22;1H
|
72
|
+
[1;24r[22;1H[33m 55 [m[7C [1m[34m@byte[m = [1m[35m1[m [1m[31m# DEBUG [m[30m[43mFIXME[m[23;63H[1m[33m[40m55,1 21%[22;5H[1;22r[m[22;1H
|
73
|
+
[1;24r[22;1H[33m 56 [m[7C [1m[34m@target[m = target[23;63H[1m[33m[40m56,1 21%[22;5H[1;22r[m[22;1H
|
74
|
+
[1;24r[22;1H[33m 57 [m[7C [1m[34m@state[m = [1m[35m1[m [1m[31m# default state is 1[m[23;63H[1m[33m[40m57,1 22%[22;5H[1;22r[m[22;1H
|
75
|
+
[1;24r[22;1H[33m 58 [m[7C [1m[34m@alt_parser[m = [1m[35mnil[m [1m[31m# alternative escape sequence parser[m[23;63H[1m[33m[40m58,1 23%[22;5H[1;22r[m[22;1H
|
76
|
+
[1;24r[22;1H[33m 59 [m[7C [1m[34m@current_escape_sequence[m = [1m[35m""[m[23;63H[1m[33m[40m59,1 23%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m 60 [m[7C load_transition_table([1m[34mFile[m.join([1m[34mFile[m.dirname([1m[35m__FILE__[m), [1m[35m"lib/scripttt[m[22;1H[33m [m[1m[35my/dg410-transition-table.rb"[m)) [1m[31m# DEBUG [m[30m[43mFIXME[m[23;63H[1m[33m[40m60,1 24%[21;5H[1;22r[m[22;1H
|
77
|
+
[1;24r[22;1H[33m 61 [m [1m[35mend[m[23;63H[1m[33m[40m61,1 25%[22;5H[1;22r[m[22;1H
|
78
|
+
[1;24r[22;1H[33m 62 [m[23;63H[1m[33m[40m62,0-1 26%[22;5H[1;22r[m[22;1H
|
79
|
+
[1;24r[22;1H[33m 63 [m [1m[35mdef[m [1m[34mfeed[m(input_bytes)[23;63H[1m[33m[40m63,1 26%[22;5H[1;22r[m[22;1H
|
80
|
+
[1;24r[22;1H[33m 64 [m[7C input_bytes.length.times [31mdo[m |[1m[34mi[m|[23;63H[1m[33m[40m64,1 27%[22;5H[1;22r[m[22;1H
|
81
|
+
[1;24r[22;1H[33m 65 [m[9C feed_byte(input_bytes[i,[1m[35m1[m])[23;63H[1m[33m[40m65,1 27%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m 66 [m[9C [1m[34m@byte[m += [1m[35m1[m [1m[31m# DEBUG [m[30m[43mFIXME[m
|
82
|
+
[33m 67 [m[7C [31mend[m[23;63H[1m[33m[40m66,1 28%[21;5H[23;63H67,1 28%[22;5H[1;22r[m[22;1H
|
83
|
+
[1;24r[22;1H[33m 68 [m [1m[35mend[m[23;63H[1m[33m[40m68,1 29%[22;5H[1;22r[m[22;1H
|
84
|
+
[1;24r[22;1H[33m 69 [m[23;63H[1m[33m[40m69,0-1 30%[22;5H[1;22r[m[22;1H
|
85
|
+
[1;24r[22;1H[33m 70 [m [1m[31m#private[m[23;63H[1m[33m[40m70,1 30%[22;5H[1;22r[m[22;1H
|
86
|
+
[1;24r[22;1H[33m 71 [m[23;63H[1m[33m[40m71,0-1 31%[22;5H[1;22r[m[22;1H
|
87
|
+
[1;24r[22;1H[33m 72 [m [1m[35mdef[m [1m[34mfeed_byte[m(input_byte)[23;63H[1m[33m[40m72,1 31%[22;5H[1;22r[m[22;1H
|
88
|
+
[1;24r[22;1H[33m 73 [m[7C [31mif[m [1m[34m@state[m != [1m[35m1[m[23;63H[1m[33m[40m73,1 32%[22;5H[1;22r[m[22;1H
|
89
|
+
[1;24r[22;1H[33m 74 [m[9C [1m[34m@current_escape_sequence[m << input_byte[23;63H[1m[33m[40m74,1 33%[22;5H[1;22r[m[22;1H
|
90
|
+
[1;24r[22;1H[33m 75 [m[7C [31melse[m[23;63H[1m[33m[40m75,1 33%[22;5H[1;22r[m[22;1H
|
91
|
+
[1;24r[22;1H[33m 76 [m[9C [1m[34m@current_escape_sequence[m = input_byte.dup[23;63H[1m[33m[40m76,1 34%[22;5H[1;22r[m[22;1H
|
92
|
+
[1;24r[22;1H[33m 77 [m[7C [31mend[m[23;63H[1m[33m[40m77,1 35%[22;5H[1;22r[m[22;1H
|
93
|
+
[1;24r[22;1H[33m 78 [m[7C [31mif[m [1m[34m@alt_parser[m[23;63H[1m[33m[40m78,1 35%[22;5H[1;22r[m[22;1H
|
94
|
+
[1;24r[22;1H[33m 79 [m[9C [31mif[m [1m[34m@alt_parser[m.feed_byte(input_byte)[23;63H[1m[33m[40m79,1 36%[22;5H[1;22r[m[22;1H
|
95
|
+
[1;24r[22;1H[33m 80 [m[11C [1m[34m@state[m = [1m[34m@next_state[m[23;63H[1m[33m[40m80,1 36%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m 81 [m[11C [1m[34m@alt_parser[m = [1m[35mnil[m
|
96
|
+
[33m 82 [m[9C [31mend[m[23;63H[1m[33m[40m81,1 37%[21;5H[23;63H82,1 37%[22;5H[1;22r[m[22;1H
|
97
|
+
[1;24r[22;1H[33m 83 [m[9C [31mreturn[m[23;63H[1m[33m[40m83,1 38%[22;5H[1;22r[m[22;1H
|
98
|
+
[1;24r[22;1H[33m 84 [m[7C [31mend[m[23;63H[1m[33m[40m84,1 38%[22;5H[1;22r[m[22;1H
|
99
|
+
[1;24r[22;1H[33m 85 [m[7C t = [1m[34m@state_transitions[m[[1m[34m@state[m][input_byte][23;63H[1m[33m[40m85,1 39%[22;5H[1;22r[m[22;1H
|
100
|
+
[1;24r[22;1H[33m 86 [m[7C t ||= [1m[34m@state_transitions[m[[1m[34m@state[m][[1m[35m:any[m][23;63H[1m[33m[40m86,1 40%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m 87 [m[7C [1m[31m#raise ArgumentError.new("Unknown escape state=#{@state.inspect} inpp[m[22;1H[33m [m[1m[31mut=#{input_byte.inspect}") unless t[m[23;63H[1m[33m[40m87,1 41%[21;5H[1;22r[m[1;1H[3M[1;24r[20;1H[33m 88 [m[7C [31mraise[m [1m[34mArgumentError[m.new([1m[35m"Unknown escape sequence #{[m[1m[34m@current_escape_ss[m[21;1H[33m [m[1m[34mequence[m.inspect[1m[35m} state=#{[m[1m[34m@state[m.inspect[1m[35m} input=#{[minput_byte.inspect[1m[35m} byte=0xx[m[22;1H[33m [m[1m[35m#{[m[1m[34m@byte[m.to_s([1m[35m16[m)[1m[35m}"[m) [31munless[m t [1m[31m# DEBUG [m[30m[43mFIXME[m[23;63H[1m[33m[40m88,1 42%[20;5H[1;22r[m[22;1H
|
101
|
+
[1;24r[22;1H[33m 89 [m[7C [1m[34m@next_state[m = t[[1m[35m:next_state[m][23;63H[1m[33m[40m89,1 43%[22;5H[1;22r[m[22;1H
|
102
|
+
[1;24r[22;1H[33m 90 [m[7C [31mif[m t[[1m[35m:callback[m][23;63H[1m[33m[40m90,1 43%[22;5H[1;22r[m[22;1H
|
103
|
+
[1;24r[22;1H[33m 91 [m[9C method_name = [1m[35m"handle_#{[mt[[1m[35m:callback[m][1m[35m}"[m.to_sym[23;63H[1m[33m[40m91,1 44%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m 92 [m[9C [31mif[m respond_to?(method_name) [1m[31m# check for the method in this objecc[m[22;1H[33m [m[1m[31mt[m[23;63H[1m[33m[40m92,1 45%[21;5H[1;22r[m[22;1H
|
104
|
+
[1;24r[22;1H[33m 93 [m[11C send(method_name, [1m[34m@current_escape_sequence[m)[23;63H[1m[33m[40m93,1 46%[22;5H[1;22r[m[22;1H
|
105
|
+
[1;24r[22;1H[33m 94 [m[9C [31melse[m[23;63H[1m[33m[40m94,1 46%[22;5H[1;22r[m[22;1H
|
106
|
+
[1;24r[22;1H[33m 95 [m[11C [1m[34m@target[m.handle(t[[1m[35m:callback[m], [1m[34m@current_escape_sequence[m)[23;63H[1m[33m[40m95,1 47%[22;5H[1;22r[m[22;1H
|
107
|
+
[1;24r[22;1H[33m 96 [m[9C [31mend[m[23;63H[1m[33m[40m96,1 47%[22;5H[1;22r[m[22;1H
|
108
|
+
[1;24r[22;1H[33m 97 [m[9C [1m[31m#elsif target.respond_to?(:unhandled)[m[23;63H[1m[33m[40m97,1 48%[22;5H[1;22r[m[22;1H
|
109
|
+
[1;24r[22;1H[33m 98 [m[9C [1m[31m# target.unhandled(t[:callback].to_sym, input_byte)[m[23;63H[1m[33m[40m98,1 49%[22;5H[1;22r[m[22;1H
|
110
|
+
[1;24r[22;1H[33m 99 [m[9C [1m[31m#else[m[23;63H[1m[33m[40m99,1 49%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m100 [m[9C [1m[31m# print "[#{t[:callback]}]" # DEBUG [m[30m[43mFIXME[m[1m[31m: should we die if thh[m[22;1H[33m [m[1m[31mis happens?[m[23;63H[1m[33m[40m100,1 50%[21;5H[1;22r[m[22;1H
|
111
|
+
[1;24r[22;1H[33m101 [m[9C [1m[31m# $stdout.flush[m[23;63H[1m[33m[40m101,1 51%[22;5H[1;22r[m[22;1H
|
112
|
+
[1;24r[22;1H[33m102 [m[9C [1m[31m#end[m[23;63H[1m[33m[40m102,1 51%[22;5H[1;22r[m[22;1H
|
113
|
+
[1;24r[22;1H[33m103 [m[7C [31mend[m[23;63H[1m[33m[40m103,1 52%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m104 [m[7C [1m[34m@state[m = [1m[34m@next_state[m
|
114
|
+
[33m105 [m [1m[35mend[m[23;63H[1m[33m[40m104,1 53%[21;5H[23;63H105,1 53%[22;5H[1;22r[m[1;1H[3M[1;24r[20;1H[33m106
|
115
|
+
107 [m [1m[31m# escapes starting with "\036~"[m
|
116
|
+
[33m108 [m [1m[31m# <036> ~ <2-byte-opcode> <n> <n*bytes>[m[23;63H[1m[33m[40m106,0-1 54%[20;5H[23;63H107,1 54%[21;5H[23;63H108,1 54%[22;5H[1;22r[m[22;1H
|
117
|
+
[1;24r[22;1H[33m109 [m [1m[35mdef[m [1m[34mhandle_proprietary_escape[m(input_byte)[23;63H[1m[33m[40m109,1 55%[22;5H[1;22r[m[22;1H
|
118
|
+
[1;24r[22;1H[33m110 [m[7C [1m[34m@alt_parser[m = [1m[34mProprietaryEscapeParser[m.new([1m[34m@target[m)[23;63H[1m[33m[40m110,1 55%[22;5H[1;22r[m[22;1H
|
119
|
+
[1;24r[22;1H[33m111 [m [1m[35mend[m[23;63H[1m[33m[40m111,1 56%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m112
|
120
|
+
113 [m [1m[35mdef[m [1m[34mload_transition_table[m(filename)[23;63H[1m[33m[40m112,0-1 57%[21;5H[23;63H113,1 57%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m114 [m[7C [1m[31m# @state_transitions[current_state][input] = {:next_state => x, :evee[m[22;1H[33m [m[1m[31mnt => x}[m[23;63H[1m[33m[40m114,1 58%[21;5H[1;22r[m[22;1H
|
121
|
+
[1;24r[22;1H[33m115 [m[7C [1m[34m@state_transitions[m = {}[23;63H[1m[33m[40m115,1 59%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m116 [m[7C [31meval[m([1m[34mFile[m.read(filename), [1m[35mnil[m, filename, [1m[35m1[m).each [31mdo[m |[1m[34mstate[m, [1m[34minput[m, [1m[34mnn[m[22;1H[33m [m[1m[34mext_state[m, [1m[34mcallback[m| [1m[31m# [m[30m[43mFIXME[m[23;63H[1m[33m[40m116,1 59%[21;5H[1;22r[m[22;1H
|
122
|
+
[1;24r[22;1H[33m117 [m[9C [1m[34m@state_transitions[m[state] ||= {}[23;63H[1m[33m[40m117,1 60%[22;5H[1;22r[m[1;1H[3M[1;24r[20;1H[33m118 [m[9C [1m[34m@state_transitions[m[state][input] = {[1m[35m:next_state[m => next_state, [1m[35m:caa[m[21;1H[33m [m[1m[35mllback[m => callback}
|
123
|
+
[33m119 [m[7C [31mend[m[23;63H[1m[33m[40m118,1 61%[20;5H[23;63H119,1 61%[22;5H[1;22r[m[22;1H
|
124
|
+
[1;24r[22;1H[33m120 [m [1m[35mend[m[23;63H[1m[33m[40m120,1 62%[22;5H[1;22r[m[22;1H
|
125
|
+
[1;24r[22;1H[33m121 [m [1m[35mend[m[23;63H[1m[33m[40m121,1 62%[22;5H[1;22r[m[22;1H
|
126
|
+
[1;24r[22;1H[33m122 [m [1m[35mend[m[23;63H[1m[33m[40m122,1 63%[22;5H[1;22r[m[22;1H
|
127
|
+
[1;24r[22;1H[33m123 [m[1m[35mend[m[23;63H[1m[33m[40m123,1 64%[22;5H[1;22r[m[22;1H
|
128
|
+
[1;24r[22;1H[33m124 [m[23;63H[1m[33m[40m124,0-1 64%[22;5H[1;22r[m[22;1H
|
129
|
+
[1;24r[22;1H[33m125 [m[23;63H[1m[33m[40m125,0-1 65%[22;5H[1;22r[m[22;1H
|
130
|
+
[1;24r[22;1H[33m126 [m[1m[35mclass[m [1m[34mTarget[m[23;63H[1m[33m[40m126,1 66%[22;5H[1;22r[m[22;1H
|
131
|
+
[1;24r[22;1H[33m127 [m[23;63H[1m[33m[40m127,0-1 66%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m128 [m [1m[34mIGNORE[m = [1m[35m%w( blink_enable blink_disable blink_off blink_on reverse_video_oo[m[22;1H[33m [m[1m[35mff dim_off dim_on )[m.map{|[1m[34mx[m| x.to_sym}[23;63H[1m[33m[40m128,1 67%[21;5H[1;22r[m[22;1H
|
132
|
+
[1;24r[22;1H[33m129 [m[23;63H[1m[33m[40m129,0-1 68%[22;5H[1;22r[m[22;1H
|
133
|
+
[1;24r[22;1H[33m130 [m [1m[35mdef[m [1m[34minitialize[m[23;63H[1m[33m[40m130,1 68%[22;5H[1;22r[m[22;1H
|
134
|
+
[1;24r[22;1H[33m131 [m [1m[34m@screen[m = [1m[34mScriptty[m::[1m[34mScreenBuffer[m.new[23;63H[1m[33m[40m131,1 69%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m132 [m [1m[35mend[m
|
135
|
+
[33m133 [m[23;63H[1m[33m[40m132,1 70%[21;5H[23;63H133,0-1 70%[22;5H[1;22r[m[22;1H
|
136
|
+
[1;24r[22;1H[33m134 [m[23;63H[1m[33m[40m134,0-1 70%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m135 [m [1m[35mdef[m [1m[34mhandle[m(name, input)
|
137
|
+
[33m136 [m [31mif[m respond_to?([1m[35m"handle_#{[mname[1m[35m}"[m)[23;63H[1m[33m[40m135,1 72%[21;5H[23;63H136,1 72%[22;5H[1;22r[m[22;1H
|
138
|
+
[1;24r[22;1H[33m137 [m send([1m[35m"handle_#{[mname[1m[35m}"[m, input)[23;63H[1m[33m[40m137,1 72%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m138 [m [31melse[m [1m[31m# DEBUG [m[30m[43mFIXME[m
|
139
|
+
[33m139 [m print [1m[35m"[#{[mname[1m[35m}]"[m[23;63H[1m[33m[40m138,1 73%[21;5H[23;63H139,1 73%[22;5H[1;22r[m[22;1H
|
140
|
+
[1;24r[22;1H[33m140 [m [31mend[m[23;63H[1m[33m[40m140,1 74%[22;5H[1;22r[m[22;1H
|
141
|
+
[1;24r[22;1H[33m141 [m [1m[34m@count[m ||= [1m[35m0[m[23;63H[1m[33m[40m141,1 75%[22;5H[1;22r[m[22;1H
|
142
|
+
[1;24r[22;1H[33m142 [m [1m[34m@count[m += [1m[35m1[m[23;63H[1m[33m[40m142,1 75%[22;5H[1;22r[m[22;1H
|
143
|
+
[1;24r[22;1H[33m143 [m [31mif[m [1m[34m@count[m % [1m[35m10[m == [1m[35m0[m[23;63H[1m[33m[40m143,1 76%[22;5H[1;22r[m[22;1H
|
144
|
+
[1;24r[22;1H[33m144 [m [1m[31m#dump[m[23;63H[1m[33m[40m144,1 76%[22;5H[1;22r[m[22;1H
|
145
|
+
[1;24r[22;1H[33m145 [m [1m[31m#gets[m[23;63H[1m[33m[40m145,1 77%[22;5H[1;22r[m[22;1H
|
146
|
+
[1;24r[22;1H[33m146 [m [31mend[m[23;63H[1m[33m[40m146,1 78%[22;5H[1;22r[m[22;1H
|
147
|
+
[1;24r[22;1H[33m147 [m [1m[35mend[m[23;63H[1m[33m[40m147,1 78%[22;5H[1;22r[m[22;1H
|
148
|
+
[1;24r[22;1H[33m148 [m[23;63H[1m[33m[40m148,0-1 79%[22;5H[1;22r[m[1;1H[2M[1;24r[21;1H[33m149 [m [1m[35mdef[m [1m[34mdump[m [1m[31m# DEBUG [m[30m[43mFIXME[m
|
149
|
+
[33m150 [m print [1m[35m"\033c"[m[23;63H[1m[33m[40m149,1 80%[21;5H[23;63H150,1 80%[22;5H[1;22r[m[22;1H
|
150
|
+
[1;24r[22;1H[33m151 [m [1m[34m@screen[m.instance_eval([1m[35m"@glyphs"[m).instance_eval([1m[35m"@lines"[m).each [31mdo[m |[1m[34mline[m|[23;63H[1m[33m[40m151,1 81%[22;5H[1;22r[m[22;1H
|
151
|
+
[1;24r[22;1H[33m152 [m puts line[23;63H[1m[33m[40m152,1 81%[22;5H[1;22r[m[22;1H
|
152
|
+
[1;24r[22;1H[33m153 [m [31mend[m[23;63H[1m[33m[40m153,1 82%[22;5H[1;22r[m[22;1H
|
153
|
+
[1;24r[22;1H[33m154 [m [1m[35mend[m[23;63H[1m[33m[40m154,1 83%[22;5H[1;22r[m[22;1H
|
154
|
+
[1;24r[22;1H[33m155 [m[23;63H[1m[33m[40m155,0-1 83%[22;5H[1;22r[m[22;1H
|
155
|
+
[1;24r[22;1H[33m156 [m [1m[35mdef[m [1m[34mhandle_literal[m(input)[23;63H[1m[33m[40m156,1 84%[22;5H[1;22r[m[22;1H
|
156
|
+
[1;24r[22;1H[33m157 [m [1m[34m@screen[m.print_char(input)[23;63H[1m[33m[40m157,1 84%[22;5H[1;22r[m[22;1H
|
157
|
+
[1;24r[22;1H[33m158 [m [1m[31m#dump[m[23;63H[1m[33m[40m158,1 85%[22;5H[1;22r[m[22;1H
|
158
|
+
[1;24r[22;1H[33m159 [m [1m[35mend[m[23;63H[1m[33m[40m159,1 86%[22;5H[1;22r[m[22;1H
|
159
|
+
[1;24r[22;1H[33m160 [m[23;63H[1m[33m[40m160,0-1 86%[22;5H[1;22r[m[22;1H
|
160
|
+
[1;24r[22;1H[33m161 [m [1m[35mdef[m [1m[34mhandle_new_line[m(input)[23;63H[1m[33m[40m161,1 87%[22;5H[1;22r[m[22;1H
|
161
|
+
[1;24r[22;1H[33m162 [m [1m[34m@screen[m.carriage_return[23;63H[1m[33m[40m162,1 88%[22;5H[1;22r[m[22;1H
|
162
|
+
[1;24r[22;1H[33m163 [m [1m[34m@screen[m.cursor_down[23;63H[1m[33m[40m163,1 88%[22;5H[1;22r[m[22;1H
|
163
|
+
[1;24r[22;1H[33m164 [m [1m[35mend[m[23;63H[1m[33m[40m164,1 89%[22;5H[1;22r[m[22;1H
|
164
|
+
[1;24r[22;1H[33m165 [m[23;63H[1m[33m[40m165,0-1 89%[22;5H[1;22r[m[22;1H
|
165
|
+
[1;24r[22;1H[33m166 [m [1m[35mdef[m [1m[34mhandle_carriage_return[m(input)[23;63H[1m[33m[40m166,1 90%[22;5H[1;22r[m[22;1H
|
166
|
+
[1;24r[22;1H[33m167 [m [1m[34m@screen[m.carriage_return[23;63H[1m[33m[40m167,1 91%[22;5H[1;22r[m[22;1H
|
167
|
+
[1;24r[22;1H[33m168 [m [1m[35mend[m[23;63H[1m[33m[40m168,1 91%[22;5H[1;22r[m[22;1H
|
168
|
+
[1;24r[22;1H[33m169 [m[23;63H[1m[33m[40m169,0-1 92%[22;5H[1;22r[m[22;1H
|
169
|
+
[1;24r[22;1H[33m170 [m [1m[35mdef[m [1m[34mhandle_erase_to_end_of_line[m(input)[23;63H[1m[33m[40m170,1 93%[22;5H[m[H[2J[1;1H[33m149 [m [1m[35mdef[m [1m[34mdump[m [1m[31m# DEBUG [m[30m[43mFIXME[m
|
170
|
+
[33m150 [m print [1m[35m"\033c"[m
|
171
|
+
[33m151 [m [1m[34m@screen[m.instance_eval([1m[35m"@glyphs"[m).instance_eval([1m[35m"@lines"[m).each [31mdo[m |[1m[34mline[m|
|
172
|
+
[33m152 [m puts line
|
173
|
+
[33m153 [m [31mend[m
|
174
|
+
[33m154 [m [1m[35mend[m
|
175
|
+
[33m155
|
176
|
+
156 [m [1m[35mdef[m [1m[34mhandle_literal[m(input)
|
177
|
+
[33m157 [m [1m[34m@screen[m.print_char(input)
|
178
|
+
[33m158 [m [1m[31m#dump[m
|
179
|
+
[33m159 [m [1m[35mend[m
|
180
|
+
[33m160
|
181
|
+
161 [m [1m[35mdef[m [1m[34mhandle_new_line[m(input)
|
182
|
+
[33m162 [m [1m[34m@screen[m.carriage_return
|
183
|
+
[33m163 [m [1m[34m@screen[m.cursor_down
|
184
|
+
[33m164 [m [1m[35mend[m
|
185
|
+
[33m165
|
186
|
+
166 [m [1m[35mdef[m [1m[34mhandle_carriage_return[m(input)
|
187
|
+
[33m167 [m [1m[34m@screen[m.carriage_return
|
188
|
+
[33m168 [m [1m[35mend[m
|
189
|
+
[33m169
|
190
|
+
170 [m [1m[35mdef[m [1m[34mhandle_erase_to_end_of_line[m(input)
|
191
|
+
[1m[33m[40mmytest.rb [RO] 170,1 93%[22;5H[1;22r[m[22;1H
|
192
|
+
[1;24r[22;1H[33m171 [m [1m[34m@screen[m.erase_to_end_of_line[23;63H[1m[33m[40m171,1 93%[22;5H[1;22r[m[22;1H
|
193
|
+
[1;24r[22;1H[33m172 [m [1m[35mend[m[23;63H[1m[33m[40m172,1 94%[22;5H[1;22r[m[22;1H
|
194
|
+
[1;24r[22;1H[33m173 [m[23;63H[1m[33m[40m173,0-1 94%[22;5H[1;22r[m[22;1H
|
195
|
+
[1;24r[22;1H[33m174 [m [1m[35mdef[m [1m[34mhandle_write_window_address[m(input)[23;63H[1m[33m[40m174,1 95%[22;5H[1;22r[m[22;1H
|
196
|
+
[1;24r[22;1H[33m175 [m[41m [m[23;63H[1m[33m[40m175,1 96%[22;5H[1;22r[m[22;1H
|
197
|
+
[1;24r[22;1H[33m176 [m [1m[35mend[m[23;63H[1m[33m[40m176,1 96%[22;5H[1;22r[m[22;1H
|
198
|
+
[1;24r[22;1H[33m177 [m[1m[35mend[m[23;63H[1m[33m[40m177,1 97%[22;5H[1;22r[m[22;1H
|
199
|
+
[1;24r[22;1H[33m178 [m[23;63H[1m[33m[40m178,0-1 98%[22;5H[1;22r[m[22;1H
|
200
|
+
[1;24r[22;1H[33m179 [mt = [1m[34mScriptty[m::[1m[34mTerm[m::[1m[34mDG410[m.new([1m[34mTarget[m.new)[23;63H[1m[33m[40m179,1 98%[22;5H[1;22r[m[22;1H
|
201
|
+
[1;24r[22;1H[33m180 [m[1m[31m#t.feed(File.read("lots_of_operations.bin"))[m[23;63H[1m[33m[40m180,1 99%[22;5H[1;22r[m[22;1H
|
202
|
+
[1;24r[22;1H[33m181 [mt.feed([1m[34mFile[m.read([1m[35m"dg410only.bin"[m))[23;63H[1m[33m[40m181,1 Bot[22;5H[23;63H180,1 Bot[21;5H[23;63H181,1 Bot[22;5H[23;63H180,1 Bot[21;5H[23;63H179,1 Bot[20;5H[m[H[2J[1;1H[33m 1 [m[1m[35m#!/usr/bin/env jruby[m
|
203
|
+
[33m 2
|
204
|
+
3 [m[1m[34m$LOAD_PATH[m.unshift [1m[35m"lib"[m
|
205
|
+
[33m 4
|
206
|
+
5 [m[1m[31m#require 'scriptty/async_sockets'[m
|
207
|
+
[33m 6 [m[1m[35mrequire[m [1m[35m'scriptty/dg410-transition-table'[m
|
208
|
+
[33m 7 [m[1m[35mrequire[m [1m[35m'scriptty/screen_buffer'[m
|
209
|
+
[33m 8
|
210
|
+
9 [m[1m[35mmodule[m [1m[34mScriptty[m
|
211
|
+
[33m 10 [m [1m[35mmodule[m [1m[34mTerm[m
|
212
|
+
[33m 11 [m [1m[35mclass[m [1m[34mDG410[m
|
213
|
+
[33m 12
|
214
|
+
13 [m [1m[35mclass[m [1m[34mProprietaryEscapeParser[m
|
215
|
+
[33m 14 [m[7C [1m[35mdef[m [1m[34minitialize[m(target)
|
216
|
+
[33m 15 [m[9C [1m[34m@target[m = target
|
217
|
+
[33m 16 [m[9C [1m[34m@state[m = [1m[35m:opcode[m
|
218
|
+
[33m 17 [m[9C [1m[34m@opcode[m = [1m[35m""[m
|
219
|
+
[33m 18 [m[9C [1m[34m@n[m = [1m[35mnil[m
|
220
|
+
[33m 19 [m[9C [1m[34m@payload[m = [1m[35m""[m
|
221
|
+
[33m 20 [m[7C [1m[35mend[m
|
222
|
+
[33m 21
|
223
|
+
22 [m[7C [1m[31m# <036> ~ <2-byte-opcode> <n> <n*bytes>[m
|
224
|
+
[1m[33m[40mmytest.rb [RO] 1,1 Top[1;5H[23;63H2,0-1 Top[2;5H[23;63H3,1 Top[3;5H[1;22r[m[1;1H[11M[1;24r[12;1H[33m 23 [m[7C [1m[35mdef[m [1m[34mfeed_byte[m(input_byte)
|
225
|
+
[33m 24 [m[9C [31mcase[m [1m[34m@state[m
|
226
|
+
[33m 25 [m[9C [31mwhen[m [1m[35m:opcode[m
|
227
|
+
[33m 26 [m[11C [1m[34m@opcode[m << input_byte
|
228
|
+
[33m 27 [m[11C [31mif[m [1m[34m@opcode[m.length >= [1m[35m2[m
|
229
|
+
[33m 28 [m[13C [1m[34m@state[m = [1m[35m:n[m
|
230
|
+
[33m 29 [m[11C [31mend[m
|
231
|
+
[33m 30 [m[9C [31mwhen[m [1m[35m:n[m
|
232
|
+
[33m 31 [m[11C [1m[34m@n[m = input_byte.unpack([1m[35m"C*"[m)[[1m[35m0[m]
|
233
|
+
[33m 32 [m[11C [31mif[m [1m[34m@n[m > [1m[35m0[m
|
234
|
+
[33m 33 [m[13C [1m[34m@state[m = [1m[35m:payload[m[23;63H[1m[33m[40m14,9 6%[3;13H[1;22r[m[1;1H[11M[1;24r[12;1H[33m 34 [m[11C [31melse[m
|
235
|
+
[33m 35 [m[13C [1m[34m@state[m = [1m[35m:done[m
|
236
|
+
[33m 36 [m[11C [31mend[m
|
237
|
+
[33m 37 [m[9C [31mwhen[m [1m[35m:payload[m
|
238
|
+
[33m 38 [m[11C [1m[34m@payload[m << input_byte
|
239
|
+
[33m 39 [m[11C [31mif[m [1m[34m@payload[m.length >= [1m[34m@n[m
|
240
|
+
[33m 40 [m[13C [1m[34m@state[m = [1m[35m:done[m
|
241
|
+
[33m 41 [m[11C [31mend[m
|
242
|
+
[33m 42 [m[9C [31melse[m
|
243
|
+
[33m 43 [m[11C [31mraise[m [1m[35m"BUG"[m
|
244
|
+
[33m 44 [m[9C [31mend[m[23;63H[1m[33m[40m25,11 13%[3;15H[1;22r[m[1;1H[11M[1;24r[12;1H[33m 45 [m[9C [31mif[m [1m[34m@state[m == [1m[35m:done[m
|
245
|
+
[33m 46 [m[11C [1m[34m@target[m.handle([1m[35m:proprietary_escape[m, [1m[35m"#{[m[1m[34m@opcode[m[1m[35m}#{[m[[1m[34m@n[m].pack([1m[35m"C*"[m))[14;1H[33m [m[1m[35m}#{[m[1m[34m@payload[m[1m[35m}"[m)
|
246
|
+
[33m 47 [m[11C [31mreturn[m [1m[35mtrue[m
|
247
|
+
[33m 48 [m[9C [31melse[m
|
248
|
+
[33m 49 [m[11C [31mreturn[m [1m[35mfalse[m
|
249
|
+
[33m 50 [m[9C [31mend[m
|
250
|
+
[33m 51 [m[7C [1m[35mend[m
|
251
|
+
[33m 52 [m [1m[35mend[m
|
252
|
+
[33m 53
|
253
|
+
54 [m [1m[35mdef[m [1m[34minitialize[m(target)[23;63H[1m[33m[40m36,13 20%[3;17H[24;1H[m:s
|
254
|
+
[33m 50[m[10C [31mend[m[17;18H[K[18;2H[33m51[m[8C [1m[35mend[m[18;16H[K[19;2H[33m52[m[6C [1m[35mend[m[19;14H[K[20;2H[33m53[m[20;11H[K[21;2H[33m54[m[6C [1m[35mdef[m [1m[34minitialize[m(target)[22;2H[33m55[m[6C [1m[34m@byte[m = [1m[35m1[m [1m[31m# DEBUG [m[30m[43mFIXME[m
|
255
|
+
[1m[33m[40mmytest.rb [RO][48C36,13 20%[3;17H[23;63H37,13 20%[4;17H[23;63H38,13 20%[5;17H[23;63H39,13 20%[6;17H[23;63H40,13 20%[7;17H[23;63H41,13 20%[8;17H[23;63H42,13 20%[9;17H[23;63H43,13 20%[10;17H[23;63H44,13 20%[11;17H[23;63H45,13 20%[12;17H[23;63H46,13 20%[13;17H[m[1;17H[K[2;19H[K[3;17H[K[4;15H[K[5;17H[K[6;17H[K[7;19H[K[8;17H[K[9;15H[K[10;17H[K[11;15H[K[12;15H[K[13;4H[33m [m[1m[34m@opcode[m[1m[35m}#{[m[[1m[34m@n[m].pack([1m[35m"C*"[m)[1m[35m}#{[m[1m[34m@payload[m[1m[35m}"[m[46m)[m[13;44H[K[14;17H[K[15;15H[K[16;17H[K[17;15H[K[18;13H[K[19;11H[K[21;11H[K[22;13H[K[23;1H[1m[33m[40mmytest.rb [RO][48C46,90 20%[13;43H[m)[23;63H[1m[33m[40m46,89 20%[13;42H[m[13;32H[1m[35m[46m{[m[1m[34m@payload[m[1m[35m[46m}[m[1m[35m"[m)[23;63H[1m[33m[40m46,88 20%[13;41H[m[13;32H[1m[35m{[m[1m[34m@payload[m[1m[35m}"[m)[23;63H[1m[33m[40m46,87 20%[13;40H[23;63H46,86 20%[13;39H[23;63H46,85 20%[13;38H[23;63H46,84 20%[13;37H[23;63H46,83 20%[13;36H[23;63H46,82 20%[13;35H[23;63H46,81 20%[13;34H[23;63H46,80 20%[13;33H[m[1m[35m[46m{[m[1m[34m@payload[m[1m[35m[46m}[m[1m[35m"[m)[23;63H[1m[33m[40m46,79 20%[13;32H[m[1m[35m{[m[1m[34m@payload[m[1m[35m}"[m)[23;63H[1m[33m[40m46,78 20%[13;31H[m[13;14H[1m[35m[46m{[m[[14C[1m[35m[46m}[m[1m[35m#{[m[1m[34m@payload[m[1m[35m}"[m)[23;63H[1m[33m[40m46,77 20%[13;30H[m[13;14H[1m[35m{[m[[8C[46m([4C)[m[1m[35m}#{[m[1m[34m@payload[m[1m[35m}"[m)[23;63H[1m[33m[40m46,76 20%[13;29H[m([4C)[23;63H[1m[33m[40m46,75 20%[13;28H[23;63H46,74 20%[13;27H[23;63H46,73 20%[13;26H[23;63H46,72 20%[13;25H[m[46m([4C)[m[23;63H[1m[33m[40m46,71 20%[13;24H[m([4C)[23;63H[1m[33m[40m46,70 20%[13;23H[23;63H46,69 20%[13;22H[23;63H46,68 20%[13;21H[23;63H46,67 20%[13;20H[23;63H46,66 20%[13;19H[m[46m[[2C][m[23;63H[1m[33m[40m46,65 20%[13;18H[m[[2C][23;63H[1m[33m[40m46,64 20%[13;17H[23;63H46,63 20%[13;16H[m[46m[[2C][m[23;63H[1m[33m[40m46,62 20%[13;15H[m[1m[35m[46m{[m[[2C][11C[1m[35m[46m}[m[1m[35m#{[m[1m[34m@payload[m[1m[35m}"[m)[23;63H[1m[33m[40m46,61 20%[13;14H[m[1m[35m{[m[[14C[1m[35m}#{[m[1m[34m@payload[m[1m[35m}"[m)[23;63H[1m[33m[40m46,60 20%[13;13H[m[1m[35m[46m}[m[1m[35m#{[m[[23;63H[1m[33m[40m46,59 20%[13;12H[m[1m[35m}#{[m[[23;63H[1m[33m[40m46,58 20%[13;11H[23;63H46,57 20%[13;10H[23;63H46,56 20%[13;9H[23;63H46,55 20%[13;8H[23;63H46,54 20%[13;7H[23;63H46,53 20%[13;6H[23;63H46,52 20%[13;5H[m[1;4H[33m [m[31melse[m[2;6H [1m[34m@state[m = [1m[35m:done[m[3;4H[33m [m[31mend[m[4;4H[33m [m[31men[m [1m[35m:payload[m[5;4H[33m [m[1m[34m@payload[m << input_byte[6;4H[33m [m[31mif[m [1m[34m@payload[m.length >= [1m[34m@n[m[7;6H [1m[34m@state[m = [1m[35m:done[m[8;4H[33m [m[31mend[m[9;4H[33m [m[31mse[m[10;4H[33m [m[31mraise[m [1m[35m"BUG"[m[11;4H[33m [m[31md[m[12;5H [1m[34m@state[m == [1m[35m:done[m[13;5H[1m[34m@target[m.handle([1m[35m:proprietary_escape[m, [1m[35m"#[m[1m[35m[46m{[m[1m[34m@opcode[m[1m[35m[46m}[m[1m[35m#{[m[[1m[34m@n[m].pack([1m[35m"C*"[m)[1m[35m}#{[m[1m[34m@payload[m[1m[35m}[m[14;4H[33m [m[31mreturn[m [1m[35mtrue[m[15;4H[33m [m[31mse[m[16;4H[33m [m[31mreturn[m [1m[35mfalse[m[17;4H[33m [m[31md[m[21;4H[33m [m[1m[34mitialize[m(target)[22;4H[33m [m[1m[34me[m = [1m[35m1[m [1m[31m# DEBUG [m[30m[43mFIXME[m
|
256
|
+
[1m[33m[40mmytest.rb [RO][48C46,51 20%[13;43H[m[1m[35m{[m[1m[34m@opcode[m[1m[35m}#{[m[[23;63H[1m[33m[40m46,50 20%[13;42H[23;63H46,49 20%[13;41H[23;63H46,48 20%[13;40H[23;63H46,47 20%[13;39H[23;63H46,46 20%[13;38H[23;63H46,45 20%[13;37H[23;63H46,44 20%[13;36H[23;63H46,43 20%[13;35H[23;63H46,42 20%[13;34H[23;63H46,41 20%[13;33H[23;63H46,40 20%[13;32H[23;63H46,39 20%[13;31H[23;63H46,38 20%[13;30H[23;63H46,37 20%[13;29H[23;63H46,36 20%[13;28H[23;63H46,35 20%[13;27H[23;63H46,34 20%[13;26H[23;63H46,33 20%[13;25H[23;63H46,32 20%[13;24H[23;63H46,31 20%[13;23H[23;63H46,30 20%[13;22H[23;63H46,29 20%[13;21H[23;63H46,28 20%[13;20H[m[46m([m[23;63H[1m[33m[40m46,27 20%[13;19H[m([23;63H[1m[33m[40m46,26 20%[13;18H[23;63H46,25 20%[13;17H[23;63H46,24 20%[13;16H[23;63H46,23 20%[13;15H[23;63H46,22 20%[13;14H[23;63H46,21 20%[13;13H[23;63H46,20 20%[13;12H[23;63H46,19 20%[13;11H[23;63H46,18 20%[13;10H[23;63H46,17 20%[13;9H[23;63H46,16 20%[13;8H[23;63H46,15 20%[13;7H[23;63H46,14 20%[13;6H[23;63H46,13 20%[13;5H[m[1;4H[33m [m [7C [31melse[m[2;6H [1m[34m@state[m = [1m[35m:done[m[3;4H[33m [m [8C [31mend[m[4;4H[33m [m [31mwhen[m [1m[35m:payload[m[5;4H[33m [m [1m[34m@payload[m << input_byte[6;4H[33m [m [31mif[m [1m[34m@payload[m.length >= [1m[34m@n[m[7;6H [1m[34m@state[m = [1m[35m:done[m[8;4H[33m [m [8C [31mend[m[9;4H[33m [m [7C [31melse[m[10;4H[33m [m [31mraise[m [1m[35m"BUG"[m[11;4H[33m [m [8C [31mend[m[12;5H [31mif[m [1m[34m@state[m == [1m[35m:done[m[13;4H[33m [m [1m[34m@target[m.handle([1m[35m:proprietary_escape[m, [1m[35m"#{[m[1m[34m@opcode[m[1m[35m}#{[m[[1m[34m@n[m].pack([1m[35m"C*"[m)[14;4H[33m [m [31mreturn[m [1m[35mtrue[m[15;4H[33m [m [7C [31melse[m[16;4H[33m [m [31mreturn[m [1m[35mfalse[m[17;4H[33m [m [8C [31mend[m[18;12H [1m[35mend[m[19;10H [1m[35mend[m[21;4H[33m [m [1m[35mdef[m [1m[34minitialize[m(target)[22;4H[33m [m [1m[34m@byte[m = [1m[35m1[m [1m[31m# DEBUG [m[30m[43mFIXME[m
|
257
|
+
[1m[33m[40mmytest.rb [RO][48C46,12 20%[13;16H[23;63H46,11 20%[13;15H[23;63H46,10 20%[13;14H[23;63H46,9 20%[13;13H[23;63H46,8 20%[13;12H[23;63H46,7 20%[13;11H[23;63H46,6 20%[13;10H[23;63H46,5 20%[13;9H[23;63H46,4 20%[13;8H[23;63H46,3 20%[13;7H[23;63H46,2 20%[13;6H[23;63H46,1 20%[13;5H[m[24;1H[K[24;1H:q
|
258
|
+
dwaynelitzenberger$
|
259
|
+
iMac-002:[94m~/components/scriptty/main[39m
|
260
|
+
dwaynelitzenberger$ exit
|
261
|
+
|
262
|
+
Script done on Mon Mar 1 17:15:28 2010
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
|
4
|
+
require 'rubygems'
|
5
|
+
require 'scriptty/term/xterm'
|
6
|
+
|
7
|
+
t = ScripTTY::Term::XTerm.new
|
8
|
+
print "\ec" # reset
|
9
|
+
delay = ARGV[1] ? ARGV[1].to_f : 0.001
|
10
|
+
File.read(ARGV[0] || "captures/xterm-overlong-line-prompt.bin").split("").each { |byte|
|
11
|
+
t.feed_byte(byte)
|
12
|
+
print "\e[H" + t.text.join("\n") + "\n"
|
13
|
+
row, col = t.cursor_pos
|
14
|
+
print "\e[#{row+1};#{col+1}H"
|
15
|
+
$stdout.flush
|
16
|
+
if delay > 0
|
17
|
+
sleep delay
|
18
|
+
end
|
19
|
+
}
|