148 lines
3.4 KiB
Plaintext
148 lines
3.4 KiB
Plaintext
Error Handling
|
|
--------------
|
|
Now all functions, in which an error could occure, are returning a
|
|
value. This value is either a 64bit integer or a pointer.
|
|
|
|
A negative 64bit integer as result indicates an error. Values >= 0
|
|
indicates successfull execution. This is similiar to the convention
|
|
used in UNIX system calls, but we do not return -1 but the error
|
|
number (which is always negative).
|
|
|
|
For functions returning a pointer the NULL-pointer is used to indicate
|
|
an error. You can call the function H5PartGetErrno() to get the error
|
|
number. For the time being there is no strerror(3) or perror(3)
|
|
equivalent.
|
|
|
|
|
|
API Changes
|
|
-----------
|
|
There are several changes in the API of H5Part. The biggest change is
|
|
a side-effect of the implementation of strict error handling. The
|
|
impact to the existing C/C++ code is very small. But now you *can*
|
|
and *should* implement some kind of error handling. The simplest
|
|
error handling is to set an error handler which aborts the program as
|
|
soon as an error occured.
|
|
|
|
The next "biggest" change is the use of H5Part types instead of "long
|
|
long" and "double". The replacement of "long long" is "h5part_int64_t"
|
|
and for "double" "h5part_float64_t". This change has now effect in
|
|
Fortran.
|
|
|
|
In some functions the argument type changed from "int" to
|
|
"h5part_int64_t". Since on most systems "int" is a 32bit integer,
|
|
calls to these functions must be adapted to the new API. In C/C++ the
|
|
compiler will complain about it. But in Fortran you will *not* get an
|
|
error message.So, you must check your Fortran code carefully.
|
|
|
|
Changes in detail (not listed are functions where only the return
|
|
type changed from any to "h5part_int64_t"):
|
|
|
|
New API Changes to old API
|
|
|
|
h5part_int64_t void
|
|
H5PartSetNumParticles (
|
|
H5PartFile *f,
|
|
h5part_int64_t nparticles long long
|
|
);
|
|
|
|
h5part_int64_t int
|
|
H5PartWriteDataFloat64 (
|
|
H5PartFile *f,
|
|
char *name,
|
|
h5part_float64_t *dta double
|
|
);
|
|
|
|
h5part_int64_t int
|
|
H5PartWriteDataInt64 (
|
|
H5PartFile *f,
|
|
char *name,
|
|
h5part_int64_t *dta long long
|
|
);
|
|
|
|
h5part_int64_t void
|
|
H5PartSetStep (
|
|
H5PartFile *f,
|
|
h5part_int64_t step int
|
|
);
|
|
|
|
h5part_int64_t void
|
|
H5PartSetView (
|
|
H5PartFile *f,
|
|
h5part_int64_t start, long long
|
|
h5part_int64_t end long long
|
|
);
|
|
|
|
h5part_int64_t int
|
|
H5PartGetView (
|
|
H5PartFile *f,
|
|
h5part_int64_t *start, long long
|
|
h5part_int64_t *end long long
|
|
);
|
|
|
|
h5part_int64_t int
|
|
H5PartReadDataFloat64 (
|
|
H5PartFile *f,
|
|
char *name,
|
|
h5part_float64_t *dta double
|
|
);
|
|
|
|
h5part_int64_t int
|
|
H5PartReadDataInt64 (
|
|
H5PartFile *f,
|
|
char *name,
|
|
h5part_int64_t *dta long long
|
|
);
|
|
|
|
h5part_int64_t void
|
|
H5PartReadParticleStep (
|
|
H5PartFile *f,
|
|
h5part_int64_t step, int
|
|
h5part_float64_t *x, double
|
|
h5part_float64_t *y, double
|
|
h5part_float64_t *z, double
|
|
h5part_float64_t *px, double
|
|
h5part_float64_t *py, double
|
|
h5part_float64_t *pz, double
|
|
h5part_int64_t *id long long
|
|
);
|
|
|
|
New functions:
|
|
|
|
h5part_int64_t
|
|
H5PartSetVerbosityLevel (
|
|
unsigned int
|
|
);
|
|
|
|
h5part_int64_t
|
|
H5PartSetErrorHandler (
|
|
h5part_error_handler handler
|
|
);
|
|
|
|
h5part_int64_t
|
|
H5PartGetErrno (
|
|
void
|
|
);
|
|
|
|
h5part_int64_t
|
|
H5PartDefaultErrorHandler (
|
|
const char *funcname,
|
|
const h5part_int64_t eno,
|
|
const char *fmt,
|
|
...
|
|
);
|
|
|
|
h5part_int64_t
|
|
H5PartAbortErrorHandler (
|
|
const char *funcname,
|
|
const h5part_int64_t eno,
|
|
const char *fmt,
|
|
...
|
|
);
|
|
|
|
Removed functions:
|
|
|
|
int
|
|
H5PartFileIsValid (
|
|
H5PartFile *f
|
|
);
|