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 2016/02/11 12:50:58 UTC
[1/6] lucy-clownfish git commit: Make Class_fetch_class public
Repository: lucy-clownfish
Updated Branches:
refs/heads/master 9debabe4d -> efc37a364
Make Class_fetch_class public
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/65cca171
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/65cca171
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/65cca171
Branch: refs/heads/master
Commit: 65cca1711853c1f3e893b2bd8654eddc6f09c9e7
Parents: c75ee92
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Feb 9 14:28:03 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Feb 9 14:28:03 2016 +0100
----------------------------------------------------------------------
runtime/core/Clownfish/Class.cfh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/65cca171/runtime/core/Clownfish/Class.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Class.cfh b/runtime/core/Clownfish/Class.cfh
index 7b5bb59..dbb31cb 100644
--- a/runtime/core/Clownfish/Class.cfh
+++ b/runtime/core/Clownfish/Class.cfh
@@ -76,10 +76,10 @@ public final class Clownfish::Class inherits Clownfish::Obj {
inert void
register_with_host(Class *klass, Class *parent);
- /** Find a registered class. May return NULL if the class is not
+ /** Find a registered class. May return [](@null) if the class is not
* registered.
*/
- inert nullable Class*
+ public inert nullable Class*
fetch_class(String *class_name);
/** Given a class name, return the name of a parent class which descends
[4/6] lucy-clownfish git commit: Add some accessors for CFCCallable
Posted by nw...@apache.org.
Add some accessors for CFCCallable
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/96581fd6
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/96581fd6
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/96581fd6
Branch: refs/heads/master
Commit: 96581fd6caf1b74279c1906d6504fd49e8489a6d
Parents: 5aae424
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Feb 11 12:10:44 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Feb 11 12:10:44 2016 +0100
----------------------------------------------------------------------
compiler/src/CFCCallable.c | 25 +++++++++++++++++++++++++
compiler/src/CFCCallable.h | 15 +++++++++++++++
2 files changed, 40 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/96581fd6/compiler/src/CFCCallable.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCallable.c b/compiler/src/CFCCallable.c
index 26f9c42..d421366 100644
--- a/compiler/src/CFCCallable.c
+++ b/compiler/src/CFCCallable.c
@@ -88,3 +88,28 @@ CFCCallable_can_be_bound(CFCCallable *self) {
return true;
}
+CFCType*
+CFCCallable_get_return_type(CFCCallable *self) {
+ return self->return_type;
+}
+
+CFCParamList*
+CFCCallable_get_param_list(CFCCallable *self) {
+ return self->param_list;
+}
+
+CFCDocuComment*
+CFCCallable_get_docucomment(CFCCallable *self) {
+ return self->docucomment;
+}
+
+const char*
+CFCCallable_get_name(CFCCallable *self) {
+ return CFCSymbol_get_name((CFCSymbol*)self);
+}
+
+int
+CFCCallable_public(CFCCallable *self) {
+ return CFCSymbol_public((CFCSymbol*)self);
+}
+
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/96581fd6/compiler/src/CFCCallable.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCallable.h b/compiler/src/CFCCallable.h
index 7ac737f..0848f11 100644
--- a/compiler/src/CFCCallable.h
+++ b/compiler/src/CFCCallable.h
@@ -70,6 +70,21 @@ CFCCallable_resolve_types(CFCCallable *self);
int
CFCCallable_can_be_bound(CFCCallable *self);
+struct CFCType*
+CFCCallable_get_return_type(CFCCallable *self);
+
+struct CFCParamList*
+CFCCallable_get_param_list(CFCCallable *self);
+
+struct CFCDocuComment*
+CFCCallable_get_docucomment(CFCCallable *self);
+
+const char*
+CFCCallable_get_name(CFCCallable *self);
+
+int
+CFCCallable_public(CFCCallable *self);
+
#ifdef __cplusplus
}
#endif
[5/6] lucy-clownfish git commit: Switch to base class CFCCallable in
docgen
Posted by nw...@apache.org.
Switch to base class CFCCallable in docgen
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/ca66acbb
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/ca66acbb
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/ca66acbb
Branch: refs/heads/master
Commit: ca66acbb816d046beae540dc03a9c9869c2fbb04
Parents: 96581fd
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Feb 11 12:12:46 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Feb 11 12:32:03 2016 +0100
----------------------------------------------------------------------
compiler/perl/lib/Clownfish/CFC.xs | 2 +-
compiler/perl/typemap | 1 +
compiler/src/CFCCHtml.c | 28 +++++++++++++++-------------
compiler/src/CFCCMan.c | 28 +++++++++++++++-------------
compiler/src/CFCPerlPod.c | 30 ++++++++++++++++--------------
compiler/src/CFCPerlPod.h | 4 ++--
6 files changed, 50 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ca66acbb/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.xs b/compiler/perl/lib/Clownfish/CFC.xs
index efb68a2..33dba4f 100644
--- a/compiler/perl/lib/Clownfish/CFC.xs
+++ b/compiler/perl/lib/Clownfish/CFC.xs
@@ -2394,7 +2394,7 @@ OUTPUT: RETVAL
SV*
_gen_subroutine_pod(func, alias, klass, code_sample, class_name, is_constructor)
- CFCFunction *func;
+ CFCCallable *func;
const char *alias;
CFCClass *klass;
const char *code_sample;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ca66acbb/compiler/perl/typemap
----------------------------------------------------------------------
diff --git a/compiler/perl/typemap b/compiler/perl/typemap
index a83840e..97c389d 100644
--- a/compiler/perl/typemap
+++ b/compiler/perl/typemap
@@ -16,6 +16,7 @@
TYPEMAP
CFCBase* CLOWNFISH_TYPE
CFCCBlock* CLOWNFISH_MODEL
+CFCCallable* CLOWNFISH_MODEL
CFCClass* CLOWNFISH_MODEL
CFCDocuComment* CLOWNFISH_MODEL
CFCFile* CLOWNFISH_MODEL
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ca66acbb/compiler/src/CFCCHtml.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCHtml.c b/compiler/src/CFCCHtml.c
index 898a06d..f357443 100644
--- a/compiler/src/CFCCHtml.c
+++ b/compiler/src/CFCCHtml.c
@@ -39,6 +39,7 @@
#include "CFCUtil.h"
#include "CFCUri.h"
#include "CFCVariable.h"
+#include "CFCCallable.h"
#ifndef true
#define true 1
@@ -146,11 +147,11 @@ static char*
S_html_create_fresh_methods(CFCClass *klass, CFCClass *ancestor);
static char*
-S_html_create_func(CFCClass *klass, CFCFunction *func, const char *prefix,
+S_html_create_func(CFCClass *klass, CFCCallable *func, const char *prefix,
const char *short_sym);
static char*
-S_html_create_param_list(CFCClass *klass, CFCFunction *func);
+S_html_create_param_list(CFCClass *klass, CFCCallable *func);
static char*
S_html_create_inheritance(CFCClass *klass);
@@ -685,7 +686,8 @@ S_html_create_functions(CFCClass *klass) {
name, "</dt>\n", NULL);
char *short_sym = CFCFunction_short_func_sym(func, klass);
- char *func_html = S_html_create_func(klass, func, prefix, short_sym);
+ char *func_html = S_html_create_func(klass, (CFCCallable*)func, prefix,
+ short_sym);
result = CFCUtil_cat(result, func_html, NULL);
FREEMEM(func_html);
FREEMEM(short_sym);
@@ -772,7 +774,7 @@ S_html_create_fresh_methods(CFCClass *klass, CFCClass *ancestor) {
result = CFCUtil_cat(result, "</dt>\n", NULL);
char *short_sym = CFCMethod_short_method_sym(method, klass);
- char *method_html = S_html_create_func(klass, (CFCFunction*)method,
+ char *method_html = S_html_create_func(klass, (CFCCallable*)method,
prefix, short_sym);
result = CFCUtil_cat(result, method_html, NULL);
FREEMEM(method_html);
@@ -787,9 +789,9 @@ S_html_create_fresh_methods(CFCClass *klass, CFCClass *ancestor) {
}
static char*
-S_html_create_func(CFCClass *klass, CFCFunction *func, const char *prefix,
+S_html_create_func(CFCClass *klass, CFCCallable *func, const char *prefix,
const char *short_sym) {
- CFCType *ret_type = CFCFunction_get_return_type(func);
+ CFCType *ret_type = CFCCallable_get_return_type(func);
char *ret_html = S_type_to_html(ret_type, "", klass);
const char *ret_array = CFCType_get_array(ret_type);
const char *ret_array_str = ret_array ? ret_array : "";
@@ -811,15 +813,15 @@ S_html_create_func(CFCClass *klass, CFCFunction *func, const char *prefix,
FREEMEM(param_list);
// Get documentation, which may be inherited.
- CFCDocuComment *docucomment = CFCFunction_get_docucomment(func);
+ CFCDocuComment *docucomment = CFCCallable_get_docucomment(func);
if (!docucomment) {
- const char *name = CFCFunction_get_name(func);
+ const char *name = CFCCallable_get_name(func);
CFCClass *parent = klass;
while (NULL != (parent = CFCClass_get_parent(parent))) {
- CFCFunction *parent_func
- = (CFCFunction*)CFCClass_method(parent, name);
+ CFCCallable *parent_func
+ = (CFCCallable*)CFCClass_method(parent, name);
if (!parent_func) { break; }
- docucomment = CFCFunction_get_docucomment(parent_func);
+ docucomment = CFCCallable_get_docucomment(parent_func);
if (docucomment) { break; }
}
}
@@ -866,8 +868,8 @@ S_html_create_func(CFCClass *klass, CFCFunction *func, const char *prefix,
}
static char*
-S_html_create_param_list(CFCClass *klass, CFCFunction *func) {
- CFCParamList *param_list = CFCFunction_get_param_list(func);
+S_html_create_param_list(CFCClass *klass, CFCCallable *func) {
+ CFCParamList *param_list = CFCCallable_get_param_list(func);
CFCVariable **variables = CFCParamList_get_variables(param_list);
const char *cfc_class = CFCBase_get_cfc_class((CFCBase*)func);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ca66acbb/compiler/src/CFCCMan.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCMan.c b/compiler/src/CFCCMan.c
index be9aaaf..5b98c88 100644
--- a/compiler/src/CFCCMan.c
+++ b/compiler/src/CFCCMan.c
@@ -32,6 +32,7 @@
#include "CFCUri.h"
#include "CFCUtil.h"
#include "CFCVariable.h"
+#include "CFCCallable.h"
#ifndef true
#define true 1
@@ -57,10 +58,10 @@ static char*
S_man_create_fresh_methods(CFCClass *klass, CFCClass *ancestor);
static char*
-S_man_create_func(CFCClass *klass, CFCFunction *func, const char *full_sym);
+S_man_create_func(CFCClass *klass, CFCCallable *func, const char *full_sym);
static char*
-S_man_create_param_list(CFCClass *klass, CFCFunction *func);
+S_man_create_param_list(CFCClass *klass, CFCCallable *func);
static char*
S_man_create_inheritance(CFCClass *klass);
@@ -183,7 +184,8 @@ S_man_create_functions(CFCClass *klass) {
result = CFCUtil_cat(result, ".TP\n.B ", name, "\n", NULL);
char *full_func_sym = CFCFunction_full_func_sym(func, klass);
- char *function_man = S_man_create_func(klass, func, full_func_sym);
+ char *function_man = S_man_create_func(klass, (CFCCallable*)func,
+ full_func_sym);
result = CFCUtil_cat(result, function_man, NULL);
FREEMEM(function_man);
FREEMEM(full_func_sym);
@@ -257,7 +259,7 @@ S_man_create_fresh_methods(CFCClass *klass, CFCClass *ancestor) {
result = CFCUtil_cat(result, "\n", NULL);
char *full_sym = CFCMethod_full_method_sym(method, klass);
- char *method_man = S_man_create_func(klass, (CFCFunction*)method,
+ char *method_man = S_man_create_func(klass, (CFCCallable*)method,
full_sym);
result = CFCUtil_cat(result, method_man, NULL);
FREEMEM(method_man);
@@ -268,8 +270,8 @@ S_man_create_fresh_methods(CFCClass *klass, CFCClass *ancestor) {
}
static char*
-S_man_create_func(CFCClass *klass, CFCFunction *func, const char *full_sym) {
- CFCType *return_type = CFCFunction_get_return_type(func);
+S_man_create_func(CFCClass *klass, CFCCallable *func, const char *full_sym) {
+ CFCType *return_type = CFCCallable_get_return_type(func);
const char *return_type_c = CFCType_to_c(return_type);
const char *incremented = "";
@@ -292,15 +294,15 @@ S_man_create_func(CFCClass *klass, CFCFunction *func, const char *full_sym) {
FREEMEM(param_list);
// Get documentation, which may be inherited.
- CFCDocuComment *docucomment = CFCFunction_get_docucomment(func);
+ CFCDocuComment *docucomment = CFCCallable_get_docucomment(func);
if (!docucomment) {
- const char *name = CFCFunction_get_name(func);
+ const char *name = CFCCallable_get_name(func);
CFCClass *parent = klass;
while (NULL != (parent = CFCClass_get_parent(parent))) {
- CFCFunction *parent_func
- = (CFCFunction*)CFCClass_method(parent, name);
+ CFCCallable *parent_func
+ = (CFCCallable*)CFCClass_method(parent, name);
if (!parent_func) { break; }
- docucomment = CFCFunction_get_docucomment(parent_func);
+ docucomment = CFCCallable_get_docucomment(parent_func);
if (docucomment) { break; }
}
}
@@ -341,8 +343,8 @@ S_man_create_func(CFCClass *klass, CFCFunction *func, const char *full_sym) {
}
static char*
-S_man_create_param_list(CFCClass *klass, CFCFunction *func) {
- CFCParamList *param_list = CFCFunction_get_param_list(func);
+S_man_create_param_list(CFCClass *klass, CFCCallable *func) {
+ CFCParamList *param_list = CFCCallable_get_param_list(func);
CFCVariable **variables = CFCParamList_get_variables(param_list);
if (!variables[0]) {
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ca66acbb/compiler/src/CFCPerlPod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.c b/compiler/src/CFCPerlPod.c
index 6a69caf..8330007 100644
--- a/compiler/src/CFCPerlPod.c
+++ b/compiler/src/CFCPerlPod.c
@@ -36,6 +36,7 @@
#include "CFCDocument.h"
#include "CFCType.h"
#include "CFCVariable.h"
+#include "CFCCallable.h"
#ifndef true
#define true 1
@@ -66,7 +67,7 @@ static const CFCMeta CFCPERLPOD_META = {
};
static char*
-S_gen_code_sample(CFCFunction *func, const char *alias, CFCClass *klass,
+S_gen_code_sample(CFCCallable *func, const char *alias, CFCClass *klass,
int is_constructor);
static char*
@@ -226,7 +227,7 @@ CFCPerlPod_methods_pod(CFCPerlPod *self, CFCClass *klass) {
}
else {
meth_pod
- = CFCPerlPod_gen_subroutine_pod((CFCFunction*)method,
+ = CFCPerlPod_gen_subroutine_pod((CFCCallable*)method,
meth_spec->alias, klass,
meth_spec->sample,
class_name, false);
@@ -253,7 +254,7 @@ CFCPerlPod_methods_pod(CFCPerlPod *self, CFCClass *klass) {
char *perl_name = CFCPerlMethod_perl_name(method);
meth_pod
- = CFCPerlPod_gen_subroutine_pod((CFCFunction*)method,
+ = CFCPerlPod_gen_subroutine_pod((CFCCallable*)method,
perl_name, klass, NULL,
class_name, false);
FREEMEM(perl_name);
@@ -301,8 +302,9 @@ CFCPerlPod_constructors_pod(CFCPerlPod *self, CFCClass *klass) {
func_name, CFCClass_get_name(klass));
}
char *sub_pod
- = CFCPerlPod_gen_subroutine_pod(pod_func, slot.alias, klass,
- slot.sample, class_name, true);
+ = CFCPerlPod_gen_subroutine_pod((CFCCallable*)pod_func,
+ slot.alias, klass, slot.sample,
+ class_name, true);
pod = CFCUtil_cat(pod, sub_pod, NULL);
FREEMEM(sub_pod);
}
@@ -311,14 +313,14 @@ CFCPerlPod_constructors_pod(CFCPerlPod *self, CFCClass *klass) {
}
char*
-CFCPerlPod_gen_subroutine_pod(CFCFunction *func,
+CFCPerlPod_gen_subroutine_pod(CFCCallable *func,
const char *alias, CFCClass *klass,
const char *code_sample,
const char *class_name, int is_constructor) {
- const char *func_name = CFCFunction_get_name(func);
+ const char *func_name = CFCCallable_get_name(func);
// Only allow "public" subs to be exposed as part of the public API.
- if (!CFCFunction_public(func)) {
+ if (!CFCCallable_public(func)) {
CFCUtil_die("%s#%s is not public", class_name, func_name);
}
@@ -336,14 +338,14 @@ CFCPerlPod_gen_subroutine_pod(CFCFunction *func,
}
// Get documentation, which may be inherited.
- CFCDocuComment *docucomment = CFCFunction_get_docucomment(func);
+ CFCDocuComment *docucomment = CFCCallable_get_docucomment(func);
if (!docucomment) {
CFCClass *parent = klass;
while (NULL != (parent = CFCClass_get_parent(parent))) {
- CFCFunction *parent_func
- = (CFCFunction*)CFCClass_method(parent, func_name);
+ CFCCallable *parent_func
+ = (CFCCallable*)CFCClass_method(parent, func_name);
if (!parent_func) { break; }
- docucomment = CFCFunction_get_docucomment(parent_func);
+ docucomment = CFCCallable_get_docucomment(parent_func);
if (docucomment) { break; }
}
}
@@ -385,7 +387,7 @@ CFCPerlPod_gen_subroutine_pod(CFCFunction *func,
}
static char*
-S_gen_code_sample(CFCFunction *func, const char *alias, CFCClass *klass,
+S_gen_code_sample(CFCCallable *func, const char *alias, CFCClass *klass,
int is_constructor) {
char *invocant = NULL;
@@ -398,7 +400,7 @@ S_gen_code_sample(CFCFunction *func, const char *alias, CFCClass *klass,
FREEMEM(lower);
}
- CFCParamList *param_list = CFCFunction_get_param_list(func);
+ CFCParamList *param_list = CFCCallable_get_param_list(func);
size_t num_vars = CFCParamList_num_vars(param_list);
size_t start = is_constructor ? 0 : 1;
char *sample = NULL;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ca66acbb/compiler/src/CFCPerlPod.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.h b/compiler/src/CFCPerlPod.h
index 8ab88c2..4d4a175 100644
--- a/compiler/src/CFCPerlPod.h
+++ b/compiler/src/CFCPerlPod.h
@@ -25,7 +25,7 @@ extern "C" {
*/
typedef struct CFCPerlPod CFCPerlPod;
-struct CFCFunction;
+struct CFCCallable;
struct CFCClass;
CFCPerlPod*
@@ -112,7 +112,7 @@ CFCPerlPod_md_to_pod(const char *md, struct CFCClass *klass, int header_level);
* argument handling is different for constructors.
*/
char*
-CFCPerlPod_gen_subroutine_pod(struct CFCFunction *func,
+CFCPerlPod_gen_subroutine_pod(struct CFCCallable *func,
const char *alias, struct CFCClass *klass,
const char *code_sample,
const char *class_name, int is_constructor);
[2/6] lucy-clownfish git commit: Change default function for ctor POD
Posted by nw...@apache.org.
Change default function for ctor POD
By default, the POD for Perl constructors is taken from the "alias"
instead of "init".
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/db2ea9ad
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/db2ea9ad
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/db2ea9ad
Branch: refs/heads/master
Commit: db2ea9ad0fc304a9b1bcfe28954194b267847f4b
Parents: 65cca17
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Feb 9 14:29:50 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Feb 9 14:44:49 2016 +0100
----------------------------------------------------------------------
compiler/perl/lib/Clownfish/CFC.pm | 10 ++--
compiler/perl/lib/Clownfish/CFC.xs | 8 ++--
compiler/src/CFCPerlPod.c | 16 +++----
compiler/src/CFCPerlPod.h | 8 ++--
.../perl/buildlib/Clownfish/Build/Binding.pm | 48 +++++++-------------
5 files changed, 36 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/db2ea9ad/compiler/perl/lib/Clownfish/CFC.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.pm b/compiler/perl/lib/Clownfish/CFC.pm
index 6f03364..0344bcb 100644
--- a/compiler/perl/lib/Clownfish/CFC.pm
+++ b/compiler/perl/lib/Clownfish/CFC.pm
@@ -846,16 +846,16 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
}
my %add_constructor_PARAMS = (
- alias => undef,
- initializer => undef,
- sample => undef,
- pod => undef,
+ alias => undef,
+ pod_func => undef,
+ sample => undef,
+ pod => undef,
);
sub add_constructor {
my ( $self, %args ) = @_;
verify_args( \%add_constructor_PARAMS, %args ) or confess $@;
- _add_constructor( $self, @args{qw( alias initializer sample pod )} );
+ _add_constructor( $self, @args{qw( alias pod_func sample pod )} );
}
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/db2ea9ad/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.xs b/compiler/perl/lib/Clownfish/CFC.xs
index c942338..efb68a2 100644
--- a/compiler/perl/lib/Clownfish/CFC.xs
+++ b/compiler/perl/lib/Clownfish/CFC.xs
@@ -2316,18 +2316,18 @@ PPCODE:
CFCPerlPod_add_method(self, alias, method, sample, pod);
void
-_add_constructor(self, alias_sv, init_sv, sample_sv, pod_sv)
+_add_constructor(self, alias_sv, func_sv, sample_sv, pod_sv)
CFCPerlPod *self;
SV *alias_sv;
- SV *init_sv;
+ SV *func_sv;
SV *sample_sv;
SV *pod_sv;
PPCODE:
const char *alias = SvPOK(alias_sv) ? SvPVutf8_nolen(alias_sv) : NULL;
- const char *init = SvPOK(init_sv) ? SvPVutf8_nolen(init_sv) : NULL;
+ const char *func = SvPOK(func_sv) ? SvPVutf8_nolen(func_sv) : NULL;
const char *sample = SvPOK(sample_sv) ? SvPVutf8_nolen(sample_sv) : NULL;
const char *pod = SvPOK(pod_sv) ? SvPVutf8_nolen(pod_sv) : NULL;
- CFCPerlPod_add_constructor(self, alias, init, sample, pod);
+ CFCPerlPod_add_constructor(self, alias, func, sample, pod);
SV*
methods_pod(self, klass)
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/db2ea9ad/compiler/src/CFCPerlPod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.c b/compiler/src/CFCPerlPod.c
index 97f93c8..5cbd312 100644
--- a/compiler/src/CFCPerlPod.c
+++ b/compiler/src/CFCPerlPod.c
@@ -150,14 +150,14 @@ CFCPerlPod_add_method(CFCPerlPod *self, const char *alias, const char *method,
void
CFCPerlPod_add_constructor(CFCPerlPod *self, const char *alias,
- const char *initializer, const char *sample,
+ const char *pod_func, const char *sample,
const char *pod) {
self->num_constructors++;
size_t size = self->num_constructors * sizeof(NamePod);
self->constructors = (NamePod*)REALLOCATE(self->constructors, size);
NamePod *slot = &self->constructors[self->num_constructors - 1];
slot->alias = CFCUtil_strdup(alias ? alias : "new");
- slot->func = CFCUtil_strdup(initializer ? initializer : "init");
+ slot->func = pod_func ? CFCUtil_strdup(pod_func) : NULL;
slot->sample = sample ? CFCUtil_strdup(sample) : NULL;
slot->pod = pod ? CFCUtil_strdup(pod) : NULL;
}
@@ -294,16 +294,14 @@ CFCPerlPod_constructors_pod(CFCPerlPod *self, CFCClass *klass) {
pod = CFCUtil_cat(pod, slot.pod, "\n", NULL);
}
else {
- CFCFunction *init_func = CFCClass_function(klass, slot.func);
- if (!init_func) {
- init_func = CFCClass_function(klass, slot.alias);
- }
- if (!init_func) {
+ const char *func_name = slot.func ? slot.func : slot.alias;
+ CFCFunction *pod_func = CFCClass_function(klass, func_name);
+ if (!pod_func) {
CFCUtil_die("Can't find constructor '%s' in class '%s'",
- slot.alias, CFCClass_get_name(klass));
+ func_name, CFCClass_get_name(klass));
}
char *sub_pod
- = CFCPerlPod_gen_subroutine_pod(init_func, slot.alias, klass,
+ = CFCPerlPod_gen_subroutine_pod(pod_func, slot.alias, klass,
slot.sample, class_name, true);
pod = CFCUtil_cat(pod, sub_pod, NULL);
FREEMEM(sub_pod);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/db2ea9ad/compiler/src/CFCPerlPod.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.h b/compiler/src/CFCPerlPod.h
index 1d63a4a..8ab88c2 100644
--- a/compiler/src/CFCPerlPod.h
+++ b/compiler/src/CFCPerlPod.h
@@ -55,16 +55,16 @@ CFCPerlPod_add_method(CFCPerlPod *self, const char *alias, const char *method,
/** Add pod for a constructor.
*
* @param alias The name of the constructor, spelled as it will be used from
- * Perl-space.
- * @param initializer The name of the initialization routine from the
- * Clownfish class. Defaults to "init".
+ * Perl-space. Defaults to "new".
+ * @param pod_func The name of the function from which the constructor's
+ * documentation should be taken. Defaults to the alias.
* @param sample An optional Perl usage sample.
* @param pod Optional verbatim POD, which will override all POD which would
* otherwise have been generated.
*/
void
CFCPerlPod_add_constructor(CFCPerlPod *self, const char *alias,
- const char *initializer, const char *sample,
+ const char *pod_func, const char *sample,
const char *pod);
/** Generate POD for a METHODS section and possibly an ABSTRACT METHODS
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/db2ea9ad/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 bf73807..2ee3da0 100644
--- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -131,7 +131,7 @@ END_SYNOPSIS
Create a Blob containing the passed-in bytes.
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', pod => $constructor );
+ $pod_spec->add_constructor( pod => $constructor );
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::Blob
@@ -184,12 +184,12 @@ END_DESCRIPTION
my $bool = Clownfish::Boolean->singleton($truth_value);
-Return a Boolean singleton representing either true or false depending
-on the supplied truth value.
+Return either C<$true_singleton> or C<$false_singleton> depending on the
+supplied value.
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
$pod_spec->set_description($description);
- $pod_spec->add_constructor( alias => 'new', pod => $constructor );
+ $pod_spec->add_constructor( pod => $constructor );
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::Boolean
@@ -229,7 +229,7 @@ END_SYNOPSIS
Create a ByteBuf containing the passed-in bytes.
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', pod => $constructor );
+ $pod_spec->add_constructor( pod => $constructor );
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::ByteBuf
@@ -270,10 +270,10 @@ sub bind_charbuf {
print $buf->to_string;
END_SYNOPSIS
my $constructor = <<'END_CONSTRUCTOR';
- my $buf = Clownfish::CharBuf->new( size => 256 );
+ my $buf = Clownfish::CharBuf->new( capacity => 256 );
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', sample => $constructor );
+ $pod_spec->add_constructor( sample => $constructor );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Clownfish",
@@ -298,7 +298,7 @@ END_SYNOPSIS
Return a String containing the passed-in Perl string.
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', pod => $constructor );
+ $pod_spec->add_constructor( pod => $constructor );
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::String
@@ -498,7 +498,7 @@ END_CONSTRUCTOR
Store a key-value pair.
END_POD
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', sample => $constructor );
+ $pod_spec->add_constructor( sample => $constructor );
$pod_spec->add_method(
method => 'Store',
alias => 'store',
@@ -549,14 +549,10 @@ sub bind_hashiterator {
}
END_SYNOPSIS
my $constructor = <<'END_CONSTRUCTOR';
-=head2 new
-
my $iter = Clownfish::HashIterator->new($hash);
-
-Return a HashIterator for the passed-in Hash.
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', pod => $constructor );
+ $pod_spec->add_constructor( sample => $constructor );
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::HashIterator
@@ -593,14 +589,10 @@ sub bind_float {
my $value = $float->get_value;
END_SYNOPSIS
my $constructor = <<'END_CONSTRUCTOR';
-=head2 new
-
my $float = Clownfish::Float->new($value);
-
-Create a Float containing the passed-in value.
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', pod => $constructor );
+ $pod_spec->add_constructor( sample => $constructor );
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::Float
@@ -637,14 +629,10 @@ sub bind_integer {
my $value = $integer->get_value;
END_SYNOPSIS
my $constructor = <<'END_CONSTRUCTOR';
-=head2 new
-
my $integer = Clownfish::Integer->new($value);
-
-Create an Integer containing the passed-in value.
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', pod => $constructor );
+ $pod_spec->add_constructor( sample => $constructor );
my $xs_code = <<'END_XS_CODE';
MODULE = Clownfish PACKAGE = Clownfish::Integer
@@ -860,7 +848,7 @@ END_CONSTRUCTOR
Store an element at index C<tick>, possibly displacing an existing element.
END_POD
$pod_spec->set_synopsis($synopsis);
- $pod_spec->add_constructor( alias => 'new', sample => $constructor );
+ $pod_spec->add_constructor( sample => $constructor );
$pod_spec->add_method(
method => 'Store',
alias => 'store',
@@ -922,12 +910,8 @@ sub bind_class {
my $class = Clownfish::Class->fetch_class('Foo::Bar');
my $subclass = Clownfish::Class->singleton('Foo::Bar::Jr', $class);
END_SYNOPSIS
- my $fetch_class_pod = <<'END_CONSTRUCTOR';
-=head2 fetch_class
-
+ my $fetch_class_sample = <<'END_CONSTRUCTOR';
my $class = Clownfish::Class->fetch_class($class_name);
-
-Find a registered class. May return undef if the class is not registered.
END_CONSTRUCTOR
my $singleton_sample = <<'END_CONSTRUCTOR';
my $class = Clownfish::Class->singleton(
@@ -937,8 +921,8 @@ END_CONSTRUCTOR
END_CONSTRUCTOR
$pod_spec->set_synopsis($synopsis);
$pod_spec->add_constructor(
- alias => 'fetch_class',
- pod => $fetch_class_pod,
+ alias => 'fetch_class',
+ sample => $fetch_class_sample,
);
$pod_spec->add_constructor(
alias => 'singleton',
[6/6] lucy-clownfish git commit: Merge branch 'ctor-documentation'
Posted by nw...@apache.org.
Merge branch 'ctor-documentation'
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/efc37a36
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/efc37a36
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/efc37a36
Branch: refs/heads/master
Commit: efc37a364d9c244e66e0b335caee9f9732e0f04f
Parents: 9debabe ca66acb
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Feb 11 12:44:13 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Feb 11 12:44:13 2016 +0100
----------------------------------------------------------------------
compiler/perl/lib/Clownfish/CFC.pm | 10 ++--
compiler/perl/lib/Clownfish/CFC.xs | 10 ++--
compiler/perl/typemap | 1 +
compiler/src/CFCCHtml.c | 28 ++++++------
compiler/src/CFCCMan.c | 28 ++++++------
compiler/src/CFCCallable.c | 25 ++++++++++
compiler/src/CFCCallable.h | 15 ++++++
compiler/src/CFCPerlPod.c | 47 +++++++++----------
compiler/src/CFCPerlPod.h | 12 ++---
runtime/core/Clownfish/Class.cfh | 4 +-
.../perl/buildlib/Clownfish/Build/Binding.pm | 48 +++++++-------------
11 files changed, 129 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
[3/6] lucy-clownfish git commit: Improve gen_subroutine_pod error
message
Posted by nw...@apache.org.
Improve gen_subroutine_pod error message
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/5aae4246
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/5aae4246
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/5aae4246
Branch: refs/heads/master
Commit: 5aae42462a907bdab07dadbd1affbe52fabc5c18
Parents: db2ea9a
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Feb 9 15:13:24 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Feb 9 15:13:24 2016 +0100
----------------------------------------------------------------------
compiler/src/CFCPerlPod.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/5aae4246/compiler/src/CFCPerlPod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.c b/compiler/src/CFCPerlPod.c
index 5cbd312..6a69caf 100644
--- a/compiler/src/CFCPerlPod.c
+++ b/compiler/src/CFCPerlPod.c
@@ -315,9 +315,11 @@ CFCPerlPod_gen_subroutine_pod(CFCFunction *func,
const char *alias, CFCClass *klass,
const char *code_sample,
const char *class_name, int is_constructor) {
+ const char *func_name = CFCFunction_get_name(func);
+
// Only allow "public" subs to be exposed as part of the public API.
if (!CFCFunction_public(func)) {
- CFCUtil_die("%s#%s is not public", class_name, alias);
+ CFCUtil_die("%s#%s is not public", class_name, func_name);
}
char *pod = CFCUtil_sprintf("=head2 %s\n\n", alias);
@@ -336,7 +338,6 @@ CFCPerlPod_gen_subroutine_pod(CFCFunction *func,
// Get documentation, which may be inherited.
CFCDocuComment *docucomment = CFCFunction_get_docucomment(func);
if (!docucomment) {
- const char *func_name = CFCFunction_get_name(func);
CFCClass *parent = klass;
while (NULL != (parent = CFCClass_get_parent(parent))) {
CFCFunction *parent_func