Skip to content

Commit

Permalink
Use a common prefix for all p5helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Aug 26, 2014
1 parent 9ed2395 commit e8086f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Inline/Perl5.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ BEGIN {
}

class PerlInterpreter is repr('CPointer') {
sub Perl_SvIOK(PerlInterpreter, OpaquePointer)
sub p5_SvIOK(PerlInterpreter, OpaquePointer)
is native($p5helper)
returns Int { * }
sub Perl_SvPOK(PerlInterpreter, OpaquePointer)
sub p5_SvPOK(PerlInterpreter, OpaquePointer)
is native($p5helper)
returns Int { * }
sub Perl_sv_iv(PerlInterpreter, OpaquePointer)
is native('/usr/lib/perl5/5.18.1/x86_64-linux-thread-multi/CORE/libperl.so')
returns Int { * }
sub sv_to_char_star(PerlInterpreter, OpaquePointer)
sub p5_sv_to_char_star(PerlInterpreter, OpaquePointer)
is native($p5helper)
returns Str { * }
sub Perl_eval_pv(PerlInterpreter, Str, Int)
Expand All @@ -29,11 +29,11 @@ class PerlInterpreter is repr('CPointer') {

method run($perl) {
my $res = Perl_eval_pv(self, $perl, 1);
if Perl_SvIOK(self, $res) {
if p5_SvIOK(self, $res) {
return Perl_sv_iv(self, $res);
}
if Perl_SvPOK(self, $res) {
return sv_to_char_star(self, $res);
if p5_SvPOK(self, $res) {
return p5_sv_to_char_star(self, $res);
}
return $res;
}
Expand All @@ -43,4 +43,4 @@ class PerlInterpreter is repr('CPointer') {
}
}

sub init_perl() is export is native($p5helper) returns PerlInterpreter { * }
sub p5_init_perl() is export is native($p5helper) returns PerlInterpreter { * }
2 changes: 1 addition & 1 deletion inline_perl5.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use lib '.';
use Inline::Perl5;

my $i = init_perl();
my $i = p5_init_perl();
say $i.run('
use 5.10.0;
Expand Down
8 changes: 4 additions & 4 deletions p5helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ EXTERN_C void xs_init(pTHX) {
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
}

PerlInterpreter *init_perl() {
PerlInterpreter *p5_init_perl() {
char *embedding[] = { "", "-e", "0" };
PERL_SYS_INIT3(0, NULL, NULL);
my_perl = perl_alloc();
Expand All @@ -24,16 +24,16 @@ PerlInterpreter *init_perl() {
return my_perl;
}

int Perl_SvIOK(PerlInterpreter *my_perl, SV* sv) {
int p5_SvIOK(PerlInterpreter *my_perl, SV* sv) {
return SvIOK(sv);
}

int Perl_SvPOK(PerlInterpreter *my_perl, SV* sv) {
int p5_SvPOK(PerlInterpreter *my_perl, SV* sv) {
return SvPOK(sv);
}


char* sv_to_char_star(PerlInterpreter *my_perl, SV *sv) {
char *p5_sv_to_char_star(PerlInterpreter *my_perl, SV *sv) {
STRLEN len;
char *ptr;
ptr = SvPV(sv, len);
Expand Down

0 comments on commit e8086f9

Please sign in to comment.