aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2000-02-25 16:47:54 +0000
committertradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2000-02-25 16:47:54 +0000
commit5bbae845df0f9f1202ad7ac5cc788d2291294a8e (patch)
tree6ca4a7b476174b651ac72d5d0a7b330d0b7d4159
parentacb671b983d62e4284a69fa4e7818e05af0b63ad (diff)
Some tidying of message output.
Thomas git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@38 b589c3ab-70e8-4b4d-a09f-cba2dd200880
-rw-r--r--src/Write.c19
-rw-r--r--src/WriteGF.c26
-rw-r--r--src/WriteInfo.c22
3 files changed, 18 insertions, 49 deletions
diff --git a/src/Write.c b/src/Write.c
index 99180cb..d10d69e 100644
--- a/src/Write.c
+++ b/src/Write.c
@@ -31,14 +31,12 @@ void IOBasic_Write (cGH *GH, int index, const char *alias)
/* first, check if variable has storage assigned */
if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) {
- char *msg, *fullname;
+ char *fullname;
fullname = CCTK_FullName (index);
- msg = (char *) malloc (200 * sizeof (char) + strlen (fullname));
- sprintf (msg, "No scalar output for '%s' (no storage)", fullname);
- CCTK_WARN (2, msg);
+ CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "No scalar output for '%s' (no storage)", fullname);
free (fullname);
- free (msg);
return;
}
@@ -61,11 +59,8 @@ void IOBasic_Write (cGH *GH, int index, const char *alias)
file = fopen(fname,openmode);
if (file == NULL) {
- char *msg = (char *) malloc (100 + strlen (fname));
-
- sprintf (msg, "Could not open output file '%s'", fname);
- CCTK_WARN (3, msg);
- free (msg);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Could not open output file '%s'", fname);
free (fname);
return;
}
@@ -102,8 +97,4 @@ void IOBasic_Write (cGH *GH, int index, const char *alias)
free (fname);
}
-
-
-
}
-
diff --git a/src/WriteGF.c b/src/WriteGF.c
index e498422..8c7ed8c 100644
--- a/src/WriteGF.c
+++ b/src/WriteGF.c
@@ -50,14 +50,12 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias)
/* first, check if variable has storage assigned */
if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) {
- char *msg, *fullname;
+ char *fullname;
fullname = CCTK_FullName (index);
- msg = (char *) malloc (200 * sizeof (char) + strlen (fullname));
- sprintf (msg, "No 0D output for '%s' (no storage)", fullname);
- CCTK_WARN (2, msg);
+ CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "No 0D output for '%s' (no storage)", fullname);
free (fullname);
- free (msg);
return;
}
@@ -79,11 +77,8 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias)
/* get the reduction handle from the reduction operator */
reduction_handle = CCTK_ReductionHandle (reductions [i].operator);
if (reduction_handle < 0) {
- char *msg = (char *) malloc (100 + strlen (reductions [i].operator));
-
- sprintf (msg, "Invalid reduction operator '%s'", reductions [i].operator);
- CCTK_WARN (3, msg);
- free (msg);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Invalid reduction operator '%s'", reductions [i].operator);
continue;
}
@@ -106,11 +101,8 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias)
file = fopen (filename, openmode);
if (file == NULL) {
- char *msg = (char *) malloc (100 + strlen (filename));
-
- sprintf (msg, "Could not open output file '%s'", filename);
- CCTK_WARN (3, msg);
- free (msg);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Could not open output file '%s'", filename);
continue;
}
@@ -130,8 +122,4 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias)
}
free (filename);
-
-
-
}
-
diff --git a/src/WriteInfo.c b/src/WriteInfo.c
index 5be067d..26994d0 100644
--- a/src/WriteInfo.c
+++ b/src/WriteInfo.c
@@ -21,21 +21,18 @@
CCTK_REAL IOBasic_WriteInfo (cGH *GH, int index, const char *operator, const char *alias)
{
- CCTK_REAL tt[1];
int reduce_handle;
CCTK_REAL retval;
/* first, check if variable has storage assigned */
if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) {
- char *msg, *fullname;
+ char *fullname;
fullname = CCTK_FullName (index);
- msg = (char *) malloc (200 * sizeof (char) + strlen (fullname));
- sprintf (msg, "No info output for '%s' (no storage)", fullname);
- CCTK_WARN (2, msg);
+ CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "No info output for '%s' (no storage)", fullname);
free (fullname);
- free (msg);
return (0);
}
@@ -43,21 +40,14 @@ CCTK_REAL IOBasic_WriteInfo (cGH *GH, int index, const char *operator, const cha
if (reduce_handle > -1)
{
- CCTK_Reduce(GH,-1,reduce_handle,1,CCTK_VARIABLE_REAL,tt,1,index);
- retval = tt[0];
+ CCTK_Reduce(GH,-1,reduce_handle,1,CCTK_VARIABLE_REAL,&retval,1,index);
}
else
{
- CCTK_WARN(1, "Reduction operator doesn't exist.");
-
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Reduction operator '%s' doesn't exist", operator);
retval = -27;
}
return retval;
-
}
-
-
-
-
-