Jerome Quelin > Language-Befunge > Language::Befunge::lib::SUBR

Download:
Language-Befunge-4.13.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

Language::Befunge::IP::lib::SUBR - subroutines extension

DESCRIPTION ^

The SUBR fingerprint (0x53554252) allows to use subroutines within befunge.

FUNCTIONS ^

new

Create a new SUBR instance.

Subroutines

J( $vector )

Pop a $vector from the stack, and jump inconditionally to this location. The velocity will be forced to (1,0) (or the equivalent for other dimensions).

($from, $velocity, @stack) = C( $vector, $count )

Call a subroutine. In details, pop a $count and a $vector from the stack. Then pop $count elements from the stack, push current position, current velocity and the $count elements popped back on the stack. Then jump to the $vector address with a velocity of (1,0) (or the equivalent for other dimensions). This function is supposed to be called in conjunction with R.

(@stack) = R($from, $velocity, @stack, $count)

Return from subroutine (supposed to be called after a call to C). Pop a $count from the stack, then $count elements from the stack. Pop then 2 vectors, and push back the $count elements on the stack. Then restore the velocity from the first vector popped, and jump back to address it went from (the second vector popped).

Address mode

Function C and J pop a vector from the stack to jump to this address. However, the vector popped can be either absolute or relative to the storage offset. Default mode is absolute addressing, but one can switch with the following functions:

A()

Switch in absolute mode.

O()

Switch in relative mode.

SEE ALSO ^

Language::Befunge, http://www.rcfunge98.com/rcsfingers.html#SUBR.

AUTHOR ^

Jerome Quelin, <jquelin@cpan.org>

COPYRIGHT & LICENSE ^

Copyright (c) 2001-2009 Jerome Quelin, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: