prefix notation type parser

This commit is contained in:
Ellen Arvidsson 2025-04-19 20:35:42 +03:00
parent 9b24c8a496
commit 9ac779c1cf
14 changed files with 1217 additions and 151 deletions

View file

@ -18,17 +18,23 @@
#define SPHO_ERR_BUF_LEN 2048
#define SPHO_ERR(ctx, e) \
do { \
(ctx)->err = (e); \
if ((e) == SPHO_ERR_SYS) \
SPHO_ERR_INFO(ctx, e, errno); \
else \
SPHO_ERR_INFO(ctx, e, 0); \
} while (0)
#ifdef SPHO_DEBUG
#define SPHO_ERR_FILEBUF_LEN 128
#define SPHO_ERR(ctx, e) \
#define SPHO_ERR_INFO(ctx, e, info) \
do { \
(ctx)->err = (e); \
if ((e) == SPHO_ERR_SYS) \
(ctx)->err_info = errno; \
(ctx)->err_info = (info); \
snprintf((ctx)->filebuf, sizeof((ctx)->filebuf), \
__FILE__); \
(ctx)->errline = __LINE__; \
@ -85,18 +91,17 @@
#else /* SPHO_DEBUG */
#define SPHO_ERR(ctx, e) \
#define SPHO_ERR_INFO(ctx, e, info) \
do { \
(ctx)->err = (e); \
if ((e) == SPHO_ERR_SYS) \
(ctx)->err_info = errno; \
(ctx)->err_info = (info); \
} while (0)
#define SPHO_PRECOND(cond)
#define SPHO_ASSERT(cond)
#define SPHO_POSTCOND(cond)
#define SPHO_DBG_PRINT(fmt, ...)
#define SPHO_DEBUG_PRINT(fmt, ...)
#endif /* SPHO_DEBUG */