create rasterize(), and tests for that.
[language-befunge-vector-xs.git] / lib / Language / Befunge / Vector / XS.pm
blob0d371f0ce0af55329a40f04e96f90641f8e52b35
2 # This file is part of Language::Befunge::Vector::XS.
3 # Copyright (c) 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::Vector::XS;
12 use strict;
13 use warnings;
15 use overload
16 '=' => \&copy,
17 '+' => \&_add,
18 '-' => \&_substract,
19 'neg' => \&_invert,
20 '+=' => \&_add_inplace,
21 '-=' => \&_substract_inplace,
22 '<=>' => \&_compare,
23 '""' => \&as_string;
25 our $VERSION = '1.0.0';
27 require XSLoader;
28 XSLoader::load('Language::Befunge::Vector::XS', $VERSION);
30 # Preloaded methods go here.
32 sub as_string {
33 my $self = shift;
34 local $" = ',';
35 return "(@$self)";
40 __END__
42 =head1 NAME
44 Language::Befunge::Vector::XS - Language::Befunge::Vector rewritten for speed
48 =head1 DESCRIPTION
50 The C<Language::Befunge> module makes heavy use of n-dims vectors,
51 mapped to the C<Language::Befunge::Vector> class. This allows to
52 abstract the funge dimension while still keeping the same code for the
53 operations.
55 However, such an heavy usage does have some impact on the performances.
56 Therefore, this modules is basically a rewrite of LBV in XS. If
57 installed, then LBV will automagically load it and replace its own
58 functions with the XS ones.
62 =head1 METHODS
64 This module implements exactly the same api as LBV. Please refer to this
65 module for more information on the following methods:
67 =over 4
69 =item new()
71 =item new_zeroes()
73 =item copy()
75 =item as_string()
77 =item get_dims()
79 =item get_component()
81 =item get_all_components()
83 =item clear()
85 =item set_component()
87 =item bounds_check()
89 =item rasterize()
91 =item standard mathematical operations
93 =item inplace mathematical operations
95 =item comparison operations
97 =back
100 =head1 SEE ALSO
102 L<Language::Befunge::Vector>
105 =head1 AUTHOR
107 Jerome Quelin, E<lt>jquelin@cpan.orgE<gt>
109 Development is discussed on E<lt>language-befunge@mongueurs.netE<gt>
112 =head1 COPYRIGHT & LICENSE
114 Copyright (c) 2008 Jerome Quelin, all rights reserved.
116 This program is free software; you can redistribute it and/or modify
117 it under the same terms as Perl itself.
120 =cut