Regenerate charmonizer.c

Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/8e5363d3
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/8e5363d3
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/8e5363d3

Branch: refs/heads/c-bindings-cfc
Commit: 8e5363d36249f0e76a8ebf9461bf231b357eb8aa
Parents: 074a997
Author: Nick Wellnhofer <[email protected]>
Authored: Tue Feb 12 22:32:19 2013 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Tue Feb 12 23:03:17 2013 +0100

----------------------------------------------------------------------
 clownfish/compiler/common/charmonizer.c |   39 ++++++++++++++++++++-----
 clownfish/runtime/common/charmonizer.c  |   30 +++++++++++++++----
 common/charmonizer.c                    |   30 +++++++++++++++----
 3 files changed, 77 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/8e5363d3/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c 
b/clownfish/compiler/common/charmonizer.c
index d687b02..7d36eef 100644
--- a/clownfish/compiler/common/charmonizer.c
+++ b/clownfish/compiler/common/charmonizer.c
@@ -2469,6 +2469,7 @@ chaz_HeadCheck_maybe_add_to_cache(const char 
*header_name, int exists) {
 /***************************************************************************/
 
 #line 17 "src/Charmonizer/Core/Make.c"
+#include <ctype.h>
 #include <string.h>
 /* #include "Charmonizer/Core/Make.h" */
 /* #include "Charmonizer/Core/Compiler.h" */
@@ -2779,7 +2780,7 @@ chaz_MakeFile_write(chaz_MakeFile *makefile) {
             fprintf(file, "clean :\n");
             for (i = 0; makefile->cleanups[i]; i++) {
                 const char *cleanup = makefile->cleanups[i];
-                fprintf(file, "\tfor %%i in (%s) do if exist %%i del /f %%i\n",
+                fprintf(file, "\tfor %%i in (%s) do @if exist %%i del /f 
%%i\n",
                         cleanup);
             }
             fprintf(file, "\n");
@@ -2791,17 +2792,28 @@ chaz_MakeFile_write(chaz_MakeFile *makefile) {
 
     fprintf(file, "distclean : clean\n");
     if (shell_type == CHAZ_OS_POSIX) {
-        fprintf(file, "\trm -f charmonizer charmony.h Makefile\n\n");
+        fprintf(file, "\trm -f charmonizer$(EXE_EXT) charmony.h Makefile\n\n");
     }
     else if (shell_type == CHAZ_OS_CMD_EXE) {
         fprintf(file,
-            "\tfor %%i in (charmonizer charmony.h Makefile) do"
-            " if exist %%i del /f %%i\n\n");
+            "\tfor %%i in (charmonizer$(EXE_EXT) charmonizer$(OBJ_EXT)"
+            " charmony.h Makefile) do @if exist %%i del /f %%i\n\n");
     }
     else {
         chaz_Util_die("Unsupported shell type: %d", shell_type);
     }
 
+    if (chaz_Make.is_nmake) {
+        /* Inference rule for .c files. */
+        fprintf(file, ".c.obj :\n");
+        if (chaz_CC_msvc_version_num()) {
+            fprintf(file, "\t$(CC) $(CFLAGS) /c $< /Fo$@\n\n");
+        }
+        else {
+            fprintf(file, "\t$(CC) $(CFLAGS) -c $< -o $@\n\n");
+        }
+    }
+
     fclose(file);
 }
 
@@ -2975,7 +2987,7 @@ chaz_Make_list_files(const char *dir, const char *ext,
          * path of the directory. This is done by using the variable
          * substitution feature of the 'for' command.
          */
-        pattern = "for %%I in (%s) do echo %%~fI";
+        pattern = "for %%I in (%s) do @echo %%~fI";
         command_size = strlen(pattern) + strlen(dir) + 10;
         command = (char*)malloc(command_size);
         sprintf(command, pattern, dir);
@@ -2983,7 +2995,10 @@ chaz_Make_list_files(const char *dir, const char *ext,
         free(command);
         if (!output) { chaz_Util_die("Failed to find absolute path"); }
 
-        prefix_len = strcspn(output, "\r\n");
+        /* Strip whitespace from end of output. */
+        for (prefix_len = output_len; prefix_len > 0; --prefix_len) {
+            if (!isspace(output[prefix_len-1])) { break; }
+        }
         prefix = (char*)malloc(prefix_len + 2);
         memcpy(prefix, output, prefix_len);
         prefix[prefix_len++] = '\\';
@@ -2997,7 +3012,8 @@ chaz_Make_list_files(const char *dir, const char *ext,
         if (strlen(file) <= prefix_len
             || memcmp(file, prefix, prefix_len) != 0
            ) {
-            chaz_Util_die("Unexpected file name");
+            chaz_Util_die("Expected prefix '%s' for file name '%s'", prefix,
+                          file);
         }
 
         callback(file + prefix_len, context);
@@ -4537,7 +4553,11 @@ chaz_Strings_probe_c99_snprintf(void) {
 /* #include "Charmonizer/Probe.h" */
 /* #include "Charmonizer/Probe/Integers.h" */
 
-#define DIR_SEP "/"
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  #define DIR_SEP "\\"
+#else
+  #define DIR_SEP "/"
+#endif
 
 typedef struct SourceFileContext {
     chaz_MakeVar *common_objs;
@@ -4648,6 +4668,9 @@ S_write_makefile() {
 
     chaz_MakeFile_add_var(makefile, "CC", chaz_CC_get_cc());
 
+    if (chaz_CC_msvc_version_num()) {
+        chaz_CC_add_extra_cflags("/nologo");
+    }
     chaz_CC_set_optimization_level("2");
     chaz_CC_add_include_dir(".");
     chaz_CC_add_include_dir("$(INCLUDE_DIR)");

http://git-wip-us.apache.org/repos/asf/lucy/blob/8e5363d3/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c 
b/clownfish/runtime/common/charmonizer.c
index 23f5cb1..055658a 100644
--- a/clownfish/runtime/common/charmonizer.c
+++ b/clownfish/runtime/common/charmonizer.c
@@ -2751,6 +2751,7 @@ chaz_HeadCheck_maybe_add_to_cache(const char 
*header_name, int exists) {
 /***************************************************************************/
 
 #line 17 "src/Charmonizer/Core/Make.c"
+#include <ctype.h>
 #include <string.h>
 /* #include "Charmonizer/Core/Make.h" */
 /* #include "Charmonizer/Core/Compiler.h" */
@@ -3061,7 +3062,7 @@ chaz_MakeFile_write(chaz_MakeFile *makefile) {
             fprintf(file, "clean :\n");
             for (i = 0; makefile->cleanups[i]; i++) {
                 const char *cleanup = makefile->cleanups[i];
-                fprintf(file, "\tfor %%i in (%s) do if exist %%i del /f %%i\n",
+                fprintf(file, "\tfor %%i in (%s) do @if exist %%i del /f 
%%i\n",
                         cleanup);
             }
             fprintf(file, "\n");
@@ -3073,17 +3074,28 @@ chaz_MakeFile_write(chaz_MakeFile *makefile) {
 
     fprintf(file, "distclean : clean\n");
     if (shell_type == CHAZ_OS_POSIX) {
-        fprintf(file, "\trm -f charmonizer charmony.h Makefile\n\n");
+        fprintf(file, "\trm -f charmonizer$(EXE_EXT) charmony.h Makefile\n\n");
     }
     else if (shell_type == CHAZ_OS_CMD_EXE) {
         fprintf(file,
-            "\tfor %%i in (charmonizer charmony.h Makefile) do"
-            " if exist %%i del /f %%i\n\n");
+            "\tfor %%i in (charmonizer$(EXE_EXT) charmonizer$(OBJ_EXT)"
+            " charmony.h Makefile) do @if exist %%i del /f %%i\n\n");
     }
     else {
         chaz_Util_die("Unsupported shell type: %d", shell_type);
     }
 
+    if (chaz_Make.is_nmake) {
+        /* Inference rule for .c files. */
+        fprintf(file, ".c.obj :\n");
+        if (chaz_CC_msvc_version_num()) {
+            fprintf(file, "\t$(CC) $(CFLAGS) /c $< /Fo$@\n\n");
+        }
+        else {
+            fprintf(file, "\t$(CC) $(CFLAGS) -c $< -o $@\n\n");
+        }
+    }
+
     fclose(file);
 }
 
@@ -3257,7 +3269,7 @@ chaz_Make_list_files(const char *dir, const char *ext,
          * path of the directory. This is done by using the variable
          * substitution feature of the 'for' command.
          */
-        pattern = "for %%I in (%s) do echo %%~fI";
+        pattern = "for %%I in (%s) do @echo %%~fI";
         command_size = strlen(pattern) + strlen(dir) + 10;
         command = (char*)malloc(command_size);
         sprintf(command, pattern, dir);
@@ -3265,7 +3277,10 @@ chaz_Make_list_files(const char *dir, const char *ext,
         free(command);
         if (!output) { chaz_Util_die("Failed to find absolute path"); }
 
-        prefix_len = strcspn(output, "\r\n");
+        /* Strip whitespace from end of output. */
+        for (prefix_len = output_len; prefix_len > 0; --prefix_len) {
+            if (!isspace(output[prefix_len-1])) { break; }
+        }
         prefix = (char*)malloc(prefix_len + 2);
         memcpy(prefix, output, prefix_len);
         prefix[prefix_len++] = '\\';
@@ -3279,7 +3294,8 @@ chaz_Make_list_files(const char *dir, const char *ext,
         if (strlen(file) <= prefix_len
             || memcmp(file, prefix, prefix_len) != 0
            ) {
-            chaz_Util_die("Unexpected file name");
+            chaz_Util_die("Expected prefix '%s' for file name '%s'", prefix,
+                          file);
         }
 
         callback(file + prefix_len, context);

http://git-wip-us.apache.org/repos/asf/lucy/blob/8e5363d3/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 4c5275d..71b71e5 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -2751,6 +2751,7 @@ chaz_HeadCheck_maybe_add_to_cache(const char 
*header_name, int exists) {
 /***************************************************************************/
 
 #line 17 "src/Charmonizer/Core/Make.c"
+#include <ctype.h>
 #include <string.h>
 /* #include "Charmonizer/Core/Make.h" */
 /* #include "Charmonizer/Core/Compiler.h" */
@@ -3061,7 +3062,7 @@ chaz_MakeFile_write(chaz_MakeFile *makefile) {
             fprintf(file, "clean :\n");
             for (i = 0; makefile->cleanups[i]; i++) {
                 const char *cleanup = makefile->cleanups[i];
-                fprintf(file, "\tfor %%i in (%s) do if exist %%i del /f %%i\n",
+                fprintf(file, "\tfor %%i in (%s) do @if exist %%i del /f 
%%i\n",
                         cleanup);
             }
             fprintf(file, "\n");
@@ -3073,17 +3074,28 @@ chaz_MakeFile_write(chaz_MakeFile *makefile) {
 
     fprintf(file, "distclean : clean\n");
     if (shell_type == CHAZ_OS_POSIX) {
-        fprintf(file, "\trm -f charmonizer charmony.h Makefile\n\n");
+        fprintf(file, "\trm -f charmonizer$(EXE_EXT) charmony.h Makefile\n\n");
     }
     else if (shell_type == CHAZ_OS_CMD_EXE) {
         fprintf(file,
-            "\tfor %%i in (charmonizer charmony.h Makefile) do"
-            " if exist %%i del /f %%i\n\n");
+            "\tfor %%i in (charmonizer$(EXE_EXT) charmonizer$(OBJ_EXT)"
+            " charmony.h Makefile) do @if exist %%i del /f %%i\n\n");
     }
     else {
         chaz_Util_die("Unsupported shell type: %d", shell_type);
     }
 
+    if (chaz_Make.is_nmake) {
+        /* Inference rule for .c files. */
+        fprintf(file, ".c.obj :\n");
+        if (chaz_CC_msvc_version_num()) {
+            fprintf(file, "\t$(CC) $(CFLAGS) /c $< /Fo$@\n\n");
+        }
+        else {
+            fprintf(file, "\t$(CC) $(CFLAGS) -c $< -o $@\n\n");
+        }
+    }
+
     fclose(file);
 }
 
@@ -3257,7 +3269,7 @@ chaz_Make_list_files(const char *dir, const char *ext,
          * path of the directory. This is done by using the variable
          * substitution feature of the 'for' command.
          */
-        pattern = "for %%I in (%s) do echo %%~fI";
+        pattern = "for %%I in (%s) do @echo %%~fI";
         command_size = strlen(pattern) + strlen(dir) + 10;
         command = (char*)malloc(command_size);
         sprintf(command, pattern, dir);
@@ -3265,7 +3277,10 @@ chaz_Make_list_files(const char *dir, const char *ext,
         free(command);
         if (!output) { chaz_Util_die("Failed to find absolute path"); }
 
-        prefix_len = strcspn(output, "\r\n");
+        /* Strip whitespace from end of output. */
+        for (prefix_len = output_len; prefix_len > 0; --prefix_len) {
+            if (!isspace(output[prefix_len-1])) { break; }
+        }
         prefix = (char*)malloc(prefix_len + 2);
         memcpy(prefix, output, prefix_len);
         prefix[prefix_len++] = '\\';
@@ -3279,7 +3294,8 @@ chaz_Make_list_files(const char *dir, const char *ext,
         if (strlen(file) <= prefix_len
             || memcmp(file, prefix, prefix_len) != 0
            ) {
-            chaz_Util_die("Unexpected file name");
+            chaz_Util_die("Expected prefix '%s' for file name '%s'", prefix,
+                          file);
         }
 
         callback(file + prefix_len, context);

Reply via email to