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

Stephane Popinet popinet at users.sf.net
Fri May 15 02:54:19 UTC 2009


The following commit has been merged in the upstream branch:
commit 9af271ea7e41527499112556aac1d5e653798861
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Fri Apr 20 15:47:10 2007 +1000

    Bug fix for expression parsing
    
    darcs-hash:20070420054710-d4795-41cd72ba88563623db994027229d7844baa1a539.gz

diff --git a/src/utils.c b/src/utils.c
index 004ac87..47b810a 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -238,8 +238,8 @@ static GfsCartesianGrid * read_cartesian_grid (gchar * name, GtsFile * fp)
   klass = gfs_cartesian_grid_class ();
 
   grid = gfs_cartesian_grid_new (klass);
-
-  (* klass->read) ((GtsObject **) &grid, fp1);
+  GtsObject * o = GTS_OBJECT (grid);
+  (* klass->read) (&o, fp1);
 
   if (fp1->type == GTS_ERROR) {
     gts_file_error (fp, "%s:%d:%d: %s", name, fp1->line, fp1->pos, fp1->error);
@@ -367,6 +367,11 @@ GString * gfs_function_expression (GtsFile * fp, gboolean * is_expression)
       else
 	c = gts_file_getc (fp);
     }
+    if (strlen (expr->str) == 1 && gfs_char_in_string (expr->str[0], operators))
+      while (c != EOF && gfs_char_in_string (c, spaces)) {
+	g_string_append_c (expr, c);
+	c = gts_file_getc (fp);
+      }
     while (c != EOF) {
       if (gfs_char_in_string (c, "{}\n")) {
 	fp->next_token = c;
@@ -385,15 +390,22 @@ GString * gfs_function_expression (GtsFile * fp, gboolean * is_expression)
 	  g_string_append_c (expr, c);
 	  c = gts_file_getc (fp);
 	}
-	if (!gfs_char_in_string (c, operators)) {
-	  fp->next_token = c;
-	  break;
+	if (c == '(') {
+	  scope++;
+	  g_string_append_c (expr, c);
+	  c = gts_file_getc (fp);
 	}
-	g_string_append_c (expr, c);
-	c = gts_file_getc (fp);
-	while (c != EOF && gfs_char_in_string (c, spaces)) {
+	else {
+	  if (!gfs_char_in_string (c, operators)) {
+	    fp->next_token = c;
+	    break;
+	  }
 	  g_string_append_c (expr, c);
 	  c = gts_file_getc (fp);
+	  while (c != EOF && gfs_char_in_string (c, spaces)) {
+	    g_string_append_c (expr, c);
+	    c = gts_file_getc (fp);
+	  }
 	}
       }
       else if (gfs_char_in_string (c, operators)) {

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list