[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
s.popinet at niwa.co.nz
Fri May 15 02:52:07 UTC 2009
The following commit has been merged in the upstream branch:
commit 7572fd688baef585651e729cbae131d105d5ef44
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date: Wed Jun 29 15:27:34 2005 +1000
gfs_function_description() can return long or short descriptions
darcs-hash:20050629052734-fbd8f-529b141d4d208b41ad5cd87f7d3cf331f947c956.gz
diff --git a/src/output.c b/src/output.c
index c8e3275..d3fbb3d 100644
--- a/src/output.c
+++ b/src/output.c
@@ -1436,7 +1436,7 @@ static void gfs_output_scalar_read (GtsObject ** o, GtsFile * fp)
}
gts_file_next_token (fp);
gfs_function_read (output->f, gfs_object_simulation (*o), fp);
- output->name = gfs_function_description (output->f);
+ output->name = gfs_function_description (output->f, TRUE);
}
else if (!strcmp (fp->token->str, "min")) {
gts_file_next_token (fp);
diff --git a/src/utils.c b/src/utils.c
index ac8da1e..877dffd 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -476,10 +476,12 @@ static gdouble interpolated_value (GfsFunction * f, FttVector * p)
/**
* gfs_function_description:
* @f: a #GfsFunction.
+ * @truncate: whether to truncate long descriptions.
*
- * Returns: a newly allocated string describing @f concisely.
+ * Returns: a newly allocated string describing @f.
*/
-gchar * gfs_function_description (GfsFunction * f)
+gchar * gfs_function_description (GfsFunction * f,
+ gboolean truncate)
{
gchar * s;
@@ -490,16 +492,19 @@ gchar * gfs_function_description (GfsFunction * f)
else if (f->v)
s = g_strdup (f->v->name);
else if (f->expr) {
- gchar * c = s = g_strdup (f->expr->str);
- guint n = 0;
-
- while (*c != '\0' && !isspace (*c))
- c++;
- while (*c != '\0' && n < 3) {
- *c = '.';
- c++; n++;
+ s = g_strdup (f->expr->str);
+ if (truncate) {
+ gchar * c = s;
+ guint n = 0;
+
+ while (*c != '\0' && !isspace (*c))
+ c++;
+ while (*c != '\0' && n < 3) {
+ *c = '.';
+ c++; n++;
+ }
+ *c = '\0';
}
- *c = '\0';
}
else
s = g_strdup_printf ("%g", f->val);
diff --git a/src/utils.h b/src/utils.h
index fda51ac..f720c11 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -63,7 +63,8 @@ struct _GfsFunctionClass {
GfsFunctionClass * gfs_function_class (void);
GfsFunction * gfs_function_new (GfsFunctionClass * klass,
gdouble val);
-gchar * gfs_function_description (GfsFunction * f);
+gchar * gfs_function_description (GfsFunction * f,
+ gboolean truncate);
gdouble gfs_function_face_value (GfsFunction * f,
FttCellFace * fa);
gdouble gfs_function_value (GfsFunction * f,
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list