lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r467461 - in /lucene/lucy/trunk/charmonizer: charmonize.c src/Charmonizer.charm src/Charmonizer.harm
Date Tue, 24 Oct 2006 20:10:16 GMT
Author: marvin
Date: Tue Oct 24 13:10:15 2006
New Revision: 467461

URL: http://svn.apache.org/viewvc?view=rev&rev=467461
Log:
Rework chaz_init so that the os name gets recorded to the config file.

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=467461&r1=467460&r2=467461
==============================================================================
--- lucene/lucy/trunk/charmonizer/charmonize.c (original)
+++ lucene/lucy/trunk/charmonizer/charmonize.c Tue Oct 24 13:10:15 2006
@@ -16,7 +16,7 @@
 /* Process command line args, set up Charmonizer, etc. Returns the outpath
  * (where the config file should be written to).
  */
-char*
+FILE*
 init(int argc, char **argv);
 
 /* Find <tag_name> and </tag_name> within a string and return the text between
@@ -42,14 +42,7 @@
 
 int main(int argc, char **argv) 
 {
-    FILE *config_fh;
-
-    /* parse commmand line args, init Charmonizer, open outfile */
-    char *outpath = init(argc, argv);
-    config_fh = fopen(outpath, "w");
-    if (config_fh == NULL)
-        die("Couldn't open '%s': %s", strerror(errno));
-    start_conf_file(config_fh);
+    FILE *config_fh = init(argc, argv);
 
     /* modules section */
     chaz_FuncMacro_run(config_fh);
@@ -61,19 +54,19 @@
     /* write tail of config and clean up */
     finish_conf_file(config_fh);
     if (fclose(config_fh))
-        die("Error closing file '%s': %s", outpath, strerror(errno));
-    free(outpath);
+        die("Error closing config file: %s", strerror(errno));
     chaz_clean_up();
 
     return 0;
 }
 
-char* 
+FILE* 
 init(int argc, char **argv) 
 {
     char *outpath, *cc_command, *cc_flags, *os_name;
     char *infile_str;
     size_t infile_len;
+    FILE *conf_fh;
 
     /* parse the infile */
     if (argc != 2)
@@ -84,8 +77,14 @@
     outpath    = extract_delim(infile_str, infile_len, "charm_outpath");
     os_name    = extract_delim(infile_str, infile_len, "charm_os_name");
     
+    /* open outfile */
+    conf_fh = fopen(outpath, "w");
+    if (conf_fh == NULL)
+        die("Couldn't open '%s': %s", strerror(errno));
+    start_conf_file(conf_fh);
+
     /* set up Charmonizer */
-    chaz_init(os_name, cc_command, cc_flags);
+    chaz_init(conf_fh, os_name, cc_command, cc_flags);
     chaz_set_prefixes("LUCY_", "Lucy_", "lucy_", "lucy_");
     chaz_write_charm_test_h();
 
@@ -94,8 +93,9 @@
     free(cc_command);
     free(cc_flags);
     free(os_name);
+    free(outpath);
 
-    return outpath;
+    return conf_fh;
 }
 
 static char*

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer.charm?view=diff&rev=467461&r1=467460&r2=467461
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer.charm Tue Oct 24 13:10:15 2006
@@ -10,7 +10,8 @@
 #include "Charmonizer/Core/OperSys.h"
 
 void
-chaz_init(const char *osname, const char *cc_command, const char *cc_flags)
+chaz_init(FILE *conf_fh, const char *osname, const char *cc_command, 
+          const char *cc_flags)
 {
     /* create os and compiler objects */
     os       = OS_new(osname);
@@ -22,6 +23,9 @@
 
     /* dispatch other tasks */
     chaz_ModHand_init();
+
+    /* record the name of the OS -- private, for now */
+    fprintf(conf_fh, "#define CHAZ_OS_NAME \"%s\"\n\n", osname);
 
     if (verbosity)
         printf("Initialization complete.\n");

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer.harm?view=diff&rev=467461&r1=467460&r2=467461
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer.harm Tue Oct 24 13:10:15 2006
@@ -7,7 +7,8 @@
  * else.
  */
 void
-chaz_init(const char *os_name, const char *cc_command, const char *cc_flags);
+chaz_init(FILE *conf_fh, const char *os_name, const char *cc_command, 
+          const char *cc_flags);
 
 /* Clean up the Charmonizer environment -- deleting tempfiles, etc.  This
  * should be called only after everything else finishes.



Mime
View raw message