Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unbitrot perl5 interopability.
  • Loading branch information
pmurias committed Jan 14, 2012
1 parent c102694 commit 59c6a7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -56,8 +56,8 @@ obj/Kernel.dll: $(patsubst %,lib/%,$(cskernel)) lib/unidata
/res:lib/unidata $(patsubst %,lib/%,$(cskernel))

perl5: obj/Perl5Interpreter.dll obj/p5embed.so
obj/Perl5Interpreter.dll: obj/Kernel.dll lib/Perl5Interpreter.cs
$(CSC) /target:library /lib:obj /out:obj/Perl5Interpreter.dll /r:Kernel.dll lib/Perl5Interpreter.cs
obj/Perl5Interpreter.dll: obj/Run.Kernel.dll lib/Perl5Interpreter.cs
$(CSC) /target:library /lib:obj /out:obj/Perl5Interpreter.dll /r:Run.Kernel.dll lib/Perl5Interpreter.cs

obj/p5embed.so: lib/p5embed.c
cc -shared -o obj/p5embed.so lib/p5embed.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
Expand Down
10 changes: 10 additions & 0 deletions lib/Perl5Interpreter.cs
@@ -1,6 +1,7 @@
using Niecza;
using System.Runtime.InteropServices;
using System;
using Niecza.Serialization;

public class Perl5Interpreter : IForeignInterpreter {
[DllImport("obj/p5embed.so", EntryPoint="p5embed_initialize")]
Expand Down Expand Up @@ -83,6 +84,9 @@ public class SVVariable : Variable {
return Kernel.BoxAnyMO<Variable>(this, Kernel.ScalarMO);

}
public override void Freeze(FreezeBuffer fb) {
throw new NieczaException("Freezing perl5 SV* NYI.");
}
}
public class SVany : P6any {
[DllImport("obj/p5embed.so", EntryPoint="p5method_call")]
Expand All @@ -92,6 +96,10 @@ public class SVany : P6any {
int argument_n
);

public override void Freeze(FreezeBuffer fb) {
throw new NieczaException("Freezing perl5 SV* NYI.");
}

public static IntPtr VariableToSV(Variable var) {
P6any obj = var.Fetch();
if (obj is SVany) {
Expand Down Expand Up @@ -150,6 +158,8 @@ int argument_n
return caller;
}

public override string ReprName() { return "P6opaque"; }

public SVany(IntPtr _sv) {
mo = Kernel.AnyMO;
sv = _sv;
Expand Down

0 comments on commit 59c6a7b

Please sign in to comment.