diff --git a/src/obierrno.c b/src/obierrno.c new file mode 100644 index 0000000..9b9f00b --- /dev/null +++ b/src/obierrno.c @@ -0,0 +1,10 @@ +/* + * obierrno.c + * + * Created on: 23 mai 2015 + * Author: coissac + */ + + +int obi_errno; + diff --git a/src/obierrno.h b/src/obierrno.h new file mode 100644 index 0000000..9af6a8b --- /dev/null +++ b/src/obierrno.h @@ -0,0 +1,36 @@ +/* + * obierrno.h + * + * Created on: 23 mai 2015 + * Author: coissac + */ + +#ifndef OBIERRNO_H_ +#define OBIERRNO_H_ + +/** + * @brief The declaration of the external variable `obi_errno`. + * + * `obi_errno` is an equivalent of `errno` for the system level error + * but for for error generated by the C layer of the OBITools framework. + * + * @todo We have to look for defining this variable as thread specific. + */ +extern int obi_errno; + +/** + * @brief set the global `obi_errno` variable with + * the specified `err` code + * + * This function is defined as a macro to reduce the risk + * to increase the problem generating the error by calling + * a new function. + * + * @param err the error code as an integer value + * + * @since May 2015 + * @author Eric Coissac (eric.coissac@metabarcoding.org) + */ +#define obi_set_errno(err) (obi_errno = (err)) + +#endif /* OBIERRNO_H_ */