You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/11/20 15:05:33 UTC
[12/19] lucy-clownfish git commit: Perl bindings for
Clownfish::CharBuf
Perl bindings for Clownfish::CharBuf
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/9465b1bb
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/9465b1bb
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/9465b1bb
Branch: refs/heads/master
Commit: 9465b1bbdb0a77700df60504fed36e77f7d73fb6
Parents: b36a997
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Nov 15 15:50:32 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Nov 17 19:08:43 2015 +0100
----------------------------------------------------------------------
.../perl/buildlib/Clownfish/Build/Binding.pm | 24 +++++++++++++++++++
runtime/perl/lib/Clownfish/CharBuf.pm | 2 +-
runtime/perl/lib/Clownfish/String.pm | 25 ++++++++++++++++++++
3 files changed, 50 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9465b1bb/runtime/perl/buildlib/Clownfish/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
index 3b7c14c..cfca479 100644
--- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -26,6 +26,7 @@ sub bind_all {
$class->bind_test_alias_obj;
$class->bind_blob;
$class->bind_bytebuf;
+ $class->bind_charbuf;
$class->bind_string;
$class->bind_err;
$class->bind_hash;
@@ -173,6 +174,29 @@ END_XS_CODE
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
+sub bind_charbuf {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
+ my $synopsis = <<'END_SYNOPSIS';
+ my $buf = Clownfish::CharBuf->new;
+ $buf->cat('abc');
+ $buf->cat_char(ord("\n"));
+ print $buf->to_string;
+END_SYNOPSIS
+ my $constructor = <<'END_CONSTRUCTOR';
+ my $buf = Clownfish::CharBuf->new( size => 256 );
+END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor );
+
+ my $binding = Clownfish::CFC::Binding::Perl::Class->new(
+ parcel => "Clownfish",
+ class_name => "Clownfish::CharBuf",
+ );
+ $binding->set_pod_spec($pod_spec);
+
+ Clownfish::CFC::Binding::Perl::Class->register($binding);
+}
+
sub bind_string {
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::String
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9465b1bb/runtime/perl/lib/Clownfish/CharBuf.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/lib/Clownfish/CharBuf.pm b/runtime/perl/lib/Clownfish/CharBuf.pm
index ce9c6e6..af0b01e 100644
--- a/runtime/perl/lib/Clownfish/CharBuf.pm
+++ b/runtime/perl/lib/Clownfish/CharBuf.pm
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-package Clownfish::String;
+package Clownfish::CharBuf;
use Clownfish;
our $VERSION = '0.004000';
$VERSION = eval $VERSION;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9465b1bb/runtime/perl/lib/Clownfish/String.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/lib/Clownfish/String.pm b/runtime/perl/lib/Clownfish/String.pm
new file mode 100644
index 0000000..ce9c6e6
--- /dev/null
+++ b/runtime/perl/lib/Clownfish/String.pm
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+package Clownfish::String;
+use Clownfish;
+our $VERSION = '0.004000';
+$VERSION = eval $VERSION;
+
+1;
+
+__END__
+
+