Add a mecanism similar to the classical errno system for reporting error

but specific to the OBITools framwork
This commit is contained in:
2015-05-23 14:54:48 +03:00
parent 3636672b2e
commit 5e3e6f93c0
2 changed files with 46 additions and 0 deletions

10
src/obierrno.c Normal file
View File

@ -0,0 +1,10 @@
/*
* obierrno.c
*
* Created on: 23 mai 2015
* Author: coissac
*/
int obi_errno;

36
src/obierrno.h Normal file
View File

@ -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_ */