2 # This file is part of Language::Befunge.
3 # Copyright (c) 2001-2008 Jerome Quelin, all rights reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the same terms as Perl itself.
10 package Language
::Befunge
::lib
::ORTH
;
15 use Language
::Befunge
::Vector
;
17 sub new
{ return bless {}, shift; }
22 my ($self, $interp) = @_;
23 my $ip = $interp->get_curip();
34 my ($self, $interp) = @_;
35 my $ip = $interp->get_curip();
46 my ($self, $interp) = @_;
47 my $ip = $interp->get_curip();
61 my ($self, $lbi) = @_;
62 my $ip = $lbi->get_curip;
66 my $v = Language
::Befunge
::Vector
->new($x,$y);
67 my $val = $lbi->storage->get_value( $v );
72 my ($self, $lbi) = @_;
73 my $ip = $lbi->get_curip;
77 my $v = Language
::Befunge
::Vector
->new($x,$y);
79 $lbi->storage->set_value( $v, $val );
86 my ($self, $lbi) = @_;
87 print $lbi->get_curip->spop_gnirts;
91 # -- coordinates & velocity changes
94 my ($self, $lbi) = @_;
95 my $ip = $lbi->get_curip;
96 my $v = $ip->get_position;
98 $v->set_component(0,$x);
102 my ($self, $lbi) = @_;
103 my $ip = $lbi->get_curip;
104 my $v = $ip->get_position;
106 $v->set_component(1,$y);
110 my ($self, $lbi) = @_;
111 my $ip = $lbi->get_curip;
112 my $v = $ip->get_delta;
114 $v->set_component(0,$dx);
118 my ($self, $lbi) = @_;
119 my $ip = $lbi->get_curip;
120 my $v = $ip->get_delta;
122 $v->set_component(1,$dy);
129 my ($self, $lbi) = @_;
130 my $ip = $lbi->get_curip;
132 $lbi->_move_ip_once($ip) if $v == 0;
143 Language::Befunge::IP::lib::ORTH - Orthogonal Easement Library
149 The ORTH fingerprint (0x4f525448) is designed to ease transition between the
150 Orthogonal programming language and Befunge-98 (or higher dimension Funges).
152 Even if transition from Orthogonal is not an issue, the ORTH library contains
153 some potentially interesting instructions not in standard Funge-98.
161 Create a new ORTH instance.
164 =head2 Bit operations
170 Push back C<$a & $b> (bitwise AND).
175 Push back C<$a | $b> (bitwise OR).
180 Push back C<$a ^ $b> (bitwise XOR).
193 Push back value stored at coords ($x, $y). Note that Befunge get is C<g($x,$y)>
194 (ie, the arguments are reversed).
197 =item P( $v, $y, $x )
199 Store value C<$v> at coords ($x, $y). Note that Befunge put is C<p($v,$x,$y)> (ie,
200 the coordinates are reversed).
213 Print popped 0gnirts on STDOUT.
219 =head2 Coordinates & velocity changes
225 Change X coordinate of IP to C<$x>.
230 Change Y coordinate of IP to C<$y>.
235 Change X coordinate of IP velocity to C<$dx>.
240 Change Y coordinate of IP velocity to C<$dy>.
249 L<Language::Befunge>, L<http://www.muppetlabs.com/~breadbox/orth/orth.html>
250 and L<http://catseye.tc/projects/funge98/library/ORTH.html>
255 Jerome Quelin, C<< <jquelin@cpan.org> >>
258 =head1 COPYRIGHT & LICENSE
260 Copyright (c) 2001-2008 Jerome Quelin, all rights reserved.
262 This program is free software; you can redistribute it and/or modify
263 it under the same terms as Perl itself.