From 46ff9acfe25887174526eb922b13ad56b7f57f3c Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 19 Mar 2018 09:22:12 +0000 Subject: [PATCH] exposed hcl_addbuiltinprims(). --- Makefile.in | 9 ++++----- configure | 14 +------------- lib/Makefile.in | 1 - lib/hcl-prv.h | 7 ------- lib/hcl-s.c | 4 ++-- lib/hcl.h | 4 ++++ lib/main-s.c | 27 +++++++++++++-------------- mod/Makefile.in | 1 - 8 files changed, 24 insertions(+), 43 deletions(-) diff --git a/Makefile.in b/Makefile.in index ea0c943..365416a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -353,7 +353,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -584,7 +583,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(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) dist-bzip2: distdir @@ -610,7 +609,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&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) dist-zip: distdir @@ -628,7 +627,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.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*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -638,7 +637,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/configure b/configure index 6f1e1b5..5a13c82 100755 --- a/configure +++ b/configure @@ -781,7 +781,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -875,7 +874,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1128,15 +1126,6 @@ do | -silent | --silent | --silen | --sile | --sil) 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) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1274,7 +1263,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1427,7 +1416,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] diff --git a/lib/Makefile.in b/lib/Makefile.in index 2883f01..ddd8e03 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -420,7 +420,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/lib/hcl-prv.h b/lib/hcl-prv.h index 323db2e..9798e2c 100644 --- a/lib/hcl-prv.h +++ b/lib/hcl-prv.h @@ -996,13 +996,6 @@ hcl_pfbase_t* hcl_querymod ( hcl_mod_t** mod ); -/* ========================================================================= */ -/* prim.c */ -/* ========================================================================= */ -int hcl_addbuiltinprims ( - hcl_t* hcl -); - /* ========================================================================= */ /* logfmt.c */ /* ========================================================================= */ diff --git a/lib/hcl-s.c b/lib/hcl-s.c index 8d67399..0ff6ebb 100644 --- a/lib/hcl-s.c +++ b/lib/hcl-s.c @@ -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? */ 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) { case HCL_OOCI_EOF: diff --git a/lib/hcl.h b/lib/hcl.h index bf8d4b8..0c9a155 100644 --- a/lib/hcl.h +++ b/lib/hcl.h @@ -1583,6 +1583,10 @@ HCL_EXPORT int hcl_ignite ( hcl_t* hcl ); +HCL_EXPORT int hcl_addbuiltinprims ( + hcl_t* hcl +); + /** * The hcl_execute() function executes an activated context. */ diff --git a/lib/main-s.c b/lib/main-s.c index 1909e6a..6f894d6 100644 --- a/lib/main-s.c +++ b/lib/main-s.c @@ -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; @@ -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); if (len >= rcapa) { - write_all (xtn->logfd, ptr, rcapa); + write_all (fd, ptr, rcapa); ptr += 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; } -static void flush_log (hcl_server_t* server) +static void flush_log (hcl_server_t* server, int fd) { server_xtn_t* xtn; xtn = hcl_server_getxtn(server); 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; } } @@ -241,22 +241,21 @@ static void log_write (hcl_server_t* server, hcl_oow_t wid, unsigned int mask, c tslen = 25; } -/* TODO: less write system calls by having a buffer */ - write_log (server, ts, tslen); + write_log (server, logfd, ts, tslen); if (wid != HCL_SERVER_WID_INVALID) { /* TODO: check if the underlying snprintf support %zd */ tslen = snprintf (ts, sizeof(ts), "[%zu] ", wid); - write_log (server, ts, tslen); + write_log (server, logfd, ts, tslen); } } if (xtn->logfd_istty) { - if (mask & HCL_LOG_FATAL) write_log (server, "\x1B[1;31m", 7); - else if (mask & HCL_LOG_ERROR) write_log (server, "\x1B[1;32m", 7); - else if (mask & HCL_LOG_WARN) write_log (server, "\x1B[1;33m", 7); + if (mask & HCL_LOG_FATAL) write_log (server, logfd, "\x1B[1;31m", 7); + else if (mask & HCL_LOG_ERROR) write_log (server, logfd, "\x1B[1;32m", 7); + else if (mask & HCL_LOG_WARN) write_log (server, logfd, "\x1B[1;33m", 7); } #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);*/ /* 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; else @@ -295,15 +294,15 @@ static void log_write (hcl_server_t* server, hcl_oow_t wid, unsigned int mask, c } } #else - write_log (server, msg, len); + write_log (server, logfd, msg, len); #endif 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); } /* ========================================================================= */ diff --git a/mod/Makefile.in b/mod/Makefile.in index 40b1ca0..1970289 100644 --- a/mod/Makefile.in +++ b/mod/Makefile.in @@ -376,7 +376,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@