Skip to content

Commit

Permalink
Turn p5 undef into Nil.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Jan 18, 2012
1 parent 0f93f81 commit 9856167
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Perl5Interpreter.cs
Expand Up @@ -37,6 +37,9 @@ public class Perl5Interpreter : IForeignInterpreter {
[DllImport("obj/p5embed.so", EntryPoint="p5embed_SvPOKp")]
public static extern int SvPOKp(IntPtr sv);

[DllImport("obj/p5embed.so", EntryPoint="p5embed_SvOK")]
public static extern int SvOK(IntPtr sv);

[DllImport("obj/p5embed.so", EntryPoint="p5embed_newSVpvn")]
public static extern IntPtr newSVpvn(IntPtr s,int length);

Expand Down Expand Up @@ -64,6 +67,10 @@ int argument_n
//TODO: check - cargo culted
return Kernel.NilP.mo.typeVar;
}
if (SvOK(sv) == 0) {
return Kernel.NilP.mo.typeVar;
}

if (SvIOKp(sv) != 0) {
return Builtins.MakeInt(SvIV(sv));
} else if (SvNOKp(sv) != 0) {
Expand Down
3 changes: 3 additions & 0 deletions lib/p5embed.c
Expand Up @@ -116,6 +116,9 @@ int p5embed_SvNOKp(SV* sv) {
int p5embed_SvPOKp(SV* sv) {
return SvPOKp(sv);
}
int p5embed_SvOK(SV* sv) {
return SvOK(sv);
}

int p5embed_SvIV(SV* sv) {
return SvIV(sv);
Expand Down
1 change: 1 addition & 0 deletions t/spectest_p5.data
@@ -1,3 +1,4 @@
S01-perl-5-integration/subs.t
S01-perl-5-integration/strings.t
S01-perl-5-integration/context.t
S01-perl-5-integration/undef.t

0 comments on commit 9856167

Please sign in to comment.