changed a wrong function name from hcl_logoofmt to hcl_logufmt
enhanced the log formatter routine a bit
This commit is contained in:
parent
7e6b16e153
commit
bf49aa1260
12
lib/hcl.h
12
lib/hcl.h
@ -1589,10 +1589,10 @@ HCL_EXPORT hcl_ooi_t hcl_logbfmt (
|
|||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
HCL_EXPORT hcl_ooi_t hcl_logoofmt (
|
HCL_EXPORT hcl_ooi_t hcl_logufmt (
|
||||||
hcl_t* hcl,
|
hcl_t* hcl,
|
||||||
hcl_oow_t mask,
|
hcl_oow_t mask,
|
||||||
const hcl_ooch_t* fmt,
|
const hcl_uch_t* fmt,
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1796,10 +1796,10 @@ HCL_EXPORT int hcl_equalobjs (
|
|||||||
# define hcl_convootobcstr(hcl,oocs,oocslen,bcs,bcslen) hcl_convutobcstr(hcl,oocs,oocslen,bcs,bcslen)
|
# define hcl_convootobcstr(hcl,oocs,oocslen,bcs,bcslen) hcl_convutobcstr(hcl,oocs,oocslen,bcs,bcslen)
|
||||||
# define hcl_convbtooocstr(hcl,bcs,bcslen,oocs,oocslen) hcl_convbtoucstr(hcl,bcs,bcslen,oocs,oocslen)
|
# define hcl_convbtooocstr(hcl,bcs,bcslen,oocs,oocslen) hcl_convbtoucstr(hcl,bcs,bcslen,oocs,oocslen)
|
||||||
#else
|
#else
|
||||||
# define hcl_convootouchars(hcl,oocs,oocslen,bcs,bcslen) hcl_convbtouchars(hcl,oocs,oocslen,bcs,bcslen)
|
# define hcl_convootouchars(hcl,oocs,oocslen,ucs,ucslen) hcl_convbtouchars(hcl,oocs,oocslen,ucs,ucslen)
|
||||||
# define hcl_convutooochars(hcl,bcs,bcslen,oocs,oocslen) hcl_convutobchars(hcl,bcs,bcslen,oocs,oocslen)
|
# define hcl_convutooochars(hcl,ucs,ucslen,oocs,oocslen) hcl_convutobchars(hcl,ucs,ucslen,oocs,oocslen)
|
||||||
# define hcl_convootoucstr(hcl,oocs,oocslen,bcs,bcslen) hcl_convbtoucstr(hcl,oocs,oocslen,bcs,bcslen)
|
# define hcl_convootoucstr(hcl,oocs,oocslen,ucs,ucslen) hcl_convbtoucstr(hcl,oocs,oocslen,ucs,ucslen)
|
||||||
# define hcl_convutooocstr(hcl,bcs,bcslen,oocs,oocslen) hcl_convutobcstr(hcl,bcs,bcslen,oocs,oocslen)
|
# define hcl_convutooocstr(hcl,ucs,ucslen,oocs,oocslen) hcl_convutobcstr(hcl,ucs,ucslen,oocs,oocslen)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HCL_EXPORT int hcl_convbtouchars (
|
HCL_EXPORT int hcl_convbtouchars (
|
||||||
|
@ -100,6 +100,7 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
|||||||
int n, base, neg, sign;
|
int n, base, neg, sign;
|
||||||
hcl_ooi_t tmp, width, precision;
|
hcl_ooi_t tmp, width, precision;
|
||||||
hcl_ooch_t ch, padc;
|
hcl_ooch_t ch, padc;
|
||||||
|
fmtchar_t fch;
|
||||||
int lm_flag, lm_dflag, flagc, numlen;
|
int lm_flag, lm_dflag, flagc, numlen;
|
||||||
hcl_uintmax_t num = 0;
|
hcl_uintmax_t num = 0;
|
||||||
int stop = 0;
|
int stop = 0;
|
||||||
@ -137,23 +138,29 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
|
|||||||
}
|
}
|
||||||
PUT_OOCS (checkpoint, fmt - checkpoint - 1);
|
PUT_OOCS (checkpoint, fmt - checkpoint - 1);
|
||||||
#else
|
#else
|
||||||
while ((ch = *fmt++) != '%' || stop)
|
while ((fch = *fmt++) != '%' || stop)
|
||||||
{
|
{
|
||||||
if (ch == '\0') goto done;
|
|
||||||
|
|
||||||
#if defined(HCL_OOCH_IS_UCH)
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
|
if (fch == '\0') goto done;
|
||||||
/* ooch is uch. fmtchar is bch */
|
/* ooch is uch. fmtchar is bch */
|
||||||
/* TODO: convert bch to uch */
|
/* TODO: convert bch to uch */
|
||||||
#else
|
|
||||||
/* ooch is bch. fmtchar is uch */
|
|
||||||
/* TODO: convert uch to bch */
|
|
||||||
#endif
|
|
||||||
PUT_OOCH (ch, 1);
|
PUT_OOCH (ch, 1);
|
||||||
|
#else
|
||||||
|
hcl_bch_t bcsbuf[HCL_MBLEN_MAX + 1];
|
||||||
|
hcl_oow_t ucslen, bcslen;
|
||||||
|
|
||||||
|
if (fch == '\0') goto done;
|
||||||
|
|
||||||
|
/* ooch is bch. fmtchar is uch */
|
||||||
|
ucslen = 1;
|
||||||
|
bcslen = 1;
|
||||||
|
if (hcl_convutooochars (hcl, &fch, &ucslen, bcsbuf, &bcslen) <= -1) goto oops;
|
||||||
|
PUT_OOCS (bcsbuf, bcslen);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
percent = fmt - 1;
|
percent = fmt - 1;
|
||||||
|
|
||||||
|
|
||||||
padc = ' ';
|
padc = ' ';
|
||||||
width = 0; precision = 0;
|
width = 0; precision = 0;
|
||||||
neg = 0; sign = 0;
|
neg = 0; sign = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user