lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [1/6] git commit: Bake parcel privacy defines into XS
Date Sun, 16 Feb 2014 23:20:02 GMT
Repository: lucy-clownfish
Updated Branches:
  refs/heads/cflags [created] e6a5815a5


Bake parcel privacy defines into XS

The XS code can now be compiled without any extra compiler flags.


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

Branch: refs/heads/cflags
Commit: e6a5815a599fe2cfa4a3a15c5e247b26a6e8a2cb
Parents: cc26fa0
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Feb 16 23:53:51 2014 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Mon Feb 17 00:18:42 2014 +0100

----------------------------------------------------------------------
 compiler/src/CFCPerl.c | 15 ++++++++++++++-
 runtime/perl/Build.PL  |  1 -
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e6a5815a/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerl.c b/compiler/src/CFCPerl.c
index 7c3c639..9d8b47e 100644
--- a/compiler/src/CFCPerl.c
+++ b/compiler/src/CFCPerl.c
@@ -400,12 +400,24 @@ S_add_xs_init(char *xs_init, CFCPerlSub *xsub) {
 
 void
 CFCPerl_write_bindings(CFCPerl *self) {
-    CFCClass **ordered = CFCHierarchy_ordered_classes(self->hierarchy);
+    CFCParcel    **parcels  = CFCParcel_all_parcels();
+    CFCClass     **ordered  = CFCHierarchy_ordered_classes(self->hierarchy);
     CFCPerlClass **registry = CFCPerlClass_registry();
     char *hand_rolled_xs   = CFCUtil_strdup("");
     char *generated_xs     = CFCUtil_strdup("");
     char *xs_init          = CFCUtil_strdup("");
 
+    // Bake the parcel privacy defines into the XS, so it can be compiled
+    // without any extra compiler flags.
+    for (size_t i = 0; parcels[i]; ++i) {
+        if (!CFCParcel_included(parcels[i])) {
+            const char *privacy_sym = CFCParcel_get_privacy_sym(parcels[i]);
+            generated_xs = CFCUtil_cat(generated_xs, "#define ", privacy_sym,
+                                       "\n", NULL);
+        }
+    }
+    generated_xs = CFCUtil_cat(generated_xs, "\n", NULL);
+
     // Pound-includes for generated headers.
     for (size_t i = 0; ordered[i] != NULL; i++) {
         CFCClass *klass = ordered[i];
@@ -472,6 +484,7 @@ CFCPerl_write_bindings(CFCPerl *self) {
     FREEMEM(xs_init);
     FREEMEM(generated_xs);
     FREEMEM(ordered);
+    FREEMEM(parcels);
 }
 
 void

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e6a5815a/runtime/perl/Build.PL
----------------------------------------------------------------------
diff --git a/runtime/perl/Build.PL b/runtime/perl/Build.PL
index c449d2a..070aee3 100644
--- a/runtime/perl/Build.PL
+++ b/runtime/perl/Build.PL
@@ -56,7 +56,6 @@ my $builder = Clownfish::Build->new(
             $XS_SOURCE_DIR,
         ],
     },
-    extra_compiler_flags => '-DCFP_CFISH -DCFP_TESTCFISH',
     add_to_cleanup => [
         qw(
             Clownfish-*


Mime
View raw message