=encoding UTF-8 =head1 NAME SPVM - Fast Calculation and Easy C/C++ Binding with perlish syntax and static typing B =head1 SYNOPSIS =head2 Fast Array Operation using SPVM. SPVM Module: # lib/SPVM/MyMath.spvm package MyMath { # Sub Declaration sub sum ($nums : int[]) : int { # Culcurate total my $total = 0; for (my $i = 0; $i < @$nums; $i++) { $total += $nums->[$i]; } return $total; } } Use SPVM Module from Perl use FindBin; use lib "$FindBin::Bin/lib"; # Use SPVM module use SPVM 'MyMath'; # New SPVM int array my $sp_nums = SPVM::new_int_array([3, 6, 8, 9]); # Call SPVM subroutine my $total = SPVM::MyMath::sum($sp_nums); print $total . "\n"; If you know more SPVM syntax, see L. If you know more Functions to convert Perl Data to SPVM Data, see L. =head2 C Extension using SPVM SPVM Module: # lib/SPVM/MyMathNative.spvm package MyMathNative { # Sub Declaration sub sum ($nums : int[]) : native int; } C Source File; // lib/SPVM/MyMathNative.native/MyMathNative.c #include int32_t SPVM__MyMathNative__sum(SPVM_API* api, SPVM_API_VALUE* args) { // First argument SPVM_API_OBJECT* sp_nums = args[0].object_value; // Array length int32_t length = api->get_array_length(api, sp_nums); // Elements pointer int32_t* nums = api->get_int_array_elements(api, sp_nums); // Culcurate total int32_t total = 0; { int32_t i; for (i = 0; i < length; i++) { total += nums[i]; } } return total; } Use Extension Module from Perl: use FindBin; use lib "$FindBin::Bin/lib"; # Use SPVM module use SPVM 'MyMathNative'; # New SPVM int array my $sp_nums = SPVM::new_int_array([3, 6, 8, 9]); # Call SPVM subroutine my $total = SPVM::MyMathNative::sum($sp_nums); print $total . "\n"; If you know more SPVM Extension, see L. If you know the APIs to manipulate SPVM data, see L. =head1 DESCRIPTION SPVM provide Fast Culcuration and Easy way to Bind C/C++ Language to Perl. =over 4 =item * B - The Perl's biggest weak point is the calculation performance. SPVM provides fast calculations. =item * B - You don't need to care about freeing memory =item * B - Static typing for performance =item * B - Byte codes are generated so that you can run them on SPVM language =item * B - SPVM syntax is very similar to Perl =item * B - SPVM function can be called from Perl itself. =back If you learn more SPVM, see L Documentation. =head1 AUTHOR Yuki Kimoto Ekimoto.yuki@gmail.com =head1 CONTRIBUTERS =over 4 =item * L (Koichi Murase) =item * L<[NAGAYASU Shinya|https://github.com/nagayasu-shinya> =item * L =item * L =item * L =back =head1 COPYRIGHT AND LICENSE Copyright (C) 2017 by Yuki Kimoto This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.3 or, at your option, any later version of Perl 5 you may have available. =cut