Skip to content

Commit 3924209

Browse files
committed
EXODUS: Clean up ex_err doxygen documentation
1 parent 68231e4 commit 3924209

File tree

1 file changed

+93
-60
lines changed
  • packages/seacas/libraries/exodus/src

1 file changed

+93
-60
lines changed

packages/seacas/libraries/exodus/src/ex_err.c

Lines changed: 93 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,62 @@
99
#include "exodusII.h" // for exoptval, MAX_ERR_LENGTH, etc
1010
#include "exodusII_int.h"
1111

12+
#if defined(EXODUS_THREADSAFE)
13+
EX_errval_t *ex_errval = NULL;
14+
#define EX_PNAME ex_errval->last_pname
15+
#define EX_ERRMSG ex_errval->last_errmsg
16+
#define EX_ERR_NUM ex_errval->last_err_num
17+
#else
18+
int exerrval = 0; /* clear initial global error code value */
19+
20+
static char last_pname[MAX_ERR_LENGTH + 1];
21+
static char last_errmsg[MAX_ERR_LENGTH + 1];
22+
static int last_err_num;
23+
24+
#define EX_PNAME last_pname
25+
#define EX_ERRMSG last_errmsg
26+
#define EX_ERR_NUM last_err_num
27+
#endif
28+
1229
/*!
13-
\ingroup Utilities
14-
\fn{void ex_err_fn(exoid, const char *module_name, const char *message, int err_num)}
30+
\ingroup Utilities
31+
\undoc
32+
*/
33+
void ex__reset_error_status(void)
34+
{
35+
#if !defined(EXODUS_THREADSAFE)
36+
exerrval = 0;
37+
EX_ERR_NUM = 0;
38+
#endif
39+
}
1540

16-
The function ex_err_fn(exoid, ) logs an error to stderr. It is intended
41+
/*!
42+
\ingroup Utilities
43+
The function ex_err(exoid, ...) logs an error to stderr. It is intended
1744
to provide explanatory messages for error codes returned from other
1845
exodus routines.
1946
2047
The passed in error codes and corresponding messages are listed in
21-
???. The programmer may supplement the error message printed
48+
\file{exodusII.h}. The programmer may supplement the error message printed
2249
for standard errors by providing an error message. If the error code
2350
is provided with no error message, the predefined message will be
24-
used. The error code EX_MSG is available to log application
51+
used. The error code \c EX_MSG is available to log application
2552
specific messages.
2653
27-
\param[in] module_name This is a string containing the name of the calling
28-
function.
29-
\param[in] message This is a string containing a message explaining the
30-
error
31-
or problem. If EX_VERBOSE (see ex_opts()) is true,
54+
\param[in] module_name This is a string containing the name of the calling function.
55+
\param[in] message This is a string containing a message explaining the error
56+
or problem. If \c EX_VERBOSE (see ex_opts()) is true,
3257
this message will be printed to stderr. Otherwise,
33-
nothing will be printed. Maximum length is \c
34-
MAX_ERR_LENGTH.
58+
nothing will be printed. Maximum length is \c MAX_ERR_LENGTH.
3559
3660
\param[in] err_num This is an integer code identifying the error. exodus C
37-
functions
38-
place an error code value in exerrval, an external
39-
int. Negative
40-
values are considered fatal errors while positive
41-
values are
42-
warnings. There is a set of predefined values defined
43-
in
44-
\file{exodusII.h}. The predefined constant \c
45-
EX_PRTLASTMSG will
46-
cause the last error message to be output, regardless
47-
of the setting
61+
functions place an error code value in exerrval,
62+
an external integer. Negative values are considered
63+
fatal errors while positive values are warnings.
64+
There is a set of predefined values defined in
65+
\file{exodusII.h}. The predefined constant
66+
\c EX_PRTLASTMSG will cause the last error message
67+
to be output, regardless of the setting
4868
of the error reporting level (see ex_opts()).
4969
5070
The following is an example of the use of this function:
@@ -62,45 +82,11 @@ if (exoid = ex_open ("test.exo", EX_READ, &CPU_word_size,
6282
&IO_word_size, &version)) {
6383
errval = 999;
6484
snprintf(errmsg, MAX_ERR_LENGTH,"ERROR: cannot open file test.exo");
65-
ex_err_fn(exoid, __func__, errmsg, errval);
85+
ex_err(__func__, errmsg, errval);
6686
}
6787
~~~
6888
6989
*/
70-
71-
#if defined(EXODUS_THREADSAFE)
72-
EX_errval_t *ex_errval = NULL;
73-
#define EX_PNAME ex_errval->last_pname
74-
#define EX_ERRMSG ex_errval->last_errmsg
75-
#define EX_ERR_NUM ex_errval->last_err_num
76-
#else
77-
int exerrval = 0; /* clear initial global error code value */
78-
79-
static char last_pname[MAX_ERR_LENGTH + 1];
80-
static char last_errmsg[MAX_ERR_LENGTH + 1];
81-
static int last_err_num;
82-
83-
#define EX_PNAME last_pname
84-
#define EX_ERRMSG last_errmsg
85-
#define EX_ERR_NUM last_err_num
86-
#endif
87-
88-
/*!
89-
\ingroup Utilities
90-
\undoc
91-
*/
92-
void ex__reset_error_status(void)
93-
{
94-
#if !defined(EXODUS_THREADSAFE)
95-
exerrval = 0;
96-
EX_ERR_NUM = 0;
97-
#endif
98-
}
99-
100-
/*!
101-
\ingroup Utilities
102-
\undoc
103-
*/
10490
void ex_err(const char *module_name, const char *message, int err_num)
10591
{
10692
EX_FUNC_ENTER_INT();
@@ -157,8 +143,55 @@ void ex_err(const char *module_name, const char *message, int err_num)
157143
}
158144

