exposed hcl_addbuiltinprims().

This commit is contained in:
hyung-hwan 2018-03-19 09:22:12 +00:00
parent 89f3fc2d08
commit 46ff9acfe2
8 changed files with 24 additions and 43 deletions

View File

@ -353,7 +353,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -584,7 +583,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)" || chmod -R a+r "$(distdir)"
dist-gzip: distdir dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-bzip2: distdir dist-bzip2: distdir
@ -610,7 +609,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \ @echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2 "deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-zip: distdir dist-zip: distdir
@ -628,7 +627,7 @@ dist dist-all:
distcheck: dist distcheck: dist
case '$(DIST_ARCHIVES)' in \ case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \ *.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \ *.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \ *.tar.lz*) \
@ -638,7 +637,7 @@ distcheck: dist
*.tar.Z*) \ *.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \ *.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
esac esac

14
configure vendored
View File

@ -781,7 +781,6 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
@ -875,7 +874,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -1128,15 +1126,6 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1274,7 +1263,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir libdir localedir mandir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
@ -1427,7 +1416,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]

View File

@ -420,7 +420,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@

View File

@ -996,13 +996,6 @@ hcl_pfbase_t* hcl_querymod (
hcl_mod_t** mod hcl_mod_t** mod
); );
/* ========================================================================= */
/* prim.c */
/* ========================================================================= */
int hcl_addbuiltinprims (
hcl_t* hcl
);
/* ========================================================================= */ /* ========================================================================= */
/* logfmt.c */ /* logfmt.c */
/* ========================================================================= */ /* ========================================================================= */

View File

@ -1396,8 +1396,8 @@ static int get_token (hcl_server_proto_t* proto)
SET_TOKEN_TYPE (proto, HCL_SERVER_PROTO_TOKEN_EOF); /* is it correct? */ SET_TOKEN_TYPE (proto, HCL_SERVER_PROTO_TOKEN_EOF); /* is it correct? */
proto->tok.len = 0; proto->tok.len = 0;
proto->tok.loc = proto->hcl->c->lxc.l; /* set token location */ proto->tok.loc = proto->lxc->l; /* set token location */
switch (c) switch (c)
{ {
case HCL_OOCI_EOF: case HCL_OOCI_EOF:

View File

@ -1583,6 +1583,10 @@ HCL_EXPORT int hcl_ignite (
hcl_t* hcl hcl_t* hcl
); );
HCL_EXPORT int hcl_addbuiltinprims (
hcl_t* hcl
);
/** /**
* The hcl_execute() function executes an activated context. * The hcl_execute() function executes an activated context.
*/ */

View File

@ -127,7 +127,7 @@ static int write_all (int fd, const hcl_bch_t* ptr, hcl_oow_t len)
} }
static int write_log (hcl_server_t* server, const hcl_bch_t* ptr, hcl_oow_t len) static int write_log (hcl_server_t* server, int fd, const hcl_bch_t* ptr, hcl_oow_t len)
{ {
server_xtn_t* xtn; server_xtn_t* xtn;
@ -161,7 +161,7 @@ static int write_log (hcl_server_t* server, const hcl_bch_t* ptr, hcl_oow_t len)
rcapa = HCL_COUNTOF(xtn->logbuf.buf); rcapa = HCL_COUNTOF(xtn->logbuf.buf);
if (len >= rcapa) if (len >= rcapa)
{ {
write_all (xtn->logfd, ptr, rcapa); write_all (fd, ptr, rcapa);
ptr += rcapa; ptr += rcapa;
len -= rcapa; len -= rcapa;
} }
@ -179,13 +179,13 @@ static int write_log (hcl_server_t* server, const hcl_bch_t* ptr, hcl_oow_t len)
return 0; return 0;
} }
static void flush_log (hcl_server_t* server) static void flush_log (hcl_server_t* server, int fd)
{ {
server_xtn_t* xtn; server_xtn_t* xtn;
xtn = hcl_server_getxtn(server); xtn = hcl_server_getxtn(server);
if (xtn->logbuf.len > 0) if (xtn->logbuf.len > 0)
{ {
write_all (xtn->logfd, xtn->logbuf.buf, xtn->logbuf.len); write_all (fd, xtn->logbuf.buf, xtn->logbuf.len);
xtn->logbuf.len = 0; xtn->logbuf.len = 0;
} }
} }
@ -241,22 +241,21 @@ static void log_write (hcl_server_t* server, hcl_oow_t wid, unsigned int mask, c
tslen = 25; tslen = 25;
} }
/* TODO: less write system calls by having a buffer */ write_log (server, logfd, ts, tslen);
write_log (server, ts, tslen);
if (wid != HCL_SERVER_WID_INVALID) if (wid != HCL_SERVER_WID_INVALID)
{ {
/* TODO: check if the underlying snprintf support %zd */ /* TODO: check if the underlying snprintf support %zd */
tslen = snprintf (ts, sizeof(ts), "[%zu] ", wid); tslen = snprintf (ts, sizeof(ts), "[%zu] ", wid);
write_log (server, ts, tslen); write_log (server, logfd, ts, tslen);
} }
} }
if (xtn->logfd_istty) if (xtn->logfd_istty)
{ {
if (mask & HCL_LOG_FATAL) write_log (server, "\x1B[1;31m", 7); if (mask & HCL_LOG_FATAL) write_log (server, logfd, "\x1B[1;31m", 7);
else if (mask & HCL_LOG_ERROR) write_log (server, "\x1B[1;32m", 7); else if (mask & HCL_LOG_ERROR) write_log (server, logfd, "\x1B[1;32m", 7);
else if (mask & HCL_LOG_WARN) write_log (server, "\x1B[1;33m", 7); else if (mask & HCL_LOG_WARN) write_log (server, logfd, "\x1B[1;33m", 7);
} }
#if defined(HCL_OOCH_IS_UCH) #if defined(HCL_OOCH_IS_UCH)
@ -279,7 +278,7 @@ static void log_write (hcl_server_t* server, hcl_oow_t wid, unsigned int mask, c
/*assert (ucslen > 0);*/ /*assert (ucslen > 0);*/
/* attempt to write all converted characters */ /* attempt to write all converted characters */
if (write_log(server, buf, bcslen) <= -1) break; if (write_log(server, logfd, buf, bcslen) <= -1) break;
if (n == 0) break; if (n == 0) break;
else else
@ -295,15 +294,15 @@ static void log_write (hcl_server_t* server, hcl_oow_t wid, unsigned int mask, c
} }
} }
#else #else
write_log (server, msg, len); write_log (server, logfd, msg, len);
#endif #endif
if (xtn->logfd_istty) if (xtn->logfd_istty)
{ {
if (mask & (HCL_LOG_FATAL | HCL_LOG_ERROR | HCL_LOG_WARN)) write_log (server, "\x1B[0m", 4); if (mask & (HCL_LOG_FATAL | HCL_LOG_ERROR | HCL_LOG_WARN)) write_log (server, logfd, "\x1B[0m", 4);
} }
flush_log (server); flush_log (server, logfd);
} }
/* ========================================================================= */ /* ========================================================================= */

View File

@ -376,7 +376,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@