Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Turn p5 undef into Nil.

  • Loading branch information...
commit 98561676f4dbab8788ad07a5acc3db8f1b919997 1 parent 0f93f81
@pmurias pmurias authored
Showing with 11 additions and 0 deletions.
  1. +7 −0 lib/Perl5Interpreter.cs
  2. +3 −0  lib/p5embed.c
  3. +1 −0  t/spectest_p5.data
View
7 lib/Perl5Interpreter.cs
@@ -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);
@@ -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) {
View
3  lib/p5embed.c
@@ -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);
View
1  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
Please sign in to comment.
Something went wrong with that request. Please try again.