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/18 13:08:45 UTC

[lucy-commits] [1/3] git commit: refs/heads/master - Remove unneeded test for lucy_ref_t

Updated Branches:
  refs/heads/master 1703035a3 -> 637d4e633


Remove unneeded test for lucy_ref_t

Not neccessary after object head changes.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/89d2c8eb
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/89d2c8eb
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/89d2c8eb

Branch: refs/heads/master
Commit: 89d2c8eb5ba3c0449e6e7b71df02f5e5ac932f1c
Parents: 1703035
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri May 17 23:55:50 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 18 13:02:12 2013 +0200

----------------------------------------------------------------------
 clownfish/compiler/src/CFCBindAliases.c |    1 -
 clownfish/compiler/src/CFCDumpable.c    |   12 ++++--------
 2 files changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/89d2c8eb/clownfish/compiler/src/CFCBindAliases.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindAliases.c b/clownfish/compiler/src/CFCBindAliases.c
index d7f3813..8464c95 100644
--- a/clownfish/compiler/src/CFCBindAliases.c
+++ b/clownfish/compiler/src/CFCBindAliases.c
@@ -24,7 +24,6 @@ struct alias {
 };
 
 struct alias aliases[] = {
-    {"cfish_ref_t", "lucy_ref_t"},
     {"cfish_method_t", "lucy_method_t"},
     {"cfish_method", "lucy_method"},
     {"cfish_super_method", "lucy_super_method"},

http://git-wip-us.apache.org/repos/asf/lucy/blob/89d2c8eb/clownfish/compiler/src/CFCDumpable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCDumpable.c b/clownfish/compiler/src/CFCDumpable.c
index 976e9d8..a8230cd 100644
--- a/clownfish/compiler/src/CFCDumpable.c
+++ b/clownfish/compiler/src/CFCDumpable.c
@@ -281,10 +281,8 @@ S_process_dump_member(CFCClass *klass, CFCVariable *member, char *buf,
     unsigned name_len = (unsigned)strlen(name);
     const char *specifier = CFCType_get_specifier(type);
 
-    // Skip the VTable and the refcount/host-object.
-    if (strcmp(specifier, "lucy_VTable") == 0
-        || strcmp(specifier, "lucy_ref_t") == 0
-       ) {
+    // Skip the VTable.
+    if (strcmp(specifier, "lucy_VTable") == 0) {
         return;
     }
 
@@ -344,10 +342,8 @@ S_process_load_member(CFCClass *klass, CFCVariable *member, char *buf,
     char extraction[200];
     const char *specifier = CFCType_get_specifier(type);
 
-    // Skip the VTable and the refcount/host-object.
-    if (strcmp(specifier, "lucy_VTable") == 0
-        || strcmp(specifier, "lucy_ref_t") == 0
-       ) {
+    // Skip the VTable.
+    if (strcmp(specifier, "lucy_VTable") == 0) {
         return;
     }
 


[lucy-commits] [2/3] git commit: refs/heads/master - Finish renaming of lucy_method_t to cfish_method_t

Posted by nw...@apache.org.
Finish renaming of lucy_method_t to cfish_method_t


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/5ca26ba9
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/5ca26ba9
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/5ca26ba9

Branch: refs/heads/master
Commit: 5ca26ba9f428986626f00e1f9ed1b064a8d32779
Parents: 89d2c8e
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 18 00:03:19 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 18 13:02:26 2013 +0200

----------------------------------------------------------------------
 clownfish/compiler/src/CFCBindAliases.c |    4 ----
 core/Clownfish/Method.c                 |    4 ++--
 core/Clownfish/Method.cfh               |   10 +++++-----
 core/Clownfish/VTable.c                 |    4 ++--
 core/Clownfish/VTable.cfh               |    4 ++--
 5 files changed, 11 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/5ca26ba9/clownfish/compiler/src/CFCBindAliases.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindAliases.c b/clownfish/compiler/src/CFCBindAliases.c
index 8464c95..09a1c84 100644
--- a/clownfish/compiler/src/CFCBindAliases.c
+++ b/clownfish/compiler/src/CFCBindAliases.c
@@ -24,10 +24,6 @@ struct alias {
 };
 
 struct alias aliases[] = {
-    {"cfish_method_t", "lucy_method_t"},
-    {"cfish_method", "lucy_method"},
-    {"cfish_super_method", "lucy_super_method"},
-
     {"cfish_Obj", "lucy_Obj"},
     {"CFISH_OBJ", "LUCY_OBJ"},
     {"Cfish_Obj_Dump", "Lucy_Obj_Dump"},

http://git-wip-us.apache.org/repos/asf/lucy/blob/5ca26ba9/core/Clownfish/Method.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Method.c b/core/Clownfish/Method.c
index 13f3abb..8a76d2b 100644
--- a/core/Clownfish/Method.c
+++ b/core/Clownfish/Method.c
@@ -24,13 +24,13 @@
 #include "Clownfish/VTable.h"
 
 Method*
-Method_new(const CharBuf *name, lucy_method_t callback_func, size_t offset) {
+Method_new(const CharBuf *name, cfish_method_t callback_func, size_t offset) {
     Method *self = (Method*)VTable_Make_Obj(METHOD);
     return Method_init(self, name, callback_func, offset);
 }
 
 Method*
-Method_init(Method *self, const CharBuf *name, lucy_method_t callback_func,
+Method_init(Method *self, const CharBuf *name, cfish_method_t callback_func,
             size_t offset) {
     self->name          = CB_Clone(name);
     self->callback_func = callback_func;

http://git-wip-us.apache.org/repos/asf/lucy/blob/5ca26ba9/core/Clownfish/Method.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/Method.cfh b/core/Clownfish/Method.cfh
index b2476ec..17df64a 100644
--- a/core/Clownfish/Method.cfh
+++ b/core/Clownfish/Method.cfh
@@ -21,15 +21,15 @@ parcel Lucy;
 
 class Clownfish::Method inherits Clownfish::Obj {
 
-    CharBuf       *name;
-    lucy_method_t  callback_func;
-    size_t         offset;
+    CharBuf        *name;
+    cfish_method_t  callback_func;
+    size_t          offset;
 
     inert Method*
-    new(const CharBuf *name, lucy_method_t callback_func, size_t offset);
+    new(const CharBuf *name, cfish_method_t callback_func, size_t offset);
 
     inert Method*
-    init(Method *self, const CharBuf *name, lucy_method_t callback_func,
+    init(Method *self, const CharBuf *name, cfish_method_t callback_func,
          size_t offset);
 
     incremented Obj*

http://git-wip-us.apache.org/repos/asf/lucy/blob/5ca26ba9/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/VTable.c b/core/Clownfish/VTable.c
index e2bbad1..7abdb8e 100644
--- a/core/Clownfish/VTable.c
+++ b/core/Clownfish/VTable.c
@@ -166,8 +166,8 @@ VTable_get_refcount(VTable *self) {
 }
 
 void
-VTable_override(VTable *self, lucy_method_t method, size_t offset) {
-    union { char *char_ptr; lucy_method_t *func_ptr; } pointer;
+VTable_override(VTable *self, cfish_method_t method, size_t offset) {
+    union { char *char_ptr; cfish_method_t *func_ptr; } pointer;
     pointer.char_ptr = ((char*)self) + offset;
     pointer.func_ptr[0] = method;
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/5ca26ba9/core/Clownfish/VTable.cfh
----------------------------------------------------------------------
diff --git a/core/Clownfish/VTable.cfh b/core/Clownfish/VTable.cfh
index 0351082..9f2555d 100644
--- a/core/Clownfish/VTable.cfh
+++ b/core/Clownfish/VTable.cfh
@@ -31,7 +31,7 @@ class Clownfish::VTable inherits Clownfish::Obj {
     size_t             obj_alloc_size;
     size_t             vt_alloc_size;
     VArray            *methods;
-    lucy_method_t[1]   method_ptrs; /* flexible array */
+    cfish_method_t[1]  method_ptrs; /* flexible array */
 
     inert LockFreeRegistry *registry;
     inert size_t offset_of_parent;
@@ -92,7 +92,7 @@ class Clownfish::VTable inherits Clownfish::Obj {
     /** Replace a function pointer in the VTable.
      */
     void
-    Override(VTable *self, lucy_method_t method_ptr, size_t offset);
+    Override(VTable *self, cfish_method_t method_ptr, size_t offset);
 
     /** Create an empty object of the type defined by the VTable: allocate,
      * assign its vtable and give it an initial refcount of 1.  The caller is


[lucy-commits] [3/3] git commit: refs/heads/master - Custom object head for C library

Posted by nw...@apache.org.
Custom object head for C library

Union with host object isn't needed.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/637d4e63
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/637d4e63
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/637d4e63

Branch: refs/heads/master
Commit: 637d4e63321cb489276da519c2ffe55c01a12b3c
Parents: 5ca26ba
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 18 00:11:47 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 18 13:02:43 2013 +0200

----------------------------------------------------------------------
 c/src/Clownfish/Obj.c                |    8 ++++----
 c/src/Clownfish/VTable.c             |    4 ++--
 clownfish/compiler/src/CFCBindCore.c |    6 ------
 clownfish/compiler/src/CFCC.c        |    4 ++--
 clownfish/compiler/src/CFCPerl.c     |    6 ++++++
 clownfish/compiler/src/CFCRuby.c     |    6 ++++++
 6 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/c/src/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/Obj.c b/c/src/Clownfish/Obj.c
index 30d6b9e..cf344b1 100644
--- a/c/src/Clownfish/Obj.c
+++ b/c/src/Clownfish/Obj.c
@@ -23,19 +23,19 @@
 
 uint32_t
 Obj_get_refcount(Obj *self) {
-    return self->ref.count;
+    return self->refcount;
 }
 
 Obj*
 Obj_inc_refcount(Obj *self) {
-    self->ref.count++;
+    self->refcount++;
     return self;
 }
 
 uint32_t
 Obj_dec_refcount(Obj *self) {
     uint32_t modified_refcount = INT32_MAX;
-    switch (self->ref.count) {
+    switch (self->refcount) {
         case 0:
             THROW(ERR, "Illegal refcount of 0");
             break; // useless
@@ -44,7 +44,7 @@ Obj_dec_refcount(Obj *self) {
             Obj_Destroy(self);
             break;
         default:
-            modified_refcount = --self->ref.count;
+            modified_refcount = --self->refcount;
             break;
     }
     return modified_refcount;

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/c/src/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/c/src/Clownfish/VTable.c b/c/src/Clownfish/VTable.c
index cc51c6f..09fce4e 100644
--- a/c/src/Clownfish/VTable.c
+++ b/c/src/Clownfish/VTable.c
@@ -29,7 +29,7 @@ Obj*
 VTable_make_obj(VTable *self) {
     Obj *obj = (Obj*)Memory_wrapped_calloc(self->obj_alloc_size, 1);
     obj->vtable = self;
-    obj->ref.count = 1;
+    obj->refcount = 1;
     return obj;
 }
 
@@ -37,7 +37,7 @@ Obj*
 VTable_init_obj(VTable *self, void *allocation) {
     Obj *obj = (Obj*)allocation;
     obj->vtable = self;
-    obj->ref.count = 1;
+    obj->refcount = 1;
     return obj;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCBindCore.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindCore.c b/clownfish/compiler/src/CFCBindCore.c
index a1e2348..662d20e 100644
--- a/clownfish/compiler/src/CFCBindCore.c
+++ b/clownfish/compiler/src/CFCBindCore.c
@@ -169,12 +169,6 @@ S_write_parcel_h(CFCBindCore *self) {
         "%s\n"
         "%s\n"
         "\n"
-        "/* Refcount / host object */\n"
-        "typedef union {\n"
-        "    size_t  count;\n"
-        "    void   *host_obj;\n"
-        "} cfish_ref_t;\n"
-        "\n"
         "/* Generic method pointer.\n"
         " */\n"
         "typedef void\n"

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCC.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCC.c b/clownfish/compiler/src/CFCC.c
index fb61844..3e52374 100644
--- a/clownfish/compiler/src/CFCC.c
+++ b/clownfish/compiler/src/CFCC.c
@@ -175,8 +175,8 @@ CFCC_write_hostdefs(CFCC *self) {
         "#ifndef H_CFISH_HOSTDEFS\n"
         "#define H_CFISH_HOSTDEFS 1\n"
         "\n"
-        "#define CFISH_OBJ_HEAD\\\n"
-        "   cfish_ref_t ref;\n"
+        "#define CFISH_OBJ_HEAD \\\n"
+        "    size_t refcount;\n"
         "\n"
         "#endif /* H_CFISH_HOSTDEFS */\n"
         "\n"

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index e26ea3e..d8e3ef6 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -322,6 +322,12 @@ CFCPerl_write_hostdefs(CFCPerl *self) {
         "#ifndef H_CFISH_HOSTDEFS\n"
         "#define H_CFISH_HOSTDEFS 1\n"
         "\n"
+        "/* Refcount / host object */\n"
+        "typedef union {\n"
+        "    size_t  count;\n"
+        "    void   *host_obj;\n"
+        "} cfish_ref_t;\n"
+        "\n"
         "#define CFISH_OBJ_HEAD\\\n"
         "   cfish_ref_t ref;\n"
         "\n"

http://git-wip-us.apache.org/repos/asf/lucy/blob/637d4e63/clownfish/compiler/src/CFCRuby.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCRuby.c b/clownfish/compiler/src/CFCRuby.c
index d3b9726..6921522 100644
--- a/clownfish/compiler/src/CFCRuby.c
+++ b/clownfish/compiler/src/CFCRuby.c
@@ -243,6 +243,12 @@ CFCRuby_write_hostdefs(CFCRuby *self) {
         "#ifndef H_CFISH_HOSTDEFS\n"
         "#define H_CFISH_HOSTDEFS 1\n"
         "\n"
+        "/* Refcount / host object */\n"
+        "typedef union {\n"
+        "    size_t  count;\n"
+        "    void   *host_obj;\n"
+        "} cfish_ref_t;\n"
+        "\n"
         "#define CFISH_OBJ_HEAD\\\n"
         "   cfish_ref_t ref;\n"
         "\n"