lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r468613 - in /lucene/lucy/trunk/charmonizer/src/Charmonizer/Core: OperSys.charm OperSys.harm
Date Sat, 28 Oct 2006 02:17:59 GMT
Author: marvin
Date: Fri Oct 27 19:17:59 2006
New Revision: 468613

URL: http://svn.apache.org/viewvc?view=rev&rev=468613
Log:
Add the convenience method run_local() to OperSys.

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

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?view=diff&rev=468613&r1=468612&r2=468613
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.charm Fri Oct 27 19:17:59 2006
@@ -2,6 +2,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "Charmonizer/Core/Util.h"
 #include "Charmonizer/Core/OperSys.h"
@@ -18,6 +19,9 @@
 static void
 remove_obj(OperSys *self, char *name);
 
+static void
+run_local(OperSys *self, ...);
+
 chaz_OperSys*
 chaz_OS_new(const char *name) 
 {
@@ -31,6 +35,7 @@
     self->buf_len    = 0;
     self->remove_obj = remove_obj;
     self->remove_exe = remove_exe;
+    self->run_local  = run_local;
     self->destroy    = destroy;
 
     if (strcmp(name, "mswin32") == 0) {
@@ -87,16 +92,34 @@
 static void
 remove_exe(OperSys *self, char *name)
 {
-    join_strings(&(self->buf), self->buf_len, name, self->exe_ext, NULL);
+    self->buf_len = join_strings(&(self->buf), self->buf_len, name, 
+        self->exe_ext, NULL);
     remove(self->buf);
 }
 
 static void
 remove_obj(OperSys *self, char *name)
 {
-    join_strings(&(self->buf), self->buf_len, name, self->obj_ext, NULL);
+    self->buf_len = join_strings(&(self->buf), self->buf_len, name, 
+        self->obj_ext, NULL);
     remove(self->buf);
 }
+
+static void
+run_local(OperSys *self, ...)
+{
+    va_list args;
+
+    self->buf_len = join_strings(&(self->buf), self->buf_len,
+        self->local_command_start, NULL);
+
+    va_start(args, self);
+    self->buf_len = vappend_strings(&(self->buf), self->buf_len, args);
+    va_end(args);
+
+    system(self->buf);
+}
+
 
 /**
  * Copyright 2006 The Apache Software Foundation

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?view=diff&rev=468613&r1=468612&r2=468613
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/OperSys.harm Fri Oct 27 19:17:59 2006
@@ -17,6 +17,12 @@
 typedef void
 (*chaz_OS_remove_obj_t)(chaz_OperSys *self, char *name);
 
+/* Concatenate all arguments in a NULL-terminated list into a single command
+ * string, prepend the appropriate prefix, and invoke via system().
+ */
+typedef void
+(*chaz_OS_run_local_t)(chaz_OperSys *self, ...);
+
 /* Destructor.
  */
 typedef void
@@ -32,6 +38,7 @@
     size_t      buf_len;
     chaz_OS_remove_exe_t remove_exe;
     chaz_OS_remove_obj_t remove_obj;
+    chaz_OS_run_local_t  run_local;
     chaz_OS_destroy_t    destroy;
 };
 
@@ -46,6 +53,7 @@
 # define OperSys                      chaz_OperSys
 # define OS_remove_exe_t              chaz_OS_remove_exe_t
 # define OS_remove_obj_t              chaz_OS_remove_obj_t
+# define OS_run_local_t               chaz_OS_run_local_t
 # define OS_destroy_t                 chaz_OS_destroy_t
 # define OS_new                       chaz_OS_new
 #endif



Mime
View raw message