[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203

Stephane Popinet popinet at users.sf.net
Fri May 15 02:55:05 UTC 2009


The following commit has been merged in the upstream branch:
commit 9234b1eb39c3976deff7dd25f1a5e9cbf5da9586
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Thu Mar 6 11:22:02 2008 +1100

    GfsOutput pipes now know the pre-defined Gerris shell variables
    
    darcs-hash:20080306002202-d4795-8f1122b259a0df61581b12a0ace19d09011e1926.gz

diff --git a/src/event.c b/src/event.c
index 5bcdb91..a24d240 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1563,7 +1563,17 @@ static void gfs_event_script_read (GtsObject ** o, GtsFile * fp)
     gts_file_next_token (fp);
 }
 
-static FILE * gfs_popen (GfsSimulation * sim, const char * command, const char * type)
+/**
+ * gfs_popen:
+ * @sim: a #GfsSimulation.
+ * @command: a shell command.
+ * @type: "r" for reading or "w" for writing.
+ *
+ * Returns: a file descriptor pointing to a pipe opened using the
+ * standard popen() command but which also defines standard Gerris
+ * shell variables. In case of error returns %NULL.
+ */
+FILE * gfs_popen (GfsSimulation * sim, const char * command, const char * type)
 {
   g_return_val_if_fail (command != NULL, NULL);
   g_return_val_if_fail (type != NULL, NULL);
diff --git a/src/event.h b/src/event.h
index 873561f..e85424c 100644
--- a/src/event.h
+++ b/src/event.h
@@ -228,6 +228,10 @@ GfsEventClass * gfs_event_stop_class  (void);
 
 /* GfsEventScript: Header */
 
+FILE * gfs_popen (GfsSimulation * sim, 
+		  const char * command, 
+		  const char * type);
+
 typedef struct _GfsEventScript         GfsEventScript;
 
 struct _GfsEventScript {
diff --git a/src/output.c b/src/output.c
index d952d95..b2c7df0 100644
--- a/src/output.c
+++ b/src/output.c
@@ -143,7 +143,12 @@ static gboolean gfs_output_event (GfsEvent * event, GfsSimulation * sim)
 	  guint len = strlen (output->format);
 	  g_assert (output->format[len - 1] == '}');
 	  output->format[len - 1] = '\0';
-	  output->file = gfs_output_file_new (popen (&output->format[1], "w"));
+	  FILE * fp = gfs_popen (sim, &output->format[1], "w");
+	  if (fp == NULL) {
+	    g_warning ("GfsOutput cannot start script");
+	    return TRUE;
+	  }
+	  output->file = gfs_output_file_new (fp);
 	  output->file->is_pipe = TRUE;
 	  output->format[len - 1] = '}';
 	}

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list