lexing up and running
This commit is contained in:
parent
10e16147ba
commit
b9266cdf96
6 changed files with 434 additions and 102 deletions
|
@ -16,8 +16,14 @@
|
|||
|
||||
#define SPHO_ERR_IS_SYSERR(err) (SPHO_ERR_SYS == err)
|
||||
|
||||
#define SPHO_ERR_BUF_LEN 2048
|
||||
|
||||
|
||||
|
||||
#ifdef SPHO_DEBUG
|
||||
|
||||
#define SPHO_ERR_FILEBUF_LEN 128
|
||||
|
||||
#define SPHO_ERR(ctx, e) \
|
||||
do { \
|
||||
(ctx)->err = (e); \
|
||||
|
@ -28,20 +34,6 @@
|
|||
(ctx)->errline = __LINE__; \
|
||||
} while (0)
|
||||
|
||||
#else /* SPHO_DEBUG */
|
||||
|
||||
#define SPHO_ERR(ctx, e) \
|
||||
do { \
|
||||
(ctx)->err = (e); \
|
||||
if ((e) == SPHO_ERR_SYS) \
|
||||
(ctx)->err_info = errno; \
|
||||
} while (0)
|
||||
|
||||
#endif /* SPHO_DEBUG */
|
||||
|
||||
/* debug stuff */
|
||||
#ifdef SPHO_DEBUG
|
||||
|
||||
#define SPHO_STRINGIFY(a) #a
|
||||
#define SPHO_MACRO_STR(b) SPHO_STRINGIFY(b)
|
||||
|
||||
|
@ -77,10 +69,35 @@
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef SPHO_ENABLE_DEBUG_PRINT
|
||||
|
||||
#define SPHO_DEBUG_PRINT(fmt, ...) \
|
||||
do { \
|
||||
fprintf(stderr, fmt __VA_OPT__(,) __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#else /* SPHO_ENABLE_DEBUG_PRINT */
|
||||
|
||||
#define SPHO_DEBUG_PRINT(fmt, ...)
|
||||
|
||||
#endif /* SPHO_ENABLE_DEBUG_PRINT */
|
||||
|
||||
#else /* SPHO_DEBUG */
|
||||
|
||||
#define SPHO_ERR(ctx, e) \
|
||||
do { \
|
||||
(ctx)->err = (e); \
|
||||
if ((e) == SPHO_ERR_SYS) \
|
||||
(ctx)->err_info = errno; \
|
||||
} while (0)
|
||||
|
||||
#define SPHO_PRECOND(cond)
|
||||
#define SPHO_ASSERT(cond)
|
||||
#define SPHO_POSTCOND(cond)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#define SPHO_DBG_PRINT(fmt, ...)
|
||||
|
||||
#endif /* SPHO_DEBUG */
|
||||
|
||||
#endif /* _SPHO_ERR_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue