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/05/26 17:35:29 UTC
[lucy-commits] [1/9] git commit: refs/heads/separate-clownfish-wip1 - Don't include
charmony.h from boot.c
Updated Branches:
refs/heads/separate-clownfish-wip1 [created] 7c0ae1f7e
Don't include charmony.h from boot.c
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7100a70d
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7100a70d
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7100a70d
Branch: refs/heads/separate-clownfish-wip1
Commit: 7100a70d3b18dfd9d69082784f7295f453157311
Parents: 254a1ba
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 25 18:48:55 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 16:04:04 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCPerl.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7100a70d/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index 80d0c1b..c7f971b 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -283,7 +283,6 @@ S_write_boot_c(CFCPerl *self) {
const char pattern[] =
"%s\n"
"\n"
- "#include \"charmony.h\"\n"
"#include \"%s\"\n"
"#include \"EXTERN.h\"\n"
"#include \"perl.h\"\n"
[lucy-commits] [4/9] git commit: refs/heads/separate-clownfish-wip1 - Remove
CFCParcel_clownfish_parcel
Posted by nw...@apache.org.
Remove CFCParcel_clownfish_parcel
It's only used in CFCDumpable.c and there it's actually used wrongly.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ee195c69
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ee195c69
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ee195c69
Branch: refs/heads/separate-clownfish-wip1
Commit: ee195c69a1509ae9012994cfb15250ca65bd9b0f
Parents: d462f11
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun May 26 16:36:50 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 17:17:14 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCDumpable.c | 5 ++---
clownfish/compiler/src/CFCParcel.c | 13 -------------
clownfish/compiler/src/CFCParcel.h | 7 -------
clownfish/compiler/src/CFCType.h | 3 +++
4 files changed, 5 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee195c69/clownfish/compiler/src/CFCDumpable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCDumpable.c b/clownfish/compiler/src/CFCDumpable.c
index a8230cd..7fd2616 100644
--- a/clownfish/compiler/src/CFCDumpable.c
+++ b/clownfish/compiler/src/CFCDumpable.c
@@ -114,10 +114,9 @@ S_make_method_obj(CFCClass *klass, const char *method_name) {
const char *klass_name = CFCClass_get_class_name(klass);
const char *klass_cnick = CFCClass_get_cnick(klass);
CFCParcel *klass_parcel = CFCClass_get_parcel(klass);
- CFCParcel *cf_parcel = CFCParcel_clownfish_parcel();
CFCType *return_type
- = CFCType_new_object(CFCTYPE_INCREMENTED, cf_parcel, "Obj", 1);
+ = CFCType_new_object(CFCTYPE_INCREMENTED, klass_parcel, "Obj", 1);
CFCType *self_type = CFCType_new_object(0, klass_parcel, klass_struct_sym, 1);
CFCVariable *self_var = CFCVariable_new(NULL, NULL, NULL, NULL, "self",
self_type, false);
@@ -128,7 +127,7 @@ S_make_method_obj(CFCClass *klass, const char *method_name) {
CFCParamList_add_param(param_list, self_var, NULL);
}
else if (strcmp(method_name, "Load") == 0) {
- CFCType *dump_type = CFCType_new_object(0, cf_parcel, "Obj", 1);
+ CFCType *dump_type = CFCType_new_object(0, klass_parcel, "Obj", 1);
CFCVariable *dump_var = CFCVariable_new(NULL, NULL, NULL, NULL, "dump",
dump_type, false);
param_list = CFCParamList_new(false);
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee195c69/clownfish/compiler/src/CFCParcel.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.c b/clownfish/compiler/src/CFCParcel.c
index 9949039..1cfe17e 100644
--- a/clownfish/compiler/src/CFCParcel.c
+++ b/clownfish/compiler/src/CFCParcel.c
@@ -289,19 +289,6 @@ CFCParcel_default_parcel(void) {
return default_parcel;
}
-CFCParcel*
-CFCParcel_clownfish_parcel(void) {
- CFCParcel *parcel = CFCParcel_fetch("Lucy");
- if (!parcel) {
- CFCVersion *version = CFCVersion_new("v0.3.0");
- parcel = CFCParcel_new("Lucy", "Lucy", version);
- CFCParcel_register(parcel);
- CFCBase_decref((CFCBase*)version);
- CFCBase_decref((CFCBase*)parcel);
- }
- return parcel;
-}
-
int
CFCParcel_equals(CFCParcel *self, CFCParcel *other) {
if (strcmp(self->name, other->name)) { return false; }
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee195c69/clownfish/compiler/src/CFCParcel.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.h b/clownfish/compiler/src/CFCParcel.h
index 94b57ae..9ea3a4a 100644
--- a/clownfish/compiler/src/CFCParcel.h
+++ b/clownfish/compiler/src/CFCParcel.h
@@ -77,13 +77,6 @@ CFCParcel_destroy(CFCParcel *self);
CFCParcel*
CFCParcel_default_parcel(void);
-/** Return the Parcel under which Obj, CharBuf, VArray, Hash, etc. live. At
- * some point in the future, these core object types may move to the
- * "Clownfish" CFC" Parcel, but for now they are within "Lucy".
- */
-CFCParcel*
-CFCParcel_clownfish_parcel(void);
-
int
CFCParcel_equals(CFCParcel *self, CFCParcel *other);
http://git-wip-us.apache.org/repos/asf/lucy/blob/ee195c69/clownfish/compiler/src/CFCType.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCType.h b/clownfish/compiler/src/CFCType.h
index eebb2bb..5c1354b 100644
--- a/clownfish/compiler/src/CFCType.h
+++ b/clownfish/compiler/src/CFCType.h
@@ -202,6 +202,9 @@ CFCType_get_vtable_var(CFCType *self);
int
CFCType_get_indirection(CFCType *self);
+/* Return the parcel in which the Type is used. Note that for class types,
+ * this is not neccessarily the parcel where class is defined.
+ */
struct CFCParcel*
CFCType_get_parcel(CFCType *self);
[lucy-commits] [3/9] git commit: refs/heads/separate-clownfish-wip1 - Rename more
Lucy prefixes to Clownfish
Posted by nw...@apache.org.
Rename more Lucy prefixes to Clownfish
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/9c65f940
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/9c65f940
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/9c65f940
Branch: refs/heads/separate-clownfish-wip1
Commit: 9c65f940aa83b341cb7df3366874adb6a63c2583
Parents: 7100a70
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun May 19 19:41:30 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 16:04:06 2013 +0200
----------------------------------------------------------------------
c/src/Clownfish/Err.c | 2 +-
c/t/test_lucy.c | 6 +-
clownfish/compiler/src/CFCBindAliases.c | 107 ++++++++++++++++++-
core/Clownfish/CharBuf.c | 2 +-
core/Clownfish/CharBuf.cfh | 6 +-
core/Clownfish/Err.c | 4 +-
core/Clownfish/Err.cfh | 57 +++++-----
core/Clownfish/Hash.c | 4 +-
core/Clownfish/LockFreeRegistry.c | 8 +-
core/Clownfish/Num.c | 2 +-
core/Clownfish/Num.cfh | 4 +-
core/Clownfish/Obj.cfh | 26 +++---
core/Clownfish/Util/Atomic.c | 4 +-
core/Clownfish/Util/Atomic.cfh | 26 +++---
core/Clownfish/Util/Memory.cfh | 16 ++--
core/Clownfish/Util/NumberUtils.cfh | 98 +++++++++---------
core/Clownfish/Util/SortUtils.c | 38 ++++----
core/Clownfish/Util/SortUtils.cfh | 8 +-
core/Clownfish/Util/StringHelper.c | 2 +-
core/Clownfish/Util/StringHelper.cfh | 4 +-
core/Clownfish/VArray.c | 4 +-
core/Clownfish/VArray.cfh | 8 +-
core/Clownfish/VTable.c | 2 +-
core/Lucy/Plan/FieldType.cfh | 2 +-
core/Lucy/Test.cfh | 16 ++--
core/Lucy/Test/Index/TestTermInfo.c | 2 +-
core/Lucy/Util/Json.c | 6 +-
core/Lucy/Util/Json.cfh | 4 +-
core/Lucy/Util/SortExternal.c | 8 +-
perl/buildlib/Lucy/Build/Binding/Object.pm | 2 +-
perl/buildlib/Lucy/Build/Binding/Util.pm | 2 +-
perl/xs/Lucy/Analysis/RegexTokenizer.c | 2 +-
perl/xs/Lucy/Document/Doc.c | 2 +-
perl/xs/XSBind.c | 132 +++++++++++-----------
34 files changed, 358 insertions(+), 258 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/Err.c b/c/src/Clownfish/Err.c
index a233f74..2adb533 100644
--- a/c/src/Clownfish/Err.c
+++ b/c/src/Clownfish/Err.c
@@ -70,7 +70,7 @@ Err_to_host(Err *self) {
void
Err_throw_mess(VTable *vtable, CharBuf *message) {
Err_Make_t make
- = METHOD_PTR(CERTIFY(vtable, VTABLE), Lucy_Err_Make);
+ = METHOD_PTR(CERTIFY(vtable, VTABLE), Cfish_Err_Make);
Err *err = (Err*)CERTIFY(make(NULL), ERR);
Err_Cat_Mess(err, message);
DECREF(message);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/c/t/test_lucy.c
----------------------------------------------------------------------
diff --git a/c/t/test_lucy.c b/c/t/test_lucy.c
index f23847b..709b5d1 100644
--- a/c/t/test_lucy.c
+++ b/c/t/test_lucy.c
@@ -21,13 +21,13 @@
int
main() {
- lucy_TestFormatterCF *formatter;
+ cfish_TestFormatterCF *formatter;
bool success;
lucy_bootstrap_parcel();
- formatter = lucy_TestFormatterCF_new();
- success = lucy_Test_run_all_batches((lucy_TestFormatter*)formatter);
+ formatter = cfish_TestFormatterCF_new();
+ success = lucy_Test_run_all_batches((cfish_TestFormatter*)formatter);
CFISH_DECREF(formatter);
return success ? EXIT_SUCCESS : EXIT_FAILURE;
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/clownfish/compiler/src/CFCBindAliases.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindAliases.c b/clownfish/compiler/src/CFCBindAliases.c
index 9eda959..0354080 100644
--- a/clownfish/compiler/src/CFCBindAliases.c
+++ b/clownfish/compiler/src/CFCBindAliases.c
@@ -28,10 +28,19 @@ struct alias aliases[] = {
{"cfish_Obj", "lucy_Obj"},
{"CFISH_OBJ", "LUCY_OBJ"},
+ {"cfish_Obj_dec_refcount", "lucy_Obj_dec_refcount"},
+ {"cfish_Obj_get_refcount", "lucy_Obj_get_refcount"},
+ {"cfish_Obj_inc_refcount", "lucy_Obj_inc_refcount"},
+ {"cfish_Obj_to_host", "lucy_Obj_to_host"},
+ {"Cfish_Obj_Destroy", "Lucy_Obj_Destroy"},
+ {"Cfish_Obj_Destroy_OFFSET", "Lucy_Obj_Destroy_OFFSET"},
+ {"Cfish_Obj_Destroy_t", "Lucy_Obj_Destroy_t"},
{"Cfish_Obj_Dump", "Lucy_Obj_Dump"},
{"Cfish_Obj_Get_Class_Name", "Lucy_Obj_Get_Class_Name"},
{"Cfish_Obj_Is_A", "Lucy_Obj_Is_A"},
{"Cfish_Obj_Load", "Lucy_Obj_Load"},
+ {"Cfish_Obj_Load_OFFSET", "Lucy_Obj_Load_OFFSET"},
+ {"Cfish_Obj_Load_t", "Lucy_Obj_Load_t"},
{"Cfish_Obj_To_F64", "Lucy_Obj_To_F64"},
{"Cfish_Obj_To_I64", "Lucy_Obj_To_I64"},
{"Cfish_Obj_To_Bool", "Lucy_Obj_To_Bool"},
@@ -49,10 +58,14 @@ struct alias aliases[] = {
{"cfish_CB_newf", "lucy_CB_newf"},
{"cfish_CB_new_from_trusted_utf8", "lucy_CB_new_from_trusted_utf8"},
{"Cfish_CB_Clone", "Lucy_CB_Clone"},
+ {"Cfish_CB_Nip_One_OFFSET", "Lucy_CB_Nip_One_OFFSET"},
+ {"Cfish_CB_Nip_One_t", "Lucy_CB_Nip_One_t"},
{"cfish_ZombieCharBuf", "lucy_ZombieCharBuf"},
{"CFISH_ZOMBIECHARBUF", "LUCY_ZOMBIECHARBUF"},
{"CFISH_VIEWCHARBUF", "LUCY_VIEWCHARBUF"},
+ {"cfish_ZCB_new", "lucy_ZCB_new"},
{"cfish_ZCB_size", "lucy_ZCB_size"},
+ {"cfish_ZCB_wrap", "lucy_ZCB_wrap"},
{"cfish_ZCB_wrap_str", "lucy_ZCB_wrap_str"},
{"Cfish_ZCB_Assign_Str", "Lucy_ZCB_Assign_Str"},
{"Cfish_ZCB_Assign_Trusted_Str", "Lucy_ZCB_Assign_Trusted_Str"},
@@ -65,14 +78,36 @@ struct alias aliases[] = {
{"CFISH_INTEGER64", "LUCY_INTEGER64"},
{"CFISH_FLOAT32", "LUCY_FLOAT32"},
{"CFISH_FLOAT64", "LUCY_FLOAT64"},
+ {"cfish_Bool_false_singleton", "lucy_Bool_false_singleton"},
+ {"cfish_Bool_true_singleton", "lucy_Bool_true_singleton"},
{"cfish_Bool_singleton", "lucy_Bool_singleton"},
+ {"Cfish_Bool_Dec_RefCount_OFFSET", "Lucy_Bool_Dec_RefCount_OFFSET"},
+ {"Cfish_Bool_Dec_RefCount_t", "Lucy_Bool_Dec_RefCount_t"},
{"cfish_Err", "lucy_Err"},
{"CFISH_ERR", "LUCY_ERR"},
+ {"cfish_Err_certify", "lucy_Err_certify"},
+ {"cfish_Err_do_throw", "lucy_Err_do_throw"},
+ {"cfish_Err_downcast", "lucy_Err_downcast"},
+ {"cfish_Err_get_error", "lucy_Err_get_error"},
+ {"cfish_Err_init_class", "lucy_Err_init_class"},
+ {"cfish_Err_make_mess", "lucy_Err_make_mess"},
{"cfish_Err_new", "lucy_Err_new"},
- {"cfish_Err_trap", "lucy_Err_trap"},
+ {"cfish_Err_rethrow", "lucy_Err_rethrow"},
{"cfish_Err_set_error", "lucy_Err_set_error"},
- {"cfish_Err_get_error", "lucy_Err_get_error"},
+ {"cfish_Err_throw_at", "lucy_Err_throw_at"},
+ {"cfish_Err_throw_mess", "lucy_Err_throw_mess"},
+ {"cfish_Err_to_host", "lucy_Err_to_host"},
+ {"cfish_Err_trap", "lucy_Err_trap"},
+ {"cfish_Err_warn_at", "lucy_Err_warn_at"},
+ {"cfish_Err_warn_mess", "lucy_Err_warn_mess"},
+ {"Cfish_Err_Add_Frame", "Lucy_Err_Add_Frame"},
+ {"Cfish_Err_Cat_Mess", "Lucy_Err_Cat_Mess"},
+ {"Cfish_Err_Make_OFFSET", "Lucy_Err_Make_OFFSET"},
+ {"Cfish_Err_Make_t", "Lucy_Err_Make_t"},
+ {"Cfish_Err_To_Host", "Lucy_Err_To_Host"},
+ {"Cfish_Err_To_Host_OFFSET", "Lucy_Err_To_Host_OFFSET"},
+ {"Cfish_Err_To_Host_t", "Lucy_Err_To_Host_t"},
{"cfish_Hash", "lucy_Hash"},
{"CFISH_HASH", "LUCY_HASH"},
@@ -83,6 +118,62 @@ struct alias aliases[] = {
{"Cfish_Hash_Store_Str", "Lucy_Hash_Store_Str"},
{"Cfish_Hash_Store", "Lucy_Hash_Store"},
+ {"cfish_LockFreeRegistry", "lucy_LockFreeRegistry"},
+ {"CFISH_LOCKFREEREGISTRY", "LUCY_LOCKFREEREGISTRY"},
+ {"cfish_LFReg_to_host", "lucy_LFReg_to_host"},
+ {"Cfish_LFReg_To_Host", "Lucy_LFReg_To_Host"},
+ {"Cfish_LFReg_To_Host_OFFSET", "Lucy_LFReg_To_Host_OFFSET"},
+ {"Cfish_LFReg_To_Host_t", "Lucy_LFReg_To_Host_t"},
+
+ {"cfish_Memory_wrapped_calloc", "lucy_Memory_wrapped_calloc"},
+ {"cfish_Memory_wrapped_free", "lucy_Memory_wrapped_free"},
+ {"cfish_Memory_wrapped_malloc", "lucy_Memory_wrapped_malloc"},
+ {"cfish_Memory_wrapped_realloc", "lucy_Memory_wrapped_realloc"},
+
+ {"cfish_NumUtil_decode_bigend_f32", "lucy_NumUtil_decode_bigend_f32"},
+ {"cfish_NumUtil_decode_bigend_f64", "lucy_NumUtil_decode_bigend_f64"},
+ {"cfish_NumUtil_decode_bigend_u16", "lucy_NumUtil_decode_bigend_u16"},
+ {"cfish_NumUtil_decode_bigend_u32", "lucy_NumUtil_decode_bigend_u32"},
+ {"cfish_NumUtil_decode_bigend_u64", "lucy_NumUtil_decode_bigend_u64"},
+ {"cfish_NumUtil_decode_c32", "lucy_NumUtil_decode_c32"},
+ {"cfish_NumUtil_decode_c64", "lucy_NumUtil_decode_c64"},
+ {"cfish_NumUtil_encode_bigend_f32", "lucy_NumUtil_encode_bigend_f32"},
+ {"cfish_NumUtil_encode_bigend_f64", "lucy_NumUtil_encode_bigend_f64"},
+ {"cfish_NumUtil_encode_bigend_u16", "lucy_NumUtil_encode_bigend_u16"},
+ {"cfish_NumUtil_encode_bigend_u32", "lucy_NumUtil_encode_bigend_u32"},
+ {"cfish_NumUtil_encode_bigend_u64", "lucy_NumUtil_encode_bigend_u64"},
+ {"cfish_NumUtil_encode_c32", "lucy_NumUtil_encode_c32"},
+ {"cfish_NumUtil_encode_c64", "lucy_NumUtil_encode_c64"},
+ {"cfish_NumUtil_encode_padded_c32", "lucy_NumUtil_encode_padded_c32"},
+ {"cfish_NumUtil_u1clear", "lucy_NumUtil_u1clear"},
+ {"cfish_NumUtil_u1flip", "lucy_NumUtil_u1flip"},
+ {"cfish_NumUtil_u1get", "lucy_NumUtil_u1get"},
+ {"cfish_NumUtil_u1set", "lucy_NumUtil_u1set"},
+ {"cfish_NumUtil_u1masks", "lucy_NumUtil_u1masks"},
+ {"cfish_NumUtil_u2get", "lucy_NumUtil_u2get"},
+ {"cfish_NumUtil_u2set", "lucy_NumUtil_u2set"},
+ {"cfish_NumUtil_u2masks", "lucy_NumUtil_u2masks"},
+ {"cfish_NumUtil_u2shifts", "lucy_NumUtil_u2shifts"},
+ {"cfish_NumUtil_u4get", "lucy_NumUtil_u4get"},
+ {"cfish_NumUtil_u4set", "lucy_NumUtil_u4set"},
+ {"cfish_NumUtil_u4masks", "lucy_NumUtil_u4masks"},
+ {"cfish_NumUtil_u4shifts", "lucy_NumUtil_u4shifts"},
+ {"cfish_NumUtil_skip_cint", "lucy_NumUtil_skip_cint"},
+
+ {"cfish_StrHelp_UTF8_COUNT", "lucy_StrHelp_UTF8_COUNT"},
+
+ {"cfish_TestBatch_fail", "lucy_TestBatch_fail"},
+ {"cfish_TestBatch_pass", "lucy_TestBatch_pass"},
+ {"cfish_TestBatch_skip", "lucy_TestBatch_skip"},
+ {"cfish_TestBatch_test_false", "lucy_TestBatch_test_false"},
+ {"cfish_TestBatch_test_float_equals", "lucy_TestBatch_test_float_equals"},
+ {"cfish_TestBatch_test_int_equals", "lucy_TestBatch_test_int_equals"},
+ {"cfish_TestBatch_test_string_equals", "lucy_TestBatch_test_string_equals"},
+ {"cfish_TestBatch_test_true", "lucy_TestBatch_test_true"},
+ {"cfish_TestFormatter", "lucy_TestFormatter"},
+ {"cfish_TestFormatterCF", "lucy_TestFormatterCF"},
+ {"cfish_TestFormatterCF_new", "lucy_TestFormatterCF_new"},
+
{"cfish_VArray", "lucy_VArray"},
{"CFISH_VARRAY", "LUCY_VARRAY"},
{"cfish_VA_new", "lucy_VA_new"},
@@ -94,12 +185,22 @@ struct alias aliases[] = {
{"cfish_VTable", "lucy_VTable"},
{"CFISH_VTABLE", "LUCY_VTABLE"},
- {"cfish_VTable_bootstrap", "lucy_VTable_bootstrap"},
{"cfish_VTable_add_alias_to_registry", "lucy_VTable_add_alias_to_registry"},
+ {"cfish_VTable_bootstrap", "lucy_VTable_bootstrap"},
+ {"cfish_VTable_find_parent_class", "lucy_VTable_find_parent_class"},
+ {"cfish_VTable_foster_obj", "lucy_VTable_foster_obj"},
+ {"cfish_VTable_fresh_host_methods", "lucy_VTable_fresh_host_methods"},
+ {"cfish_VTable_init_obj", "lucy_VTable_init_obj"},
+ {"cfish_VTable_make_obj", "lucy_VTable_make_obj"},
{"cfish_VTable_offset_of_parent", "lucy_VTable_offset_of_parent"},
+ {"cfish_VTable_register_with_host", "lucy_VTable_register_with_host"},
{"cfish_VTable_singleton", "lucy_VTable_singleton"},
+ {"cfish_VTable_to_host", "lucy_VTable_to_host"},
{"Cfish_VTable_Get_Name", "Lucy_VTable_Get_Name"},
{"Cfish_VTable_Make_Obj", "Lucy_VTable_Make_Obj"},
+ {"Cfish_VTable_To_Host", "Lucy_VTable_To_Host"},
+ {"Cfish_VTable_To_Host_OFFSET", "Lucy_VTable_To_Host_OFFSET"},
+ {"Cfish_VTable_To_Host_t", "Lucy_VTable_To_Host_t"},
{"CFISH_USE_SHORT_NAMES", "LUCY_USE_SHORT_NAMES"},
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/CharBuf.c b/core/Clownfish/CharBuf.c
index 88474eb..fda1646 100644
--- a/core/Clownfish/CharBuf.c
+++ b/core/Clownfish/CharBuf.c
@@ -133,7 +133,7 @@ CB_hash_sum(CharBuf *self) {
uint32_t hashvalue = 5381;
ZombieCharBuf *iterator = ZCB_WRAP(self);
- const CB_Nip_One_t nip_one = METHOD_PTR(iterator->vtable, Lucy_CB_Nip_One);
+ const CB_Nip_One_t nip_one = METHOD_PTR(iterator->vtable, Cfish_CB_Nip_One);
while (iterator->size) {
uint32_t code_point = (uint32_t)nip_one((CharBuf*)iterator);
hashvalue = ((hashvalue << 5) + hashvalue) ^ code_point;
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/CharBuf.cfh b/core/Clownfish/CharBuf.cfh
index f9d9ab5..6eeca16 100644
--- a/core/Clownfish/CharBuf.cfh
+++ b/core/Clownfish/CharBuf.cfh
@@ -387,13 +387,13 @@ class Clownfish::ZombieCharBuf cnick ZCB
__C__
-#define CFISH_ZCB_BLANK() lucy_ZCB_new(alloca(lucy_ZCB_size()))
+#define CFISH_ZCB_BLANK() cfish_ZCB_new(alloca(cfish_ZCB_size()))
#define CFISH_ZCB_WRAP(source) \
- lucy_ZCB_wrap(alloca(lucy_ZCB_size()), source)
+ cfish_ZCB_wrap(alloca(cfish_ZCB_size()), source)
#define CFISH_ZCB_WRAP_STR(ptr, size) \
- lucy_ZCB_wrap_str(alloca(lucy_ZCB_size()), ptr, size)
+ cfish_ZCB_wrap_str(alloca(cfish_ZCB_size()), ptr, size)
#ifdef LUCY_USE_SHORT_NAMES
#define ZCB_BLANK CFISH_ZCB_BLANK
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Err.c b/core/Clownfish/Err.c
index ee9f930..0a6e979 100644
--- a/core/Clownfish/Err.c
+++ b/core/Clownfish/Err.c
@@ -68,7 +68,7 @@ Err_cat_mess(Err *self, const CharBuf *mess) {
void
THROW(VTable *vtable, char *pattern, ...) {
va_list args;
- Err_Make_t make = METHOD_PTR(CERTIFY(vtable, VTABLE), Lucy_Err_Make);
+ Err_Make_t make = METHOD_PTR(CERTIFY(vtable, VTABLE), Cfish_Err_Make);
Err *err = (Err*)CERTIFY(make(NULL), ERR);
CharBuf *mess = Err_Get_Mess(err);
@@ -171,7 +171,7 @@ void
Err_throw_at(VTable *vtable, const char *file, int line,
const char *func, const char *pattern, ...) {
va_list args;
- Err_Make_t make = METHOD_PTR(CERTIFY(vtable, VTABLE), Lucy_Err_Make);
+ Err_Make_t make = METHOD_PTR(CERTIFY(vtable, VTABLE), Cfish_Err_Make);
Err *err = (Err*)CERTIFY(make(NULL), ERR);
CharBuf *mess = Err_Get_Mess(err);
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Err.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Err.cfh b/core/Clownfish/Err.cfh
index 777aab2..80ca136 100644
--- a/core/Clownfish/Err.cfh
+++ b/core/Clownfish/Err.cfh
@@ -18,9 +18,8 @@ parcel Lucy;
__C__
typedef void
-(*Lucy_Err_Attempt_t)(void *context);
+(*Cfish_Err_Attempt_t)(void *context);
-#define Cfish_Err_Attempt_t Lucy_Err_Attempt_t
#ifdef LUCY_USE_SHORT_NAMES
#define Err_Attempt_t Cfish_Err_Attempt_t
#endif
@@ -181,66 +180,66 @@ __C__
#endif
#define CFISH_ERR_ADD_FRAME(_error) \
- Lucy_Err_Add_Frame(_error, __FILE__, __LINE__, \
- CFISH_ERR_FUNC_MACRO)
+ Cfish_Err_Add_Frame(_error, __FILE__, __LINE__, \
+ CFISH_ERR_FUNC_MACRO)
#define CFISH_RETHROW(_error) \
- lucy_Err_rethrow((lucy_Err*)_error, __FILE__, __LINE__, \
- CFISH_ERR_FUNC_MACRO)
+ cfish_Err_rethrow((cfish_Err*)_error, __FILE__, __LINE__, \
+ CFISH_ERR_FUNC_MACRO)
-/** Macro version of lucy_Err_throw_at which inserts contextual information
+/** Macro version of cfish_Err_throw_at which inserts contextual information
* automatically, provided that the compiler supports the necessary features.
*/
#ifdef CHY_HAS_VARIADIC_MACROS
#ifdef CHY_HAS_ISO_VARIADIC_MACROS
#define CFISH_THROW(_vtable, ...) \
- lucy_Err_throw_at(_vtable, __FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, \
- __VA_ARGS__)
+ cfish_Err_throw_at(_vtable, __FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, \
+ __VA_ARGS__)
#define CFISH_WARN(...) \
- lucy_Err_warn_at(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, __VA_ARGS__)
+ cfish_Err_warn_at(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, __VA_ARGS__)
#define CFISH_MAKE_MESS(...) \
- lucy_Err_make_mess(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, \
- __VA_ARGS__)
+ cfish_Err_make_mess(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, \
+ __VA_ARGS__)
#elif defined(CHY_HAS_GNUC_VARIADIC_MACROS)
#define CFISH_THROW(_vtable, args...) \
- lucy_Err_throw_at(_vtable, __FILE__, __LINE__, \
- CFISH_ERR_FUNC_MACRO, ##args)
+ cfish_Err_throw_at(_vtable, __FILE__, __LINE__, \
+ CFISH_ERR_FUNC_MACRO, ##args)
#define CFISH_WARN(args...) \
- lucy_Err_warn_at(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, ##args)
+ cfish_Err_warn_at(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, ##args)
#define CFISH_MAKE_MESS(args...) \
- lucy_Err_make_mess(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, ##args)
+ cfish_Err_make_mess(__FILE__, __LINE__, CFISH_ERR_FUNC_MACRO, ##args)
#endif
#else
void
- CFISH_THROW(lucy_VTable *vtable, char* format, ...);
+ CFISH_THROW(cfish_VTable *vtable, char* format, ...);
void
CFISH_WARN(char* format, ...);
- lucy_CharBuf*
+ cfish_CharBuf*
CFISH_MAKE_MESS(char* format, ...);
#endif
#define CFISH_DOWNCAST(_obj, _vtable) \
- lucy_Err_downcast((lucy_Obj*)(_obj), (_vtable), \
- __FILE__, __LINE__, CFISH_ERR_FUNC_MACRO)
+ cfish_Err_downcast((cfish_Obj*)(_obj), (_vtable), \
+ __FILE__, __LINE__, CFISH_ERR_FUNC_MACRO)
#define CFISH_CERTIFY(_obj, _vtable) \
- lucy_Err_certify((lucy_Obj*)(_obj), (_vtable), \
- __FILE__, __LINE__, CFISH_ERR_FUNC_MACRO)
+ cfish_Err_certify((cfish_Obj*)(_obj), (_vtable), \
+ __FILE__, __LINE__, CFISH_ERR_FUNC_MACRO)
static CFISH_INLINE void
-lucy_Err_abstract_class_check(lucy_Obj *obj, lucy_VTable *vtable) {
- lucy_VTable *const my_vtable = (lucy_VTable*)((cfish_Dummy*)obj)->vtable;
+cfish_Err_abstract_class_check(cfish_Obj *obj, cfish_VTable *vtable) {
+ cfish_VTable *const my_vtable = (cfish_VTable*)((cfish_Dummy*)obj)->vtable;
if (my_vtable == vtable) {
- lucy_CharBuf *mess = CFISH_MAKE_MESS("%o is an abstract class",
- Lucy_Obj_Get_Class_Name(obj));
- Lucy_Obj_Dec_RefCount(obj);
- lucy_Err_throw_mess(LUCY_ERR, mess);
+ cfish_CharBuf *mess = CFISH_MAKE_MESS("%o is an abstract class",
+ Cfish_Obj_Get_Class_Name(obj));
+ Cfish_Obj_Dec_RefCount(obj);
+ cfish_Err_throw_mess(CFISH_ERR, mess);
}
}
#define CFISH_ABSTRACT_CLASS_CHECK(_obj, _vtable) \
- lucy_Err_abstract_class_check(((lucy_Obj*)_obj), _vtable)
+ cfish_Err_abstract_class_check(((cfish_Obj*)_obj), _vtable)
#ifdef LUCY_USE_SHORT_NAMES
#define THROW CFISH_THROW
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Hash.c b/core/Clownfish/Hash.c
index 40c9a0b..59c4854 100644
--- a/core/Clownfish/Hash.c
+++ b/core/Clownfish/Hash.c
@@ -35,7 +35,7 @@
static HashTombStone *TOMBSTONE;
-#define HashEntry lucy_HashEntry
+#define HashEntry cfish_HashEntry
typedef struct HashEntry {
Obj *key;
@@ -144,7 +144,7 @@ Hash_load(Hash *self, Obj *dump) {
// Dispatch to an alternate Load() method.
if (vtable) {
- Obj_Load_t load = METHOD_PTR(vtable, Lucy_Obj_Load);
+ Obj_Load_t load = METHOD_PTR(vtable, Cfish_Obj_Load);
if (load == Obj_load) {
THROW(ERR, "Abstract method Load() not defined for %o",
VTable_Get_Name(vtable));
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/LockFreeRegistry.c b/core/Clownfish/LockFreeRegistry.c
index 519dc51..11ab071 100644
--- a/core/Clownfish/LockFreeRegistry.c
+++ b/core/Clownfish/LockFreeRegistry.c
@@ -24,13 +24,13 @@
#include "Clownfish/Util/Atomic.h"
#include "Clownfish/Util/Memory.h"
-typedef struct lucy_LFRegEntry {
+typedef struct cfish_LFRegEntry {
Obj *key;
Obj *value;
int32_t hash_sum;
- struct lucy_LFRegEntry *volatile next;
-} lucy_LFRegEntry;
-#define LFRegEntry lucy_LFRegEntry
+ struct cfish_LFRegEntry *volatile next;
+} cfish_LFRegEntry;
+#define LFRegEntry cfish_LFRegEntry
LockFreeRegistry*
LFReg_new(size_t capacity) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Num.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Num.c b/core/Clownfish/Num.c
index 8d49ab1..e40f825 100644
--- a/core/Clownfish/Num.c
+++ b/core/Clownfish/Num.c
@@ -438,7 +438,7 @@ Bool_deserialize(BoolNum *self, InStream *instream) {
bool value = (bool)InStream_Read_U8(instream);
if (self && self != CFISH_TRUE && self != CFISH_FALSE) {
Bool_Dec_RefCount_t super_decref
- = SUPER_METHOD_PTR(BOOLNUM, Lucy_Bool_Dec_RefCount);
+ = SUPER_METHOD_PTR(BOOLNUM, Cfish_Bool_Dec_RefCount);
super_decref(self);
}
return value ? CFISH_TRUE : CFISH_FALSE;
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Num.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Num.cfh b/core/Clownfish/Num.cfh
index 0ff37be..a684fe1 100644
--- a/core/Clownfish/Num.cfh
+++ b/core/Clownfish/Num.cfh
@@ -300,8 +300,8 @@ class Clownfish::BoolNum cnick Bool inherits Clownfish::IntNum {
__C__
-#define CFISH_TRUE lucy_Bool_true_singleton
-#define CFISH_FALSE lucy_Bool_false_singleton
+#define CFISH_TRUE cfish_Bool_true_singleton
+#define CFISH_FALSE cfish_Bool_false_singleton
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Obj.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Obj.cfh b/core/Clownfish/Obj.cfh
index a801b48..a7370fb 100644
--- a/core/Clownfish/Obj.cfh
+++ b/core/Clownfish/Obj.cfh
@@ -188,33 +188,33 @@ public class Clownfish::Obj {
__C__
static CFISH_INLINE void
-lucy_Obj_super_destroy(lucy_Obj *self, lucy_VTable *vtable) {
- Lucy_Obj_Destroy_t super_destroy
- = CFISH_SUPER_METHOD_PTR(vtable, Lucy_Obj_Destroy);
+cfish_Obj_super_destroy(cfish_Obj *self, cfish_VTable *vtable) {
+ Cfish_Obj_Destroy_t super_destroy
+ = CFISH_SUPER_METHOD_PTR(vtable, Cfish_Obj_Destroy);
super_destroy(self);
}
-#define LUCY_SUPER_DESTROY(_self, _vtable) \
- lucy_Obj_super_destroy((lucy_Obj*)_self, _vtable)
+#define CFISH_SUPER_DESTROY(_self, _vtable) \
+ cfish_Obj_super_destroy((cfish_Obj*)_self, _vtable)
-static CFISH_INLINE lucy_Obj*
-lucy_Obj_incref(lucy_Obj *self) {
- if (self != NULL) { return Lucy_Obj_Inc_RefCount(self); }
+static CFISH_INLINE cfish_Obj*
+cfish_Obj_incref(cfish_Obj *self) {
+ if (self != NULL) { return Cfish_Obj_Inc_RefCount(self); }
else { return NULL; }
}
-#define CFISH_INCREF(_self) lucy_Obj_incref((lucy_Obj*)_self)
+#define CFISH_INCREF(_self) cfish_Obj_incref((cfish_Obj*)_self)
static CFISH_INLINE uint32_t
-lucy_Obj_decref(lucy_Obj *self) {
- if (self != NULL) { return Lucy_Obj_Dec_RefCount(self); }
+cfish_Obj_decref(cfish_Obj *self) {
+ if (self != NULL) { return Cfish_Obj_Dec_RefCount(self); }
else { return 0; }
}
-#define CFISH_DECREF(_self) lucy_Obj_decref((lucy_Obj*)_self)
+#define CFISH_DECREF(_self) cfish_Obj_decref((cfish_Obj*)_self)
#ifdef LUCY_USE_SHORT_NAMES
- #define SUPER_DESTROY(_self, _vtable) LUCY_SUPER_DESTROY(_self, _vtable)
+ #define SUPER_DESTROY(_self, _vtable) CFISH_SUPER_DESTROY(_self, _vtable)
#define INCREF(_self) CFISH_INCREF(_self)
#define DECREF(_self) CFISH_DECREF(_self)
#endif
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/Atomic.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Atomic.c b/core/Clownfish/Util/Atomic.c
index 62c43e2..8bf776a 100644
--- a/core/Clownfish/Util/Atomic.c
+++ b/core/Clownfish/Util/Atomic.c
@@ -23,7 +23,7 @@
#include <windows.h>
bool
-lucy_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
+cfish_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
void *new_value) {
return InterlockedCompareExchangePointer(target, new_value, old_value)
== old_value;
@@ -33,7 +33,7 @@ lucy_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
#elif defined(CHY_HAS_PTHREAD_H)
#include <pthread.h>
-pthread_mutex_t lucy_Atomic_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t cfish_Atomic_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/Atomic.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Atomic.cfh b/core/Clownfish/Util/Atomic.cfh
index 91d3d6b..da741ce 100644
--- a/core/Clownfish/Util/Atomic.cfh
+++ b/core/Clownfish/Util/Atomic.cfh
@@ -27,13 +27,13 @@ __C__
* <code>new_value</code> and return true. Otherwise, return false.
*/
static CFISH_INLINE bool
-lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value);
+cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value);
/************************** Single threaded *******************************/
#ifdef LUCY_NOTHREADS
static CFISH_INLINE bool
-lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
+cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
if (*target == old_value) {
*target = new_value;
return true;
@@ -48,7 +48,7 @@ lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
#include <libkern/OSAtomic.h>
static CFISH_INLINE bool
-lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
+cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
return OSAtomicCompareAndSwapPtr(old_value, new_value, target);
}
@@ -56,12 +56,12 @@ lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
#elif defined(CHY_HAS_WINDOWS_H)
bool
-lucy_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
+cfish_Atomic_wrapped_cas_ptr(void *volatile *target, void *old_value,
void *new_value);
static CFISH_INLINE bool
-lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
- return lucy_Atomic_wrapped_cas_ptr(target, old_value, new_value);
+cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
+ return cfish_Atomic_wrapped_cas_ptr(target, old_value, new_value);
}
/**************************** Solaris 10 and later ************************/
@@ -69,7 +69,7 @@ lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
#include <sys/atomic.h>
static CFISH_INLINE bool
-lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
+cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
return atomic_cas_ptr(target, old_value, new_value) == old_value;
}
@@ -77,18 +77,18 @@ lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
#elif defined(CHY_HAS_PTHREAD_H)
#include <pthread.h>
-extern pthread_mutex_t lucy_Atomic_mutex;
+extern pthread_mutex_t cfish_Atomic_mutex;
static CFISH_INLINE bool
-lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
- pthread_mutex_lock(&lucy_Atomic_mutex);
+cfish_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
+ pthread_mutex_lock(&cfish_Atomic_mutex);
if (*target == old_value) {
*target = new_value;
- pthread_mutex_unlock(&lucy_Atomic_mutex);
+ pthread_mutex_unlock(&cfish_Atomic_mutex);
return true;
}
else {
- pthread_mutex_unlock(&lucy_Atomic_mutex);
+ pthread_mutex_unlock(&cfish_Atomic_mutex);
return false;
}
}
@@ -101,7 +101,7 @@ lucy_Atomic_cas_ptr(void *volatile *target, void *old_value, void *new_value) {
#endif // Big platform if-else chain.
#ifdef LUCY_USE_SHORT_NAMES
- #define Atomic_cas_ptr lucy_Atomic_cas_ptr
+ #define Atomic_cas_ptr cfish_Atomic_cas_ptr
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/Memory.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Memory.cfh b/core/Clownfish/Util/Memory.cfh
index cd249b4..e5ed310 100644
--- a/core/Clownfish/Util/Memory.cfh
+++ b/core/Clownfish/Util/Memory.cfh
@@ -56,16 +56,16 @@ inert class Clownfish::Util::Memory {
__C__
-#define LUCY_MALLOCATE lucy_Memory_wrapped_malloc
-#define LUCY_CALLOCATE lucy_Memory_wrapped_calloc
-#define LUCY_REALLOCATE lucy_Memory_wrapped_realloc
-#define LUCY_FREEMEM lucy_Memory_wrapped_free
+#define CFISH_MALLOCATE cfish_Memory_wrapped_malloc
+#define CFISH_CALLOCATE cfish_Memory_wrapped_calloc
+#define CFISH_REALLOCATE cfish_Memory_wrapped_realloc
+#define CFISH_FREEMEM cfish_Memory_wrapped_free
#ifdef LUCY_USE_SHORT_NAMES
- #define MALLOCATE LUCY_MALLOCATE
- #define CALLOCATE LUCY_CALLOCATE
- #define REALLOCATE LUCY_REALLOCATE
- #define FREEMEM LUCY_FREEMEM
+ #define MALLOCATE CFISH_MALLOCATE
+ #define CALLOCATE CFISH_CALLOCATE
+ #define REALLOCATE CFISH_REALLOCATE
+ #define FREEMEM CFISH_FREEMEM
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/NumberUtils.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/NumberUtils.cfh b/core/Clownfish/Util/NumberUtils.cfh
index 11a5afd..e94b90c 100644
--- a/core/Clownfish/Util/NumberUtils.cfh
+++ b/core/Clownfish/Util/NumberUtils.cfh
@@ -181,7 +181,7 @@ __C__
#include <string.h>
static CFISH_INLINE void
-lucy_NumUtil_encode_bigend_u16(uint16_t value, void *dest_ptr) {
+cfish_NumUtil_encode_bigend_u16(uint16_t value, void *dest_ptr) {
uint8_t *dest = *(uint8_t**)dest_ptr;
#ifdef CHY_BIG_END
memcpy(dest, &value, sizeof(uint16_t));
@@ -193,7 +193,7 @@ lucy_NumUtil_encode_bigend_u16(uint16_t value, void *dest_ptr) {
}
static CFISH_INLINE void
-lucy_NumUtil_encode_bigend_u32(uint32_t value, void *dest_ptr) {
+cfish_NumUtil_encode_bigend_u32(uint32_t value, void *dest_ptr) {
uint8_t *dest = *(uint8_t**)dest_ptr;
#ifdef CHY_BIG_END
memcpy(dest, &value, sizeof(uint32_t));
@@ -207,7 +207,7 @@ lucy_NumUtil_encode_bigend_u32(uint32_t value, void *dest_ptr) {
}
static CFISH_INLINE void
-lucy_NumUtil_encode_bigend_u64(uint64_t value, void *dest_ptr) {
+cfish_NumUtil_encode_bigend_u64(uint64_t value, void *dest_ptr) {
uint8_t *dest = *(uint8_t**)dest_ptr;
#ifdef CHY_BIG_END
memcpy(dest, &value, sizeof(uint64_t));
@@ -225,14 +225,14 @@ lucy_NumUtil_encode_bigend_u64(uint64_t value, void *dest_ptr) {
}
static CFISH_INLINE uint16_t
-lucy_NumUtil_decode_bigend_u16(void *source) {
+cfish_NumUtil_decode_bigend_u16(void *source) {
uint8_t *const buf = (uint8_t*)source;
return (buf[0] << 8) |
(buf[1]);
}
static CFISH_INLINE uint32_t
-lucy_NumUtil_decode_bigend_u32(void *source) {
+cfish_NumUtil_decode_bigend_u32(void *source) {
uint8_t *const buf = (uint8_t*)source;
return (buf[0] << 24) |
(buf[1] << 16) |
@@ -241,7 +241,7 @@ lucy_NumUtil_decode_bigend_u32(void *source) {
}
static CFISH_INLINE uint64_t
-lucy_NumUtil_decode_bigend_u64(void *source) {
+cfish_NumUtil_decode_bigend_u64(void *source) {
uint8_t *const buf = (uint8_t*)source;
uint64_t high_bits = (buf[0] << 24) |
(buf[1] << 16) |
@@ -257,55 +257,55 @@ lucy_NumUtil_decode_bigend_u64(void *source) {
}
static CFISH_INLINE void
-lucy_NumUtil_encode_bigend_f32(float value, void *dest_ptr) {
+cfish_NumUtil_encode_bigend_f32(float value, void *dest_ptr) {
uint8_t *dest = *(uint8_t**)dest_ptr;
#ifdef CHY_BIG_END
memcpy(dest, &value, sizeof(float));
#else
union { float f; uint32_t u32; } duo;
duo.f = value;
- lucy_NumUtil_encode_bigend_u32(duo.u32, &dest);
+ cfish_NumUtil_encode_bigend_u32(duo.u32, &dest);
#endif
}
static CFISH_INLINE void
-lucy_NumUtil_encode_bigend_f64(double value, void *dest_ptr) {
+cfish_NumUtil_encode_bigend_f64(double value, void *dest_ptr) {
uint8_t *dest = *(uint8_t**)dest_ptr;
#ifdef CHY_BIG_END
memcpy(dest, &value, sizeof(double));
#else
union { double d; uint64_t u64; } duo;
duo.d = value;
- lucy_NumUtil_encode_bigend_u64(duo.u64, &dest);
+ cfish_NumUtil_encode_bigend_u64(duo.u64, &dest);
#endif
}
static CFISH_INLINE float
-lucy_NumUtil_decode_bigend_f32(void *source) {
+cfish_NumUtil_decode_bigend_f32(void *source) {
union { float f; uint32_t u32; } duo;
memcpy(&duo, source, sizeof(float));
#ifdef CHY_LITTLE_END
- duo.u32 = lucy_NumUtil_decode_bigend_u32(&duo.u32);
+ duo.u32 = cfish_NumUtil_decode_bigend_u32(&duo.u32);
#endif
return duo.f;
}
static CFISH_INLINE double
-lucy_NumUtil_decode_bigend_f64(void *source) {
+cfish_NumUtil_decode_bigend_f64(void *source) {
union { double d; uint64_t u64; } duo;
memcpy(&duo, source, sizeof(double));
#ifdef CHY_LITTLE_END
- duo.u64 = lucy_NumUtil_decode_bigend_u64(&duo.u64);
+ duo.u64 = cfish_NumUtil_decode_bigend_u64(&duo.u64);
#endif
return duo.d;
}
-#define LUCY_NUMUTIL_C32_MAX_BYTES ((sizeof(uint32_t) * 8 / 7) + 1) // 5
-#define LUCY_NUMUTIL_C64_MAX_BYTES ((sizeof(uint64_t) * 8 / 7) + 1) // 10
+#define CFISH_NUMUTIL_C32_MAX_BYTES ((sizeof(uint32_t) * 8 / 7) + 1) // 5
+#define CFISH_NUMUTIL_C64_MAX_BYTES ((sizeof(uint64_t) * 8 / 7) + 1) // 10
static CFISH_INLINE void
-lucy_NumUtil_encode_c32(uint32_t value, char **out_buf) {
- uint8_t buf[LUCY_NUMUTIL_C32_MAX_BYTES];
+cfish_NumUtil_encode_c32(uint32_t value, char **out_buf) {
+ uint8_t buf[CFISH_NUMUTIL_C32_MAX_BYTES];
uint8_t *const limit = buf + sizeof(buf);
uint8_t *ptr = limit - 1;
int num_bytes;
@@ -323,8 +323,8 @@ lucy_NumUtil_encode_c32(uint32_t value, char **out_buf) {
}
static CFISH_INLINE void
-lucy_NumUtil_encode_c64(uint64_t value, char **out_buf) {
- uint8_t buf[LUCY_NUMUTIL_C64_MAX_BYTES];
+cfish_NumUtil_encode_c64(uint64_t value, char **out_buf) {
+ uint8_t buf[CFISH_NUMUTIL_C64_MAX_BYTES];
uint8_t *const limit = buf + sizeof(buf);
uint8_t *ptr = limit - 1;
int num_bytes;
@@ -342,8 +342,8 @@ lucy_NumUtil_encode_c64(uint64_t value, char **out_buf) {
}
static CFISH_INLINE void
-lucy_NumUtil_encode_padded_c32(uint32_t value, char **out_buf) {
- uint8_t buf[LUCY_NUMUTIL_C32_MAX_BYTES]
+cfish_NumUtil_encode_padded_c32(uint32_t value, char **out_buf) {
+ uint8_t buf[CFISH_NUMUTIL_C32_MAX_BYTES]
= { 0x80, 0x80, 0x80, 0x80, 0x80 };
uint8_t *const limit = buf + sizeof(buf);
uint8_t *ptr = limit - 1;
@@ -355,12 +355,12 @@ lucy_NumUtil_encode_padded_c32(uint32_t value, char **out_buf) {
*--ptr = ((value & 0x7f) | 0x80);
value >>= 7;
}
- memcpy(*out_buf, buf, LUCY_NUMUTIL_C32_MAX_BYTES);
+ memcpy(*out_buf, buf, CFISH_NUMUTIL_C32_MAX_BYTES);
*out_buf += sizeof(buf);
}
// Decode a compressed integer up to size of 'var', advancing 'source'
-#define LUCY_NUMUTIL_DECODE_CINT(var, source) \
+#define CFISH_NUMUTIL_DECODE_CINT(var, source) \
do { \
var = (*source & 0x7f); \
while (*source++ & 0x80) { \
@@ -369,76 +369,76 @@ lucy_NumUtil_encode_padded_c32(uint32_t value, char **out_buf) {
} while (0)
static CFISH_INLINE uint32_t
-lucy_NumUtil_decode_c32(char **source_ptr) {
+cfish_NumUtil_decode_c32(char **source_ptr) {
char *source = *source_ptr;
uint32_t decoded;
- LUCY_NUMUTIL_DECODE_CINT(decoded, source);
+ CFISH_NUMUTIL_DECODE_CINT(decoded, source);
*source_ptr = source;
return decoded;
}
static CFISH_INLINE uint64_t
-lucy_NumUtil_decode_c64(char **source_ptr) {
+cfish_NumUtil_decode_c64(char **source_ptr) {
char *source = *source_ptr;
uint64_t decoded;
- LUCY_NUMUTIL_DECODE_CINT(decoded, source);
+ CFISH_NUMUTIL_DECODE_CINT(decoded, source);
*source_ptr = source;
return decoded;
}
static CFISH_INLINE void
-lucy_NumUtil_skip_cint(char **source_ptr) {
+cfish_NumUtil_skip_cint(char **source_ptr) {
uint8_t *ptr = *(uint8_t**)source_ptr;
while ((*ptr++ & 0x80) != 0) { }
*source_ptr = (char*)ptr;
}
static CFISH_INLINE bool
-lucy_NumUtil_u1get(void *array, uint32_t tick) {
+cfish_NumUtil_u1get(void *array, uint32_t tick) {
uint8_t *const u8bits = (uint8_t*)array;
const uint32_t byte_offset = tick >> 3;
- const uint8_t mask = lucy_NumUtil_u1masks[tick & 0x7];
+ const uint8_t mask = cfish_NumUtil_u1masks[tick & 0x7];
return !((u8bits[byte_offset] & mask) == 0);
}
static CFISH_INLINE void
-lucy_NumUtil_u1set(void *array, uint32_t tick) {
+cfish_NumUtil_u1set(void *array, uint32_t tick) {
uint8_t *const u8bits = (uint8_t*)array;
const uint32_t byte_offset = tick >> 3;
- const uint8_t mask = lucy_NumUtil_u1masks[tick & 0x7];
+ const uint8_t mask = cfish_NumUtil_u1masks[tick & 0x7];
u8bits[byte_offset] |= mask;
}
static CFISH_INLINE void
-lucy_NumUtil_u1clear(void *array, uint32_t tick) {
+cfish_NumUtil_u1clear(void *array, uint32_t tick) {
uint8_t *const u8bits = (uint8_t*)array;
const uint32_t byte_offset = tick >> 3;
- const uint8_t mask = lucy_NumUtil_u1masks[tick & 0x7];
+ const uint8_t mask = cfish_NumUtil_u1masks[tick & 0x7];
u8bits[byte_offset] &= ~mask;
}
static CFISH_INLINE void
-lucy_NumUtil_u1flip(void *array, uint32_t tick) {
+cfish_NumUtil_u1flip(void *array, uint32_t tick) {
uint8_t *const u8bits = (uint8_t*)array;
const uint32_t byte_offset = tick >> 3;
- const uint8_t mask = lucy_NumUtil_u1masks[tick & 0x7];
+ const uint8_t mask = cfish_NumUtil_u1masks[tick & 0x7];
u8bits[byte_offset] ^= mask;
}
static CFISH_INLINE uint8_t
-lucy_NumUtil_u2get(void *array, uint32_t tick) {
+cfish_NumUtil_u2get(void *array, uint32_t tick) {
uint8_t *ints = (uint8_t*)array;
uint8_t byte = ints[(tick >> 2)];
- int shift = lucy_NumUtil_u2shifts[tick & 0x3];
+ int shift = cfish_NumUtil_u2shifts[tick & 0x3];
return (byte >> shift) & 0x3;
}
static CFISH_INLINE void
-lucy_NumUtil_u2set(void *array, uint32_t tick, uint8_t value) {
+cfish_NumUtil_u2set(void *array, uint32_t tick, uint8_t value) {
uint8_t *ints = (uint8_t*)array;
unsigned sub_tick = tick & 0x3;
- int shift = lucy_NumUtil_u2shifts[sub_tick];
- uint8_t mask = lucy_NumUtil_u2masks[sub_tick];
+ int shift = cfish_NumUtil_u2shifts[sub_tick];
+ uint8_t mask = cfish_NumUtil_u2masks[sub_tick];
uint8_t new_val = value & 0x3;
uint8_t new_bits = new_val << shift;
ints[(tick >> 2)] = (ints[(tick >> 2)] & ~mask) | new_bits;
@@ -446,27 +446,27 @@ lucy_NumUtil_u2set(void *array, uint32_t tick, uint8_t value) {
static CFISH_INLINE uint8_t
-lucy_NumUtil_u4get(void *array, uint32_t tick) {
+cfish_NumUtil_u4get(void *array, uint32_t tick) {
uint8_t *ints = (uint8_t*)array;
uint8_t byte = ints[(tick >> 1)];
- int shift = lucy_NumUtil_u4shifts[(tick & 1)];
+ int shift = cfish_NumUtil_u4shifts[(tick & 1)];
return (byte >> shift) & 0xF;
}
static CFISH_INLINE void
-lucy_NumUtil_u4set(void *array, uint32_t tick, uint8_t value) {
+cfish_NumUtil_u4set(void *array, uint32_t tick, uint8_t value) {
uint8_t *ints = (uint8_t*)array;
unsigned sub_tick = tick & 0x1;
- int shift = lucy_NumUtil_u4shifts[sub_tick];
- uint8_t mask = lucy_NumUtil_u4masks[sub_tick];
+ int shift = cfish_NumUtil_u4shifts[sub_tick];
+ uint8_t mask = cfish_NumUtil_u4masks[sub_tick];
uint8_t new_val = value & 0xF;
uint8_t new_bits = new_val << shift;
ints[(tick >> 1)] = (ints[(tick >> 1)] & ~mask) | new_bits;
}
#ifdef LUCY_USE_SHORT_NAMES
- #define C32_MAX_BYTES LUCY_NUMUTIL_C32_MAX_BYTES
- #define C64_MAX_BYTES LUCY_NUMUTIL_C64_MAX_BYTES
+ #define C32_MAX_BYTES CFISH_NUMUTIL_C32_MAX_BYTES
+ #define C64_MAX_BYTES CFISH_NUMUTIL_C64_MAX_BYTES
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/SortUtils.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/SortUtils.c b/core/Clownfish/Util/SortUtils.c
index 3b17077..18eb88d 100644
--- a/core/Clownfish/Util/SortUtils.c
+++ b/core/Clownfish/Util/SortUtils.c
@@ -33,22 +33,22 @@
// Recursive merge sorting functions.
static void
S_msort4(void *velems, void *vscratch, uint32_t left, uint32_t right,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
static void
S_msort8(void *velems, void *vscratch, uint32_t left, uint32_t right,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
static void
S_msort_any(void *velems, void *vscratch, uint32_t left, uint32_t right,
- Lucy_Sort_Compare_t compare, void *context, size_t width);
+ Cfish_Sort_Compare_t compare, void *context, size_t width);
static INLINE void
SI_merge(void *left_vptr, uint32_t left_size,
void *right_vptr, uint32_t right_size,
- void *vdest, size_t width, Lucy_Sort_Compare_t compare, void *context);
+ void *vdest, size_t width, Cfish_Sort_Compare_t compare, void *context);
void
Sort_mergesort(void *elems, void *scratch, uint32_t num_elems, uint32_t width,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
// Arrays of 0 or 1 items are already sorted.
if (num_elems < 2) { return; }
@@ -79,7 +79,7 @@ Sort_mergesort(void *elems, void *scratch, uint32_t num_elems, uint32_t width,
void
Sort_merge(void *left_ptr, uint32_t left_size,
void *right_ptr, uint32_t right_size,
- void *dest, size_t width, Lucy_Sort_Compare_t compare,
+ void *dest, size_t width, Cfish_Sort_Compare_t compare,
void *context) {
switch (width) {
case 0:
@@ -103,7 +103,7 @@ Sort_merge(void *left_ptr, uint32_t left_size,
#define WIDTH 4
static void
S_msort4(void *velems, void *vscratch, uint32_t left, uint32_t right,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
uint8_t *elems = (uint8_t*)velems;
uint8_t *scratch = (uint8_t*)vscratch;
if (right > left) {
@@ -121,7 +121,7 @@ S_msort4(void *velems, void *vscratch, uint32_t left, uint32_t right,
#define WIDTH 8
static void
S_msort8(void *velems, void *vscratch, uint32_t left, uint32_t right,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
uint8_t *elems = (uint8_t*)velems;
uint8_t *scratch = (uint8_t*)vscratch;
if (right > left) {
@@ -138,7 +138,7 @@ S_msort8(void *velems, void *vscratch, uint32_t left, uint32_t right,
#undef WIDTH
static void
S_msort_any(void *velems, void *vscratch, uint32_t left, uint32_t right,
- Lucy_Sort_Compare_t compare, void *context, size_t width) {
+ Cfish_Sort_Compare_t compare, void *context, size_t width) {
uint8_t *elems = (uint8_t*)velems;
uint8_t *scratch = (uint8_t*)vscratch;
if (right > left) {
@@ -155,7 +155,7 @@ S_msort_any(void *velems, void *vscratch, uint32_t left, uint32_t right,
static INLINE void
SI_merge(void *left_vptr, uint32_t left_size,
void *right_vptr, uint32_t right_size,
- void *vdest, size_t width, Lucy_Sort_Compare_t compare,
+ void *vdest, size_t width, Cfish_Sort_Compare_t compare,
void *context) {
uint8_t *left_ptr = (uint8_t*)left_vptr;
uint8_t *right_ptr = (uint8_t*)right_vptr;
@@ -188,10 +188,10 @@ SI_merge(void *left_vptr, uint32_t left_size,
// Quicksort implementations optimized for four-byte and eight-byte elements.
static void
S_qsort4(FOUR_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
static void
S_qsort8(EIGHT_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
// Swap two elements.
static INLINE void
@@ -221,14 +221,14 @@ SI_exchange8(EIGHT_BYTE_TYPE *elems, int32_t left, int32_t right);
*/
static INLINE FOUR_BYTE_TYPE*
SI_choose_pivot4(FOUR_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
static INLINE EIGHT_BYTE_TYPE*
SI_choose_pivot8(EIGHT_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
void
Sort_quicksort(void *elems, size_t num_elems, size_t width,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
// Arrays of 0 or 1 items are already sorted.
if (num_elems < 2) { return; }
@@ -260,7 +260,7 @@ SI_exchange4(FOUR_BYTE_TYPE *elems, int32_t left, int32_t right) {
static INLINE FOUR_BYTE_TYPE*
SI_choose_pivot4(FOUR_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
if (right - left > 1) {
int32_t mid = left + (right - left) / 2;
if (compare(context, elems + left, elems + mid) > 0) {
@@ -278,7 +278,7 @@ SI_choose_pivot4(FOUR_BYTE_TYPE *elems, int32_t left, int32_t right,
static void
S_qsort4(FOUR_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
FOUR_BYTE_TYPE *const pivot
= SI_choose_pivot4(elems, left, right, compare, context);
int32_t i = left - 1;
@@ -365,7 +365,7 @@ SI_exchange8(EIGHT_BYTE_TYPE *elems, int32_t left, int32_t right) {
static INLINE EIGHT_BYTE_TYPE*
SI_choose_pivot8(EIGHT_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
if (right - left > 1) {
int32_t mid = left + (right - left) / 2;
if (compare(context, elems + left, elems + mid) > 0) {
@@ -383,7 +383,7 @@ SI_choose_pivot8(EIGHT_BYTE_TYPE *elems, int32_t left, int32_t right,
static void
S_qsort8(EIGHT_BYTE_TYPE *elems, int32_t left, int32_t right,
- Lucy_Sort_Compare_t compare, void *context) {
+ Cfish_Sort_Compare_t compare, void *context) {
EIGHT_BYTE_TYPE *const pivot
= SI_choose_pivot8(elems, left, right, compare, context);
int32_t i = left - 1;
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/SortUtils.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/SortUtils.cfh b/core/Clownfish/Util/SortUtils.cfh
index 4071a32..7667e81 100644
--- a/core/Clownfish/Util/SortUtils.cfh
+++ b/core/Clownfish/Util/SortUtils.cfh
@@ -18,7 +18,7 @@ parcel Lucy;
__C__
typedef int
-(*Lucy_Sort_Compare_t)(void *context, const void *va, const void *vb);
+(*Cfish_Sort_Compare_t)(void *context, const void *va, const void *vb);
__END_C__
/** Specialized sorting routines.
@@ -38,7 +38,7 @@ inert class Clownfish::Util::SortUtils cnick Sort {
*/
inert void
mergesort(void *elems, void *scratch, uint32_t num_elems, uint32_t width,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
/** Merge two source arrays together using the classic mergesort merge
* algorithm, storing the result in <code>dest</code>.
@@ -56,13 +56,13 @@ inert class Clownfish::Util::SortUtils cnick Sort {
inert void
merge(void *left_ptr, uint32_t left_num_elems,
void *right_ptr, uint32_t right_num_elems,
- void *dest, size_t width, Lucy_Sort_Compare_t compare, void *context);
+ void *dest, size_t width, Cfish_Sort_Compare_t compare, void *context);
/** Quicksort.
*/
inert void
quicksort(void *elems, size_t num_elems, size_t width,
- Lucy_Sort_Compare_t compare, void *context);
+ Cfish_Sort_Compare_t compare, void *context);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/StringHelper.c b/core/Clownfish/Util/StringHelper.c
index 58f278d..7726f9d 100644
--- a/core/Clownfish/Util/StringHelper.c
+++ b/core/Clownfish/Util/StringHelper.c
@@ -24,7 +24,7 @@
#include "Clownfish/Err.h"
#include "Clownfish/Util/Memory.h"
-const uint8_t lucy_StrHelp_UTF8_COUNT[] = {
+const uint8_t cfish_StrHelp_UTF8_COUNT[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/Util/StringHelper.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/StringHelper.cfh b/core/Clownfish/Util/StringHelper.cfh
index 60d6d78..9d7f4e0 100644
--- a/core/Clownfish/Util/StringHelper.cfh
+++ b/core/Clownfish/Util/StringHelper.cfh
@@ -74,9 +74,9 @@ __C__
/** The maximum number of bytes encoded by to_base36(), including the
* terminating NULL.
*/
-#define lucy_StrHelp_MAX_BASE36_BYTES 14
+#define cfish_StrHelp_MAX_BASE36_BYTES 14
#ifdef LUCY_USE_SHORT_NAMES
- #define StrHelp_MAX_BASE36_BYTES lucy_StrHelp_MAX_BASE36_BYTES
+ #define StrHelp_MAX_BASE36_BYTES cfish_StrHelp_MAX_BASE36_BYTES
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/VArray.c b/core/Clownfish/VArray.c
index 08314cf..7da0d33 100644
--- a/core/Clownfish/VArray.c
+++ b/core/Clownfish/VArray.c
@@ -307,7 +307,7 @@ S_default_compare(void *context, const void *va, const void *vb) {
}
void
-VA_sort(VArray *self, Lucy_Sort_Compare_t compare, void *context) {
+VA_sort(VArray *self, Cfish_Sort_Compare_t compare, void *context) {
if (!compare) { compare = S_default_compare; }
Sort_quicksort(self->elems, self->size, sizeof(void*), compare, context);
}
@@ -332,7 +332,7 @@ VA_equals(VArray *self, Obj *other) {
}
VArray*
-VA_gather(VArray *self, Lucy_VA_Gather_Test_t test, void *data) {
+VA_gather(VArray *self, VA_Gather_Test_t test, void *data) {
VArray *gathered = VA_new(self->size);
for (uint32_t i = 0, max = self->size; i < max; i++) {
if (test(self, i, data)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/VArray.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/VArray.cfh b/core/Clownfish/VArray.cfh
index e6f8741..f36e31d 100644
--- a/core/Clownfish/VArray.cfh
+++ b/core/Clownfish/VArray.cfh
@@ -20,10 +20,10 @@ __C__
#include "Clownfish/Util/SortUtils.h"
typedef bool
-(*Lucy_VA_Gather_Test_t)(lucy_VArray *self, uint32_t tick, void *data);
+(*Cfish_VA_Gather_Test_t)(cfish_VArray *self, uint32_t tick, void *data);
#ifdef LUCY_USE_SHORT_NAMES
- #define Lucy_VA_Gather_Test_t Lucy_VA_Gather_Test_t
+ #define VA_Gather_Test_t Cfish_VA_Gather_Test_t
#endif
__END_C__
@@ -119,7 +119,7 @@ class Clownfish::VArray cnick VA inherits Clownfish::Obj {
* @param context Argument supplied to the comparison routine.
*/
void
- Sort(VArray *self, Lucy_Sort_Compare_t compare = NULL,
+ Sort(VArray *self, Cfish_Sort_Compare_t compare = NULL,
void *context = NULL);
/** Set the size for the VArray. If the new size is larger than the
@@ -147,7 +147,7 @@ class Clownfish::VArray cnick VA inherits Clownfish::Obj {
/** Return all elements for which <code>test</code> returns true.
*/
public incremented VArray*
- Gather(VArray *self, Lucy_VA_Gather_Test_t test, void *data);
+ Gather(VArray *self, Cfish_VA_Gather_Test_t test, void *data);
/** Return a new array consisting of elements from a contiguous slice. If
* the specified range is out of bounds, return an array with fewer
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/VTable.c b/core/Clownfish/VTable.c
index 7abdb8e..dbc5715 100644
--- a/core/Clownfish/VTable.c
+++ b/core/Clownfish/VTable.c
@@ -278,7 +278,7 @@ VTable_singleton(const CharBuf *class_name, VTable *parent) {
Obj*
VTable_load_obj(VTable *self, Obj *dump) {
- Obj_Load_t load = METHOD_PTR(self, Lucy_Obj_Load);
+ Obj_Load_t load = METHOD_PTR(self, Cfish_Obj_Load);
if (load == Obj_load) {
THROW(ERR, "Abstract method Load() not defined for %o", self->name);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Lucy/Plan/FieldType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/FieldType.cfh b/core/Lucy/Plan/FieldType.cfh
index 7f3df32..bad2186 100644
--- a/core/Lucy/Plan/FieldType.cfh
+++ b/core/Lucy/Plan/FieldType.cfh
@@ -169,7 +169,7 @@ __C__
static CFISH_INLINE int32_t
lucy_FType_null_back_compare_values(lucy_FieldType *self,
- lucy_Obj *a, lucy_Obj *b) {
+ cfish_Obj *a, cfish_Obj *b) {
if (a == NULL) {
if (b == NULL) { return 0; }
else { return 1; }
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Lucy/Test.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test.cfh b/core/Lucy/Test.cfh
index 34775fa..661b6a0 100644
--- a/core/Lucy/Test.cfh
+++ b/core/Lucy/Test.cfh
@@ -28,14 +28,14 @@ inert class Lucy::Test {
__C__
#ifdef LUCY_USE_SHORT_NAMES
- #define TEST_TRUE lucy_TestBatch_test_true
- #define TEST_FALSE lucy_TestBatch_test_false
- #define TEST_INT_EQ lucy_TestBatch_test_int_equals
- #define TEST_FLOAT_EQ lucy_TestBatch_test_float_equals
- #define TEST_STR_EQ lucy_TestBatch_test_string_equals
- #define PASS lucy_TestBatch_pass
- #define FAIL lucy_TestBatch_fail
- #define SKIP lucy_TestBatch_skip
+ #define TEST_TRUE cfish_TestBatch_test_true
+ #define TEST_FALSE cfish_TestBatch_test_false
+ #define TEST_INT_EQ cfish_TestBatch_test_int_equals
+ #define TEST_FLOAT_EQ cfish_TestBatch_test_float_equals
+ #define TEST_STR_EQ cfish_TestBatch_test_string_equals
+ #define PASS cfish_TestBatch_pass
+ #define FAIL cfish_TestBatch_fail
+ #define SKIP cfish_TestBatch_skip
#endif
__END_C__
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Lucy/Test/Index/TestTermInfo.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Index/TestTermInfo.c b/core/Lucy/Test/Index/TestTermInfo.c
index c6f996b..9de3a08 100644
--- a/core/Lucy/Test/Index/TestTermInfo.c
+++ b/core/Lucy/Test/Index/TestTermInfo.c
@@ -42,7 +42,7 @@ test_freqfilepos(TestBatch *batch) {
TermInfo* cloned_tinfo = TInfo_Clone(tinfo);
- TEST_FALSE(batch, Lucy_TInfo_Equals(tinfo, (lucy_Obj*)cloned_tinfo),"the clone should be a separate C struct");
+ TEST_FALSE(batch, Lucy_TInfo_Equals(tinfo, (Obj*)cloned_tinfo),"the clone should be a separate C struct");
TEST_INT_EQ(batch, TInfo_Get_Doc_Freq(tinfo), 10, "new sets doc_freq correctly" );
TEST_INT_EQ(batch, TInfo_Get_Doc_Freq(tinfo), 10, "... doc_freq cloned" );
TEST_INT_EQ(batch, TInfo_Get_Post_FilePos(tinfo), 20, "... post_filepos cloned" );
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index c0885c8..154c38d 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -30,7 +30,7 @@
void*
LucyParseJsonAlloc(void * (*allocate)(size_t));
void
-LucyParseJson(void *json_parser, int token_type, lucy_Obj *value,
+LucyParseJson(void *json_parser, int token_type, Obj *value,
lucy_JsonParserState *state);
void
LucyParseJsonFree(void *json_parser, void(*freemem)(void*));
@@ -368,14 +368,14 @@ S_to_json(Obj *dump, CharBuf *json, int32_t depth) {
static Obj*
S_parse_json(char *text, size_t size) {
- void *json_parser = LucyParseJsonAlloc(lucy_Memory_wrapped_malloc);
+ void *json_parser = LucyParseJsonAlloc(Memory_wrapped_malloc);
if (json_parser == NULL) {
CharBuf *mess = MAKE_MESS("Failed to allocate JSON parser");
Err_set_error(Err_new(mess));
return NULL;
}
Obj *dump = S_do_parse_json(json_parser, text, size);
- LucyParseJsonFree(json_parser, lucy_Memory_wrapped_free);
+ LucyParseJsonFree(json_parser, Memory_wrapped_free);
return dump;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Lucy/Util/Json.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.cfh b/core/Lucy/Util/Json.cfh
index 3dcd0a9..f872438 100644
--- a/core/Lucy/Util/Json.cfh
+++ b/core/Lucy/Util/Json.cfh
@@ -62,8 +62,8 @@ __C__
struct lucy_JsonParserState
{
- lucy_Obj *result;
- bool errors;
+ cfish_Obj *result;
+ bool errors;
};
typedef struct lucy_JsonParserState lucy_JsonParserState;
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 4f530f7..1a220ed 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -125,8 +125,8 @@ SortEx_sort_cache(SortExternal *self) {
}
if (self->cache_max != 0) {
VTable *vtable = SortEx_Get_VTable(self);
- Lucy_Sort_Compare_t compare
- = (Lucy_Sort_Compare_t)METHOD_PTR(vtable, Lucy_SortEx_Compare);
+ Cfish_Sort_Compare_t compare
+ = (Cfish_Sort_Compare_t)METHOD_PTR(vtable, Lucy_SortEx_Compare);
if (self->scratch_cap < self->cache_cap) {
self->scratch_cap = self->cache_cap;
self->scratch = (uint8_t*)REALLOCATE(
@@ -219,8 +219,8 @@ S_absorb_slices(SortExternal *self, uint8_t *endpost) {
uint8_t **slice_starts = self->slice_starts;
uint32_t *slice_sizes = self->slice_sizes;
VTable *vtable = SortEx_Get_VTable(self);
- Lucy_Sort_Compare_t compare
- = (Lucy_Sort_Compare_t)METHOD_PTR(vtable, Lucy_SortEx_Compare);
+ Cfish_Sort_Compare_t compare
+ = (Cfish_Sort_Compare_t)METHOD_PTR(vtable, Lucy_SortEx_Compare);
if (self->cache_max != 0) { THROW(ERR, "Can't refill unless empty"); }
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/perl/buildlib/Lucy/Build/Binding/Object.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Object.pm b/perl/buildlib/Lucy/Build/Binding/Object.pm
index 8adbbfe..ba9f957 100644
--- a/perl/buildlib/Lucy/Build/Binding/Object.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Object.pm
@@ -333,7 +333,7 @@ CODE:
}
if (ints_av && SvTYPE(ints_av) == SVt_PVAV) {
int32_t size = av_len(ints_av) + 1;
- int32_t *ints = (int32_t*)LUCY_MALLOCATE(size * sizeof(int32_t));
+ int32_t *ints = (int32_t*)CFISH_MALLOCATE(size * sizeof(int32_t));
int32_t i;
for (i = 0; i < size; i++) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/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..237e93d 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -221,7 +221,7 @@ to_base36(num)
uint64_t num;
CODE:
{
- char base36[lucy_StrHelp_MAX_BASE36_BYTES];
+ char base36[cfish_StrHelp_MAX_BASE36_BYTES];
size_t size = lucy_StrHelp_to_base36(num, &base36);
RETVAL = newSVpvn(base36, size);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/perl/xs/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c
index e386cf6..211e461 100644
--- a/perl/xs/Lucy/Analysis/RegexTokenizer.c
+++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c
@@ -127,7 +127,7 @@ void
lucy_RegexTokenizer_destroy(lucy_RegexTokenizer *self) {
CFISH_DECREF(self->pattern);
ReREFCNT_dec(((REGEXP*)self->token_re));
- LUCY_SUPER_DESTROY(self, LUCY_REGEXTOKENIZER);
+ CFISH_SUPER_DESTROY(self, LUCY_REGEXTOKENIZER);
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index 0f0de76..aa3e4df 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -237,7 +237,7 @@ lucy_Doc_equals(lucy_Doc *self, lucy_Obj *other) {
void
lucy_Doc_destroy(lucy_Doc *self) {
if (self->fields) { SvREFCNT_dec((SV*)self->fields); }
- LUCY_SUPER_DESTROY(self, LUCY_DOC);
+ CFISH_SUPER_DESTROY(self, LUCY_DOC);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/9c65f940/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/perl/xs/XSBind.c b/perl/xs/XSBind.c
index 3261069..8352355 100644
--- a/perl/xs/XSBind.c
+++ b/perl/xs/XSBind.c
@@ -542,7 +542,7 @@ XSBind_allot_params(SV** stack, int32_t start, int32_t num_stack_elems, ...) {
if (SvCUR(key_sv) == (STRLEN)label_len) {
if (memcmp(SvPVX(key_sv), label, label_len) == 0) {
found_arg = tick;
- lucy_NumUtil_u1set(verified_labels, tick);
+ cfish_NumUtil_u1set(verified_labels, tick);
}
}
}
@@ -573,7 +573,7 @@ XSBind_allot_params(SV** stack, int32_t start, int32_t num_stack_elems, ...) {
// Ensure that all parameter labels were valid.
for (int32_t tick = start; tick < num_stack_elems; tick += 2) {
- if (!lucy_NumUtil_u1get(verified_labels, tick)) {
+ if (!cfish_NumUtil_u1get(verified_labels, tick)) {
SV *const key_sv = stack[tick];
char *key = SvPV_nolen(key_sv);
cfish_CharBuf *mess
@@ -594,7 +594,7 @@ XSBind_allot_params(SV** stack, int32_t start, int32_t num_stack_elems, ...) {
/**************************** Clownfish::Obj *******************************/
static void
-S_lazy_init_host_obj(lucy_Obj *self) {
+S_lazy_init_host_obj(cfish_Obj *self) {
SV *inner_obj = newSV(0);
SvOBJECT_on(inner_obj);
#if (PERL_VERSION <= 16)
@@ -604,9 +604,9 @@ S_lazy_init_host_obj(lucy_Obj *self) {
sv_setiv(inner_obj, PTR2IV(self));
// Connect class association.
- lucy_CharBuf *class_name = Lucy_VTable_Get_Name(self->vtable);
- HV *stash = gv_stashpvn((char*)Lucy_CB_Get_Ptr8(class_name),
- Lucy_CB_Get_Size(class_name), TRUE);
+ cfish_CharBuf *class_name = Cfish_VTable_Get_Name(self->vtable);
+ HV *stash = gv_stashpvn((char*)Cfish_CB_Get_Ptr8(class_name),
+ Cfish_CB_Get_Size(class_name), TRUE);
SvSTASH_set(inner_obj, (HV*)SvREFCNT_inc(stash));
/* Up till now we've been keeping track of the refcount in
@@ -620,17 +620,17 @@ S_lazy_init_host_obj(lucy_Obj *self) {
}
uint32_t
-lucy_Obj_get_refcount(lucy_Obj *self) {
+cfish_Obj_get_refcount(cfish_Obj *self) {
return self->ref.count & XSBIND_REFCOUNT_FLAG
? self->ref.count >> XSBIND_REFCOUNT_SHIFT
: SvREFCNT((SV*)self->ref.host_obj);
}
-lucy_Obj*
-lucy_Obj_inc_refcount(lucy_Obj *self) {
+cfish_Obj*
+cfish_Obj_inc_refcount(cfish_Obj *self) {
if (self->ref.count & XSBIND_REFCOUNT_FLAG) {
if (self->ref.count == XSBIND_REFCOUNT_FLAG) {
- CFISH_THROW(LUCY_ERR, "Illegal refcount of 0");
+ CFISH_THROW(CFISH_ERR, "Illegal refcount of 0");
}
self->ref.count += 1 << XSBIND_REFCOUNT_SHIFT;
}
@@ -641,16 +641,16 @@ lucy_Obj_inc_refcount(lucy_Obj *self) {
}
uint32_t
-lucy_Obj_dec_refcount(lucy_Obj *self) {
+cfish_Obj_dec_refcount(cfish_Obj *self) {
uint32_t modified_refcount = I32_MAX;
if (self->ref.count & XSBIND_REFCOUNT_FLAG) {
if (self->ref.count == XSBIND_REFCOUNT_FLAG) {
- CFISH_THROW(LUCY_ERR, "Illegal refcount of 0");
+ CFISH_THROW(CFISH_ERR, "Illegal refcount of 0");
}
if (self->ref.count
== ((1 << XSBIND_REFCOUNT_SHIFT) | XSBIND_REFCOUNT_FLAG)) {
modified_refcount = 0;
- Lucy_Obj_Destroy(self);
+ Cfish_Obj_Destroy(self);
}
else {
self->ref.count -= 1 << XSBIND_REFCOUNT_SHIFT;
@@ -667,34 +667,34 @@ lucy_Obj_dec_refcount(lucy_Obj *self) {
}
void*
-lucy_Obj_to_host(lucy_Obj *self) {
+cfish_Obj_to_host(cfish_Obj *self) {
if (self->ref.count & XSBIND_REFCOUNT_FLAG) { S_lazy_init_host_obj(self); }
return newRV_inc((SV*)self->ref.host_obj);
}
/*************************** Clownfish::VTable ******************************/
-lucy_Obj*
-lucy_VTable_make_obj(lucy_VTable *self) {
- lucy_Obj *obj
- = (lucy_Obj*)lucy_Memory_wrapped_calloc(self->obj_alloc_size, 1);
+cfish_Obj*
+cfish_VTable_make_obj(cfish_VTable *self) {
+ cfish_Obj *obj
+ = (cfish_Obj*)cfish_Memory_wrapped_calloc(self->obj_alloc_size, 1);
obj->vtable = self;
obj->ref.count = (1 << XSBIND_REFCOUNT_SHIFT) | XSBIND_REFCOUNT_FLAG;
return obj;
}
-lucy_Obj*
-lucy_VTable_init_obj(lucy_VTable *self, void *allocation) {
- lucy_Obj *obj = (lucy_Obj*)allocation;
+cfish_Obj*
+cfish_VTable_init_obj(cfish_VTable *self, void *allocation) {
+ cfish_Obj *obj = (cfish_Obj*)allocation;
obj->vtable = self;
obj->ref.count = (1 << XSBIND_REFCOUNT_SHIFT) | XSBIND_REFCOUNT_FLAG;
return obj;
}
-lucy_Obj*
-lucy_VTable_foster_obj(lucy_VTable *self, void *host_obj) {
- lucy_Obj *obj
- = (lucy_Obj*)lucy_Memory_wrapped_calloc(self->obj_alloc_size, 1);
+cfish_Obj*
+cfish_VTable_foster_obj(cfish_VTable *self, void *host_obj) {
+ cfish_Obj *obj
+ = (cfish_Obj*)cfish_Memory_wrapped_calloc(self->obj_alloc_size, 1);
SV *inner_obj = SvRV((SV*)host_obj);
obj->vtable = self;
sv_setiv(inner_obj, PTR2IV(obj));
@@ -703,22 +703,22 @@ lucy_VTable_foster_obj(lucy_VTable *self, void *host_obj) {
}
void
-lucy_VTable_register_with_host(lucy_VTable *singleton, lucy_VTable *parent) {
+cfish_VTable_register_with_host(cfish_VTable *singleton, cfish_VTable *parent) {
dSP;
ENTER;
SAVETMPS;
EXTEND(SP, 2);
PUSHMARK(SP);
- mPUSHs((SV*)Lucy_VTable_To_Host(singleton));
- mPUSHs((SV*)Lucy_VTable_To_Host(parent));
+ mPUSHs((SV*)Cfish_VTable_To_Host(singleton));
+ mPUSHs((SV*)Cfish_VTable_To_Host(parent));
PUTBACK;
call_pv("Clownfish::VTable::_register", G_VOID | G_DISCARD);
FREETMPS;
LEAVE;
}
-lucy_VArray*
-lucy_VTable_fresh_host_methods(const lucy_CharBuf *class_name) {
+cfish_VArray*
+cfish_VTable_fresh_host_methods(const cfish_CharBuf *class_name) {
dSP;
ENTER;
SAVETMPS;
@@ -735,8 +735,8 @@ lucy_VTable_fresh_host_methods(const lucy_CharBuf *class_name) {
return methods;
}
-lucy_CharBuf*
-lucy_VTable_find_parent_class(const lucy_CharBuf *class_name) {
+cfish_CharBuf*
+cfish_VTable_find_parent_class(const cfish_CharBuf *class_name) {
dSP;
ENTER;
SAVETMPS;
@@ -756,10 +756,10 @@ lucy_VTable_find_parent_class(const lucy_CharBuf *class_name) {
}
void*
-lucy_VTable_to_host(lucy_VTable *self) {
+cfish_VTable_to_host(cfish_VTable *self) {
bool first_time = self->ref.count & XSBIND_REFCOUNT_FLAG ? true : false;
- Lucy_VTable_To_Host_t to_host
- = CFISH_SUPER_METHOD_PTR(LUCY_VTABLE, Lucy_VTable_To_Host);
+ Cfish_VTable_To_Host_t to_host
+ = CFISH_SUPER_METHOD_PTR(CFISH_VTABLE, Cfish_VTable_To_Host);
SV *host_obj = (SV*)to_host(self);
if (first_time) {
SvSHARE((SV*)self->ref.host_obj);
@@ -774,7 +774,7 @@ lucy_VTable_to_host(lucy_VTable *self) {
// so that it can be run inside a Perl eval block.
static SV *attempt_xsub = NULL;
-XS(lucy_Err_attempt_via_xs) {
+XS(cfish_Err_attempt_via_xs) {
dXSARGS;
CHY_UNUSED_VAR(cv);
SP -= items;
@@ -790,13 +790,13 @@ XS(lucy_Err_attempt_via_xs) {
}
void
-lucy_Err_init_class(void) {
+cfish_Err_init_class(void) {
char *file = (char*)__FILE__;
- attempt_xsub = (SV*)newXS(NULL, lucy_Err_attempt_via_xs, file);
+ attempt_xsub = (SV*)newXS(NULL, cfish_Err_attempt_via_xs, file);
}
-lucy_Err*
-lucy_Err_get_error() {
+cfish_Err*
+cfish_Err_get_error() {
dSP;
ENTER;
SAVETMPS;
@@ -812,7 +812,7 @@ lucy_Err_get_error() {
}
void
-lucy_Err_set_error(lucy_Err *error) {
+cfish_Err_set_error(cfish_Err *error) {
dSP;
ENTER;
SAVETMPS;
@@ -820,7 +820,7 @@ lucy_Err_set_error(lucy_Err *error) {
PUSHMARK(SP);
PUSHmortal;
if (error) {
- mPUSHs((SV*)Lucy_Err_To_Host(error));
+ mPUSHs((SV*)Cfish_Err_To_Host(error));
}
else {
PUSHmortal;
@@ -832,9 +832,9 @@ lucy_Err_set_error(lucy_Err *error) {
}
void
-lucy_Err_do_throw(lucy_Err *err) {
+cfish_Err_do_throw(cfish_Err *err) {
dSP;
- SV *error_sv = (SV*)Lucy_Err_To_Host(err);
+ SV *error_sv = (SV*)Cfish_Err_To_Host(err);
CFISH_DECREF(err);
ENTER;
SAVETMPS;
@@ -847,35 +847,35 @@ lucy_Err_do_throw(lucy_Err *err) {
}
void*
-lucy_Err_to_host(lucy_Err *self) {
- Lucy_Err_To_Host_t super_to_host
- = CFISH_SUPER_METHOD_PTR(LUCY_ERR, Lucy_Err_To_Host);
+cfish_Err_to_host(cfish_Err *self) {
+ Cfish_Err_To_Host_t super_to_host
+ = CFISH_SUPER_METHOD_PTR(CFISH_ERR, Cfish_Err_To_Host);
SV *perl_obj = (SV*)super_to_host(self);
XSBind_enable_overload(perl_obj);
return perl_obj;
}
void
-lucy_Err_throw_mess(lucy_VTable *vtable, lucy_CharBuf *message) {
- Lucy_Err_Make_t make
- = CFISH_METHOD_PTR(CFISH_CERTIFY(vtable, LUCY_VTABLE), Lucy_Err_Make);
- lucy_Err *err = (lucy_Err*)CFISH_CERTIFY(make(NULL), LUCY_ERR);
- Lucy_Err_Cat_Mess(err, message);
+cfish_Err_throw_mess(cfish_VTable *vtable, cfish_CharBuf *message) {
+ Cfish_Err_Make_t make
+ = CFISH_METHOD_PTR(CFISH_CERTIFY(vtable, CFISH_VTABLE), Cfish_Err_Make);
+ cfish_Err *err = (cfish_Err*)CFISH_CERTIFY(make(NULL), CFISH_ERR);
+ Cfish_Err_Cat_Mess(err, message);
CFISH_DECREF(message);
- lucy_Err_do_throw(err);
+ cfish_Err_do_throw(err);
}
void
-lucy_Err_warn_mess(lucy_CharBuf *message) {
+cfish_Err_warn_mess(cfish_CharBuf *message) {
SV *error_sv = XSBind_cb_to_sv(message);
CFISH_DECREF(message);
warn("%s", SvPV_nolen(error_sv));
SvREFCNT_dec(error_sv);
}
-lucy_Err*
-lucy_Err_trap(Cfish_Err_Attempt_t routine, void *context) {
- lucy_Err *error = NULL;
+cfish_Err*
+cfish_Err_trap(Cfish_Err_Attempt_t routine, void *context) {
+ cfish_Err *error = NULL;
SV *routine_sv = newSViv(PTR2IV(routine));
SV *context_sv = newSViv(PTR2IV(context));
dSP;
@@ -889,10 +889,10 @@ lucy_Err_trap(Cfish_Err_Attempt_t routine, void *context) {
int count = call_sv(attempt_xsub, G_EVAL | G_DISCARD);
if (count != 0) {
- lucy_CharBuf *mess
- = lucy_CB_newf("'attempt' returned too many values: %i32",
+ cfish_CharBuf *mess
+ = cfish_CB_newf("'attempt' returned too many values: %i32",
(int32_t)count);
- error = lucy_Err_new(mess);
+ error = cfish_Err_new(mess);
}
else {
SV *dollar_at = get_sv("@", FALSE);
@@ -901,14 +901,14 @@ lucy_Err_trap(Cfish_Err_Attempt_t routine, void *context) {
&& sv_derived_from(dollar_at,"Clownfish::Err")
) {
IV error_iv = SvIV(SvRV(dollar_at));
- error = INT2PTR(lucy_Err*, error_iv);
+ error = INT2PTR(cfish_Err*, error_iv);
CFISH_INCREF(error);
}
else {
STRLEN len;
char *ptr = SvPVutf8(dollar_at, len);
- lucy_CharBuf *mess = lucy_CB_new_from_trusted_utf8(ptr, len);
- error = lucy_Err_new(mess);
+ cfish_CharBuf *mess = cfish_CB_new_from_trusted_utf8(ptr, len);
+ error = cfish_Err_new(mess);
}
}
}
@@ -921,10 +921,10 @@ lucy_Err_trap(Cfish_Err_Attempt_t routine, void *context) {
/*********************** Clownfish::LockFreeRegistry ************************/
void*
-lucy_LFReg_to_host(lucy_LockFreeRegistry *self) {
+cfish_LFReg_to_host(cfish_LockFreeRegistry *self) {
bool first_time = self->ref.count & XSBIND_REFCOUNT_FLAG ? true : false;
- Lucy_LFReg_To_Host_t to_host
- = CFISH_SUPER_METHOD_PTR(LUCY_LOCKFREEREGISTRY, Lucy_LFReg_To_Host);
+ Cfish_LFReg_To_Host_t to_host
+ = CFISH_SUPER_METHOD_PTR(CFISH_LOCKFREEREGISTRY, Cfish_LFReg_To_Host);
SV *host_obj = (SV*)to_host(self);
if (first_time) {
SvSHARE((SV*)self->ref.host_obj);
[lucy-commits] [2/9] git commit: refs/heads/separate-clownfish-wip1 - Rename Lucy
prefixes in Perl bindings to Clownfish
Posted by nw...@apache.org.
Rename Lucy prefixes in Perl bindings to Clownfish
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/d462f11a
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/d462f11a
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/d462f11a
Branch: refs/heads/separate-clownfish-wip1
Commit: d462f11a21b3204924abef9980c90b85718353c4
Parents: 9c65f94
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun May 19 21:56:06 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 16:04:06 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCBindAliases.c | 66 ++++++++-
clownfish/compiler/src/CFCPerlTypeMap.c | 28 ++++-
perl/buildlib/Lucy/Build/Binding/Index.pm | 14 +-
perl/buildlib/Lucy/Build/Binding/Misc.pm | 18 ++--
perl/buildlib/Lucy/Build/Binding/Object.pm | 170 +++++++++++-----------
perl/buildlib/Lucy/Build/Binding/Search.pm | 6 +-
perl/buildlib/Lucy/Build/Binding/Util.pm | 10 +-
perl/xs/Lucy/Analysis/RegexTokenizer.c | 26 ++--
perl/xs/Lucy/Document/Doc.c | 80 ++++++------
perl/xs/Lucy/Index/DocReader.c | 8 +-
perl/xs/Lucy/Index/Inverter.c | 48 +++---
perl/xs/XSBind.h | 22 ++--
12 files changed, 286 insertions(+), 210 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/clownfish/compiler/src/CFCBindAliases.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindAliases.c b/clownfish/compiler/src/CFCBindAliases.c
index 0354080..c32f925 100644
--- a/clownfish/compiler/src/CFCBindAliases.c
+++ b/clownfish/compiler/src/CFCBindAliases.c
@@ -32,45 +32,64 @@ struct alias aliases[] = {
{"cfish_Obj_get_refcount", "lucy_Obj_get_refcount"},
{"cfish_Obj_inc_refcount", "lucy_Obj_inc_refcount"},
{"cfish_Obj_to_host", "lucy_Obj_to_host"},
+ {"Cfish_Obj_Dec_RefCount", "Lucy_Obj_Dec_RefCount"},
+ {"Cfish_Obj_Deserialize", "Lucy_Obj_Deserialize"},
{"Cfish_Obj_Destroy", "Lucy_Obj_Destroy"},
{"Cfish_Obj_Destroy_OFFSET", "Lucy_Obj_Destroy_OFFSET"},
{"Cfish_Obj_Destroy_t", "Lucy_Obj_Destroy_t"},
{"Cfish_Obj_Dump", "Lucy_Obj_Dump"},
{"Cfish_Obj_Get_Class_Name", "Lucy_Obj_Get_Class_Name"},
+ {"Cfish_Obj_Inc_RefCount", "Lucy_Obj_Inc_RefCount"},
{"Cfish_Obj_Is_A", "Lucy_Obj_Is_A"},
{"Cfish_Obj_Load", "Lucy_Obj_Load"},
{"Cfish_Obj_Load_OFFSET", "Lucy_Obj_Load_OFFSET"},
{"Cfish_Obj_Load_t", "Lucy_Obj_Load_t"},
+ {"Cfish_Obj_Serialize", "Lucy_Obj_Serialize"},
{"Cfish_Obj_To_F64", "Lucy_Obj_To_F64"},
{"Cfish_Obj_To_I64", "Lucy_Obj_To_I64"},
{"Cfish_Obj_To_Bool", "Lucy_Obj_To_Bool"},
{"Cfish_Obj_To_Host", "Lucy_Obj_To_Host"},
- {"Cfish_Obj_Dec_RefCount", "Lucy_Obj_Dec_RefCount"},
- {"Cfish_Obj_Inc_RefCount", "Lucy_Obj_Inc_RefCount"},
{"cfish_ByteBuf", "lucy_ByteBuf"},
{"CFISH_BYTEBUF", "LUCY_BYTEBUF"},
- {"Cfish_BB_Get_Size", "Lucy_BB_Get_Size"},
+ {"cfish_BB_init", "lucy_BB_init"},
+ {"Cfish_BB_Deserialize", "Lucy_BB_Deserialize"},
{"Cfish_BB_Get_Buf", "Lucy_BB_Get_Buf"},
+ {"Cfish_BB_Get_Size", "Lucy_BB_Get_Size"},
+ {"Cfish_BB_Mimic_Bytes", "Lucy_BB_Mimic_Bytes"},
+ {"Cfish_BB_To_Host", "Lucy_BB_To_Host"},
+ {"cfish_ViewByteBuf", "lucy_ViewByteBuf"},
+ {"cfish_ViewBB_new", "lucy_ViewBB_new"},
+ {"Cfish_ViewBB_Assign_Bytes", "Lucy_ViewBB_Assign_Bytes"},
{"cfish_CharBuf", "lucy_CharBuf"},
{"CFISH_CHARBUF", "LUCY_CHARBUF"},
+ {"cfish_CB_clone", "lucy_CB_clone"},
{"cfish_CB_newf", "lucy_CB_newf"},
{"cfish_CB_new_from_trusted_utf8", "lucy_CB_new_from_trusted_utf8"},
+ {"cfish_CB_init", "lucy_CB_init"},
+ {"Cfish_CB_Cat_Trusted_Str", "Lucy_CB_Cat_Trusted_Str"},
{"Cfish_CB_Clone", "Lucy_CB_Clone"},
+ {"Cfish_CB_Deserialize", "Lucy_CB_Deserialize"},
+ {"Cfish_CB_Find_Str", "Lucy_CB_Find_Str"},
+ {"Cfish_CB_Get_Ptr8", "Lucy_CB_Get_Ptr8"},
+ {"Cfish_CB_Get_Size", "Lucy_CB_Get_Size"},
+ {"Cfish_CB_Mimic_Str", "Lucy_CB_Mimic_Str"},
{"Cfish_CB_Nip_One_OFFSET", "Lucy_CB_Nip_One_OFFSET"},
{"Cfish_CB_Nip_One_t", "Lucy_CB_Nip_One_t"},
+ {"Cfish_CB_To_Host", "Lucy_CB_To_Host"},
+ {"cfish_ViewCharBuf", "lucy_ViewCharBuf"},
+ {"CFISH_VIEWCHARBUF", "LUCY_VIEWCHARBUF"},
+ {"cfish_ViewCB_new_from_trusted_utf8", "lucy_ViewCB_new_from_trusted_utf8"},
+ {"Cfish_ViewCB_Assign_Str", "Lucy_ViewCB_Assign_Str"},
{"cfish_ZombieCharBuf", "lucy_ZombieCharBuf"},
{"CFISH_ZOMBIECHARBUF", "LUCY_ZOMBIECHARBUF"},
- {"CFISH_VIEWCHARBUF", "LUCY_VIEWCHARBUF"},
{"cfish_ZCB_new", "lucy_ZCB_new"},
{"cfish_ZCB_size", "lucy_ZCB_size"},
{"cfish_ZCB_wrap", "lucy_ZCB_wrap"},
{"cfish_ZCB_wrap_str", "lucy_ZCB_wrap_str"},
{"Cfish_ZCB_Assign_Str", "Lucy_ZCB_Assign_Str"},
{"Cfish_ZCB_Assign_Trusted_Str", "Lucy_ZCB_Assign_Trusted_Str"},
- {"Cfish_CB_Get_Ptr8", "Lucy_CB_Get_Ptr8"},
- {"Cfish_CB_Get_Size", "Lucy_CB_Get_Size"},
{"CFISH_FLOATNUM", "LUCY_FLOATNUM"},
{"CFISH_INTNUM", "LUCY_INTNUM"},
@@ -112,11 +131,15 @@ struct alias aliases[] = {
{"cfish_Hash", "lucy_Hash"},
{"CFISH_HASH", "LUCY_HASH"},
{"cfish_Hash_new", "lucy_Hash_new"},
+ {"cfish_Hash_fetch", "lucy_Hash_fetch"},
+ {"cfish_Hash_store", "lucy_Hash_store"},
+ {"Cfish_Hash_Deserialize", "Lucy_Hash_Deserialize"},
+ {"Cfish_Hash_Fetch_Str", "Lucy_Hash_Fetch_Str"},
{"Cfish_Hash_Iterate", "Lucy_Hash_Iterate"},
{"Cfish_Hash_Next", "Lucy_Hash_Next"},
- {"Cfish_Hash_Fetch_Str", "Lucy_Hash_Fetch_Str"},
{"Cfish_Hash_Store_Str", "Lucy_Hash_Store_Str"},
{"Cfish_Hash_Store", "Lucy_Hash_Store"},
+ {"Cfish_Hash_To_Host", "Lucy_Hash_To_Host"},
{"cfish_LockFreeRegistry", "lucy_LockFreeRegistry"},
{"CFISH_LOCKFREEREGISTRY", "LUCY_LOCKFREEREGISTRY"},
@@ -130,6 +153,17 @@ struct alias aliases[] = {
{"cfish_Memory_wrapped_malloc", "lucy_Memory_wrapped_malloc"},
{"cfish_Memory_wrapped_realloc", "lucy_Memory_wrapped_realloc"},
+ {"cfish_Float32", "lucy_Float32"},
+ {"cfish_Float32_init", "lucy_Float32_init"},
+ {"Cfish_Float32_Set_Value", "Lucy_Float32_Set_Value"},
+ {"cfish_Float64", "lucy_Float64"},
+ {"cfish_Float64_init", "lucy_Float64_init"},
+ {"Cfish_Float64_Set_Value", "Lucy_Float64_Set_Value"},
+ {"cfish_Integer32", "lucy_Integer32"},
+ {"Cfish_Int32_Set_Value", "Lucy_Int32_Set_Value"},
+ {"cfish_Integer64", "lucy_Integer64"},
+ {"Cfish_Int64_Set_Value", "Lucy_Int64_Set_Value"},
+
{"cfish_NumUtil_decode_bigend_f32", "lucy_NumUtil_decode_bigend_f32"},
{"cfish_NumUtil_decode_bigend_f64", "lucy_NumUtil_decode_bigend_f64"},
{"cfish_NumUtil_decode_bigend_u16", "lucy_NumUtil_decode_bigend_u16"},
@@ -160,6 +194,8 @@ struct alias aliases[] = {
{"cfish_NumUtil_u4shifts", "lucy_NumUtil_u4shifts"},
{"cfish_NumUtil_skip_cint", "lucy_NumUtil_skip_cint"},
+ {"cfish_StrHelp_to_base36", "lucy_StrHelp_to_base36"},
+ {"cfish_StrHelp_utf8_valid", "lucy_StrHelp_utf8_valid"},
{"cfish_StrHelp_UTF8_COUNT", "lucy_StrHelp_UTF8_COUNT"},
{"cfish_TestBatch_fail", "lucy_TestBatch_fail"},
@@ -173,29 +209,43 @@ struct alias aliases[] = {
{"cfish_TestFormatter", "lucy_TestFormatter"},
{"cfish_TestFormatterCF", "lucy_TestFormatterCF"},
{"cfish_TestFormatterCF_new", "lucy_TestFormatterCF_new"},
+ {"cfish_TestFormatterTAP", "lucy_TestFormatterTAP"},
+ {"cfish_TestFormatterTAP_new", "lucy_TestFormatterTAP_new"},
{"cfish_VArray", "lucy_VArray"},
{"CFISH_VARRAY", "LUCY_VARRAY"},
{"cfish_VA_new", "lucy_VA_new"},
+ {"cfish_VA_store", "lucy_VA_store"},
+ {"Cfish_VA_Clone", "Lucy_VA_Clone"},
+ {"Cfish_VA_Delete", "Lucy_VA_Delete"},
+ {"Cfish_VA_Deserialize", "Lucy_VA_Deserialize"},
{"Cfish_VA_Fetch", "Lucy_VA_Fetch"},
{"Cfish_VA_Get_Size", "Lucy_VA_Get_Size"},
+ {"Cfish_VA_Pop", "Lucy_VA_Pop"},
+ {"Cfish_VA_Push", "Lucy_VA_Push"},
{"Cfish_VA_Resize", "Lucy_VA_Resize"},
+ {"Cfish_VA_Shallow_Copy", "Lucy_VA_Shallow_Copy"},
+ {"Cfish_VA_Shift", "Lucy_VA_Shift"},
{"Cfish_VA_Store", "Lucy_VA_Store"},
- {"Cfish_VA_Push", "Lucy_VA_Push"},
+ {"Cfish_VA_To_Host", "Lucy_VA_To_Host"},
{"cfish_VTable", "lucy_VTable"},
{"CFISH_VTABLE", "LUCY_VTABLE"},
{"cfish_VTable_add_alias_to_registry", "lucy_VTable_add_alias_to_registry"},
{"cfish_VTable_bootstrap", "lucy_VTable_bootstrap"},
+ {"cfish_VTable_fetch_vtable", "lucy_VTable_fetch_vtable"},
{"cfish_VTable_find_parent_class", "lucy_VTable_find_parent_class"},
{"cfish_VTable_foster_obj", "lucy_VTable_foster_obj"},
{"cfish_VTable_fresh_host_methods", "lucy_VTable_fresh_host_methods"},
{"cfish_VTable_init_obj", "lucy_VTable_init_obj"},
+ {"cfish_VTable_init_registry", "lucy_VTable_init_registry"},
{"cfish_VTable_make_obj", "lucy_VTable_make_obj"},
{"cfish_VTable_offset_of_parent", "lucy_VTable_offset_of_parent"},
{"cfish_VTable_register_with_host", "lucy_VTable_register_with_host"},
+ {"cfish_VTable_registry", "lucy_VTable_registry"},
{"cfish_VTable_singleton", "lucy_VTable_singleton"},
{"cfish_VTable_to_host", "lucy_VTable_to_host"},
+ {"Cfish_VTable_Foster_Obj", "Lucy_VTable_Foster_Obj"},
{"Cfish_VTable_Get_Name", "Lucy_VTable_Get_Name"},
{"Cfish_VTable_Make_Obj", "Lucy_VTable_Make_Obj"},
{"Cfish_VTable_To_Host", "Lucy_VTable_To_Host"},
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/clownfish/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlTypeMap.c b/clownfish/compiler/src/CFCPerlTypeMap.c
index ce05145..22b0f15 100644
--- a/clownfish/compiler/src/CFCPerlTypeMap.c
+++ b/clownfish/compiler/src/CFCPerlTypeMap.c
@@ -214,7 +214,7 @@ static const char typemap_start[] =
"uint32_t\tCHY_UNSIGNED_INT\n"
"uint64_t\tCHY_BIG_UNSIGNED_INT\n"
"\n"
- "const lucy_CharBuf*\tCONST_CHARBUF\n";
+ "const cfish_CharBuf*\tCONST_CHARBUF\n";
static const char typemap_input[] =
@@ -275,6 +275,32 @@ CFCPerlTypeMap_write_xs_typemap(CFCHierarchy *hierarchy) {
const char *full_struct_sym = CFCClass_full_struct_sym(klass);
const char *vtable_var = CFCClass_full_vtable_var(klass);
+ /* Temporary hack until the Clownfish parcel is ready. */
+ if (strcmp(full_struct_sym, "lucy_ByteBuf") == 0) {
+ full_struct_sym = "cfish_ByteBuf";
+ vtable_var = "CFISH_BYTEBUF";
+ }
+ else if (strcmp(full_struct_sym, "lucy_CharBuf") == 0) {
+ full_struct_sym = "cfish_CharBuf";
+ vtable_var = "CFISH_CHARBUF";
+ }
+ else if (strcmp(full_struct_sym, "lucy_Hash") == 0) {
+ full_struct_sym = "cfish_Hash";
+ vtable_var = "CFISH_HASH";
+ }
+ else if (strcmp(full_struct_sym, "lucy_Obj") == 0) {
+ full_struct_sym = "cfish_Obj";
+ vtable_var = "CFISH_OBJ";
+ }
+ else if (strcmp(full_struct_sym, "lucy_VArray") == 0) {
+ full_struct_sym = "cfish_VArray";
+ vtable_var = "CFISH_VARRAY";
+ }
+ else if (strcmp(full_struct_sym, "lucy_VTable") == 0) {
+ full_struct_sym = "cfish_VTable";
+ vtable_var = "CFISH_VTABLE";
+ }
+
start = CFCUtil_cat(start, full_struct_sym, "*\t", vtable_var, "_\n",
NULL);
input = CFCUtil_cat(input, vtable_var, "_\n"
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/buildlib/Lucy/Build/Binding/Index.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Index.pm b/perl/buildlib/Lucy/Build/Binding/Index.pm
index 13e4fee..71913b1 100644
--- a/perl/buildlib/Lucy/Build/Binding/Index.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Index.pm
@@ -407,8 +407,8 @@ set_race_condition_debug1(val_sv)
SV *val_sv;
PPCODE:
CFISH_DECREF(lucy_PolyReader_race_condition_debug1);
- lucy_PolyReader_race_condition_debug1 = (lucy_CharBuf*)
- XSBind_maybe_sv_to_cfish_obj(val_sv, LUCY_CHARBUF, NULL);
+ lucy_PolyReader_race_condition_debug1 = (cfish_CharBuf*)
+ XSBind_maybe_sv_to_cfish_obj(val_sv, CFISH_CHARBUF, NULL);
if (lucy_PolyReader_race_condition_debug1) {
(void)CFISH_INCREF(lucy_PolyReader_race_condition_debug1);
}
@@ -584,7 +584,7 @@ PPCODE:
}
}
else if (items == 1) {
- CFISH_THROW(LUCY_ERR, "Missing required argument 'doc'");
+ CFISH_THROW(CFISH_ERR, "Missing required argument 'doc'");
}
// Either get a Doc or use the stock doc.
@@ -602,8 +602,8 @@ PPCODE:
}
}
if (!doc) {
- THROW(LUCY_ERR, "Need either a hashref or a %o",
- Lucy_VTable_Get_Name(LUCY_DOC));
+ THROW(CFISH_ERR, "Need either a hashref or a %o",
+ Cfish_VTable_Get_Name(LUCY_DOC));
}
Lucy_Indexer_Add_Doc(self, doc, boost);
@@ -1116,8 +1116,8 @@ CODE:
CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error()));
}
{
- lucy_Obj *blank = Lucy_SortCache_Make_Blank(self);
- lucy_Obj *value = Lucy_SortCache_Value(self, ord, blank);
+ cfish_Obj *blank = Lucy_SortCache_Make_Blank(self);
+ cfish_Obj *value = Lucy_SortCache_Value(self, ord, blank);
RETVAL = XSBind_cfish_to_perl(value);
CFISH_DECREF(blank);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index 0fb31a8..0e25807 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -46,7 +46,7 @@ to_clownfish(sv)
SV *sv;
CODE:
{
- lucy_Obj *obj = XSBind_perl_to_cfish(sv);
+ cfish_Obj *obj = XSBind_perl_to_cfish(sv);
RETVAL = CFISH_OBJ_TO_SV_NOINC(obj);
}
OUTPUT: RETVAL
@@ -58,7 +58,7 @@ CODE:
{
if (sv_isobject(sv) && sv_derived_from(sv, "Clownfish::Obj")) {
IV tmp = SvIV(SvRV(sv));
- lucy_Obj* obj = INT2PTR(lucy_Obj*, tmp);
+ cfish_Obj* obj = INT2PTR(cfish_Obj*, tmp);
RETVAL = XSBind_cfish_to_perl(obj);
}
else {
@@ -85,9 +85,9 @@ bool
run_tests(package)
char *package;
CODE:
- lucy_CharBuf *class_name = lucy_CB_newf("%s", package);
- lucy_TestFormatter *formatter
- = (lucy_TestFormatter*)lucy_TestFormatterTAP_new();
+ cfish_CharBuf *class_name = cfish_CB_newf("%s", package);
+ cfish_TestFormatter *formatter
+ = (cfish_TestFormatter*)cfish_TestFormatterTAP_new();
bool result = lucy_Test_run_batch(class_name, formatter);
CFISH_DECREF(class_name);
CFISH_DECREF(formatter);
@@ -129,8 +129,8 @@ CODE:
{
void *address = Lucy_BBSortEx_Fetch(self);
if (address) {
- RETVAL = XSBind_cfish_to_perl(*(lucy_Obj**)address);
- CFISH_DECREF(*(lucy_Obj**)address);
+ RETVAL = XSBind_cfish_to_perl(*(cfish_Obj**)address);
+ CFISH_DECREF(*(cfish_Obj**)address);
}
else {
RETVAL = newSV(0);
@@ -145,7 +145,7 @@ CODE:
{
void *address = Lucy_BBSortEx_Peek(self);
if (address) {
- RETVAL = XSBind_cfish_to_perl(*(lucy_Obj**)address);
+ RETVAL = XSBind_cfish_to_perl(*(cfish_Obj**)address);
}
else {
RETVAL = newSV(0);
@@ -156,7 +156,7 @@ OUTPUT: RETVAL
void
feed(self, bb)
lucy_BBSortEx *self;
- lucy_ByteBuf *bb;
+ cfish_ByteBuf *bb;
CODE:
CFISH_INCREF(bb);
Lucy_BBSortEx_Feed(self, &bb);
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/buildlib/Lucy/Build/Binding/Object.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Object.pm b/perl/buildlib/Lucy/Build/Binding/Object.pm
index ba9f957..0ba0bb6 100644
--- a/perl/buildlib/Lucy/Build/Binding/Object.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Object.pm
@@ -92,20 +92,20 @@ CODE:
{
STRLEN size;
char *ptr = SvPV(sv, size);
- lucy_ByteBuf *self = (lucy_ByteBuf*)XSBind_new_blank_obj(either_sv);
- lucy_BB_init(self, size);
- Lucy_BB_Mimic_Bytes(self, ptr, size);
+ cfish_ByteBuf *self = (cfish_ByteBuf*)XSBind_new_blank_obj(either_sv);
+ cfish_BB_init(self, size);
+ Cfish_BB_Mimic_Bytes(self, ptr, size);
RETVAL = CFISH_OBJ_TO_SV_NOINC(self);
}
OUTPUT: RETVAL
SV*
_deserialize(self, instream)
- lucy_ByteBuf *self;
+ cfish_ByteBuf *self;
lucy_InStream *instream;
CODE:
- lucy_ByteBuf *thawed = Lucy_BB_Deserialize(self, instream);
- RETVAL = (SV*)Lucy_BB_To_Host(thawed);
+ cfish_ByteBuf *thawed = Cfish_BB_Deserialize(self, instream);
+ RETVAL = (SV*)Cfish_BB_To_Host(thawed);
OUTPUT: RETVAL
END_XS_CODE
@@ -131,32 +131,32 @@ CODE:
{
STRLEN size;
char *ptr = SvPVutf8(sv, size);
- lucy_CharBuf *self = (lucy_CharBuf*)XSBind_new_blank_obj(either_sv);
- lucy_CB_init(self, size);
- Lucy_CB_Cat_Trusted_Str(self, ptr, size);
+ cfish_CharBuf *self = (cfish_CharBuf*)XSBind_new_blank_obj(either_sv);
+ cfish_CB_init(self, size);
+ Cfish_CB_Cat_Trusted_Str(self, ptr, size);
RETVAL = CFISH_OBJ_TO_SV_NOINC(self);
}
OUTPUT: RETVAL
SV*
_clone(self)
- lucy_CharBuf *self;
+ cfish_CharBuf *self;
CODE:
- RETVAL = CFISH_OBJ_TO_SV_NOINC(lucy_CB_clone(self));
+ RETVAL = CFISH_OBJ_TO_SV_NOINC(cfish_CB_clone(self));
OUTPUT: RETVAL
SV*
_deserialize(self, instream)
- lucy_CharBuf *self;
+ cfish_CharBuf *self;
lucy_InStream *instream;
CODE:
- lucy_CharBuf *thawed = Lucy_CB_Deserialize(self, instream);
- RETVAL = (SV*)Lucy_CB_To_Host(thawed);
+ cfish_CharBuf *thawed = Cfish_CB_Deserialize(self, instream);
+ RETVAL = (SV*)Cfish_CB_To_Host(thawed);
OUTPUT: RETVAL
SV*
to_perl(self)
- lucy_CharBuf *self;
+ cfish_CharBuf *self;
CODE:
RETVAL = XSBind_cb_to_sv(self);
OUTPUT: RETVAL
@@ -171,8 +171,8 @@ CODE:
{
STRLEN size;
char *ptr = SvPVutf8(sv, size);
- lucy_ViewCharBuf *self
- = lucy_ViewCB_new_from_trusted_utf8(ptr, size);
+ cfish_ViewCharBuf *self
+ = cfish_ViewCB_new_from_trusted_utf8(ptr, size);
CHY_UNUSED_VAR(unused);
RETVAL = CFISH_OBJ_TO_SV_NOINC(self);
}
@@ -249,43 +249,43 @@ MODULE = Lucy PACKAGE = Clownfish::Hash
SV*
_deserialize(self, instream)
- lucy_Hash *self;
+ cfish_Hash *self;
lucy_InStream *instream;
CODE:
- lucy_Hash *thawed = Lucy_Hash_Deserialize(self, instream);
- RETVAL = (SV*)Lucy_Hash_To_Host(thawed);
+ cfish_Hash *thawed = Cfish_Hash_Deserialize(self, instream);
+ RETVAL = (SV*)Cfish_Hash_To_Host(thawed);
OUTPUT: RETVAL
SV*
_fetch(self, key)
- lucy_Hash *self;
- const lucy_CharBuf *key;
+ cfish_Hash *self;
+ const cfish_CharBuf *key;
CODE:
- RETVAL = CFISH_OBJ_TO_SV(lucy_Hash_fetch(self, (lucy_Obj*)key));
+ RETVAL = CFISH_OBJ_TO_SV(cfish_Hash_fetch(self, (cfish_Obj*)key));
OUTPUT: RETVAL
void
store(self, key, value);
- lucy_Hash *self;
- const lucy_CharBuf *key;
- lucy_Obj *value;
+ cfish_Hash *self;
+ const cfish_CharBuf *key;
+ cfish_Obj *value;
PPCODE:
{
if (value) { CFISH_INCREF(value); }
- lucy_Hash_store(self, (lucy_Obj*)key, value);
+ cfish_Hash_store(self, (cfish_Obj*)key, value);
}
void
next(self)
- lucy_Hash *self;
+ cfish_Hash *self;
PPCODE:
{
- lucy_Obj *key;
- lucy_Obj *val;
+ cfish_Obj *key;
+ cfish_Obj *val;
- if (Lucy_Hash_Next(self, &key, &val)) {
- SV *key_sv = (SV*)Lucy_Obj_To_Host(key);
- SV *val_sv = (SV*)Lucy_Obj_To_Host(val);
+ if (Cfish_Hash_Next(self, &key, &val)) {
+ SV *key_sv = (SV*)Cfish_Obj_To_Host(key);
+ SV *val_sv = (SV*)Cfish_Obj_To_Host(val);
XPUSHs(sv_2mortal(key_sv));
XPUSHs(sv_2mortal(val_sv));
@@ -346,7 +346,7 @@ CODE:
lucy_I32Arr_init(self, ints, size);
}
else {
- THROW(LUCY_ERR, "Required param 'ints' isn't an arrayref");
+ THROW(CFISH_ERR, "Required param 'ints' isn't an arrayref");
}
RETVAL = CFISH_OBJ_TO_SV_NOINC(self);
@@ -401,8 +401,8 @@ new(either_sv, value)
float value;
CODE:
{
- lucy_Float32 *self = (lucy_Float32*)XSBind_new_blank_obj(either_sv);
- lucy_Float32_init(self, value);
+ cfish_Float32 *self = (cfish_Float32*)XSBind_new_blank_obj(either_sv);
+ cfish_Float32_init(self, value);
RETVAL = CFISH_OBJ_TO_SV_NOINC(self);
}
OUTPUT: RETVAL
@@ -428,8 +428,8 @@ new(either_sv, value)
double value;
CODE:
{
- lucy_Float64 *self = (lucy_Float64*)XSBind_new_blank_obj(either_sv);
- lucy_Float64_init(self, value);
+ cfish_Float64 *self = (cfish_Float64*)XSBind_new_blank_obj(either_sv);
+ cfish_Float64_init(self, value);
RETVAL = CFISH_OBJ_TO_SV_NOINC(self);
}
OUTPUT: RETVAL
@@ -550,29 +550,29 @@ MODULE = Lucy PACKAGE = Clownfish::Obj
bool
is_a(self, class_name)
- lucy_Obj *self;
- const lucy_CharBuf *class_name;
+ cfish_Obj *self;
+ const cfish_CharBuf *class_name;
CODE:
{
- lucy_VTable *target = lucy_VTable_fetch_vtable(class_name);
- RETVAL = Lucy_Obj_Is_A(self, target);
+ cfish_VTable *target = cfish_VTable_fetch_vtable(class_name);
+ RETVAL = Cfish_Obj_Is_A(self, target);
}
OUTPUT: RETVAL
void
STORABLE_freeze(self, ...)
- lucy_Obj *self;
+ cfish_Obj *self;
PPCODE:
{
CHY_UNUSED_VAR(self);
if (items < 2 || !SvTRUE(ST(1))) {
SV *retval;
- lucy_ByteBuf *serialized_bb;
+ cfish_ByteBuf *serialized_bb;
lucy_RAMFileHandle *file_handle
= lucy_RAMFH_open(NULL, LUCY_FH_WRITE_ONLY | LUCY_FH_CREATE, NULL);
- lucy_OutStream *target = lucy_OutStream_open((lucy_Obj*)file_handle);
+ lucy_OutStream *target = lucy_OutStream_open((cfish_Obj*)file_handle);
- Lucy_Obj_Serialize(self, target);
+ Cfish_Obj_Serialize(self, target);
Lucy_OutStream_Close(target);
serialized_bb
@@ -582,7 +582,7 @@ PPCODE:
CFISH_DECREF(target);
if (SvCUR(retval) == 0) { // Thwart Storable bug
- THROW(LUCY_ERR, "Calling serialize produced an empty string");
+ THROW(CFISH_ERR, "Calling serialize produced an empty string");
}
ST(0) = sv_2mortal(retval);
XSRETURN(1);
@@ -606,19 +606,19 @@ STORABLE_thaw(blank_obj, cloning, serialized_sv)
PPCODE:
{
char *class_name = HvNAME(SvSTASH(SvRV(blank_obj)));
- lucy_ZombieCharBuf *klass
+ cfish_ZombieCharBuf *klass
= CFISH_ZCB_WRAP_STR(class_name, strlen(class_name));
- lucy_VTable *vtable
- = (lucy_VTable*)lucy_VTable_singleton((lucy_CharBuf*)klass, NULL);
+ cfish_VTable *vtable
+ = (cfish_VTable*)cfish_VTable_singleton((cfish_CharBuf*)klass, NULL);
STRLEN len;
char *ptr = SvPV(serialized_sv, len);
- lucy_ViewByteBuf *contents = lucy_ViewBB_new(ptr, len);
- lucy_RAMFile *ram_file = lucy_RAMFile_new((lucy_ByteBuf*)contents, true);
+ cfish_ViewByteBuf *contents = cfish_ViewBB_new(ptr, len);
+ lucy_RAMFile *ram_file = lucy_RAMFile_new((cfish_ByteBuf*)contents, true);
lucy_RAMFileHandle *file_handle
= lucy_RAMFH_open(NULL, LUCY_FH_READ_ONLY, ram_file);
- lucy_InStream *instream = lucy_InStream_open((lucy_Obj*)file_handle);
- lucy_Obj *self = Lucy_VTable_Foster_Obj(vtable, blank_obj);
- lucy_Obj *deserialized = Lucy_Obj_Deserialize(self, instream);
+ lucy_InStream *instream = lucy_InStream_open((cfish_Obj*)file_handle);
+ cfish_Obj *self = Cfish_VTable_Foster_Obj(vtable, blank_obj);
+ cfish_Obj *deserialized = Cfish_Obj_Deserialize(self, instream);
CHY_UNUSED_VAR(cloning);
CFISH_DECREF(contents);
@@ -628,7 +628,7 @@ PPCODE:
// Catch bad deserialize() override.
if (deserialized != self) {
- THROW(LUCY_ERR, "Error when deserializing obj of class %o", klass);
+ THROW(CFISH_ERR, "Error when deserializing obj of class %o", klass);
}
}
END_XS_CODE
@@ -660,66 +660,66 @@ MODULE = Lucy PACKAGE = Clownfish::VArray
SV*
shallow_copy(self)
- lucy_VArray *self;
+ cfish_VArray *self;
CODE:
- RETVAL = CFISH_OBJ_TO_SV_NOINC(Lucy_VA_Shallow_Copy(self));
+ RETVAL = CFISH_OBJ_TO_SV_NOINC(Cfish_VA_Shallow_Copy(self));
OUTPUT: RETVAL
SV*
_deserialize(self, instream)
- lucy_VArray *self;
+ cfish_VArray *self;
lucy_InStream *instream;
CODE:
- lucy_VArray *thawed = Lucy_VA_Deserialize(self, instream);
- RETVAL = (SV*)Lucy_VA_To_Host(thawed);
+ cfish_VArray *thawed = Cfish_VA_Deserialize(self, instream);
+ RETVAL = (SV*)Cfish_VA_To_Host(thawed);
OUTPUT: RETVAL
SV*
_clone(self)
- lucy_VArray *self;
+ cfish_VArray *self;
CODE:
- RETVAL = CFISH_OBJ_TO_SV_NOINC(Lucy_VA_Clone(self));
+ RETVAL = CFISH_OBJ_TO_SV_NOINC(Cfish_VA_Clone(self));
OUTPUT: RETVAL
SV*
shift(self)
- lucy_VArray *self;
+ cfish_VArray *self;
CODE:
- RETVAL = CFISH_OBJ_TO_SV_NOINC(Lucy_VA_Shift(self));
+ RETVAL = CFISH_OBJ_TO_SV_NOINC(Cfish_VA_Shift(self));
OUTPUT: RETVAL
SV*
pop(self)
- lucy_VArray *self;
+ cfish_VArray *self;
CODE:
- RETVAL = CFISH_OBJ_TO_SV_NOINC(Lucy_VA_Pop(self));
+ RETVAL = CFISH_OBJ_TO_SV_NOINC(Cfish_VA_Pop(self));
OUTPUT: RETVAL
SV*
delete(self, tick)
- lucy_VArray *self;
+ cfish_VArray *self;
uint32_t tick;
CODE:
- RETVAL = CFISH_OBJ_TO_SV_NOINC(Lucy_VA_Delete(self, tick));
+ RETVAL = CFISH_OBJ_TO_SV_NOINC(Cfish_VA_Delete(self, tick));
OUTPUT: RETVAL
void
store(self, tick, value);
- lucy_VArray *self;
+ cfish_VArray *self;
uint32_t tick;
- lucy_Obj *value;
+ cfish_Obj *value;
PPCODE:
{
if (value) { CFISH_INCREF(value); }
- lucy_VA_store(self, tick, value);
+ cfish_VA_store(self, tick, value);
}
SV*
fetch(self, tick)
- lucy_VArray *self;
+ cfish_VArray *self;
uint32_t tick;
CODE:
- RETVAL = CFISH_OBJ_TO_SV(Lucy_VA_Fetch(self, tick));
+ RETVAL = CFISH_OBJ_TO_SV(Cfish_VA_Fetch(self, tick));
OUTPUT: RETVAL
END_XS_CODE
@@ -742,10 +742,10 @@ MODULE = Lucy PACKAGE = Clownfish::VTable
SV*
_get_registry()
CODE:
- if (lucy_VTable_registry == NULL) {
- lucy_VTable_init_registry();
+ if (cfish_VTable_registry == NULL) {
+ cfish_VTable_init_registry();
}
- RETVAL = (SV*)Lucy_Obj_To_Host((lucy_Obj*)lucy_VTable_registry);
+ RETVAL = (SV*)Cfish_Obj_To_Host((cfish_Obj*)cfish_VTable_registry);
OUTPUT: RETVAL
SV*
@@ -754,28 +754,28 @@ singleton(unused_sv, ...)
CODE:
{
CHY_UNUSED_VAR(unused_sv);
- lucy_CharBuf *class_name = NULL;
- lucy_VTable *parent = NULL;
+ cfish_CharBuf *class_name = NULL;
+ cfish_VTable *parent = NULL;
bool args_ok
= XSBind_allot_params(&(ST(0)), 1, items,
ALLOT_OBJ(&class_name, "class_name", 10, true,
- LUCY_CHARBUF, alloca(cfish_ZCB_size())),
+ CFISH_CHARBUF, alloca(cfish_ZCB_size())),
ALLOT_OBJ(&parent, "parent", 6, false,
- LUCY_VTABLE, NULL),
+ CFISH_VTABLE, NULL),
NULL);
if (!args_ok) {
CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error()));
}
- lucy_VTable *singleton = lucy_VTable_singleton(class_name, parent);
- RETVAL = (SV*)Lucy_VTable_To_Host(singleton);
+ cfish_VTable *singleton = cfish_VTable_singleton(class_name, parent);
+ RETVAL = (SV*)Cfish_VTable_To_Host(singleton);
}
OUTPUT: RETVAL
SV*
make_obj(self)
- lucy_VTable *self;
+ cfish_VTable *self;
CODE:
- lucy_Obj *blank = Lucy_VTable_Make_Obj(self);
+ cfish_Obj *blank = Cfish_VTable_Make_Obj(self);
RETVAL = CFISH_OBJ_TO_SV_NOINC(blank);
OUTPUT: RETVAL
END_XS_CODE
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/buildlib/Lucy/Build/Binding/Search.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Search.pm b/perl/buildlib/Lucy/Build/Binding/Search.pm
index 51d6193..af63475 100644
--- a/perl/buildlib/Lucy/Build/Binding/Search.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Search.pm
@@ -513,7 +513,7 @@ CODE:
CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error()));
}
const char *type_str = SvPVutf8_nolen(type_sv);
- lucy_Obj *value = NULL;
+ cfish_Obj *value = NULL;
uint32_t type = 0;
if (strcmp(type_str, "OPEN_PAREN") == 0) {
@@ -539,11 +539,11 @@ CODE:
}
else if (strcmp(type_str, "FIELD") == 0) {
type = LUCY_QPARSER_TOKEN_FIELD;
- value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), LUCY_CHARBUF);
+ value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_CHARBUF);
}
else if (strcmp(type_str, "STRING") == 0) {
type = LUCY_QPARSER_TOKEN_STRING;
- value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), LUCY_CHARBUF);
+ value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_CHARBUF);
}
else if (strcmp(type_str, "QUERY") == 0) {
type = LUCY_QPARSER_TOKEN_QUERY;
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/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 237e93d..45b9ab4 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -116,7 +116,7 @@ MODULE = Lucy PACKAGE = Lucy::Util::IndexFileNames
uint64_t
extract_gen(name)
- const lucy_CharBuf *name;
+ const cfish_CharBuf *name;
CODE:
RETVAL = lucy_IxFileNames_extract_gen(name);
OUTPUT: RETVAL
@@ -126,7 +126,7 @@ latest_snapshot(folder)
lucy_Folder *folder;
CODE:
{
- lucy_CharBuf *latest = lucy_IxFileNames_latest_snapshot(folder);
+ cfish_CharBuf *latest = lucy_IxFileNames_latest_snapshot(folder);
RETVAL = XSBind_cb_to_sv(latest);
CFISH_DECREF(latest);
}
@@ -222,7 +222,7 @@ to_base36(num)
CODE:
{
char base36[cfish_StrHelp_MAX_BASE36_BYTES];
- size_t size = lucy_StrHelp_to_base36(num, &base36);
+ size_t size = cfish_StrHelp_to_base36(num, &base36);
RETVAL = newSVpvn(base36, size);
}
OUTPUT: RETVAL
@@ -254,7 +254,7 @@ CODE:
{
STRLEN len;
char *ptr = SvPV(sv, len);
- RETVAL = lucy_StrHelp_utf8_valid(ptr, len);
+ RETVAL = cfish_StrHelp_utf8_valid(ptr, len);
}
OUTPUT: RETVAL
@@ -274,7 +274,7 @@ PPCODE:
{
STRLEN len;
char *ptr = SvPV(catted, len);
- if (SvUTF8(sv)) { CFISH_THROW(LUCY_ERR, "Can't cat_bytes onto a UTF-8 SV"); }
+ if (SvUTF8(sv)) { CFISH_THROW(CFISH_ERR, "Can't cat_bytes onto a UTF-8 SV"); }
sv_catpvn(sv, ptr, len);
}
END_XS_CODE
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/xs/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c
index 211e461..d175b59 100644
--- a/perl/xs/Lucy/Analysis/RegexTokenizer.c
+++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c
@@ -40,20 +40,20 @@ lucy_RegexTokenizer_is_available(void) {
lucy_RegexTokenizer*
lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
- const lucy_CharBuf *pattern) {
+ const cfish_CharBuf *pattern) {
lucy_Analyzer_init((lucy_Analyzer*)self);
#define DEFAULT_PATTERN "\\w+(?:['\\x{2019}]\\w+)*"
if (pattern) {
- if (Lucy_CB_Find_Str(pattern, "\\p", 2) != -1
- || Lucy_CB_Find_Str(pattern, "\\P", 2) != -1
+ if (Cfish_CB_Find_Str(pattern, "\\p", 2) != -1
+ || Cfish_CB_Find_Str(pattern, "\\P", 2) != -1
) {
CFISH_DECREF(self);
- THROW(LUCY_ERR, "\\p and \\P constructs forbidden");
+ THROW(CFISH_ERR, "\\p and \\P constructs forbidden");
}
- self->pattern = Lucy_CB_Clone(pattern);
+ self->pattern = Cfish_CB_Clone(pattern);
}
else {
- self->pattern = lucy_CB_new_from_trusted_utf8(
+ self->pattern = cfish_CB_new_from_trusted_utf8(
DEFAULT_PATTERN, sizeof(DEFAULT_PATTERN) - 1);
}
@@ -94,12 +94,12 @@ S_set_token_re_but_not_pattern(lucy_RegexTokenizer *self, void *token_re) {
magic = mg_find((SV*)token_re, PERL_MAGIC_qr);
}
if (!magic) {
- THROW(LUCY_ERR, "token_re is not a qr// entity");
+ THROW(CFISH_ERR, "token_re is not a qr// entity");
}
REGEXP *rx = (REGEXP*)magic->mg_obj;
#endif
if (rx == NULL) {
- THROW(LUCY_ERR, "Failed to extract REGEXP from token_re '%s'",
+ THROW(CFISH_ERR, "Failed to extract REGEXP from token_re '%s'",
SvPV_nolen((SV*)token_re));
}
if (self->token_re) { ReREFCNT_dec(((REGEXP*)self->token_re)); }
@@ -112,7 +112,7 @@ S_set_pattern_from_token_re(lucy_RegexTokenizer *self, void *token_re) {
SV *rv = newRV((SV*)token_re);
STRLEN len = 0;
char *ptr = SvPVutf8((SV*)rv, len);
- Lucy_CB_Mimic_Str(self->pattern, ptr, len);
+ Cfish_CB_Mimic_Str(self->pattern, ptr, len);
SvREFCNT_dec(rv);
}
@@ -171,16 +171,16 @@ lucy_RegexTokenizer_tokenize_str(lucy_RegexTokenizer *self,
// Get start and end offsets in Unicode code points.
for (; string_arg < start_ptr; num_code_points++) {
- string_arg += lucy_StrHelp_UTF8_COUNT[(uint8_t)(*string_arg)];
+ string_arg += cfish_StrHelp_UTF8_COUNT[(uint8_t)(*string_arg)];
if (string_arg > string_end) {
- THROW(LUCY_ERR, "scanned past end of '%s'", string_beg);
+ THROW(CFISH_ERR, "scanned past end of '%s'", string_beg);
}
}
start = num_code_points;
for (; string_arg < end_ptr; num_code_points++) {
- string_arg += lucy_StrHelp_UTF8_COUNT[(uint8_t)(*string_arg)];
+ string_arg += cfish_StrHelp_UTF8_COUNT[(uint8_t)(*string_arg)];
if (string_arg > string_end) {
- THROW(LUCY_ERR, "scanned past end of '%s'", string_beg);
+ THROW(CFISH_ERR, "scanned past end of '%s'", string_beg);
}
}
end = num_code_points;
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index aa3e4df..c20c2b0 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -25,7 +25,7 @@ lucy_Doc*
lucy_Doc_init(lucy_Doc *self, void *fields, int32_t doc_id) {
// Assign.
if (fields) {
- if (SvTYPE((SV*)fields) != SVt_PVHV) { THROW(LUCY_ERR, "Not a hash"); }
+ if (SvTYPE((SV*)fields) != SVt_PVHV) { THROW(CFISH_ERR, "Not a hash"); }
self->fields = SvREFCNT_inc((SV*)fields);
}
else {
@@ -48,15 +48,15 @@ lucy_Doc_get_size(lucy_Doc *self) {
}
void
-lucy_Doc_store(lucy_Doc *self, const lucy_CharBuf *field, lucy_Obj *value) {
- char *key = (char*)Lucy_CB_Get_Ptr8(field);
- size_t key_size = Lucy_CB_Get_Size(field);
+lucy_Doc_store(lucy_Doc *self, const cfish_CharBuf *field, cfish_Obj *value) {
+ char *key = (char*)Cfish_CB_Get_Ptr8(field);
+ size_t key_size = Cfish_CB_Get_Size(field);
SV *key_sv = newSVpvn(key, key_size);
SV *val_sv = value == NULL
? newSV(0)
- : Lucy_Obj_Is_A(value, LUCY_CHARBUF)
- ? XSBind_cb_to_sv((lucy_CharBuf*)value)
- : (SV*)Lucy_Obj_To_Host(value);
+ : Cfish_Obj_Is_A(value, CFISH_CHARBUF)
+ ? XSBind_cb_to_sv((cfish_CharBuf*)value)
+ : (SV*)Cfish_Obj_To_Host(value);
SvUTF8_on(key_sv);
(void)hv_store_ent((HV*)self->fields, key_sv, val_sv, 0);
// TODO: make this a thread-local instead of creating it every time?
@@ -135,24 +135,24 @@ lucy_Doc_deserialize(lucy_Doc *self, lucy_InStream *instream) {
return self;
}
-lucy_Obj*
-lucy_Doc_extract(lucy_Doc *self, lucy_CharBuf *field,
- lucy_ViewCharBuf *target) {
- lucy_Obj *retval = NULL;
- SV **sv_ptr = hv_fetch((HV*)self->fields, (char*)Lucy_CB_Get_Ptr8(field),
- Lucy_CB_Get_Size(field), 0);
+cfish_Obj*
+lucy_Doc_extract(lucy_Doc *self, cfish_CharBuf *field,
+ cfish_ViewCharBuf *target) {
+ cfish_Obj *retval = NULL;
+ SV **sv_ptr = hv_fetch((HV*)self->fields, (char*)Cfish_CB_Get_Ptr8(field),
+ Cfish_CB_Get_Size(field), 0);
if (sv_ptr && XSBind_sv_defined(*sv_ptr)) {
SV *const sv = *sv_ptr;
if (sv_isobject(sv) && sv_derived_from(sv, "Clownfish::Obj")) {
IV tmp = SvIV(SvRV(sv));
- retval = INT2PTR(lucy_Obj*, tmp);
+ retval = INT2PTR(cfish_Obj*, tmp);
}
else {
STRLEN size;
char *ptr = SvPVutf8(sv, size);
- Lucy_ViewCB_Assign_Str(target, ptr, size);
- retval = (lucy_Obj*)target;
+ Cfish_ViewCB_Assign_Str(target, ptr, size);
+ retval = (cfish_Obj*)target;
}
}
@@ -168,36 +168,36 @@ lucy_Doc_to_host(lucy_Doc *self) {
return perl_obj;
}
-lucy_Hash*
+cfish_Hash*
lucy_Doc_dump(lucy_Doc *self) {
- lucy_Hash *dump = lucy_Hash_new(0);
- Lucy_Hash_Store_Str(dump, "_class", 6,
- (lucy_Obj*)Lucy_CB_Clone(Lucy_Doc_Get_Class_Name(self)));
- Lucy_Hash_Store_Str(dump, "doc_id", 7,
- (lucy_Obj*)lucy_CB_newf("%i32", self->doc_id));
- Lucy_Hash_Store_Str(dump, "fields", 6,
+ cfish_Hash *dump = cfish_Hash_new(0);
+ Cfish_Hash_Store_Str(dump, "_class", 6,
+ (cfish_Obj*)Cfish_CB_Clone(Lucy_Doc_Get_Class_Name(self)));
+ Cfish_Hash_Store_Str(dump, "doc_id", 7,
+ (cfish_Obj*)cfish_CB_newf("%i32", self->doc_id));
+ Cfish_Hash_Store_Str(dump, "fields", 6,
XSBind_perl_to_cfish((SV*)self->fields));
return dump;
}
lucy_Doc*
-lucy_Doc_load(lucy_Doc *self, lucy_Obj *dump) {
- lucy_Hash *source = (lucy_Hash*)CFISH_CERTIFY(dump, LUCY_HASH);
- lucy_CharBuf *class_name = (lucy_CharBuf*)CFISH_CERTIFY(
- Lucy_Hash_Fetch_Str(source, "_class", 6),
- LUCY_CHARBUF);
- lucy_VTable *vtable = lucy_VTable_singleton(class_name, NULL);
- lucy_Doc *loaded = (lucy_Doc*)Lucy_VTable_Make_Obj(vtable);
- lucy_Obj *doc_id = CFISH_CERTIFY(
- Lucy_Hash_Fetch_Str(source, "doc_id", 7),
- LUCY_OBJ);
- lucy_Hash *fields = (lucy_Hash*)CFISH_CERTIFY(
- Lucy_Hash_Fetch_Str(source, "fields", 6),
- LUCY_HASH);
- SV *fields_sv = XSBind_cfish_to_perl((lucy_Obj*)fields);
+lucy_Doc_load(lucy_Doc *self, cfish_Obj *dump) {
+ cfish_Hash *source = (cfish_Hash*)CFISH_CERTIFY(dump, CFISH_HASH);
+ cfish_CharBuf *class_name = (cfish_CharBuf*)CFISH_CERTIFY(
+ Cfish_Hash_Fetch_Str(source, "_class", 6),
+ CFISH_CHARBUF);
+ cfish_VTable *vtable = cfish_VTable_singleton(class_name, NULL);
+ lucy_Doc *loaded = (lucy_Doc*)Cfish_VTable_Make_Obj(vtable);
+ cfish_Obj *doc_id = CFISH_CERTIFY(
+ Cfish_Hash_Fetch_Str(source, "doc_id", 7),
+ CFISH_OBJ);
+ cfish_Hash *fields = (cfish_Hash*)CFISH_CERTIFY(
+ Cfish_Hash_Fetch_Str(source, "fields", 6),
+ CFISH_HASH);
+ SV *fields_sv = XSBind_cfish_to_perl((cfish_Obj*)fields);
CHY_UNUSED_VAR(self);
- loaded->doc_id = (int32_t)Lucy_Obj_To_I64(doc_id);
+ loaded->doc_id = (int32_t)Cfish_Obj_To_I64(doc_id);
loaded->fields = SvREFCNT_inc(SvRV(fields_sv));
SvREFCNT_dec(fields_sv);
@@ -205,14 +205,14 @@ lucy_Doc_load(lucy_Doc *self, lucy_Obj *dump) {
}
bool
-lucy_Doc_equals(lucy_Doc *self, lucy_Obj *other) {
+lucy_Doc_equals(lucy_Doc *self, cfish_Obj *other) {
lucy_Doc *twin = (lucy_Doc*)other;
HV *my_fields;
HV *other_fields;
I32 num_fields;
if (twin == self) { return true; }
- if (!Lucy_Obj_Is_A(other, LUCY_DOC)) { return false; }
+ if (!Cfish_Obj_Is_A(other, LUCY_DOC)) { return false; }
if (!self->doc_id == twin->doc_id) { return false; }
if (!!self->fields ^ !!twin->fields) { return false; }
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/xs/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/DocReader.c b/perl/xs/Lucy/Index/DocReader.c
index 6230e77..0c7b2ac 100644
--- a/perl/xs/Lucy/Index/DocReader.c
+++ b/perl/xs/Lucy/Index/DocReader.c
@@ -60,10 +60,10 @@ lucy_DefDocReader_fetch_doc(lucy_DefaultDocReader *self, int32_t doc_id) {
*SvEND(field_name_sv) = '\0';
// Find the Field's FieldType.
- lucy_ZombieCharBuf *field_name_zcb
+ cfish_ZombieCharBuf *field_name_zcb
= CFISH_ZCB_WRAP_STR(field_name_ptr, field_name_len);
- Lucy_ZCB_Assign_Str(field_name_zcb, field_name_ptr, field_name_len);
- type = Lucy_Schema_Fetch_Type(schema, (lucy_CharBuf*)field_name_zcb);
+ Cfish_ZCB_Assign_Str(field_name_zcb, field_name_ptr, field_name_len);
+ type = Lucy_Schema_Fetch_Type(schema, (cfish_CharBuf*)field_name_zcb);
// Read the field value.
switch (Lucy_FType_Primitive_ID(type) & lucy_FType_PRIMITIVE_ID_MASK) {
@@ -107,7 +107,7 @@ lucy_DefDocReader_fetch_doc(lucy_DefaultDocReader *self, int32_t doc_id) {
break;
default:
value_sv = NULL;
- CFISH_THROW(LUCY_ERR, "Unrecognized type: %o", type);
+ CFISH_THROW(CFISH_ERR, "Unrecognized type: %o", type);
}
// Store the value.
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 0653501..7f0bc95 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -43,35 +43,35 @@ S_fetch_entry(lucy_Inverter *self, HE *hash_entry) {
else {
key = HeKEY(hash_entry);
key_len = he_key_len;
- if (!lucy_StrHelp_utf8_valid(key, key_len)) {
+ if (!cfish_StrHelp_utf8_valid(key, key_len)) {
SV *key_sv = HeSVKEY_force(hash_entry);
key = SvPVutf8(key_sv, key_len);
}
}
- lucy_ZombieCharBuf *field = CFISH_ZCB_WRAP_STR(key, key_len);
+ cfish_ZombieCharBuf *field = CFISH_ZCB_WRAP_STR(key, key_len);
int32_t field_num
- = Lucy_Seg_Field_Num(self->segment, (lucy_CharBuf*)field);
+ = Lucy_Seg_Field_Num(self->segment, (cfish_CharBuf*)field);
if (!field_num) {
// This field seems not to be in the segment yet. Try to find it in
// the Schema.
- if (Lucy_Schema_Fetch_Type(schema, (lucy_CharBuf*)field)) {
+ if (Lucy_Schema_Fetch_Type(schema, (cfish_CharBuf*)field)) {
// The field is in the Schema. Get a field num from the Segment.
field_num = Lucy_Seg_Add_Field(self->segment,
- (lucy_CharBuf*)field);
+ (cfish_CharBuf*)field);
}
else {
// We've truly failed to find the field. The user must
// not have spec'd it.
- THROW(LUCY_ERR, "Unknown field name: '%s'", key);
+ THROW(CFISH_ERR, "Unknown field name: '%s'", key);
}
}
lucy_InverterEntry *entry
- = (lucy_InverterEntry*)Lucy_VA_Fetch(self->entry_pool, field_num);
+ = (lucy_InverterEntry*)Cfish_VA_Fetch(self->entry_pool, field_num);
if (!entry) {
- entry = lucy_InvEntry_new(schema, (lucy_CharBuf*)field, field_num);
- Lucy_VA_Store(self->entry_pool, field_num, (lucy_Obj*)entry);
+ entry = lucy_InvEntry_new(schema, (cfish_CharBuf*)field, field_num);
+ Cfish_VA_Store(self->entry_pool, field_num, (cfish_Obj*)entry);
}
return entry;
}
@@ -96,44 +96,44 @@ lucy_Inverter_invert_doc(lucy_Inverter *self, lucy_Doc *doc) {
case lucy_FType_TEXT: {
STRLEN val_len;
char *val_ptr = SvPVutf8(value_sv, val_len);
- lucy_ViewCharBuf *value
- = (lucy_ViewCharBuf*)inv_entry->value;
- Lucy_ViewCB_Assign_Str(value, val_ptr, val_len);
+ cfish_ViewCharBuf *value
+ = (cfish_ViewCharBuf*)inv_entry->value;
+ Cfish_ViewCB_Assign_Str(value, val_ptr, val_len);
break;
}
case lucy_FType_BLOB: {
STRLEN val_len;
char *val_ptr = SvPV(value_sv, val_len);
- lucy_ViewByteBuf *value
- = (lucy_ViewByteBuf*)inv_entry->value;
- Lucy_ViewBB_Assign_Bytes(value, val_ptr, val_len);
+ cfish_ViewByteBuf *value
+ = (cfish_ViewByteBuf*)inv_entry->value;
+ Cfish_ViewBB_Assign_Bytes(value, val_ptr, val_len);
break;
}
case lucy_FType_INT32: {
- lucy_Integer32* value = (lucy_Integer32*)inv_entry->value;
- Lucy_Int32_Set_Value(value, SvIV(value_sv));
+ cfish_Integer32* value = (cfish_Integer32*)inv_entry->value;
+ Cfish_Int32_Set_Value(value, SvIV(value_sv));
break;
}
case lucy_FType_INT64: {
- lucy_Integer64* value = (lucy_Integer64*)inv_entry->value;
+ cfish_Integer64* value = (cfish_Integer64*)inv_entry->value;
int64_t val = sizeof(IV) == 8
? SvIV(value_sv)
: (int64_t)SvNV(value_sv); // lossy
- Lucy_Int64_Set_Value(value, val);
+ Cfish_Int64_Set_Value(value, val);
break;
}
case lucy_FType_FLOAT32: {
- lucy_Float32* value = (lucy_Float32*)inv_entry->value;
- Lucy_Float32_Set_Value(value, (float)SvNV(value_sv));
+ cfish_Float32* value = (cfish_Float32*)inv_entry->value;
+ Cfish_Float32_Set_Value(value, (float)SvNV(value_sv));
break;
}
case lucy_FType_FLOAT64: {
- lucy_Float64* value = (lucy_Float64*)inv_entry->value;
- Lucy_Float64_Set_Value(value, SvNV(value_sv));
+ cfish_Float64* value = (cfish_Float64*)inv_entry->value;
+ Cfish_Float64_Set_Value(value, SvNV(value_sv));
break;
}
default:
- THROW(LUCY_ERR, "Unrecognized type: %o", type);
+ THROW(CFISH_ERR, "Unrecognized type: %o", type);
}
Lucy_Inverter_Add_Field(self, inv_entry);
http://git-wip-us.apache.org/repos/asf/lucy/blob/d462f11a/perl/xs/XSBind.h
----------------------------------------------------------------------
diff --git a/perl/xs/XSBind.h b/perl/xs/XSBind.h
index 8d6e0ba..c5a5453 100644
--- a/perl/xs/XSBind.h
+++ b/perl/xs/XSBind.h
@@ -44,7 +44,7 @@ extern "C" {
/** Given either a class name or a perl object, manufacture a new Clownfish
* object suitable for supplying to a cfish_Foo_init() function.
*/
-LUCY_VISIBLE cfish_Obj*
+CFISH_VISIBLE cfish_Obj*
cfish_XSBind_new_blank_obj(SV *either_sv);
/** Test whether an SV is defined. Handles "get" magic, unlike SvOK on its
@@ -64,13 +64,13 @@ cfish_XSBind_sv_defined(SV *sv) {
* <code>allocation</code>, assign the SV's string to it, and return that
* instead. If all else fails, throw an exception.
*/
-LUCY_VISIBLE cfish_Obj*
+CFISH_VISIBLE cfish_Obj*
cfish_XSBind_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation);
/** As XSBind_sv_to_cfish_obj above, but returns NULL instead of throwing an
* exception.
*/
-LUCY_VISIBLE cfish_Obj*
+CFISH_VISIBLE cfish_Obj*
cfish_XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable,
void *allocation);
@@ -116,24 +116,24 @@ cfish_XSBind_cfish_obj_to_sv_noinc(cfish_Obj *obj) {
* SVs, ByteBufs to SVs, VArrays to Perl array refs, Hashes to Perl hashrefs,
* and any other object to a Perl object wrapping the Clownfish Obj.
*/
-LUCY_VISIBLE SV*
+CFISH_VISIBLE SV*
cfish_XSBind_cfish_to_perl(cfish_Obj *obj);
/** Deep conversion of Perl data structures to Clownfish objects -- Perl hash
* to Hash, Perl array to VArray, Clownfish objects stripped of their
* wrappers, and everything else stringified and turned to a CharBuf.
*/
-LUCY_VISIBLE cfish_Obj*
+CFISH_VISIBLE cfish_Obj*
cfish_XSBind_perl_to_cfish(SV *sv);
/** Convert a ByteBuf into a new string SV.
*/
-LUCY_VISIBLE SV*
+CFISH_VISIBLE SV*
cfish_XSBind_bb_to_sv(const cfish_ByteBuf *bb);
/** Convert a CharBuf into a new UTF-8 string SV.
*/
-LUCY_VISIBLE SV*
+CFISH_VISIBLE SV*
cfish_XSBind_cb_to_sv(const cfish_CharBuf *cb);
/** Perl-specific wrapper for Err#trap. The "routine" must be either a
@@ -144,15 +144,15 @@ cfish_XSBind_trap(SV *routine, SV *context);
/** Turn on overloading for the supplied Perl object and its class.
*/
-LUCY_VISIBLE void
+CFISH_VISIBLE void
cfish_XSBind_enable_overload(void *pobj);
/** Process hash-style params passed to an XS subroutine. The varargs must be
* a NULL-terminated series of ALLOT_ macros.
*
* cfish_XSBind_allot_params(stack, start, num_stack_elems,
- * ALLOT_OBJ(&field, "field", 5, LUCY_CHARBUF, true, alloca(cfish_ZCB_size()),
- * ALLOT_OBJ(&term, "term", 4, LUCY_CHARBUF, true, alloca(cfish_ZCB_size()),
+ * ALLOT_OBJ(&field, "field", 5, CFISH_CHARBUF, true, alloca(cfish_ZCB_size()),
+ * ALLOT_OBJ(&term, "term", 4, CFISH_CHARBUF, true, alloca(cfish_ZCB_size()),
* NULL);
*
* The following ALLOT_ macros are available for primitive types:
@@ -208,7 +208,7 @@ cfish_XSBind_enable_overload(void *pobj);
* (generally, the XS variable "items").
* @return true on success, false on failure (sets Err_error).
*/
-LUCY_VISIBLE bool
+CFISH_VISIBLE bool
cfish_XSBind_allot_params(SV** stack, int32_t start,
int32_t num_stack_elems, ...);
[lucy-dev] Re: [lucy-commits] [5/9] git commit: refs/heads/separate-clownfish-wip1
- Support object types from other parcels without prefix
Posted by Marvin Humphrey <ma...@rectangular.com>.
On Sun, May 26, 2013 at 8:35 AM, <nw...@apache.org> wrote:
> Support object types from other parcels without prefix
>
> Resolve types after all classes have been parsed.
>
> This means that caching of C representations has to be postponed. For
> now, the C representations are cached after the types have been
> resolved. This is error-prone and requires some hacks for methods. It
> might be better to move to a scheme where the C strings are not cached
> until they're used for the first time.
> Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
> Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/c33d5cb3
> Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c33d5cb3
> Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c33d5cb3
This commit is a very nice step in the right direction. CFC tries to do too
much during the parse phase. It's better to perform semantic analysis during
subsequent tree traversals, even though that may mean adding extra code to
lazily-resolved getters and such to ensure that the object is in a valid state
when they are called.
I suspect that if we move to a single registry for both parcels and classes --
or better yet, a single registry for all symbols, including methods, inert
functions, inert vars and member vars -- type resolution would get easier.
Marvin Humphrey
[lucy-commits] [5/9] git commit: refs/heads/separate-clownfish-wip1 - Support object
types from other parcels without prefix
Posted by nw...@apache.org.
Support object types from other parcels without prefix
Resolve types after all classes have been parsed.
This means that caching of C representations has to be postponed. For
now, the C representations are cached after the types have been
resolved. This is error-prone and requires some hacks for methods. It
might be better to move to a scheme where the C strings are not cached
until they're used for the first time.
TODO: Add Perl bindings and fix Perl tests
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/c33d5cb3
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c33d5cb3
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c33d5cb3
Branch: refs/heads/separate-clownfish-wip1
Commit: c33d5cb3e9ed70a55214aa54c6760dc853206865
Parents: ee195c6
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 20 01:36:52 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 17:19:02 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCClass.c | 16 +++
clownfish/compiler/src/CFCClass.h | 5 +
clownfish/compiler/src/CFCDumpable.c | 13 ++-
clownfish/compiler/src/CFCFunction.c | 6 +
clownfish/compiler/src/CFCFunction.h | 6 +
clownfish/compiler/src/CFCHierarchy.c | 3 +
clownfish/compiler/src/CFCMethod.c | 33 ++++--
clownfish/compiler/src/CFCMethod.h | 3 +
clownfish/compiler/src/CFCParamList.c | 14 ++-
clownfish/compiler/src/CFCParamList.h | 4 +
clownfish/compiler/src/CFCTest.c | 6 +
clownfish/compiler/src/CFCTestClass.c | 15 +++-
clownfish/compiler/src/CFCTestFile.c | 22 ++++-
clownfish/compiler/src/CFCTestMethod.c | 12 ++-
clownfish/compiler/src/CFCTestParamList.c | 10 ++-
clownfish/compiler/src/CFCTestParser.c | 15 +++-
clownfish/compiler/src/CFCTestType.c | 35 +++++++-
clownfish/compiler/src/CFCTestVariable.c | 10 ++-
clownfish/compiler/src/CFCType.c | 123 ++++++++++++++++--------
clownfish/compiler/src/CFCType.h | 6 +
clownfish/compiler/src/CFCVariable.c | 18 +++-
clownfish/compiler/src/CFCVariable.h | 4 +
22 files changed, 305 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.c b/clownfish/compiler/src/CFCClass.c
index e5022ac..0567ca4 100644
--- a/clownfish/compiler/src/CFCClass.c
+++ b/clownfish/compiler/src/CFCClass.c
@@ -459,6 +459,22 @@ CFCClass_fresh_method(CFCClass *self, const char *sym) {
return NULL;
}
+void
+CFCClass_resolve_types(CFCClass *self, CFCClass **classes) {
+ for (size_t i = 0; self->functions[i] != NULL; i++) {
+ CFCFunction_resolve_types(self->functions[i], classes);
+ }
+ for (size_t i = 0; self->methods[i] != NULL; i++) {
+ CFCMethod_resolve_types(self->methods[i], classes);
+ }
+ for (size_t i = 0; self->member_vars[i] != NULL; i++) {
+ CFCVariable_resolve_type(self->member_vars[i], classes);
+ }
+ for (size_t i = 0; self->inert_vars[i] != NULL; i++) {
+ CFCVariable_resolve_type(self->inert_vars[i], classes);
+ }
+}
+
// Pass down member vars to from parent to children.
static void
S_bequeath_member_vars(CFCClass *self) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCClass.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.h b/clownfish/compiler/src/CFCClass.h
index fd38149..cb484d8 100644
--- a/clownfish/compiler/src/CFCClass.h
+++ b/clownfish/compiler/src/CFCClass.h
@@ -150,6 +150,11 @@ CFCClass_fresh_method(CFCClass *self, const char *sym);
struct CFCMethod*
CFCClass_find_novel_method(CFCClass *self, const char *sym);
+/** Find the actual class of all object variables without prefix.
+ */
+void
+CFCClass_resolve_types(CFCClass *self, CFCClass **classes);
+
/** Bequeath all inherited methods and members to children.
*/
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCDumpable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCDumpable.c b/clownfish/compiler/src/CFCDumpable.c
index 7fd2616..006f62a 100644
--- a/clownfish/compiler/src/CFCDumpable.c
+++ b/clownfish/compiler/src/CFCDumpable.c
@@ -110,14 +110,15 @@ CFCDumpable_add_dumpables(CFCDumpable *self, CFCClass *klass) {
static CFCMethod*
S_make_method_obj(CFCClass *klass, const char *method_name) {
- const char *klass_struct_sym = CFCClass_get_struct_sym(klass);
+ const char *klass_full_struct_sym = CFCClass_full_struct_sym(klass);
const char *klass_name = CFCClass_get_class_name(klass);
const char *klass_cnick = CFCClass_get_cnick(klass);
CFCParcel *klass_parcel = CFCClass_get_parcel(klass);
CFCType *return_type
- = CFCType_new_object(CFCTYPE_INCREMENTED, klass_parcel, "Obj", 1);
- CFCType *self_type = CFCType_new_object(0, klass_parcel, klass_struct_sym, 1);
+ = CFCType_new_object(CFCTYPE_INCREMENTED, klass_parcel, "lucy_Obj", 1);
+ CFCType *self_type = CFCType_new_object(0, klass_parcel,
+ klass_full_struct_sym, 1);
CFCVariable *self_var = CFCVariable_new(NULL, NULL, NULL, NULL, "self",
self_type, false);
CFCParamList *param_list = NULL;
@@ -127,7 +128,8 @@ S_make_method_obj(CFCClass *klass, const char *method_name) {
CFCParamList_add_param(param_list, self_var, NULL);
}
else if (strcmp(method_name, "Load") == 0) {
- CFCType *dump_type = CFCType_new_object(0, klass_parcel, "Obj", 1);
+ CFCType *dump_type = CFCType_new_object(0, klass_parcel, "lucy_Obj",
+ 1);
CFCVariable *dump_var = CFCVariable_new(NULL, NULL, NULL, NULL, "dump",
dump_type, false);
param_list = CFCParamList_new(false);
@@ -143,6 +145,9 @@ S_make_method_obj(CFCClass *klass, const char *method_name) {
CFCMethod *method = CFCMethod_new(klass_parcel, "public", klass_name,
klass_cnick, method_name, return_type,
param_list, NULL, false, false);
+ // Hack
+ CFCClass *dummy_class = NULL;
+ CFCMethod_resolve_types(method, &dummy_class);
CFCBase_decref((CFCBase*)param_list);
CFCBase_decref((CFCBase*)self_type);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCFunction.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCFunction.c b/clownfish/compiler/src/CFCFunction.c
index 7205622..6f781f4 100644
--- a/clownfish/compiler/src/CFCFunction.c
+++ b/clownfish/compiler/src/CFCFunction.c
@@ -84,6 +84,12 @@ CFCFunction_init(CFCFunction *self, CFCParcel *parcel, const char *exposure,
}
void
+CFCFunction_resolve_types(CFCFunction *self, struct CFCClass **classes) {
+ CFCType_resolve(self->return_type, classes);
+ CFCParamList_resolve_types(self->param_list, classes);
+}
+
+void
CFCFunction_destroy(CFCFunction *self) {
CFCBase_decref((CFCBase*)self->return_type);
CFCBase_decref((CFCBase*)self->param_list);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCFunction.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCFunction.h b/clownfish/compiler/src/CFCFunction.h
index e69b632..baab2c7 100644
--- a/clownfish/compiler/src/CFCFunction.h
+++ b/clownfish/compiler/src/CFCFunction.h
@@ -29,6 +29,7 @@ struct CFCParcel;
struct CFCType;
struct CFCDocuComment;
struct CFCParamList;
+struct CFCClass;
#ifdef CFC_NEED_FUNCTION_STRUCT_DEF
#define CFC_NEED_SYMBOL_STRUCT_DEF
@@ -110,6 +111,11 @@ CFCFunction_micro_sym(CFCFunction *self);
int
CFCFunction_public(CFCFunction *self);
+/** Find the actual class of all object variables without prefix.
+ */
+void
+CFCFunction_resolve_types(CFCFunction *self, struct CFCClass **classes);
+
#ifdef __cplusplus
}
#endif
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCHierarchy.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCHierarchy.c b/clownfish/compiler/src/CFCHierarchy.c
index b8ba423..5c5b192 100644
--- a/clownfish/compiler/src/CFCHierarchy.c
+++ b/clownfish/compiler/src/CFCHierarchy.c
@@ -197,6 +197,9 @@ CFCHierarchy_build(CFCHierarchy *self) {
for (size_t i = 0; self->includes[i] != NULL; i++) {
S_parse_cf_files(self, self->includes[i], 1);
}
+ for (int i = 0; self->classes[i] != NULL; i++) {
+ CFCClass_resolve_types(self->classes[i], self->classes);
+ }
S_connect_classes(self);
for (size_t i = 0; self->trees[i] != NULL; i++) {
CFCClass_grow_tree(self->trees[i]);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCMethod.c b/clownfish/compiler/src/CFCMethod.c
index a9f0063..395eb62 100644
--- a/clownfish/compiler/src/CFCMethod.c
+++ b/clownfish/compiler/src/CFCMethod.c
@@ -105,12 +105,30 @@ CFCMethod_init(CFCMethod *self, CFCParcel *parcel, const char *exposure,
docucomment, false);
FREEMEM(micro_sym);
+ self->macro_sym = CFCUtil_strdup(macro_sym);
+ self->is_final = is_final;
+ self->is_abstract = is_abstract;
+
+ self->full_override_sym = NULL;
+
+ // Assume that this method is novel until we discover when applying
+ // inheritance that it overrides another.
+ self->is_novel = true;
+
+ return self;
+}
+
+void
+CFCMethod_resolve_types(CFCMethod *self, struct CFCClass **classes) {
+ CFCFunction_resolve_types((CFCFunction*)self, classes);
+
// Verify that the first element in the arg list is a self.
- CFCVariable **args = CFCParamList_get_variables(param_list);
+ CFCVariable **args = CFCParamList_get_variables(self->function.param_list);
if (!args[0]) { CFCUtil_die("Missing 'self' argument"); }
CFCType *type = CFCVariable_get_type(args[0]);
const char *specifier = CFCType_get_specifier(type);
const char *prefix = CFCMethod_get_prefix(self);
+ const char *class_name = CFCMethod_get_class_name(self);
const char *last_colon = strrchr(class_name, ':');
const char *struct_sym = last_colon ? last_colon + 1 : class_name;
char *wanted = CFCUtil_sprintf("%s%s", prefix, struct_sym);
@@ -121,19 +139,9 @@ CFCMethod_init(CFCMethod *self, CFCParcel *parcel, const char *exposure,
class_name, specifier);
}
- self->macro_sym = CFCUtil_strdup(macro_sym);
- self->is_final = is_final;
- self->is_abstract = is_abstract;
-
// Derive more symbols.
const char *full_func_sym = CFCMethod_implementing_func_sym(self);
self->full_override_sym = CFCUtil_sprintf("%s_OVERRIDE", full_func_sym);
-
- // Assume that this method is novel until we discover when applying
- // inheritance that it overrides another.
- self->is_novel = true;
-
- return self;
}
void
@@ -220,6 +228,9 @@ CFCMethod_finalize(CFCMethod *self) {
self->function.param_list,
self->function.docucomment, true,
self->is_abstract);
+ // Hack
+ CFCClass *dummy_class = NULL;
+ CFCMethod_resolve_types(finalized, &dummy_class);
return finalized;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCMethod.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCMethod.h b/clownfish/compiler/src/CFCMethod.h
index b7f01dd..cdceb6a 100644
--- a/clownfish/compiler/src/CFCMethod.h
+++ b/clownfish/compiler/src/CFCMethod.h
@@ -71,6 +71,9 @@ CFCMethod_init(CFCMethod *self, struct CFCParcel *parcel,
int is_abstract);
void
+CFCMethod_resolve_types(CFCMethod *self, struct CFCClass **classes);
+
+void
CFCMethod_destroy(CFCMethod *self);
/** Returns true if the methods have signatures and attributes which allow one
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCParamList.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParamList.c b/clownfish/compiler/src/CFCParamList.c
index 3e7bacf..2845480 100644
--- a/clownfish/compiler/src/CFCParamList.c
+++ b/clownfish/compiler/src/CFCParamList.c
@@ -55,11 +55,20 @@ CFCParamList_init(CFCParamList *self, int variadic) {
self->num_vars = 0;
self->variables = (CFCVariable**)CALLOCATE(1, sizeof(void*));
self->values = (char**)CALLOCATE(1, sizeof(char*));
- S_generate_c_strings(self);
+ self->c_string = CFCUtil_strdup("");
+ self->name_list = CFCUtil_strdup("");
return self;
}
void
+CFCParamList_resolve_types(CFCParamList *self, struct CFCClass **classes) {
+ for (size_t i = 0; self->variables[i]; ++i) {
+ CFCVariable_resolve_type(self->variables[i], classes);
+ }
+ S_generate_c_strings(self);
+}
+
+void
CFCParamList_add_param(CFCParamList *self, CFCVariable *variable,
const char *value) {
CFCUTIL_NULL_CHECK(variable);
@@ -72,8 +81,6 @@ CFCParamList_add_param(CFCParamList *self, CFCVariable *variable,
self->values[self->num_vars - 1] = value ? CFCUtil_strdup(value) : NULL;
self->variables[self->num_vars] = NULL;
self->values[self->num_vars] = NULL;
-
- S_generate_c_strings(self);
}
void
@@ -153,7 +160,6 @@ CFCParamList_num_vars(CFCParamList *self) {
void
CFCParamList_set_variadic(CFCParamList *self, int variadic) {
self->variadic = !!variadic;
- S_generate_c_strings(self);
}
int
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCParamList.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParamList.h b/clownfish/compiler/src/CFCParamList.h
index 23cc0e3..886fdfe 100644
--- a/clownfish/compiler/src/CFCParamList.h
+++ b/clownfish/compiler/src/CFCParamList.h
@@ -25,6 +25,7 @@ extern "C" {
#endif
typedef struct CFCParamList CFCParamList;
+struct CFCClass;
struct CFCVariable;
/**
@@ -37,6 +38,9 @@ CFCParamList*
CFCParamList_init(CFCParamList *self, int variadic);
void
+CFCParamList_resolve_types(CFCParamList *self, struct CFCClass **classes);
+
+void
CFCParamList_destroy(CFCParamList *self);
/** Add a parameter to the ParamList.
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTest.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTest.c b/clownfish/compiler/src/CFCTest.c
index 2fd9933..21cff48 100644
--- a/clownfish/compiler/src/CFCTest.c
+++ b/clownfish/compiler/src/CFCTest.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -297,6 +298,11 @@ S_format_cfish_vtest_result(int pass, int test_num, const char *fmt,
vprintf(fmt, args);
printf("\n");
}
+ else if (getenv("CFCTEST_VERBOSE")) {
+ printf(" Passed test %d: ", test_num);
+ vprintf(fmt, args);
+ printf("\n");
+ }
}
static void
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTestClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestClass.c b/clownfish/compiler/src/CFCTestClass.c
index 67097d6..9f841f9 100644
--- a/clownfish/compiler/src/CFCTestClass.c
+++ b/clownfish/compiler/src/CFCTestClass.c
@@ -39,7 +39,7 @@ S_has_symbol(CFCSymbol **symbols, const char *micro_sym);
const CFCTestBatch CFCTEST_BATCH_CLASS = {
"Clownfish::CFC::Model::Class",
- 83,
+ 87,
S_run_tests
};
@@ -49,6 +49,10 @@ S_run_tests(CFCTest *test) {
CFCParcel *neato = CFCParcel_new("Neato", NULL, NULL);
CFCFileSpec *file_spec = CFCFileSpec_new(".", "Foo/FooJr", 0);
+ CFCClass *thing_class
+ = CFCTest_parse_class(test, parser, "class Thing {}");
+ CFCClass *widget_class
+ = CFCTest_parse_class(test, parser, "class Widget {}");
CFCVariable *thing;
CFCVariable *widget;
@@ -119,6 +123,13 @@ S_run_tests(CFCTest *test) {
= CFCTest_parse_method(test, parser, "void Do_Stuff(Foo *self);");
CFCClass_add_method(foo, do_stuff);
+ CFCClass *class_list[6] = {
+ foo, foo_jr, final_foo, thing_class, widget_class, NULL
+ };
+ CFCClass_resolve_types(foo, class_list);
+ CFCClass_resolve_types(foo_jr, class_list);
+ CFCClass_resolve_types(final_foo, class_list);
+
CFCClass_add_child(foo, foo_jr);
CFCClass_add_child(foo_jr, final_foo);
CFCClass_grow_tree(foo);
@@ -330,6 +341,8 @@ S_run_tests(CFCTest *test) {
CFCBase_decref((CFCBase*)parser);
CFCBase_decref((CFCBase*)neato);
CFCBase_decref((CFCBase*)file_spec);
+ CFCBase_decref((CFCBase*)thing_class);
+ CFCBase_decref((CFCBase*)widget_class);
CFCBase_decref((CFCBase*)thing);
CFCBase_decref((CFCBase*)widget);
CFCBase_decref((CFCBase*)tread_water);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTestFile.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestFile.c b/clownfish/compiler/src/CFCTestFile.c
index 2e1edc5..f62b919 100644
--- a/clownfish/compiler/src/CFCTestFile.c
+++ b/clownfish/compiler/src/CFCTestFile.c
@@ -21,6 +21,7 @@
#include "CFCClass.h"
#include "CFCFile.h"
#include "CFCFileSpec.h"
+#include "CFCParcel.h"
#include "CFCParser.h"
#include "CFCTest.h"
#include "CFCType.h"
@@ -32,7 +33,7 @@ S_run_tests(CFCTest *test);
const CFCTestBatch CFCTEST_BATCH_FILE = {
"Clownfish::CFC::Model::File",
- 19,
+ 21,
S_run_tests
};
@@ -50,6 +51,8 @@ S_run_tests(CFCTest *test) {
" Foo *foo;\n"
" Bar *bar;\n"
"}\n"
+ "class Foo {}\n"
+ "class Bar {}\n"
"__C__\n"
"int foo;\n"
"__END_C__\n";
@@ -88,13 +91,17 @@ S_run_tests(CFCTest *test) {
FREEMEM(h_path);
CFCClass **classes = CFCFile_classes(file);
- OK(test, classes[0] != NULL && classes[1] == NULL,
+ OK(test,
+ classes[0] != NULL && classes[1] != NULL && classes[2] != NULL
+ && classes[3] == NULL,
"classes() filters blocks");
CFCVariable **member_vars = CFCClass_member_vars(classes[0]);
CFCType *foo_type = CFCVariable_get_type(member_vars[0]);
+ CFCType_resolve(foo_type, classes);
STR_EQ(test, CFCType_get_specifier(foo_type), "stuff_Foo",
"file production picked up parcel def");
CFCType *bar_type = CFCVariable_get_type(member_vars[1]);
+ CFCType_resolve(bar_type, classes);
STR_EQ(test, CFCType_get_specifier(bar_type), "stuff_Bar",
"parcel def is sticky");
@@ -104,8 +111,12 @@ S_run_tests(CFCTest *test) {
STR_EQ(test, CFCBase_get_cfc_class(blocks[1]),
"Clownfish::CFC::Model::Class", "blocks[1]");
STR_EQ(test, CFCBase_get_cfc_class(blocks[2]),
- "Clownfish::CFC::Model::CBlock", "blocks[2]");
- OK(test, blocks[3] == NULL, "blocks[3]");
+ "Clownfish::CFC::Model::Class", "blocks[2]");
+ STR_EQ(test, CFCBase_get_cfc_class(blocks[3]),
+ "Clownfish::CFC::Model::Class", "blocks[3]");
+ STR_EQ(test, CFCBase_get_cfc_class(blocks[4]),
+ "Clownfish::CFC::Model::CBlock", "blocks[4]");
+ OK(test, blocks[5] == NULL, "blocks[5]");
CFCBase_decref((CFCBase*)file);
}
@@ -128,5 +139,8 @@ S_run_tests(CFCTest *test) {
CFCBase_decref((CFCBase*)file_spec);
CFCBase_decref((CFCBase*)parser);
+
+ CFCClass_clear_registry();
+ CFCParcel_reap_singletons();
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTestMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestMethod.c b/clownfish/compiler/src/CFCTestMethod.c
index 7122786..a805228 100644
--- a/clownfish/compiler/src/CFCTestMethod.c
+++ b/clownfish/compiler/src/CFCTestMethod.c
@@ -16,6 +16,7 @@
#define CFC_USE_TEST_MACROS
#include "CFCBase.h"
+#include "CFCClass.h"
#include "CFCMethod.h"
#include "CFCParamList.h"
#include "CFCParcel.h"
@@ -41,7 +42,7 @@ S_run_final_tests(CFCTest *test);
const CFCTestBatch CFCTEST_BATCH_METHOD = {
"Clownfish::CFC::Model::Method",
- 66,
+ 70,
S_run_tests
};
@@ -225,6 +226,11 @@ S_run_final_tests(CFCTest *test) {
CFCParser *parser = CFCParser_new();
CFCParcel *neato_parcel
= CFCTest_parse_parcel(test, parser, "parcel Neato;");
+ CFCClass *obj_class
+ = CFCTest_parse_class(test, parser, "class Obj {}");
+ CFCClass *foo_class
+ = CFCTest_parse_class(test, parser, "class Neato::Foo {}");
+ CFCClass *class_list[3] = { obj_class, foo_class, NULL };
CFCType *return_type = CFCTest_parse_type(test, parser, "Obj*");
CFCParamList *param_list
= CFCTest_parse_param_list(test, parser, "(Foo *self)");
@@ -233,6 +239,7 @@ S_run_final_tests(CFCTest *test) {
= CFCMethod_new(neato_parcel, NULL, "Neato::Foo", "Foo",
"Return_An_Obj", return_type, param_list,
NULL, 0, 0);
+ CFCMethod_resolve_types(not_final, class_list);
CFCMethod *final = CFCMethod_finalize(not_final);
OK(test, CFCMethod_compatible(not_final, final),
"finalize clones properly");
@@ -241,11 +248,14 @@ S_run_final_tests(CFCTest *test) {
CFCBase_decref((CFCBase*)parser);
CFCBase_decref((CFCBase*)neato_parcel);
+ CFCBase_decref((CFCBase*)obj_class);
+ CFCBase_decref((CFCBase*)foo_class);
CFCBase_decref((CFCBase*)return_type);
CFCBase_decref((CFCBase*)param_list);
CFCBase_decref((CFCBase*)not_final);
CFCBase_decref((CFCBase*)final);
+ CFCClass_clear_registry();
CFCParcel_reap_singletons();
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTestParamList.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestParamList.c b/clownfish/compiler/src/CFCTestParamList.c
index 0fd552c..29ff226 100644
--- a/clownfish/compiler/src/CFCTestParamList.c
+++ b/clownfish/compiler/src/CFCTestParamList.c
@@ -16,6 +16,7 @@
#define CFC_USE_TEST_MACROS
#include "CFCBase.h"
+#include "CFCClass.h"
#include "CFCParamList.h"
#include "CFCParcel.h"
#include "CFCParser.h"
@@ -27,7 +28,7 @@ S_run_tests(CFCTest *test);
const CFCTestBatch CFCTEST_BATCH_PARAM_LIST = {
"Clownfish::CFC::Model::ParamList",
- 21,
+ 23,
S_run_tests
};
@@ -36,10 +37,13 @@ S_run_tests(CFCTest *test) {
CFCParser *parser = CFCParser_new();
CFCParcel *neato_parcel
= CFCTest_parse_parcel(test, parser, "parcel Neato;");
+ CFCClass *obj_class = CFCTest_parse_class(test, parser, "class Obj {}");
+ CFCClass *class_list[2] = { obj_class, NULL };
{
CFCParamList *param_list
= CFCTest_parse_param_list(test, parser, "(Obj *self, int num)");
+ CFCParamList_resolve_types(param_list, class_list);
OK(test, !CFCParamList_variadic(param_list), "not variadic");
STR_EQ(test, CFCParamList_to_c(param_list), "neato_Obj* self, int num",
"to_c");
@@ -53,6 +57,7 @@ S_run_tests(CFCTest *test) {
CFCParamList *param_list
= CFCTest_parse_param_list(test, parser,
"(Obj *self=NULL, int num, ...)");
+ CFCParamList_resolve_types(param_list, class_list);
OK(test, CFCParamList_variadic(param_list), "variadic");
STR_EQ(test, CFCParamList_to_c(param_list),
"neato_Obj* self, int num, ...", "to_c");
@@ -72,6 +77,7 @@ S_run_tests(CFCTest *test) {
{
CFCParamList *param_list
= CFCTest_parse_param_list(test, parser, "()");
+ CFCParamList_resolve_types(param_list, class_list);
STR_EQ(test, CFCParamList_to_c(param_list), "void", "to_c");
INT_EQ(test, CFCParamList_num_vars(param_list), 0, "num_vars");
CFCVariable **variables = CFCParamList_get_variables(param_list);
@@ -82,7 +88,9 @@ S_run_tests(CFCTest *test) {
CFCBase_decref((CFCBase*)parser);
CFCBase_decref((CFCBase*)neato_parcel);
+ CFCBase_decref((CFCBase*)obj_class);
+ CFCClass_clear_registry();
CFCParcel_reap_singletons();
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTestParser.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestParser.c b/clownfish/compiler/src/CFCTestParser.c
index 35d38ab..46611dd 100644
--- a/clownfish/compiler/src/CFCTestParser.c
+++ b/clownfish/compiler/src/CFCTestParser.c
@@ -37,7 +37,7 @@ S_test_initial_value(CFCTest *test, CFCParser *parser,
const CFCTestBatch CFCTEST_BATCH_PARSER = {
"Clownfish::CFC::Model::Parser",
- 189,
+ 203,
S_run_tests
};
@@ -108,17 +108,30 @@ S_run_tests(CFCTest *test) {
static const char *const class_names[7] = {
"ByteBuf", "Obj", "ANDMatcher", "Foo", "FooJr", "FooIII", "Foo4th"
};
+ CFCClass *class_list[8];
+ for (int i = 0; i < 7; ++i) {
+ char *class_code = CFCUtil_sprintf("class %s {}", class_names[i]);
+ CFCClass *klass = CFCTest_parse_class(test, parser, class_code);
+ class_list[i] = klass;
+ FREEMEM(class_code);
+ }
+ class_list[7] = NULL;
for (int i = 0; i < 7; ++i) {
const char *class_name = class_names[i];
char *src = CFCUtil_sprintf("%s*", class_name);
char *expected = CFCUtil_sprintf("crust_%s", class_name);
CFCType *type = CFCTest_parse_type(test, parser, src);
+ CFCType_resolve(type, class_list);
STR_EQ(test, CFCType_get_specifier(type), expected,
"object_type_specifier: %s", class_name);
FREEMEM(src);
FREEMEM(expected);
CFCBase_decref((CFCBase*)type);
}
+ for (int i = 0; i < 7; ++i) {
+ CFCBase_decref((CFCBase*)class_list[i]);
+ }
+ CFCClass_clear_registry();
}
{
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTestType.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestType.c b/clownfish/compiler/src/CFCTestType.c
index 8751eb8..baa91d2 100644
--- a/clownfish/compiler/src/CFCTestType.c
+++ b/clownfish/compiler/src/CFCTestType.c
@@ -16,12 +16,18 @@
#define CFC_USE_TEST_MACROS
#include "CFCBase.h"
+#include "CFCClass.h"
#include "CFCParcel.h"
#include "CFCParser.h"
#include "CFCTest.h"
#include "CFCType.h"
#include "CFCUtil.h"
+#ifndef true
+ #define true 1
+ #define false 0
+#endif
+
static void
S_run_tests(CFCTest *test);
@@ -54,7 +60,7 @@ S_run_composite_tests(CFCTest *test);
const CFCTestBatch CFCTEST_BATCH_TYPE = {
"Clownfish::CFC::Model::Type",
- 353,
+ 361,
S_run_tests
};
@@ -287,11 +293,17 @@ S_run_object_tests(CFCTest *test) {
for (int i = 0; i < 4; ++i) {
const char *specifier = specifiers[i];
+ char *class_code = CFCUtil_sprintf("class %s {}", specifier);
+ CFCClass *klass = CFCTest_parse_class(test, parser, class_code);
+ CFCClass *class_list[2] = { klass, NULL };
+ FREEMEM(class_code);
+
static const char *prefixes[2] = { "", "neato_" };
char *expect = CFCUtil_sprintf("neato_%s", specifier);
for (int j = 0; j < 2; ++j) {
char *src = CFCUtil_sprintf("%s%s*", prefixes[j], specifier);
CFCType *type = CFCTest_parse_type(test, parser, src);
+ CFCType_resolve(type, class_list);
STR_EQ(test, CFCType_get_specifier(type), expect,
"object_type_specifier: %s", src);
OK(test, CFCType_is_object(type), "%s is_object", src);
@@ -312,16 +324,26 @@ S_run_object_tests(CFCTest *test) {
FREEMEM(src);
CFCBase_decref((CFCBase*)type);
}
+
+ CFCBase_decref((CFCBase*)klass);
+ CFCClass_clear_registry();
}
CFCBase_decref((CFCBase*)neato_parcel);
CFCBase_decref((CFCBase*)parser);
}
+ CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL);
+ CFCClass *foo_class
+ = CFCClass_create(neato_parcel, NULL, "Foo", NULL, NULL, NULL, NULL,
+ NULL, false, false);
+ CFCClass *class_list[2] = { foo_class, NULL };
CFCType *foo = CFCType_new_object(0, NULL, "Foo", 1);
+ CFCType_resolve(foo, class_list);
{
CFCType *another_foo = CFCType_new_object(0, NULL, "Foo", 1);
+ CFCType_resolve(another_foo, class_list);
OK(test, CFCType_equals(foo, another_foo), "equals");
CFCBase_decref((CFCBase*)another_foo);
}
@@ -335,13 +357,18 @@ S_run_object_tests(CFCTest *test) {
{
CFCParcel *foreign_parcel = CFCParcel_new("Foreign", NULL, NULL);
- CFCParcel_register(foreign_parcel);
+ CFCClass *foreign_foo_class
+ = CFCClass_create(foreign_parcel, NULL, "Foo", NULL, NULL, NULL,
+ NULL, NULL, false, false);
+ CFCClass *foreign_class_list[2] = { foreign_foo_class, NULL };
CFCType *foreign_foo = CFCType_new_object(0, foreign_parcel, "Foo", 1);
+ CFCType_resolve(foreign_foo, foreign_class_list);
OK(test, !CFCType_equals(foo, foreign_foo),
"different parcel spoils equals");
STR_EQ(test, CFCType_get_specifier(foreign_foo), "foreign_Foo",
"prepend parcel prefix to specifier");
CFCBase_decref((CFCBase*)foreign_parcel);
+ CFCBase_decref((CFCBase*)foreign_foo_class);
CFCBase_decref((CFCBase*)foreign_foo);
}
@@ -366,8 +393,10 @@ S_run_object_tests(CFCTest *test) {
CFCBase_decref((CFCBase*)string_type);
}
+ CFCBase_decref((CFCBase*)foo_class);
CFCBase_decref((CFCBase*)foo);
+ CFCClass_clear_registry();
CFCParcel_reap_singletons();
}
@@ -485,7 +514,9 @@ S_run_composite_tests(CFCTest *test) {
}
{
+ CFCClass *class_list[1] = { NULL };
CFCType *foo_array = CFCTest_parse_type(test, parser, "foo_t[]");
+ CFCType_resolve(foo_array, class_list);
STR_EQ(test, CFCType_get_array(foo_array), "[]", "get_array");
STR_EQ(test, CFCType_to_c(foo_array), "foo_t",
"array subscripts not included by to_c");
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCTestVariable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestVariable.c b/clownfish/compiler/src/CFCTestVariable.c
index fd7f291..f0cbcac 100644
--- a/clownfish/compiler/src/CFCTestVariable.c
+++ b/clownfish/compiler/src/CFCTestVariable.c
@@ -16,6 +16,7 @@
#define CFC_USE_TEST_MACROS
#include "CFCBase.h"
+#include "CFCClass.h"
#include "CFCParcel.h"
#include "CFCParser.h"
#include "CFCSymbol.h"
@@ -28,7 +29,7 @@ S_run_tests(CFCTest *test);
const CFCTestBatch CFCTEST_BATCH_VARIABLE = {
"Clownfish::CFC::Model::Variable",
- 27,
+ 29,
S_run_tests
};
@@ -37,11 +38,14 @@ S_run_tests(CFCTest *test) {
CFCParser *parser = CFCParser_new();
CFCParcel *neato_parcel
= CFCTest_parse_parcel(test, parser, "parcel Neato;");
+ CFCClass *foo_class = CFCTest_parse_class(test, parser, "class Foo {}");
+ CFCClass *class_list[2] = { foo_class, NULL };
{
CFCType *type = CFCTest_parse_type(test, parser, "float*");
CFCVariable *var
= CFCVariable_new(NULL, NULL, NULL, NULL, "foo", type, 0);
+ CFCVariable_resolve_type(var, class_list);
STR_EQ(test, CFCVariable_local_c(var), "float* foo", "local_c");
STR_EQ(test, CFCVariable_local_declaration(var), "float* foo;",
"local_declaration");
@@ -55,6 +59,7 @@ S_run_tests(CFCTest *test) {
CFCType *type = CFCTest_parse_type(test, parser, "float[1]");
CFCVariable *var
= CFCVariable_new(NULL, NULL, NULL, NULL, "foo", type, 0);
+ CFCVariable_resolve_type(var, class_list);
STR_EQ(test, CFCVariable_local_c(var), "float foo[1]",
"to_c appends array to var name rather than type specifier");
@@ -68,6 +73,7 @@ S_run_tests(CFCTest *test) {
= CFCVariable_new(neato_parcel, NULL,
"Crustacean::Lobster::LobsterClaw", "LobClaw",
"foo", type, 0);
+ CFCVariable_resolve_type(var, class_list);
STR_EQ(test, CFCVariable_global_c(var), "neato_Foo* neato_LobClaw_foo",
"global_c");
@@ -94,7 +100,9 @@ S_run_tests(CFCTest *test) {
CFCBase_decref((CFCBase*)parser);
CFCBase_decref((CFCBase*)neato_parcel);
+ CFCBase_decref((CFCBase*)foo_class);
+ CFCClass_clear_registry();
CFCParcel_reap_singletons();
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCType.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCType.c b/clownfish/compiler/src/CFCType.c
index 549dff1..0494f93 100644
--- a/clownfish/compiler/src/CFCType.c
+++ b/clownfish/compiler/src/CFCType.c
@@ -26,6 +26,7 @@
#define CFC_NEED_BASE_STRUCT_DEF
#include "CFCBase.h"
#include "CFCType.h"
+#include "CFCClass.h"
#include "CFCParcel.h"
#include "CFCSymbol.h"
#include "CFCUtil.h"
@@ -92,15 +93,8 @@ CFCType_init(CFCType *self, int flags, struct CFCParcel *parcel,
self->width = 0;
self->array = NULL;
self->child = NULL;
- if (flags & CFCTYPE_OBJECT) {
- self->vtable_var = CFCUtil_strdup(specifier);
- for (int i = 0; self->vtable_var[i] != 0; i++) {
- self->vtable_var[i] = toupper(self->vtable_var[i]);
- }
- }
- else {
- self->vtable_var = NULL;
- }
+ self->vtable_var = NULL;
+
return self;
}
@@ -216,14 +210,8 @@ CFCType_new_object(int flags, CFCParcel *parcel, const char *specifier,
flags |= CFCTYPE_STRING_TYPE;
}
- char full_specifier[MAX_SPECIFIER_LEN + 1];
char small_specifier[MAX_SPECIFIER_LEN + 1];
if (isupper(*specifier)) {
- const char *prefix = CFCParcel_get_prefix(parcel);
- if (strlen(prefix) + strlen(specifier) > MAX_SPECIFIER_LEN) {
- CFCUtil_die("Specifier and/or parcel prefix too long");
- }
- sprintf(full_specifier, "%s%s", prefix, specifier);
strcpy(small_specifier, specifier);
}
else if (!isalpha(*specifier)) {
@@ -243,7 +231,6 @@ CFCType_new_object(int flags, CFCParcel *parcel, const char *specifier,
}
probe++;
}
- strcpy(full_specifier, specifier);
strcpy(small_specifier, probe);
}
@@ -251,15 +238,6 @@ CFCType_new_object(int flags, CFCParcel *parcel, const char *specifier,
CFCUtil_die("Invalid specifier: '%s'", specifier);
}
- // Cache C representation.
- char c_string[MAX_SPECIFIER_LEN + 10];
- if (flags & CFCTYPE_CONST) {
- sprintf(c_string, "const %s*", full_specifier);
- }
- else {
- sprintf(c_string, "%s*", full_specifier);
- }
-
int acceptable_flags = CFCTYPE_OBJECT
| CFCTYPE_STRING_TYPE
| CFCTYPE_CONST
@@ -268,7 +246,7 @@ CFCType_new_object(int flags, CFCParcel *parcel, const char *specifier,
| CFCTYPE_DECREMENTED;
S_check_flags(flags, acceptable_flags, "Object");
- return CFCType_new(flags, parcel, full_specifier, 1, c_string);
+ return CFCType_new(flags, parcel, specifier, 1, NULL);
}
#define MAX_COMPOSITE_LEN 256
@@ -282,22 +260,8 @@ CFCType_new_composite(int flags, CFCType *child, int indirection,
flags |= CFCTYPE_COMPOSITE;
S_check_flags(flags, CFCTYPE_COMPOSITE | CFCTYPE_NULLABLE, "Composite");
- // Cache C representation.
- // NOTE: Array postfixes are NOT included.
- const char *child_c_string = CFCType_to_c(child);
- size_t child_c_len = strlen(child_c_string);
- size_t amount = child_c_len + indirection;
- if (amount > MAX_COMPOSITE_LEN) {
- CFCUtil_die("C representation too long");
- }
- char c_string[MAX_COMPOSITE_LEN + 1];
- strcpy(c_string, child_c_string);
- for (int i = 0; i < indirection; i++) {
- strncat(c_string, "*", 1);
- }
-
CFCType *self = CFCType_new(flags, NULL, CFCType_get_specifier(child),
- indirection, c_string);
+ indirection, NULL);
self->child = (CFCType*)CFCBase_incref((CFCBase*)child);
// Record array spec.
@@ -335,6 +299,83 @@ CFCType_new_arbitrary(CFCParcel *parcel, const char *specifier) {
}
void
+CFCType_resolve(CFCType *self, CFCClass **classes) {
+ if (CFCType_is_composite(self)) {
+ CFCType_resolve(self->child, classes);
+
+ // Cache C representation.
+ // NOTE: Array postfixes are NOT included.
+ const char *child_c_string = CFCType_to_c(self->child);
+ size_t child_c_len = strlen(child_c_string);
+ size_t amount = child_c_len + self->indirection;
+ if (amount > MAX_COMPOSITE_LEN) {
+ CFCUtil_die("C representation too long");
+ }
+ char c_string[MAX_COMPOSITE_LEN + 1];
+ strcpy(c_string, child_c_string);
+ for (int i = 0; i < self->indirection; i++) {
+ strncat(c_string, "*", 1);
+ }
+ FREEMEM(self->c_string);
+ self->c_string = CFCUtil_strdup(c_string);
+
+ return;
+ }
+ if (!CFCType_is_object(self)) {
+ return;
+ }
+
+ if (isupper(self->specifier[0])) {
+ // Try to find class from class list.
+ const char *specifier = self->specifier;
+ CFCClass *klass = NULL;
+
+ for (size_t i = 0; classes[i]; ++i) {
+ CFCClass *maybe_class = classes[i];
+ const char *struct_sym = CFCClass_get_struct_sym(maybe_class);
+
+ if (strcmp(specifier, struct_sym) == 0) {
+ if (klass) {
+ CFCUtil_die("Type '%s' is ambigious", specifier);
+ }
+ klass = maybe_class;
+ }
+ }
+
+ if (!klass) {
+ CFCUtil_die("No class found for type '%s'", specifier);
+ }
+
+ // Create actual specifier with prefix.
+ const char *prefix = CFCClass_get_prefix(klass);
+ if (strlen(prefix) + strlen(specifier) > MAX_SPECIFIER_LEN) {
+ CFCUtil_die("Specifier and/or parcel prefix too long");
+ }
+ char full_specifier[MAX_SPECIFIER_LEN + 1];
+ sprintf(full_specifier, "%s%s", prefix, specifier);
+ FREEMEM(self->specifier);
+ self->specifier = CFCUtil_strdup(full_specifier);
+ }
+
+ // Cache C representation.
+ char c_string[MAX_SPECIFIER_LEN + 10];
+ if (CFCType_const(self)) {
+ sprintf(c_string, "const %s*", self->specifier);
+ }
+ else {
+ sprintf(c_string, "%s*", self->specifier);
+ }
+ FREEMEM(self->c_string);
+ self->c_string = CFCUtil_strdup(c_string);
+
+ // Cache name of VTable variable.
+ self->vtable_var = CFCUtil_strdup(self->specifier);
+ for (int i = 0; self->vtable_var[i] != 0; i++) {
+ self->vtable_var[i] = toupper(self->vtable_var[i]);
+ }
+}
+
+void
CFCType_destroy(CFCType *self) {
if (self->child) {
CFCBase_decref((CFCBase*)self->child);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCType.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCType.h b/clownfish/compiler/src/CFCType.h
index 5c1354b..937ae94 100644
--- a/clownfish/compiler/src/CFCType.h
+++ b/clownfish/compiler/src/CFCType.h
@@ -25,6 +25,7 @@ extern "C" {
#endif
typedef struct CFCType CFCType;
+struct CFCClass;
struct CFCParcel;
#define CFCTYPE_CONST 0x00000001
@@ -173,6 +174,11 @@ CFCType_new_va_list(void);
CFCType*
CFCType_new_arbitrary(struct CFCParcel *parcel, const char *specifier);
+/** Find the actual class of an object variable without prefix.
+ */
+void
+CFCType_resolve(CFCType *self, struct CFCClass **classes);
+
void
CFCType_destroy(CFCType *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCVariable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCVariable.c b/clownfish/compiler/src/CFCVariable.c
index adf743b..54c2a17 100644
--- a/clownfish/compiler/src/CFCVariable.c
+++ b/clownfish/compiler/src/CFCVariable.c
@@ -74,18 +74,30 @@ CFCVariable_init(CFCVariable *self, struct CFCParcel *parcel,
self->type = (CFCType*)CFCBase_incref((CFCBase*)type);
self->inert = !!inert;
- // Cache various C string representations.
+ self->local_c = NULL;
+ self->local_dec = NULL;
+ self->global_c = NULL;
+
+ return self;
+}
+
+// Cache various C string representations. Will be called after type has
+// been resolved.
+void
+CFCVariable_resolve_type(CFCVariable *self, struct CFCClass **classes) {
+ CFCType *type = self->type;
+ CFCType_resolve(type, classes);
+
const char *type_str = CFCType_to_c(type);
const char *postfix = "";
if (CFCType_is_composite(type) && CFCType_get_array(type) != NULL) {
postfix = CFCType_get_array(type);
}
+ const char *micro_sym = CFCVariable_micro_sym(self);
self->local_c = CFCUtil_sprintf("%s %s%s", type_str, micro_sym, postfix);
self->local_dec = CFCUtil_sprintf("%s;", self->local_c);
const char *full_sym = CFCVariable_full_sym(self);
self->global_c = CFCUtil_sprintf("%s %s%s", type_str, full_sym, postfix);
-
- return self;
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/c33d5cb3/clownfish/compiler/src/CFCVariable.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCVariable.h b/clownfish/compiler/src/CFCVariable.h
index 2d3fcfc..7263de7 100644
--- a/clownfish/compiler/src/CFCVariable.h
+++ b/clownfish/compiler/src/CFCVariable.h
@@ -34,6 +34,7 @@ extern "C" {
#endif
typedef struct CFCVariable CFCVariable;
+struct CFCClass;
struct CFCParcel;
struct CFCType;
@@ -56,6 +57,9 @@ CFCVariable_init(CFCVariable *self, struct CFCParcel *parcel,
struct CFCType *type, int inert);
void
+CFCVariable_resolve_type(CFCVariable *self, struct CFCClass **classes);
+
+void
CFCVariable_destroy(CFCVariable *self);
int
[lucy-commits] [9/9] git commit: refs/heads/separate-clownfish-wip1 - Improve
support for multiple parcels
Posted by nw...@apache.org.
Improve support for multiple parcels
* Generate separate parcel.h and parcel.c files for every parcel.
* Support multiple parcels in a single binary.
* Use intra-parcel dependency information for includes and
bootstrapping.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7c0ae1f7
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7c0ae1f7
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7c0ae1f7
Branch: refs/heads/separate-clownfish-wip1
Commit: 7c0ae1f7efefcf218016f3bc8d9c7983d0413a31
Parents: 13149c8
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue May 21 00:50:05 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 17:19:42 2013 +0200
----------------------------------------------------------------------
c/install.sh | 1 +
clownfish/compiler/perl/lib/Clownfish/CFC.pm | 5 +-
clownfish/compiler/perl/lib/Clownfish/CFC.xs | 7 +-
.../compiler/perl/lib/Clownfish/CFC/Perl/Build.pm | 7 +-
clownfish/compiler/src/CFCBindAliases.c | 1 -
clownfish/compiler/src/CFCBindClass.c | 13 +-
clownfish/compiler/src/CFCBindCore.c | 221 +++++++++------
clownfish/compiler/src/CFCParcel.c | 16 +
clownfish/compiler/src/CFCParcel.h | 5 +
clownfish/compiler/src/CFCPerl.c | 98 +++----
clownfish/compiler/src/CFCPerl.h | 11 +-
common/charmonizer.c | 9 +
common/charmonizer.main | 9 +
core/Clownfish.c | 27 ++
core/Lucy.c | 7 -
perl/Build.PL | 2 +-
perl/buildlib/Lucy/Build/Binding/Misc.pm | 2 +-
17 files changed, 260 insertions(+), 181 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/c/install.sh
----------------------------------------------------------------------
diff --git a/c/install.sh b/c/install.sh
index 7a8495e..f0c9446 100755
--- a/c/install.sh
+++ b/c/install.sh
@@ -67,6 +67,7 @@ esac
mkdir -p $prefix/include
cp autogen/include/cfish_hostdefs.h $prefix/include
+cp autogen/include/cfish_parcel.h $prefix/include
cp autogen/include/lucy_parcel.h $prefix/include
cp -R autogen/include/Clownfish $prefix/include
cp -R autogen/include/Lucy $prefix/include
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/perl/lib/Clownfish/CFC.pm
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.pm b/clownfish/compiler/perl/lib/Clownfish/CFC.pm
index 6635096..cbd28ee 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.pm
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.pm
@@ -698,7 +698,6 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.01' ) }
use Clownfish::CFC::Util qw( verify_args a_isa_b );
our %new_PARAMS = (
- parcel => undef,
hierarchy => undef,
lib_dir => undef,
boot_class => undef,
@@ -709,10 +708,8 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.01' ) }
sub new {
my ( $either, %args ) = @_;
verify_args( \%new_PARAMS, %args ) or confess $@;
- $args{parcel}
- = Clownfish::CFC::Model::Parcel->acquire( $args{parcel} );
return _new(
- @args{qw( parcel hierarchy lib_dir boot_class header footer )} );
+ @args{qw( hierarchy lib_dir boot_class header footer )} );
}
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.xs b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
index 6d3f4f2..308c453 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
@@ -1876,16 +1876,15 @@ PPCODE:
MODULE = Clownfish PACKAGE = Clownfish::CFC::Binding::Perl
SV*
-_new(parcel, hierarchy, lib_dir, boot_class, header, footer)
- CFCParcel *parcel;
+_new(hierarchy, lib_dir, boot_class, header, footer)
CFCHierarchy *hierarchy;
const char *lib_dir;
const char *boot_class;
const char *header;
const char *footer;
CODE:
- CFCPerl *self = CFCPerl_new(parcel, hierarchy, lib_dir, boot_class,
- header, footer);
+ CFCPerl *self = CFCPerl_new(hierarchy, lib_dir, boot_class, header,
+ footer);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
index b816f1c..0243aad 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
@@ -243,15 +243,10 @@ sub _compile_clownfish {
$package_name->bind_all;
}
- my $module_name = $self->module_name;
- my @module_parts = split( '::', $module_name );
- my $parcel = $module_parts[-1];
-
my $binding = Clownfish::CFC::Binding::Perl->new(
- parcel => $parcel,
hierarchy => $hierarchy,
lib_dir => $LIB_DIR,
- boot_class => $module_name,
+ boot_class => $self->module_name,
header => $self->clownfish_params('autogen_header'),
footer => '',
);
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/src/CFCBindAliases.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindAliases.c b/clownfish/compiler/src/CFCBindAliases.c
index 12890ad..91da364 100644
--- a/clownfish/compiler/src/CFCBindAliases.c
+++ b/clownfish/compiler/src/CFCBindAliases.c
@@ -24,7 +24,6 @@ struct alias {
};
struct alias aliases[] = {
- {"CFISH_VISIBLE", "LUCY_VISIBLE"},
{NULL, NULL}
};
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/src/CFCBindClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindClass.c b/clownfish/compiler/src/CFCBindClass.c
index 6c40855..5c83d98 100644
--- a/clownfish/compiler/src/CFCBindClass.c
+++ b/clownfish/compiler/src/CFCBindClass.c
@@ -119,8 +119,7 @@ CFCBindClass_to_c_header(CFCBindClass *self) {
static char*
S_to_c_header_inert(CFCBindClass *self) {
- //const char *prefix = CFCClass_get_prefix(self->client);
- const char *prefix = "lucy_";
+ const char *prefix = CFCClass_get_prefix(self->client);
char *inert_func_decs = S_sub_declarations(self);
char *inert_var_defs = S_inert_var_declarations(self);
char *short_names = S_short_names(self);
@@ -156,10 +155,8 @@ static char*
S_to_c_header_dynamic(CFCBindClass *self) {
const char *privacy_symbol = CFCClass_privacy_symbol(self->client);
const char *vt_var = CFCClass_full_vtable_var(self->client);
- //const char *prefix = CFCClass_get_prefix(self->client);
- //const char *PREFIX = CFCClass_get_PREFIX(self->client);
- const char *prefix = "lucy_";
- const char *PREFIX = "LUCY_";
+ const char *prefix = CFCClass_get_prefix(self->client);
+ const char *PREFIX = CFCClass_get_PREFIX(self->client);
char *struct_def = S_struct_definition(self);
char *parent_include = S_parent_include(self);
char *sub_declarations = S_sub_declarations(self);
@@ -168,8 +165,12 @@ S_to_c_header_dynamic(CFCBindClass *self) {
char *method_defs = S_method_defs(self);
char *short_names = S_short_names(self);
+ // We must include lucy_parcel.h for the Serialize/Deserialize methods.
+ // This should be removed when InStream and OutStream are moved to the
+ // Clownfish parcel or serialization is reworked.
char pattern[] =
"#include \"%sparcel.h\"\n"
+ "#include \"lucy_parcel.h\"\n" // For serialize/deserialize
"\n"
"/* Include the header for this class's parent. \n"
" */\n"
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/src/CFCBindCore.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindCore.c b/clownfish/compiler/src/CFCBindCore.c
index ec36cab..68c9639 100644
--- a/clownfish/compiler/src/CFCBindCore.c
+++ b/clownfish/compiler/src/CFCBindCore.c
@@ -22,7 +22,6 @@
#define CFC_NEED_BASE_STRUCT_DEF
#include "CFCBase.h"
#include "CFCBindCore.h"
-#include "CFCBindAliases.h"
#include "CFCBindClass.h"
#include "CFCBindFile.h"
#include "CFCClass.h"
@@ -45,12 +44,12 @@ struct CFCBindCore {
* all classes, plus typedefs for all class structs.
*/
static void
-S_write_parcel_h(CFCBindCore *self);
+S_write_parcel_h(CFCBindCore *self, CFCParcel *parcel);
/* Write the "parcel.c" file containing autogenerated implementation code.
*/
static void
-S_write_parcel_c(CFCBindCore *self);
+S_write_parcel_c(CFCBindCore *self, CFCParcel *parcel);
static char*
S_charmony_defines();
@@ -116,8 +115,13 @@ CFCBindCore_write_all_modified(CFCBindCore *self, int modified) {
// If any class definition has changed, rewrite the parcel.h and parcel.c
// files.
if (modified) {
- S_write_parcel_h(self);
- S_write_parcel_c(self);
+ CFCParcel **parcels = CFCParcel_source_parcels();
+ for (size_t i = 0; parcels[i]; ++i) {
+ CFCParcel *parcel = parcels[i];
+ S_write_parcel_h(self, parcel);
+ S_write_parcel_c(self, parcel);
+ }
+ FREEMEM(parcels);
}
return modified;
@@ -127,69 +131,41 @@ CFCBindCore_write_all_modified(CFCBindCore *self, int modified) {
* all classes, plus typedefs for all class structs.
*/
static void
-S_write_parcel_h(CFCBindCore *self) {
- CFCHierarchy *hierarchy = self->hierarchy;
- CFCParcel *parcel = NULL;
+S_write_parcel_h(CFCBindCore *self, CFCParcel *parcel) {
+ CFCHierarchy *hierarchy = self->hierarchy;
+ const char *prefix = CFCParcel_get_prefix(parcel);
+ const char *PREFIX = CFCParcel_get_PREFIX(parcel);
+ const char *privacy_sym = CFCParcel_get_privacy_sym(parcel);
char *charmony_defines = S_charmony_defines();
// Declare object structs for all instantiable classes.
- // Obtain parcel prefix for use in bootstrap function name.
char *typedefs = CFCUtil_strdup("");
CFCClass **ordered = CFCHierarchy_ordered_classes(hierarchy);
for (int i = 0; ordered[i] != NULL; i++) {
CFCClass *klass = ordered[i];
+ const char *class_prefix = CFCClass_get_prefix(klass);
+ if (strcmp(class_prefix, prefix) != 0) { continue; }
+
if (!CFCClass_inert(klass)) {
const char *full_struct = CFCClass_full_struct_sym(klass);
typedefs = CFCUtil_cat(typedefs, "typedef struct ", full_struct,
" ", full_struct, ";\n", NULL);
}
- if (!CFCClass_included(klass)) {
- if (parcel && CFCClass_get_parcel(klass) != parcel) {
- //CFCUtil_die("Multiple parcels not yet supported.");
- }
- parcel = CFCClass_get_parcel(klass);
- }
}
FREEMEM(ordered);
- if (!parcel) {
- CFCUtil_die("No source classes found.");
- }
- //const char *prefix = CFCParcel_get_prefix(parcel);
- //const char *PREFIX = CFCParcel_get_PREFIX(parcel);
- const char *prefix = "lucy_";
- const char *PREFIX = "LUCY_";
-
- // Create Clownfish aliases if necessary.
- char *aliases = CFCBindAliases_c_aliases();
-
- const char pattern[] =
- "%s\n"
- "#ifndef CFCPARCEL_H\n"
- "#define CFCPARCEL_H 1\n"
- "\n"
- "#ifdef __cplusplus\n"
- "extern \"C\" {\n"
- "#endif\n"
- "\n"
+ // Special includes for Clownfish parcel.
+ const char *cfish_includes_pattern =
"#include <stdarg.h>\n"
"#include <stddef.h>\n"
"\n"
"%s"
"\n"
- "#include \"cfish_hostdefs.h\"\n"
- "\n"
- "#ifdef CFP_LUCY\n"
- " #include \"charmony.h\"\n"
- " #define LUCY_VISIBLE CFISH_EXPORT\n"
- "#else\n"
- " #define LUCY_VISIBLE CFISH_IMPORT\n"
- "#endif\n"
- "\n"
- "%s\n"
- "%s\n"
- "\n"
+ "#include \"cfish_hostdefs.h\"\n";
+
+ // Special definitions for Clownfish parcel.
+ const char *cfish_defs =
"/* Generic method pointer.\n"
" */\n"
"typedef void\n"
@@ -269,6 +245,51 @@ S_write_parcel_h(CFCBindCore *self) {
" #define MethodSpec cfish_MethodSpec\n"
" #define VTableSpec cfish_VTableSpec\n"
"#endif\n"
+ "\n";
+
+ const char *extra_defs;
+ char *extra_includes;
+ if (strcmp(prefix, "cfish_") == 0) {
+ extra_defs = cfish_defs;
+ extra_includes = CFCUtil_sprintf(cfish_includes_pattern,
+ charmony_defines);
+ }
+ else {
+ extra_defs = "";
+ extra_includes = CFCUtil_strdup("");
+
+ // Include parcel.h of dependent parcels.
+ CFCParcel **dep_parcels = CFCParcel_dependent_parcels(parcel);
+ for (size_t i = 0; dep_parcels[i]; ++i) {
+ const char *dep_prefix = CFCParcel_get_prefix(dep_parcels[i]);
+ extra_includes = CFCUtil_cat(extra_includes, "#include <",
+ dep_prefix, "parcel.h>\n", NULL);
+ }
+ }
+
+ const char pattern[] =
+ "%s\n"
+ "#ifndef CFISH_%sPARCEL_H\n"
+ "#define CFISH_%sPARCEL_H 1\n"
+ "\n"
+ "#ifdef __cplusplus\n"
+ "extern \"C\" {\n"
+ "#endif\n"
+ "\n"
+ "%s" // Extra includes.
+ "\n"
+ "#ifdef %s\n"
+ " #include \"charmony.h\"\n"
+ " #define %sVISIBLE CFISH_EXPORT\n"
+ "#else\n"
+ " #define %sVISIBLE CFISH_IMPORT\n"
+ "#endif\n"
+ "\n"
+ "%s" // Typedefs.
+ "\n"
+ "%s" // Extra definitions.
+ "%sVISIBLE void\n"
+ "%sbootstrap_inheritance();\n"
"\n"
"%sVISIBLE void\n"
"%sbootstrap_parcel();\n"
@@ -280,13 +301,15 @@ S_write_parcel_h(CFCBindCore *self) {
"}\n"
"#endif\n"
"\n"
- "#endif /* CFCPARCEL_H */\n"
+ "#endif /* CFISH_%sPARCEL_H */\n"
"\n"
"%s\n"
"\n";
char *file_content
- = CFCUtil_sprintf(pattern, self->header, charmony_defines, aliases,
- typedefs, PREFIX, prefix, prefix, self->footer);
+ = CFCUtil_sprintf(pattern, self->header, PREFIX, PREFIX,
+ extra_includes, privacy_sym, PREFIX, PREFIX,
+ typedefs, extra_defs, PREFIX, prefix, PREFIX, prefix,
+ prefix, PREFIX, self->footer);
// Unlink then write file.
const char *inc_dest = CFCHierarchy_get_include_dest(hierarchy);
@@ -297,18 +320,17 @@ S_write_parcel_h(CFCBindCore *self) {
FREEMEM(filepath);
FREEMEM(charmony_defines);
- FREEMEM(aliases);
FREEMEM(typedefs);
+ FREEMEM(extra_includes);
FREEMEM(file_content);
}
static void
-S_write_parcel_c(CFCBindCore *self) {
+S_write_parcel_c(CFCBindCore *self, CFCParcel *parcel) {
CFCHierarchy *hierarchy = self->hierarchy;
- CFCParcel *parcel = NULL;
+ const char *prefix = CFCParcel_get_prefix(parcel);
- // Aggregate C code from all files.
- // Obtain parcel prefix for use in bootstrap function name.
+ // Aggregate C code for the parcel.
char *privacy_syms = CFCUtil_strdup("");
char *includes = CFCUtil_strdup("");
char *c_data = CFCUtil_strdup("");
@@ -318,13 +340,13 @@ S_write_parcel_c(CFCBindCore *self) {
CFCClass **ordered = CFCHierarchy_ordered_classes(hierarchy);
for (int i = 0; ordered[i] != NULL; i++) {
CFCClass *klass = ordered[i];
+ const char *class_prefix = CFCClass_get_prefix(klass);
+ if (strcmp(class_prefix, prefix) != 0) { continue; }
const char *include_h = CFCClass_include_h(klass);
includes = CFCUtil_cat(includes, "#include \"", include_h,
"\"\n", NULL);
- if (CFCClass_included(klass)) { continue; }
-
CFCBindClass *class_binding = CFCBindClass_new(klass);
char *class_c_data = CFCBindClass_to_c_data(class_binding);
c_data = CFCUtil_cat(c_data, class_c_data, "\n", NULL);
@@ -342,28 +364,47 @@ S_write_parcel_c(CFCBindCore *self) {
const char *privacy_sym = CFCClass_privacy_symbol(klass);
privacy_syms = CFCUtil_cat(privacy_syms, "#define ",
privacy_sym, "\n", NULL);
- if (parcel && CFCClass_get_parcel(klass) != parcel) {
- //CFCUtil_die("Multiple parcels not yet supported.");
- }
- parcel = CFCClass_get_parcel(klass);
}
vt_specs = CFCUtil_cat(vt_specs, "\n};\n", NULL);
FREEMEM(ordered);
- if (!parcel) {
- CFCUtil_die("No source classes found.");
+ // Bootstrapping code for dependent parcels.
+ //
+ // bootstrap_inheritance() first calls bootstrap_inheritance() for all
+ // parcels from which classes are extended. Then the VTables of the parcel
+ // are initialized. It aborts on recursive invocation.
+ //
+ // bootstrap_parcel() first calls bootstrap_inheritance() of its own
+ // parcel. Then it calls bootstrap_parcel() for all dependent parcels.
+ // Finally, it calls init_parcel(). Recursive invocation is allowed.
+
+ char *ext_bootstrap = CFCUtil_strdup("");
+ char *dep_bootstrap = CFCUtil_strdup("");
+ CFCParcel **ext_parcels = CFCParcel_extended_parcels(parcel);
+ for (size_t i = 0; ext_parcels[i]; ++i) {
+ const char *ext_prefix = CFCParcel_get_prefix(ext_parcels[i]);
+ ext_bootstrap = CFCUtil_cat(ext_bootstrap, " ", ext_prefix,
+ "bootstrap_inheritance();\n", NULL);
+ }
+ CFCParcel **dep_parcels = CFCParcel_dependent_parcels(parcel);
+ for (size_t i = 0; dep_parcels[i]; ++i) {
+ const char *dep_prefix = CFCParcel_get_prefix(dep_parcels[i]);
+ dep_bootstrap = CFCUtil_cat(dep_bootstrap, " ", dep_prefix,
+ "bootstrap_parcel();\n", NULL);
}
- //const char *prefix = CFCParcel_get_prefix(parcel);
- const char *prefix = "lucy_";
char pattern[] =
"%s\n"
"\n"
- "#define C_CFISH_VTABLE\n"
+ "#define C_CFISH_VTABLE\n" // Needed for method_ptrs offset.
+ "#include <stdio.h>\n"
+ "#include <stdlib.h>\n"
"%s\n"
"#include \"%sparcel.h\"\n"
"#include \"callbacks.h\"\n"
- "#include \"Clownfish/VTable.h\"\n"
+ "#include \"Clownfish/VTable.h\"\n" // Needed for method_ptrs offset.
+ "#include \"Clownfish/VArray.h\"\n" // Needed for dump/load.
+ "#include \"Clownfish/Num.h\"\n" // Needed for dump/load.
"%s\n"
"\n"
"%s\n"
@@ -372,20 +413,37 @@ S_write_parcel_c(CFCBindCore *self) {
" */\n"
"%s\n"
"\n"
+ "static int bootstrap_state = 0;\n"
+ "\n"
"void\n"
- "%sbootstrap_parcel() {\n"
- " static bool bootstrapped = false;\n"
- " if (bootstrapped) { return; }\n"
+ "%sbootstrap_inheritance() {\n"
+ " if (bootstrap_state == 1) {\n"
+ " fprintf(stderr, \"Cycle in class inheritance between\"\n"
+ " \" parcels detected.\\n\");\n"
+ " abort();\n"
+ " }\n"
+ " if (bootstrap_state >= 2) { return; }\n"
+ " bootstrap_state = 1;\n"
+ "%s" // Bootstrap extended parcels.
" cfish_VTable_bootstrap(vtable_specs, %d);\n"
+ " bootstrap_state = 2;\n"
+ "}\n"
+ "\n"
+ "void\n"
+ "%sbootstrap_parcel() {\n"
+ " if (bootstrap_state >= 3) { return; }\n"
+ " %sbootstrap_inheritance();\n"
+ " bootstrap_state = 3;\n"
+ "%s" // Finish bootstrapping of all dependent parcels.
" %sinit_parcel();\n"
- " bootstrapped = true;\n"
"}\n"
"\n"
"%s\n";
char *file_content
= CFCUtil_sprintf(pattern, self->header, privacy_syms, prefix,
- includes, c_data, vt_specs, prefix, num_specs,
- prefix, self->footer);
+ includes, c_data, vt_specs, prefix, ext_bootstrap,
+ num_specs, prefix, prefix, dep_bootstrap, prefix,
+ self->footer);
// Unlink then open file.
const char *src_dest = CFCHierarchy_get_source_dest(hierarchy);
@@ -399,6 +457,8 @@ S_write_parcel_c(CFCBindCore *self) {
FREEMEM(includes);
FREEMEM(c_data);
FREEMEM(vt_specs);
+ FREEMEM(ext_bootstrap);
+ FREEMEM(dep_bootstrap);
FREEMEM(file_content);
}
@@ -409,7 +469,6 @@ void
CFCBindCore_write_callbacks_h(CFCBindCore *self) {
CFCHierarchy *hierarchy = self->hierarchy;
CFCClass **ordered = CFCHierarchy_ordered_classes(hierarchy);
- CFCParcel *parcel = NULL;
char *includes = CFCUtil_strdup("");
char *all_cb_decs = CFCUtil_strdup("");
@@ -426,22 +485,11 @@ CFCBindCore_write_callbacks_h(CFCBindCore *self) {
all_cb_decs = CFCUtil_cat(all_cb_decs, cb_decs, NULL);
FREEMEM(cb_decs);
CFCBase_decref((CFCBase*)class_binding);
-
- if (parcel && CFCClass_get_parcel(klass) != parcel) {
- //CFCUtil_die("Multiple parcels not yet supported.");
- }
- parcel = CFCClass_get_parcel(klass);
}
}
FREEMEM(ordered);
- if (!parcel) {
- CFCUtil_die("No source classes found.");
- }
- //const char *prefix = CFCParcel_get_prefix(parcel);
- const char *prefix = "lucy_";
-
const char pattern[] =
"%s\n"
"#ifndef CFCCALLBACKS_H\n"
@@ -451,7 +499,6 @@ CFCBindCore_write_callbacks_h(CFCBindCore *self) {
"extern \"C\" {\n"
"#endif\n"
"\n"
- "#include \"%sparcel.h\"\n"
"%s"
"\n"
"%s"
@@ -465,7 +512,7 @@ CFCBindCore_write_callbacks_h(CFCBindCore *self) {
"%s\n"
"\n";
char *file_content
- = CFCUtil_sprintf(pattern, self->header, prefix, includes, all_cb_decs,
+ = CFCUtil_sprintf(pattern, self->header, includes, all_cb_decs,
self->footer);
// Unlink then write file.
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/src/CFCParcel.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.c b/clownfish/compiler/src/CFCParcel.c
index 7387524..2618162 100644
--- a/clownfish/compiler/src/CFCParcel.c
+++ b/clownfish/compiler/src/CFCParcel.c
@@ -37,6 +37,7 @@ struct CFCParcel {
char *prefix;
char *Prefix;
char *PREFIX;
+ char *privacy_sym;
int is_included;
CFCParcel **dependent_parcels;
size_t num_dependent_parcels;
@@ -217,6 +218,15 @@ CFCParcel_init(CFCParcel *self, const char *name, const char *cnick,
self->Prefix[prefix_len] = '\0';
self->PREFIX[prefix_len] = '\0';
+ // Derive privacy symbol.
+ size_t privacy_sym_len = cnick_len + 4;
+ self->privacy_sym = (char*)MALLOCATE(privacy_sym_len + 1);
+ memcpy(self->privacy_sym, "CFP_", 4);
+ for (size_t i = 0; i < cnick_len; i++) {
+ self->privacy_sym[i+4] = toupper(self->cnick[i]);
+ }
+ self->privacy_sym[privacy_sym_len] = '\0';
+
// Set is_included.
self->is_included = is_included;
@@ -314,6 +324,7 @@ CFCParcel_destroy(CFCParcel *self) {
FREEMEM(self->prefix);
FREEMEM(self->Prefix);
FREEMEM(self->PREFIX);
+ FREEMEM(self->privacy_sym);
for (size_t i = 0; self->dependent_parcels[i]; ++i) {
CFCBase_decref((CFCBase*)self->dependent_parcels[i]);
}
@@ -374,6 +385,11 @@ CFCParcel_get_PREFIX(CFCParcel *self) {
return self->PREFIX;
}
+const char*
+CFCParcel_get_privacy_sym(CFCParcel *self) {
+ return self->privacy_sym;
+}
+
int
CFCParcel_included(CFCParcel *self) {
return self->is_included;
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/src/CFCParcel.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.h b/clownfish/compiler/src/CFCParcel.h
index f8a58d2..fe7498a 100644
--- a/clownfish/compiler/src/CFCParcel.h
+++ b/clownfish/compiler/src/CFCParcel.h
@@ -110,6 +110,11 @@ CFCParcel_get_Prefix(CFCParcel *self);
const char*
CFCParcel_get_PREFIX(CFCParcel *self);
+/* Return the Parcel's privacy symbol.
+ */
+const char*
+CFCParcel_get_privacy_sym(CFCParcel *self);
+
/** Return true if the parcel is from an include directory.
*/
int
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index 7263632..37f8b19 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -36,19 +36,13 @@
struct CFCPerl {
CFCBase base;
- CFCParcel *parcel;
CFCHierarchy *hierarchy;
char *lib_dir;
char *boot_class;
char *header;
char *footer;
char *xs_path;
- char *boot_h_file;
- char *boot_c_file;
- char *boot_h_path;
- char *boot_c_path;
char *boot_func;
- char *parcel_h_file;
};
// Modify a string in place, swapping out "::" for the supplied character.
@@ -65,24 +59,20 @@ static const CFCMeta CFCPERL_META = {
};
CFCPerl*
-CFCPerl_new(CFCParcel *parcel, CFCHierarchy *hierarchy, const char *lib_dir,
+CFCPerl_new(CFCHierarchy *hierarchy, const char *lib_dir,
const char *boot_class, const char *header, const char *footer) {
CFCPerl *self = (CFCPerl*)CFCBase_allocate(&CFCPERL_META);
- return CFCPerl_init(self, parcel, hierarchy, lib_dir, boot_class, header,
- footer);
+ return CFCPerl_init(self, hierarchy, lib_dir, boot_class, header, footer);
}
CFCPerl*
-CFCPerl_init(CFCPerl *self, CFCParcel *parcel, CFCHierarchy *hierarchy,
- const char *lib_dir, const char *boot_class, const char *header,
- const char *footer) {
- CFCUTIL_NULL_CHECK(parcel);
+CFCPerl_init(CFCPerl *self, CFCHierarchy *hierarchy, const char *lib_dir,
+ const char *boot_class, const char *header, const char *footer) {
CFCUTIL_NULL_CHECK(hierarchy);
CFCUTIL_NULL_CHECK(lib_dir);
CFCUTIL_NULL_CHECK(boot_class);
CFCUTIL_NULL_CHECK(header);
CFCUTIL_NULL_CHECK(footer);
- self->parcel = (CFCParcel*)CFCBase_incref((CFCBase*)parcel);
self->hierarchy = (CFCHierarchy*)CFCBase_incref((CFCBase*)hierarchy);
self->lib_dir = CFCUtil_strdup(lib_dir);
self->boot_class = CFCUtil_strdup(boot_class);
@@ -94,47 +84,26 @@ CFCPerl_init(CFCPerl *self, CFCParcel *parcel, CFCHierarchy *hierarchy,
boot_class);
S_replace_double_colons(self->xs_path, CHY_DIR_SEP_CHAR);
- // Derive the name of the files containing bootstrapping code.
- const char *prefix = CFCParcel_get_prefix(parcel);
- const char *inc_dest = CFCHierarchy_get_include_dest(hierarchy);
- const char *src_dest = CFCHierarchy_get_source_dest(hierarchy);
- self->boot_h_file = CFCUtil_sprintf("%sboot.h", prefix);
- self->boot_c_file = CFCUtil_sprintf("%sboot.c", prefix);
- self->boot_h_path = CFCUtil_sprintf("%s" CHY_DIR_SEP "%s", inc_dest,
- self->boot_h_file);
- self->boot_c_path = CFCUtil_sprintf("%s" CHY_DIR_SEP "%s", src_dest,
- self->boot_c_file);
-
// Derive the name of the bootstrap function.
- self->boot_func = CFCUtil_sprintf("%s%s_bootstrap", prefix, boot_class);
+ self->boot_func = CFCUtil_sprintf("cfish_%s_bootstrap", boot_class);
for (int i = 0; self->boot_func[i] != 0; i++) {
if (!isalnum(self->boot_func[i])) {
self->boot_func[i] = '_';
}
}
- // Derive the name of the "parcel.h" file.
- //self->parcel_h_file = CFCUtil_sprintf("%sparcel.h", prefix);
- self->parcel_h_file = CFCUtil_sprintf("%sparcel.h", "lucy_");
-
return self;
}
void
CFCPerl_destroy(CFCPerl *self) {
- CFCBase_decref((CFCBase*)self->parcel);
CFCBase_decref((CFCBase*)self->hierarchy);
FREEMEM(self->lib_dir);
FREEMEM(self->boot_class);
FREEMEM(self->header);
FREEMEM(self->footer);
FREEMEM(self->xs_path);
- FREEMEM(self->boot_h_file);
- FREEMEM(self->boot_c_file);
- FREEMEM(self->boot_h_path);
- FREEMEM(self->boot_c_path);
FREEMEM(self->boot_func);
- FREEMEM(self->parcel_h_file);
CFCBase_destroy((CFCBase*)self);
}
@@ -221,7 +190,11 @@ S_write_boot_h(CFCPerl *self) {
char *content
= CFCUtil_sprintf(pattern, self->header, guard, guard, self->boot_func,
guard, self->footer);
- CFCUtil_write_file(self->boot_h_path, content, strlen(content));
+
+ const char *inc_dest = CFCHierarchy_get_include_dest(self->hierarchy);
+ char *boot_h_path = CFCUtil_sprintf("%s" CHY_DIR_SEP "boot.h", inc_dest);
+ CFCUtil_write_file(boot_h_path, content, strlen(content));
+ FREEMEM(boot_h_path);
FREEMEM(content);
FREEMEM(guard);
@@ -229,11 +202,18 @@ S_write_boot_h(CFCPerl *self) {
static void
S_write_boot_c(CFCPerl *self) {
- CFCClass **ordered = CFCHierarchy_ordered_classes(self->hierarchy);
- char *pound_includes = CFCUtil_strdup("");
- char *alias_adds = CFCUtil_strdup("");
- char *isa_pushes = CFCUtil_strdup("");
- const char *prefix = CFCParcel_get_prefix(self->parcel);
+ CFCClass **ordered = CFCHierarchy_ordered_classes(self->hierarchy);
+ CFCParcel **parcels = CFCParcel_source_parcels();
+ char *pound_includes = CFCUtil_strdup("");
+ char *bootstrap_code = CFCUtil_strdup("");
+ char *alias_adds = CFCUtil_strdup("");
+ char *isa_pushes = CFCUtil_strdup("");
+
+ for (size_t i = 0; parcels[i]; ++i) {
+ const char *prefix = CFCParcel_get_prefix(parcels[i]);
+ bootstrap_code = CFCUtil_cat(bootstrap_code, " ", prefix,
+ "bootstrap_parcel();\n", NULL);
+ }
for (size_t i = 0; ordered[i] != NULL; i++) {
CFCClass *klass = ordered[i];
@@ -284,18 +264,18 @@ S_write_boot_c(CFCPerl *self) {
const char pattern[] =
"%s\n"
"\n"
- "#include \"%s\"\n"
+ "#include \"cfish_parcel.h\"\n"
"#include \"EXTERN.h\"\n"
"#include \"perl.h\"\n"
"#include \"XSUB.h\"\n"
- "#include \"%s\"\n"
+ "#include \"boot.h\"\n"
"#include \"Clownfish/CharBuf.h\"\n"
"#include \"Clownfish/VTable.h\"\n"
"%s\n"
"\n"
"void\n"
"%s() {\n"
- " %sbootstrap_parcel();\n"
+ "%s"
"\n"
" cfish_ZombieCharBuf *alias = CFISH_ZCB_WRAP_STR(\"\", 0);\n"
"%s"
@@ -307,15 +287,21 @@ S_write_boot_c(CFCPerl *self) {
"%s\n"
"\n";
char *content
- = CFCUtil_sprintf(pattern, self->header, self->parcel_h_file,
- self->boot_h_file, pound_includes, self->boot_func,
- prefix, alias_adds, isa_pushes, self->footer);
- CFCUtil_write_file(self->boot_c_path, content, strlen(content));
+ = CFCUtil_sprintf(pattern, self->header, pound_includes,
+ self->boot_func, bootstrap_code, alias_adds,
+ isa_pushes, self->footer);
+
+ const char *src_dest = CFCHierarchy_get_source_dest(self->hierarchy);
+ char *boot_c_path = CFCUtil_sprintf("%s" CHY_DIR_SEP "boot.c", src_dest);
+ CFCUtil_write_file(boot_c_path, content, strlen(content));
+ FREEMEM(boot_c_path);
FREEMEM(content);
FREEMEM(isa_pushes);
FREEMEM(alias_adds);
+ FREEMEM(bootstrap_code);
FREEMEM(pound_includes);
+ FREEMEM(parcels);
FREEMEM(ordered);
}
@@ -366,8 +352,7 @@ S_xs_file_contents(CFCPerl *self, const char *generated_xs,
"%s"
"\n"
"#include \"XSBind.h\"\n"
- "#include \"%s\"\n"
- "#include \"%s\"\n"
+ "#include \"boot.h\"\n"
"\n"
"#include \"Clownfish/Util/Memory.h\"\n"
"#include \"Clownfish/Util/StringHelper.h\"\n"
@@ -389,10 +374,9 @@ S_xs_file_contents(CFCPerl *self, const char *generated_xs,
"\n"
"%s";
char *contents
- = CFCUtil_sprintf(pattern, self->header, self->parcel_h_file,
- self->boot_h_file, generated_xs, self->boot_class,
- self->boot_class, xs_init, hand_rolled_xs,
- self->footer);
+ = CFCUtil_sprintf(pattern, self->header, generated_xs,
+ self->boot_class, self->boot_class, xs_init,
+ hand_rolled_xs, self->footer);
return contents;
}
@@ -504,7 +488,6 @@ S_write_callbacks_c(CFCPerl *self) {
"\n"
"#include \"XSBind.h\"\n"
"#include \"callbacks.h\"\n"
- "#include \"%s\"\n"
"\n"
"static void\n"
"S_finish_callback_void(const char *meth_name) {\n"
@@ -577,8 +560,7 @@ S_write_callbacks_c(CFCPerl *self) {
" return retval;\n"
"}\n"
"\n";
- char *content
- = CFCUtil_sprintf(pattern, self->header, self->parcel_h_file);
+ char *content = CFCUtil_sprintf(pattern, self->header);
for (size_t i = 0; ordered[i] != NULL; i++) {
CFCClass *klass = ordered[i];
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/clownfish/compiler/src/CFCPerl.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.h b/clownfish/compiler/src/CFCPerl.h
index 04f0c53..eef10ac 100644
--- a/clownfish/compiler/src/CFCPerl.h
+++ b/clownfish/compiler/src/CFCPerl.h
@@ -67,14 +67,13 @@ struct CFCHierarchy;
* typically copyright information.
*/
CFCPerl*
-CFCPerl_new(struct CFCParcel *parcel, struct CFCHierarchy *hierarchy,
- const char *lib_dir, const char *boot_class, const char *header,
- const char *footer);
+CFCPerl_new(struct CFCHierarchy *hierarchy, const char *lib_dir,
+ const char *boot_class, const char *header, const char *footer);
CFCPerl*
-CFCPerl_init(CFCPerl *self, struct CFCParcel *parcel,
- struct CFCHierarchy *hierarchy, const char *lib_dir,
- const char *boot_class, const char *header, const char *footer);
+CFCPerl_init(CFCPerl *self, struct CFCHierarchy *hierarchy,
+ const char *lib_dir, const char *boot_class, const char *header,
+ const char *footer);
void
CFCPerl_destroy(CFCPerl *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 99740a8..21cc5b3 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -6802,6 +6802,7 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
chaz_CFlags_add_define(extra_cflags, "HAS_BOOL", NULL);
}
+ chaz_CFlags_add_define(extra_cflags, "CFP_CFISH", NULL);
chaz_CFlags_add_define(extra_cflags, "CFP_LUCY", NULL);
}
@@ -6954,6 +6955,10 @@ S_write_makefile(struct chaz_CLIArgs *args) {
free(scratch);
scratch = chaz_Util_join("", "autogen", dir_sep, "source", dir_sep,
+ "cfish_parcel", obj_ext, NULL);
+ chaz_MakeVar_append(var, scratch);
+ free(scratch);
+ scratch = chaz_Util_join("", "autogen", dir_sep, "source", dir_sep,
"lucy_parcel", obj_ext, NULL);
chaz_MakeVar_append(var, scratch);
free(scratch);
@@ -6993,6 +6998,10 @@ S_write_makefile(struct chaz_CLIArgs *args) {
free(scratch);
/* Needed for parallel builds. */
+ scratch = chaz_Util_join(dir_sep, "autogen", "source", "cfish_parcel.c",
+ NULL);
+ rule = chaz_MakeFile_add_rule(makefile, scratch, "autogen");
+ free(scratch);
scratch = chaz_Util_join(dir_sep, "autogen", "source", "lucy_parcel.c",
NULL);
rule = chaz_MakeFile_add_rule(makefile, scratch, "autogen");
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 99a28c3..d7236fb 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -90,6 +90,7 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
chaz_CFlags_add_define(extra_cflags, "HAS_BOOL", NULL);
}
+ chaz_CFlags_add_define(extra_cflags, "CFP_CFISH", NULL);
chaz_CFlags_add_define(extra_cflags, "CFP_LUCY", NULL);
}
@@ -242,6 +243,10 @@ S_write_makefile(struct chaz_CLIArgs *args) {
free(scratch);
scratch = chaz_Util_join("", "autogen", dir_sep, "source", dir_sep,
+ "cfish_parcel", obj_ext, NULL);
+ chaz_MakeVar_append(var, scratch);
+ free(scratch);
+ scratch = chaz_Util_join("", "autogen", dir_sep, "source", dir_sep,
"lucy_parcel", obj_ext, NULL);
chaz_MakeVar_append(var, scratch);
free(scratch);
@@ -281,6 +286,10 @@ S_write_makefile(struct chaz_CLIArgs *args) {
free(scratch);
/* Needed for parallel builds. */
+ scratch = chaz_Util_join(dir_sep, "autogen", "source", "cfish_parcel.c",
+ NULL);
+ rule = chaz_MakeFile_add_rule(makefile, scratch, "autogen");
+ free(scratch);
scratch = chaz_Util_join(dir_sep, "autogen", "source", "lucy_parcel.c",
NULL);
rule = chaz_MakeFile_add_rule(makefile, scratch, "autogen");
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/core/Clownfish.c
----------------------------------------------------------------------
diff --git a/core/Clownfish.c b/core/Clownfish.c
new file mode 100644
index 0000000..130b87a
--- /dev/null
+++ b/core/Clownfish.c
@@ -0,0 +1,27 @@
+/* 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.
+ */
+
+#include "Clownfish/Num.h"
+#include "Clownfish/Hash.h"
+#include "Clownfish/Err.h"
+
+void
+cfish_init_parcel() {
+ cfish_Bool_init_class();
+ cfish_Hash_init_class();
+ cfish_Err_init_class();
+}
+
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/core/Lucy.c
----------------------------------------------------------------------
diff --git a/core/Lucy.c b/core/Lucy.c
index ebd0c0b..4bbfad5 100644
--- a/core/Lucy.c
+++ b/core/Lucy.c
@@ -14,14 +14,7 @@
* limitations under the License.
*/
-#include "Clownfish/Num.h"
-#include "Clownfish/Hash.h"
-#include "Clownfish/Err.h"
-
void
lucy_init_parcel() {
- cfish_Bool_init_class();
- cfish_Hash_init_class();
- cfish_Err_init_class();
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/perl/Build.PL
----------------------------------------------------------------------
diff --git a/perl/Build.PL b/perl/Build.PL
index db8a3d9..ce003dc 100644
--- a/perl/Build.PL
+++ b/perl/Build.PL
@@ -68,7 +68,7 @@ my $builder = Lucy::Build->new(
$UTF8PROC_SRC_DIR,
],
},
- extra_compiler_flags => '-DCFP_LUCY',
+ extra_compiler_flags => '-DCFP_CFISH -DCFP_LUCY',
add_to_cleanup => [
qw(
Lucy-*
http://git-wip-us.apache.org/repos/asf/lucy/blob/7c0ae1f7/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index 0e25807..c1377e0 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -32,7 +32,7 @@ sub bind_lucy {
MODULE = Lucy PACKAGE = Lucy
BOOT:
- lucy_Lucy_bootstrap();
+ cfish_Lucy_bootstrap();
IV
_dummy_function()
[lucy-commits] [6/9] git commit: refs/heads/separate-clownfish-wip1 - Move Clownfish
classes to parcel Clownfish
Posted by nw...@apache.org.
Move Clownfish classes to parcel Clownfish
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/fa758f42
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/fa758f42
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/fa758f42
Branch: refs/heads/separate-clownfish-wip1
Commit: fa758f4206096019292cc03b1780b1c027a10805
Parents: c33d5cb
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 20 16:54:45 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 17:19:40 2013 +0200
----------------------------------------------------------------------
c/src/Clownfish/Err.c | 1 +
c/src/Clownfish/LockFreeRegistry.c | 3 +-
c/src/Clownfish/Obj.c | 3 +-
c/src/Clownfish/VTable.c | 5 +-
c/src/Lucy/Analysis/RegexTokenizer.c | 1 +
c/src/Lucy/Document/Doc.c | 1 +
c/src/Lucy/Index/DocReader.c | 1 +
c/src/Lucy/Index/Inverter.c | 1 +
clownfish/compiler/src/CFCBindAliases.c | 229 ---------------
clownfish/compiler/src/CFCBindClass.c | 9 +-
clownfish/compiler/src/CFCBindCore.c | 20 +-
clownfish/compiler/src/CFCDumpable.c | 14 +-
clownfish/compiler/src/CFCPerl.c | 3 +-
clownfish/compiler/src/CFCPerlSub.c | 4 +-
clownfish/compiler/src/CFCPerlTypeMap.c | 30 +--
clownfish/runtime/core/Clownfish/ByteBuf.c | 5 +-
clownfish/runtime/core/Clownfish/CharBuf.c | 7 +-
clownfish/runtime/core/Clownfish/Err.c | 7 +-
clownfish/runtime/core/Clownfish/Hash.c | 5 +-
.../runtime/core/Clownfish/LockFreeRegistry.c | 3 +-
clownfish/runtime/core/Clownfish/Method.c | 3 +-
clownfish/runtime/core/Clownfish/Num.c | 19 +-
clownfish/runtime/core/Clownfish/Obj.c | 5 +-
clownfish/runtime/core/Clownfish/Test.c | 3 +-
.../runtime/core/Clownfish/Test/TestByteBuf.c | 1 +
.../runtime/core/Clownfish/Test/TestCharBuf.c | 1 +
clownfish/runtime/core/Clownfish/Test/TestErr.c | 1 +
clownfish/runtime/core/Clownfish/Test/TestHash.c | 1 +
.../core/Clownfish/Test/TestLockFreeRegistry.c | 1 +
clownfish/runtime/core/Clownfish/Test/TestNum.c | 1 +
clownfish/runtime/core/Clownfish/Test/TestObj.c | 1 +
clownfish/runtime/core/Clownfish/Test/TestUtils.c | 1 +
clownfish/runtime/core/Clownfish/Test/TestVArray.c | 1 +
.../runtime/core/Clownfish/Test/Util/TestAtomic.c | 1 +
.../runtime/core/Clownfish/Test/Util/TestMemory.c | 1 +
.../core/Clownfish/Test/Util/TestNumberUtils.c | 1 +
.../core/Clownfish/Test/Util/TestStringHelper.c | 1 +
clownfish/runtime/core/Clownfish/Util/Atomic.c | 3 +-
clownfish/runtime/core/Clownfish/Util/Memory.c | 3 +-
.../runtime/core/Clownfish/Util/NumberUtils.c | 3 +-
clownfish/runtime/core/Clownfish/Util/SortUtils.c | 3 +-
.../runtime/core/Clownfish/Util/StringHelper.c | 3 +-
clownfish/runtime/core/Clownfish/VArray.c | 3 +-
clownfish/runtime/core/Clownfish/VTable.c | 9 +-
clownfish/runtime/perl/xs/XSBind.c | 6 +-
core/Clownfish.cfp | 5 +
core/Clownfish/ByteBuf.c | 5 +-
core/Clownfish/ByteBuf.cfh | 2 +-
core/Clownfish/CharBuf.c | 7 +-
core/Clownfish/CharBuf.cfh | 2 +-
core/Clownfish/Err.c | 7 +-
core/Clownfish/Err.cfh | 2 +-
core/Clownfish/Hash.c | 5 +-
core/Clownfish/Hash.cfh | 2 +-
core/Clownfish/LockFreeRegistry.c | 3 +-
core/Clownfish/LockFreeRegistry.cfh | 2 +-
core/Clownfish/Method.c | 3 +-
core/Clownfish/Method.cfh | 2 +-
core/Clownfish/Num.c | 19 +-
core/Clownfish/Num.cfh | 2 +-
core/Clownfish/Obj.c | 5 +-
core/Clownfish/Obj.cfh | 2 +-
core/Clownfish/Test/TestBatch.c | 3 +-
core/Clownfish/Test/TestBatch.cfh | 2 +-
core/Clownfish/Test/TestFormatter.c | 3 +-
core/Clownfish/Test/TestFormatter.cfh | 2 +-
core/Clownfish/Test/TestRunner.c | 3 +-
core/Clownfish/Test/TestRunner.cfh | 2 +-
core/Clownfish/Util/Atomic.c | 3 +-
core/Clownfish/Util/Atomic.cfh | 2 +-
core/Clownfish/Util/Memory.c | 3 +-
core/Clownfish/Util/Memory.cfh | 2 +-
core/Clownfish/Util/NumberUtils.c | 3 +-
core/Clownfish/Util/NumberUtils.cfh | 2 +-
core/Clownfish/Util/SortUtils.c | 3 +-
core/Clownfish/Util/SortUtils.cfh | 2 +-
core/Clownfish/Util/StringHelper.c | 3 +-
core/Clownfish/Util/StringHelper.cfh | 2 +-
core/Clownfish/VArray.c | 3 +-
core/Clownfish/VArray.cfh | 2 +-
core/Clownfish/VTable.c | 9 +-
core/Clownfish/VTable.cfh | 2 +-
core/Lucy.c | 6 +-
core/Lucy/Search/Matcher.c | 1 +
core/Lucy/Search/QueryParser.c | 2 +-
core/Lucy/Util/Debug.c | 1 +
core/Lucy/Util/ToolSet.h | 1 +
example-lang/src/Lucy/Object/LockFreeRegistry.c | 2 +-
example-lang/src/Lucy/Object/Obj.c | 2 +-
example-lang/src/Lucy/Object/VTable.c | 4 +-
perl/buildlib/Lucy/Build/Binding/Object.pm | 20 +-
perl/buildlib/Lucy/Build/Binding/Util.pm | 2 +-
perl/xs/XSBind.c | 6 +-
ruby/src/Lucy/Object/LockFreeRegistry.c | 2 +-
ruby/src/Lucy/Object/Obj.c | 2 +-
ruby/src/Lucy/Object/VTable.c | 4 +-
96 files changed, 213 insertions(+), 401 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/Err.c b/c/src/Clownfish/Err.c
index 2adb533..a932ee2 100644
--- a/c/src/Clownfish/Err.c
+++ b/c/src/Clownfish/Err.c
@@ -15,6 +15,7 @@
*/
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include <setjmp.h>
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Clownfish/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/LockFreeRegistry.c b/c/src/Clownfish/LockFreeRegistry.c
index 92c121c..83683c3 100644
--- a/c/src/Clownfish/LockFreeRegistry.c
+++ b/c/src/Clownfish/LockFreeRegistry.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_LOCKFREEREGISTRY
+#define C_CFISH_LOCKFREEREGISTRY
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Clownfish/LockFreeRegistry.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/Obj.c b/c/src/Clownfish/Obj.c
index cf344b1..b27f632 100644
--- a/c/src/Clownfish/Obj.c
+++ b/c/src/Clownfish/Obj.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
+#define C_CFISH_OBJ
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Clownfish/Obj.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/VTable.c b/c/src/Clownfish/VTable.c
index 09fce4e..22dc34e 100644
--- a/c/src/Clownfish/VTable.c
+++ b/c/src/Clownfish/VTable.c
@@ -15,9 +15,10 @@
*/
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
#include "Clownfish/VTable.h"
#include "Clownfish/CharBuf.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index d2d3bbb..e2e5277 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -16,6 +16,7 @@
#define C_LUCY_REGEXTOKENIZER
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "charmony.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Document/Doc.c b/c/src/Lucy/Document/Doc.c
index 8b44af2..92d33f3 100644
--- a/c/src/Lucy/Document/Doc.c
+++ b/c/src/Lucy/Document/Doc.c
@@ -16,6 +16,7 @@
#define C_LUCY_DOC
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Lucy/Document/Doc.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index e06e7ee..79fcd4f 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -17,6 +17,7 @@
#define C_LUCY_DOCREADER
#define C_LUCY_DEFAULTDOCREADER
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Lucy/Index/DocReader.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/c/src/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c
index cfaafcd..0700075 100644
--- a/c/src/Lucy/Index/Inverter.c
+++ b/c/src/Lucy/Index/Inverter.c
@@ -17,6 +17,7 @@
#define C_LUCY_INVERTER
#define C_LUCY_INVERTERENTRY
#define CHY_USE_SHORT_NAMES
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Lucy/Index/Inverter.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/compiler/src/CFCBindAliases.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindAliases.c b/clownfish/compiler/src/CFCBindAliases.c
index c32f925..12890ad 100644
--- a/clownfish/compiler/src/CFCBindAliases.c
+++ b/clownfish/compiler/src/CFCBindAliases.c
@@ -25,235 +25,6 @@ struct alias {
struct alias aliases[] = {
{"CFISH_VISIBLE", "LUCY_VISIBLE"},
-
- {"cfish_Obj", "lucy_Obj"},
- {"CFISH_OBJ", "LUCY_OBJ"},
- {"cfish_Obj_dec_refcount", "lucy_Obj_dec_refcount"},
- {"cfish_Obj_get_refcount", "lucy_Obj_get_refcount"},
- {"cfish_Obj_inc_refcount", "lucy_Obj_inc_refcount"},
- {"cfish_Obj_to_host", "lucy_Obj_to_host"},
- {"Cfish_Obj_Dec_RefCount", "Lucy_Obj_Dec_RefCount"},
- {"Cfish_Obj_Deserialize", "Lucy_Obj_Deserialize"},
- {"Cfish_Obj_Destroy", "Lucy_Obj_Destroy"},
- {"Cfish_Obj_Destroy_OFFSET", "Lucy_Obj_Destroy_OFFSET"},
- {"Cfish_Obj_Destroy_t", "Lucy_Obj_Destroy_t"},
- {"Cfish_Obj_Dump", "Lucy_Obj_Dump"},
- {"Cfish_Obj_Get_Class_Name", "Lucy_Obj_Get_Class_Name"},
- {"Cfish_Obj_Inc_RefCount", "Lucy_Obj_Inc_RefCount"},
- {"Cfish_Obj_Is_A", "Lucy_Obj_Is_A"},
- {"Cfish_Obj_Load", "Lucy_Obj_Load"},
- {"Cfish_Obj_Load_OFFSET", "Lucy_Obj_Load_OFFSET"},
- {"Cfish_Obj_Load_t", "Lucy_Obj_Load_t"},
- {"Cfish_Obj_Serialize", "Lucy_Obj_Serialize"},
- {"Cfish_Obj_To_F64", "Lucy_Obj_To_F64"},
- {"Cfish_Obj_To_I64", "Lucy_Obj_To_I64"},
- {"Cfish_Obj_To_Bool", "Lucy_Obj_To_Bool"},
- {"Cfish_Obj_To_Host", "Lucy_Obj_To_Host"},
-
- {"cfish_ByteBuf", "lucy_ByteBuf"},
- {"CFISH_BYTEBUF", "LUCY_BYTEBUF"},
- {"cfish_BB_init", "lucy_BB_init"},
- {"Cfish_BB_Deserialize", "Lucy_BB_Deserialize"},
- {"Cfish_BB_Get_Buf", "Lucy_BB_Get_Buf"},
- {"Cfish_BB_Get_Size", "Lucy_BB_Get_Size"},
- {"Cfish_BB_Mimic_Bytes", "Lucy_BB_Mimic_Bytes"},
- {"Cfish_BB_To_Host", "Lucy_BB_To_Host"},
- {"cfish_ViewByteBuf", "lucy_ViewByteBuf"},
- {"cfish_ViewBB_new", "lucy_ViewBB_new"},
- {"Cfish_ViewBB_Assign_Bytes", "Lucy_ViewBB_Assign_Bytes"},
-
- {"cfish_CharBuf", "lucy_CharBuf"},
- {"CFISH_CHARBUF", "LUCY_CHARBUF"},
- {"cfish_CB_clone", "lucy_CB_clone"},
- {"cfish_CB_newf", "lucy_CB_newf"},
- {"cfish_CB_new_from_trusted_utf8", "lucy_CB_new_from_trusted_utf8"},
- {"cfish_CB_init", "lucy_CB_init"},
- {"Cfish_CB_Cat_Trusted_Str", "Lucy_CB_Cat_Trusted_Str"},
- {"Cfish_CB_Clone", "Lucy_CB_Clone"},
- {"Cfish_CB_Deserialize", "Lucy_CB_Deserialize"},
- {"Cfish_CB_Find_Str", "Lucy_CB_Find_Str"},
- {"Cfish_CB_Get_Ptr8", "Lucy_CB_Get_Ptr8"},
- {"Cfish_CB_Get_Size", "Lucy_CB_Get_Size"},
- {"Cfish_CB_Mimic_Str", "Lucy_CB_Mimic_Str"},
- {"Cfish_CB_Nip_One_OFFSET", "Lucy_CB_Nip_One_OFFSET"},
- {"Cfish_CB_Nip_One_t", "Lucy_CB_Nip_One_t"},
- {"Cfish_CB_To_Host", "Lucy_CB_To_Host"},
- {"cfish_ViewCharBuf", "lucy_ViewCharBuf"},
- {"CFISH_VIEWCHARBUF", "LUCY_VIEWCHARBUF"},
- {"cfish_ViewCB_new_from_trusted_utf8", "lucy_ViewCB_new_from_trusted_utf8"},
- {"Cfish_ViewCB_Assign_Str", "Lucy_ViewCB_Assign_Str"},
- {"cfish_ZombieCharBuf", "lucy_ZombieCharBuf"},
- {"CFISH_ZOMBIECHARBUF", "LUCY_ZOMBIECHARBUF"},
- {"cfish_ZCB_new", "lucy_ZCB_new"},
- {"cfish_ZCB_size", "lucy_ZCB_size"},
- {"cfish_ZCB_wrap", "lucy_ZCB_wrap"},
- {"cfish_ZCB_wrap_str", "lucy_ZCB_wrap_str"},
- {"Cfish_ZCB_Assign_Str", "Lucy_ZCB_Assign_Str"},
- {"Cfish_ZCB_Assign_Trusted_Str", "Lucy_ZCB_Assign_Trusted_Str"},
-
- {"CFISH_FLOATNUM", "LUCY_FLOATNUM"},
- {"CFISH_INTNUM", "LUCY_INTNUM"},
- {"CFISH_INTEGER32", "LUCY_INTEGER32"},
- {"CFISH_INTEGER64", "LUCY_INTEGER64"},
- {"CFISH_FLOAT32", "LUCY_FLOAT32"},
- {"CFISH_FLOAT64", "LUCY_FLOAT64"},
- {"cfish_Bool_false_singleton", "lucy_Bool_false_singleton"},
- {"cfish_Bool_true_singleton", "lucy_Bool_true_singleton"},
- {"cfish_Bool_singleton", "lucy_Bool_singleton"},
- {"Cfish_Bool_Dec_RefCount_OFFSET", "Lucy_Bool_Dec_RefCount_OFFSET"},
- {"Cfish_Bool_Dec_RefCount_t", "Lucy_Bool_Dec_RefCount_t"},
-
- {"cfish_Err", "lucy_Err"},
- {"CFISH_ERR", "LUCY_ERR"},
- {"cfish_Err_certify", "lucy_Err_certify"},
- {"cfish_Err_do_throw", "lucy_Err_do_throw"},
- {"cfish_Err_downcast", "lucy_Err_downcast"},
- {"cfish_Err_get_error", "lucy_Err_get_error"},
- {"cfish_Err_init_class", "lucy_Err_init_class"},
- {"cfish_Err_make_mess", "lucy_Err_make_mess"},
- {"cfish_Err_new", "lucy_Err_new"},
- {"cfish_Err_rethrow", "lucy_Err_rethrow"},
- {"cfish_Err_set_error", "lucy_Err_set_error"},
- {"cfish_Err_throw_at", "lucy_Err_throw_at"},
- {"cfish_Err_throw_mess", "lucy_Err_throw_mess"},
- {"cfish_Err_to_host", "lucy_Err_to_host"},
- {"cfish_Err_trap", "lucy_Err_trap"},
- {"cfish_Err_warn_at", "lucy_Err_warn_at"},
- {"cfish_Err_warn_mess", "lucy_Err_warn_mess"},
- {"Cfish_Err_Add_Frame", "Lucy_Err_Add_Frame"},
- {"Cfish_Err_Cat_Mess", "Lucy_Err_Cat_Mess"},
- {"Cfish_Err_Make_OFFSET", "Lucy_Err_Make_OFFSET"},
- {"Cfish_Err_Make_t", "Lucy_Err_Make_t"},
- {"Cfish_Err_To_Host", "Lucy_Err_To_Host"},
- {"Cfish_Err_To_Host_OFFSET", "Lucy_Err_To_Host_OFFSET"},
- {"Cfish_Err_To_Host_t", "Lucy_Err_To_Host_t"},
-
- {"cfish_Hash", "lucy_Hash"},
- {"CFISH_HASH", "LUCY_HASH"},
- {"cfish_Hash_new", "lucy_Hash_new"},
- {"cfish_Hash_fetch", "lucy_Hash_fetch"},
- {"cfish_Hash_store", "lucy_Hash_store"},
- {"Cfish_Hash_Deserialize", "Lucy_Hash_Deserialize"},
- {"Cfish_Hash_Fetch_Str", "Lucy_Hash_Fetch_Str"},
- {"Cfish_Hash_Iterate", "Lucy_Hash_Iterate"},
- {"Cfish_Hash_Next", "Lucy_Hash_Next"},
- {"Cfish_Hash_Store_Str", "Lucy_Hash_Store_Str"},
- {"Cfish_Hash_Store", "Lucy_Hash_Store"},
- {"Cfish_Hash_To_Host", "Lucy_Hash_To_Host"},
-
- {"cfish_LockFreeRegistry", "lucy_LockFreeRegistry"},
- {"CFISH_LOCKFREEREGISTRY", "LUCY_LOCKFREEREGISTRY"},
- {"cfish_LFReg_to_host", "lucy_LFReg_to_host"},
- {"Cfish_LFReg_To_Host", "Lucy_LFReg_To_Host"},
- {"Cfish_LFReg_To_Host_OFFSET", "Lucy_LFReg_To_Host_OFFSET"},
- {"Cfish_LFReg_To_Host_t", "Lucy_LFReg_To_Host_t"},
-
- {"cfish_Memory_wrapped_calloc", "lucy_Memory_wrapped_calloc"},
- {"cfish_Memory_wrapped_free", "lucy_Memory_wrapped_free"},
- {"cfish_Memory_wrapped_malloc", "lucy_Memory_wrapped_malloc"},
- {"cfish_Memory_wrapped_realloc", "lucy_Memory_wrapped_realloc"},
-
- {"cfish_Float32", "lucy_Float32"},
- {"cfish_Float32_init", "lucy_Float32_init"},
- {"Cfish_Float32_Set_Value", "Lucy_Float32_Set_Value"},
- {"cfish_Float64", "lucy_Float64"},
- {"cfish_Float64_init", "lucy_Float64_init"},
- {"Cfish_Float64_Set_Value", "Lucy_Float64_Set_Value"},
- {"cfish_Integer32", "lucy_Integer32"},
- {"Cfish_Int32_Set_Value", "Lucy_Int32_Set_Value"},
- {"cfish_Integer64", "lucy_Integer64"},
- {"Cfish_Int64_Set_Value", "Lucy_Int64_Set_Value"},
-
- {"cfish_NumUtil_decode_bigend_f32", "lucy_NumUtil_decode_bigend_f32"},
- {"cfish_NumUtil_decode_bigend_f64", "lucy_NumUtil_decode_bigend_f64"},
- {"cfish_NumUtil_decode_bigend_u16", "lucy_NumUtil_decode_bigend_u16"},
- {"cfish_NumUtil_decode_bigend_u32", "lucy_NumUtil_decode_bigend_u32"},
- {"cfish_NumUtil_decode_bigend_u64", "lucy_NumUtil_decode_bigend_u64"},
- {"cfish_NumUtil_decode_c32", "lucy_NumUtil_decode_c32"},
- {"cfish_NumUtil_decode_c64", "lucy_NumUtil_decode_c64"},
- {"cfish_NumUtil_encode_bigend_f32", "lucy_NumUtil_encode_bigend_f32"},
- {"cfish_NumUtil_encode_bigend_f64", "lucy_NumUtil_encode_bigend_f64"},
- {"cfish_NumUtil_encode_bigend_u16", "lucy_NumUtil_encode_bigend_u16"},
- {"cfish_NumUtil_encode_bigend_u32", "lucy_NumUtil_encode_bigend_u32"},
- {"cfish_NumUtil_encode_bigend_u64", "lucy_NumUtil_encode_bigend_u64"},
- {"cfish_NumUtil_encode_c32", "lucy_NumUtil_encode_c32"},
- {"cfish_NumUtil_encode_c64", "lucy_NumUtil_encode_c64"},
- {"cfish_NumUtil_encode_padded_c32", "lucy_NumUtil_encode_padded_c32"},
- {"cfish_NumUtil_u1clear", "lucy_NumUtil_u1clear"},
- {"cfish_NumUtil_u1flip", "lucy_NumUtil_u1flip"},
- {"cfish_NumUtil_u1get", "lucy_NumUtil_u1get"},
- {"cfish_NumUtil_u1set", "lucy_NumUtil_u1set"},
- {"cfish_NumUtil_u1masks", "lucy_NumUtil_u1masks"},
- {"cfish_NumUtil_u2get", "lucy_NumUtil_u2get"},
- {"cfish_NumUtil_u2set", "lucy_NumUtil_u2set"},
- {"cfish_NumUtil_u2masks", "lucy_NumUtil_u2masks"},
- {"cfish_NumUtil_u2shifts", "lucy_NumUtil_u2shifts"},
- {"cfish_NumUtil_u4get", "lucy_NumUtil_u4get"},
- {"cfish_NumUtil_u4set", "lucy_NumUtil_u4set"},
- {"cfish_NumUtil_u4masks", "lucy_NumUtil_u4masks"},
- {"cfish_NumUtil_u4shifts", "lucy_NumUtil_u4shifts"},
- {"cfish_NumUtil_skip_cint", "lucy_NumUtil_skip_cint"},
-
- {"cfish_StrHelp_to_base36", "lucy_StrHelp_to_base36"},
- {"cfish_StrHelp_utf8_valid", "lucy_StrHelp_utf8_valid"},
- {"cfish_StrHelp_UTF8_COUNT", "lucy_StrHelp_UTF8_COUNT"},
-
- {"cfish_TestBatch_fail", "lucy_TestBatch_fail"},
- {"cfish_TestBatch_pass", "lucy_TestBatch_pass"},
- {"cfish_TestBatch_skip", "lucy_TestBatch_skip"},
- {"cfish_TestBatch_test_false", "lucy_TestBatch_test_false"},
- {"cfish_TestBatch_test_float_equals", "lucy_TestBatch_test_float_equals"},
- {"cfish_TestBatch_test_int_equals", "lucy_TestBatch_test_int_equals"},
- {"cfish_TestBatch_test_string_equals", "lucy_TestBatch_test_string_equals"},
- {"cfish_TestBatch_test_true", "lucy_TestBatch_test_true"},
- {"cfish_TestFormatter", "lucy_TestFormatter"},
- {"cfish_TestFormatterCF", "lucy_TestFormatterCF"},
- {"cfish_TestFormatterCF_new", "lucy_TestFormatterCF_new"},
- {"cfish_TestFormatterTAP", "lucy_TestFormatterTAP"},
- {"cfish_TestFormatterTAP_new", "lucy_TestFormatterTAP_new"},
-
- {"cfish_VArray", "lucy_VArray"},
- {"CFISH_VARRAY", "LUCY_VARRAY"},
- {"cfish_VA_new", "lucy_VA_new"},
- {"cfish_VA_store", "lucy_VA_store"},
- {"Cfish_VA_Clone", "Lucy_VA_Clone"},
- {"Cfish_VA_Delete", "Lucy_VA_Delete"},
- {"Cfish_VA_Deserialize", "Lucy_VA_Deserialize"},
- {"Cfish_VA_Fetch", "Lucy_VA_Fetch"},
- {"Cfish_VA_Get_Size", "Lucy_VA_Get_Size"},
- {"Cfish_VA_Pop", "Lucy_VA_Pop"},
- {"Cfish_VA_Push", "Lucy_VA_Push"},
- {"Cfish_VA_Resize", "Lucy_VA_Resize"},
- {"Cfish_VA_Shallow_Copy", "Lucy_VA_Shallow_Copy"},
- {"Cfish_VA_Shift", "Lucy_VA_Shift"},
- {"Cfish_VA_Store", "Lucy_VA_Store"},
- {"Cfish_VA_To_Host", "Lucy_VA_To_Host"},
-
- {"cfish_VTable", "lucy_VTable"},
- {"CFISH_VTABLE", "LUCY_VTABLE"},
- {"cfish_VTable_add_alias_to_registry", "lucy_VTable_add_alias_to_registry"},
- {"cfish_VTable_bootstrap", "lucy_VTable_bootstrap"},
- {"cfish_VTable_fetch_vtable", "lucy_VTable_fetch_vtable"},
- {"cfish_VTable_find_parent_class", "lucy_VTable_find_parent_class"},
- {"cfish_VTable_foster_obj", "lucy_VTable_foster_obj"},
- {"cfish_VTable_fresh_host_methods", "lucy_VTable_fresh_host_methods"},
- {"cfish_VTable_init_obj", "lucy_VTable_init_obj"},
- {"cfish_VTable_init_registry", "lucy_VTable_init_registry"},
- {"cfish_VTable_make_obj", "lucy_VTable_make_obj"},
- {"cfish_VTable_offset_of_parent", "lucy_VTable_offset_of_parent"},
- {"cfish_VTable_register_with_host", "lucy_VTable_register_with_host"},
- {"cfish_VTable_registry", "lucy_VTable_registry"},
- {"cfish_VTable_singleton", "lucy_VTable_singleton"},
- {"cfish_VTable_to_host", "lucy_VTable_to_host"},
- {"Cfish_VTable_Foster_Obj", "Lucy_VTable_Foster_Obj"},
- {"Cfish_VTable_Get_Name", "Lucy_VTable_Get_Name"},
- {"Cfish_VTable_Make_Obj", "Lucy_VTable_Make_Obj"},
- {"Cfish_VTable_To_Host", "Lucy_VTable_To_Host"},
- {"Cfish_VTable_To_Host_OFFSET", "Lucy_VTable_To_Host_OFFSET"},
- {"Cfish_VTable_To_Host_t", "Lucy_VTable_To_Host_t"},
-
- {"CFISH_USE_SHORT_NAMES", "LUCY_USE_SHORT_NAMES"},
-
{NULL, NULL}
};
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/compiler/src/CFCBindClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindClass.c b/clownfish/compiler/src/CFCBindClass.c
index f83a5c1..6c40855 100644
--- a/clownfish/compiler/src/CFCBindClass.c
+++ b/clownfish/compiler/src/CFCBindClass.c
@@ -119,7 +119,8 @@ CFCBindClass_to_c_header(CFCBindClass *self) {
static char*
S_to_c_header_inert(CFCBindClass *self) {
- const char *prefix = CFCClass_get_prefix(self->client);
+ //const char *prefix = CFCClass_get_prefix(self->client);
+ const char *prefix = "lucy_";
char *inert_func_decs = S_sub_declarations(self);
char *inert_var_defs = S_inert_var_declarations(self);
char *short_names = S_short_names(self);
@@ -155,8 +156,10 @@ static char*
S_to_c_header_dynamic(CFCBindClass *self) {
const char *privacy_symbol = CFCClass_privacy_symbol(self->client);
const char *vt_var = CFCClass_full_vtable_var(self->client);
- const char *prefix = CFCClass_get_prefix(self->client);
- const char *PREFIX = CFCClass_get_PREFIX(self->client);
+ //const char *prefix = CFCClass_get_prefix(self->client);
+ //const char *PREFIX = CFCClass_get_PREFIX(self->client);
+ const char *prefix = "lucy_";
+ const char *PREFIX = "LUCY_";
char *struct_def = S_struct_definition(self);
char *parent_include = S_parent_include(self);
char *sub_declarations = S_sub_declarations(self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/compiler/src/CFCBindCore.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindCore.c b/clownfish/compiler/src/CFCBindCore.c
index 63bcda3..ec36cab 100644
--- a/clownfish/compiler/src/CFCBindCore.c
+++ b/clownfish/compiler/src/CFCBindCore.c
@@ -146,7 +146,7 @@ S_write_parcel_h(CFCBindCore *self) {
}
if (!CFCClass_included(klass)) {
if (parcel && CFCClass_get_parcel(klass) != parcel) {
- CFCUtil_die("Multiple parcels not yet supported.");
+ //CFCUtil_die("Multiple parcels not yet supported.");
}
parcel = CFCClass_get_parcel(klass);
}
@@ -156,8 +156,10 @@ S_write_parcel_h(CFCBindCore *self) {
if (!parcel) {
CFCUtil_die("No source classes found.");
}
- const char *prefix = CFCParcel_get_prefix(parcel);
- const char *PREFIX = CFCParcel_get_PREFIX(parcel);
+ //const char *prefix = CFCParcel_get_prefix(parcel);
+ //const char *PREFIX = CFCParcel_get_PREFIX(parcel);
+ const char *prefix = "lucy_";
+ const char *PREFIX = "LUCY_";
// Create Clownfish aliases if necessary.
char *aliases = CFCBindAliases_c_aliases();
@@ -341,7 +343,7 @@ S_write_parcel_c(CFCBindCore *self) {
privacy_syms = CFCUtil_cat(privacy_syms, "#define ",
privacy_sym, "\n", NULL);
if (parcel && CFCClass_get_parcel(klass) != parcel) {
- CFCUtil_die("Multiple parcels not yet supported.");
+ //CFCUtil_die("Multiple parcels not yet supported.");
}
parcel = CFCClass_get_parcel(klass);
}
@@ -351,12 +353,13 @@ S_write_parcel_c(CFCBindCore *self) {
if (!parcel) {
CFCUtil_die("No source classes found.");
}
- const char *prefix = CFCParcel_get_prefix(parcel);
+ //const char *prefix = CFCParcel_get_prefix(parcel);
+ const char *prefix = "lucy_";
char pattern[] =
"%s\n"
"\n"
- "#define C_LUCY_VTABLE\n"
+ "#define C_CFISH_VTABLE\n"
"%s\n"
"#include \"%sparcel.h\"\n"
"#include \"callbacks.h\"\n"
@@ -425,7 +428,7 @@ CFCBindCore_write_callbacks_h(CFCBindCore *self) {
CFCBase_decref((CFCBase*)class_binding);
if (parcel && CFCClass_get_parcel(klass) != parcel) {
- CFCUtil_die("Multiple parcels not yet supported.");
+ //CFCUtil_die("Multiple parcels not yet supported.");
}
parcel = CFCClass_get_parcel(klass);
}
@@ -436,7 +439,8 @@ CFCBindCore_write_callbacks_h(CFCBindCore *self) {
if (!parcel) {
CFCUtil_die("No source classes found.");
}
- const char *prefix = CFCParcel_get_prefix(parcel);
+ //const char *prefix = CFCParcel_get_prefix(parcel);
+ const char *prefix = "lucy_";
const char pattern[] =
"%s\n"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/compiler/src/CFCDumpable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCDumpable.c b/clownfish/compiler/src/CFCDumpable.c
index 006f62a..150b363 100644
--- a/clownfish/compiler/src/CFCDumpable.c
+++ b/clownfish/compiler/src/CFCDumpable.c
@@ -115,8 +115,8 @@ S_make_method_obj(CFCClass *klass, const char *method_name) {
const char *klass_cnick = CFCClass_get_cnick(klass);
CFCParcel *klass_parcel = CFCClass_get_parcel(klass);
- CFCType *return_type
- = CFCType_new_object(CFCTYPE_INCREMENTED, klass_parcel, "lucy_Obj", 1);
+ CFCType *return_type = CFCType_new_object(CFCTYPE_INCREMENTED,
+ klass_parcel, "cfish_Obj", 1);
CFCType *self_type = CFCType_new_object(0, klass_parcel,
klass_full_struct_sym, 1);
CFCVariable *self_var = CFCVariable_new(NULL, NULL, NULL, NULL, "self",
@@ -128,7 +128,7 @@ S_make_method_obj(CFCClass *klass, const char *method_name) {
CFCParamList_add_param(param_list, self_var, NULL);
}
else if (strcmp(method_name, "Load") == 0) {
- CFCType *dump_type = CFCType_new_object(0, klass_parcel, "lucy_Obj",
+ CFCType *dump_type = CFCType_new_object(0, klass_parcel, "cfish_Obj",
1);
CFCVariable *dump_var = CFCVariable_new(NULL, NULL, NULL, NULL, "dump",
dump_type, false);
@@ -178,7 +178,7 @@ S_add_dump_method(CFCClass *klass) {
"cfish_Obj*\n"
"%s(%s *self)\n"
"{\n"
- " %s super_dump = SUPER_METHOD_PTR(%s, %s);\n"
+ " %s super_dump = CFISH_SUPER_METHOD_PTR(%s, %s);\n"
" cfish_Hash *dump = (cfish_Hash*)super_dump(self);\n";
char *autocode
= CFCUtil_sprintf(pattern, full_func_sym, full_struct,
@@ -234,7 +234,7 @@ S_add_load_method(CFCClass *klass) {
"%s(%s *self, cfish_Obj *dump)\n"
"{\n"
" cfish_Hash *source = (cfish_Hash*)CFISH_CERTIFY(dump, CFISH_HASH);\n"
- " %s super_load = SUPER_METHOD_PTR(%s, %s);\n"
+ " %s super_load = CFISH_SUPER_METHOD_PTR(%s, %s);\n"
" %s *loaded = (%s*)super_load(self, dump);\n";
char *autocode
= CFCUtil_sprintf(pattern, full_func_sym, full_struct,
@@ -286,7 +286,7 @@ S_process_dump_member(CFCClass *klass, CFCVariable *member, char *buf,
const char *specifier = CFCType_get_specifier(type);
// Skip the VTable.
- if (strcmp(specifier, "lucy_VTable") == 0) {
+ if (strcmp(specifier, "cfish_VTable") == 0) {
return;
}
@@ -347,7 +347,7 @@ S_process_load_member(CFCClass *klass, CFCVariable *member, char *buf,
const char *specifier = CFCType_get_specifier(type);
// Skip the VTable.
- if (strcmp(specifier, "lucy_VTable") == 0) {
+ if (strcmp(specifier, "cfish_VTable") == 0) {
return;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index c7f971b..7263632 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -114,7 +114,8 @@ CFCPerl_init(CFCPerl *self, CFCParcel *parcel, CFCHierarchy *hierarchy,
}
// Derive the name of the "parcel.h" file.
- self->parcel_h_file = CFCUtil_sprintf("%sparcel.h", prefix);
+ //self->parcel_h_file = CFCUtil_sprintf("%sparcel.h", prefix);
+ self->parcel_h_file = CFCUtil_sprintf("%sparcel.h", "lucy_");
return self;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/compiler/src/CFCPerlSub.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlSub.c b/clownfish/compiler/src/CFCPerlSub.c
index af98cde..2b35ac5 100644
--- a/clownfish/compiler/src/CFCPerlSub.c
+++ b/clownfish/compiler/src/CFCPerlSub.c
@@ -147,9 +147,7 @@ S_allot_params_arg(CFCType *type, const char *label, int required) {
// Share buffers rather than copy between Perl scalars and Clownfish
// string types.
int use_sv_buffer = false;
- if (strcmp(struct_sym, "lucy_CharBuf") == 0
- || strcmp(struct_sym, "cfish_CharBuf") == 0
- || strcmp(struct_sym, "lucy_Obj") == 0
+ if (strcmp(struct_sym, "cfish_CharBuf") == 0
|| strcmp(struct_sym, "cfish_Obj") == 0
) {
use_sv_buffer = true;
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlTypeMap.c b/clownfish/compiler/src/CFCPerlTypeMap.c
index 22b0f15..08d12da 100644
--- a/clownfish/compiler/src/CFCPerlTypeMap.c
+++ b/clownfish/compiler/src/CFCPerlTypeMap.c
@@ -42,9 +42,7 @@ CFCPerlTypeMap_from_perl(CFCType *type, const char *xs_var) {
const char *struct_sym = CFCType_get_specifier(type);
const char *vtable_var = CFCType_get_vtable_var(type);
const char *allocation;
- if (strcmp(struct_sym, "lucy_CharBuf") == 0
- || strcmp(struct_sym, "cfish_CharBuf") == 0
- || strcmp(struct_sym, "lucy_Obj") == 0
+ if (strcmp(struct_sym, "cfish_CharBuf") == 0
|| strcmp(struct_sym, "cfish_Obj") == 0
) {
// Share buffers rather than copy between Perl scalars and
@@ -275,32 +273,6 @@ CFCPerlTypeMap_write_xs_typemap(CFCHierarchy *hierarchy) {
const char *full_struct_sym = CFCClass_full_struct_sym(klass);
const char *vtable_var = CFCClass_full_vtable_var(klass);
- /* Temporary hack until the Clownfish parcel is ready. */
- if (strcmp(full_struct_sym, "lucy_ByteBuf") == 0) {
- full_struct_sym = "cfish_ByteBuf";
- vtable_var = "CFISH_BYTEBUF";
- }
- else if (strcmp(full_struct_sym, "lucy_CharBuf") == 0) {
- full_struct_sym = "cfish_CharBuf";
- vtable_var = "CFISH_CHARBUF";
- }
- else if (strcmp(full_struct_sym, "lucy_Hash") == 0) {
- full_struct_sym = "cfish_Hash";
- vtable_var = "CFISH_HASH";
- }
- else if (strcmp(full_struct_sym, "lucy_Obj") == 0) {
- full_struct_sym = "cfish_Obj";
- vtable_var = "CFISH_OBJ";
- }
- else if (strcmp(full_struct_sym, "lucy_VArray") == 0) {
- full_struct_sym = "cfish_VArray";
- vtable_var = "CFISH_VARRAY";
- }
- else if (strcmp(full_struct_sym, "lucy_VTable") == 0) {
- full_struct_sym = "cfish_VTable";
- vtable_var = "CFISH_VTABLE";
- }
-
start = CFCUtil_cat(start, full_struct_sym, "*\t", vtable_var, "_\n",
NULL);
input = CFCUtil_cat(input, vtable_var, "_\n"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/ByteBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/ByteBuf.c b/clownfish/runtime/core/Clownfish/ByteBuf.c
index 1c48214..685faf1 100644
--- a/clownfish/runtime/core/Clownfish/ByteBuf.c
+++ b/clownfish/runtime/core/Clownfish/ByteBuf.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_BYTEBUF
-#define C_LUCY_VIEWBYTEBUF
+#define C_CFISH_BYTEBUF
+#define C_CFISH_VIEWBYTEBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 9953dc6..0e19c83 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_CHARBUF
-#define C_LUCY_VIEWCHARBUF
-#define C_LUCY_ZOMBIECHARBUF
+#define C_CFISH_CHARBUF
+#define C_CFISH_VIEWCHARBUF
+#define C_CFISH_ZOMBIECHARBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Err.c b/clownfish/runtime/core/Clownfish/Err.c
index ee9f930..c933137 100644
--- a/clownfish/runtime/core/Clownfish/Err.c
+++ b/clownfish/runtime/core/Clownfish/Err.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_ERR
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
+#define C_CFISH_ERR
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.c b/clownfish/runtime/core/Clownfish/Hash.c
index 1e2cd56..57c8ee5 100644
--- a/clownfish/runtime/core/Clownfish/Hash.c
+++ b/clownfish/runtime/core/Clownfish/Hash.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_HASH
-#define C_LUCY_HASHTOMBSTONE
+#define C_CFISH_HASH
+#define C_CFISH_HASHTOMBSTONE
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/LockFreeRegistry.c b/clownfish/runtime/core/Clownfish/LockFreeRegistry.c
index 519dc51..c31e118 100644
--- a/clownfish/runtime/core/Clownfish/LockFreeRegistry.c
+++ b/clownfish/runtime/core/Clownfish/LockFreeRegistry.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_LOCKFREEREGISTRY
+#define C_CFISH_LOCKFREEREGISTRY
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Method.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Method.c b/clownfish/runtime/core/Clownfish/Method.c
index 13f3abb..96979da 100644
--- a/clownfish/runtime/core/Clownfish/Method.c
+++ b/clownfish/runtime/core/Clownfish/Method.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_METHOD
+#define C_CFISH_METHOD
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Num.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Num.c b/clownfish/runtime/core/Clownfish/Num.c
index bc84c30..462ad18 100644
--- a/clownfish/runtime/core/Clownfish/Num.c
+++ b/clownfish/runtime/core/Clownfish/Num.c
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-#define C_LUCY_NUM
-#define C_LUCY_INTNUM
-#define C_LUCY_FLOATNUM
-#define C_LUCY_INTEGER32
-#define C_LUCY_INTEGER64
-#define C_LUCY_FLOAT32
-#define C_LUCY_FLOAT64
-#define C_LUCY_BOOLNUM
-#define C_LUCY_VIEWCHARBUF
+#define C_CFISH_NUM
+#define C_CFISH_INTNUM
+#define C_CFISH_FLOATNUM
+#define C_CFISH_INTEGER32
+#define C_CFISH_INTEGER64
+#define C_CFISH_FLOAT32
+#define C_CFISH_FLOAT64
+#define C_CFISH_BOOLNUM
+#define C_CFISH_VIEWCHARBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Obj.c b/clownfish/runtime/core/Clownfish/Obj.c
index bb1b3cb..c6b8712 100644
--- a/clownfish/runtime/core/Clownfish/Obj.c
+++ b/clownfish/runtime/core/Clownfish/Obj.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test.c b/clownfish/runtime/core/Clownfish/Test.c
index 14573b8..20f9c78 100644
--- a/clownfish/runtime/core/Clownfish/Test.c
+++ b/clownfish/runtime/core/Clownfish/Test.c
@@ -18,7 +18,8 @@
#include <stdlib.h>
#include <string.h>
-#define C_LUCY_TESTBATCH
+#define C_CFISH_TESTBATCH
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestByteBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestByteBuf.c b/clownfish/runtime/core/Clownfish/Test/TestByteBuf.c
index c411753..c8506b3 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestByteBuf.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestByteBuf.c
@@ -17,6 +17,7 @@
#include <string.h>
#define C_LUCY_TESTBYTEBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c b/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
index afefbea..122d0c4 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
@@ -18,6 +18,7 @@
#include <stdio.h>
#define C_LUCY_TESTCHARBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestErr.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestErr.c b/clownfish/runtime/core/Clownfish/Test/TestErr.c
index 26255a8..4ee3f06 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestErr.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestErr.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestHash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestHash.c b/clownfish/runtime/core/Clownfish/Test/TestHash.c
index 4f28765..00da68f 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestHash.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestHash.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <time.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestLockFreeRegistry.c b/clownfish/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
index 0323f61..716d4d9 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
@@ -16,6 +16,7 @@
#include <string.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestNum.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestNum.c b/clownfish/runtime/core/Clownfish/Test/TestNum.c
index f2c3252..00721ce 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestNum.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestNum.c
@@ -16,6 +16,7 @@
#define C_LUCY_TESTNUM
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestObj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestObj.c b/clownfish/runtime/core/Clownfish/Test/TestObj.c
index 4d7c76b..b2a4414 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -17,6 +17,7 @@
#include <stdio.h>
#define C_LUCY_TESTOBJ
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestUtils.c b/clownfish/runtime/core/Clownfish/Test/TestUtils.c
index 4a39702..db1000a 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestUtils.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestUtils.c
@@ -18,6 +18,7 @@
#include <stdlib.h>
#define C_LUCY_TESTUTILS
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/TestVArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestVArray.c b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
index 5d6a69d..b30d7b1 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestVArray.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
@@ -17,6 +17,7 @@
#include <string.h>
#define C_LUCY_TESTVARRAY
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/Util/TestAtomic.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestAtomic.c b/clownfish/runtime/core/Clownfish/Test/Util/TestAtomic.c
index 7d0b978..9adae1c 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestAtomic.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestAtomic.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/Util/TestMemory.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestMemory.c b/clownfish/runtime/core/Clownfish/Test/Util/TestMemory.c
index 7481b66..65c5850 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestMemory.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestMemory.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c b/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
index c662e8e..66db928 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <time.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
index be05145..08a9d72 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Util/Atomic.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/Atomic.c b/clownfish/runtime/core/Clownfish/Util/Atomic.c
index 62c43e2..e950c4b 100644
--- a/clownfish/runtime/core/Clownfish/Util/Atomic.c
+++ b/clownfish/runtime/core/Clownfish/Util/Atomic.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_ATOMIC
+#define C_CFISH_ATOMIC
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Clownfish/Util/Atomic.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Util/Memory.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/Memory.c b/clownfish/runtime/core/Clownfish/Util/Memory.c
index 0f52e98..9a36d1b 100644
--- a/clownfish/runtime/core/Clownfish/Util/Memory.c
+++ b/clownfish/runtime/core/Clownfish/Util/Memory.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_MEMORY
+#define C_CFISH_MEMORY
#include <stdlib.h>
#include <stdio.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
#include "Clownfish/Util/Memory.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Util/NumberUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/NumberUtils.c b/clownfish/runtime/core/Clownfish/Util/NumberUtils.c
index ba73cf9..12f3a23 100644
--- a/clownfish/runtime/core/Clownfish/Util/NumberUtils.c
+++ b/clownfish/runtime/core/Clownfish/Util/NumberUtils.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_NUMBERUTILS
+#define C_CFISH_NUMBERUTILS
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Util/SortUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/SortUtils.c b/clownfish/runtime/core/Clownfish/Util/SortUtils.c
index 3b17077..4efd5ef 100644
--- a/clownfish/runtime/core/Clownfish/Util/SortUtils.c
+++ b/clownfish/runtime/core/Clownfish/Util/SortUtils.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_SORTUTILS
+#define C_CFISH_SORTUTILS
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/StringHelper.c b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
index 58f278d..185b6a2 100644
--- a/clownfish/runtime/core/Clownfish/Util/StringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_STRINGHELPER
+#define C_CFISH_STRINGHELPER
#include <string.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VArray.c b/clownfish/runtime/core/Clownfish/VArray.c
index c9b6e47..cc7806a 100644
--- a/clownfish/runtime/core/Clownfish/VArray.c
+++ b/clownfish/runtime/core/Clownfish/VArray.c
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#define C_LUCY_VARRAY
+#define C_CFISH_VARRAY
#include <string.h>
#include <stdlib.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VTable.c b/clownfish/runtime/core/Clownfish/VTable.c
index 0ff58e2..c91aa03 100644
--- a/clownfish/runtime/core/Clownfish/VTable.c
+++ b/clownfish/runtime/core/Clownfish/VTable.c
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#define C_LUCY_VTABLE
-#define C_LUCY_OBJ
-#define C_LUCY_CHARBUF
-#define C_LUCY_METHOD
+#define C_CFISH_VTABLE
+#define C_CFISH_OBJ
+#define C_CFISH_CHARBUF
+#define C_CFISH_METHOD
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index 70db4da..d47c484 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
-#define C_LUCY_LOCKFREEREGISTRY
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
+#define C_CFISH_LOCKFREEREGISTRY
#define NEED_newRV_noinc
#include "XSBind.h"
#include "Clownfish/LockFreeRegistry.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish.cfp
----------------------------------------------------------------------
diff --git a/core/Clownfish.cfp b/core/Clownfish.cfp
new file mode 100644
index 0000000..ae91f8a
--- /dev/null
+++ b/core/Clownfish.cfp
@@ -0,0 +1,5 @@
+{
+ "name": "Clownfish",
+ "nickname": "Cfish",
+ "version": "v0.3.0"
+}
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/ByteBuf.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/ByteBuf.c b/core/Clownfish/ByteBuf.c
index 3bcc12d..bbd0484 100644
--- a/core/Clownfish/ByteBuf.c
+++ b/core/Clownfish/ByteBuf.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_BYTEBUF
-#define C_LUCY_VIEWBYTEBUF
+#define C_CFISH_BYTEBUF
+#define C_CFISH_VIEWBYTEBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/ByteBuf.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/ByteBuf.cfh b/core/Clownfish/ByteBuf.cfh
index 6967d08..15b28f3 100644
--- a/core/Clownfish/ByteBuf.cfh
+++ b/core/Clownfish/ByteBuf.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/**
* Growable buffer holding arbitrary bytes.
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/CharBuf.c b/core/Clownfish/CharBuf.c
index fda1646..23bf180 100644
--- a/core/Clownfish/CharBuf.c
+++ b/core/Clownfish/CharBuf.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_CHARBUF
-#define C_LUCY_VIEWCHARBUF
-#define C_LUCY_ZOMBIECHARBUF
+#define C_CFISH_CHARBUF
+#define C_CFISH_VIEWCHARBUF
+#define C_CFISH_ZOMBIECHARBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/CharBuf.cfh b/core/Clownfish/CharBuf.cfh
index 6eeca16..c1c7918 100644
--- a/core/Clownfish/CharBuf.cfh
+++ b/core/Clownfish/CharBuf.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/**
* Growable buffer holding Unicode characters.
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Err.c b/core/Clownfish/Err.c
index 0a6e979..f6d395d 100644
--- a/core/Clownfish/Err.c
+++ b/core/Clownfish/Err.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_ERR
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
+#define C_CFISH_ERR
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Err.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Err.cfh b/core/Clownfish/Err.cfh
index 80ca136..584ba14 100644
--- a/core/Clownfish/Err.cfh
+++ b/core/Clownfish/Err.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
__C__
typedef void
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Hash.c b/core/Clownfish/Hash.c
index 59c4854..b85683b 100644
--- a/core/Clownfish/Hash.c
+++ b/core/Clownfish/Hash.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_HASH
-#define C_LUCY_HASHTOMBSTONE
+#define C_CFISH_HASH
+#define C_CFISH_HASHTOMBSTONE
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Hash.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Hash.cfh b/core/Clownfish/Hash.cfh
index 787184f..5724883 100644
--- a/core/Clownfish/Hash.cfh
+++ b/core/Clownfish/Hash.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/**
* Hashtable.
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/LockFreeRegistry.c b/core/Clownfish/LockFreeRegistry.c
index 11ab071..ccf3c30 100644
--- a/core/Clownfish/LockFreeRegistry.c
+++ b/core/Clownfish/LockFreeRegistry.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_LOCKFREEREGISTRY
+#define C_CFISH_LOCKFREEREGISTRY
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/LockFreeRegistry.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/LockFreeRegistry.cfh b/core/Clownfish/LockFreeRegistry.cfh
index 18ac4bb..2a3d62a 100644
--- a/core/Clownfish/LockFreeRegistry.cfh
+++ b/core/Clownfish/LockFreeRegistry.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/** Specialized lock free hash table for storing VTables.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Method.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Method.c b/core/Clownfish/Method.c
index 8a76d2b..9d36299 100644
--- a/core/Clownfish/Method.c
+++ b/core/Clownfish/Method.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_METHOD
+#define C_CFISH_METHOD
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Method.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Method.cfh b/core/Clownfish/Method.cfh
index 17df64a..5cac0b2 100644
--- a/core/Clownfish/Method.cfh
+++ b/core/Clownfish/Method.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/** Method metadata.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Num.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Num.c b/core/Clownfish/Num.c
index e40f825..7dcc0dd 100644
--- a/core/Clownfish/Num.c
+++ b/core/Clownfish/Num.c
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-#define C_LUCY_NUM
-#define C_LUCY_INTNUM
-#define C_LUCY_FLOATNUM
-#define C_LUCY_INTEGER32
-#define C_LUCY_INTEGER64
-#define C_LUCY_FLOAT32
-#define C_LUCY_FLOAT64
-#define C_LUCY_BOOLNUM
-#define C_LUCY_VIEWCHARBUF
+#define C_CFISH_NUM
+#define C_CFISH_INTNUM
+#define C_CFISH_FLOATNUM
+#define C_CFISH_INTEGER32
+#define C_CFISH_INTEGER64
+#define C_CFISH_FLOAT32
+#define C_CFISH_FLOAT64
+#define C_CFISH_BOOLNUM
+#define C_CFISH_VIEWCHARBUF
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Num.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Num.cfh b/core/Clownfish/Num.cfh
index a684fe1..51f28e9 100644
--- a/core/Clownfish/Num.cfh
+++ b/core/Clownfish/Num.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/** Abstract base class for numbers.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Obj.c b/core/Clownfish/Obj.c
index a805910..fd943c6 100644
--- a/core/Clownfish/Obj.c
+++ b/core/Clownfish/Obj.c
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Obj.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Obj.cfh b/core/Clownfish/Obj.cfh
index a7370fb..ce4d812 100644
--- a/core/Clownfish/Obj.cfh
+++ b/core/Clownfish/Obj.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/** Base class for all objects.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Test/TestBatch.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestBatch.c b/core/Clownfish/Test/TestBatch.c
index 403c224..f77a71a 100644
--- a/core/Clownfish/Test/TestBatch.c
+++ b/core/Clownfish/Test/TestBatch.c
@@ -18,7 +18,8 @@
#include <stdio.h>
#include <string.h>
-#define C_LUCY_TESTBATCH
+#define C_CFISH_TESTBATCH
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Clownfish/Test/TestBatch.h"
#include "Clownfish/CharBuf.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Test/TestBatch.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestBatch.cfh b/core/Clownfish/Test/TestBatch.cfh
index 42b84cb..01113a0 100644
--- a/core/Clownfish/Test/TestBatch.cfh
+++ b/core/Clownfish/Test/TestBatch.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
abstract class Clownfish::Test::TestBatch inherits Clownfish::Obj {
TestFormatter *formatter;
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Test/TestFormatter.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestFormatter.c b/core/Clownfish/Test/TestFormatter.c
index 6bccc14..5a700a2 100644
--- a/core/Clownfish/Test/TestFormatter.c
+++ b/core/Clownfish/Test/TestFormatter.c
@@ -16,7 +16,8 @@
#include <stdio.h>
-#define C_LUCY_TESTFORMATTER
+#define C_CFISH_TESTFORMATTER
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Test/TestFormatter.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestFormatter.cfh b/core/Clownfish/Test/TestFormatter.cfh
index 4487b37..2ba63bf 100644
--- a/core/Clownfish/Test/TestFormatter.cfh
+++ b/core/Clownfish/Test/TestFormatter.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/**
* Abstract base class for Clownfish test formatters.
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Test/TestRunner.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestRunner.c b/core/Clownfish/Test/TestRunner.c
index 0779e5d..8091c36 100644
--- a/core/Clownfish/Test/TestRunner.c
+++ b/core/Clownfish/Test/TestRunner.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_TESTRUNNER
+#define C_CFISH_TESTRUNNER
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Test/TestRunner.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Test/TestRunner.cfh b/core/Clownfish/Test/TestRunner.cfh
index 61a951c..a59010a 100644
--- a/core/Clownfish/Test/TestRunner.cfh
+++ b/core/Clownfish/Test/TestRunner.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/**
* Run multiple test batches and collect statistics.
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/Atomic.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Atomic.c b/core/Clownfish/Util/Atomic.c
index 8bf776a..83ca2bd 100644
--- a/core/Clownfish/Util/Atomic.c
+++ b/core/Clownfish/Util/Atomic.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_ATOMIC
+#define C_CFISH_ATOMIC
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#include "Clownfish/Util/Atomic.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/Atomic.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Atomic.cfh b/core/Clownfish/Util/Atomic.cfh
index da741ce..51822f7 100644
--- a/core/Clownfish/Util/Atomic.cfh
+++ b/core/Clownfish/Util/Atomic.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/** Provide atomic memory operations.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/Memory.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Memory.c b/core/Clownfish/Util/Memory.c
index 0f52e98..9a36d1b 100644
--- a/core/Clownfish/Util/Memory.c
+++ b/core/Clownfish/Util/Memory.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_MEMORY
+#define C_CFISH_MEMORY
#include <stdlib.h>
#include <stdio.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
#include "Clownfish/Util/Memory.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/Memory.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/Memory.cfh b/core/Clownfish/Util/Memory.cfh
index e5ed310..6636972 100644
--- a/core/Clownfish/Util/Memory.cfh
+++ b/core/Clownfish/Util/Memory.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
inert class Clownfish::Util::Memory {
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/NumberUtils.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/NumberUtils.c b/core/Clownfish/Util/NumberUtils.c
index ba73cf9..12f3a23 100644
--- a/core/Clownfish/Util/NumberUtils.c
+++ b/core/Clownfish/Util/NumberUtils.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_NUMBERUTILS
+#define C_CFISH_NUMBERUTILS
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/NumberUtils.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/NumberUtils.cfh b/core/Clownfish/Util/NumberUtils.cfh
index e94b90c..c2a281e 100644
--- a/core/Clownfish/Util/NumberUtils.cfh
+++ b/core/Clownfish/Util/NumberUtils.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/** Provide various number-related utilies.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/SortUtils.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/SortUtils.c b/core/Clownfish/Util/SortUtils.c
index 18eb88d..1a97413 100644
--- a/core/Clownfish/Util/SortUtils.c
+++ b/core/Clownfish/Util/SortUtils.c
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_SORTUTILS
+#define C_CFISH_SORTUTILS
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/SortUtils.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/SortUtils.cfh b/core/Clownfish/Util/SortUtils.cfh
index 7667e81..39ac2d1 100644
--- a/core/Clownfish/Util/SortUtils.cfh
+++ b/core/Clownfish/Util/SortUtils.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
__C__
typedef int
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/StringHelper.c b/core/Clownfish/Util/StringHelper.c
index 7726f9d..764be2b 100644
--- a/core/Clownfish/Util/StringHelper.c
+++ b/core/Clownfish/Util/StringHelper.c
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#define C_LUCY_STRINGHELPER
+#define C_CFISH_STRINGHELPER
#include <string.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/Util/StringHelper.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/StringHelper.cfh b/core/Clownfish/Util/StringHelper.cfh
index 9d7f4e0..896e309 100644
--- a/core/Clownfish/Util/StringHelper.cfh
+++ b/core/Clownfish/Util/StringHelper.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
inert class Clownfish::Util::StringHelper cnick StrHelp {
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/VArray.c b/core/Clownfish/VArray.c
index 7da0d33..38aa128 100644
--- a/core/Clownfish/VArray.c
+++ b/core/Clownfish/VArray.c
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#define C_LUCY_VARRAY
+#define C_CFISH_VARRAY
#include <string.h>
#include <stdlib.h>
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/VArray.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/VArray.cfh b/core/Clownfish/VArray.cfh
index f36e31d..0ce4726 100644
--- a/core/Clownfish/VArray.cfh
+++ b/core/Clownfish/VArray.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
__C__
#include "Clownfish/Util/SortUtils.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/VTable.c b/core/Clownfish/VTable.c
index dbc5715..3bd393b 100644
--- a/core/Clownfish/VTable.c
+++ b/core/Clownfish/VTable.c
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#define C_LUCY_VTABLE
-#define C_LUCY_OBJ
-#define C_LUCY_CHARBUF
-#define C_LUCY_METHOD
+#define C_CFISH_VTABLE
+#define C_CFISH_OBJ
+#define C_CFISH_CHARBUF
+#define C_CFISH_METHOD
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Clownfish/VTable.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/VTable.cfh b/core/Clownfish/VTable.cfh
index 9f2555d..1325fd4 100644
--- a/core/Clownfish/VTable.cfh
+++ b/core/Clownfish/VTable.cfh
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-parcel Lucy;
+parcel Clownfish;
/** Virtual method dispatch table.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Lucy.c
----------------------------------------------------------------------
diff --git a/core/Lucy.c b/core/Lucy.c
index 3ed569c..ebd0c0b 100644
--- a/core/Lucy.c
+++ b/core/Lucy.c
@@ -20,8 +20,8 @@
void
lucy_init_parcel() {
- lucy_Bool_init_class();
- lucy_Hash_init_class();
- lucy_Err_init_class();
+ cfish_Bool_init_class();
+ cfish_Hash_init_class();
+ cfish_Err_init_class();
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Lucy/Search/Matcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Matcher.c b/core/Lucy/Search/Matcher.c
index 79673a3..c8ea31a 100644
--- a/core/Lucy/Search/Matcher.c
+++ b/core/Lucy/Search/Matcher.c
@@ -15,6 +15,7 @@
*/
#define C_LUCY_MATCHER
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index d6e1110..b665f73 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -15,7 +15,7 @@
*/
#define C_LUCY_QUERYPARSER
-#define C_LUCY_VIEWCHARBUF
+#define C_CFISH_VIEWCHARBUF
#include <stdlib.h>
#include <ctype.h>
#include "Lucy/Util/ToolSet.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Lucy/Util/Debug.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Debug.c b/core/Lucy/Util/Debug.c
index 773aaa9..aa88c7e 100644
--- a/core/Lucy/Util/Debug.c
+++ b/core/Lucy/Util/Debug.c
@@ -15,6 +15,7 @@
*/
#define C_LUCY_DEBUG
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/core/Lucy/Util/ToolSet.h
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/ToolSet.h b/core/Lucy/Util/ToolSet.h
index a21fb1e..6ad0ebf 100644
--- a/core/Lucy/Util/ToolSet.h
+++ b/core/Lucy/Util/ToolSet.h
@@ -28,6 +28,7 @@ extern "C" {
* header files, so that the header files remain as sparse as possible.
*/
+#define CFISH_USE_SHORT_NAMES
#define LUCY_USE_SHORT_NAMES
#define CHY_USE_SHORT_NAMES
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/example-lang/src/Lucy/Object/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/example-lang/src/Lucy/Object/LockFreeRegistry.c b/example-lang/src/Lucy/Object/LockFreeRegistry.c
index 1f208c4..5991ad3 100644
--- a/example-lang/src/Lucy/Object/LockFreeRegistry.c
+++ b/example-lang/src/Lucy/Object/LockFreeRegistry.c
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define C_LUCY_LOCKFREEREGISTRY
+#define C_CFISH_LOCKFREEREGISTRY
#include "CFBind.h"
#include "Clownfish/LockFreeRegistry.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/example-lang/src/Lucy/Object/Obj.c
----------------------------------------------------------------------
diff --git a/example-lang/src/Lucy/Object/Obj.c b/example-lang/src/Lucy/Object/Obj.c
index e529513..2e0551d 100644
--- a/example-lang/src/Lucy/Object/Obj.c
+++ b/example-lang/src/Lucy/Object/Obj.c
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
+#define C_CFISH_OBJ
#include "CFBind.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/example-lang/src/Lucy/Object/VTable.c
----------------------------------------------------------------------
diff --git a/example-lang/src/Lucy/Object/VTable.c b/example-lang/src/Lucy/Object/VTable.c
index 00c9901..3055f8d 100644
--- a/example-lang/src/Lucy/Object/VTable.c
+++ b/example-lang/src/Lucy/Object/VTable.c
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
#include "CFBind.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/perl/buildlib/Lucy/Build/Binding/Object.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Object.pm b/perl/buildlib/Lucy/Build/Binding/Object.pm
index 0ba0bb6..210db4f 100644
--- a/perl/buildlib/Lucy/Build/Binding/Object.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Object.pm
@@ -110,7 +110,7 @@ OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::ByteBuf",
);
$binding->append_xs($xs_code);
@@ -180,7 +180,7 @@ OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::CharBuf",
);
$binding->append_xs($xs_code);
@@ -228,7 +228,7 @@ OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::Err",
);
$binding->bind_constructor( alias => '_new' );
@@ -298,7 +298,7 @@ PPCODE:
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::Hash",
);
$binding->exclude_method($_) for @hand_rolled;
@@ -385,7 +385,7 @@ END_XS_CODE
sub bind_lockfreeregistry {
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::LockFreeRegistry",
);
Clownfish::CFC::Binding::Perl::Class->register($binding);
@@ -409,7 +409,7 @@ OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::Float32",
);
$binding->append_xs($float32_xs_code);
@@ -436,7 +436,7 @@ OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::Float64",
);
$binding->append_xs($float64_xs_code);
@@ -634,7 +634,7 @@ PPCODE:
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::Obj",
);
$binding->bind_method( alias => '_load', method => 'Load' );
@@ -724,7 +724,7 @@ OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::VArray",
);
$binding->exclude_method($_) for @hand_rolled;
@@ -781,7 +781,7 @@ OUTPUT: RETVAL
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::VTable",
);
$binding->exclude_method($_) for @hand_rolled;
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/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 45b9ab4..186c517 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -280,7 +280,7 @@ PPCODE:
END_XS_CODE
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
+ parcel => "Clownfish",
class_name => "Clownfish::Util::StringHelper",
);
$binding->append_xs($xs_code);
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/perl/xs/XSBind.c b/perl/xs/XSBind.c
index 8352355..092b5e9 100644
--- a/perl/xs/XSBind.c
+++ b/perl/xs/XSBind.c
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
-#define C_LUCY_LOCKFREEREGISTRY
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
+#define C_CFISH_LOCKFREEREGISTRY
#define NEED_newRV_noinc
#include "XSBind.h"
#include "Clownfish/LockFreeRegistry.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/ruby/src/Lucy/Object/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/ruby/src/Lucy/Object/LockFreeRegistry.c b/ruby/src/Lucy/Object/LockFreeRegistry.c
index 1f208c4..5991ad3 100644
--- a/ruby/src/Lucy/Object/LockFreeRegistry.c
+++ b/ruby/src/Lucy/Object/LockFreeRegistry.c
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define C_LUCY_LOCKFREEREGISTRY
+#define C_CFISH_LOCKFREEREGISTRY
#include "CFBind.h"
#include "Clownfish/LockFreeRegistry.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/ruby/src/Lucy/Object/Obj.c
----------------------------------------------------------------------
diff --git a/ruby/src/Lucy/Object/Obj.c b/ruby/src/Lucy/Object/Obj.c
index e529513..2e0551d 100644
--- a/ruby/src/Lucy/Object/Obj.c
+++ b/ruby/src/Lucy/Object/Obj.c
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
+#define C_CFISH_OBJ
#include "CFBind.h"
http://git-wip-us.apache.org/repos/asf/lucy/blob/fa758f42/ruby/src/Lucy/Object/VTable.c
----------------------------------------------------------------------
diff --git a/ruby/src/Lucy/Object/VTable.c b/ruby/src/Lucy/Object/VTable.c
index 00c9901..3055f8d 100644
--- a/ruby/src/Lucy/Object/VTable.c
+++ b/ruby/src/Lucy/Object/VTable.c
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#define C_LUCY_OBJ
-#define C_LUCY_VTABLE
+#define C_CFISH_OBJ
+#define C_CFISH_VTABLE
#include "CFBind.h"
[lucy-commits] [8/9] git commit: refs/heads/separate-clownfish-wip1 - Intra-parcel
dependencies
Posted by nw...@apache.org.
Intra-parcel dependencies
Parcels depend on other parcels if:
* A class extends a class from another parcel.
* A class uses types from another parcel.
This commit makes CFC track these dependencies.
TODO: Perl bindings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/13149c82
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/13149c82
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/13149c82
Branch: refs/heads/separate-clownfish-wip1
Commit: 13149c82a91dd4781fd0e59efb4b7b85792fb465
Parents: 041145b
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun May 26 13:09:14 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 17:19:42 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCClass.c | 5 ++
clownfish/compiler/src/CFCParcel.c | 77 +++++++++++++++++++++++++++++++
clownfish/compiler/src/CFCParcel.h | 22 +++++++++
clownfish/compiler/src/CFCType.c | 24 +++++++++-
4 files changed, 126 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/13149c82/clownfish/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.c b/clownfish/compiler/src/CFCClass.c
index 0567ca4..e2cb2cc 100644
--- a/clownfish/compiler/src/CFCClass.c
+++ b/clownfish/compiler/src/CFCClass.c
@@ -323,6 +323,11 @@ CFCClass_add_child(CFCClass *self, CFCClass *child) {
self->children[self->num_kids - 1]
= (CFCClass*)CFCBase_incref((CFCBase*)child);
self->children[self->num_kids] = NULL;
+
+ // Add parcel dependency.
+ CFCParcel *parcel = CFCClass_get_parcel(self);
+ CFCParcel *child_parcel = CFCClass_get_parcel(child);
+ CFCParcel_add_extended_parcel(child_parcel, parcel);
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/13149c82/clownfish/compiler/src/CFCParcel.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.c b/clownfish/compiler/src/CFCParcel.c
index f628f66..7387524 100644
--- a/clownfish/compiler/src/CFCParcel.c
+++ b/clownfish/compiler/src/CFCParcel.c
@@ -38,6 +38,10 @@ struct CFCParcel {
char *Prefix;
char *PREFIX;
int is_included;
+ CFCParcel **dependent_parcels;
+ size_t num_dependent_parcels;
+ CFCParcel **extended_parcels;
+ size_t num_extended_parcels;
};
static CFCParcel *default_parcel = NULL;
@@ -216,6 +220,12 @@ CFCParcel_init(CFCParcel *self, const char *name, const char *cnick,
// Set is_included.
self->is_included = is_included;
+ // Initialize dependencies.
+ self->dependent_parcels = (CFCParcel**)CALLOCATE(1, sizeof(CFCParcel*));
+ self->num_dependent_parcels = 0;
+ self->extended_parcels = (CFCParcel**)CALLOCATE(1, sizeof(CFCParcel*));
+ self->num_extended_parcels = 0;
+
return self;
}
@@ -304,6 +314,14 @@ CFCParcel_destroy(CFCParcel *self) {
FREEMEM(self->prefix);
FREEMEM(self->Prefix);
FREEMEM(self->PREFIX);
+ for (size_t i = 0; self->dependent_parcels[i]; ++i) {
+ CFCBase_decref((CFCBase*)self->dependent_parcels[i]);
+ }
+ FREEMEM(self->dependent_parcels);
+ for (size_t i = 0; self->extended_parcels[i]; ++i) {
+ CFCBase_decref((CFCBase*)self->extended_parcels[i]);
+ }
+ FREEMEM(self->extended_parcels);
CFCBase_destroy((CFCBase*)self);
}
@@ -361,6 +379,65 @@ CFCParcel_included(CFCParcel *self) {
return self->is_included;
}
+void
+CFCParcel_add_dependent_parcel(CFCParcel *self, CFCParcel *dependent) {
+ const char *prefix = CFCParcel_get_prefix(self);
+ const char *dep_prefix = CFCParcel_get_prefix(dependent);
+
+ if (strcmp(prefix, dep_prefix) == 0) { return; }
+
+ for (size_t i = 0; self->dependent_parcels[i]; ++i) {
+ const char *other_prefix
+ = CFCParcel_get_prefix(self->dependent_parcels[i]);
+ if (strcmp(other_prefix, dep_prefix) == 0) { return; }
+ }
+
+ size_t num_parcels = self->num_dependent_parcels;
+ self->dependent_parcels
+ = (CFCParcel**)REALLOCATE(self->dependent_parcels,
+ (num_parcels + 2) * sizeof(CFCParcel*));
+ self->dependent_parcels[num_parcels]
+ = (CFCParcel*)CFCBase_incref((CFCBase*)dependent);
+ self->dependent_parcels[num_parcels+1] = NULL;
+ self->num_dependent_parcels = num_parcels + 1;
+}
+
+void
+CFCParcel_add_extended_parcel(CFCParcel *self, CFCParcel *extended) {
+ const char *prefix = CFCParcel_get_prefix(self);
+ const char *ext_prefix = CFCParcel_get_prefix(extended);
+
+ if (strcmp(prefix, ext_prefix) == 0) { return; }
+
+ for (size_t i = 0; self->extended_parcels[i]; ++i) {
+ const char *other_prefix
+ = CFCParcel_get_prefix(self->extended_parcels[i]);
+ if (strcmp(other_prefix, ext_prefix) == 0) { return; }
+ }
+
+ size_t num_parcels = self->num_extended_parcels;
+ self->extended_parcels
+ = (CFCParcel**)REALLOCATE(self->extended_parcels,
+ (num_parcels + 2) * sizeof(CFCParcel*));
+ self->extended_parcels[num_parcels]
+ = (CFCParcel*)CFCBase_incref((CFCBase*)extended);
+ self->extended_parcels[num_parcels+1] = NULL;
+ self->num_extended_parcels = num_parcels + 1;
+
+ // Add to dependent parcels.
+ CFCParcel_add_dependent_parcel(self, extended);
+}
+
+CFCParcel**
+CFCParcel_dependent_parcels(CFCParcel *self) {
+ return self->dependent_parcels;
+}
+
+CFCParcel**
+CFCParcel_extended_parcels(CFCParcel *self) {
+ return self->extended_parcels;
+}
+
/*****************************************************************************
* The hack JSON parser coded up below is only meant to parse Clownfish parcel
* file content. It is limited in its capabilities because so little is legal
http://git-wip-us.apache.org/repos/asf/lucy/blob/13149c82/clownfish/compiler/src/CFCParcel.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.h b/clownfish/compiler/src/CFCParcel.h
index e77e5a8..f8a58d2 100644
--- a/clownfish/compiler/src/CFCParcel.h
+++ b/clownfish/compiler/src/CFCParcel.h
@@ -115,6 +115,28 @@ CFCParcel_get_PREFIX(CFCParcel *self);
int
CFCParcel_included(CFCParcel *self);
+/** Add another Parcel that the Parcel depends on.
+ */
+void
+CFCParcel_add_dependent_parcel(CFCParcel *self, CFCParcel *dependent);
+
+/** Add another Parcel containing superclasses that subclasses in the Parcel
+ * extend. Also adds the other Parcel to the Parcel's dependencies.
+ */
+void
+CFCParcel_add_extended_parcel(CFCParcel *self, CFCParcel *extended);
+
+/** Return a NULL-terminated array of all Parcels that the Parcel depends on.
+ */
+CFCParcel**
+CFCParcel_dependent_parcels(CFCParcel *self);
+
+/** Return a NULL-terminated array of all Parcels containing superclasses that
+ * subclasses in the Parcel extend.
+ */
+CFCParcel**
+CFCParcel_extended_parcels(CFCParcel *self);
+
#ifdef __cplusplus
}
#endif
http://git-wip-us.apache.org/repos/asf/lucy/blob/13149c82/clownfish/compiler/src/CFCType.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCType.c b/clownfish/compiler/src/CFCType.c
index 0494f93..d0b68ec 100644
--- a/clownfish/compiler/src/CFCType.c
+++ b/clownfish/compiler/src/CFCType.c
@@ -325,11 +325,11 @@ CFCType_resolve(CFCType *self, CFCClass **classes) {
return;
}
+ CFCClass *klass = NULL;
+
if (isupper(self->specifier[0])) {
// Try to find class from class list.
const char *specifier = self->specifier;
- CFCClass *klass = NULL;
-
for (size_t i = 0; classes[i]; ++i) {
CFCClass *maybe_class = classes[i];
const char *struct_sym = CFCClass_get_struct_sym(maybe_class);
@@ -356,6 +356,26 @@ CFCType_resolve(CFCType *self, CFCClass **classes) {
FREEMEM(self->specifier);
self->specifier = CFCUtil_strdup(full_specifier);
}
+ else {
+ // Try to find class from class list.
+ const char *specifier = self->specifier;
+ for (size_t i = 0; classes[i]; ++i) {
+ CFCClass *maybe_class = classes[i];
+ const char *full_struct_sym
+ = CFCClass_full_struct_sym(maybe_class);
+
+ if (strcmp(specifier, full_struct_sym) == 0) {
+ klass = maybe_class;
+ break;
+ }
+ }
+ }
+
+ // Add parcel dependency.
+ if (klass) {
+ CFCParcel *class_parcel = CFCClass_get_parcel(klass);
+ CFCParcel_add_dependent_parcel(self->parcel, class_parcel);
+ }
// Cache C representation.
char c_string[MAX_SPECIFIER_LEN + 10];
[lucy-commits] [7/9] git commit: refs/heads/separate-clownfish-wip1 - Add
is_included member to CFCParcel
Posted by nw...@apache.org.
Add is_included member to CFCParcel
Needed to tell whether a parcel is from an include directory. Also add
CFCParcel_source_parcels which list all non-included parcels from source
directories.
TODO: Fix Perl bindings
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/041145bf
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/041145bf
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/041145bf
Branch: refs/heads/separate-clownfish-wip1
Commit: 041145bf80c05415e016a67b291857a71c5da0ff
Parents: fa758f4
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon May 20 22:36:34 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun May 26 17:19:42 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/perl/lib/Clownfish/CFC.xs | 6 +-
clownfish/compiler/src/CFCHierarchy.c | 18 +++++--
clownfish/compiler/src/CFCParcel.c | 52 +++++++++++++++++----
clownfish/compiler/src/CFCParcel.h | 19 ++++++--
clownfish/compiler/src/CFCParseHeader.y | 7 ++-
clownfish/compiler/src/CFCTestClass.c | 7 ++-
clownfish/compiler/src/CFCTestParcel.c | 22 +++++++--
clownfish/compiler/src/CFCTestParser.c | 8 +++-
clownfish/compiler/src/CFCTestSymbol.c | 12 ++++-
clownfish/compiler/src/CFCTestType.c | 9 ++--
10 files changed, 123 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.xs b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
index 347ccca..6d3f4f2 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
@@ -1041,7 +1041,7 @@ _new(name_sv, cnick_sv, version)
CODE:
const char *name = SvOK(name_sv) ? SvPV_nolen(name_sv) : NULL;
const char *cnick = SvOK(cnick_sv) ? SvPV_nolen(cnick_sv) : NULL;
- CFCParcel *self = CFCParcel_new(name, cnick, version);
+ CFCParcel *self = CFCParcel_new(name, cnick, version, false);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
@@ -1050,7 +1050,7 @@ SV*
_new_from_file(path)
const char *path;
CODE:
- CFCParcel *self = CFCParcel_new_from_file(path);
+ CFCParcel *self = CFCParcel_new_from_file(path, false);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
@@ -1059,7 +1059,7 @@ SV*
_new_from_json(json)
const char *json;
CODE:
- CFCParcel *self = CFCParcel_new_from_json(json);
+ CFCParcel *self = CFCParcel_new_from_json(json, false);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCHierarchy.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCHierarchy.c b/clownfish/compiler/src/CFCHierarchy.c
index 5c5b192..f5d40eb 100644
--- a/clownfish/compiler/src/CFCHierarchy.c
+++ b/clownfish/compiler/src/CFCHierarchy.c
@@ -58,6 +58,10 @@ struct CFCHierarchy {
size_t num_classes;
};
+typedef struct CFCParseParcelFilesContext {
+ int is_included;
+} CFCParseParcelFilesContext;
+
// CFCUtil_walk() callback which parses .cfp files.
static void
S_parse_parcel_files(const char *path, void *context);
@@ -185,11 +189,14 @@ CFCHierarchy_add_include_dir(CFCHierarchy *self, const char *include_dir) {
void
CFCHierarchy_build(CFCHierarchy *self) {
+ CFCParseParcelFilesContext context;
+ context.is_included = false;
for (size_t i = 0; self->sources[i] != NULL; i++) {
- CFCUtil_walk(self->sources[i], S_parse_parcel_files, NULL);
+ CFCUtil_walk(self->sources[i], S_parse_parcel_files, &context);
}
+ context.is_included = false;
for (size_t i = 0; self->includes[i] != NULL; i++) {
- CFCUtil_walk(self->includes[i], S_parse_parcel_files, NULL);
+ CFCUtil_walk(self->includes[i], S_parse_parcel_files, &context);
}
for (size_t i = 0; self->sources[i] != NULL; i++) {
S_parse_cf_files(self, self->sources[i], 0);
@@ -207,8 +214,8 @@ CFCHierarchy_build(CFCHierarchy *self) {
}
static void
-S_parse_parcel_files(const char *path, void *context) {
- (void)context; // unused
+S_parse_parcel_files(const char *path, void *arg) {
+ CFCParseParcelFilesContext *context = (CFCParseParcelFilesContext*)arg;
// Ignore hidden files.
if (strstr(path, CHY_DIR_SEP ".") != NULL) {
@@ -218,7 +225,8 @@ S_parse_parcel_files(const char *path, void *context) {
// Parse .cfp files and register the parcels they define.
size_t path_len = strlen(path);
if (path_len > 4 && (strcmp((path + path_len - 4), ".cfp") == 0)) {
- CFCParcel *parcel = CFCParcel_new_from_file(path);
+ CFCParcel *parcel = CFCParcel_new_from_file(path,
+ context->is_included);
CFCParcel *existing = CFCParcel_fetch(CFCParcel_get_name(parcel));
if (existing) {
if (!CFCParcel_equals(parcel, existing)) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCParcel.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.c b/clownfish/compiler/src/CFCParcel.c
index 1cfe17e..f628f66 100644
--- a/clownfish/compiler/src/CFCParcel.c
+++ b/clownfish/compiler/src/CFCParcel.c
@@ -37,6 +37,7 @@ struct CFCParcel {
char *prefix;
char *Prefix;
char *PREFIX;
+ int is_included;
};
static CFCParcel *default_parcel = NULL;
@@ -105,6 +106,27 @@ CFCParcel_register(CFCParcel *self) {
registry[num_registered] = NULL;
}
+CFCParcel**
+CFCParcel_source_parcels(void) {
+ size_t size = (num_registered + 1) * sizeof(CFCParcel*);
+ CFCParcel **parcels = (CFCParcel**)MALLOCATE(size);
+ size_t n = 0;
+
+ for (size_t i = 0; registry[i]; ++i) {
+ CFCParcel *parcel = registry[i];
+ const char *prefix = CFCParcel_get_prefix(parcel);
+
+ // Skip default and included parcels.
+ if (*prefix && !CFCParcel_included(parcel)) {
+ parcels[n++] = parcel;
+ }
+ }
+
+ parcels[n] = NULL;
+
+ return parcels;
+}
+
void
CFCParcel_reap_singletons(void) {
for (size_t i = 0; i < num_registered; i++) {
@@ -133,14 +155,15 @@ static const CFCMeta CFCPARCEL_META = {
};
CFCParcel*
-CFCParcel_new(const char *name, const char *cnick, CFCVersion *version) {
+CFCParcel_new(const char *name, const char *cnick, CFCVersion *version,
+ int is_included) {
CFCParcel *self = (CFCParcel*)CFCBase_allocate(&CFCPARCEL_META);
- return CFCParcel_init(self, name, cnick, version);
+ return CFCParcel_init(self, name, cnick, version, is_included);
}
CFCParcel*
CFCParcel_init(CFCParcel *self, const char *name, const char *cnick,
- CFCVersion *version) {
+ CFCVersion *version, int is_included) {
// Validate name.
if (!name || !S_validate_name_or_cnick(name)) {
CFCUtil_die("Invalid name: '%s'", name ? name : "[NULL]");
@@ -190,11 +213,14 @@ CFCParcel_init(CFCParcel *self, const char *name, const char *cnick,
self->Prefix[prefix_len] = '\0';
self->PREFIX[prefix_len] = '\0';
+ // Set is_included.
+ self->is_included = is_included;
+
return self;
}
static CFCParcel*
-S_new_from_json(const char *json, const char *path) {
+S_new_from_json(const char *json, const char *path, int is_included) {
JSONNode *parsed = S_parse_json_for_parcel(json);
if (!parsed) {
CFCUtil_die("Invalid JSON parcel definition in '%s'", path);
@@ -235,7 +261,7 @@ S_new_from_json(const char *json, const char *path) {
if (!version) {
CFCUtil_die("Missing required key 'version' (filepath '%s')", path);
}
- CFCParcel *self = CFCParcel_new(name, nickname, version);
+ CFCParcel *self = CFCParcel_new(name, nickname, version, is_included);
CFCBase_decref((CFCBase*)version);
for (size_t i = 0, max = parsed->num_kids; i < max; i += 2) {
@@ -257,15 +283,15 @@ S_new_from_json(const char *json, const char *path) {
}
CFCParcel*
-CFCParcel_new_from_json(const char *json) {
- return S_new_from_json(json, "[NULL]");
+CFCParcel_new_from_json(const char *json, int is_included) {
+ return S_new_from_json(json, "[NULL]", is_included);
}
CFCParcel*
-CFCParcel_new_from_file(const char *path) {
+CFCParcel_new_from_file(const char *path, int is_included) {
size_t len;
char *json = CFCUtil_slurp_text(path, &len);
- CFCParcel *self = S_new_from_json(json, path);
+ CFCParcel *self = S_new_from_json(json, path, is_included);
FREEMEM(json);
return self;
}
@@ -284,7 +310,7 @@ CFCParcel_destroy(CFCParcel *self) {
CFCParcel*
CFCParcel_default_parcel(void) {
if (default_parcel == NULL) {
- default_parcel = CFCParcel_new("", "", NULL);
+ default_parcel = CFCParcel_new("", "", NULL, false);
}
return default_parcel;
}
@@ -296,6 +322,7 @@ CFCParcel_equals(CFCParcel *self, CFCParcel *other) {
if (CFCVersion_compare_to(self->version, other->version) != 0) {
return false;
}
+ if (self->is_included != other->is_included) { return false; }
return true;
}
@@ -329,6 +356,11 @@ CFCParcel_get_PREFIX(CFCParcel *self) {
return self->PREFIX;
}
+int
+CFCParcel_included(CFCParcel *self) {
+ return self->is_included;
+}
+
/*****************************************************************************
* The hack JSON parser coded up below is only meant to parse Clownfish parcel
* file content. It is limited in its capabilities because so little is legal
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCParcel.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParcel.h b/clownfish/compiler/src/CFCParcel.h
index 9ea3a4a..e77e5a8 100644
--- a/clownfish/compiler/src/CFCParcel.h
+++ b/clownfish/compiler/src/CFCParcel.h
@@ -50,6 +50,12 @@ CFCParcel_fetch(const char *name);
void
CFCParcel_register(CFCParcel *self);
+/** Return a NULL-terminated list of all registered parcels that are not
+ * included. Must be freed by the caller.
+ */
+CFCParcel**
+CFCParcel_source_parcels(void);
+
/** Decref all singletons at shutdown.
*/
void
@@ -57,17 +63,17 @@ CFCParcel_reap_singletons(void);
CFCParcel*
CFCParcel_new(const char *name, const char *cnick,
- struct CFCVersion *version);
+ struct CFCVersion *version, int is_included);
CFCParcel*
-CFCParcel_new_from_file(const char *path);
+CFCParcel_new_from_file(const char *path, int is_included);
CFCParcel*
-CFCParcel_new_from_json(const char *json);
+CFCParcel_new_from_json(const char *json, int is_included);
CFCParcel*
CFCParcel_init(CFCParcel *self, const char *name, const char *cnick,
- struct CFCVersion *version);
+ struct CFCVersion *version, int is_included);
void
CFCParcel_destroy(CFCParcel *self);
@@ -104,6 +110,11 @@ CFCParcel_get_Prefix(CFCParcel *self);
const char*
CFCParcel_get_PREFIX(CFCParcel *self);
+/** Return true if the parcel is from an include directory.
+ */
+int
+CFCParcel_included(CFCParcel *self);
+
#ifdef __cplusplus
}
#endif
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCParseHeader.y
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParseHeader.y b/clownfish/compiler/src/CFCParseHeader.y
index 9b14db5..c9f9215 100644
--- a/clownfish/compiler/src/CFCParseHeader.y
+++ b/clownfish/compiler/src/CFCParseHeader.y
@@ -315,7 +315,12 @@ parcel_definition(A) ::= PARCEL qualified_id(B) SEMICOLON.
{
A = CFCParcel_fetch(B);
if (!A) {
- A = CFCParcel_new(B, NULL, NULL);
+ CFCFileSpec *file_spec = CFCParser_get_file_spec(state);
+ int is_included = false;
+ if (file_spec) {
+ is_included = CFCFileSpec_included(file_spec);
+ }
+ A = CFCParcel_new(B, NULL, NULL, is_included);
CFCParcel_register(A);
CFCBase_decref((CFCBase*)A);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCTestClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestClass.c b/clownfish/compiler/src/CFCTestClass.c
index 9f841f9..2eb4183 100644
--- a/clownfish/compiler/src/CFCTestClass.c
+++ b/clownfish/compiler/src/CFCTestClass.c
@@ -31,6 +31,11 @@
#include "CFCUtil.h"
#include "CFCVariable.h"
+#ifndef true
+ #define true 1
+ #define false 0
+#endif
+
static void
S_run_tests(CFCTest *test);
@@ -47,7 +52,7 @@ static void
S_run_tests(CFCTest *test) {
CFCParser *parser = CFCParser_new();
- CFCParcel *neato = CFCParcel_new("Neato", NULL, NULL);
+ CFCParcel *neato = CFCParcel_new("Neato", NULL, NULL, false);
CFCFileSpec *file_spec = CFCFileSpec_new(".", "Foo/FooJr", 0);
CFCClass *thing_class
= CFCTest_parse_class(test, parser, "class Thing {}");
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCTestParcel.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestParcel.c b/clownfish/compiler/src/CFCTestParcel.c
index e468e9f..9c63f18 100644
--- a/clownfish/compiler/src/CFCTestParcel.c
+++ b/clownfish/compiler/src/CFCTestParcel.c
@@ -23,20 +23,32 @@
#include "CFCVersion.h"
#include "CFCTest.h"
+#ifndef true
+ #define true 1
+ #define false 0
+#endif
+
static void
S_run_tests(CFCTest *test);
const CFCTestBatch CFCTEST_BATCH_PARCEL = {
"Clownfish::CFC::Model::Parcel",
- 10,
+ 12,
S_run_tests
};
static void
S_run_tests(CFCTest *test) {
{
- CFCParcel *parcel = CFCParcel_new("Foo", NULL, NULL);
+ CFCParcel *parcel = CFCParcel_new("Foo", NULL, NULL, false);
OK(test, parcel != NULL, "new");
+ OK(test, !CFCParcel_included(parcel), "not included");
+ CFCBase_decref((CFCBase*)parcel);
+ }
+
+ {
+ CFCParcel *parcel = CFCParcel_new("Foo", NULL, NULL, true);
+ OK(test, CFCParcel_included(parcel), "included");
CFCBase_decref((CFCBase*)parcel);
}
@@ -47,14 +59,14 @@ S_run_tests(CFCTest *test) {
" \"nickname\": \"Crust\",\n"
" \"version\": \"v0.1.0\"\n"
" }\n";
- CFCParcel *parcel = CFCParcel_new_from_json(json);
+ CFCParcel *parcel = CFCParcel_new_from_json(json, false);
OK(test, parcel != NULL, "new_from_json");
CFCBase_decref((CFCBase*)parcel);
}
{
const char *path = "t" CHY_DIR_SEP "cfsource" CHY_DIR_SEP "Animal.cfp";
- CFCParcel *parcel = CFCParcel_new_from_file(path);
+ CFCParcel *parcel = CFCParcel_new_from_file(path, false);
OK(test, parcel != NULL, "new_from_file");
CFCBase_decref((CFCBase*)parcel);
}
@@ -72,7 +84,7 @@ S_run_tests(CFCTest *test) {
}
{
- CFCParcel *parcel = CFCParcel_new("Crustacean", "Crust", NULL);
+ CFCParcel *parcel = CFCParcel_new("Crustacean", "Crust", NULL, false);
CFCParcel_register(parcel);
STR_EQ(test, CFCVersion_get_vstring(CFCParcel_get_version(parcel)),
"v0", "get_version");
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCTestParser.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestParser.c b/clownfish/compiler/src/CFCTestParser.c
index 46611dd..04c39e7 100644
--- a/clownfish/compiler/src/CFCTestParser.c
+++ b/clownfish/compiler/src/CFCTestParser.c
@@ -27,6 +27,11 @@
#include "CFCUtil.h"
#include "CFCVariable.h"
+#ifndef true
+ #define true 1
+ #define false 0
+#endif
+
static void
S_run_tests(CFCTest *test);
@@ -49,7 +54,8 @@ S_run_tests(CFCTest *test) {
{
CFCParcel *fish = CFCTest_parse_parcel(test, parser, "parcel Fish;");
- CFCParcel *registered = CFCParcel_new("Crustacean", "Crust", NULL);
+ CFCParcel *registered
+ = CFCParcel_new("Crustacean", "Crust", NULL, false);
CFCParcel_register(registered);
CFCParcel *parcel
= CFCTest_parse_parcel(test, parser, "parcel Crustacean;");
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCTestSymbol.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestSymbol.c b/clownfish/compiler/src/CFCTestSymbol.c
index 7dfe8d9..8f6518e 100644
--- a/clownfish/compiler/src/CFCTestSymbol.c
+++ b/clownfish/compiler/src/CFCTestSymbol.c
@@ -20,6 +20,11 @@
#include "CFCSymbol.h"
#include "CFCTest.h"
+#ifndef true
+ #define true 1
+ #define false 0
+#endif
+
static void
S_run_tests(CFCTest *test);
@@ -89,7 +94,8 @@ S_run_tests(CFCTest *test) {
}
{
- CFCParcel *lucifer_parcel = CFCParcel_new("Lucifer", NULL, NULL);
+ CFCParcel *lucifer_parcel
+ = CFCParcel_new("Lucifer", NULL, NULL, false);
CFCParcel_register(lucifer_parcel);
CFCSymbol *lucifer
= CFCSymbol_new(lucifer_parcel, "parcel", NULL, NULL, "sym");
@@ -103,7 +109,7 @@ S_run_tests(CFCTest *test) {
const char *PREFIX = CFCSymbol_get_PREFIX(lucifer);
STR_EQ(test, PREFIX, "LUCIFER_", "get_PREFIX");
- CFCParcel *luser_parcel = CFCParcel_new("Luser", NULL, NULL);
+ CFCParcel *luser_parcel = CFCParcel_new("Luser", NULL, NULL, false);
CFCParcel_register(luser_parcel);
CFCSymbol *luser
= CFCSymbol_new(luser_parcel, "parcel", NULL, NULL, "sym");
@@ -127,7 +133,7 @@ S_run_tests(CFCTest *test) {
}
{
- CFCParcel *eep_parcel = CFCParcel_new("Eep", NULL, NULL);
+ CFCParcel *eep_parcel = CFCParcel_new("Eep", NULL, NULL, false);
CFCParcel_register(eep_parcel);
CFCSymbol *eep
= CFCSymbol_new(eep_parcel, "parcel", "Op::Ork", NULL, "ah_ah");
http://git-wip-us.apache.org/repos/asf/lucy/blob/041145bf/clownfish/compiler/src/CFCTestType.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestType.c b/clownfish/compiler/src/CFCTestType.c
index baa91d2..b94903c 100644
--- a/clownfish/compiler/src/CFCTestType.c
+++ b/clownfish/compiler/src/CFCTestType.c
@@ -79,7 +79,7 @@ S_run_tests(CFCTest *test) {
static void
S_run_basic_tests(CFCTest *test) {
- CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL);
+ CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL, false);
CFCParcel_register(neato_parcel);
CFCType *type = CFCType_new(0, neato_parcel, "mytype_t", 0, NULL);
@@ -333,7 +333,7 @@ S_run_object_tests(CFCTest *test) {
CFCBase_decref((CFCBase*)parser);
}
- CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL);
+ CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL, false);
CFCClass *foo_class
= CFCClass_create(neato_parcel, NULL, "Foo", NULL, NULL, NULL, NULL,
NULL, false, false);
@@ -356,7 +356,8 @@ S_run_object_tests(CFCTest *test) {
}
{
- CFCParcel *foreign_parcel = CFCParcel_new("Foreign", NULL, NULL);
+ CFCParcel *foreign_parcel
+ = CFCParcel_new("Foreign", NULL, NULL, false);
CFCClass *foreign_foo_class
= CFCClass_create(foreign_parcel, NULL, "Foo", NULL, NULL, NULL,
NULL, NULL, false, false);
@@ -422,7 +423,7 @@ S_run_va_list_tests(CFCTest *test) {
static void
S_run_arbitrary_tests(CFCTest *test) {
{
- CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL);
+ CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL, false);
CFCParcel_register(neato_parcel);
CFCType *foo = CFCType_new_arbitrary(neato_parcel, "foo_t");