lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [6/6] git commit: Bake parcel privacy defines into XS
Date Tue, 22 Apr 2014 20:59:12 GMT
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/b7d53da9
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/b7d53da9
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/b7d53da9

Branch: refs/heads/master
Commit: b7d53da9bbbd3bd6cae5e21e45b0e2cac3635e57
Parents: 1757e4e
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sun Feb 16 23:53:51 2014 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Tue Apr 22 22:57:06 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b7d53da9/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerl.c b/compiler/src/CFCPerl.c
index 02fb96b..d931ea2 100644
--- a/compiler/src/CFCPerl.c
+++ b/compiler/src/CFCPerl.c
@@ -399,12 +399,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];

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b7d53da9/runtime/perl/Build.PL
----------------------------------------------------------------------
diff --git a/runtime/perl/Build.PL b/runtime/perl/Build.PL
index c893e5d..94cf181 100644
--- a/runtime/perl/Build.PL
+++ b/runtime/perl/Build.PL
@@ -57,7 +57,6 @@ my $builder = Clownfish::Build->new(
         ],
         include => [], # Don't use default includes.
     },
-    extra_compiler_flags => '-DCFP_CFISH -DCFP_TESTCFISH',
     add_to_cleanup => [
         qw(
             Clownfish-*


Mime
View raw message