From 74ece704fd30248c5ccf131ee500f276883a34e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Quelin?= Date: Tue, 11 Nov 2008 16:05:10 +0100 Subject: [PATCH] new extnesion ROMA --- MANIFEST | 1 + lib/Language/Befunge/lib/ROMA.pm | 79 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 lib/Language/Befunge/lib/ROMA.pm diff --git a/MANIFEST b/MANIFEST index 9e53921..66f292b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -21,6 +21,7 @@ lib/Language/Befunge/lib/HELO.pm lib/Language/Befunge/lib/NULL.pm lib/Language/Befunge/lib/ORTH.pm lib/Language/Befunge/lib/PERL.pm +lib/Language/Befunge/lib/ROMA.pm lib/Language/Befunge/lib/TEST.pm lib/Language/Befunge/Ops.pm lib/Language/Befunge/Ops/Befunge98.pm diff --git a/lib/Language/Befunge/lib/ROMA.pm b/lib/Language/Befunge/lib/ROMA.pm new file mode 100644 index 0000000..817f926 --- /dev/null +++ b/lib/Language/Befunge/lib/ROMA.pm @@ -0,0 +1,79 @@ +# +# This file is part of Language::Befunge. +# Copyright (c) 2001-2008 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. +# +# + +package Language::Befunge::lib::ROMA; + +use strict; +use warnings; + +use Language::Befunge::Vector; + +sub new { return bless {}, shift; } + +sub C { $_[1]->get_curip->spush(100); } +sub D { $_[1]->get_curip->spush(500); } +sub I { $_[1]->get_curip->spush(1); } +sub L { $_[1]->get_curip->spush(50); } +sub M { $_[1]->get_curip->spush(1000); } +sub V { $_[1]->get_curip->spush(5); } +sub X { $_[1]->get_curip->spush(10); } + + +1; + +__END__ + + +=head1 NAME + +Language::Befunge::IP::lib::ROMA - Roman numerals library + + + +=head1 DESCRIPTION + +The ROMA fingerprint (0x524f4d41) allows to get standard values of roman +numbers. Note that the new instructions will just push digits, you still +have to do the arithmetic yourself. Executing MCMLXXXIV will not leave 1984 +on the stack. But executing C should. + + +=head1 FUNCTIONS + +=head2 new + +Create a new ROMA instance. + + +=head2 C D I L M V X + +Push the corresponding roman value (M=1000, D=500, etc.) onto the stack. + + + +=head1 SEE ALSO + +L, L. + + + +=head1 AUTHOR + +Jerome Quelin, C<< >> + + +=head1 COPYRIGHT & LICENSE + +Copyright (c) 2001-2008 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. + + +=cut -- 2.11.4.GIT