From lucy-commitsqcarrillo@example.net Thu Mar 12 03:04:14 2009
Return-Path: <lucy-commitsqcarrillo@example.net>
Delivered-To: qcarrillo@example.net
Received: (qmail 11687 invoked from network); 12 Mar 2009 03:04:13 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 12 Mar 2009 03:04:13 -0000
Received: (qmail 41459 invoked by uid 500); 12 Mar 2009 03:04:13 -0000
Delivered-To: qcarrillo@example.net
Received: (qmail 41440 invoked by uid 500); 12 Mar 2009 03:04:13 -0000
Mailing-List: contact qcarrillo@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:qcarrillo@example.net>
List-Unsubscribe: <mailto:qcarrillo@example.net>
List-Post: <mailto:qcarrillo@example.net>
List-Id: <lucy-commits.lucene.apache.org>
Reply-To: qcarrillo@example.net
Delivered-To: mailing list qcarrillo@example.net
Received: (qmail 41431 invoked by uid 99); 12 Mar 2009 03:04:13 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 20:04:13 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 03:04:12 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 6C2DF23888E6; Thu, 12 Mar 2009 03:03:52 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r752754 - in /lucene/lucy/trunk:
 charmonizer/src/Charmonizer/Core/HeadCheck.charm
 charmonizer/src/Charmonizer/Core/HeadCheck.harm devel/file_format/
Date: Thu, 12 Mar 2009 03:03:52 -0000
To: qcarrillo@example.net
From: qcarrillo@example.net
X-Mailer: svnmailer-1.0.8
Message-Id: <qcarrillo@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: marvin
Date: Thu Mar 12 03:03:51 2009
New Revision: 752754

URL: http://svn.apache.org/viewvc?rev=752754&view=rev
Log:
Add a probe function which discovers whether a struct contains a given member.

Added:
    lucene/lucy/trunk/devel/file_format/
Modified:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.harm

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.charm?rev=752754&r1=752753&r2=752754&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.charm Thu Mar 12 03:03:51 2009
@@ -109,6 +109,27 @@
     return success;
 }
 
