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 2010/01/06 00:03:29 UTC

svn commit: r896262 - in /lucene/lucy/trunk/charmonizer/src/Charmonizer: ./ Core/ Probe/

Author: marvin
Date: Tue Jan  5 23:03:24 2010
New Revision: 896262

URL: http://svn.apache.org/viewvc?rev=896262&view=rev
Log:
Refactor Charmonizer/Core/ConfWriter, parceling out some features that made
sense when it was named "ModHandler", but no longer belong there.  (LUCY-95)

Modified:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.h
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.h
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c Tue Jan  5 23:03:24 2010
@@ -7,9 +7,16 @@
 #include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/OperatingSystem.h"
 
+/* Temporary files. */
+#define TRY_SOURCE_PATH  "_charmonizer_try.c"
+#define TRY_APP_BASENAME "_charmonizer_try"
+#define TARGET_PATH      "_charmonizer_target"
+
+/* Static vars. */
 static char     *cc_command   = NULL;
 static char     *cc_flags     = NULL;
 static char    **inc_dirs     = NULL;
+static char     *try_app_name = NULL;
 
 /* Detect a supported compiler, or assume a generic GCC-compatible compiler
  * and hope for the best.  */
@@ -30,6 +37,11 @@
 static char *exe_flag          = "-o ";
 #endif
 
+/* Clean up the files associated with CC_capture_output().
+ */
+static void
+S_clean_up_try();
+
 static void
 S_do_test_compile();
 
@@ -48,6 +60,14 @@
     /* Add the current directory as an include dir. */
     CC_add_inc_dir(".");
 
+    /* Set the name of the application which we "try" to execute. */
+    {
+        const char *exe_ext = OS_exe_ext();
+        size_t len = strlen(TRY_APP_BASENAME) + strlen(exe_ext) + 1;
+        try_app_name = (char*)malloc(len);
+        sprintf(try_app_name, "%s%s", TRY_APP_BASENAME, exe_ext);
+    }
+
     /* If we can't compile anything, game over. */
     S_do_test_compile();
 }
@@ -110,19 +130,14 @@
     Util_write_file(source_path, code);
 
     /* Prepare and run the compiler command. */
