lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [1/2] git commit: Write a log file after a successful cfc run
Date Sun, 09 Mar 2014 11:56:50 GMT
Repository: lucy-clownfish
Updated Branches:
  refs/heads/master 95d2a7c7d -> 37d8cfcd3


Write a log file after a successful cfc run

This will be used to make dependencies in Makefiles work reliably. We
could add some useful or interesting statistics about the class
hierarchy later (number of parcels, classes, methods, etc.).


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

Branch: refs/heads/master
Commit: af553f16a919c3cd80912eb0a2273210249228b4
Parents: 95d2a7c
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Mar 9 12:42:24 2014 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sun Mar 9 12:42:24 2014 +0100

----------------------------------------------------------------------
 compiler/c/cfc.c            |  2 ++
 compiler/src/CFCHierarchy.c | 14 ++++++++++++++
 compiler/src/CFCHierarchy.h |  8 ++++++++
 3 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/af553f16/compiler/c/cfc.c
----------------------------------------------------------------------
diff --git a/compiler/c/cfc.c b/compiler/c/cfc.c
index 2dcc25c..b467ce9 100644
--- a/compiler/c/cfc.c
+++ b/compiler/c/cfc.c
@@ -231,6 +231,8 @@ main(int argc, char **argv) {
         CFCC_write_man_pages(c_binding);
     }
 
+    CFCHierarchy_write_log(hierarchy);
+
     CFCBase_decref((CFCBase*)c_binding);
     CFCBase_decref((CFCBase*)core_binding);
     CFCBase_decref((CFCBase*)hierarchy);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/af553f16/compiler/src/CFCHierarchy.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCHierarchy.c b/compiler/src/CFCHierarchy.c
index 682638a..c5ce5ec 100644
--- a/compiler/src/CFCHierarchy.c
+++ b/compiler/src/CFCHierarchy.c
@@ -479,6 +479,20 @@ CFCHierarchy_ordered_classes(CFCHierarchy *self) {
     return ladder;
 }
 
+void
+CFCHierarchy_write_log(CFCHierarchy *self) {
+    // For now, we only write an empty file that can be used as a Makefile
+    // target. It might be useful to add statistics about the class hierarchy
+    // later.
+    const char *file_content = "{}\n";
+
+    char *filepath = CFCUtil_sprintf("%s" CHY_DIR_SEP "hierarchy.json",
+                                     self->dest);
+    remove(filepath);
+    CFCUtil_write_file(filepath, file_content, strlen(file_content));
+    FREEMEM(filepath);
+}
+
 static CFCFile*
 S_fetch_file(CFCHierarchy *self, const char *path_part) {
     for (size_t i = 0; self->files[i] != NULL; i++) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/af553f16/compiler/src/CFCHierarchy.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCHierarchy.h b/compiler/src/CFCHierarchy.h
index f04edb6..06d1e57 100644
--- a/compiler/src/CFCHierarchy.h
+++ b/compiler/src/CFCHierarchy.h
@@ -71,6 +71,14 @@ CFCHierarchy_build(CFCHierarchy *self);
 int
 CFCHierarchy_propagate_modified(CFCHierarchy *self, int modified);
 
+/** Write a JSON files with statistics about the class hierarchy. At the
+ * moment, this file is empty. It is only used for reliable dependency
+ * handling in the Makefiles of the C build. Thus, the log file should only
+ * be updated after all other files were written successfully.
+ */
+void
+CFCHierarchy_write_log(CFCHierarchy *self);
+
 /** Return all Classes as an array with the property that every parent class
  * will precede all of its children.
  */


Mime
View raw message