+static char contains_code[] = METAQUOTE
+  #include <stddef.h>
+  %s
+  int main() { return offsetof(%s, %s); }
+METAQUOTE;
+
+chaz_bool_t
+chaz_HeadCheck_contains_member(const char *struct_name, const char *member,
+                               const char *includes)
+{
+    long needed = sizeof(contains_code) + strlen(struct_name) 
+                + strlen(member) + strlen(includes) + 10;
+    if (code_buf_len < needed) { 
+        code_buf_len = needed;
+        free(code_buf);
+        code_buf = malloc(code_buf_len);
+    }
+    sprintf(code_buf, contains_code, includes, struct_name, member);
+    return test_compile(code_buf, strlen(code_buf));
+}
+
 static int
 compare_headers(const void *vptr_a, const void *vptr_b) {
     Header **const a = (Header**)vptr_a;

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.harm?rev=752754&r1=752753&r2=752754&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/HeadCheck.harm Thu Mar 12 03:03:51 2009
@@ -24,8 +24,14 @@
 chaz_bool_t
 chaz_HeadCheck_check_many_headers(const char **header_names);
 
+/* Return true if the member is present in the struct. */
+chaz_bool_t
+chaz_HeadCheck_contains_member(const char *struct_name, const char *member,
+                               const char *includes);
+
 #ifdef CHAZ_USE_SHORT_NAMES
   #define HeadCheck_init             chaz_HeadCheck_init
+  #define HeadCheck_contains_member  chaz_HeadCheck_contains_member
   #define check_header               chaz_HeadCheck_check_header
   #define check_many_headers         chaz_HeadCheck_check_many_headers
 #endif



From lucy-commitsqcarrillo@example.net Thu Mar 12 03:26:10 2009
Return-Path: <lucy-commitsqcarrillo@example.net>
Delivered-To: qcarrillo@example.net
Received: (qmail 16308 invoked from network); 12 Mar 2009 03:26:08 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 12 Mar 2009 03:26:08 -0000
Received: (qmail 45822 invoked by uid 500); 12 Mar 2009 03:26:08 -0000
Delivered-To: qcarrillo@example.net
Received: (qmail 45799 invoked by uid 500); 12 Mar 2009 03:26:08 -0000
Mailing-List: contact qcarrillo@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:qcarrillo@example.net>
List-Unsubscribe: <mailto:qcarrillo@example.net>
List-Post: <mailto:qcarrillo@example.net>
List-Id: <lucy-commits.lucene.apache.org>
Reply-To: qcarrillo@example.net
Delivered-To: mailing list qcarrillo@example.net
Received: (qmail 45790 invoked by uid 99); 12 Mar 2009 03:26:08 -0000
Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 20:26:08 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 03:26:06 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id D21422388964; Thu, 12 Mar 2009 03:25:37 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r752757 - in
 /lucene/lucy/trunk/charmonizer/src/Charmonizer/Core: Dir.charm Dir.harm
 OperSys.charm OperSys.harm
Date: Thu, 12 Mar 2009 03:25:37 -0000
To: qcarrillo@example.net
From: qcarrillo@example.net
X-Mailer: svnmailer-1.0.8
Message-Id: <qcarrillo@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: marvin
Date: Thu Mar 12 03:25:37 2009
New Revision: 752757

URL: http://svn.apache.org/viewvc?rev=752757&view=rev
Log:
Add a Charmonizer core module for directory handling.  Return a value when
running a local command via OperSys.

Added:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.harm
Modified:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.harm

Added: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.charm?rev=752757&view=auto
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.charm (added)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.charm Thu Mar 12 03:25:37 2009
@@ -0,0 +1,163 @@
+#define CHAZ_USE_SHORT_NAMES
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "Charmonizer/Core/Dir.h"
+
+#include "Charmonizer/Core/Compiler.h"
+#include "Charmonizer/Core/HeadCheck.h"
+#include "Charmonizer/Core/ModHandler.h"
+#include "Charmonizer/Core/OperSys.h"
+#include "Charmonizer/Core/Util.h"
+
+static chaz_bool_t mkdir_available = false;
+static chaz_bool_t rmdir_available = false;
+static chaz_bool_t initialized     = false;
+int    chaz_Dir_mkdir_num_args = 0;
+static char mkdir_command[7];
+char *Dir_mkdir_command = mkdir_command;
+
+/* Source code for standard POSIX mkdir */
+static char posix_mkdir_code[] = METAQUOTE
+    #include <%s>
+    int main(int argc, char **argv) {
+        if (argc != 2) { return 1; }
+        if (mkdir(argv[1], 0777) != 0) { return 2; }
+        return 0;
+    }
+METAQUOTE;
+
+/* Source code for Windows _mkdir. */
+static char win_mkdir_code[] = METAQUOTE
+    #include <direct.h>
+    int main(int argc, char **argv) {
+        if (argc != 2) { return 1; }
+        if (_mkdir(argv[1]) != 0) { return 2; }
+        return 0;
+    }
+METAQUOTE;
+
+/* Source code for rmdir. */
+static char rmdir_code[] = METAQUOTE
+    #include <%s>
+    int main(int argc, char **argv) {
+        if (argc != 2) { return 1; }
+        if (rmdir(argv[1]) != 0) { return 2; }
+        return 0;
+    }
+METAQUOTE;
+
+static chaz_bool_t
+try_init_posix_mkdir(char *header)
+{
+    size_t needed = sizeof(posix_mkdir_code) + 30;
+    char *code_buf = malloc(needed);
+
+    /* Attempt compilation. */
+    sprintf(code_buf, posix_mkdir_code, header);
+    mkdir_available = compiler->compile_exe(compiler, "_charm_mkdir.c",
+        "_charm_mkdir", code_buf, strlen(code_buf));
+
+    /* Set vars on success. */
+    if (mkdir_available) {
+        strcpy(mkdir_command, "mkdir");
+        if (strcmp(header, "direct.h") == 0) {
+            Dir_mkdir_num_args = 1;
+        }
+        else {
+            Dir_mkdir_num_args = 2;
+        }
+    }
+
+    free(code_buf);
+    return mkdir_available;
+}
+
+static chaz_bool_t
+try_init_win_mkdir()
+{
+    mkdir_available = compiler->compile_exe(compiler, "_charm_mkdir.c",
+        "_charm_mkdir", win_mkdir_code, strlen(win_mkdir_code));
+    if (mkdir_available) {
+        strcpy(mkdir_command, "_mkdir");
+        Dir_mkdir_num_args = 1;
+    }
+    return mkdir_available;
+}
+
+static void
+init_mkdir()
+{
+    if (verbosity) {
+        printf("Attempting to compile _charm_mkdir utility...\n");
+    }
+    if (try_init_win_mkdir())               { return; }
+    if (try_init_posix_mkdir("sys/stat.h")) { return; }
+    if (try_init_posix_mkdir("direct.h"))   { return; }
+}
+
+static chaz_bool_t
+try_init_rmdir(char *header) 
+{
+    size_t needed = sizeof(posix_mkdir_code) + 30;
+    char *code_buf = malloc(needed);
+    sprintf(code_buf, rmdir_code, header);
+    rmdir_available = compiler->compile_exe(compiler, "_charm_rmdir.c",
+        "_charm_rmdir", code_buf, strlen(code_buf));
+    free(code_buf);
+    return rmdir_available;
+}
+
+static void
+init_rmdir()
+{
+    if (verbosity) {
+        printf("Attempting to compile _charm_rmdir utility...\n");
+    }
+    if (try_init_rmdir("unistd.h"))   { return; }
+    if (try_init_rmdir("dirent.h"))   { return; }
+    if (try_init_rmdir("direct.h"))   { return; }
+}
+
+/* Compile _charm_mkdir and _charm_rmdir. */
+void
+chaz_Dir_init(void)
+{
+    if (!initialized) { 
+        initialized = true;
+        init_mkdir();
+        init_rmdir();
+    }
+}
+
+chaz_bool_t
+chaz_Dir_mkdir(const char *filepath)
+{
+    if (!initialized) { chaz_Dir_init(); }
+    return os->run_local(os, "_charm_mkdir ", filepath, NULL);
+}
+
+chaz_bool_t
+chaz_Dir_rmdir(const char *filepath)
+{
+    if (!initialized) { chaz_Dir_init(); }
+    return os->run_local(os, "_charm_rmdir ", filepath, NULL);
+}
+
+/**
+ * Copyright 2009 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+

Added: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.harm?rev=752757&view=auto
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.harm (added)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/Dir.harm Thu Mar 12 03:25:37 2009
@@ -0,0 +1,57 @@
+/* Charmonizer/Core/Dir.h - Directory manipulation routines.
+ *
+ * Compile utilities to create and remove directories.
+ */
+
+#ifndef H_CHAZ_DIR
+#define H_CHAZ_DIR
+
+#include "Charmonizer/Core/Defines.h"
+
+/* Compile the utilities which execute the Dir_mkdir and Dir_rmdir functions. */
+void
+chaz_Dir_init(void);
+
+/* Attempt to create a directory.  Returns true on success, false on failure.
+ */
+chaz_bool_t
+chaz_Dir_mkdir(const char *filepath);
+
+/* Attempt to remove a directory, which must be empty.  Returns true on
+ * success, false on failure.
+ */
+chaz_bool_t
+chaz_Dir_rmdir(const char *filepath);
+
+/* The string command for mkdir. */
+extern char* chaz_Dir_mkdir_command;
+
+/* Indicate whether the mkdir takes 1 or 2 args. */
+extern int chaz_Dir_mkdir_num_args;
+
+#ifdef CHAZ_USE_SHORT_NAMES
+  #define Dir_init              chaz_Dir_init
+  #define Dir_mkdir             chaz_Dir_mkdir
+  #define Dir_rmdir             chaz_Dir_rmdir
+  #define Dir_mkdir_command     chaz_Dir_mkdir_command
+  #define Dir_mkdir_num_args    chaz_Dir_mkdir_num_args
+#endif
+
+#endif /* H_CHAZ_DIR */
+
+/**
+ * Copyright 2009 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.charm?rev=752757&r1=752756&r2=752757&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.charm Thu Mar 12 03:25:37 2009
@@ -19,7 +19,7 @@
 static void
 remove_obj(OperSys *self, char *name);
 
-static void
+static int 
 run_local(OperSys *self, ...);
 
 chaz_OperSys*
@@ -111,7 +111,7 @@
     remove(self->buf);
 }
 
-static void
+static int
 run_local(OperSys *self, ...)
 {
     va_list args;
@@ -126,7 +126,7 @@
     va_end(args);
 
     /* run the command */
-    system(self->buf);
+    return system(self->buf);
 }
 
 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.harm?rev=752757&r1=752756&r2=752757&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.harm Thu Mar 12 03:25:37 2009
@@ -20,7 +20,7 @@
 /* Concatenate all arguments in a NULL-terminated list into a single command
  * string, prepend the appropriate prefix, and invoke via system().
  */
