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:51:02 UTC
[5/6] lucy-clownfish git commit: Switch to base class CFCCallable in
docgen
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);