[SCM] Gerris Flow Solver branch, upstream, updated. e8f73a07832050124d2b8bf6c6f35b33180e65a8
Stephane Popinet
popinet at users.sf.net
Tue Nov 24 12:24:56 UTC 2009
The following commit has been merged in the upstream branch:
commit 1ef036aeb188c352cc73b6fb6b3e5a7a417ce70f
Author: Stephane Popinet <popinet at users.sf.net>
Date: Thu Aug 20 09:21:42 2009 +1000
Bug fix for gfs_function_expression()
When specifying two GfsFunctions in a row.
darcs-hash:20090819232142-d4795-121183da1a488809114e133d7d05ca00a11a72ca.gz
diff --git a/src/utils.c b/src/utils.c
index abb18ee..cc8b40f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -361,6 +361,7 @@ GString * gfs_function_expression (GtsFile * fp, gboolean * is_expression)
else {
static gchar spaces[] = " \t\f\r";
static gchar operators[] = "+-*/%<>=&^|?:!";
+ gboolean is_constant = (fp->type == GTS_INT || fp->type == GTS_FLOAT);
gint c, scope = 0;
gchar * s;
gchar empty[] = "", * comments = fp->comments;
@@ -405,6 +406,10 @@ GString * gfs_function_expression (GtsFile * fp, gboolean * is_expression)
c = gts_file_getc (fp);
}
if (c == '(') {
+ if (is_constant) {
+ fp->next_token = c;
+ break;
+ }
scope++;
g_string_append_c (expr, c);
c = gts_file_getc (fp);
@@ -414,6 +419,7 @@ GString * gfs_function_expression (GtsFile * fp, gboolean * is_expression)
fp->next_token = c;
break;
}
+ is_constant = FALSE;
g_string_append_c (expr, c);
c = gts_file_getc (fp);
while (c != EOF && gfs_char_in_string (c, spaces)) {
@@ -423,6 +429,7 @@ GString * gfs_function_expression (GtsFile * fp, gboolean * is_expression)
}
}
else if (gfs_char_in_string (c, operators)) {
+ is_constant = FALSE;
g_string_append_c (expr, c);
c = gts_file_getc (fp);
while (c != EOF && gfs_char_in_string (c, spaces)) {
@@ -431,6 +438,7 @@ GString * gfs_function_expression (GtsFile * fp, gboolean * is_expression)
}
}
else {
+ is_constant = FALSE;
if (c == '(') scope++;
else if (c == ')') scope--;
if (scope < 0) {
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list