You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2013/06/04 20:23:00 UTC

[lucy-commits] [05/13] git commit: refs/heads/master - Add a Perl binding for Lucy::Util::Freezer.

Add a Perl binding for Lucy::Util::Freezer.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/201a9d6f
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/201a9d6f
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/201a9d6f

Branch: refs/heads/master
Commit: 201a9d6f396f07cca1a89fd70873a047395a12ed
Parents: 60aafbd
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon May 20 18:02:05 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Tue Jun 4 11:13:47 2013 -0700

----------------------------------------------------------------------
 perl/buildlib/Lucy/Build/Binding/Util.pm |   31 +++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/201a9d6f/perl/buildlib/Lucy/Build/Binding/Util.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Util.pm b/perl/buildlib/Lucy/Build/Binding/Util.pm
index 6820869..5e42150 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -22,6 +22,7 @@ $VERSION = eval $VERSION;
 sub bind_all {
     my $class = shift;
     $class->bind_debug;
+    $class->bind_freezer;
     $class->bind_indexfilenames;
     $class->bind_memorypool;
     $class->bind_priorityqueue;
@@ -110,6 +111,36 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
+sub bind_freezer {
+    my $xs_code = <<'END_XS_CODE';
+MODULE = Lucy   PACKAGE = Lucy::Util::Freezer
+
+void
+freeze(obj, outstream)
+    lucy_Obj *obj;
+    lucy_OutStream *outstream;
+PPCODE:
+    lucy_Freezer_serialize(obj, outstream);
+
+SV*
+thaw(instream)
+    lucy_InStream *instream;
+CODE:
+    lucy_Obj *obj = lucy_Freezer_thaw(instream);
+    RETVAL = CFISH_OBJ_TO_SV_NOINC(obj);
+OUTPUT: RETVAL
+
+END_XS_CODE
+
+    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
+        parcel     => "Lucy",
+        class_name => "Lucy::Util::Freezer",
+    );
+    $binding->append_xs($xs_code);
+
+    Clownfish::CFC::Binding::Perl::Class->register($binding);
+}
+
 sub bind_indexfilenames {
     my $xs_code = <<'END_XS_CODE';
 MODULE = Lucy   PACKAGE = Lucy::Util::IndexFileNames