Blame src/internal/treebnf_errinfo_impl.h
|
|
02e59c |
/**************************************************************/
|
|
|
02e59c |
/* treebnf: a tree oriented bnf library */
|
|
|
02e59c |
/* Copyright (C) 2024 SysDeer Technologies, LLC */
|
|
|
02e59c |
/* Released under GPLv2 and GPLv3; see COPYING.TREEBNF. */
|
|
|
02e59c |
/**************************************************************/
|
|
|
02e59c |
|
|
|
02e59c |
#ifndef TREEBNF_ERRINFO_IMPL_H
|
|
|
02e59c |
#define TREEBNF_ERRINFO_IMPL_H
|
|
|
02e59c |
|
|
|
02e59c |
#include <errno.h>
|
|
|
02e59c |
#include <treebnf/treebnf.h>
|
|
|
02e59c |
|
|
|
02e59c |
int tbnf_record_error(
|
|
|
02e59c |
const struct tbnf_driver_ctx *,
|
|
|
02e59c |
int esyscode,
|
|
|
02e59c |
int elibcode,
|
|
|
02e59c |
const char * efunction,
|
|
|
02e59c |
int eline,
|
|
|
02e59c |
unsigned eflags,
|
|
|
02e59c |
void * eany);
|
|
|
02e59c |
|
|
|
02e59c |
#define TBNF_SYSTEM_ERROR(dctx,eany) \
|
|
|
02e59c |
tbnf_record_error( \
|
|
|
02e59c |
dctx, \
|
|
|
02e59c |
errno, \
|
|
|
02e59c |
0, \
|
|
|
02e59c |
__func__, \
|
|
|
02e59c |
__LINE__, \
|
|
|
02e59c |
TBNF_ERROR_TOP_LEVEL, \
|
|
|
02e59c |
(void *)eany)
|
|
|
02e59c |
|
|
|
02e59c |
#define TBNF_BUFFER_ERROR(dctx) \
|
|
|
02e59c |
tbnf_record_error( \
|
|
|
02e59c |
dctx, \
|
|
|
02e59c |
ENOBUFS, \
|
|
|
02e59c |
0, \
|
|
|
02e59c |
__func__, \
|
|
|
02e59c |
__LINE__, \
|
|
|
02e59c |
TBNF_ERROR_TOP_LEVEL, \
|
|
|
02e59c |
0)
|
|
|
02e59c |
|
|
|
02e59c |
#define TBNF_SPAWN_ERROR(dctx) \
|
|
|
02e59c |
tbnf_record_error( \
|
|
|
02e59c |
dctx, \
|
|
|
02e59c |
errno, \
|
|
|
02e59c |
0, \
|
|
|
02e59c |
__func__, \
|
|
|
02e59c |
__LINE__, \
|
|
|
02e59c |
TBNF_ERROR_TOP_LEVEL \
|
|
|
02e59c |
| (errno ? 0 \
|
|
|
02e59c |
: TBNF_ERROR_CHILD), \
|
|
|
02e59c |
0)
|
|
|
02e59c |
|
|
|
02e59c |
#define TBNF_FILE_ERROR(dctx) \
|
|
|
02e59c |
tbnf_record_error( \
|
|
|
02e59c |
dctx, \
|
|
|
02e59c |
EIO, \
|
|
|
02e59c |
0, \
|
|
|
02e59c |
__func__, \
|
|
|
02e59c |
__LINE__, \
|
|
|
02e59c |
TBNF_ERROR_TOP_LEVEL, \
|
|
|
02e59c |
0)
|
|
|
02e59c |
|
|
|
02e59c |
#define TBNF_CUSTOM_ERROR(dctx,elibcode) \
|
|
|
02e59c |
tbnf_record_error( \
|
|
|
02e59c |
dctx, \
|
|
|
02e59c |
0, \
|
|
|
02e59c |
elibcode, \
|
|
|
02e59c |
__func__, \
|
|
|
02e59c |
__LINE__, \
|
|
|
02e59c |
TBNF_ERROR_TOP_LEVEL \
|
|
|
02e59c |
| TBNF_ERROR_CUSTOM, \
|
|
|
02e59c |
0)
|
|
|
02e59c |
|
|
|
02e59c |
#define TBNF_NESTED_ERROR(dctx) \
|
|
|
02e59c |
tbnf_record_error( \
|
|
|
02e59c |
dctx, \
|
|
|
02e59c |
0, \
|
|
|
02e59c |
0, \
|
|
|
02e59c |
__func__, \
|
|
|
02e59c |
__LINE__, \
|
|
|
02e59c |
TBNF_ERROR_NESTED, \
|
|
|
02e59c |
0)
|
|
|
02e59c |
|
|
|
02e59c |
#endif
|