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 2011/06/19 08:08:20 UTC

[lucy-commits] svn commit: r1137295 - in /incubator/lucy/trunk: charmonizer/charmonize.c charmonizer/src/Charmonizer/Probe.c charmonizer/src/Charmonizer/Probe.h perl/buildlib/Lucy/Build.pm ruby/Rakefile

Author: marvin
Date: Sun Jun 19 06:08:20 2011
New Revision: 1137295

URL: http://svn.apache.org/viewvc?rev=1137295&view=rev
Log:
Process Charmonizer's verbosity as an environment variable rather than a
command-line argument.

Modified:
    incubator/lucy/trunk/charmonizer/charmonize.c
    incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.c
    incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.h
    incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm
    incubator/lucy/trunk/ruby/Rakefile

Modified: incubator/lucy/trunk/charmonizer/charmonize.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/charmonize.c?rev=1137295&r1=1137294&r2=1137295&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/charmonize.c (original)
+++ incubator/lucy/trunk/charmonizer/charmonize.c Sun Jun 19 06:08:20 2011
@@ -36,18 +36,14 @@
 
 int main(int argc, char **argv) {
     /* Parse and process arguments. */
-    if (argc < 3) {
+    if (argc != 3) {
         fprintf(stderr,
-                "Usage: ./charmonize CC_COMMAND CC_FLAGS [VERBOSITY]\n");
+                "Usage: ./charmonize CC_COMMAND CC_FLAGS\n");
         exit(1);
     }
     else {
         char *cc_command = argv[1];
         char *cc_flags   = argv[2];
-        if (argc > 3) {
-            const long verbosity = strtol(argv[3], NULL, 10);
-            chaz_Probe_set_verbosity(verbosity);
-        }
         chaz_Probe_init(cc_command, cc_flags, NULL);
     }
 

Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.c?rev=1137295&r1=1137294&r2=1137295&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.c Sun Jun 19 06:08:20 2011
@@ -35,6 +35,12 @@ S_write_charm_h(void);
 void
 Probe_init(const char *cc_command, const char *cc_flags,
            const char *charmony_start) {
+    /* Proces CHARM_VERBOSITY environment variable. */
+    const char *verbosity_env = getenv("CHARM_VERBOSITY");
+    if (verbosity_env && strlen(verbosity_env)) {
+        Util_verbosity = strtol(verbosity_env, NULL, 10);
+    }
+
     /* Dispatch other initializers. */
     OS_init();
     CC_init(cc_command, cc_flags);
@@ -59,11 +65,6 @@ Probe_clean_up(void) {
     if (Util_verbosity) { printf("Cleanup complete.\n"); }
 }
 
-void
-Probe_set_verbosity(int level) {
-    Util_verbosity = level;
-}
-
 FILE*
 Probe_get_charmony_fh(void) {
     return ConfWriter_get_charmony_fh();

Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.h?rev=1137295&r1=1137294&r2=1137295&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe.h Sun Jun 19 06:08:20 2011
@@ -26,6 +26,13 @@ extern "C" {
 
 /* Set up the Charmonizer environment.  This should be called before anything
  * else.
+ * 
+ * If the environment variable CHARM_VERBOSITY has been set, it will be
+ * processed at this time:
+ *
+ *      0 - silent
+ *      1 - normal
+ *      2 - debugging
  *
  * @param cc_command the string used to invoke the C compiler via system()
  * @param cc_flags flags which will be passed on to the C compiler
@@ -41,14 +48,6 @@ chaz_Probe_init(const char *cc_command, 
 void
 chaz_Probe_clean_up(void);
 
-/* Determine how much feedback Charmonizer provides.
- * 0 - silent
- * 1 - normal
- * 2 - debugging
- */
-void
-chaz_Probe_set_verbosity(int level);
-
 /* Access the FILE* used to write charmony.h, so that you can write your own
  * content to it.  Should not be called before chaz_Probe_init() or after
  * chaz_Probe_clean_up().
@@ -59,7 +58,6 @@ chaz_Probe_get_charmony_fh(void);
 #ifdef CHAZ_USE_SHORT_NAMES
   #define Probe_init            chaz_Probe_init
   #define Probe_clean_up        chaz_Probe_clean_up
-  #define Probe_set_verbosity   chaz_Probe_set_verbosity
   #define Probe_get_charmony_fh chaz_Probe_get_charmony_fh
 #endif
 

Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm?rev=1137295&r1=1137294&r2=1137295&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm Sun Jun 19 06:08:20 2011
@@ -172,7 +172,6 @@ sub ACTION_charmony {
     my $flags = $self->config('ccflags') . ' ' . $self->extra_ccflags;
     $flags =~ s/"/\\"/g;
     my @command = ( $CHARMONIZE_EXE_PATH, $self->config('cc'), $flags );
-    push @command, 2 if $ENV{DEBUG_CHARM};
     if ( $ENV{CHARM_VALGRIND} ) {
         unshift @command, "valgrind", "--leak-check=yes";
     }

Modified: incubator/lucy/trunk/ruby/Rakefile
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/ruby/Rakefile?rev=1137295&r1=1137294&r2=1137295&view=diff
==============================================================================
--- incubator/lucy/trunk/ruby/Rakefile (original)
+++ incubator/lucy/trunk/ruby/Rakefile Sun Jun 19 06:08:20 2011
@@ -76,16 +76,15 @@ task :charmony => [:charmonize] do
 
   # Prepare arguments to charmonize.
   flags = all_ccflags
-  verbosity = ENV["DEBUG_CHARM"] ? 2 : 1;
 
   if ENV["CHARM_VALGRIND"]
     success = system("valgrind",  "--leak-check=yes", CHARMONIZE_EXE_PATH, 
-      cc_command, flags, verbosity.to_s)
+      cc_command, flags)
     if !success
       raise "Failed to write charmony.h"
     end
   else
-    success = system(CHARMONIZE_EXE_PATH, cc_command, flags, verbosity.to_s)
+    success = system(CHARMONIZE_EXE_PATH, cc_command, flags)
     if !success
       raise "Failed to write charmony.h"
     end