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 2013/07/20 22:37:59 UTC
[lucy-commits] [3/6] git commit: refs/heads/cfc-pod - Documentation for CFCPerlPod
Documentation for CFCPerlPod
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e50bc682
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e50bc682
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e50bc682
Branch: refs/heads/cfc-pod
Commit: e50bc6822da022a36e8bb479fb36ce96d1efd33f
Parents: dfb40d2
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Jul 20 20:12:03 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Jul 20 20:12:03 2013 +0200
----------------------------------------------------------------------
.../buildlib/Clownfish/CFC/Build/Binding.pm | 25 ++++++++++++++++++++
clownfish/compiler/src/CFCPerlPod.h | 6 +++++
2 files changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/e50bc682/clownfish/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm b/clownfish/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
index 207f528..a17a5c4 100644
--- a/clownfish/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
+++ b/clownfish/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
@@ -19,6 +19,7 @@ use strict;
sub bind_all {
my $class = shift;
$class->bind_perlclass;
+ $class->bind_perlpod;
}
sub bind_perlclass {
@@ -58,6 +59,30 @@ sub bind_perlclass {
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
+sub bind_perlpod {
+ class_from_c('CFCPerlPod', 'Clownfish::CFC::Binding::Perl::Pod');
+
+ my @exposed = qw(
+ Add_Method
+ Add_Constructor
+ Set_Synopsis
+ Get_Synopsis
+ Set_Description
+ Get_Description
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
+ $pod_spec->add_constructor( alias => 'new' );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
+
+ my $binding = Clownfish::CFC::Binding::Perl::Class->new(
+ class_name => 'Clownfish::CFC::Binding::Perl::Pod',
+ );
+ $binding->set_pod_spec($pod_spec);
+
+ Clownfish::CFC::Binding::Perl::Class->register($binding);
+}
+
# Quick and dirty hack to create a CFC class from a C header.
sub class_from_c {
my ($cfc_class_name, $class_name) = @_;
http://git-wip-us.apache.org/repos/asf/lucy/blob/e50bc682/clownfish/compiler/src/CFCPerlPod.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlPod.h b/clownfish/compiler/src/CFCPerlPod.h
index 3fb94eb..4d4a476 100644
--- a/clownfish/compiler/src/CFCPerlPod.h
+++ b/clownfish/compiler/src/CFCPerlPod.h
@@ -28,6 +28,8 @@ typedef struct CFCPerlPod CFCPerlPod;
struct CFCFunction;
struct CFCClass;
+/** Constructor
+ */
CFCPerlPod*
CFCPerlPod_new(void);
@@ -79,6 +81,8 @@ char*
CFCPerlPod_constructors_pod(CFCPerlPod *self, struct CFCClass *klass);
/** Supply a SYNOPSIS section.
+ *
+ * @param synopsis A string containing the synopsis.
*/
void
CFCPerlPod_set_synopsis(CFCPerlPod *self, const char *synopsis);
@@ -89,6 +93,8 @@ const char*
CFCPerlPod_get_synopsis(CFCPerlPod *self);
/** Supply a DESCRIPTION section.
+ *
+ * @param description A string containing the description.
*/
void
CFCPerlPod_set_description(CFCPerlPod *self, const char *description);