-typedef void
+typedef int 
 (*chaz_OS_run_local_t)(chaz_OperSys *self, ...);
 
 /* Destructor.



From lucy-commitsqcarrillo@example.net Thu Mar 12 03:29:54 2009
Return-Path: <lucy-commitsqcarrillo@example.net>
Delivered-To: qcarrillo@example.net
Received: (qmail 17045 invoked from network); 12 Mar 2009 03:29:54 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 12 Mar 2009 03:29:54 -0000
Received: (qmail 46215 invoked by uid 500); 12 Mar 2009 03:29:54 -0000
Delivered-To: qcarrillo@example.net
Received: (qmail 46193 invoked by uid 500); 12 Mar 2009 03:29:54 -0000
Mailing-List: contact qcarrillo@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:qcarrillo@example.net>
List-Unsubscribe: <mailto:qcarrillo@example.net>
List-Post: <mailto:qcarrillo@example.net>
List-Id: <lucy-commits.lucene.apache.org>
Reply-To: qcarrillo@example.net
Delivered-To: mailing list qcarrillo@example.net
Received: (qmail 46183 invoked by uid 99); 12 Mar 2009 03:29:54 -0000
Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 20:29:54 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 03:29:51 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id D737E23888F1; Thu, 12 Mar 2009 03:29:30 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r752758 - in /lucene/lucy/trunk/charmonizer/src/Charmonizer:
 Test.charm Test.harm
Date: Thu, 12 Mar 2009 03:29:30 -0000
To: qcarrillo@example.net
From: qcarrillo@example.net
X-Mailer: svnmailer-1.0.8
Message-Id: <qcarrillo@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: marvin
Date: Thu Mar 12 03:29:30 2009
New Revision: 752758

URL: http://svn.apache.org/viewvc?rev=752758&view=rev
Log:
Change Charmonizer's tests to output TAP instead of an ad hoc custom format.

Modified:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.harm

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.charm?rev=752758&r1=752757&r2=752758&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.charm Thu Mar 12 03:29:30 2009
@@ -12,6 +12,12 @@
 static void
 TestBatch_run_test(TestBatch *batch);
 
+#define PRINT_SUPPLIED_MESS(_pattern, _args) \
+    va_start(args, pat); \
+    vprintf(pat, args); \
+    va_end(args); \
+    printf("\n");
+
 void
 chaz_Test_init(void) {
     /* unbuffer stdout */
@@ -42,6 +48,12 @@
     return batch;
 }
 
