added moo_seterrbfmt() and moo_seterrufmt()

This commit is contained in:
hyunghwan.chung
2017-05-11 14:59:20 +00:00
parent ce69989a86
commit 9208d078b2
14 changed files with 315 additions and 187 deletions

View File

@ -976,6 +976,12 @@ struct moo_t
moo_cmgr_t* cmgr;
moo_errnum_t errnum;
struct
{
moo_ooch_t buf[2048];
moo_oow_t len;
} errmsg;
struct
{
unsigned int trait;
@ -998,6 +1004,7 @@ struct moo_t
int last_mask;
} log;
/* ========================= */
moo_heap_t* permheap; /* TODO: put kernel objects to here */
@ -1340,8 +1347,11 @@ typedef struct moo_synerr_t moo_synerr_t;
extern "C" {
#endif
#define moo_switchprocess(moo) ((moo)->switch_proc = 1)
#if defined(MOO_HAVE_INLINE)
static MOO_INLINE void moo_switchprocess(moo_t* moo) { moo->switch_proc = 1; }
#else
# define moo_switchprocess(moo) ((moo)->switch_proc = 1)
#endif
MOO_EXPORT moo_t* moo_open (
moo_mmgr_t* mmgr,
@ -1374,7 +1384,7 @@ MOO_EXPORT void moo_fini (
static MOO_INLINE void moo_setcmgr (moo_t* moo, moo_cmgr_t* cmgr) { moo->cmgr = cmgr; }
static MOO_INLINE moo_errnum_t moo_geterrnum (moo_t* moo) { return moo->errnum; }
static MOO_INLINE void moo_seterrnum (moo_t* moo, moo_errnum_t errnum) { moo->errnum = errnum; }
static MOO_INLINE void moo_seterrnum (moo_t* moo, moo_errnum_t errnum) { moo->errnum = errnum; moo->errmsg.len = 0; }
#else
# define moo_getmmgr(moo) ((moo)->mmgr)
# define moo_getxtn(moo) ((void*)((moo) + 1))
@ -1383,9 +1393,29 @@ MOO_EXPORT void moo_fini (
# define moo_setcmgr(moo,mgr) ((moo)->cmgr = (mgr))
# define moo_geterrnum(moo) ((moo)->errnum)
# define moo_seterrnum(moo,num) ((moo)->errnum = (num))
# define moo_seterrnum(moo,num) ((moo)->errmsg.len = 0, (moo)->errnum = (num),)
#endif
void moo_seterrbfmt (
moo_t* moo,
moo_errnum_t errnum,
const moo_bch_t* fmt,
...
);
void moo_seterrufmt (
moo_t* moo,
moo_errnum_t errnum,
const moo_uch_t* fmt,
...
);
MOO_EXPORT const moo_ooch_t* moo_geterrmsg (
moo_t* moo
);
MOO_EXPORT const moo_ooch_t* moo_geterrstr (
moo_t* moo
);