From e5f9cd349da231eae42ec9d35e3ebcd0d8fff973 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sat, 3 Sep 2016 21:23:27 +0200 Subject: *: moved error handling to src/common/ --- src/common/error.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/common/error.h (limited to 'src/common/error.h') diff --git a/src/common/error.h b/src/common/error.h new file mode 100644 index 0000000..17843ed --- /dev/null +++ b/src/common/error.h @@ -0,0 +1,26 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2015-2016 Rafael G. Martins + * + * This program can be distributed under the terms of the BSD License. + * See the file LICENSE. + */ + +#ifndef _ERROR_H +#define _ERROR_H + +#include + +typedef struct { + char *msg; + int type; +} bc_error_t; + +bc_error_t* bc_error_new(int type, const char *msg); +bc_error_t* bc_error_new_printf(int type, const char *format, ...); +bc_error_t* bc_error_parser(int type, const char *src, size_t src_len, + size_t current, const char *format, ...); +void bc_error_print(bc_error_t *err); +void bc_error_free(bc_error_t *err); + +#endif /* _ERROR_H */ -- cgit v1.2.3-18-g5258