work in progress to implement the builtin printf function

This commit is contained in:
2018-02-24 04:01:19 +00:00
parent a5fe90597c
commit 7e6b16e153
4 changed files with 1007 additions and 31 deletions

View File

@ -74,7 +74,7 @@
#define PUT_OOCH(c,n) do { \
if (n > 0) { \
int xx; \
if ((xx = data->putch (hcl, data->mask, c, n)) <= -1) goto oops; \
if ((xx = data->putch(hcl, data->mask, c, n)) <= -1) goto oops; \
if (xx == 0) goto done; \
data->count += n; \
} \
@ -83,7 +83,7 @@
#define PUT_OOCS(ptr,len) do { \
if (len > 0) { \
int xx; \
if ((xx = data->putcs (hcl, data->mask, ptr, len)) <= -1) goto oops; \
if ((xx = data->putcs(hcl, data->mask, ptr, len)) <= -1) goto oops; \
if (xx == 0) goto done; \
data->count += len; \
} \
@ -137,10 +137,17 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
}
PUT_OOCS (checkpoint, fmt - checkpoint - 1);
#else
while ((ch = *fmt++) != '%' || stop)
{
if (ch == '\0') goto done;
#if defined(HCL_OOCH_IS_UCH)
/* ooch is uch. fmtchar is bch */
/* TODO: convert bch to uch */
#else
/* ooch is bch. fmtchar is uch */
/* TODO: convert uch to bch */
#endif
PUT_OOCH (ch, 1);
}
#endif