+void
+chaz_Test_plan(TestBatch *batch)
+{
+    printf("1..%u\n", batch->num_tests);
+}
+
 static void
 TestBatch_destroy(TestBatch *batch)
 {
@@ -53,18 +65,10 @@
 TestBatch_run_test(TestBatch *batch) 
 {
     /* print start */
-    printf("===================================\n");
-    printf("%s - %u tests to run\n", batch->name, batch->num_tests);
-    printf("===================================\n");
+    PLAN(batch);
 
     /* run the batch */
     batch->test_func(batch);
-
-    /* print report */
-    printf("-------------------------\n");
-    printf("Tests:   %d\nPassed:  %d\nFailed:  %d\nSkipped: %d\n\n",
-        batch->num_tests, batch->num_passed, batch->num_failed, 
-        batch->num_skipped);
 }
 
 void
@@ -77,19 +81,15 @@
 
     /* test condition and pass or fail */
     if (value) {
-        printf("%-4u pass: ", batch->test_num);
+        printf("ok %u - ", batch->test_num);
         batch->num_passed++;
     }
     else {
-        printf("%-4u fail: ", batch->test_num);
+        printf("not ok %u - ", batch->test_num);
         batch->num_failed++;
     }
     
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void
@@ -102,25 +102,20 @@
 
     /* test condition and pass or fail */
     if (value == 0) {
-        printf("%-4u pass: ", batch->test_num);
+        printf("ok %u - ", batch->test_num);
         batch->num_passed++;
     }
     else {
-        printf("%-4u fail: ", batch->test_num);
+        printf("not ok %u - ", batch->test_num);
         batch->num_failed++;
     }
     
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void 
-chaz_Test_assert_str_eq(TestBatch *batch, const char *expected, 
-                        const char *got, const char *pat, ...)
+chaz_Test_assert_str_eq(TestBatch *batch, const char *got, 
+                        const char *expected, const char *pat, ...)
 {
     va_list args;
     
@@ -129,26 +124,22 @@
     
     /* test condition and pass or fail */
     if (strcmp(expected, got) == 0) {
-        printf("%-4u pass: ", batch->test_num);
+        printf("ok %u - ", batch->test_num);
         batch->num_passed++;
     }
     else {
-        printf("%-4u fail: Expected '%s', got '%s'\n    ", batch->test_num, 
+        printf("not ok %u - Expected '%s', got '%s'\n    ", batch->test_num, 
             expected, got);
         batch->num_failed++;
     }
     
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 
 void 
-chaz_Test_assert_str_neq(TestBatch *batch, const char *expected, 
-                         const char *got, const char *pat, ...)
+chaz_Test_assert_str_neq(TestBatch *batch, const char *got, 
+                         const char *expected, const char *pat, ...)
 {
     va_list args;
     
@@ -157,20 +148,16 @@
     
     /* test condition and pass or fail */
     if (strcmp(expected, got) != 0) {
-        printf("%-4u pass: ", batch->test_num);
+        printf("ok %u - ", batch->test_num);
         batch->num_passed++;
     }
     else {
-        printf("%-4u fail: Expected '%s', got '%s'\n    ", batch->test_num, 
+        printf("not ok %u - Expected '%s', got '%s'\n    ", batch->test_num, 
             expected, got);
         batch->num_failed++;
     }
     
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void 
@@ -182,14 +169,10 @@
     batch->test_num++;
 
     /* indicate pass, update pass counter */
-    printf("%-4u pass: ", batch->test_num);
+    printf("ok %u - ", batch->test_num);
     batch->num_passed++;
 
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void 
@@ -201,18 +184,14 @@
     batch->test_num++;
 
     /* indicate failure, update pass counter */
-    printf("%-4u fail:\n", batch->test_num);
+    printf("not ok %u - ", batch->test_num);
     batch->num_failed++;
 
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void 
-chaz_Test_assert_int_eq(TestBatch *batch, long expected, long got, 
+chaz_Test_assert_int_eq(TestBatch *batch, long got, long expected, 
                         const char *pat, ...)
 {
     va_list args;
@@ -221,25 +200,21 @@
     batch->test_num++;
 
     if (expected == got) {
-        printf("%-4u pass: ", batch->test_num);
+        printf("ok %u - ", batch->test_num);
         batch->num_passed++;
     }
     else {
-        printf("%-4u fail: Expected '%ld', got '%ld'\n    ", batch->test_num, 
+        printf("not ok %u - Expected '%ld', got '%ld'\n    ", batch->test_num, 
             expected, got);
         batch->num_failed++;
     }
     
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void 
-chaz_Test_assert_float_eq(TestBatch *batch, double expected, 
-                          double got, const char *pat, ...)
+chaz_Test_assert_float_eq(TestBatch *batch, double got, 
+                          double expected, const char *pat, ...)
 {
     va_list args;
     double diff = expected/got;
@@ -249,21 +224,16 @@
     
     /* evaluate condition and pass or fail */
     if (diff > 0.00001) {
-        printf("%-4u pass: ", batch->test_num);
+        printf("ok %u - ", batch->test_num);
         batch->num_passed++;
     }
     else {
-        printf("%-4u fail: Expected '%f', got '%f'\n    ", batch->test_num, 
+        printf("not ok %u - Expected '%f', got '%f'\n    ", batch->test_num, 
             expected, got);
         batch->num_failed++;
     }
     
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
-
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void
@@ -275,14 +245,10 @@
     batch->test_num++;
 
     /* indicate that test is being skipped, update pass counter */
-    printf("%-4d skip: ", batch->test_num);
+    printf("ok %u # SKIP ", batch->test_num);
     batch->num_skipped++;
 
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    PRINT_SUPPLIED_MESS(pat, args);
 }
 
 void
@@ -292,14 +258,11 @@
     unsigned remaining = batch->num_tests - batch->test_num;
     
     /* indicate that tests are being skipped, update skip counter */
-    batch->num_skipped += remaining;
-    printf("Skipping all %u remaining tests: ", remaining);
-
-    /* print supplied message */
-    va_start(args, pat);
-    vprintf(pat, args);
-    va_end(args);
-    printf("\n");
+    printf("# Skipping all %u remaining tests: ", remaining);
+    PRINT_SUPPLIED_MESS(pat, args);
+    while (batch->test_num < batch->num_tests) {
+        SKIP(batch, "");
+    }
 }
 
 /**

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.harm?rev=752758&r1=752757&r2=752758&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Test.harm Thu Mar 12 03:29:30 2009
@@ -49,6 +49,7 @@
 
 /* Note: maybe add line numbers later.
  */
+#define CHAZ_TEST_PLAN              chaz_Test_plan
 #define CHAZ_TEST_ASSERT_TRUE       chaz_Test_assert_true
 #define CHAZ_TEST_ASSERT_FALSE      chaz_Test_assert_false
 #define CHAZ_TEST_ASSERT_STR_EQ     chaz_Test_assert_str_eq
@@ -72,6 +73,8 @@
         return; \
     } while (0)
 
+void
+chaz_Test_plan(chaz_TestBatch *batch);
 
 void 
 chaz_Test_assert_true(chaz_TestBatch *batch, int expression, 
@@ -82,12 +85,12 @@
                            const char *pat, ...);
 
 void 
-chaz_Test_assert_str_eq(chaz_TestBatch *batch, const char *expected, 
-                            const char *got, const char *pat, ...);
+chaz_Test_assert_str_eq(chaz_TestBatch *batch, const char *got, 
+                            const char *expected, const char *pat, ...);
 
 void 
-chaz_Test_assert_str_neq(chaz_TestBatch *batch, const char *expected,
-                             const char *got, const char *pat, ...);
+chaz_Test_assert_str_neq(chaz_TestBatch *batch, const char *got,
+                             const char *expected, const char *pat, ...);
 
 void 
 chaz_Test_pass(chaz_TestBatch *batch, const char *pat, ...);
@@ -96,12 +99,12 @@
 chaz_Test_fail(chaz_TestBatch *batch, const char *pat, ...);
 
 void 
-chaz_Test_assert_int_eq(chaz_TestBatch *batch, long expected, long got, 
+chaz_Test_assert_int_eq(chaz_TestBatch *batch, long got, long expected, 
                             const char *pat, ...);
 
 void 
-chaz_Test_assert_float_eq(chaz_TestBatch *batch, double expected, 
-                              double got, const char *pat, ...);
+chaz_Test_assert_float_eq(chaz_TestBatch *batch, double got, 
+                              double expected, const char *pat, ...);
 
 void
 chaz_Test_skip(chaz_TestBatch *batch, const char *pat, ...);
@@ -117,6 +120,8 @@
   #define TestBatch                    chaz_TestBatch
   #define Test_init                    chaz_Test_init
   #define Test_new_batch               chaz_Test_new_batch
+  #define Test_plan                    chaz_Test_plan
+  #define PLAN                         CHAZ_TEST_PLAN
   #define ASSERT_TRUE                  CHAZ_TEST_ASSERT_TRUE
   #define ASSERT_FALSE                 CHAZ_TEST_ASSERT_FALSE
   #define ASSERT_STR_EQ                CHAZ_TEST_ASSERT_STR_EQ



From lucy-commitsqcarrillo@example.net Thu Mar 12 03:32:27 2009
Return-Path: <lucy-commitsqcarrillo@example.net>
Delivered-To: qcarrillo@example.net
Received: (qmail 18527 invoked from network); 12 Mar 2009 03:32:27 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 12 Mar 2009 03:32:27 -0000
Received: (qmail 48132 invoked by uid 500); 12 Mar 2009 03:32:27 -0000
Delivered-To: qcarrillo@example.net
Received: (qmail 48107 invoked by uid 500); 12 Mar 2009 03:32:26 -0000
Mailing-List: contact qcarrillo@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:qcarrillo@example.net>
List-Unsubscribe: <mailto:qcarrillo@example.net>
List-Post: <mailto:qcarrillo@example.net>
List-Id: <lucy-commits.lucene.apache.org>
Reply-To: qcarrillo@example.net
Delivered-To: mailing list qcarrillo@example.net
Received: (qmail 48098 invoked by uid 99); 12 Mar 2009 03:32:26 -0000
Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 20:32:26 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 03:32:24 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id D40EE23888F1; Thu, 12 Mar 2009 03:32:03 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r752759 - in
 /lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe: Integers.charm
 Integers.harm
Date: Thu, 12 Mar 2009 03:32:03 -0000
To: qcarrillo@example.net
From: qcarrillo@example.net
X-Mailer: svnmailer-1.0.8
Message-Id: <qcarrillo@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: marvin
Date: Thu Mar 12 03:32:02 2009
New Revision: 752759

URL: http://svn.apache.org/viewvc?rev=752759&view=rev
Log:
Add PTR2I64 macro.

Modified:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm?rev=752759&r1=752758&r2=752759&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.charm Thu Mar 12 03:32:02 2009
@@ -311,6 +311,18 @@
         append_conf("#define CHY_U64_C(n) n##%s\n", u64_t_postfix);
     }
 
+    /* Create macro for promoting pointers to integers. */
+    if (has_64) {
+        if (sizeof_ptr == 8) {
+            append_conf("#define CHY_PTR2I64(ptr) "
+                "((chy_i64_t)(chy_u64_t)(ptr))\n");
+        }
+        else {
+            append_conf("#define CHY_PTR2I64(ptr) "
+                "((chy_i64_t)(chy_u32_t)(ptr))\n");
+        }
+    }
+
     /* true and false */
     append_conf(
         "#ifndef true\n"
@@ -382,6 +394,7 @@
         shorten_macro("U64P");
         shorten_macro("I64_C");
         shorten_macro("U64_C");
+        shorten_macro("PTR2I64");
     } 
     END_SHORT_NAMES;
     

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm?rev=752759&r1=752758&r2=752759&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.harm Thu Mar 12 03:32:02 2009
@@ -67,9 +67,14 @@
  * I32_MIN
  * I64_MIN
  *
- * If 64-bit integers type are available, these macros will expand to the
- * printf conversion specification for signed and unsigned versions (most
- * commonly "lld" and "llu").
+ * If 64-bit integers are available, this macro will promote pointers to i64_t
+ * safely.
+ * 
+ * PTR2I64(ptr)
+ *
+ * If 64-bit integers are available, these macros will expand to the printf
+ * conversion specification for signed and unsigned versions (most commonly
+ * "lld" and "llu").
  *
  * I64P
  * U64P



From lucy-commitsqcarrillo@example.net Thu Mar 12 03:38:48 2009
Return-Path: <lucy-commitsqcarrillo@example.net>
Delivered-To: qcarrillo@example.net
Received: (qmail 19889 invoked from network); 12 Mar 2009 03:38:48 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 12 Mar 2009 03:38:48 -0000
Received: (qmail 50812 invoked by uid 500); 12 Mar 2009 03:38:48 -0000
Delivered-To: qcarrillo@example.net
Received: (qmail 50794 invoked by uid 500); 12 Mar 2009 03:38:48 -0000
Mailing-List: contact qcarrillo@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:qcarrillo@example.net>
List-Unsubscribe: <mailto:qcarrillo@example.net>
List-Post: <mailto:qcarrillo@example.net>
List-Id: <lucy-commits.lucene.apache.org>
Reply-To: qcarrillo@example.net
Delivered-To: mailing list qcarrillo@example.net
Received: (qmail 50785 invoked by uid 99); 12 Mar 2009 03:38:48 -0000
Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 20:38:48 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 03:38:46 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 1DE4923888F1; Thu, 12 Mar 2009 03:38:25 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r752761 - in /lucene/lucy/trunk: c_src/compat/
 charmonizer/src/Charmonizer/Probe/LargeFiles.charm
Date: Thu, 12 Mar 2009 03:38:25 -0000
To: qcarrillo@example.net
From: qcarrillo@example.net
X-Mailer: svnmailer-1.0.8
Message-Id: <qcarrillo@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: marvin
Date: Thu Mar 12 03:38:24 2009
New Revision: 752761

URL: http://svn.apache.org/viewvc?rev=752761&view=rev
Log:
Ditch ftello64 emulation for outdated Windows compilers.

Removed:
    lucene/lucy/trunk/c_src/compat/
Modified:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.charm

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.charm?rev=752761&r1=752760&r2=752761&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.charm Thu Mar 12 03:38:24 2009
@@ -22,8 +22,8 @@
     { "#include <sys/types.h>\n", "fopen64",   "ftello64",  "fseeko64",  "off64_t" },
     { "#include <sys/types.h>\n", "fopen",     "ftello64",  "fseeko64",  "off64_t" },
     { "#include <sys/types.h>\n", "fopen",     "ftello",    "fseeko",    "off_t"   },
-    { "",                         "fopen",     "ftell",     "fseek",     "long"    },
     { "",                         "fopen",     "_ftelli64", "_fseeki64", "__int64" },
+    { "",                         "fopen",     "ftell",     "fseek",     "long"    },
     { NULL, NULL, NULL, NULL, NULL }
 };
 typedef struct unbuff_combo {



From lucy-commitsqcarrillo@example.net Thu Mar 12 04:16:39 2009
Return-Path: <lucy-commitsqcarrillo@example.net>
Delivered-To: qcarrillo@example.net
Received: (qmail 27815 invoked from network); 12 Mar 2009 04:16:37 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 12 Mar 2009 04:16:37 -0000
Received: (qmail 66315 invoked by uid 500); 12 Mar 2009 04:16:37 -0000
Delivered-To: qcarrillo@example.net
Received: (qmail 66295 invoked by uid 500); 12 Mar 2009 04:16:37 -0000
Mailing-List: contact qcarrillo@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:qcarrillo@example.net>
List-Unsubscribe: <mailto:qcarrillo@example.net>
List-Post: <mailto:qcarrillo@example.net>
List-Id: <lucy-commits.lucene.apache.org>
Reply-To: qcarrillo@example.net
Delivered-To: mailing list qcarrillo@example.net
Received: (qmail 66286 invoked by uid 99); 12 Mar 2009 04:16:37 -0000
Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 21:16:37 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 04:16:34 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 9C82323888F1; Thu, 12 Mar 2009 04:16:12 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r752768 - in /lucene/lucy/trunk/charmonizer: ./
 src/Charmonizer/Probe/ src/Charmonizer/Test/
Date: Thu, 12 Mar 2009 04:16:12 -0000
To: qcarrillo@example.net
From: qcarrillo@example.net
X-Mailer: svnmailer-1.0.8
Message-Id: <qcarrillo@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: marvin
Date: Thu Mar 12 04:16:10 2009
New Revision: 752768

URL: http://svn.apache.org/viewvc?rev=752768&view=rev
Log:
Expand directory probing to include dirent.h, mkdir.  Add a header probe for
sys/mman.h.

Added:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.charm
      - copied, changed from r692704, lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.harm
      - copied, changed from r692704, lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.harm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/DirManip.charm
Removed:
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.harm
Modified:
    lucene/lucy/trunk/charmonizer/charmonize.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.charm
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.harm

Modified: lucene/lucy/trunk/charmonizer/charmonize.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/charmonize.c?rev=752768&r1=752767&r2=752768&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/charmonize.c (original)
+++ lucene/lucy/trunk/charmonizer/charmonize.c Thu Mar 12 04:16:10 2009
@@ -7,13 +7,15 @@
 #include <string.h>
 #include <stdarg.h>
 #include "Charmonizer/Probe.h"
-#include "Charmonizer/Probe/DirSep.h"
+#include "Charmonizer/Probe/DirManip.h"
 #include "Charmonizer/Probe/FuncMacro.h"
 #include "Charmonizer/Probe/Headers.h"
 #include "Charmonizer/Probe/Integers.h"
 #include "Charmonizer/Probe/LargeFiles.h"
 #include "Charmonizer/Probe/UnusedVars.h"
 #include "Charmonizer/Probe/VariadicMacros.h"
+#include "Charmonizer/Core/HeadCheck.h"
+#include "Charmonizer/Core/ModHandler.h"
 
 char *cc_command, *cc_flags, *os_name, *verbosity_str;
 
@@ -49,7 +51,7 @@
     init(argc, argv);
 
     /* modules section */
-    chaz_DirSep_run();
+    chaz_DirManip_run();
     chaz_Headers_run();
     chaz_FuncMacro_run();
     chaz_Integers_run();
@@ -151,7 +153,9 @@
 static void
 write_charmony_postamble(void)
 {
-    /* No postamble for now. */
+    if (chaz_HeadCheck_check_header("sys/mman.h")) {
+        chaz_ModHand_append_conf("#define CHY_HAS_SYS_MMAN_H\n\n");
+    }
 }
 
 void 

Copied: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.charm (from r692704, lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.charm)
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.charm?p2=lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.charm&p1=lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.charm&r1=692704&r2=752768&rev=752768&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.charm Thu Mar 12 04:16:10 2009
@@ -1,126 +1,121 @@
 #define CHAZ_USE_SHORT_NAMES
 
 #include "Charmonizer/Core/ModHandler.h"
+#include "Charmonizer/Core/Dir.h"
 #include "Charmonizer/Core/Util.h"
 #include "Charmonizer/Core/HeadCheck.h"
-#include "Charmonizer/Probe/DirSep.h"
+#include "Charmonizer/Probe/DirManip.h"
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-/* TODO: move mkdir and rmdir to a Core module a la Stat. */
-static char mkdir_code[] = METAQUOTE
-    #include "_charm.h"
-    %s
-    #include <sys/stat.h>
-    int main () {
-        Charm_Setup;
-        if (mkdir("_charm_test_dir_orig", 0777) == 0) {
-            printf("1");
-        }
-        return 0;
+void
+chaz_DirManip_run(void) 
+{
+    FILE *f;
+    char dir_sep[3];
+    chaz_bool_t dir_sep_is_valid = false;
+    chaz_bool_t remove_zaps_dirs = false;
+    chaz_bool_t has_dirent_h = check_header("dirent.h");
+    chaz_bool_t has_direct_h = check_header("direct.h");
+    chaz_bool_t has_dirent_d_namlen = false;
+    chaz_bool_t has_dirent_d_type   = false;
+
+    START_RUN("DirManip");
+    Dir_init();
+
+    /* Header checks. */
+    if (has_dirent_h) {
+        append_conf("#define CHY_HAS_DIRENT_H\n");
     }
-METAQUOTE;
-
-static char *headers[] = {
-    "direct.h",
-    "unistd.h",
-    "sys/stat.h",
-    NULL,
-};
-
-static char rmdir_code[] = METAQUOTE
-    #include "_charm.h"
-    %s
-    int main () {
-        Charm_Setup;
-        printf("1");
-        rmdir("_charm_test_dir_orig");
-        rmdir("_charm_test_dir_mod");
-        return 0;
+    if (has_direct_h) {
+        append_conf("#define CHY_HAS_DIRECT_H\n");
     }
-METAQUOTE;
 
-void
-chaz_DirSep_run(void) 
-{
-    int          i;
-    char        *output;
-    size_t       output_len;
-    char         dir_sep[3];
-    chaz_bool_t  dir_sep_is_valid = false;
-    char        *includes_buf = strdup("");
-    size_t       inc_buf_len = 2;
-    size_t       needed;
-    char        *code_buf;
-
-    START_RUN("DirSep");
-
-    /* Include any possible relevant headers. */
-    for (i = 0; headers[i] != NULL; i++) {
-        if (!check_header(headers[i])) 
-            break;
-        inc_buf_len = append_strings(&includes_buf, inc_buf_len, "#include <",
-            headers[i], ">\n", NULL);
-    }
-    needed = strlen(mkdir_code) + inc_buf_len + 10;
-    code_buf = malloc(needed);
-    sprintf(code_buf, mkdir_code, includes_buf);
-
-    /* create a directory */
-    output = capture_output(code_buf, strlen(code_buf), &output_len);
-
-    if (output != NULL && (strcmp(output, "1") == 0)) {
-        FILE *f;
-
-        /* clean up */
-        free(output);
-
-        /* try to create files under the new directory */
-        if ( (f = fopen("_charm_test_dir_orig\\backslash", "w")) != NULL)
-            fclose(f);
-        if ( (f = fopen("_charm_test_dir_orig/slash", "w")) != NULL)
-            fclose(f);
-
-        /* rename the directory, and see which file we can get to */
-        rename("_charm_test_dir_orig", "_charm_test_dir_mod");
-        if ( (f = fopen("_charm_test_dir_mod\\backslash", "r")) != NULL) {
-            fclose(f);
-            strcpy(dir_sep, "\\\\");
-            dir_sep_is_valid = true;
+    /* Check for members in struct dirent. */
+    if (has_dirent_h) {
+        has_dirent_d_namlen = HeadCheck_contains_member("struct dirent", 
+            "d_namlen", "#include <sys/types.h>\n#include <dirent.h>");
+        if (has_dirent_d_namlen) {
+            append_conf("#define CHY_HAS_DIRENT_D_NAMLEN\n", dir_sep);
         }
-        else if ( (f = fopen("_charm_test_dir_mod/slash", "r")) != NULL) {
-            fclose(f);
-            strcpy(dir_sep, "/");
-            dir_sep_is_valid = true;
+        has_dirent_d_type = HeadCheck_contains_member("struct dirent", 
+            "d_type", "#include <sys/types.h>\n#include <dirent.h>");
+        if (has_dirent_d_type) {
+            append_conf("#define CHY_HAS_DIRENT_D_TYPE\n", dir_sep);
         }
     }
 
-    /* clean up - delete all possible files without verifying */
+    if (Dir_mkdir_num_args == 2) {
+        /* It's two args, but the command isn't "mkdir". */
+        append_conf("#define chy_makedir(_dir, _mode) %s(_dir, _mode)\n",
+            Dir_mkdir_command);
+        append_conf("#define CHY_MAKEDIR_MODE_IGNORED 0\n");
+    }
+    else if (Dir_mkdir_num_args == 1) {
+        /* It's one arg... mode arg will be ignored. */
+        append_conf("#define chy_makedir(_dir, _mode) %s(_dir)\n",
+            Dir_mkdir_command);
+        append_conf("#define CHY_MAKEDIR_MODE_IGNORED 1\n");
+    }
+
+    /* Create a directory. */
+    Dir_mkdir("_charm_test_dir_orig");
+
+    /* Try to create files under the new directory. */
+    if ( (f = fopen("_charm_test_dir_orig\\backslash", "w")) != NULL) {
+        fclose(f);
+    }
+    if ( (f = fopen("_charm_test_dir_orig/slash", "w")) != NULL) {
+        fclose(f);
+    }
+
+    /* Rename the directory, then see which file we can get to. */
+    rename("_charm_test_dir_orig", "_charm_test_dir_mod");
+    if ( (f = fopen("_charm_test_dir_mod\\backslash", "r")) != NULL) {
+        fclose(f);
+        strcpy(dir_sep, "\\\\");
+        dir_sep_is_valid = true;
+    }
+    else if ( (f = fopen("_charm_test_dir_mod/slash", "r")) != NULL) {
+        fclose(f);
+        strcpy(dir_sep, "/");
+        dir_sep_is_valid = true;
+    }
+    if (dir_sep_is_valid) {
+        append_conf("#define CHY_DIR_SEP \"%s\"\n", dir_sep);
+    }
+
+    /* Clean up - delete all possible files without verifying. */
     remove("_charm_test_dir_mod/slash");
     remove("_charm_test_dir_mod\\backslash");
     remove("_charm_test_dir_orig/slash");
     remove("_charm_test_dir_orig\\backslash");
-    remove("_charm_test_dir_orig");
-    remove("_charm_test_dir_mod");
+    Dir_rmdir("_charm_test_dir_orig");
+    Dir_rmdir("_charm_test_dir_mod");
 
-    /* Try rmdir. */
-    sprintf(code_buf, rmdir_code, includes_buf);
-    output = capture_output(code_buf, strlen(code_buf), &output_len);
+    /* See whether remove works on directories. */
+    Dir_mkdir("_charm_test_remove_me");
+    if (0 == remove("_charm_test_remove_me")) {
+        remove_zaps_dirs = true;
+        append_conf("#define CHY_REMOVE_ZAPS_DIRS\n");
+    }
+    Dir_rmdir("_charm_test_remove_me");
 
-    if (dir_sep_is_valid) {
-        append_conf("#define CHY_DIR_SEP \"%s\"\n", dir_sep);
+    /* Shorten. */
+    START_SHORT_NAMES;
+    if (dir_sep_is_valid) { shorten_macro("DIR_SEP"); }
+    if (has_dirent_h)     { shorten_macro("HAS_DIRENT_H"); }
+    if (has_direct_h)     { shorten_macro("HAS_DIRECT_H"); }
+    if (has_dirent_d_namlen) { shorten_macro("HAS_DIRENT_D_NAMLEN"); }
+    if (has_dirent_d_type)   { shorten_macro("HAS_DIRENT_D_TYPE"); }
+    shorten_function("makedir");
+    shorten_macro("MAKEDIR_MODE_IGNORED");
+    if (remove_zaps_dirs) { shorten_macro("REMOVE_ZAPS_DIRS"); }
 
-        /* shorten */
-        START_SHORT_NAMES;
-        shorten_macro("DIR_SEP");
-        END_SHORT_NAMES;
-    }
+    END_SHORT_NAMES;
 
     END_RUN;
-
-    free(code_buf);
-    free(includes_buf);
 }
 
 

Copied: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.harm (from r692704, lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.harm)
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.harm?p2=lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.harm&p1=lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.harm&r1=692704&r2=752768&rev=752768&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirSep.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.harm Thu Mar 12 04:16:10 2009
@@ -1,21 +1,45 @@
-/* Charmonizer/Probe/DirSep.h
+/* Charmonizer/Probe/DirManip.h
  */
 
-#ifndef H_CHAZ_DIR_SEP
-#define H_CHAZ_DIR_SEP 
+#ifndef H_CHAZ_DIRMANIP
+#define H_CHAZ_DIRMANIP 
 
-/* Run the DirSep module.
+/* The DirManip module exports or aliases symbols related to directory and file
+ * manipulation.
  *
- * Exports one symbol, which is a string representing the system's directory
- * separator.
+ * Defined if the header files dirent.h and direct.h are available, respectively:
+ *
+ * HAS_DIRENT_H
+ * HAS_DIRECT_H
+ *
+ * Defined if struct dirent has these members.
  * 
- * DIR_SEP
+ * HAS_DIRENT_D_NAMLEN
+ * HAS_DIRENT_D_TYPE
+ *
+ * The "makedir" macro will be aliased to the POSIX-specified two-argument
+ * "mkdir" interface:  
+ * 
+ * makedir 
+ *
+ * On some systems, the second argument to makedir will be ignored, in which
+ * case this symbol will be true; otherwise, it will be false: (TODO: This
+ * isn't verified and may sometimes be incorrect.)
  * 
+ * MAKEDIR_MODE_IGNORED
+ *
+ * String representing the system's directory separator:
+ * 
+ * DIR_SEP
+ *
+ * True if the remove() function removes directories, false otherwise:
+ *
+ * REMOVE_ZAPS_DIRS
  */
-void chaz_DirSep_run(void);
+void chaz_DirManip_run(void);
 
 #ifdef CHAZ_USE_SHORT_NAMES
-  #define DirSep_run    chaz_DirSep_run
+  #define DirManip_run    chaz_DirManip_run
 #endif
 
 #endif /* H_CHAZ_DIR_SEP */

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.charm?rev=752768&r1=752767&r2=752768&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.charm Thu Mar 12 04:16:10 2009
@@ -12,14 +12,15 @@
     chaz_Test_init();
 
     /* create a null-terminated array of test batches to iterate over */
-    batches = malloc(7 * sizeof(TestBatch*));
-    batches[0] = chaz_TFuncMacro_prepare();
-    batches[1] = chaz_THeaders_prepare();
-    batches[2] = chaz_TIntegers_prepare();
-    batches[3] = chaz_TLargeFiles_prepare();
-    batches[4] = chaz_TUnusedVars_prepare();
-    batches[5] = chaz_TVariadicMacros_prepare();
-    batches[6] = NULL;
+    batches = malloc(8 * sizeof(TestBatch*));
+    batches[0] = chaz_TDirManip_prepare();
+    batches[1] = chaz_TFuncMacro_prepare();
+    batches[2] = chaz_THeaders_prepare();
+    batches[3] = chaz_TIntegers_prepare();
+    batches[4] = chaz_TLargeFiles_prepare();
+    batches[5] = chaz_TUnusedVars_prepare();
+    batches[6] = chaz_TVariadicMacros_prepare();
+    batches[7] = NULL;
 }
 
 void

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.harm?rev=752768&r1=752767&r2=752768&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.harm Thu Mar 12 04:16:10 2009
@@ -28,6 +28,10 @@
  * problem of silent failure is less severe than it appears, affecting only
  * fallbacks.
  */
+
+chaz_TestBatch* 
+chaz_TDirManip_prepare();
+
 chaz_TestBatch* 
 chaz_TFuncMacro_prepare();
 
@@ -47,6 +51,9 @@
 chaz_TVariadicMacros_prepare();
 
 void
+chaz_TDirManip_run(chaz_TestBatch *batch);
+
+void
 chaz_TFuncMacro_run(chaz_TestBatch *batch);
 
 void
@@ -65,6 +72,7 @@
 chaz_TVariadicMacros_run(chaz_TestBatch *batch);
 
 #ifdef CHAZ_USE_SHORT_NAMES
+  #define TDirManip_prepare            chaz_TDirManip_prepare
   #define TFuncMacro_prepare           chaz_TFuncMacro_prepare
   #define THeaders_prepare             chaz_THeaders_prepare
   #define TIntegers_prepare            chaz_TIntegers_prepare

Added: lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/DirManip.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/DirManip.charm?rev=752768&view=auto
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/DirManip.charm (added)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Test/DirManip.charm Thu Mar 12 04:16:10 2009
@@ -0,0 +1,74 @@
+#define CHAZ_USE_SHORT_NAMES
+
+#include "Charmonizer/Test.h"
+#include "Charmonizer/Test/AllTests.h"
+#include <stdio.h>
+#include <string.h>
+#include "charmony.h"
+#ifdef HAS_DIRENT_H
+  #include <dirent.h>
+#endif
+#ifdef HAS_SYS_STAT_H
+  #include <sys/stat.h>
+#endif
+#ifdef HAS_SYS_TYPES_H
+  #include <sys/stat.h>
+#endif
+#ifdef HAS_UNISTD_H
+  #include <unistd.h>
+#endif
+#ifdef HAS_DIRECT_H
+  #include <direct.h>
+#endif
+
+TestBatch*
+chaz_TDirManip_prepare()
+{
+    return Test_new_batch("Integers", 6, chaz_TDirManip_run);
+}
+
+void
+chaz_TDirManip_run(TestBatch *batch)
+{
+    ASSERT_INT_EQ(batch, 0, makedir("_chaz_test_dir", 0777), "makedir");
+    ASSERT_INT_EQ(batch, 0, makedir("_chaz_test_dir" DIR_SEP "deep", 0777),
+        "makedir with DIR_SEP");
+    ASSERT_INT_EQ(batch, 0, rmdir("_chaz_test_dir" DIR_SEP "deep"),
+        "rmdir with DIR_SEP");
+    ASSERT_INT_EQ(batch, 0, rmdir("_chaz_test_dir"), "rmdir");
+#ifdef CHY_HAS_DIRENT_D_NAMLEN
+    {
+        struct dirent entry;
+        entry.d_namlen = 5;
+        ASSERT_INT_EQ(batch, 5, entry.d_namlen, "d_namlen");
+    }
+#else
+    SKIP(batch, "no d_namlen member on this platform");
+#endif
+#ifdef CHY_HAS_DIRENT_D_TYPE
+    {
+        struct dirent entry;
+        entry.d_type = 5;
+        ASSERT_INT_EQ(batch, 5, entry.d_type, "d_type");
+    }
+#else
+    SKIP(batch, "no d_type member on this platform");
+#endif
+}
+
+/**
+ * Copyright 2009 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+



From lucy-commitsqcarrillo@example.net Thu Mar 12 04:42:06 2009
Return-Path: <lucy-commitsqcarrillo@example.net>
Delivered-To: qcarrillo@example.net
Received: (qmail 33180 invoked from network); 12 Mar 2009 04:42:05 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 12 Mar 2009 04:42:05 -0000
Received: (qmail 77569 invoked by uid 500); 12 Mar 2009 04:42:05 -0000
Delivered-To: qcarrillo@example.net
Received: (qmail 77551 invoked by uid 500); 12 Mar 2009 04:42:05 -0000
Mailing-List: contact qcarrillo@example.net; run by ezmlm
Precedence: bulk
List-Help: <mailto:qcarrillo@example.net>
List-Unsubscribe: <mailto:qcarrillo@example.net>
List-Post: <mailto:qcarrillo@example.net>
List-Id: <lucy-commits.lucene.apache.org>
Reply-To: qcarrillo@example.net
Delivered-To: mailing list qcarrillo@example.net
Received: (qmail 77542 invoked by uid 99); 12 Mar 2009 04:42:05 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 21:42:05 -0700
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 04:42:05 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 1501323888CA; Thu, 12 Mar 2009 04:41:45 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r752770 - in /lucene/lucy/trunk: c_src/ core/ core/Lucy/
 core/compat/
Date: Thu, 12 Mar 2009 04:41:45 -0000
To: qcarrillo@example.net
From: qcarrillo@example.net
X-Mailer: svnmailer-1.0.8
Message-Id: <qcarrillo@example.net>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: marvin
Date: Thu Mar 12 04:41:44 2009
New Revision: 752770

URL: http://svn.apache.org/viewvc?rev=752770&view=rev
Log:
Move trunk/c_src to trunk/core, making way for a future c binding in trunk/c
or trunk/c_src.

Added:
    lucene/lucy/trunk/core/
      - copied from r692704, lucene/lucy/trunk/c_src/
    lucene/lucy/trunk/core/Lucy/
      - copied from r752769, lucene/lucy/trunk/c_src/Lucy/
Removed:
    lucene/lucy/trunk/c_src/
    lucene/lucy/trunk/core/compat/



{'source': 'Apache Software Foundation Public Mail Archives'}