-    if (Util_verbosity < 2 && chaz_ConfWriter_charm_run_available) {
-        sprintf(command, "%s %s %s %s%s %s %s",
-            "_charm_run ", 
-            cc_command, source_path, 
-            exe_flag, exe_file, 
-            inc_dir_string, cc_flags);
-        OS_run_local(command, NULL);
+    sprintf(command, "%s %s %s%s %s %s",
+        cc_command, source_path, 
+        exe_flag, exe_file, 
+        inc_dir_string, cc_flags);
+    if (Util_verbosity < 2) {
+        OS_run_quietly(command);
     }
     else {
-        sprintf(command, "%s %s %s%s %s %s", 
-            cc_command, source_path,
-            exe_flag, exe_file,
-            inc_dir_string, cc_flags);
         system(command);
     }
 
@@ -159,21 +174,15 @@
     Util_write_file(source_path, code);
 
     /* Prepare and run the compiler command. */
-    if (Util_verbosity < 2 && chaz_ConfWriter_charm_run_available) {
-        sprintf(command, "%s %s %s %s%s %s %s",
-            "_charm_run ", 
-            cc_command, source_path, 
-            object_flag, obj_file, 
-            inc_dir_string,
-            cc_flags);
-        OS_run_local(command, NULL);
+    sprintf(command, "%s %s %s%s %s %s",
+        cc_command, source_path, 
+        object_flag, obj_file, 
+        inc_dir_string,
+        cc_flags);
+    if (Util_verbosity < 2) {
+        OS_run_quietly(command);
     }
     else {
-        sprintf(command, "%s %s %s%s %s %s", 
-            cc_command, source_path,
-            object_flag, obj_file,
-            inc_dir_string,
-            cc_flags);
         system(command);
     }
 
@@ -186,6 +195,62 @@
     return result;
 }
 
+chaz_bool_t
+CC_test_compile(char *source, size_t source_len)
+{
+    chaz_bool_t compile_succeeded;
+
+    if ( !Util_remove_and_verify(try_app_name) ) {
+        Util_die("Failed to delete file '%s'", try_app_name);
+    }
+
+    compile_succeeded = CC_compile_exe(TRY_SOURCE_PATH, TRY_APP_BASENAME,
+        source, source_len);
+
+    S_clean_up_try();
+
+    return compile_succeeded;
+}
+
+char*
+CC_capture_output(char *source, size_t source_len, size_t *output_len) 
+{
+    char *captured_output = NULL;
+    chaz_bool_t compile_succeeded;
+
+    /* Clear out previous versions and test to make sure removal worked. */
+    if ( !Util_remove_and_verify(try_app_name) ) {
+        Util_die("Failed to delete file '%s'", try_app_name);
+    }
+    if ( !Util_remove_and_verify(TARGET_PATH) ) {
+        Util_die("Failed to delete file '%s'", TARGET_PATH);
+    }
+
+    /* Attempt compilation; if successful, run app and slurp output. */
+    compile_succeeded = CC_compile_exe(TRY_SOURCE_PATH, TRY_APP_BASENAME, 
+        source, source_len);
+    if (compile_succeeded) {
+        OS_run_local(try_app_name, NULL);
+        captured_output = Util_slurp_file(TARGET_PATH, output_len);
+    }
+    else {
+        *output_len = 0;
+    }
+
+    /* Remove all the files we just created. */
+    S_clean_up_try();
+
+    return captured_output;
+}
+
+static void
+S_clean_up_try()
+{
+    remove(TRY_SOURCE_PATH);
+    OS_remove_exe(TRY_APP_BASENAME);
+    remove(TARGET_PATH);
+}
+
 static void
 S_do_test_compile()
 {

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.h Tue Jan  5 23:03:24 2010
@@ -25,6 +25,20 @@
 chaz_CC_compile_obj(const char *source_path, const char *obj_path, 
                     const char *code, size_t code_len);
 
+/* Attempt to compile the supplied source code and return true if the
+ * effort succeeds.
+ */
+chaz_bool_t
+chaz_CC_test_compile(char *source, size_t source_len);
+
+/* Attempt to compile the supplied source code.  If successful, capture the 
+ * output of the program and return a pointer to a newly allocated buffer.
+ * If the compilation fails, return NULL.  The length of the captured 
+ * output will be placed into the integer pointed to by [output_len].
+ */
+char*
+chaz_CC_capture_output(char *source, size_t source_len, size_t *output_len);
+
 /* Add an include directory which will be used for all future compilation
  * attempts.
  */
@@ -46,6 +60,8 @@
   #define CC_compile_obj              chaz_CC_compile_obj
   #define CC_add_inc_dir              chaz_CC_add_inc_dir
   #define CC_clean_up                 chaz_CC_clean_up
+  #define CC_test_compile             chaz_CC_test_compile
+  #define CC_capture_output           chaz_CC_capture_output
   #define CC_init                     chaz_CC_init
 #endif
 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.c Tue Jan  5 23:03:24 2010
@@ -9,58 +9,29 @@
 #include <stdlib.h>
 #include <string.h>
 
-
-/* Write the "_charm.h" file used by every probe.
- */
-static void
-S_write_charm_h();
-
-/* Compile a small wrapper application which is used to redirect error output
- * to dev_null.
- */
-static void
-S_build_charm_run();
-
-/* Clean up the files associated with capture_output().
- */
-static void
-S_clean_up_try();
-
-/* Global vars. */
-chaz_bool_t chaz_ConfWriter_charm_run_available = false;
-FILE* ConfWriter_charmony_fh = NULL;
-
 /* Static vars. */
-static char *try_app_name = NULL;
+static FILE *charmony_fh  = NULL;
 
 void
 ConfWriter_init()
 {
-    /* Set the name of the application which we "try" to execute. */
-    const char *exe_ext = OS_exe_ext();
-    size_t len = strlen(TRY_APP_BASENAME) + strlen(exe_ext) + 1;
-    try_app_name = (char*)malloc(len);
-    sprintf(try_app_name, "%s%s", TRY_APP_BASENAME, exe_ext);
-
-    /* Write files needed by this module and others. */
-    S_build_charm_run();
-    S_write_charm_h();
+    return;
 }
 
 void
 ConfWriter_open_charmony_h(const char *charmony_start)
 {
     /* Open the filehandle. */
-    ConfWriter_charmony_fh = fopen("charmony.h", "w+");
-    if (ConfWriter_charmony_fh == NULL) {
+    charmony_fh = fopen("charmony.h", "w+");
+    if (charmony_fh == NULL) {
         Util_die("Can't open 'charmony.h': %s", strerror(errno));
     }
 
     /* Print supplied text (if any) along with warning, open include guard. */
     if (charmony_start != NULL) {
-        fprintf(ConfWriter_charmony_fh, charmony_start);
+        fprintf(charmony_fh, charmony_start);
     }
-    fprintf(ConfWriter_charmony_fh,
+    fprintf(charmony_fh,
         "/* Header file auto-generated by Charmonizer. \n"
         " * DO NOT EDIT THIS FILE!!\n"
         " */\n\n"
@@ -69,183 +40,64 @@
     );
 }
 
+FILE*
+ConfWriter_get_charmony_fh(void)
+{
+    return charmony_fh;
+}
+
 void
 ConfWriter_clean_up(void)
 {
     /* Clean up some temp files. */
     remove("_charm.h");
-    OS_remove_exe("_charm_run");
     OS_remove_exe("_charm_stat");
 
     /* Write the last bit of charmony.h and close. */
-    fprintf(ConfWriter_charmony_fh, "#endif /* H_CHARMONY */\n\n");
-    if (fclose(ConfWriter_charmony_fh)) {
+    fprintf(charmony_fh, "#endif /* H_CHARMONY */\n\n");
+    if (fclose(charmony_fh)) {
         Util_die("Couldn't close 'charmony.h': %s", strerror(errno));
     }
 }
 
-static char charm_h_code[] = METAQUOTE
-    #ifndef CHARM_H
-    #define CHARM_H 1
-
-    #include <stdio.h>
-
-    #define Charm_Setup \
-        freopen("_charmonizer_target", "w", stdout)
-    
-    #endif
-METAQUOTE;
-
-static void
-S_write_charm_h()
-{
-    Util_write_file("_charm.h", charm_h_code);
-}
-
-static char charm_run_code_a[] = METAQUOTE
-    #include <stdio.h>
-    #include <stdlib.h>
-    #include <string.h>
-    #include <stddef.h>
-    int main(int argc, char **argv)
-    {
-        char *command;
-        size_t command_len = 1; /* Terminating null. */
-        int i;
-        int retval;
-        
-        /* Rebuild the command line args, minus the name of this utility. */
-        for (i = 1; i < argc; i++) {
-            command_len += strlen(argv[i]) + 1;
-        }
-        command = (char*)calloc(command_len, sizeof(char));
-METAQUOTE;
-
-static char charm_run_code_b[] = METAQUOTE
-        if (command == NULL) {
-            fprintf(stderr, "calloc failed\n");
-            exit(1);
-        }
-        for (i = 1; i < argc; i++) {
-            strcat( strcat(command, " "), argv[i] );
-        }
-
-        /* Redirect stdout and stderr to /dev/null or equivalent. */
-        freopen( 
-METAQUOTE;
-
-static char charm_run_code_c[] = METAQUOTE
-             , "w", stdout);
-        freopen( 
-METAQUOTE;
-
-static char charm_run_code_d[] = METAQUOTE
-             , "w", stderr);
-
-        /* Run the commmand and return its value to the parent process. */
-        retval = system(command);
-        free(command);
-        return retval;
-    }
-METAQUOTE;
-
-static void
-S_build_charm_run()
+void
+ConfWriter_append_conf(const char *fmt, ...)
 {
-    chaz_bool_t compile_succeeded = false;
-    const char *dev_null = OS_dev_null();
-    size_t needed = sizeof(charm_run_code_a)
-                  + sizeof(charm_run_code_b)
-                  + strlen(dev_null)
-                  + sizeof(charm_run_code_c)
-                  + strlen(dev_null)
-                  + sizeof(charm_run_code_d)
-                  + 20;
-    char *code = (char*)malloc(needed);
-
-    sprintf(code, "%s%s \"%s\" %s \"%s\" %s", 
-        charm_run_code_a, 
-        charm_run_code_b,
-        dev_null,
-        charm_run_code_c,
-        dev_null,
-        charm_run_code_d);
-    compile_succeeded = CC_compile_exe("_charm_run.c", "_charm_run", 
-        code, strlen(code));
-    if (!compile_succeeded) {
-        Util_die("failed to compile _charm_run helper utility");
-    }
+    va_list args;
 
-    remove("_charm_run.c");
-    free(code);
-    chaz_ConfWriter_charm_run_available = true;
+    va_start(args, fmt);
+    vfprintf(charmony_fh, fmt, args);
+    va_end(args);
 }
 
-chaz_bool_t
-ConfWriter_test_compile(char *source, size_t source_len)
+void
+ConfWriter_start_short_names(void)
 {
-    chaz_bool_t compile_succeeded;
-
-    if ( !Util_remove_and_verify(try_app_name) ) {
-        Util_die("Failed to delete file '%s'", try_app_name);
-    }
-
-    compile_succeeded = CC_compile_exe(TRY_SOURCE_PATH, TRY_APP_BASENAME,
-        source, source_len);
-
-    S_clean_up_try();
-
-    return compile_succeeded;
+    ConfWriter_append_conf(
+        "\n#if defined(CHY_USE_SHORT_NAMES) "
+        "|| defined(CHAZ_USE_SHORT_NAMES)\n"
+    );
 }
 
-char*
-ConfWriter_capture_output(char *source, size_t source_len, 
-                            size_t *output_len) 
+void
+ConfWriter_end_short_names(void)
 {
-    char *captured_output = NULL;
-    chaz_bool_t compile_succeeded;
-
-    /* Clear out previous versions and test to make sure removal worked. */
-    if ( !Util_remove_and_verify(try_app_name) ) {
-        Util_die("Failed to delete file '%s'", try_app_name);
-    }
-    if ( !Util_remove_and_verify(TARGET_PATH) ) {
-        Util_die("Failed to delete file '%s'", TARGET_PATH);
-    }
-
-    /* Attempt compilation; if successful, run app and slurp output. */
-    compile_succeeded = CC_compile_exe(TRY_SOURCE_PATH, TRY_APP_BASENAME, 
-        source, source_len);
-    if (compile_succeeded) {
-        OS_run_local(try_app_name, NULL);
-        captured_output = Util_slurp_file(TARGET_PATH, output_len);
-    }
-    else {
-        *output_len = 0;
-    }
-
-    /* Remove all the files we just created. */
-    S_clean_up_try();
-
-    return captured_output;
+    ConfWriter_append_conf("#endif /* USE_SHORT_NAMES */\n");
 }
 
 void
-ConfWriter_append_conf(const char *fmt, ...)
+ConfWriter_start_module(const char *module_name)
 {
-    va_list args;
-
-    va_start(args, fmt);
-    vfprintf(ConfWriter_charmony_fh, fmt, args);
-    va_end(args);
+    if (chaz_Util_verbosity > 0) {
+        printf("Running %s module...\n", module_name);
+    }
+    ConfWriter_append_conf("\n/* %s */\n", module_name);
 }
 
-static void
-S_clean_up_try()
+void
+ConfWriter_end_module(void)
 {
-    remove(TRY_SOURCE_PATH);
-    OS_remove_exe(TRY_APP_BASENAME);
-    remove(TARGET_PATH);
+    ConfWriter_append_conf("\n");
 }
 
 void
@@ -266,7 +118,6 @@
     ConfWriter_append_conf("  #define %s chy_%s\n", sym, sym); 
 }
 
-
 /**
  * Copyright 2006 The Apache Software Foundation
  *

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.h
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.h?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.h (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ConfWriter.h Tue Jan  5 23:03:24 2010
@@ -1,4 +1,4 @@
-/* Chaz/Core/ConfWriter.h -- Write to a config file.
+/* Charmonizer/Core/ConfWriter.h -- Write to a config file.
  */
 
 #ifndef H_CHAZ_CONFWRITER
@@ -12,17 +12,6 @@
 #include <stddef.h>
 #include "Charmonizer/Core/Defines.h"
 
-/* Temporary files used by Charmonizer. 
- */
-#define CHAZ_CONFWRITER_TRY_SOURCE_PATH  "_charmonizer_try.c"
-#define CHAZ_CONFWRITER_TRY_APP_BASENAME "_charmonizer_try"
-#define CHAZ_CONFWRITER_TARGET_PATH      "_charmonizer_target"
-
-/* Global variables.
- */
-extern chaz_bool_t chaz_ConfWriter_charm_run_available;
-extern FILE* chaz_ConfWriter_charmony_fh;
-
 /* Initialize elements needed by ConfWriter.  Must be called before anything 
  * else, but after os and compiler are initialized.
  */
@@ -35,40 +24,31 @@
 void
 chaz_ConfWriter_open_charmony_h(const char *charmony_start);
 
+/* Return the config file's file handle. 
+ */
+FILE*
+chaz_ConfWriter_get_charmony_fh(void);
+
 /* Close the include guard on charmony.h, then close the file.  Delete temp
  * files and perform any other needed cleanup.
  */
 void
 chaz_ConfWriter_clean_up(void);
 
-/* Attempt to compile the supplied source code and return true if the
- * effort succeeds.
- */
-chaz_bool_t
-chaz_ConfWriter_test_compile(char *source, size_t source_len);
-
-/* Attempt to compile the supplied source code.  If successful, capture the 
- * output of the program and return a pointer to a newly allocated buffer.
- * If the compilation fails, return NULL.  The length of the captured 
- * output will be placed into the integer pointed to by [output_len].
- */
-char*
-chaz_ConfWriter_capture_output(char *source, size_t source_len, 
-                            size_t *output_len);
-
 /* Print output to charmony.h.
  */
 void
 chaz_ConfWriter_append_conf(const char *fmt, ...);
 
-/* Print bookends delimiting a short names block.
+/* Start a short names block.
  */
-#define CHAZ_CONFWRITER_START_SHORT_NAMES \
-  chaz_ConfWriter_append_conf( \
-    "\n#if defined(CHY_USE_SHORT_NAMES) || defined(CHAZ_USE_SHORT_NAMES)\n")
+void
+chaz_ConfWriter_start_short_names(void);
 
-#define CHAZ_CONFWRITER_END_SHORT_NAMES \
-    chaz_ConfWriter_append_conf("#endif /* USE_SHORT_NAMES */\n")
+/* Close a short names block.
+ */
+void
+chaz_ConfWriter_end_short_names(void);
 
 /* Define a shortened version of a macro symbol (minus the "CHY_" prefix);
  */
@@ -85,41 +65,30 @@
 void
 chaz_ConfWriter_shorten_function(const char *symbol);
 
-/* Print a "chapter heading" when starting a module. 
+/* Print a "chapter heading" comment in the conf file when starting a module. 
  */
-#define CHAZ_CONFWRITER_START_RUN(module_name) \
-    do { \
-        chaz_ConfWriter_append_conf("\n/* %s */\n", module_name); \
-        if (chaz_Util_verbosity > 0) { \
-            printf("Running %s module...\n", module_name); \
-        } \
-    } while (0)
+void
+chaz_ConfWriter_start_module(const char *module_name);
 
 /* Leave a little whitespace at the end of each module.
  */
-#define CHAZ_CONFWRITER_END_RUN chaz_ConfWriter_append_conf("\n")
+void
+chaz_ConfWriter_end_module(void);
 
 #ifdef   CHAZ_USE_SHORT_NAMES
-  #define TRY_SOURCE_PATH                   CHAZ_CONFWRITER_TRY_SOURCE_PATH
-  #define TRY_APP_BASENAME                  CHAZ_CONFWRITER_TRY_APP_BASENAME
-  #define TARGET_PATH                       CHAZ_CONFWRITER_TARGET_PATH
-  #define ConfWriter_charm_run_available    chaz_ConfWriter_charm_run_available
-  #define ConfWriter_charmony_fh            chaz_ConfWriter_charmony_fh
   #define ConfWriter_init                   chaz_ConfWriter_init
   #define ConfWriter_open_charmony_h        chaz_ConfWriter_open_charmony_h
+  #define ConfWriter_get_charmony_fh        chaz_ConfWriter_get_charmony_fh
   #define ConfWriter_clean_up               chaz_ConfWriter_clean_up
-  #define ConfWriter_write_charm_h          chaz_ConfWriter_write_charm_h
   #define ConfWriter_build_charm_run        chaz_ConfWriter_build_charm_run
-  #define START_SHORT_NAMES                 CHAZ_CONFWRITER_START_SHORT_NAMES
-  #define END_SHORT_NAMES                   CHAZ_CONFWRITER_END_SHORT_NAMES
-  #define ConfWriter_test_compile           chaz_ConfWriter_test_compile
-  #define ConfWriter_capture_output         chaz_ConfWriter_capture_output 
+  #define ConfWriter_start_module           chaz_ConfWriter_start_module
+  #define ConfWriter_end_module             chaz_ConfWriter_end_module
+  #define ConfWriter_start_short_names      chaz_ConfWriter_start_short_names
+  #define ConfWriter_end_short_names        chaz_ConfWriter_end_short_names
   #define ConfWriter_append_conf            chaz_ConfWriter_append_conf
   #define ConfWriter_shorten_macro          chaz_ConfWriter_shorten_macro
   #define ConfWriter_shorten_typedef        chaz_ConfWriter_shorten_typedef
   #define ConfWriter_shorten_function       chaz_ConfWriter_shorten_function
-  #define START_RUN                         CHAZ_CONFWRITER_START_RUN
-  #define END_RUN                           CHAZ_CONFWRITER_END_RUN
 #endif
 
 #ifdef __cplusplus

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeaderChecker.c Tue Jan  5 23:03:24 2010
@@ -1,8 +1,9 @@
 #define CHAZ_USE_SHORT_NAMES
 
+#include "Charmonizer/Core/HeaderChecker.h"
+#include "Charmonizer/Core/Compiler.h"
 #include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/Util.h"
-#include "Charmonizer/Core/HeaderChecker.h"
 #include <string.h>
 #include <stdlib.h>
 
@@ -104,7 +105,7 @@
     strcat(code_buf, test_code);
 
     /* If the code compiles, bulk add all header names to the cache. */
-    success = ConfWriter_test_compile(code_buf, strlen(code_buf));
+    success = CC_test_compile(code_buf, strlen(code_buf));
     if (success) {
         for (i = 0; header_names[i] != NULL; i++) {
             S_maybe_add_to_cache(header_names[i], true);
@@ -130,7 +131,7 @@
     char *buf = (char*)malloc(needed);
     chaz_bool_t retval;
     sprintf(buf, contains_code, includes, struct_name, member);
-    retval = ConfWriter_test_compile(buf, strlen(buf));
+    retval = CC_test_compile(buf, strlen(buf));
     free(buf);
     return retval;
 }
@@ -158,7 +159,7 @@
 
     /* See whether code that tries to pull in this header compiles. */
     sprintf(include_test, "#include <%s>\n%s", header_name, test_code);
-    header->exists = ConfWriter_test_compile(include_test, strlen(include_test));
+    header->exists = CC_test_compile(include_test, strlen(include_test));
 
     free(include_test);
     return header;

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.c Tue Jan  5 23:03:24 2010
@@ -4,7 +4,9 @@
 #include <string.h>
 #include <stdarg.h>
 
+#include "Charmonizer/Core/Compiler.h"
 #include "Charmonizer/Core/Util.h"
+#include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/OperatingSystem.h"
 
 static char dev_null[20] = "";
@@ -22,6 +24,15 @@
 static void
 S_probe_dev_null(void);
 
+/* Compile a small wrapper application which is used to redirect error output
+ * to dev_null.
+ */
+static void
+S_build_charm_run();
+
+static chaz_bool_t charm_run_initialized = false;
+static chaz_bool_t charm_run_ok = false;
+
 void
 OS_init() 
 {
@@ -67,7 +78,7 @@
 void
 OS_clean_up(void)
 {
-    return;
+    OS_remove_exe("_charm_run");
 }
 
 const char*
@@ -88,6 +99,85 @@
     return dev_null;
 }
 
+static char charm_run_code_a[] = METAQUOTE
+    #include <stdio.h>
+    #include <stdlib.h>
+    #include <string.h>
+    #include <stddef.h>
+    int main(int argc, char **argv)
+    {
+        char *command;
+        size_t command_len = 1; /* Terminating null. */
+        int i;
+        int retval;
+        
+        /* Rebuild the command line args, minus the name of this utility. */
+        for (i = 1; i < argc; i++) {
+            command_len += strlen(argv[i]) + 1;
+        }
+        command = (char*)calloc(command_len, sizeof(char));
+METAQUOTE;
+
+static char charm_run_code_b[] = METAQUOTE
+        if (command == NULL) {
+            fprintf(stderr, "calloc failed\n");
+            exit(1);
+        }
+        for (i = 1; i < argc; i++) {
+            strcat( strcat(command, " "), argv[i] );
+        }
+
+        /* Redirect stdout and stderr to /dev/null or equivalent. */
+        freopen( 
+METAQUOTE;
+
+static char charm_run_code_c[] = METAQUOTE
+             , "w", stdout);
+        freopen( 
+METAQUOTE;
+
+static char charm_run_code_d[] = METAQUOTE
+             , "w", stderr);
+
+        /* Run the commmand and return its value to the parent process. */
+        retval = system(command);
+        free(command);
+        return retval;
+    }
+METAQUOTE;
+
+static void
+S_build_charm_run()
+{
+    chaz_bool_t compile_succeeded = false;
+    const char *dev_null = OS_dev_null();
+    size_t needed = sizeof(charm_run_code_a)
+                  + sizeof(charm_run_code_b)
+                  + strlen(dev_null)
+                  + sizeof(charm_run_code_c)
+                  + strlen(dev_null)
+                  + sizeof(charm_run_code_d)
+                  + 20;
+    char *code = (char*)malloc(needed);
+
+    sprintf(code, "%s%s \"%s\" %s \"%s\" %s", 
+        charm_run_code_a, 
+        charm_run_code_b,
+        dev_null,
+        charm_run_code_c,
+        dev_null,
+        charm_run_code_d);
+    compile_succeeded = CC_compile_exe("_charm_run.c", "_charm_run", 
+        code, strlen(code));
+    if (!compile_succeeded) {
+        Util_die("failed to compile _charm_run helper utility");
+    }
+
+    remove("_charm_run.c");
+    free(code);
+    charm_run_ok = true;
+}
+
 void
 OS_remove_exe(char *name)
 {
@@ -131,6 +221,26 @@
     return retval;
 }
 
+int
+OS_run_quietly(const char *command)
+{
+    int retval = 1;
+    
+    if (!charm_run_initialized) {
+        charm_run_initialized = true;
+        S_build_charm_run();
+    }
+
+    if (!charm_run_ok) {
+        retval = system(command);
+    }
+    else {
+        retval = OS_run_local("_charm_run ", command, NULL);
+    }
+
+    return retval;
+}
+
 /**
  * Copyright 2006 The Apache Software Foundation
  *

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.h
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.h?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.h (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperatingSystem.h Tue Jan  5 23:03:24 2010
@@ -25,6 +25,13 @@
 int 
 chaz_OS_run_local(char *arg1, ...);
 
+/* Invoke a command and attempt to suppress output from both stdout and stderr
+ * (as if they had been sent to /dev/null).  If it's not possible to run the
+ * command quietly, run it anyway.
+ */
+int 
+chaz_OS_run_quietly(const char *command);
+
 /* Return the extension for an executable on this system.
  */
 const char*
@@ -54,6 +61,7 @@
   #define OS_remove_exe                chaz_OS_remove_exe
   #define OS_remove_obj                chaz_OS_remove_obj
   #define OS_run_local                 chaz_OS_run_local
+  #define OS_run_quietly               chaz_OS_run_quietly
   #define OS_exe_ext                   chaz_OS_exe_ext
   #define OS_obj_ext                   chaz_OS_obj_ext
   #define OS_dev_null                  chaz_OS_dev_null

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe.c Tue Jan  5 23:03:24 2010
@@ -10,6 +10,11 @@
 #include "Charmonizer/Core/Compiler.h"
 #include "Charmonizer/Core/OperatingSystem.h"
 
+/* Write the "_charm.h" file used by every probe.
+ */
+static void
+S_write_charm_h();
+
 void
 Probe_init(const char *cc_command, const char *cc_flags, 
            const char *charmony_start)
@@ -20,6 +25,7 @@
     ConfWriter_init();
     HeadCheck_init();
     ConfWriter_open_charmony_h(charmony_start);
+    S_write_charm_h();
 
     if (Util_verbosity) { printf("Initialization complete.\n"); }
 }
@@ -46,7 +52,25 @@
 FILE*
 Probe_get_charmony_fh(void)
 {
-    return ConfWriter_charmony_fh;
+    return ConfWriter_get_charmony_fh();
+}
+
+static char charm_h_code[] = METAQUOTE
+    #ifndef CHARM_H
+    #define CHARM_H 1
+
+    #include <stdio.h>
+
+    #define Charm_Setup \
+        freopen("_charmonizer_target", "w", stdout)
+    
+    #endif
+METAQUOTE;
+
+static void
+S_write_charm_h()
+{
+    Util_write_file("_charm.h", charm_h_code);
 }
 
 /**

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c Tue Jan  5 23:03:24 2010
@@ -15,7 +15,7 @@
     chaz_bool_t has_sys_atomic_h       = false;
     chaz_bool_t has_intrin_h           = false;
 
-    START_RUN("AtomicOps");
+    ConfWriter_start_module("AtomicOps");
 
     if (HeadCheck_check_header("libkern/OSAtomic.h")) {
         has_libkern_osatomic_h = true;
@@ -33,7 +33,7 @@
     }
     
     /* Shorten */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     if (has_libkern_osatomic_h) {
         ConfWriter_shorten_macro("HAS_LIBKERN_OSATOMIC_H");
     }
@@ -43,9 +43,9 @@
     if (has_intrin_h) {
         ConfWriter_shorten_macro("HAS_INTRIN_H");
     }
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
 
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c Tue Jan  5 23:03:24 2010
@@ -21,7 +21,7 @@
     chaz_bool_t has_dirent_d_namlen = false;
     chaz_bool_t has_dirent_d_type   = false;
 
-    START_RUN("DirManip");
+    ConfWriter_start_module("DirManip");
     Dir_init();
 
     /* Header checks. */
@@ -103,7 +103,7 @@
     Dir_rmdir("_charm_test_remove_me");
 
     /* Shorten. */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     if (dir_sep_is_valid) { ConfWriter_shorten_macro("DIR_SEP"); }
     if (has_dirent_h)     { ConfWriter_shorten_macro("HAS_DIRENT_H"); }
     if (has_direct_h)     { ConfWriter_shorten_macro("HAS_DIRECT_H"); }
@@ -113,9 +113,9 @@
     ConfWriter_shorten_macro("MAKEDIR_MODE_IGNORED");
     if (remove_zaps_dirs) { ConfWriter_shorten_macro("REMOVE_ZAPS_DIRS"); }
 
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
 
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c Tue Jan  5 23:03:24 2010
@@ -11,7 +11,7 @@
 void
 Floats_run(void) 
 {
-    START_RUN("Floats");
+    ConfWriter_start_module("Floats");
 
     ConfWriter_append_conf(
         "typedef float chy_f32_t;\n"
@@ -31,7 +31,7 @@
     );
 
     /* Shorten. */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     ConfWriter_shorten_typedef("f32_t");
     ConfWriter_shorten_typedef("f64_t");
     ConfWriter_shorten_macro("HAS_F32_T");
@@ -39,9 +39,9 @@
     ConfWriter_shorten_macro("F32_INF");
     ConfWriter_shorten_macro("F32_NEGINF");
     ConfWriter_shorten_macro("F32_NAN");
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
     
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 /**

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c Tue Jan  5 23:03:24 2010
@@ -1,5 +1,6 @@
 #define CHAZ_USE_SHORT_NAMES
 
+#include "Charmonizer/Core/Compiler.h"
 #include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/Util.h"
 #include "Charmonizer/Probe/FuncMacro.h"
@@ -42,7 +43,7 @@
 S_try_inline(const char *keyword, size_t *output_len) {
     char code[ sizeof(inline_code) + 30 ];
     sprintf(code, inline_code, keyword);
-    return ConfWriter_capture_output(code, strlen(code), output_len);
+    return CC_capture_output(code, strlen(code), output_len);
 }
 
 static const char* inline_options[] = {
@@ -63,10 +64,10 @@
     chaz_bool_t has_gnuc_funcmac = false;
     chaz_bool_t has_inline       = false;
 
-    START_RUN("FuncMacro");
+    ConfWriter_start_module("FuncMacro");
     
     /* check for ISO func macro */
-    output = ConfWriter_capture_output(iso_func_code, strlen(iso_func_code), 
+    output = CC_capture_output(iso_func_code, strlen(iso_func_code), 
         &output_len);
     if (output != NULL && strncmp(output, "main", 4) == 0) {
         has_funcmac     = true;
@@ -75,7 +76,7 @@
     free(output);
 
     /* check for GNUC func macro */
-    output = ConfWriter_capture_output(gnuc_func_code, strlen(gnuc_func_code), 
+    output = CC_capture_output(gnuc_func_code, strlen(gnuc_func_code), 
         &output_len);
     if (output != NULL && strncmp(output, "main", 4) == 0) {
         has_funcmac      = true;
@@ -120,7 +121,7 @@
     }
 
     /* shorten */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     if (has_iso_funcmac) 
         ConfWriter_shorten_macro("HAS_ISO_FUNC_MACRO");
     if (has_gnuc_funcmac)
@@ -130,9 +131,9 @@
         ConfWriter_shorten_macro("FUNC_MACRO");
     }
     ConfWriter_shorten_macro("INLINE");
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
 
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c Tue Jan  5 23:03:24 2010
@@ -91,7 +91,7 @@
 
     keeper_count = 0;
     
-    START_RUN("Headers");
+    ConfWriter_start_module("Headers");
 
     /* Try for all POSIX headers in one blast. */
     if (HeadCheck_check_many_headers((const char**)posix_headers)) {
@@ -155,7 +155,7 @@
     }
 
     /* shorten */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     if (has_posix)
         ConfWriter_shorten_macro("HAS_POSIX");
     if (has_c89) {
@@ -166,9 +166,9 @@
         S_encode_affirmation(keepers[i]);
         ConfWriter_shorten_macro(aff_buf);
     }
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
 
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 static void

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c Tue Jan  5 23:03:24 2010
@@ -1,6 +1,7 @@
 #define CHAZ_USE_SHORT_NAMES
 
 #include "Charmonizer/Core/HeaderChecker.h"
+#include "Charmonizer/Core/Compiler.h"
 #include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/Util.h"
 #include "Charmonizer/Probe/Integers.h"
@@ -77,7 +78,7 @@
     char u64_t_postfix[10];
     char code_buf[sizeof(type64_code) + 200];
 
-    START_RUN("Integers");
+    ConfWriter_start_module("Integers");
 
     /* document endian-ness */
     if (S_machine_is_big_endian())
@@ -86,7 +87,7 @@
         ConfWriter_append_conf("#define CHY_LITTLE_END\n");
 
     /* Record sizeof() for several common integer types. */
-    output = ConfWriter_capture_output(sizes_code, strlen(sizes_code), &output_len);
+    output = CC_capture_output(sizes_code, strlen(sizes_code), &output_len);
     if (output != NULL) {
         char *end_ptr = output;
         
@@ -103,7 +104,7 @@
 
     /* determine whether long longs are available */
     sprintf(code_buf, type64_code, "long long");
-    output = ConfWriter_capture_output(code_buf, strlen(code_buf), &output_len);
+    output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
     if (output != NULL) {
         has_long_long    = true;
         sizeof_long_long = strtol(output, NULL, 10);
@@ -111,7 +112,7 @@
 
     /* determine whether the __int64 type is available */
     sprintf(code_buf, type64_code, "__int64");
-    output = ConfWriter_capture_output(code_buf, strlen(code_buf), &output_len);
+    output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
     if (output != NULL) {
         has___int64 = true;
         sizeof___int64 = strtol(output, NULL, 10);
@@ -156,26 +157,26 @@
     }
     else if (has_64) {
         sprintf(code_buf, literal64_code, "LL");
-        output = ConfWriter_capture_output(code_buf, strlen(code_buf), &output_len);
+        output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
         if (output != NULL) {
             strcpy(i64_t_postfix, "LL");
         }
         else {
             sprintf(code_buf, literal64_code, "i64");
-            output = ConfWriter_capture_output(code_buf, strlen(code_buf), &output_len);
+            output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
             if (output != NULL)
                 strcpy(i64_t_postfix, "i64");
             else
                 Util_die("64-bit types, but no literal syntax found");
         }
         sprintf(code_buf, literal64_code, "ULL");
-        output = ConfWriter_capture_output(code_buf, strlen(code_buf), &output_len);
+        output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
         if (output != NULL) {
             strcpy(u64_t_postfix, "ULL");
         }
         else {
             sprintf(code_buf, literal64_code, "Ui64");
-            output = ConfWriter_capture_output(code_buf, strlen(code_buf), &output_len);
+            output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
             if (output != NULL)
                 strcpy(u64_t_postfix, "Ui64");
             else
@@ -323,7 +324,7 @@
             sprintf(format_64_code, 
                 "%s\"%%%su\", 18446744073709551615%s%s", format_64_code_a, 
                     options[i], u64_t_postfix, format_64_code_b);
-            output = ConfWriter_capture_output(format_64_code, strlen(format_64_code),
+            output = CC_capture_output(format_64_code, strlen(format_64_code),
                 &output_len);
 
             if (   output_len != 0 
@@ -376,7 +377,7 @@
     );
 
     /* shorten */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     if ( S_machine_is_big_endian() ) {
         ConfWriter_shorten_macro("BIG_END");
     }
@@ -438,9 +439,9 @@
         ConfWriter_shorten_macro("U64_C");
         ConfWriter_shorten_macro("PTR2I64");
     }
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
     
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 static chaz_bool_t

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c Tue Jan  5 23:03:24 2010
@@ -1,6 +1,7 @@
 #define CHAZ_USE_SHORT_NAMES
 
 #include "Charmonizer/Core/HeaderChecker.h"
+#include "Charmonizer/Core/Compiler.h"
 #include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/Stat.h"
 #include "Charmonizer/Core/Util.h"
@@ -86,7 +87,7 @@
     chaz_bool_t found_pread64 = false;
     unsigned i;
 
-    START_RUN("LargeFiles");
+    ConfWriter_start_module("LargeFiles");
 
     /* see if off64_t and friends exist or have synonyms */
     for (i = 0; off64_combos[i].includes != NULL; i++) {
@@ -149,7 +150,7 @@
 
     /* short names */
     if (success) {
-        START_SHORT_NAMES;
+        ConfWriter_start_short_names();
         ConfWriter_shorten_macro("HAS_LARGE_FILE_SUPPORT");
 
         /* alias these only if they're not already provided and correct */
@@ -165,10 +166,10 @@
         if (found_pread64 && strcmp(pread64_command, "pread64") != 0) {
             ConfWriter_shorten_function("pread64");
         }
-        END_SHORT_NAMES;
+        ConfWriter_end_short_names();
     }
     
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 /* code for checking ftello64 and friends */
@@ -209,8 +210,7 @@
         combo->fseek_command);
 
     /* verify compilation and that the offset type has 8 bytes */
-    output = ConfWriter_capture_output(code_buf, strlen(code_buf), 
-        &output_len);
+    output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
     if (output != NULL) {
         long size = strtol(output, NULL, 10);
         if (size == 8)
@@ -249,8 +249,7 @@
 
     /* Verify compilation. */
     sprintf(code_buf, lseek_code, combo->includes, combo->lseek_command);
-    output = ConfWriter_capture_output(code_buf, strlen(code_buf), 
-        &output_len);
+    output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
     if (output != NULL) {
         success = true;
         free(output);
@@ -287,8 +286,7 @@
 
     /* Verify compilation. */
     sprintf(code_buf, pread64_code, combo->includes, combo->pread64_command);
-    output = ConfWriter_capture_output(code_buf, strlen(code_buf), 
-        &output_len);
+    output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
     if (output != NULL) {
         success = true;
         free(output);
@@ -389,7 +387,7 @@
     /* concat the source strings, compile the file, capture output */
     sprintf(code_buf, "%s%s%s", create_bigfile_code_a, fseek_command, 
         create_bigfile_code_b);
-    output = ConfWriter_capture_output(code_buf, strlen(code_buf), &output_len);
+    output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
 
     /* truncate, just in case the call to remove fails */
     truncating_fh = fopen("_charm_large_file_test", "w");

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c Tue Jan  5 23:03:24 2010
@@ -10,19 +10,19 @@
 void
 UnusedVars_run(void) 
 {
-    START_RUN("UnusedVars");
+    ConfWriter_start_module("UnusedVars");
     
     /* write the macros (no test, these are the same everywhere) */
     ConfWriter_append_conf("#define CHY_UNUSED_VAR(x) ((void)x)\n");
     ConfWriter_append_conf("#define CHY_UNREACHABLE_RETURN(type) return (type)0\n");
 
     /* shorten */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     ConfWriter_shorten_macro("UNUSED_VAR");
     ConfWriter_shorten_macro("UNREACHABLE_RETURN");
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
 
-    END_RUN;
+    ConfWriter_end_module();
 }
 
 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c?rev=896262&r1=896261&r2=896262&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c Tue Jan  5 23:03:24 2010
@@ -1,5 +1,6 @@
 #define CHAZ_USE_SHORT_NAMES
 
+#include "Charmonizer/Core/Compiler.h"
 #include "Charmonizer/Core/ConfWriter.h"
 #include "Charmonizer/Core/Util.h"
 #include "Charmonizer/Probe/VariadicMacros.h"
@@ -40,10 +41,10 @@
     chaz_bool_t has_iso_varmacros  = false;
     chaz_bool_t has_gnuc_varmacros = false;
 
-    START_RUN("VariadicMacros");
+    ConfWriter_start_module("VariadicMacros");
 
     /* test for ISO-style variadic macros */
-    output = ConfWriter_capture_output(iso_code, strlen(iso_code), &output_len);
+    output = CC_capture_output(iso_code, strlen(iso_code), &output_len);
     if (output != NULL) {
         has_varmacros = true;
         has_iso_varmacros = true;
@@ -52,7 +53,7 @@
     }
 
     /* test for GNU-style variadic macros */
-    output = ConfWriter_capture_output(gnuc_code, strlen(gnuc_code), &output_len);
+    output = CC_capture_output(gnuc_code, strlen(gnuc_code), &output_len);
     if (output != NULL) {
         has_gnuc_varmacros = true;
         if (has_varmacros == false) {
@@ -63,16 +64,16 @@
     }
 
     /* shorten */
-    START_SHORT_NAMES;
+    ConfWriter_start_short_names();
     if (has_varmacros)
         ConfWriter_shorten_macro("HAS_VARIADIC_MACROS");
     if (has_iso_varmacros)
         ConfWriter_shorten_macro("HAS_ISO_VARIADIC_MACROS");
     if (has_gnuc_varmacros)
         ConfWriter_shorten_macro("HAS_GNUC_VARIADIC_MACROS");
-    END_SHORT_NAMES;
+    ConfWriter_end_short_names();
 
-    END_RUN;
+    ConfWriter_end_module();
 }