lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [7/9] Remove Charmonizer from repo
Date Mon, 10 Mar 2014 20:40:11 GMT
http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c b/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c
deleted file mode 100644
index 8592659..0000000
--- a/charmonizer/src/Charmonizer/Core/ConfWriterPerl.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Charmonizer/Core/Util.h"
-#include "Charmonizer/Core/ConfWriter.h"
-#include "Charmonizer/Core/ConfWriterPerl.h"
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Static vars. */
-static struct {
-    FILE *fh;
-} chaz_CWPerl = { NULL };
-static chaz_ConfWriter CWPerl_conf_writer;
-
-/* Open the Charmony.pm file handle.
- */
-static void
-chaz_ConfWriterPerl_open_config_pm(void);
-
-static void
-chaz_ConfWriterPerl_clean_up(void);
-static void
-chaz_ConfWriterPerl_vappend_conf(const char *fmt, va_list args);
-static void
-chaz_ConfWriterPerl_add_def(const char *sym, const char *value);
-static void
-chaz_ConfWriterPerl_add_global_def(const char *sym, const char *value);
-static void
-chaz_ConfWriterPerl_add_typedef(const char *type, const char *alias);
-static void
-chaz_ConfWriterPerl_add_global_typedef(const char *type, const char *alias);
-static void
-chaz_ConfWriterPerl_add_sys_include(const char *header);
-static void
-chaz_ConfWriterPerl_add_local_include(const char *header);
-static void
-chaz_ConfWriterPerl_start_module(const char *module_name);
-static void
-chaz_ConfWriterPerl_end_module(void);
-
-void
-chaz_ConfWriterPerl_enable(void) {
-    CWPerl_conf_writer.clean_up           = chaz_ConfWriterPerl_clean_up;
-    CWPerl_conf_writer.vappend_conf       = chaz_ConfWriterPerl_vappend_conf;
-    CWPerl_conf_writer.add_def            = chaz_ConfWriterPerl_add_def;
-    CWPerl_conf_writer.add_global_def     = chaz_ConfWriterPerl_add_global_def;
-    CWPerl_conf_writer.add_typedef        = chaz_ConfWriterPerl_add_typedef;
-    CWPerl_conf_writer.add_global_typedef = chaz_ConfWriterPerl_add_global_typedef;
-    CWPerl_conf_writer.add_sys_include    = chaz_ConfWriterPerl_add_sys_include;
-    CWPerl_conf_writer.add_local_include  = chaz_ConfWriterPerl_add_local_include;
-    CWPerl_conf_writer.start_module       = chaz_ConfWriterPerl_start_module;
-    CWPerl_conf_writer.end_module         = chaz_ConfWriterPerl_end_module;
-    chaz_ConfWriterPerl_open_config_pm();
-    chaz_ConfWriter_add_writer(&CWPerl_conf_writer);
-    return;
-}
-
-static void
-chaz_ConfWriterPerl_open_config_pm(void) {
-    /* Open the filehandle. */
-    chaz_CWPerl.fh = fopen("Charmony.pm", "w+");
-    if (chaz_CWPerl.fh == NULL) {
-        chaz_Util_die("Can't open 'Charmony.pm': %s", strerror(errno));
-    }
-
-    /* Start the module. */
-    fprintf(chaz_CWPerl.fh,
-            "# Auto-generated by Charmonizer. \n"
-            "# DO NOT EDIT THIS FILE!!\n"
-            "\n"
-            "package Charmony;\n"
-            "use strict;\n"
-            "use warnings;\n"
-            "\n"
-            "my %%defs;\n"
-            "\n"
-            "sub config { \\%%defs }\n"
-            "\n"
-           );
-}
-
-static void
-chaz_ConfWriterPerl_clean_up(void) {
-    /* Write the last bit of Charmony.pm and close. */
-    fprintf(chaz_CWPerl.fh, "\n1;\n\n");
-    if (fclose(chaz_CWPerl.fh)) {
-        chaz_Util_die("Couldn't close 'Charmony.pm': %s", strerror(errno));
-    }
-}
-
-static void
-chaz_ConfWriterPerl_vappend_conf(const char *fmt, va_list args) {
-    (void)fmt;
-    (void)args;
-}
-
-static char*
-chaz_ConfWriterPerl_quotify(const char *string, char *buf, size_t buf_size) {
-    char *quoted = buf;
-
-    /* Don't bother with undef values here. */
-    if (!string) {
-        return NULL;
-    }
-
-    /* Allocate memory if necessary. */
-    {
-        const char *ptr;
-        size_t space = 3; /* Quotes plus NUL termination. */
-        for (ptr = string; *ptr; ptr++) {
-            if (*ptr == '\'' || *ptr == '\\') {
-                space += 2;
-            }
-            else {
-                space += 1;
-            }
-        }
-        if (space > buf_size) {
-            quoted = (char*)malloc(space);
-        }
-    }
-
-    /* Perform copying and escaping */
-    {
-        const char *ptr;
-        size_t pos = 0;
-        quoted[pos++] = '\'';
-        for (ptr = string; *ptr; ptr++) {
-            if (*ptr == '\'' || *ptr == '\\') {
-                quoted[pos++] = '\\';
-            }
-            quoted[pos++] = *ptr;
-        }
-        quoted[pos++] = '\'';
-        quoted[pos++] = '\0';
-    }
-
-    return quoted;
-}
-
-#define CFPERL_MAX_BUF 100
-static void
-chaz_ConfWriterPerl_add_def(const char *sym, const char *value) {
-    char sym_buf[CFPERL_MAX_BUF + 1];
-    char value_buf[CFPERL_MAX_BUF + 1];
-    char *quoted_sym;
-    char *quoted_value;
-
-    /* Quote key. */
-    if (!sym) {
-        chaz_Util_die("Can't handle NULL key");
-    }
-    quoted_sym = chaz_ConfWriterPerl_quotify(sym, sym_buf, CFPERL_MAX_BUF);
-
-    /* Quote value or use "undef". */
-    if (!value) {
-        strcpy(value_buf, "undef");
-        quoted_value = value_buf;
-    }
-    else {
-        quoted_value = chaz_ConfWriterPerl_quotify(value, value_buf,
-                                                CFPERL_MAX_BUF);
-    }
-
-    fprintf(chaz_CWPerl.fh, "$defs{%s} = %s;\n", quoted_sym, quoted_value);
-
-    if (quoted_sym   != sym_buf)   { free(quoted_sym);   }
-    if (quoted_value != value_buf) { free(quoted_value); }
-}
-
-static void
-chaz_ConfWriterPerl_add_global_def(const char *sym, const char *value) {
-    (void)sym;
-    (void)value;
-}
-
-static void
-chaz_ConfWriterPerl_add_typedef(const char *type, const char *alias) {
-    (void)type;
-    (void)alias;
-}
-
-static void
-chaz_ConfWriterPerl_add_global_typedef(const char *type, const char *alias) {
-    (void)type;
-    (void)alias;
-}
-
-static void
-chaz_ConfWriterPerl_add_sys_include(const char *header) {
-    (void)header;
-}
-
-static void
-chaz_ConfWriterPerl_add_local_include(const char *header) {
-    (void)header;
-}
-
-static void
-chaz_ConfWriterPerl_start_module(const char *module_name) {
-    fprintf(chaz_CWPerl.fh, "# %s\n", module_name);
-}
-
-static void
-chaz_ConfWriterPerl_end_module(void) {
-    fprintf(chaz_CWPerl.fh, "\n");
-}
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/ConfWriterPerl.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterPerl.h b/charmonizer/src/Charmonizer/Core/ConfWriterPerl.h
deleted file mode 100644
index 136ede8..0000000
--- a/charmonizer/src/Charmonizer/Core/ConfWriterPerl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Core/ConfWriterPerl.h -- Write to a Perl module file.
- */
-
-#ifndef H_CHAZ_CONFWRITERPERL
-#define H_CHAZ_CONFWRITERPERL 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enable writing config to a Perl module file.
- */
-void
-chaz_ConfWriterPerl_enable(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_CONFWRITERPERL */
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/ConfWriterPython.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterPython.c b/charmonizer/src/Charmonizer/Core/ConfWriterPython.c
deleted file mode 100644
index e4cc58b..0000000
--- a/charmonizer/src/Charmonizer/Core/ConfWriterPython.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Charmonizer/Core/Util.h"
-#include "Charmonizer/Core/ConfWriter.h"
-#include "Charmonizer/Core/ConfWriterPython.h"
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Static vars. */
-static struct {
-    FILE *fh;
-} chaz_CWPython = { NULL };
-static chaz_ConfWriter CWPython_conf_writer;
-
-/* Open the charmony.py file handle.
- */
-static void
-chaz_ConfWriterPython_open_config_py(void);
-
-static void
-chaz_ConfWriterPython_clean_up(void);
-static void
-chaz_ConfWriterPython_vappend_conf(const char *fmt, va_list args);
-static void
-chaz_ConfWriterPython_add_def(const char *sym, const char *value);
-static void
-chaz_ConfWriterPython_add_global_def(const char *sym, const char *value);
-static void
-chaz_ConfWriterPython_add_typedef(const char *type, const char *alias);
-static void
-chaz_ConfWriterPython_add_global_typedef(const char *type, const char *alias);
-static void
-chaz_ConfWriterPython_add_sys_include(const char *header);
-static void
-chaz_ConfWriterPython_add_local_include(const char *header);
-static void
-chaz_ConfWriterPython_start_module(const char *module_name);
-static void
-chaz_ConfWriterPython_end_module(void);
-
-void
-chaz_ConfWriterPython_enable(void) {
-    CWPython_conf_writer.clean_up           = chaz_ConfWriterPython_clean_up;
-    CWPython_conf_writer.vappend_conf       = chaz_ConfWriterPython_vappend_conf;
-    CWPython_conf_writer.add_def            = chaz_ConfWriterPython_add_def;
-    CWPython_conf_writer.add_global_def     = chaz_ConfWriterPython_add_global_def;
-    CWPython_conf_writer.add_typedef        = chaz_ConfWriterPython_add_typedef;
-    CWPython_conf_writer.add_global_typedef = chaz_ConfWriterPython_add_global_typedef;
-    CWPython_conf_writer.add_sys_include    = chaz_ConfWriterPython_add_sys_include;
-    CWPython_conf_writer.add_local_include  = chaz_ConfWriterPython_add_local_include;
-    CWPython_conf_writer.start_module       = chaz_ConfWriterPython_start_module;
-    CWPython_conf_writer.end_module         = chaz_ConfWriterPython_end_module;
-    chaz_ConfWriterPython_open_config_py();
-    chaz_ConfWriter_add_writer(&CWPython_conf_writer);
-    return;
-}
-
-static void
-chaz_ConfWriterPython_open_config_py(void) {
-    /* Open the filehandle. */
-    chaz_CWPython.fh = fopen("charmony.py", "w+");
-    if (chaz_CWPython.fh == NULL) {
-        chaz_Util_die("Can't open 'charmony.py': %s", strerror(errno));
-    }
-
-    /* Start the module. */
-    fprintf(chaz_CWPython.fh,
-            "# Auto-generated by Charmonizer. \n"
-            "# DO NOT EDIT THIS FILE!!\n"
-            "\n"
-            "class Charmony(object):\n"
-            "    @classmethod\n"
-            "    def config(cls):\n"
-            "        return cls.defs\n"
-            "\n"
-            "    defs = {}\n"
-            "\n"
-           );
-}
-
-static void
-chaz_ConfWriterPython_clean_up(void) {
-    /* No more code necessary to finish charmony.py, so just close. */
-    if (fclose(chaz_CWPython.fh)) {
-        chaz_Util_die("Couldn't close 'charmony.py': %s", strerror(errno));
-    }
-}
-
-static void
-chaz_ConfWriterPython_vappend_conf(const char *fmt, va_list args) {
-    (void)fmt;
-    (void)args;
-}
-
-static char*
-chaz_ConfWriterPython_quotify(const char *string, char *buf, size_t buf_size) {
-    char *quoted = buf;
-
-    /* Don't bother with NULL values here. */
-    if (!string) {
-        return NULL;
-    }
-
-    /* Allocate memory if necessary. */
-    {
-        const char *ptr;
-        size_t space = 3; /* Quotes plus NUL termination. */
-        for (ptr = string; *ptr; ptr++) {
-            if (*ptr == '\'' || *ptr == '\\') {
-                space += 2;
-            }
-            else {
-                space += 1;
-            }
-        }
-        if (space > buf_size) {
-            quoted = (char*)malloc(space);
-        }
-    }
-
-    /* Perform copying and escaping */
-    {
-        const char *ptr;
-        size_t pos = 0;
-        quoted[pos++] = '\'';
-        for (ptr = string; *ptr; ptr++) {
-            if (*ptr == '\'' || *ptr == '\\') {
-                quoted[pos++] = '\\';
-            }
-            quoted[pos++] = *ptr;
-        }
-        quoted[pos++] = '\'';
-        quoted[pos++] = '\0';
-    }
-
-    return quoted;
-}
-
-#define CFPYTHON_MAX_BUF 100
-static void
-chaz_ConfWriterPython_add_def(const char *sym, const char *value) {
-    char sym_buf[CFPYTHON_MAX_BUF + 1];
-    char value_buf[CFPYTHON_MAX_BUF + 1];
-    char *quoted_sym;
-    char *quoted_value;
-
-    /* Quote key. */
-    if (!sym) {
-        chaz_Util_die("Can't handle NULL key");
-    }
-    quoted_sym = chaz_ConfWriterPython_quotify(sym, sym_buf, CFPYTHON_MAX_BUF);
-
-    /* Quote value or use "None". */
-    if (!value) {
-        strcpy(value_buf, "None");
-        quoted_value = value_buf;
-    }
-    else {
-        quoted_value = chaz_ConfWriterPython_quotify(value, value_buf,
-                                                     CFPYTHON_MAX_BUF);
-    }
-
-    fprintf(chaz_CWPython.fh, "    defs[%s] = %s\n", quoted_sym, quoted_value);
-
-    if (quoted_sym   != sym_buf)   { free(quoted_sym);   }
-    if (quoted_value != value_buf) { free(quoted_value); }
-}
-
-static void
-chaz_ConfWriterPython_add_global_def(const char *sym, const char *value) {
-    (void)sym;
-    (void)value;
-}
-
-static void
-chaz_ConfWriterPython_add_typedef(const char *type, const char *alias) {
-    (void)type;
-    (void)alias;
-}
-
-static void
-chaz_ConfWriterPython_add_global_typedef(const char *type, const char *alias) {
-    (void)type;
-    (void)alias;
-}
-
-static void
-chaz_ConfWriterPython_add_sys_include(const char *header) {
-    (void)header;
-}
-
-static void
-chaz_ConfWriterPython_add_local_include(const char *header) {
-    (void)header;
-}
-
-static void
-chaz_ConfWriterPython_start_module(const char *module_name) {
-    fprintf(chaz_CWPython.fh, "    # %s\n", module_name);
-}
-
-static void
-chaz_ConfWriterPython_end_module(void) {
-    fprintf(chaz_CWPython.fh, "\n");
-}
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/ConfWriterPython.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterPython.h b/charmonizer/src/Charmonizer/Core/ConfWriterPython.h
deleted file mode 100644
index 00f13bf..0000000
--- a/charmonizer/src/Charmonizer/Core/ConfWriterPython.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Core/ConfWriterPython.h -- Write to a Python module file.
- */
-
-#ifndef H_CHAZ_CONFWRITERPYTHON
-#define H_CHAZ_CONFWRITERPYTHON 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enable writing config to a Python module file.
- */
-void
-chaz_ConfWriterPython_enable(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_CONFWRITERPYTHON */
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c b/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c
deleted file mode 100644
index c81c10f..0000000
--- a/charmonizer/src/Charmonizer/Core/ConfWriterRuby.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Charmonizer/Core/Util.h"
-#include "Charmonizer/Core/ConfWriter.h"
-#include "Charmonizer/Core/ConfWriterRuby.h"
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Static vars. */
-static struct {
-    FILE *fh;
-} chaz_CWRuby = { NULL };
-static chaz_ConfWriter CWRuby_conf_writer;
-
-/* Open the Charmony.rb file handle.
- */
-static void
-chaz_ConfWriterRuby_open_config_rb(void);
-
-static void
-chaz_ConfWriterRuby_clean_up(void);
-static void
-chaz_ConfWriterRuby_vappend_conf(const char *fmt, va_list args);
-static void
-chaz_ConfWriterRuby_add_def(const char *sym, const char *value);
-static void
-chaz_ConfWriterRuby_add_global_def(const char *sym, const char *value);
-static void
-chaz_ConfWriterRuby_add_typedef(const char *type, const char *alias);
-static void
-chaz_ConfWriterRuby_add_global_typedef(const char *type, const char *alias);
-static void
-chaz_ConfWriterRuby_add_sys_include(const char *header);
-static void
-chaz_ConfWriterRuby_add_local_include(const char *header);
-static void
-chaz_ConfWriterRuby_start_module(const char *module_name);
-static void
-chaz_ConfWriterRuby_end_module(void);
-
-void
-chaz_ConfWriterRuby_enable(void) {
-    CWRuby_conf_writer.clean_up           = chaz_ConfWriterRuby_clean_up;
-    CWRuby_conf_writer.vappend_conf       = chaz_ConfWriterRuby_vappend_conf;
-    CWRuby_conf_writer.add_def            = chaz_ConfWriterRuby_add_def;
-    CWRuby_conf_writer.add_global_def     = chaz_ConfWriterRuby_add_global_def;
-    CWRuby_conf_writer.add_typedef        = chaz_ConfWriterRuby_add_typedef;
-    CWRuby_conf_writer.add_global_typedef = chaz_ConfWriterRuby_add_global_typedef;
-    CWRuby_conf_writer.add_sys_include    = chaz_ConfWriterRuby_add_sys_include;
-    CWRuby_conf_writer.add_local_include  = chaz_ConfWriterRuby_add_local_include;
-    CWRuby_conf_writer.start_module       = chaz_ConfWriterRuby_start_module;
-    CWRuby_conf_writer.end_module         = chaz_ConfWriterRuby_end_module;
-    chaz_ConfWriterRuby_open_config_rb();
-    chaz_ConfWriter_add_writer(&CWRuby_conf_writer);
-    return;
-}
-
-static void
-chaz_ConfWriterRuby_open_config_rb(void) {
-    /* Open the filehandle. */
-    chaz_CWRuby.fh = fopen("Charmony.rb", "w+");
-    if (chaz_CWRuby.fh == NULL) {
-        chaz_Util_die("Can't open 'Charmony.rb': %s", strerror(errno));
-    }
-
-    /* Start the module. */
-    fprintf(chaz_CWRuby.fh,
-            "# Auto-generated by Charmonizer. \n"
-            "# DO NOT EDIT THIS FILE!!\n"
-            "\n"
-            "module Charmony\n"
-            "\n"
-            "defs = {}\n"
-            "\n"
-            "def config\ndefs\nend\n"
-            "\n"
-           );
-}
-
-static void
-chaz_ConfWriterRuby_clean_up(void) {
-    /* Write the last bit of Charmony.rb and close. */
-    fprintf(chaz_CWRuby.fh, "\nend\n\n");
-    if (fclose(chaz_CWRuby.fh)) {
-        chaz_Util_die("Couldn't close 'Charmony.rb': %s", strerror(errno));
-    }
-}
-
-static void
-chaz_ConfWriterRuby_vappend_conf(const char *fmt, va_list args) {
-    (void)fmt;
-    (void)args;
-}
-
-static char*
-chaz_ConfWriterRuby_quotify(const char *string, char *buf, size_t buf_size) {
-    char *quoted = buf;
-
-    /* Don't bother with undef values here. */
-    if (!string) {
-        return NULL;
-    }
-
-    /* Allocate memory if necessary. */
-    {
-        const char *ptr;
-        size_t space = 3; /* Quotes plus NUL termination. */
-        for (ptr = string; *ptr; ptr++) {
-            if (*ptr == '\'' || *ptr == '\\') {
-                space += 2;
-            }
-            else {
-                space += 1;
-            }
-        }
-        if (space > buf_size) {
-            quoted = (char*)malloc(space);
-        }
-    }
-
-    /* Perform copying and escaping */
-    {
-        const char *ptr;
-        size_t pos = 0;
-        quoted[pos++] = '\'';
-        for (ptr = string; *ptr; ptr++) {
-            if (*ptr == '\'' || *ptr == '\\') {
-                quoted[pos++] = '\\';
-            }
-            quoted[pos++] = *ptr;
-        }
-        quoted[pos++] = '\'';
-        quoted[pos++] = '\0';
-    }
-
-    return quoted;
-}
-
-#define CFRUBY_MAX_BUF 100
-static void
-chaz_ConfWriterRuby_add_def(const char *sym, const char *value) {
-    char sym_buf[CFRUBY_MAX_BUF + 1];
-    char value_buf[CFRUBY_MAX_BUF + 1];
-    char *quoted_sym;
-    char *quoted_value;
-
-    /* Quote key. */
-    if (!sym) {
-        chaz_Util_die("Can't handle NULL key");
-    }
-    quoted_sym = chaz_ConfWriterRuby_quotify(sym, sym_buf, CFRUBY_MAX_BUF);
-
-    /* Quote value or use "nil". */
-    if (!value) {
-        strcpy(value_buf, "nil");
-        quoted_value = value_buf;
-    }
-    else {
-        quoted_value = chaz_ConfWriterRuby_quotify(value, value_buf,
-                                                CFRUBY_MAX_BUF);
-    }
-
-    fprintf(chaz_CWRuby.fh, "defs[%s] = %s\n", quoted_sym, quoted_value);
-
-    if (quoted_sym   != sym_buf)   { free(quoted_sym);   }
-    if (quoted_value != value_buf) { free(quoted_value); }
-}
-
-static void
-chaz_ConfWriterRuby_add_global_def(const char *sym, const char *value) {
-    (void)sym;
-    (void)value;
-}
-
-static void
-chaz_ConfWriterRuby_add_typedef(const char *type, const char *alias) {
-    (void)type;
-    (void)alias;
-}
-
-static void
-chaz_ConfWriterRuby_add_global_typedef(const char *type, const char *alias) {
-    (void)type;
-    (void)alias;
-}
-
-static void
-chaz_ConfWriterRuby_add_sys_include(const char *header) {
-    (void)header;
-}
-
-static void
-chaz_ConfWriterRuby_add_local_include(const char *header) {
-    (void)header;
-}
-
-static void
-chaz_ConfWriterRuby_start_module(const char *module_name) {
-    fprintf(chaz_CWRuby.fh, "# %s\n", module_name);
-}
-
-static void
-chaz_ConfWriterRuby_end_module(void) {
-    fprintf(chaz_CWRuby.fh, "\n");
-}
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/ConfWriterRuby.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/ConfWriterRuby.h b/charmonizer/src/Charmonizer/Core/ConfWriterRuby.h
deleted file mode 100644
index b77d77c..0000000
--- a/charmonizer/src/Charmonizer/Core/ConfWriterRuby.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Core/ConfWriterRuby.h -- Write to a Ruby module file.
- */
-
-#ifndef H_CHAZ_CONFWRITERRUBY
-#define H_CHAZ_CONFWRITERRUBY 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enable writing config to a Ruby module file.
- */
-void
-chaz_ConfWriterRuby_enable(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_CONFWRITERRUBY */
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/Defines.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Defines.h b/charmonizer/src/Charmonizer/Core/Defines.h
deleted file mode 100644
index e85e856..0000000
--- a/charmonizer/src/Charmonizer/Core/Defines.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Core/Defines.h -- Universal definitions.
- */
-#ifndef H_CHAZ_DEFINES
-#define H_CHAZ_DEFINES 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef true
-  #define true 1
-  #define false 0
-#endif
-
-#define CHAZ_QUOTE(x) #x "\n"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_DEFINES */
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/HeaderChecker.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/HeaderChecker.c b/charmonizer/src/Charmonizer/Core/HeaderChecker.c
deleted file mode 100644
index 7aea085..0000000
--- a/charmonizer/src/Charmonizer/Core/HeaderChecker.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Charmonizer/Core/HeaderChecker.h"
-#include "Charmonizer/Core/Compiler.h"
-#include "Charmonizer/Core/ConfWriter.h"
-#include "Charmonizer/Core/Util.h"
-#include <string.h>
-#include <stdlib.h>
-
-typedef struct chaz_CHeader {
-    const char  *name;
-    int          exists;
-} chaz_CHeader;
-
-/* Keep a sorted, dynamically-sized array of names of all headers we've
- * checked for so far.
- */
-static struct {
-    int            cache_size;
-    chaz_CHeader **header_cache;
-} chaz_HeadCheck = { 0, NULL };
-
-/* Comparison function to feed to qsort, bsearch, etc.
- */
-static int
-chaz_HeadCheck_compare_headers(const void *vptr_a, const void *vptr_b);
-
-/* Run a test compilation and return a new chaz_CHeader object encapsulating
- * the results.
- */
-static chaz_CHeader*
-chaz_HeadCheck_discover_header(const char *header_name);
-
-/* Extend the cache, add this chaz_CHeader object to it, and sort.
- */
-static void
-chaz_HeadCheck_add_to_cache(chaz_CHeader *header);
-
-/* Like add_to_cache, but takes a individual elements instead of a
- * chaz_CHeader* and checks if header exists in array first.
- */
-static void
-chaz_HeadCheck_maybe_add_to_cache(const char *header_name, int exists);
-
-void
-chaz_HeadCheck_init(void) {
-    chaz_CHeader *null_header = (chaz_CHeader*)malloc(sizeof(chaz_CHeader));
-
-    /* Create terminating record for the dynamic array of chaz_CHeader
-     * objects. */
-    null_header->name   = NULL;
-    null_header->exists = false;
-    chaz_HeadCheck.header_cache    = (chaz_CHeader**)malloc(sizeof(void*));
-    *(chaz_HeadCheck.header_cache) = null_header;
-    chaz_HeadCheck.cache_size = 1;
-}
-
-int
-chaz_HeadCheck_check_header(const char *header_name) {
-    chaz_CHeader  *header;
-    chaz_CHeader   key;
-    chaz_CHeader  *fake = &key;
-    chaz_CHeader **header_ptr;
-
-    /* Fake up a key to feed to bsearch; see if the header's already there. */
-    key.name = header_name;
-    key.exists = false;
-    header_ptr = (chaz_CHeader**)bsearch(&fake, chaz_HeadCheck.header_cache,
-                                         chaz_HeadCheck.cache_size,
-                                         sizeof(void*),
-                                         chaz_HeadCheck_compare_headers);
-
-    /* If it's not there, go try a test compile. */
-    if (header_ptr == NULL) {
-        header = chaz_HeadCheck_discover_header(header_name);
-        chaz_HeadCheck_add_to_cache(header);
-    }
-    else {
-        header = *header_ptr;
-    }
-
-    return header->exists;
-}
-
-int
-chaz_HeadCheck_check_many_headers(const char **header_names) {
-    static const char test_code[] = "int main() { return 0; }\n";
-    int success;
-    int i;
-    char *code_buf;
-    size_t needed = sizeof(test_code) + 20;
-
-    /* Build the source code string. */
-    for (i = 0; header_names[i] != NULL; i++) {
-        needed += strlen(header_names[i]);
-        needed += sizeof("#include <>\n");
-    }
-    code_buf = (char*)malloc(needed);
-    code_buf[0] = '\0';
-    for (i = 0; header_names[i] != NULL; i++) {
-        strcat(code_buf, "#include <");
-        strcat(code_buf, header_names[i]);
-        strcat(code_buf, ">\n");
-    }
-    strcat(code_buf, test_code);
-
-    /* If the code compiles, bulk add all header names to the cache. */
-    success = chaz_CC_test_compile(code_buf);
-    if (success) {
-        for (i = 0; header_names[i] != NULL; i++) {
-            chaz_HeadCheck_maybe_add_to_cache(header_names[i], true);
-        }
-    }
-
-    free(code_buf);
-    return success;
-}
-
-int
-chaz_HeadCheck_contains_member(const char *struct_name, const char *member,
-                               const char *includes) {
-    static const char contains_code[] =
-        CHAZ_QUOTE(  #include <stddef.h>                           )
-        CHAZ_QUOTE(  %s                                            )
-        CHAZ_QUOTE(  int main() { return offsetof(%s, %s); }       );
-    long needed = sizeof(contains_code)
-                  + strlen(struct_name)
-                  + strlen(member)
-                  + strlen(includes)
-                  + 10;
-    char *buf = (char*)malloc(needed);
-    int retval;
-    sprintf(buf, contains_code, includes, struct_name, member);
-    retval = chaz_CC_test_compile(buf);
-    free(buf);
-    return retval;
-}
-
-static int
-chaz_HeadCheck_compare_headers(const void *vptr_a, const void *vptr_b) {
-    chaz_CHeader *const *const a = (chaz_CHeader*const*)vptr_a;
-    chaz_CHeader *const *const b = (chaz_CHeader*const*)vptr_b;
-
-    /* (NULL is "greater than" any string.) */
-    if ((*a)->name == NULL)      { return 1; }
-    else if ((*b)->name == NULL) { return -1; }
-    else                         { return strcmp((*a)->name, (*b)->name); }
-}
-
-static chaz_CHeader*
-chaz_HeadCheck_discover_header(const char *header_name) {
-    static const char test_code[] = "int main() { return 0; }\n";
-    chaz_CHeader* header = (chaz_CHeader*)malloc(sizeof(chaz_CHeader));
-    size_t  needed = strlen(header_name) + sizeof(test_code) + 50;
-    char *include_test = (char*)malloc(needed);
-
-    /* Assign. */
-    header->name = chaz_Util_strdup(header_name);
-
-    /* See whether code that tries to pull in this header compiles. */
-    sprintf(include_test, "#include <%s>\n%s", header_name, test_code);
-    header->exists = chaz_CC_test_compile(include_test);
-
-    free(include_test);
-    return header;
-}
-
-static void
-chaz_HeadCheck_add_to_cache(chaz_CHeader *header) {
-    size_t amount;
-
-    /* Realloc array -- inefficient, but this isn't a bottleneck. */
-    amount = ++chaz_HeadCheck.cache_size * sizeof(void*);
-    chaz_HeadCheck.header_cache
-        = (chaz_CHeader**)realloc(chaz_HeadCheck.header_cache, amount);
-    chaz_HeadCheck.header_cache[chaz_HeadCheck.cache_size - 1] = header;
-
-    /* Keep the list of headers sorted. */
-    qsort(chaz_HeadCheck.header_cache, chaz_HeadCheck.cache_size,
-          sizeof(*(chaz_HeadCheck.header_cache)),
-          chaz_HeadCheck_compare_headers);
-}
-
-static void
-chaz_HeadCheck_maybe_add_to_cache(const char *header_name, int exists) {
-    chaz_CHeader *header;
-    chaz_CHeader  key;
-    chaz_CHeader *fake = &key;
-
-    /* Fake up a key and bsearch for it. */
-    key.name   = header_name;
-    key.exists = exists;
-    header = (chaz_CHeader*)bsearch(&fake, chaz_HeadCheck.header_cache,
-                                    chaz_HeadCheck.cache_size, sizeof(void*),
-                                    chaz_HeadCheck_compare_headers);
-
-    /* We've already done the test compile, so skip that step and add it. */
-    if (header == NULL) {
-        header = (chaz_CHeader*)malloc(sizeof(chaz_CHeader));
-        header->name   = chaz_Util_strdup(header_name);
-        header->exists = exists;
-        chaz_HeadCheck_add_to_cache(header);
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/HeaderChecker.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/HeaderChecker.h b/charmonizer/src/Charmonizer/Core/HeaderChecker.h
deleted file mode 100644
index 2d0a175..0000000
--- a/charmonizer/src/Charmonizer/Core/HeaderChecker.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Probe/HeaderChecker.h
- */
-
-#ifndef H_CHAZ_HEAD_CHECK
-#define H_CHAZ_HEAD_CHECK
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "Charmonizer/Core/Defines.h"
-
-/* Bootstrap the HeadCheck.  Call this before anything else.
- */
-void
-chaz_HeadCheck_init(void);
-
-/* Check for a particular header and return true if it's available.  The
- * test-compile is only run the first time a given request is made.
- */
-int
-chaz_HeadCheck_check_header(const char *header_name);
-
-/* Attempt to compile a file which pulls in all the headers specified by name
- * in a null-terminated array.  If the compile succeeds, add them all to the
- * internal register and return true.
- */
-int
-chaz_HeadCheck_check_many_headers(const char **header_names);
-
-/* Return true if the member is present in the struct. */
-int
-chaz_HeadCheck_contains_member(const char *struct_name, const char *member,
-                               const char *includes);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_HEAD_CHECK */
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
deleted file mode 100644
index f54a146..0000000
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ /dev/null
@@ -1,767 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <ctype.h>
-#include <string.h>
-#include "Charmonizer/Core/Make.h"
-#include "Charmonizer/Core/Compiler.h"
-#include "Charmonizer/Core/OperatingSystem.h"
-#include "Charmonizer/Core/Util.h"
-
-struct chaz_MakeVar {
-    char   *name;
-    char   *value;
-    size_t  num_elements;
-};
-
-struct chaz_MakeRule {
-    char *targets;
-    char *prereqs;
-    char *commands;
-};
-
-struct chaz_MakeFile {
-    chaz_MakeVar  **vars;
-    size_t          num_vars;
-    chaz_MakeRule **rules;
-    size_t          num_rules;
-    chaz_MakeRule  *clean;
-    chaz_MakeRule  *distclean;
-};
-
-/* Static vars. */
-static struct {
-    char *make_command;
-    int   is_gnu_make;
-    int   is_nmake;
-    int   shell_type;
-} chaz_Make = {
-    NULL,
-    0, 0, 0
-};
-
-/* Detect make command.
- *
- * The argument list must be a NULL-terminated series of different spellings
- * of `make`, which will be auditioned in the order they are supplied.  Here
- * are several possibilities:
- *
- *      make
- *      gmake
- *      nmake
- *      dmake
- */
-static int
-chaz_Make_detect(const char *make1, ...);
-
-static int
-chaz_Make_audition(const char *make);
-
-static chaz_MakeRule*
-S_new_rule(const char *target, const char *prereq);
-
-static void
-S_destroy_rule(chaz_MakeRule *rule);
-
-static void
-S_write_rule(chaz_MakeRule *rule, FILE *out);
-
-void
-chaz_Make_init(void) {
-    const char *make;
-
-    chaz_Make_detect("make", "gmake", "nmake", "dmake", "mingw32-make",
-                     "mingw64-make", NULL);
-    make = chaz_Make.make_command;
-
-    if (make) {
-        if (strcmp(make, "make") == 0
-            || strcmp(make, "gmake") == 0
-            || strcmp(make, "mingw32-make") == 0
-            || strcmp(make, "mingw64-make") == 0
-           ) {
-            /* TODO: Add a feature test for GNU make. */
-            chaz_Make.is_gnu_make = 1;
-            /* TODO: Feature test which shell GNU make uses on Windows. */
-            chaz_Make.shell_type = CHAZ_OS_POSIX;
-        }
-        else if (strcmp(make, "nmake") == 0) {
-            chaz_Make.is_nmake = 1;
-            chaz_Make.shell_type = CHAZ_OS_CMD_EXE;
-        }
-    }
-}
-
-void
-chaz_Make_clean_up(void) {
-    free(chaz_Make.make_command);
-}
-
-const char*
-chaz_Make_get_make(void) {
-    return chaz_Make.make_command;
-}
-
-int
-chaz_Make_shell_type(void) {
-    return chaz_Make.shell_type;
-}
-
-static int
-chaz_Make_detect(const char *make1, ...) {
-    va_list args;
-    const char *candidate;
-    int found = 0;
-    const char makefile_content[] = "foo:\n\techo \"foo!\"\n";
-    chaz_Util_write_file("_charm_Makefile", makefile_content);
-
-    /* Audition candidates. */
-    found = chaz_Make_audition(make1);
-    va_start(args, make1);
-    while (!found && (NULL != (candidate = va_arg(args, const char*)))) {
-        found = chaz_Make_audition(candidate);
-    }
-    va_end(args);
-
-    chaz_Util_remove_and_verify("_charm_Makefile");
-
-    return found;
-}
-
-static int
-chaz_Make_audition(const char *make) {
-    int succeeded = 0;
-    char *command = chaz_Util_join(" ", make, "-f", "_charm_Makefile", NULL);
-
-    chaz_Util_remove_and_verify("_charm_foo");
-    chaz_OS_run_redirected(command, "_charm_foo");
-    if (chaz_Util_can_open_file("_charm_foo")) {
-        size_t len;
-        char *content = chaz_Util_slurp_file("_charm_foo", &len);
-        if (NULL != strstr(content, "foo!")) {
-            succeeded = 1;
-        }
-        free(content);
-    }
-    chaz_Util_remove_and_verify("_charm_foo");
-
-    if (succeeded) {
-        chaz_Make.make_command = chaz_Util_strdup(make);
-    }
-
-    free(command);
-    return succeeded;
-}
-
-chaz_MakeFile*
-chaz_MakeFile_new() {
-    chaz_MakeFile *makefile = (chaz_MakeFile*)malloc(sizeof(chaz_MakeFile));
-    const char    *exe_ext  = chaz_OS_exe_ext();
-    const char    *obj_ext  = chaz_CC_obj_ext();
-    char *generated;
-
-    makefile->vars = (chaz_MakeVar**)malloc(sizeof(chaz_MakeVar*));
-    makefile->vars[0] = NULL;
-    makefile->num_vars = 0;
-
-    makefile->rules = (chaz_MakeRule**)malloc(sizeof(chaz_MakeRule*));
-    makefile->rules[0] = NULL;
-    makefile->num_rules = 0;
-
-    makefile->clean     = S_new_rule("clean", NULL);
-    makefile->distclean = S_new_rule("distclean", "clean");
-
-    generated = chaz_Util_join("", "charmonizer", exe_ext, " charmonizer",
-                               obj_ext, " charmony.h Makefile", NULL);
-    chaz_MakeRule_add_rm_command(makefile->distclean, generated);
-
-    free(generated);
-    return makefile;
-}
-
-void
-chaz_MakeFile_destroy(chaz_MakeFile *makefile) {
-    size_t i;
-
-    for (i = 0; makefile->vars[i]; i++) {
-        chaz_MakeVar *var = makefile->vars[i];
-        free(var->name);
-        free(var->value);
-        free(var);
-    }
-    free(makefile->vars);
-
-    for (i = 0; makefile->rules[i]; i++) {
-        S_destroy_rule(makefile->rules[i]);
-    }
-    free(makefile->rules);
-
-    S_destroy_rule(makefile->clean);
-    S_destroy_rule(makefile->distclean);
-
-    free(makefile);
-}
-
-chaz_MakeVar*
-chaz_MakeFile_add_var(chaz_MakeFile *makefile, const char *name,
-                      const char *value) {
-    chaz_MakeVar  *var      = (chaz_MakeVar*)malloc(sizeof(chaz_MakeVar));
-    chaz_MakeVar **vars     = makefile->vars;
-    size_t         num_vars = makefile->num_vars + 1;
-
-    var->name         = chaz_Util_strdup(name);
-    var->value        = chaz_Util_strdup("");
-    var->num_elements = 0;
-
-    if (value) { chaz_MakeVar_append(var, value); }
-
-    vars = (chaz_MakeVar**)realloc(vars,
-                                   (num_vars + 1) * sizeof(chaz_MakeVar*));
-    vars[num_vars-1] = var;
-    vars[num_vars]   = NULL;
-    makefile->vars = vars;
-    makefile->num_vars = num_vars;
-
-    return var;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_add_rule(chaz_MakeFile *makefile, const char *target,
-                       const char *prereq) {
-    chaz_MakeRule  *rule      = S_new_rule(target, prereq);
-    chaz_MakeRule **rules     = makefile->rules;
-    size_t          num_rules = makefile->num_rules + 1;
-
-    rules = (chaz_MakeRule**)realloc(rules,
-                                     (num_rules + 1) * sizeof(chaz_MakeRule*));
-    rules[num_rules-1] = rule;
-    rules[num_rules]   = NULL;
-    makefile->rules = rules;
-    makefile->num_rules = num_rules;
-
-    return rule;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_clean_rule(chaz_MakeFile *makefile) {
-    return makefile->clean;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_distclean_rule(chaz_MakeFile *makefile) {
-    return makefile->distclean;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
-                      const char *sources, chaz_CFlags *link_flags) {
-    chaz_CFlags   *local_flags  = chaz_CC_new_cflags();
-    const char    *link         = chaz_CC_link_command();
-    const char    *link_flags_string = "";
-    const char    *local_flags_string;
-    chaz_MakeRule *rule;
-    char          *command;
-
-    rule = chaz_MakeFile_add_rule(makefile, exe, sources);
-
-    if (link_flags) {
-        link_flags_string = chaz_CFlags_get_string(link_flags);
-    }
-    if (chaz_CC_msvc_version_num()) {
-        chaz_CFlags_append(local_flags, "/nologo");
-    }
-    chaz_CFlags_set_link_output(local_flags, exe);
-    local_flags_string = chaz_CFlags_get_string(local_flags);
-    command = chaz_Util_join(" ", link, sources, link_flags_string,
-                             local_flags_string, NULL);
-    chaz_MakeRule_add_command(rule, command);
-
-    chaz_MakeRule_add_rm_command(makefile->clean, exe);
-
-    chaz_CFlags_destroy(local_flags);
-    free(command);
-    return rule;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_add_compiled_exe(chaz_MakeFile *makefile, const char *exe,
-                               const char *sources, chaz_CFlags *cflags) {
-    chaz_CFlags   *local_flags   = chaz_CC_new_cflags();
-    const char    *cc            = chaz_CC_get_cc();
-    const char    *cflags_string = "";
-    const char    *local_flags_string;
-    chaz_MakeRule *rule;
-    char          *command;
-
-    rule = chaz_MakeFile_add_rule(makefile, exe, sources);
-
-    if (cflags) {
-        cflags_string = chaz_CFlags_get_string(cflags);
-    }
-    if (chaz_CC_msvc_version_num()) {
-        chaz_CFlags_append(local_flags, "/nologo");
-    }
-    chaz_CFlags_set_output_exe(local_flags, exe);
-    local_flags_string = chaz_CFlags_get_string(local_flags);
-    command = chaz_Util_join(" ", cc, sources, cflags_string,
-                             local_flags_string, NULL);
-    chaz_MakeRule_add_command(rule, command);
-
-    chaz_MakeRule_add_rm_command(makefile->clean, exe);
-    /* TODO: Clean .obj file on Windows. */
-
-    chaz_CFlags_destroy(local_flags);
-    free(command);
-    return rule;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, chaz_SharedLib *lib,
-                             const char *sources, chaz_CFlags *link_flags) {
-    chaz_CFlags   *local_flags  = chaz_CC_new_cflags();
-    const char    *link         = chaz_CC_link_command();
-    const char    *shlib_ext    = chaz_OS_shared_lib_ext();
-    const char    *link_flags_string = "";
-    const char    *local_flags_string;
-    chaz_MakeRule *rule;
-    char          *filename;
-    char          *command;
-
-    filename = chaz_SharedLib_filename(lib);
-    rule = chaz_MakeFile_add_rule(makefile, filename, sources);
-
-    if (link_flags) {
-        link_flags_string = chaz_CFlags_get_string(link_flags);
-    }
-
-    if (chaz_CC_msvc_version_num()) {
-        chaz_CFlags_append(local_flags, "/nologo");
-    }
-    chaz_CFlags_link_shared_library(local_flags);
-    if (strcmp(shlib_ext, ".dylib") == 0) {
-        /* Set temporary install name with full path on Darwin. */
-        const char *dir_sep = chaz_OS_dir_sep();
-        char *major_v_name = chaz_SharedLib_major_version_filename(lib);
-        char *install_name = chaz_Util_join("", "-install_name $(CURDIR)",
-                                            dir_sep, major_v_name, NULL);
-        chaz_CFlags_append(local_flags, install_name);
-        free(major_v_name);
-        free(install_name);
-    }
-    chaz_CFlags_set_shared_library_version(local_flags, lib);
-    chaz_CFlags_set_link_output(local_flags, filename);
-    local_flags_string = chaz_CFlags_get_string(local_flags);
-
-    command = chaz_Util_join(" ", link, sources, link_flags_string,
-                             local_flags_string, NULL);
-    chaz_MakeRule_add_command(rule, command);
-    free(command);
-
-    chaz_MakeRule_add_rm_command(makefile->clean, filename);
-
-    /* Add symlinks. */
-    if (strcmp(shlib_ext, ".dll") != 0) {
-        char *major_v_name = chaz_SharedLib_major_version_filename(lib);
-        char *no_v_name    = chaz_SharedLib_no_version_filename(lib);
-
-        command = chaz_Util_join(" ", "ln -sf", filename, major_v_name, NULL);
-        chaz_MakeRule_add_command(rule, command);
-        free(command);
-
-        if (strcmp(shlib_ext, ".dylib") == 0) {
-            command = chaz_Util_join(" ", "ln -sf", filename, no_v_name,
-                                     NULL);
-        }
-        else {
-            command = chaz_Util_join(" ", "ln -sf", major_v_name, no_v_name,
-                                     NULL);
-        }
-        chaz_MakeRule_add_command(rule, command);
-        free(command);
-
-        chaz_MakeRule_add_rm_command(makefile->clean, major_v_name);
-        chaz_MakeRule_add_rm_command(makefile->clean, no_v_name);
-
-        free(major_v_name);
-        free(no_v_name);
-    }
-
-    if (chaz_CC_msvc_version_num()) {
-        /* Remove import library and export file under MSVC. */
-        char *lib_filename = chaz_SharedLib_implib_filename(lib);
-        char *exp_filename = chaz_SharedLib_export_filename(lib);
-        chaz_MakeRule_add_rm_command(makefile->clean, lib_filename);
-        chaz_MakeRule_add_rm_command(makefile->clean, exp_filename);
-        free(lib_filename);
-        free(exp_filename);
-    }
-
-    chaz_CFlags_destroy(local_flags);
-    free(filename);
-    return rule;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_add_lemon_exe(chaz_MakeFile *makefile, const char *dir) {
-    chaz_CFlags   *cflags = chaz_CC_new_cflags();
-    chaz_MakeRule *rule;
-    const char *dir_sep = chaz_OS_dir_sep();
-    const char *exe_ext = chaz_OS_exe_ext();
-    char *lemon_exe = chaz_Util_join("", dir, dir_sep, "lemon", exe_ext, NULL);
-    char *lemon_c   = chaz_Util_join(dir_sep, dir, "lemon.c", NULL);
-
-    chaz_CFlags_enable_optimization(cflags);
-    chaz_MakeFile_add_var(makefile, "LEMON_EXE", lemon_exe);
-    rule = chaz_MakeFile_add_compiled_exe(makefile, "$(LEMON_EXE)", lemon_c,
-                                          cflags);
-
-    chaz_CFlags_destroy(cflags);
-    free(lemon_c);
-    free(lemon_exe);
-    return rule;
-}
-
-chaz_MakeRule*
-chaz_MakeFile_add_lemon_grammar(chaz_MakeFile *makefile,
-                                const char *base_name) {
-    char *c_file  = chaz_Util_join(".", base_name, "c", NULL);
-    char *h_file  = chaz_Util_join(".", base_name, "h", NULL);
-    char *y_file  = chaz_Util_join(".", base_name, "y", NULL);
-    char *command = chaz_Util_join(" ", "$(LEMON_EXE) -q", y_file, NULL);
-
-    chaz_MakeRule *rule = chaz_MakeFile_add_rule(makefile, c_file, y_file);
-    chaz_MakeRule *clean_rule = chaz_MakeFile_clean_rule(makefile);
-
-    chaz_MakeRule_add_prereq(rule, "$(LEMON_EXE)");
-    chaz_MakeRule_add_command(rule, command);
-
-    chaz_MakeRule_add_rm_command(clean_rule, h_file);
-    chaz_MakeRule_add_rm_command(clean_rule, c_file);
-
-    free(c_file);
-    free(h_file);
-    free(y_file);
-    free(command);
-    return rule;
-}
-
-void
-chaz_MakeFile_write(chaz_MakeFile *makefile) {
-    FILE   *out;
-    size_t  i;
-
-    out = fopen("Makefile", "w");
-    if (!out) {
-        chaz_Util_die("Can't open Makefile\n");
-    }
-
-    for (i = 0; makefile->vars[i]; i++) {
-        chaz_MakeVar *var = makefile->vars[i];
-        fprintf(out, "%s = %s\n", var->name, var->value);
-    }
-    fprintf(out, "\n");
-
-    for (i = 0; makefile->rules[i]; i++) {
-        S_write_rule(makefile->rules[i], out);
-    }
-
-    S_write_rule(makefile->clean, out);
-    S_write_rule(makefile->distclean, out);
-
-    if (chaz_Make.is_nmake) {
-        /* Inference rule for .c files. */
-        if (chaz_CC_msvc_version_num()) {
-            fprintf(out, ".c.obj :\n");
-            fprintf(out, "\t$(CC) /nologo $(CFLAGS) /c $< /Fo$@\n\n");
-        }
-        else {
-            fprintf(out, ".c.o :\n");
-            fprintf(out, "\t$(CC) $(CFLAGS) -c $< -o $@\n\n");
-        }
-    }
-
-    fclose(out);
-}
-
-void
-chaz_MakeVar_append(chaz_MakeVar *var, const char *element) {
-    char *value;
-
-    if (element[0] == '\0') { return; }
-
-    if (var->num_elements == 0) {
-        value = chaz_Util_strdup(element);
-    }
-    else {
-        value = (char*)malloc(strlen(var->value) + strlen(element) + 20);
-
-        if (var->num_elements == 1) {
-            sprintf(value, "\\\n    %s \\\n    %s", var->value, element);
-        }
-        else {
-            sprintf(value, "%s \\\n    %s", var->value, element);
-        }
-    }
-
-    free(var->value);
-    var->value = value;
-    var->num_elements++;
-}
-
-static chaz_MakeRule*
-S_new_rule(const char *target, const char *prereq) {
-    chaz_MakeRule *rule = (chaz_MakeRule*)malloc(sizeof(chaz_MakeRule));
-
-    rule->targets  = NULL;
-    rule->prereqs  = NULL;
-    rule->commands = NULL;
-
-    if (target) { chaz_MakeRule_add_target(rule, target); }
-    if (prereq) { chaz_MakeRule_add_prereq(rule, prereq); }
-
-    return rule;
-}
-
-static void
-S_destroy_rule(chaz_MakeRule *rule) {
-    if (rule->targets)  { free(rule->targets); }
-    if (rule->prereqs)  { free(rule->prereqs); }
-    if (rule->commands) { free(rule->commands); }
-    free(rule);
-}
-
-static void
-S_write_rule(chaz_MakeRule *rule, FILE *out) {
-    fprintf(out, "%s :", rule->targets);
-    if (rule->prereqs) {
-        fprintf(out, " %s", rule->prereqs);
-    }
-    fprintf(out, "\n");
-    if (rule->commands) {
-        fprintf(out, "%s", rule->commands);
-    }
-    fprintf(out, "\n");
-}
-
-void
-chaz_MakeRule_add_target(chaz_MakeRule *rule, const char *target) {
-    char *targets;
-
-    if (!rule->targets) {
-        targets = chaz_Util_strdup(target);
-    }
-    else {
-        targets = chaz_Util_join(" ", rule->targets, target, NULL);
-        free(rule->targets);
-    }
-
-    rule->targets = targets;
-}
-
-void
-chaz_MakeRule_add_prereq(chaz_MakeRule *rule, const char *prereq) {
-    char *prereqs;
-
-    if (!rule->prereqs) {
-        prereqs = chaz_Util_strdup(prereq);
-    }
-    else {
-        prereqs = chaz_Util_join(" ", rule->prereqs, prereq, NULL);
-        free(rule->prereqs);
-    }
-
-    rule->prereqs = prereqs;
-}
-
-void
-chaz_MakeRule_add_command(chaz_MakeRule *rule, const char *command) {
-    char *commands;
-
-    if (!rule->commands) {
-        commands = (char*)malloc(strlen(command) + 20);
-        sprintf(commands, "\t%s\n", command);
-    }
-    else {
-        commands = (char*)malloc(strlen(rule->commands) + strlen(command) + 20);
-        sprintf(commands, "%s\t%s\n", rule->commands, command);
-        free(rule->commands);
-    }
-
-    rule->commands = commands;
-}
-
-void
-chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
-    char *command;
-
-    if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
-        command = chaz_Util_join(" ", "rm -f", files, NULL);
-    }
-    else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
-        command = chaz_Util_join("", "for %i in (", files,
-                                 ") do @if exist %i del /f %i", NULL);
-    }
-    else {
-        chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
-    }
-
-    chaz_MakeRule_add_command(rule, command);
-    free(command);
-}
-
-void
-chaz_MakeRule_add_recursive_rm_command(chaz_MakeRule *rule, const char *dirs) {
-    char *command;
-
-    if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
-        command = chaz_Util_join(" ", "rm -rf", dirs, NULL);
-    }
-    else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
-        command = chaz_Util_join("", "for %i in (", dirs,
-                                 ") do @if exist %i rmdir /s /q %i", NULL);
-    }
-    else {
-        chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
-    }
-
-    chaz_MakeRule_add_command(rule, command);
-    free(command);
-}
-
-void
-chaz_MakeRule_add_make_command(chaz_MakeRule *rule, const char *dir,
-                               const char *target) {
-    char *command;
-
-    if (chaz_Make.is_gnu_make) {
-        if (!target) {
-            command = chaz_Util_join(" ", "$(MAKE)", "-C", dir, NULL);
-        }
-        else {
-            command = chaz_Util_join(" ", "$(MAKE)", "-C", dir, target, NULL);
-        }
-        chaz_MakeRule_add_command(rule, command);
-        free(command);
-    }
-    else if (chaz_Make.is_nmake) {
-        command = chaz_Util_join(" ", "cd", dir, NULL);
-        chaz_MakeRule_add_command(rule, command);
-        free(command);
-
-        if (!target) {
-            chaz_MakeRule_add_command(rule, "$(MAKE) /nologo");
-        }
-        else {
-            command = chaz_Util_join(" ", "$(MAKE) /nologo", target, NULL);
-            chaz_MakeRule_add_command(rule, command);
-            free(command);
-        }
-
-        chaz_MakeRule_add_command(rule, "cd $(MAKEDIR)");
-    }
-    else {
-        chaz_Util_die("Couldn't find a supported 'make' utility.");
-    }
-}
-
-void
-chaz_Make_list_files(const char *dir, const char *ext,
-                     chaz_Make_list_files_callback_t callback, void *context) {
-    int         shell_type = chaz_OS_shell_type();
-    const char *pattern;
-    char       *command;
-    char       *list;
-    char       *prefix;
-    char       *file;
-    size_t      command_size;
-    size_t      list_len;
-    size_t      prefix_len;
-
-    /* List files using shell. */
-
-    if (shell_type == CHAZ_OS_POSIX) {
-        pattern = "find %s -name '*.%s' -type f";
-    }
-    else if (shell_type == CHAZ_OS_CMD_EXE) {
-        pattern = "dir %s\\*.%s /s /b /a-d";
-    }
-    else {
-        chaz_Util_die("Unknown shell type %d", shell_type);
-    }
-
-    command_size = strlen(pattern) + strlen(dir) + strlen(ext) + 10;
-    command = (char*)malloc(command_size);
-    sprintf(command, pattern, dir, ext);
-    list = chaz_OS_run_and_capture(command, &list_len);
-    free(command);
-    if (!list) {
-        chaz_Util_die("Failed to list files in '%s'", dir);
-    }
-    list[list_len-1] = 0;
-
-    /* Find directory prefix to strip from files */
-
-    if (shell_type == CHAZ_OS_POSIX) {
-        prefix_len = strlen(dir);
-        prefix = (char*)malloc(prefix_len + 2);
-        memcpy(prefix, dir, prefix_len);
-        prefix[prefix_len++] = '/';
-        prefix[prefix_len]   = '\0';
-    }
-    else {
-        char   *output;
-        size_t  output_len;
-
-        /* 'dir /s' returns absolute paths, so we have to find the absolute
-         * 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";
-        command_size = strlen(pattern) + strlen(dir) + 10;
-        command = (char*)malloc(command_size);
-        sprintf(command, pattern, dir);
-        output = chaz_OS_run_and_capture(command, &output_len);
-        free(command);
-        if (!output) { chaz_Util_die("Failed to find absolute path"); }
-
-        /* 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++] = '\\';
-        prefix[prefix_len]   = '\0';
-        free(output);
-    }
-
-    /* Iterate file list and invoke callback. */
-
-    for (file = strtok(list, "\r\n"); file; file = strtok(NULL, "\r\n")) {
-        if (strlen(file) <= prefix_len
-            || memcmp(file, prefix, prefix_len) != 0
-           ) {
-            chaz_Util_die("Expected prefix '%s' for file name '%s'", prefix,
-                          file);
-        }
-
-        callback(dir, file + prefix_len, context);
-    }
-
-    free(prefix);
-    free(list);
-}
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/Make.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.h b/charmonizer/src/Charmonizer/Core/Make.h
deleted file mode 100644
index 7139dd4..0000000
--- a/charmonizer/src/Charmonizer/Core/Make.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Core/Make.h
- */
-
-#ifndef H_CHAZ_MAKE
-#define H_CHAZ_MAKE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "Charmonizer/Core/CFlags.h"
-#include "Charmonizer/Core/SharedLib.h"
-
-typedef struct chaz_MakeFile chaz_MakeFile;
-typedef struct chaz_MakeVar chaz_MakeVar;
-typedef struct chaz_MakeRule chaz_MakeRule;
-
-typedef void (*chaz_Make_list_files_callback_t)(const char *dir, char *file,
-                                                void *context);
-
-/** Initialize the environment.
- */
-void
-chaz_Make_init(void);
-
-/** Clean up the environment.
- */
-void
-chaz_Make_clean_up(void);
-
-/** Return the name of the detected 'make' executable.
- */
-const char*
-chaz_Make_get_make(void);
-
-/** Return the type of shell used by the detected 'make' executable.
- */
-int
-chaz_Make_shell_type(void);
-
-/** Recursively list files in a directory. For every file a callback is called
- * with the filename and a context variable.
- *
- * @param dir Directory to search in.
- * @param ext File extension to search for.
- * @param callback Callback to call for every matching file.
- * @param context Context variable to pass to callback.
- */
-void
-chaz_Make_list_files(const char *dir, const char *ext,
-                     chaz_Make_list_files_callback_t callback, void *context);
-
-/** MakeFile constructor.
- */
-chaz_MakeFile*
-chaz_MakeFile_new();
-
-/** MakeFile destructor.
- */
-void
-chaz_MakeFile_destroy(chaz_MakeFile *makefile);
-
-/** Add a variable to a makefile.
- *
- * @param makefile The makefile.
- * @param name Name of the variable.
- * @param value Value of the variable. Can be NULL if you want add content
- * later.
- * @return a MakeVar.
- */
-chaz_MakeVar*
-chaz_MakeFile_add_var(chaz_MakeFile *makefile, const char *name,
-                      const char *value);
-
-/** Add a rule to a makefile.
- *
- * @param makefile The makefile.
- * @param target The first target of the rule. Can be NULL if you want to add
- * targets later.
- * @param prereq The first prerequisite of the rule. Can be NULL if you want to
- * add prerequisites later.
- * @return a MakeRule.
- */
-chaz_MakeRule*
-chaz_MakeFile_add_rule(chaz_MakeFile *makefile, const char *target,
-                       const char *prereq);
-
-/** Return the rule for the 'clean' target.
- *
- * @param makefile The makefile.
- */
-chaz_MakeRule*
-chaz_MakeFile_clean_rule(chaz_MakeFile *makefile);
-
-/** Return the rule for the 'distclean' target.
- *
- * @param makefile The makefile.
- */
-chaz_MakeRule*
-chaz_MakeFile_distclean_rule(chaz_MakeFile *makefile);
-
-/** Add a rule to link an executable. The executable will also be added to the
- * list of files to clean.
- *
- * @param makefile The makefile.
- * @param exe The name of the executable.
- * @param sources The list of source files.
- * @param link_flags Additional link flags.
- */
-chaz_MakeRule*
-chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
-                      const char *sources, chaz_CFlags *link_flags);
-
-/** Add a rule to compile and link an executable. The executable will also be
- * added to the list of files to clean.
- *
- * @param makefile The makefile.
- * @param exe The name of the executable.
- * @param sources The list of source files.
- * @param cflags Additional compiler flags.
- */
-chaz_MakeRule*
-chaz_MakeFile_add_compiled_exe(chaz_MakeFile *makefile, const char *exe,
-                               const char *sources, chaz_CFlags *cflags);
-
-/** Add a rule to link a shared library. The shared library will also be added
- * to the list of files to clean.
- *
- * @param makefile The makefile.
- * @param lib The shared library.
- * @param sources The list of source files.
- * @param link_flags Additional link flags.
- */
-chaz_MakeRule*
-chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, chaz_SharedLib *lib,
-                             const char *sources, chaz_CFlags *link_flags);
-
-/** Add a rule to build the lemon parser generator.
- *
- * @param makefile The makefile.
- * @param dir The lemon directory.
- */
-chaz_MakeRule*
-chaz_MakeFile_add_lemon_exe(chaz_MakeFile *makefile, const char *dir);
-
-/** Add a rule for a lemon grammar.
- *
- * @param makefile The makefile.
- * @param base_name The filename of the grammar without extension.
- */
-chaz_MakeRule*
-chaz_MakeFile_add_lemon_grammar(chaz_MakeFile *makefile,
-                                const char *base_name);
-
-/** Write the makefile to a file named 'Makefile' in the current directory.
- *
- * @param makefile The makefile.
- */
-void
-chaz_MakeFile_write(chaz_MakeFile *makefile);
-
-/** Append content to a makefile variable. The new content will be separated
- * from the existing content with whitespace.
- *
- * @param var The variable.
- * @param element The additional content.
- */
-void
-chaz_MakeVar_append(chaz_MakeVar *var, const char *element);
-
-/** Add another target to a makefile rule.
- *
- * @param rule The rule.
- * @param target The additional rule.
- */
-void
-chaz_MakeRule_add_target(chaz_MakeRule *rule, const char *target);
-
-/** Add another prerequisite to a makefile rule.
- *
- * @param rule The rule.
- * @param prereq The additional prerequisite.
- */
-void
-chaz_MakeRule_add_prereq(chaz_MakeRule *rule, const char *prereq);
-
-/** Add a command to a rule.
- *
- * @param rule The rule.
- * @param command The additional command.
- */
-void
-chaz_MakeRule_add_command(chaz_MakeRule *rule, const char *command);
-
-/** Add a command to remove one or more files.
- *
- * @param rule The rule.
- * @param files The list of files.
- */
-void
-chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files);
-
-/** Add a command to remove one or more directories.
- *
- * @param rule The rule.
- * @param dirs The list of directories.
- */
-void
-chaz_MakeRule_add_recursive_rm_command(chaz_MakeRule *rule, const char *dirs);
-
-/** Add one or more commands to call another makefile recursively.
- *
- * @param rule The rule.
- * @param dir The directory in which to call the makefile.
- * @param target The target to call. Pass NULL for the default target.
- */
-void
-chaz_MakeRule_add_make_command(chaz_MakeRule *rule, const char *dir,
-                               const char *target);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_MAKE */
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/OperatingSystem.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/OperatingSystem.c b/charmonizer/src/Charmonizer/Core/OperatingSystem.c
deleted file mode 100644
index 31db30c..0000000
--- a/charmonizer/src/Charmonizer/Core/OperatingSystem.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ctype.h>
-
-#include "Charmonizer/Core/Compiler.h"
-#include "Charmonizer/Core/Util.h"
-#include "Charmonizer/Core/ConfWriter.h"
-#include "Charmonizer/Core/OperatingSystem.h"
-
-#define CHAZ_OS_TARGET_PATH  "_charmonizer_target"
-#define CHAZ_OS_NAME_MAX     31
-
-static struct {
-    char name[CHAZ_OS_NAME_MAX+1];
-    char dev_null[20];
-    char dir_sep[2];
-    char exe_ext[5];
-    char shared_lib_ext[7];
-    char local_command_start[3];
-    int  shell_type;
-} chaz_OS = { "", "", "", "", "", "", 0 };
-
-void
-chaz_OS_init(void) {
-    if (chaz_Util_verbosity) {
-        printf("Initializing Charmonizer/Core/OperatingSystem...\n");
-    }
-
-    if (chaz_Util_verbosity) {
-        printf("Trying to find a bit-bucket a la /dev/null...\n");
-    }
-
-    /* Detect shell based on whether the bitbucket is "/dev/null" or "nul". */
-    if (chaz_Util_can_open_file("/dev/null")) {
-        char   *uname;
-        size_t  uname_len;
-        size_t i;
-
-        chaz_OS.shell_type = CHAZ_OS_POSIX;
-
-        /* Detect Unix name. */
-        uname = chaz_OS_run_and_capture("uname", &uname_len);
-        for (i = 0; i < CHAZ_OS_NAME_MAX && i < uname_len; i++) {
-            char c = uname[i];
-            if (!c || isspace(c)) { break; }
-            chaz_OS.name[i] = tolower(c);
-        }
-        if (i > 0) { chaz_OS.name[i] = '\0'; }
-        else       { strcpy(chaz_OS.name, "unknown_unix"); }
-        free(uname);
-
-        strcpy(chaz_OS.dev_null, "/dev/null");
-        strcpy(chaz_OS.dir_sep, "/");
-        strcpy(chaz_OS.exe_ext, "");
-        if (memcmp(chaz_OS.name, "darwin", 6) == 0) {
-            strcpy(chaz_OS.shared_lib_ext, ".dylib");
-        }
-        else if (memcmp(chaz_OS.name, "cygwin", 6) == 0) {
-            strcpy(chaz_OS.shared_lib_ext, ".dll");
-        }
-        else {
-            strcpy(chaz_OS.shared_lib_ext, ".so");
-        }
-        strcpy(chaz_OS.local_command_start, "./");
-    }
-    else if (chaz_Util_can_open_file("nul")) {
-        strcpy(chaz_OS.name, "windows");
-        strcpy(chaz_OS.dev_null, "nul");
-        strcpy(chaz_OS.dir_sep, "\\");
-        strcpy(chaz_OS.exe_ext, ".exe");
-        strcpy(chaz_OS.shared_lib_ext, ".dll");
-        strcpy(chaz_OS.local_command_start, ".\\");
-        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
-    }
-    else {
-        /* Bail out because we couldn't find anything like /dev/null. */
-        chaz_Util_die("Couldn't find anything like /dev/null");
-    }
-}
-
-const char*
-chaz_OS_name(void) {
-    return chaz_OS.name;
-}
-
-int
-chaz_OS_is_darwin(void) {
-    return memcmp(chaz_OS.name, "darwin", 6) == 0;
-}
-
-int
-chaz_OS_is_cygwin(void) {
-    return memcmp(chaz_OS.name, "cygwin", 6) == 0;
-}
-
-const char*
-chaz_OS_exe_ext(void) {
-    return chaz_OS.exe_ext;
-}
-
-const char*
-chaz_OS_shared_lib_ext(void) {
-    return chaz_OS.shared_lib_ext;
-}
-
-const char*
-chaz_OS_dev_null(void) {
-    return chaz_OS.dev_null;
-}
-
-const char*
-chaz_OS_dir_sep(void) {
-    return chaz_OS.dir_sep;
-}
-
-int
-chaz_OS_shell_type(void) {
-    return chaz_OS.shell_type;
-}
-
-int
-chaz_OS_remove(const char *name) {
-    /*
-     * On Windows it can happen that another process, typically a
-     * virus scanner, still has an open handle on the file. This can
-     * make the subsequent recreation of a file with the same name
-     * fail. As a workaround, files are renamed to a random name
-     * before deletion.
-     */
-    int retval;
-
-    static const size_t num_random_chars = 16;
-
-    size_t  name_len = strlen(name);
-    size_t  i;
-    char   *temp_name = (char*)malloc(name_len + num_random_chars + 1);
-
-    strcpy(temp_name, name);
-    for (i = 0; i < num_random_chars; i++) {
-        temp_name[name_len+i] = 'A' + rand() % 26;
-    }
-    temp_name[name_len+num_random_chars] = '\0';
-
-    if (rename(name, temp_name) == 0) {
-        retval = !remove(temp_name);
-    }
-    else {
-        // Error during rename, remove using old name.
-        retval = !remove(name);
-    }
-
-    free(temp_name);
-    return retval;
-}
-
-int
-chaz_OS_run_local_redirected(const char *command, const char *path) {
-    char *local_command
-        = chaz_Util_join("", chaz_OS.local_command_start, command, NULL);
-    int retval = chaz_OS_run_redirected(local_command, path);
-    free(local_command);
-    return retval;
-}
-
-int
-chaz_OS_run_quietly(const char *command) {
-    return chaz_OS_run_redirected(command, chaz_OS.dev_null);
-}
-
-int
-chaz_OS_run_redirected(const char *command, const char *path) {
-    int retval = 1;
-    char *quiet_command = NULL;
-    if (chaz_OS.shell_type == CHAZ_OS_POSIX
-        || chaz_OS.shell_type == CHAZ_OS_CMD_EXE
-        ) {
-        quiet_command = chaz_Util_join(" ", command, ">", path, "2>&1", NULL);
-    }
-    else {
-        chaz_Util_die("Don't know the shell type");
-    }
-    retval = system(quiet_command);
-    free(quiet_command);
-    return retval;
-}
-
-char*
-chaz_OS_run_and_capture(const char *command, size_t *output_len) {
-    char *output;
-    chaz_OS_run_redirected(command, CHAZ_OS_TARGET_PATH);
-    output = chaz_Util_slurp_file(CHAZ_OS_TARGET_PATH, output_len);
-    chaz_Util_remove_and_verify(CHAZ_OS_TARGET_PATH);
-    return output;
-}
-
-void
-chaz_OS_mkdir(const char *filepath) {
-    char *command = NULL;
-    if (chaz_OS.shell_type == CHAZ_OS_POSIX
-        || chaz_OS.shell_type == CHAZ_OS_CMD_EXE
-       ) {
-        command = chaz_Util_join(" ", "mkdir", filepath, NULL);
-    }
-    else {
-        chaz_Util_die("Don't know the shell type");
-    }
-    chaz_OS_run_quietly(command);
-    free(command);
-}
-
-void
-chaz_OS_rmdir(const char *filepath) {
-    char *command = NULL;
-    if (chaz_OS.shell_type == CHAZ_OS_POSIX) {
-        command = chaz_Util_join(" ", "rmdir", filepath, NULL);
-    }
-    else if (chaz_OS.shell_type == CHAZ_OS_CMD_EXE) {
-        command = chaz_Util_join(" ", "rmdir", "/q", filepath, NULL);
-    }
-    else {
-        chaz_Util_die("Don't know the shell type");
-    }
-    chaz_OS_run_quietly(command);
-    free(command);
-}
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/OperatingSystem.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/OperatingSystem.h b/charmonizer/src/Charmonizer/Core/OperatingSystem.h
deleted file mode 100644
index 84a7ac0..0000000
--- a/charmonizer/src/Charmonizer/Core/OperatingSystem.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Core/OperatingSystem.h - abstract an operating system down to a few
- * variables.
- */
-
-#ifndef H_CHAZ_OPER_SYS
-#define H_CHAZ_OPER_SYS
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CHAZ_OS_POSIX    1
-#define CHAZ_OS_CMD_EXE  2
-
-/* Safely remove a file named [name]. Needed because of Windows quirks.
- * Returns true on success, false on failure.
- */
-int
-chaz_OS_remove(const char *name);
-
-/* 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);
-
-/* Capture both stdout and stderr for a command to the supplied filepath.
- */
-int
-chaz_OS_run_redirected(const char *command, const char *path);
-
-/* Run a command beginning with the name of an executable in the current
- * working directory and capture both stdout and stderr to the supplied
- * filepath.
- */
-int
-chaz_OS_run_local_redirected(const char *command, const char *path);
-
-/* Run a command and return the output from stdout.
- */
-char*
-chaz_OS_run_and_capture(const char *command, size_t *output_len);
-
-/* Attempt to create a directory.
- */
-void
-chaz_OS_mkdir(const char *filepath);
-
-/* Attempt to remove a directory, which must be empty.
- */
-void
-chaz_OS_rmdir(const char *filepath);
-
-/* Return the operating system name.
- */
-const char*
-chaz_OS_name(void);
-
-int
-chaz_OS_is_darwin(void);
-
-int
-chaz_OS_is_cygwin(void);
-
-/* Return the extension for an executable on this system.
- */
-const char*
-chaz_OS_exe_ext(void);
-
-/* Return the extension for a shared object on this system.
- */
-const char*
-chaz_OS_shared_lib_ext(void);
-
-/* Return the equivalent of /dev/null on this system.
- */
-const char*
-chaz_OS_dev_null(void);
-
-/* Return the directory separator on this system.
- */
-const char*
-chaz_OS_dir_sep(void);
-
-/* Return the shell type of this system.
- */
-int
-chaz_OS_shell_type(void);
-
-/* Initialize the Charmonizer/Core/OperatingSystem module.
- */
-void
-chaz_OS_init(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_COMPILER */
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/SharedLibrary.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/SharedLibrary.c b/charmonizer/src/Charmonizer/Core/SharedLibrary.c
deleted file mode 100644
index 5c9d0e9..0000000
--- a/charmonizer/src/Charmonizer/Core/SharedLibrary.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include "Charmonizer/Core/SharedLib.h"
-#include "Charmonizer/Core/Compiler.h"
-#include "Charmonizer/Core/Util.h"
-#include "Charmonizer/Core/OperatingSystem.h"
-
-struct chaz_SharedLib {
-    char *name;
-    char *version;
-    char *major_version;
-};
-
-static char*
-S_build_filename(chaz_SharedLib *lib, const char *version, const char *ext);
-
-static const char*
-S_get_prefix(void);
-
-chaz_SharedLib*
-chaz_SharedLib_new(const char *name, const char *version,
-                   const char *major_version) {
-    chaz_SharedLib *lib = (chaz_SharedLib*)malloc(sizeof(chaz_SharedLib));
-    lib->name          = chaz_Util_strdup(name);
-    lib->version       = chaz_Util_strdup(version);
-    lib->major_version = chaz_Util_strdup(major_version);
-    return lib;
-}
-
-void
-chaz_SharedLib_destroy(chaz_SharedLib *lib) {
-    free(lib->name);
-    free(lib->version);
-    free(lib->major_version);
-    free(lib);
-}
-
-const char*
-chaz_SharedLib_get_name(chaz_SharedLib *lib) {
-    return lib->name;
-}
-
-const char*
-chaz_SharedLib_get_version(chaz_SharedLib *lib) {
-    return lib->version;
-}
-
-const char*
-chaz_SharedLib_get_major_version(chaz_SharedLib *lib) {
-    return lib->major_version;
-}
-
-char*
-chaz_SharedLib_filename(chaz_SharedLib *lib) {
-    const char *shlib_ext = chaz_OS_shared_lib_ext();
-
-    if (strcmp(shlib_ext, ".dll") == 0) {
-        return S_build_filename(lib, lib->major_version, shlib_ext);
-    }
-    else {
-        return S_build_filename(lib, lib->version, shlib_ext);
-    }
-}
-
-char*
-chaz_SharedLib_major_version_filename(chaz_SharedLib *lib) {
-    const char *shlib_ext = chaz_OS_shared_lib_ext();
-
-    return S_build_filename(lib, lib->major_version, shlib_ext);
-}
-
-char*
-chaz_SharedLib_no_version_filename(chaz_SharedLib *lib) {
-    const char *prefix    = S_get_prefix();
-    const char *shlib_ext = chaz_OS_shared_lib_ext();
-
-    return chaz_Util_join("", prefix, lib->name, shlib_ext, NULL);
-}
-
-char*
-chaz_SharedLib_implib_filename(chaz_SharedLib *lib) {
-    return S_build_filename(lib, lib->major_version, ".lib");
-}
-
-char*
-chaz_SharedLib_export_filename(chaz_SharedLib *lib) {
-    return S_build_filename(lib, lib->major_version, ".exp");
-}
-
-static char*
-S_build_filename(chaz_SharedLib *lib, const char *version, const char *ext) {
-    const char *prefix    = S_get_prefix();
-    const char *shlib_ext = chaz_OS_shared_lib_ext();
-
-    if (strcmp(shlib_ext, ".dll") == 0) {
-        return chaz_Util_join("", prefix, lib->name, "-", version, ext, NULL);
-    }
-    else if (strcmp(shlib_ext, ".dylib") == 0) {
-        return chaz_Util_join("", prefix, lib->name, ".", version, ext, NULL);
-    }
-    else {
-        return chaz_Util_join("", prefix, lib->name, ext, ".", version, NULL);
-    }
-}
-
-static const char*
-S_get_prefix() {
-    if (chaz_CC_msvc_version_num()) {
-        return "";
-    }
-    else if (chaz_OS_is_cygwin()) {
-        return "cyg";
-    }
-    else {
-        return "lib";
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/3dc812ab/charmonizer/src/Charmonizer/Core/SharedLibrary.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/SharedLibrary.h b/charmonizer/src/Charmonizer/Core/SharedLibrary.h
deleted file mode 100644
index 723f407..0000000
--- a/charmonizer/src/Charmonizer/Core/SharedLibrary.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Charmonizer/Core/SharedLibrary.h
- */
-
-#ifndef H_CHAZ_SHARED_LIB
-#define H_CHAZ_SHARED_LIB
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct chaz_SharedLib chaz_SharedLib;
-
-chaz_SharedLib*
-chaz_SharedLib_new(const char *name, const char *version,
-                   const char *major_version);
-
-void
-chaz_SharedLib_destroy(chaz_SharedLib *flags);
-
-const char*
-chaz_SharedLib_get_name(chaz_SharedLib *lib);
-
-const char*
-chaz_SharedLib_get_version(chaz_SharedLib *lib);
-
-const char*
-chaz_SharedLib_get_major_version(chaz_SharedLib *lib);
-
-char*
-chaz_SharedLib_filename(chaz_SharedLib *lib);
-
-char*
-chaz_SharedLib_major_version_filename(chaz_SharedLib *lib);
-
-char*
-chaz_SharedLib_no_version_filename(chaz_SharedLib *lib);
-
-char*
-chaz_SharedLib_implib_filename(chaz_SharedLib *lib);
-
-char*
-chaz_SharedLib_export_filename(chaz_SharedLib *lib);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CHAZ_SHARED_LIB */
-
-


Mime
View raw message