You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2006/10/16 00:21:03 UTC

svn commit: r464305 - in /lucene/lucy/trunk/charmonizer: charmonize.c src/Charmonizer.charm src/Charmonizer.harm src/Charmonizer/Core.charm src/Charmonizer/Core.harm

Author: marvin
Date: Sun Oct 15 15:21:03 2006
New Revision: 464305

URL: http://svn.apache.org/viewvc?view=rev&rev=464305
Log:
Update Charmonizer library to accept ccflags.

Modified:
    lucene/lucy/trunk/charmonizer/charmonize.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer.harm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.harm

Modified: lucene/lucy/trunk/charmonizer/charmonize.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/charmonize.c?view=diff&rev=464305&r1=464304&r2=464305
==============================================================================
--- lucene/lucy/trunk/charmonizer/charmonize.c (original)
+++ lucene/lucy/trunk/charmonizer/charmonize.c Sun Oct 15 15:21:03 2006
@@ -92,7 +92,7 @@
     /* set up Charmonizer */
     chaz_set_prefixes("LUCY_", "Lucy_", "lucy_", "lucy_");
     chaz_set_compiler(compiler);
-    /* chaz_set_ccflags(ccflags); */  /* TODO */
+    chaz_set_ccflags(ccflags);
 
     /* clean up */
     free(infile_contents);

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer.charm?view=diff&rev=464305&r1=464304&r2=464305
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer.charm Sun Oct 15 15:21:03 2006
@@ -22,6 +22,22 @@
     strncpy(compiler, comp_cmd, len);
 }
 
+void 
+chaz_set_ccflags(char* flag_string) 
+{
+    size_t len = strlen(flag_string);
+
+    /* security check */
+    if (len > 100)
+        die("ccflags greater than 100 characters: %s", flag_string);
+
+    /* assign new val */
+    free(ccflags);
+    ccflags = (char*)malloc(len * (sizeof(char)) + 1);
+    ccflags[len] = '\0';
+    strncpy(ccflags, flag_string, len);
+}
+
 void
 chaz_set_prefixes(char *constant_pre, char *macro_pre, char* typedef_pre,  
                   char *function_pre) {

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer.harm?view=diff&rev=464305&r1=464304&r2=464305
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer.harm Sun Oct 15 15:21:03 2006
@@ -8,6 +8,11 @@
 void
 chaz_set_compiler(char *compiler_string);
 
+/* Supply a string which charmonizer will append to its compile commands.
+ */
+void
+chaz_set_ccflags(char *ccflags);
+
 /* These prefixes will be prepended to every symbol Charmonizer generates.
  * By default, they are blank.
  */ 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.charm?view=diff&rev=464305&r1=464304&r2=464305
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.charm Sun Oct 15 15:21:03 2006
@@ -7,6 +7,7 @@
 #include <string.h>
 
 char *compiler        = NULL;
+char *ccflags         = NULL;
 char *constant_prefix = NULL;
 char *macro_prefix    = NULL;
 char *typedef_prefix  = NULL;
@@ -39,7 +40,8 @@
     /* security note: snprintf isn't available, so we just have to make sure
      * that the compiler command is short enough at an earlier stage.
      */
-    sprintf(command, "%s " TRY_SOURCE_PATH " -o " TRY_APP_PATH "\0", compiler);
+    sprintf(command, "%s " TRY_SOURCE_PATH " -o " TRY_APP_PATH " %s\0", 
+        compiler, ccflags);
 
     /* Compile the source.
      * Unfortunately there's no completely portable way to redirect stderr

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.harm?view=diff&rev=464305&r1=464304&r2=464305
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core.harm Sun Oct 15 15:21:03 2006
@@ -22,6 +22,7 @@
 /* Global variables.
  */
 extern char *chaz_Core_compiler;
+extern char *chaz_Core_ccflags;
 extern char *chaz_Core_constant_prefix;
 extern char *chaz_Core_macro_prefix;
 extern char *chaz_Core_typedef_prefix;
@@ -84,6 +85,7 @@
 # define TRY_APP_PATH           CHAZ_CORE_TRY_APP_PATH
 # define TARGET_PATH            CHAZ_CORE_TARGET_PATH
 # define compiler               chaz_Core_compiler
+# define ccflags                chaz_Core_ccflags
 # define constant_prefix        chaz_Core_constant_prefix
 # define macro_prefix           chaz_Core_macro_prefix
 # define typedef_prefix         chaz_Core_typedef_prefix