Add a utility header to convert error codes.

This commit is contained in:
2018-02-10 16:01:01 -08:00
parent 2db840288d
commit b46dccb70d
4 changed files with 45 additions and 2 deletions

View File

@@ -7,7 +7,9 @@
*/
enum libab_result {
LIBAB_SUCCESS,
LIBAB_MALLOC
LIBAB_MALLOC,
LIBAB_BAD_PATTERN,
LIBAB_FAILED_MATCH
};
typedef enum libab_result libab_result;

21
include/libabacus_util.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef LIBABACUS_UTIL_H
#define LIBABACUS_UTIL_H
#include "libds.h"
#include "liblex.h"
#include "libabacus.h"
/**
* Converts a result code from liblex to libabacus.
* @param to_convert the code to convert.
* @return the libabacus equivalent of the error code.
*/
libab_result convert_lex_result(liblex_result to_convert);
/**
* Converts a result code from libds to libabacus.
* @param to_convert the code to convert.
* @return the libabacus equivalent of the error code.
*/
libab_result convert_ds_result(libds_result to_convert);
#endif