lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r465370 - in /lucene/lucy/trunk/charmonizer: charmonize.c src/Charmonizer.charm src/Charmonizer.harm
Date Wed, 18 Oct 2006 21:00:41 GMT
Author: marvin
Date: Wed Oct 18 14:00:39 2006
New Revision: 465370

URL: http://svn.apache.org/viewvc?view=rev&rev=465370
Log:
Remove chaz_set_compiler and chaz_set_ccflags.  Roll their functionality into
chaz_init, since nothing can happen anyway until compiler and ccflags are
known.  Also, change the args on chaz_set_prefixes to const char* from char*,
and call it with empty strings during initialization.

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

Modified: lucene/lucy/trunk/charmonizer/charmonize.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/charmonize.c?view=diff&rev=465370&r1=465369&r2=465370
==============================================================================
--- lucene/lucy/trunk/charmonizer/charmonize.c (original)
+++ lucene/lucy/trunk/charmonizer/charmonize.c Wed Oct 18 14:00:39 2006
@@ -85,10 +85,8 @@
     outpath  = extract_delim(infile_contents, infile_len, "charm_outpath");
     
     /* set up Charmonizer */
+    chaz_init(compiler, ccflags);
     chaz_set_prefixes("LUCY_", "Lucy_", "lucy_", "lucy_");
-    chaz_set_compiler(compiler);
-    chaz_set_ccflags(ccflags);
-    chaz_init();
 
     /* 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=465370&r1=465369&r2=465370
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer.charm Wed Oct 18 14:00:39 2006
@@ -7,8 +7,17 @@
 #include "Charmonizer/Core.h"
 
 void
-chaz_init()
+chaz_init(const char *comp_cmd, const char *cc_flags_string )
 {
+    /* set the compiler and ccflags vars */
+    compiler = strdup(comp_cmd);
+    ccflags  = strdup(cc_flags_string);
+
+    /* don't write short names unless the user so indicates */
+    chaz_set_prefixes("", "", "", "");
+    want_short_names = false;
+
+    /* dispatch other tasks */
     probe_compiler_syntax();
     write_charm_h();
 }
@@ -21,27 +30,10 @@
     remove("_charm.h");
 }
 
-void 
-chaz_set_compiler(char* comp_cmd) 
-{
-    size_t len = strlen(comp_cmd);
-    compiler = (char*)realloc(compiler, len * (sizeof(char)) + 1);
-    compiler[len] = '\0';
-    strncpy(compiler, comp_cmd, len);
-}
-
-void 
-chaz_set_ccflags(char* flag_string) 
-{
-    size_t len = strlen(flag_string);
-    ccflags = (char*)realloc(ccflags, 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) {
+chaz_set_prefixes(const char *constant_pre, const char *macro_pre, 
+                  const char* typedef_pre,  const char *function_pre) 
+{
     want_short_names = true;
 
     free(constant_prefix);

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer.harm?view=diff&rev=465370&r1=465369&r2=465370
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer.harm Wed Oct 18 14:00:39 2006
@@ -7,7 +7,7 @@
  * else.
  */
 void
-chaz_init();
+chaz_init(const char *compiler, const char *ccflags);
 
 /* Clean up the Charmonizer environment -- deleting tempfiles, etc.  This
  * should be called only after everything else finishes.
@@ -15,22 +15,12 @@
 void
 chaz_clean_up();
 
-/* Tell Charmonizer the name of the compiler it should use.
- */
-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.
  */ 
 void
-chaz_set_prefixes(char *constant_prefix, char *macro_prefix, 
-                  char *typedef_prefix,  char *function_prefix);
+chaz_set_prefixes(const char *constant_prefix, const char *macro_prefix, 
+                  const char *typedef_prefix,  const char *function_prefix);
 
 /* Determine how much feedback Charmonizer provides.  
  * 0 - silent



Mime
View raw message