added hcl_seterrumsg() and hcl_seterrbfmt() in case the caller can't use variadic arguments
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hyung-hwan 2023-05-29 01:49:13 +09:00
parent ce47037b79
commit 0845e12a93
3 changed files with 30 additions and 8 deletions

View File

@ -242,6 +242,17 @@ void hcl_seterrnum (hcl_t* hcl, hcl_errnum_t errnum)
hcl->errmsg.len = 0; hcl->errmsg.len = 0;
} }
void hcl_seterrbmsg (hcl_t* hcl, hcl_errnum_t errnum, const hcl_bch_t* errmsg)
{
hcl_seterrbfmt(hcl, errnum, "%hs", errmsg);
}
void hcl_seterrumsg (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* errmsg)
{
hcl_seterrbfmt(hcl, errnum, "%ls", errmsg);
}
static int err_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len) static int err_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
{ {

View File

@ -2025,13 +2025,25 @@ HCL_EXPORT void hcl_seterrnum (
hcl_errnum_t errnum hcl_errnum_t errnum
); );
HCL_EXPORT void hcl_seterrbmsg (
hcl_t* hcl,
hcl_errnum_t errnum,
const hcl_bch_t* errmsg
);
HCL_EXPORT void hcl_seterrumsg (
hcl_t* hcl,
hcl_errnum_t errnum,
const hcl_uch_t* errmsg
);
HCL_EXPORT void hcl_seterrwithsyserr ( HCL_EXPORT void hcl_seterrwithsyserr (
hcl_t* hcl, hcl_t* hcl,
int syserr_type, int syserr_type,
int syserr_code int syserr_code
); );
void hcl_seterrbfmtwithsyserr ( HCL_EXPORT void hcl_seterrbfmtwithsyserr (
hcl_t* hcl, hcl_t* hcl,
int syserr_type, int syserr_type,
int syserr_code, int syserr_code,
@ -2039,7 +2051,7 @@ void hcl_seterrbfmtwithsyserr (
... ...
); );
void hcl_seterrufmtwithsyserr ( HCL_EXPORT void hcl_seterrufmtwithsyserr (
hcl_t* hcl, hcl_t* hcl,
int syserr_type, int syserr_type,
int syserr_code, int syserr_code,
@ -2089,8 +2101,10 @@ HCL_EXPORT const hcl_bch_t* hcl_geterrbmsg (
#if defined(HCL_OOCH_IS_UCH) #if defined(HCL_OOCH_IS_UCH)
# define hcl_geterrmsg hcl_geterrumsg # define hcl_geterrmsg hcl_geterrumsg
# define hcl_seterrmsg hcl_seterrumsg
#else #else
# define hcl_geterrmsg hcl_geterrbmsg # define hcl_geterrmsg hcl_geterrbmsg
# define hcl_seterrmsg hcl_seterrbmsg
#endif #endif
HCL_EXPORT const hcl_ooch_t* hcl_backuperrmsg ( HCL_EXPORT const hcl_ooch_t* hcl_backuperrmsg (

View File

@ -4038,14 +4038,11 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioi
hcl_ioinarg_t new_inarg; hcl_ioinarg_t new_inarg;
hcl_iooutarg_t new_outarg; hcl_iooutarg_t new_outarg;
if (reader)
{
if (!hcl->c) if (!hcl->c)
{ {
if (init_compiler(hcl) <= -1) return -1; if (init_compiler(hcl) <= -1) return -1;
inited_compiler = 1; inited_compiler = 1;
} }
}
if (reader) if (reader)
{ {