line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::Rezrov::ZReceiver; |
2
|
|
|
|
|
|
|
# stub ZIO used for redirecting output. |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub new { |
5
|
0
|
|
|
0
|
0
|
|
my ($type) = @_; |
6
|
0
|
|
|
|
|
|
my $self = {}; |
7
|
0
|
|
|
|
|
|
bless $self, $type; |
8
|
0
|
|
|
|
|
|
$self->reset(); |
9
|
0
|
|
|
|
|
|
return $self; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub write_zchar { |
13
|
|
|
|
|
|
|
# print STDERR "received: " . chr($_[1]); |
14
|
0
|
|
|
0
|
0
|
|
$_[0]->{"buffer"} .= chr($_[1]); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub buffer { |
18
|
0
|
|
|
0
|
0
|
|
return $_[0]->{"buffer"}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub reset { |
22
|
0
|
|
|
0
|
0
|
|
$_[0]->{"buffer"} = ""; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub misc { |
26
|
|
|
|
|
|
|
# misc info for this object; hack used in stream3 redirection |
27
|
0
|
0
|
|
0
|
0
|
|
$_[0]->{"misc"} = $_[1] if defined $_[1]; |
28
|
0
|
|
|
|
|
|
return $_[0]->{"misc"}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub buffer_zchar { |
32
|
0
|
|
|
0
|
0
|
|
$_[0]->{"buffer"} .= chr($_[1]); |
33
|
|
|
|
|
|
|
# printf STDERR "redirect: %s\n", chr($_[1]); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub buffer_zchunk { |
37
|
0
|
|
|
0
|
0
|
|
$_[0]->{"buffer"} .= ${$_[1]}; |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
0
|
|
sub flush { |
41
|
|
|
|
|
|
|
# $_[0]->{"buffer"} .= $_; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub newline { |
45
|
|
|
|
|
|
|
# z-char for newline |
46
|
0
|
|
|
0
|
0
|
|
$_[0]->{"buffer"} .= chr(Games::Rezrov::ZConst::Z_NEWLINE()); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|