added hcl_prufmtv() and hcl_prbfmtv()
This commit is contained in:
parent
77f8047af8
commit
16c7c290ce
@ -166,8 +166,8 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \
|
|||||||
$(top_srcdir)/ac/compile $(top_srcdir)/ac/config.guess \
|
$(top_srcdir)/ac/compile $(top_srcdir)/ac/config.guess \
|
||||||
$(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \
|
$(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \
|
||||||
$(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing ac/ar-lib \
|
$(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing ac/ar-lib \
|
||||||
ac/compile ac/config.guess ac/config.sub ac/install-sh \
|
ac/compile ac/config.guess ac/config.sub ac/depcomp \
|
||||||
ac/ltmain.sh ac/missing
|
ac/install-sh ac/ltmain.sh ac/missing
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
distdir = $(PACKAGE)-$(VERSION)
|
distdir = $(PACKAGE)-$(VERSION)
|
||||||
top_distdir = $(distdir)
|
top_distdir = $(distdir)
|
||||||
|
@ -30,7 +30,7 @@ hcl_LDFLAGS = $(LDFLAGS_ALL_COMMON)
|
|||||||
hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl
|
hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl
|
||||||
hcl_DEPENDENCIES = ../lib/libhcl.la
|
hcl_DEPENDENCIES = ../lib/libhcl.la
|
||||||
|
|
||||||
if ENABLE_HCLEX
|
if ENABLE_HCLX
|
||||||
|
|
||||||
## cb-impl.c is included in libhclx.
|
## cb-impl.c is included in libhclx.
|
||||||
## so ../lib/cb-impl.h and ../lib/cb-impl.c are not listed as sources
|
## so ../lib/cb-impl.h and ../lib/cb-impl.c are not listed as sources
|
||||||
|
@ -1150,6 +1150,7 @@ int main (int argc, char* argv[])
|
|||||||
* -- instead of returning -1 immediately. --*/
|
* -- instead of returning -1 immediately. --*/
|
||||||
set_signal (SIGINT, handle_sigint);
|
set_signal (SIGINT, handle_sigint);
|
||||||
|
|
||||||
|
hcl_prbfmt (hcl, "this is good %s %10hs %hs\n", "whole new world. 1234567890 from this point onward, any failure leasd to jumping to oops label", "as이거 좋은거잖아dkfjsdakfjsadklfjasd", "1111");
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
hcl_oop_t obj;
|
hcl_oop_t obj;
|
||||||
|
30
configure
vendored
30
configure
vendored
@ -651,8 +651,8 @@ HCL_SIZEOF_LONG_LONG
|
|||||||
HCL_SIZEOF_CHAR32_T
|
HCL_SIZEOF_CHAR32_T
|
||||||
HCL_SIZEOF_CHAR16_T
|
HCL_SIZEOF_CHAR16_T
|
||||||
HCL_SIZEOF_WCHAR_T
|
HCL_SIZEOF_WCHAR_T
|
||||||
ENABLE_HCLEX_FALSE
|
ENABLE_HCLX_FALSE
|
||||||
ENABLE_HCLEX_TRUE
|
ENABLE_HCLX_TRUE
|
||||||
ENABLE_LIBUNWIND_FALSE
|
ENABLE_LIBUNWIND_FALSE
|
||||||
ENABLE_LIBUNWIND_TRUE
|
ENABLE_LIBUNWIND_TRUE
|
||||||
ENABLE_LIBLTDL_FALSE
|
ENABLE_LIBLTDL_FALSE
|
||||||
@ -824,7 +824,7 @@ enable_dynamic_module
|
|||||||
enable_static_module
|
enable_static_module
|
||||||
enable_libltdl
|
enable_libltdl
|
||||||
enable_libunwind
|
enable_libunwind
|
||||||
enable_hclex
|
enable_hclx
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
host_alias
|
host_alias
|
||||||
@ -1482,7 +1482,7 @@ Optional Features:
|
|||||||
library(default. no)
|
library(default. no)
|
||||||
--enable-libltdl use libltdl(default. no)
|
--enable-libltdl use libltdl(default. no)
|
||||||
--enable-libunwind use libunwind(default. no)
|
--enable-libunwind use libunwind(default. no)
|
||||||
--enable-hclex build libhclex(default. no)
|
--enable-hclx build libhclx(default. no)
|
||||||
|
|
||||||
Optional Packages:
|
Optional Packages:
|
||||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||||
@ -21256,20 +21256,20 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-hclex was given.
|
# Check whether --enable-hclx was given.
|
||||||
if test "${enable_hclex+set}" = set; then :
|
if test "${enable_hclx+set}" = set; then :
|
||||||
enableval=$enable_hclex; enable_hclex_is=$enableval
|
enableval=$enable_hclx; enable_hclx_is=$enableval
|
||||||
else
|
else
|
||||||
enable_hclex_is=no
|
enable_hclx_is=no
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x${enable_hclex_is}" = "xyes"; then
|
if test "x${enable_hclx_is}" = "xyes"; then
|
||||||
ENABLE_HCLEX_TRUE=
|
ENABLE_HCLX_TRUE=
|
||||||
ENABLE_HCLEX_FALSE='#'
|
ENABLE_HCLX_FALSE='#'
|
||||||
else
|
else
|
||||||
ENABLE_HCLEX_TRUE='#'
|
ENABLE_HCLX_TRUE='#'
|
||||||
ENABLE_HCLEX_FALSE=
|
ENABLE_HCLX_FALSE=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -21479,8 +21479,8 @@ if test -z "${ENABLE_LIBUNWIND_TRUE}" && test -z "${ENABLE_LIBUNWIND_FALSE}"; th
|
|||||||
as_fn_error $? "conditional \"ENABLE_LIBUNWIND\" was never defined.
|
as_fn_error $? "conditional \"ENABLE_LIBUNWIND\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
if test -z "${ENABLE_HCLEX_TRUE}" && test -z "${ENABLE_HCLEX_FALSE}"; then
|
if test -z "${ENABLE_HCLX_TRUE}" && test -z "${ENABLE_HCLX_FALSE}"; then
|
||||||
as_fn_error $? "conditional \"ENABLE_HCLEX\" was never defined.
|
as_fn_error $? "conditional \"ENABLE_HCLX\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
12
configure.ac
12
configure.ac
@ -693,13 +693,13 @@ then
|
|||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(ENABLE_LIBUNWIND, test "x${enable_libunwind_is}" = "xyes")
|
AM_CONDITIONAL(ENABLE_LIBUNWIND, test "x${enable_libunwind_is}" = "xyes")
|
||||||
|
|
||||||
dnl ===== enable-hclex =====
|
dnl ===== enable-hclx =====
|
||||||
AC_ARG_ENABLE([hclex],
|
AC_ARG_ENABLE([hclx],
|
||||||
[AS_HELP_STRING([--enable-hclex],[build libhclex(default. no)])],
|
[AS_HELP_STRING([--enable-hclx],[build libhclx(default. no)])],
|
||||||
enable_hclex_is=$enableval,
|
enable_hclx_is=$enableval,
|
||||||
enable_hclex_is=no
|
enable_hclx_is=no
|
||||||
)
|
)
|
||||||
AM_CONDITIONAL(ENABLE_HCLEX, test "x${enable_hclex_is}" = "xyes")
|
AM_CONDITIONAL(ENABLE_HCLX, test "x${enable_hclx_is}" = "xyes")
|
||||||
|
|
||||||
AC_SUBST(HCL_SIZEOF_WCHAR_T, $ac_cv_sizeof_wchar_t)
|
AC_SUBST(HCL_SIZEOF_WCHAR_T, $ac_cv_sizeof_wchar_t)
|
||||||
AC_SUBST(HCL_SIZEOF_CHAR16_T, $ac_cv_sizeof_char16_t)
|
AC_SUBST(HCL_SIZEOF_CHAR16_T, $ac_cv_sizeof_char16_t)
|
||||||
|
@ -101,7 +101,7 @@ libhcl_la_LIBADD += -lhcl-sys
|
|||||||
libhcl_la_DEPENDENCIES += $(abs_builddir)/../mod/libhcl-sys.la
|
libhcl_la_DEPENDENCIES += $(abs_builddir)/../mod/libhcl-sys.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ENABLE_HCLEX
|
if ENABLE_HCLX
|
||||||
pkglib_LTLIBRARIES += libhclx.la
|
pkglib_LTLIBRARIES += libhclx.la
|
||||||
pkginclude_HEADERS += hcl-c.h hcl-s.h hcl-tmr.h hcl-xutl.h hcl-json.h
|
pkginclude_HEADERS += hcl-c.h hcl-s.h hcl-tmr.h hcl-xutl.h hcl-json.h
|
||||||
libhclx_la_SOURCES = \
|
libhclx_la_SOURCES = \
|
||||||
|
76
lib/fmt.c
76
lib/fmt.c
@ -1646,9 +1646,6 @@ static int print_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
|
|||||||
ucslen = HCL_COUNTOF(ucsbuf);
|
ucslen = HCL_COUNTOF(ucsbuf);
|
||||||
hcl_conv_bchars_to_uchars_with_cmgr(ptr, &bcslen, ucsbuf, &ucslen, hcl->cmgr, 1);
|
hcl_conv_bchars_to_uchars_with_cmgr(ptr, &bcslen, ucsbuf, &ucslen, hcl->cmgr, 1);
|
||||||
|
|
||||||
hcl->c->outarg.ptr = ucsbuf;
|
|
||||||
hcl->c->outarg.len = ucslen;
|
|
||||||
|
|
||||||
ucsptr = ucsbuf;
|
ucsptr = ucsbuf;
|
||||||
while (ucslen > 0)
|
while (ucslen > 0)
|
||||||
{
|
{
|
||||||
@ -1690,9 +1687,11 @@ static int print_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
|
|||||||
static int print_ucs (hcl_fmtout_t* fmtout, const hcl_uch_t* ptr, hcl_oow_t len)
|
static int print_ucs (hcl_fmtout_t* fmtout, const hcl_uch_t* ptr, hcl_oow_t len)
|
||||||
{
|
{
|
||||||
hcl_t* hcl = (hcl_t*)fmtout->ctx;
|
hcl_t* hcl = (hcl_t*)fmtout->ctx;
|
||||||
hcl_uch_t* optr;
|
|
||||||
|
|
||||||
#if defined(HCL_OOCH_IS_UCH)
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
|
hcl_uch_t* optr;
|
||||||
|
|
||||||
optr = (hcl_uch_t*)ptr;
|
optr = (hcl_uch_t*)ptr;
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
@ -1707,17 +1706,41 @@ static int print_ucs (hcl_fmtout_t* fmtout, const hcl_uch_t* ptr, hcl_oow_t len)
|
|||||||
len -= hcl->c->outarg.xlen;
|
len -= hcl->c->outarg.xlen;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* TODO: */
|
hcl_oow_t bcslen, ucslen;
|
||||||
|
hcl_ooch_t bcsbuf[64], * bcsptr;
|
||||||
|
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
ucslen = len;
|
||||||
|
bcslen = HCL_COUNTOF(bcsbuf);
|
||||||
|
hcl_conv_uchars_to_bchars_with_cmgr(ptr, &ucslen, bcsbuf, &bcslen, hcl->cmgr);
|
||||||
|
|
||||||
|
bcsptr = bcsbuf;
|
||||||
|
while (ucslen > 0)
|
||||||
|
{
|
||||||
|
hcl->c->outarg.ptr = bcsptr;
|
||||||
|
hcl->c->outarg.len = bcslen;
|
||||||
|
|
||||||
|
if (hcl->c->printer(hcl, HCL_IO_WRITE, &hcl->c->outarg) <= -1) return -1;
|
||||||
|
if (hcl->c->outarg.xlen <= 0) return 0; /* end of stream. but not failure */
|
||||||
|
|
||||||
|
HCL_ASSERT (hcl, hcl->c->outarg.xlen <= len);
|
||||||
|
bcsptr += hcl->c->outarg.xlen;
|
||||||
|
bcslen -= hcl->c->outarg.xlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr += ucslen;
|
||||||
|
len -= ucslen;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 1; /* success */
|
return 1; /* success */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hcl_ooi_t hcl_prbfmt (hcl_t* hcl, const hcl_bch_t* fmt, ...)
|
hcl_ooi_t hcl_prbfmtv (hcl_t* hcl, const hcl_bch_t* fmt, va_list ap)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
va_list ap;
|
|
||||||
hcl_fmtout_t fo;
|
hcl_fmtout_t fo;
|
||||||
|
|
||||||
HCL_MEMSET (&fo, 0, HCL_SIZEOF(fo));
|
HCL_MEMSET (&fo, 0, HCL_SIZEOF(fo));
|
||||||
@ -1725,21 +1748,31 @@ hcl_ooi_t hcl_prbfmt (hcl_t* hcl, const hcl_bch_t* fmt, ...)
|
|||||||
fo.fmt_str = fmt;
|
fo.fmt_str = fmt;
|
||||||
fo.ctx = hcl;
|
fo.ctx = hcl;
|
||||||
fo.mask = 0;
|
fo.mask = 0;
|
||||||
fo.putbcs = log_bcs;
|
fo.putbcs = print_bcs;
|
||||||
fo.putucs = log_ucs;
|
fo.putucs = print_ucs;
|
||||||
fo.putobj = hcl_fmt_object_;
|
fo.putobj = hcl_fmt_object_;
|
||||||
|
|
||||||
va_start (ap, fmt);
|
|
||||||
x = fmt_outv(&fo, ap);
|
x = fmt_outv(&fo, ap);
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
return (x <= -1)? -1: fo.count;
|
return (x <= -1)? -1: fo.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcl_ooi_t hcl_prufmt (hcl_t* hcl, const hcl_uch_t* fmt, ...)
|
hcl_ooi_t hcl_prbfmt (hcl_t* hcl, const hcl_bch_t* fmt, ...)
|
||||||
|
{
|
||||||
|
hcl_ooi_t x;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start (ap, fmt);
|
||||||
|
x = hcl_prbfmtv(hcl, fmt, ap);
|
||||||
|
va_end (ap);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
hcl_ooi_t hcl_prufmtv (hcl_t* hcl, const hcl_uch_t* fmt, va_list ap)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
va_list ap;
|
|
||||||
hcl_fmtout_t fo;
|
hcl_fmtout_t fo;
|
||||||
|
|
||||||
HCL_MEMSET (&fo, 0, HCL_SIZEOF(fo));
|
HCL_MEMSET (&fo, 0, HCL_SIZEOF(fo));
|
||||||
@ -1747,17 +1780,26 @@ hcl_ooi_t hcl_prufmt (hcl_t* hcl, const hcl_uch_t* fmt, ...)
|
|||||||
fo.fmt_str = fmt;
|
fo.fmt_str = fmt;
|
||||||
fo.ctx = hcl;
|
fo.ctx = hcl;
|
||||||
fo.mask = 0;
|
fo.mask = 0;
|
||||||
fo.putbcs = log_bcs;
|
fo.putbcs = print_bcs;
|
||||||
fo.putucs = log_ucs;
|
fo.putucs = print_ucs;
|
||||||
fo.putobj = hcl_fmt_object_;
|
fo.putobj = hcl_fmt_object_;
|
||||||
|
|
||||||
va_start (ap, fmt);
|
|
||||||
x = fmt_outv(&fo, ap);
|
x = fmt_outv(&fo, ap);
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
return (x <= -1)? -1: fo.count;
|
return (x <= -1)? -1: fo.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hcl_ooi_t hcl_prufmt (hcl_t* hcl, const hcl_uch_t* fmt, ...)
|
||||||
|
{
|
||||||
|
hcl_ooi_t x;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start (ap, fmt);
|
||||||
|
x = hcl_prufmtv(hcl, fmt, ap);
|
||||||
|
va_end (ap);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
* SUPPORT FOR FORMATTED OUTPUT TO BE USED BY BUILTIN PRIMITIVE FUNCTIONS
|
* SUPPORT FOR FORMATTED OUTPUT TO BE USED BY BUILTIN PRIMITIVE FUNCTIONS
|
||||||
|
19
lib/hcl.h
19
lib/hcl.h
@ -1825,12 +1825,31 @@ HCL_EXPORT hcl_ooi_t hcl_prbfmt (
|
|||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
HCL_EXPORT hcl_ooi_t hcl_prbfmtv (
|
||||||
|
hcl_t* hcl,
|
||||||
|
const hcl_bch_t* fmt,
|
||||||
|
va_list ap
|
||||||
|
);
|
||||||
|
|
||||||
HCL_EXPORT hcl_ooi_t hcl_prufmt (
|
HCL_EXPORT hcl_ooi_t hcl_prufmt (
|
||||||
hcl_t* hcl,
|
hcl_t* hcl,
|
||||||
const hcl_uch_t* fmt,
|
const hcl_uch_t* fmt,
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
HCL_EXPORT hcl_ooi_t hcl_prufmtv (
|
||||||
|
hcl_t* hcl,
|
||||||
|
const hcl_uch_t* fmt,
|
||||||
|
va_list ap
|
||||||
|
);
|
||||||
|
|
||||||
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
|
# define hcl_proofmt hcl_prufmt
|
||||||
|
# define hcl_proofmtv hcl_prufmtv
|
||||||
|
#else
|
||||||
|
# define hcl_proofmt hcl_prbfmt
|
||||||
|
# define hcl_proofmtv hcl_prbfmtv
|
||||||
|
#endif
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
* OBJECT MANAGEMENT
|
* OBJECT MANAGEMENT
|
||||||
* ========================================================================= */
|
* ========================================================================= */
|
||||||
|
Loading…
Reference in New Issue
Block a user