lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [4/5] git commit: Add array of class struct symbols to CFCParcel
Date Wed, 12 Mar 2014 18:37:31 GMT
Add array of class struct symbols to CFCParcel


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

Branch: refs/heads/explicit-dependencies
Commit: f226ff01e49fbb65ff6c9ff00d32b56887ff3959
Parents: a96f749
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Wed Mar 12 15:54:56 2014 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Wed Mar 12 19:33:25 2014 +0100

----------------------------------------------------------------------
 compiler/src/CFCClass.c  |  2 ++
 compiler/src/CFCParcel.c | 20 ++++++++++++++++++++
 compiler/src/CFCParcel.h |  3 +++
 3 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f226ff01/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index 61a9d42..dfb3e6d 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -202,6 +202,8 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
     // Store in registry.
     S_register(self);
 
+    CFCParcel_add_class_struct_sym(parcel, self->struct_sym);
+
     return self;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f226ff01/compiler/src/CFCParcel.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCParcel.c b/compiler/src/CFCParcel.c
index 68b88dd..bf89c7c 100644
--- a/compiler/src/CFCParcel.c
+++ b/compiler/src/CFCParcel.c
@@ -47,6 +47,8 @@ struct CFCParcel {
     int is_required;
     char **inherited_parcels;
     size_t num_inherited_parcels;
+    char **class_struct_syms;
+    size_t num_class_struct_syms;
     CFCPrereq **prereqs;
     size_t num_prereqs;
 };
@@ -258,6 +260,8 @@ CFCParcel_init(CFCParcel *self, const char *name, const char *cnick,
     // Initialize arrays.
     self->inherited_parcels = (char**)CALLOCATE(1, sizeof(char*));
     self->num_inherited_parcels = 0;
+    self->class_struct_syms = (char**)CALLOCATE(1, sizeof(char*));
+    self->num_class_struct_syms = 0;
     self->prereqs = (CFCPrereq**)CALLOCATE(1, sizeof(CFCPrereq*));
     self->num_prereqs = 0;
 
@@ -400,6 +404,10 @@ CFCParcel_destroy(CFCParcel *self) {
         FREEMEM(prereq);
     }
     FREEMEM(self->prereqs);
+    for (size_t i = 0; self->class_struct_syms[i]; ++i) {
+        FREEMEM(self->class_struct_syms[i]);
+    }
+    FREEMEM(self->class_struct_syms);
     CFCBase_destroy((CFCBase*)self);
 }
 
@@ -571,6 +579,18 @@ CFCParcel_has_prereq(CFCParcel *self, CFCParcel *parcel) {
     return false;
 }
 
+void
+CFCParcel_add_class_struct_sym(CFCParcel *self, const char *struct_sym) {
+    size_t num_class_struct_syms = self->num_class_struct_syms + 1;
+    size_t size = (num_class_struct_syms + 1) * sizeof(char*);
+    char **class_struct_syms
+        = (char**)REALLOCATE(self->class_struct_syms, size);
+    class_struct_syms[num_class_struct_syms-1] = CFCUtil_strdup(struct_sym);
+    class_struct_syms[num_class_struct_syms]   = NULL;
+    self->class_struct_syms     = class_struct_syms;
+    self->num_class_struct_syms = num_class_struct_syms;
+}
+
 const char*
 CFCPrereq_get_name(CFCPrereq *self) {
     return self->name;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f226ff01/compiler/src/CFCParcel.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCParcel.h b/compiler/src/CFCParcel.h
index 73bfdc0..41687e7 100644
--- a/compiler/src/CFCParcel.h
+++ b/compiler/src/CFCParcel.h
@@ -161,6 +161,9 @@ CFCParcel_check_prereqs(CFCParcel *self);
 int
 CFCParcel_has_prereq(CFCParcel *self, CFCParcel *parcel);
 
+void
+CFCParcel_add_class_struct_sym(CFCParcel *self, const char *struct_sym);
+
 const char*
 CFCPrereq_get_name(CFCPrereq *self);
 


Mime
View raw message