159145
/*!
160-
\ingroup Utilities
161-
\undoc
146+
\ingroup Utilities
147+
The function ex_err_fn() logs an error to stderr. It is intended
148+
to provide explanatory messages for error codes returned from other
149+
exodus routines. The main difference between ex_err_fn() and ex_err() is
150+
that ex_err_fn() will print the name of the exodus file that the error occured on.
151+
152+
The passed in error codes and corresponding messages are listed in
153+
\file{exodusII.h}. The programmer may supplement the error message printed
154+
for standard errors by providing an error message. If the error code
155+
is provided with no error message, the predefined message will be
156+
used. The error code \c EX_MSG is available to log application
157+
specific messages.
158+
159+
\param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open().
160+
\param[in] module_name This is a string containing the name of the calling function.
161+
\param[in] message This is a string containing a message explaining the error
162+
or problem. If \c EX_VERBOSE (see ex_opts()) is true,
163+
this message will be printed to stderr. Otherwise,
164+
nothing will be printed. Maximum length is \c MAX_ERR_LENGTH.
165+
166+
\param[in] err_num This is an integer code identifying the error. exodus C
167+
functions place an error code value in exerrval,
168+
an external integer. Negative values are considered
169+
fatal errors while positive values are warnings.
170+
There is a set of predefined values defined in
171+
\file{exodusII.h}. The predefined constant
172+
\c EX_PRTLASTMSG will cause the last error message
173+
to be output, regardless of the setting
174+
of the error reporting level (see ex_opts()).
175+
176+
The following is an example of the use of this function:
177+
178+
~~~{.c}
179+
int exoid, CPU_word_size, IO_word_size, errval;
180+
float version;
181+
char errmsg[MAX_ERR_LENGTH];
182+
183+
CPU_word_size = sizeof(float);
184+
IO_word_size = 0;
185+
186+
\comment{open exodus file}
187+
if (exoid = ex_open ("test.exo", EX_READ, &CPU_word_size,
188+
&IO_word_size, &version)) {
189+
errval = 999;
190+
snprintf(errmsg, MAX_ERR_LENGTH,"ERROR: cannot open file test.exo");
191+
ex_err_fn(exoid, __func__, errmsg, errval);
192+
}
193+
~~~
194+
162195
*/
163196
void ex_err_fn(int exoid, const char *module_name, const char *message, int err_num)
164197
{

0 commit comments

Comments
 (0)