| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# This file is part of Language::Befunge. |
|
3
|
|
|
|
|
|
|
# Copyright (c) 2001-2009 Jerome Quelin, all rights reserved. |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
6
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Language::Befunge::lib::BOOL; |
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
4037
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
292
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
1
|
|
sub new { return bless {}, shift; } |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# -- bit operations |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
# $v = A( $a, $b ) |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
# push $a and $b back onto the stack (logical AND) |
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
sub A { |
|
27
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
|
28
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip(); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# pop the values |
|
31
|
0
|
|
|
|
|
|
my $b = $ip->spop; |
|
32
|
0
|
|
|
|
|
|
my $a = $ip->spop; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# push the result |
|
35
|
0
|
|
0
|
|
|
|
$ip->spush( $a and $b ); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# |
|
40
|
|
|
|
|
|
|
# $v = N( $a ) |
|
41
|
|
|
|
|
|
|
# |
|
42
|
|
|
|
|
|
|
# push not $a back onto the stack (logical NOT) |
|
43
|
|
|
|
|
|
|
# |
|
44
|
|
|
|
|
|
|
sub N { |
|
45
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
|
46
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip(); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# pop the values |
|
49
|
0
|
|
|
|
|
|
my $a = $ip->spop; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# push the result |
|
52
|
0
|
|
|
|
|
|
$ip->spush( not $a ); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# |
|
57
|
|
|
|
|
|
|
# $v = O( $a, $b ) |
|
58
|
|
|
|
|
|
|
# |
|
59
|
|
|
|
|
|
|
# push $a or $b back onto the stack (logical OR) |
|
60
|
|
|
|
|
|
|
# |
|
61
|
|
|
|
|
|
|
sub O { |
|
62
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
|
63
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip(); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# pop the values |
|
66
|
0
|
|
|
|
|
|
my $b = $ip->spop; |
|
67
|
0
|
|
|
|
|
|
my $a = $ip->spop; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# push the result |
|
70
|
0
|
|
0
|
|
|
|
$ip->spush( $a or $b ); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# |
|
76
|
|
|
|
|
|
|
# $v = X( $a, $b ) |
|
77
|
|
|
|
|
|
|
# |
|
78
|
|
|
|
|
|
|
# push $a xor $b back onto the stack (logical XOR) |
|
79
|
|
|
|
|
|
|
# |
|
80
|
|
|
|
|
|
|
sub X { |
|
81
|
0
|
|
|
0
|
1
|
|
my ($self, $interp) = @_; |
|
82
|
0
|
|
|
|
|
|
my $ip = $interp->get_curip(); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# pop the values |
|
85
|
0
|
|
|
|
|
|
my $b = $ip->spop; |
|
86
|
0
|
|
|
|
|
|
my $a = $ip->spop; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# push the result |
|
89
|
0
|
|
0
|
|
|
|
$ip->spush( $a xor $b ); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |