From 5aa3a72eea36b1495d5bdf5d3d675de5148f0fd0 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 17 Mar 2018 16:07:51 +0000 Subject: [PATCH] renamed main2.c to main-s.c started adding client code --- configure | 25 +++++ configure.ac | 8 ++ lib/Makefile.am | 24 ++++- lib/Makefile.in | 110 ++++++++++++++++----- lib/hcl-c.c | 203 ++++++++++++++++++++++++++++++++++++++ lib/hcl-c.h | 23 +++++ lib/{main2.c => main-s.c} | 0 7 files changed, 366 insertions(+), 27 deletions(-) rename lib/{main2.c => main-s.c} (100%) diff --git a/configure b/configure index 11e16ac..6f1e1b5 100755 --- a/configure +++ b/configure @@ -651,6 +651,8 @@ HCL_SIZEOF_LONG_LONG HCL_SIZEOF_CHAR32_T HCL_SIZEOF_CHAR16_T HCL_SIZEOF_WCHAR_T +ENABLE_HCLC_FALSE +ENABLE_HCLC_TRUE ENABLE_HCLS_FALSE ENABLE_HCLS_TRUE ENABLE_LIBLTDL_FALSE @@ -819,6 +821,7 @@ enable_dynamic_module enable_static_module enable_libltdl enable_hcls +enable_hclc ' ac_precious_vars='build_alias host_alias @@ -1485,6 +1488,7 @@ Optional Features: library(default. no) --enable-libltdl use libltdl(default. no) --enable-hcls build libhcls and hcls(default. no) + --enable-hclc build libhclc and hclc(default. no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -21145,6 +21149,23 @@ else fi +# Check whether --enable-hclc was given. +if test "${enable_hclc+set}" = set; then : + enableval=$enable_hclc; enable_hclc_is=$enableval +else + enable_hclc_is=no + +fi + + if test "${enable_hclc_is}" = "yes"; then + ENABLE_HCLC_TRUE= + ENABLE_HCLC_FALSE='#' +else + ENABLE_HCLC_TRUE='#' + ENABLE_HCLC_FALSE= +fi + + HCL_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t HCL_SIZEOF_CHAR16_T=$ac_cv_sizeof_char16_t @@ -21347,6 +21368,10 @@ if test -z "${ENABLE_HCLS_TRUE}" && test -z "${ENABLE_HCLS_FALSE}"; then as_fn_error $? "conditional \"ENABLE_HCLS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_HCLC_TRUE}" && test -z "${ENABLE_HCLC_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_HCLC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git a/configure.ac b/configure.ac index b0f26f7..f825e42 100644 --- a/configure.ac +++ b/configure.ac @@ -643,6 +643,14 @@ AC_ARG_ENABLE([hcls], ) AM_CONDITIONAL(ENABLE_HCLS, test "${enable_hcls_is}" = "yes") +dnl ===== enable-hclc ===== +AC_ARG_ENABLE([hclc], + [AS_HELP_STRING([--enable-hclc],[build libhclc and hclc(default. no)])], + enable_hclc_is=$enableval, + enable_hclc_is=no +) +AM_CONDITIONAL(ENABLE_HCLC, test "${enable_hclc_is}" = "yes") + 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_CHAR32_T, $ac_cv_sizeof_char32_t) diff --git a/lib/Makefile.am b/lib/Makefile.am index b5e9519..5d0e7f7 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -81,6 +81,15 @@ libhcls_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) libhcls_la_DEPENDENCIES = endif +if ENABLE_HCLC +pkglib_LTLIBRARIES += libhclc.la +libhclc_la_SOURCES = hcl-c.c hcl-c.h +libhclc_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) +libhclc_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) +libhclc_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) +libhclc_la_DEPENDENCIES = +endif + if ENABLE_STATIC_MODULE libhcl_la_LIBADD += -lhcl-arr libhcl_la_DEPENDENCIES += $(abs_builddir)/../mod/libhcl-arr.la @@ -101,15 +110,26 @@ endif if ENABLE_HCLS bin_PROGRAMS += hcls -hcls_SOURCES = main2.c +hcls_SOURCES = main-s.c hcls_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hcls_LDFLAGS = $(LDFLAGS_LIB_COMMON) -hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhcls #-ldyncall_s +hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhcls if ENABLE_STATIC_MODULE hcls_DEPENDENCIES = libhcl.la libhcls.la endif endif +if ENABLE_HCLC +bin_PROGRAMS += hclc +hclc_SOURCES = main-c.c +hclc_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) +hclc_LDFLAGS = $(LDFLAGS_LIB_COMMON) +hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclc +if ENABLE_STATIC_MODULE +hclc_DEPENDENCIES = libhcl.la libhclc.la +endif +endif + install-data-hook: @echo "#ifndef _HCL_CFG_H_" > "$(DESTDIR)$(pkgincludedir)/hcl-cfg.h" @echo "#define _HCL_CFG_H_" >> "$(DESTDIR)$(pkgincludedir)/hcl-cfg.h" diff --git a/lib/Makefile.in b/lib/Makefile.in index 349b897..2883f01 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -91,16 +91,20 @@ host_triplet = @host@ @ENABLE_LIBLTDL_TRUE@am__append_1 = $(LTDL_LIBS) @ENABLE_LIBLTDL_FALSE@am__append_2 = $(DL_LIBS) @ENABLE_HCLS_TRUE@am__append_3 = libhcls.la -@ENABLE_STATIC_MODULE_TRUE@am__append_4 = -lhcl-arr -lhcl-dic \ +@ENABLE_HCLC_TRUE@am__append_4 = libhclc.la +@ENABLE_STATIC_MODULE_TRUE@am__append_5 = -lhcl-arr -lhcl-dic \ @ENABLE_STATIC_MODULE_TRUE@ -lhcl-str -@ENABLE_STATIC_MODULE_TRUE@am__append_5 = $(abs_builddir)/../mod/libhcl-arr.la \ +@ENABLE_STATIC_MODULE_TRUE@am__append_6 = $(abs_builddir)/../mod/libhcl-arr.la \ @ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-dic.la \ @ENABLE_STATIC_MODULE_TRUE@ $(abs_builddir)/../mod/libhcl-str.la -bin_PROGRAMS = hcl$(EXEEXT) $(am__EXEEXT_1) +bin_PROGRAMS = hcl$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) @ENABLE_STATIC_MODULE_FALSE@hcl_DEPENDENCIES = $(am__DEPENDENCIES_4) -@ENABLE_HCLS_TRUE@am__append_6 = hcls +@ENABLE_HCLS_TRUE@am__append_7 = hcls @ENABLE_HCLS_TRUE@@ENABLE_STATIC_MODULE_FALSE@hcls_DEPENDENCIES = $(am__DEPENDENCIES_4) \ @ENABLE_HCLS_TRUE@@ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) +@ENABLE_HCLC_TRUE@am__append_8 = hclc +@ENABLE_HCLC_TRUE@@ENABLE_STATIC_MODULE_FALSE@hclc_DEPENDENCIES = $(am__DEPENDENCIES_4) \ +@ENABLE_HCLC_TRUE@@ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ @@ -168,6 +172,13 @@ am__v_lt_1 = libhcl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libhcl_la_LDFLAGS) $(LDFLAGS) -o $@ +am__libhclc_la_SOURCES_DIST = hcl-c.c hcl-c.h +@ENABLE_HCLC_TRUE@am_libhclc_la_OBJECTS = libhclc_la-hcl-c.lo +libhclc_la_OBJECTS = $(am_libhclc_la_OBJECTS) +libhclc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libhclc_la_LDFLAGS) $(LDFLAGS) -o $@ +@ENABLE_HCLC_TRUE@am_libhclc_la_rpath = -rpath $(pkglibdir) am__libhcls_la_SOURCES_DIST = hcl-s.c hcl-s.h @ENABLE_HCLS_TRUE@am_libhcls_la_OBJECTS = libhcls_la-hcl-s.lo libhcls_la_OBJECTS = $(am_libhcls_la_OBJECTS) @@ -176,14 +187,21 @@ libhcls_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(libhcls_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_HCLS_TRUE@am_libhcls_la_rpath = -rpath $(pkglibdir) @ENABLE_HCLS_TRUE@am__EXEEXT_1 = hcls$(EXEEXT) +@ENABLE_HCLC_TRUE@am__EXEEXT_2 = hclc$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am_hcl_OBJECTS = hcl-main.$(OBJEXT) hcl_OBJECTS = $(am_hcl_OBJECTS) hcl_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hcl_LDFLAGS) $(LDFLAGS) -o $@ -am__hcls_SOURCES_DIST = main2.c -@ENABLE_HCLS_TRUE@am_hcls_OBJECTS = hcls-main2.$(OBJEXT) +am__hclc_SOURCES_DIST = main-c.c +@ENABLE_HCLC_TRUE@am_hclc_OBJECTS = hclc-main-c.$(OBJEXT) +hclc_OBJECTS = $(am_hclc_OBJECTS) +hclc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(hclc_LDFLAGS) $(LDFLAGS) -o $@ +am__hcls_SOURCES_DIST = main-s.c +@ENABLE_HCLS_TRUE@am_hcls_OBJECTS = hcls-main-s.$(OBJEXT) hcls_OBJECTS = $(am_hcls_OBJECTS) hcls_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -222,10 +240,12 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libhcl_la_SOURCES) $(libhcls_la_SOURCES) $(hcl_SOURCES) \ +SOURCES = $(libhcl_la_SOURCES) $(libhclc_la_SOURCES) \ + $(libhcls_la_SOURCES) $(hcl_SOURCES) $(hclc_SOURCES) \ $(hcls_SOURCES) -DIST_SOURCES = $(libhcl_la_SOURCES) $(am__libhcls_la_SOURCES_DIST) \ - $(hcl_SOURCES) $(am__hcls_SOURCES_DIST) +DIST_SOURCES = $(libhcl_la_SOURCES) $(am__libhclc_la_SOURCES_DIST) \ + $(am__libhcls_la_SOURCES_DIST) $(hcl_SOURCES) \ + $(am__hclc_SOURCES_DIST) $(am__hcls_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -433,7 +453,7 @@ pkginclude_HEADERS = \ hcl-utl.h \ hcl.h -pkglib_LTLIBRARIES = libhcl.la $(am__append_3) +pkglib_LTLIBRARIES = libhcl.la $(am__append_3) $(am__append_4) libhcl_la_SOURCES = \ hcl-prv.h \ logfmtv.h \ @@ -463,23 +483,33 @@ libhcl_la_SOURCES = \ libhcl_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) libhcl_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) -libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_4) -libhcl_la_DEPENDENCIES = $(am__append_5) +libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_5) +libhcl_la_DEPENDENCIES = $(am__append_6) @ENABLE_HCLS_TRUE@libhcls_la_SOURCES = hcl-s.c hcl-s.h @ENABLE_HCLS_TRUE@libhcls_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) @ENABLE_HCLS_TRUE@libhcls_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) @ENABLE_HCLS_TRUE@libhcls_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) @ENABLE_HCLS_TRUE@libhcls_la_DEPENDENCIES = +@ENABLE_HCLC_TRUE@libhclc_la_SOURCES = hcl-c.c hcl-c.h +@ENABLE_HCLC_TRUE@libhclc_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) +@ENABLE_HCLC_TRUE@libhclc_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) +@ENABLE_HCLC_TRUE@libhclc_la_LIBADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) +@ENABLE_HCLC_TRUE@libhclc_la_DEPENDENCIES = hcl_SOURCES = main.c hcl_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) hcl_LDFLAGS = $(LDFLAGS_LIB_COMMON) hcl_LDADD = $(LIBADD_LIB_COMMON) -lhcl #-ldyncall_s @ENABLE_STATIC_MODULE_TRUE@hcl_DEPENDENCIES = libhcl.la -@ENABLE_HCLS_TRUE@hcls_SOURCES = main2.c +@ENABLE_HCLS_TRUE@hcls_SOURCES = main-s.c @ENABLE_HCLS_TRUE@hcls_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) @ENABLE_HCLS_TRUE@hcls_LDFLAGS = $(LDFLAGS_LIB_COMMON) -@ENABLE_HCLS_TRUE@hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhcls #-ldyncall_s +@ENABLE_HCLS_TRUE@hcls_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhcls @ENABLE_HCLS_TRUE@@ENABLE_STATIC_MODULE_TRUE@hcls_DEPENDENCIES = libhcl.la libhcls.la +@ENABLE_HCLC_TRUE@hclc_SOURCES = main-c.c +@ENABLE_HCLC_TRUE@hclc_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) +@ENABLE_HCLC_TRUE@hclc_LDFLAGS = $(LDFLAGS_LIB_COMMON) +@ENABLE_HCLC_TRUE@hclc_LDADD = $(LIBADD_LIB_COMMON) $(PTHREAD_LIBS) -lhcl -lhclc +@ENABLE_HCLC_TRUE@@ENABLE_STATIC_MODULE_TRUE@hclc_DEPENDENCIES = libhcl.la libhclc.la all: hcl-cfg.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -568,6 +598,9 @@ clean-pkglibLTLIBRARIES: libhcl.la: $(libhcl_la_OBJECTS) $(libhcl_la_DEPENDENCIES) $(EXTRA_libhcl_la_DEPENDENCIES) $(AM_V_CCLD)$(libhcl_la_LINK) -rpath $(pkglibdir) $(libhcl_la_OBJECTS) $(libhcl_la_LIBADD) $(LIBS) +libhclc.la: $(libhclc_la_OBJECTS) $(libhclc_la_DEPENDENCIES) $(EXTRA_libhclc_la_DEPENDENCIES) + $(AM_V_CCLD)$(libhclc_la_LINK) $(am_libhclc_la_rpath) $(libhclc_la_OBJECTS) $(libhclc_la_LIBADD) $(LIBS) + libhcls.la: $(libhcls_la_OBJECTS) $(libhcls_la_DEPENDENCIES) $(EXTRA_libhcls_la_DEPENDENCIES) $(AM_V_CCLD)$(libhcls_la_LINK) $(am_libhcls_la_rpath) $(libhcls_la_OBJECTS) $(libhcls_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @@ -624,6 +657,10 @@ hcl$(EXEEXT): $(hcl_OBJECTS) $(hcl_DEPENDENCIES) $(EXTRA_hcl_DEPENDENCIES) @rm -f hcl$(EXEEXT) $(AM_V_CCLD)$(hcl_LINK) $(hcl_OBJECTS) $(hcl_LDADD) $(LIBS) +hclc$(EXEEXT): $(hclc_OBJECTS) $(hclc_DEPENDENCIES) $(EXTRA_hclc_DEPENDENCIES) + @rm -f hclc$(EXEEXT) + $(AM_V_CCLD)$(hclc_LINK) $(hclc_OBJECTS) $(hclc_LDADD) $(LIBS) + hcls$(EXEEXT): $(hcls_OBJECTS) $(hcls_DEPENDENCIES) $(EXTRA_hcls_DEPENDENCIES) @rm -f hcls$(EXEEXT) $(AM_V_CCLD)$(hcls_LINK) $(hcls_OBJECTS) $(hcls_LDADD) $(LIBS) @@ -635,7 +672,8 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcl-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcls-main2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hclc-main-c.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcls-main-s.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-bigint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-comp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-debug.Plo@am__quote@ @@ -657,6 +695,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-tmr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-utf8.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-utl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclc_la-hcl-c.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcls_la-hcl-s.Plo@am__quote@ .c.o: @@ -830,6 +869,13 @@ libhcl_la-utl.lo: utl.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhcl_la-utl.lo `test -f 'utl.c' || echo '$(srcdir)/'`utl.c +libhclc_la-hcl-c.lo: hcl-c.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclc_la-hcl-c.lo -MD -MP -MF $(DEPDIR)/libhclc_la-hcl-c.Tpo -c -o libhclc_la-hcl-c.lo `test -f 'hcl-c.c' || echo '$(srcdir)/'`hcl-c.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclc_la-hcl-c.Tpo $(DEPDIR)/libhclc_la-hcl-c.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hcl-c.c' object='libhclc_la-hcl-c.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclc_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclc_la-hcl-c.lo `test -f 'hcl-c.c' || echo '$(srcdir)/'`hcl-c.c + libhcls_la-hcl-s.lo: hcl-s.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcls_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcls_la-hcl-s.lo -MD -MP -MF $(DEPDIR)/libhcls_la-hcl-s.Tpo -c -o libhcls_la-hcl-s.lo `test -f 'hcl-s.c' || echo '$(srcdir)/'`hcl-s.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcls_la-hcl-s.Tpo $(DEPDIR)/libhcls_la-hcl-s.Plo @@ -851,19 +897,33 @@ hcl-main.obj: main.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcl_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcl-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` -hcls-main2.o: main2.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcls-main2.o -MD -MP -MF $(DEPDIR)/hcls-main2.Tpo -c -o hcls-main2.o `test -f 'main2.c' || echo '$(srcdir)/'`main2.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcls-main2.Tpo $(DEPDIR)/hcls-main2.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main2.c' object='hcls-main2.o' libtool=no @AMDEPBACKSLASH@ +hclc-main-c.o: main-c.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclc-main-c.o -MD -MP -MF $(DEPDIR)/hclc-main-c.Tpo -c -o hclc-main-c.o `test -f 'main-c.c' || echo '$(srcdir)/'`main-c.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclc-main-c.Tpo $(DEPDIR)/hclc-main-c.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-c.c' object='hclc-main-c.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcls-main2.o `test -f 'main2.c' || echo '$(srcdir)/'`main2.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclc-main-c.o `test -f 'main-c.c' || echo '$(srcdir)/'`main-c.c -hcls-main2.obj: main2.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcls-main2.obj -MD -MP -MF $(DEPDIR)/hcls-main2.Tpo -c -o hcls-main2.obj `if test -f 'main2.c'; then $(CYGPATH_W) 'main2.c'; else $(CYGPATH_W) '$(srcdir)/main2.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcls-main2.Tpo $(DEPDIR)/hcls-main2.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main2.c' object='hcls-main2.obj' libtool=no @AMDEPBACKSLASH@ +hclc-main-c.obj: main-c.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hclc-main-c.obj -MD -MP -MF $(DEPDIR)/hclc-main-c.Tpo -c -o hclc-main-c.obj `if test -f 'main-c.c'; then $(CYGPATH_W) 'main-c.c'; else $(CYGPATH_W) '$(srcdir)/main-c.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hclc-main-c.Tpo $(DEPDIR)/hclc-main-c.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-c.c' object='hclc-main-c.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcls-main2.obj `if test -f 'main2.c'; then $(CYGPATH_W) 'main2.c'; else $(CYGPATH_W) '$(srcdir)/main2.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hclc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hclc-main-c.obj `if test -f 'main-c.c'; then $(CYGPATH_W) 'main-c.c'; else $(CYGPATH_W) '$(srcdir)/main-c.c'; fi` + +hcls-main-s.o: main-s.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcls-main-s.o -MD -MP -MF $(DEPDIR)/hcls-main-s.Tpo -c -o hcls-main-s.o `test -f 'main-s.c' || echo '$(srcdir)/'`main-s.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcls-main-s.Tpo $(DEPDIR)/hcls-main-s.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-s.c' object='hcls-main-s.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcls-main-s.o `test -f 'main-s.c' || echo '$(srcdir)/'`main-s.c + +hcls-main-s.obj: main-s.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hcls-main-s.obj -MD -MP -MF $(DEPDIR)/hcls-main-s.Tpo -c -o hcls-main-s.obj `if test -f 'main-s.c'; then $(CYGPATH_W) 'main-s.c'; else $(CYGPATH_W) '$(srcdir)/main-s.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hcls-main-s.Tpo $(DEPDIR)/hcls-main-s.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-s.c' object='hcls-main-s.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hcls_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hcls-main-s.obj `if test -f 'main-s.c'; then $(CYGPATH_W) 'main-s.c'; else $(CYGPATH_W) '$(srcdir)/main-s.c'; fi` mostlyclean-libtool: -rm -f *.lo diff --git a/lib/hcl-c.c b/lib/hcl-c.c index da18d27..efc683e 100644 --- a/lib/hcl-c.c +++ b/lib/hcl-c.c @@ -25,3 +25,206 @@ */ #include "hcl-c.h" +#include "hcl-prv.h" + + +struct hcl_client_proto_t +{ + hcl_client_t* client; + + struct + { + hcl_bch_t* ptr; + hcl_oow_t len; + hcl_oow_t capa; + } req; + + struct + { + hcl_ooch_t* ptr; + hcl_oow_t len; + hcl_oow_t capa; + } rep; +}; + +struct hcl_client_t +{ + hcl_mmgr_t* mmgr; + hcl_cmgr_t* cmgr; + /*hcl_t* dummy_hcl;*/ +}; + +/* ========================================================================= */ + + +static void proto_start_request (hcl_client_proto_t* proto) +{ + proto->req.len = 0; +} + + +static void proto_feed_request_data (hcl_client_proto_t* proto, xxxx); +{ +} + + +static int proto_end_request (hcl_client_proto_t* proto) +{ + if (proto->req.len <= 0) return -1; + + return 0; +} + + +static void proto_start_response (hcl_client_proto_t* proto) +{ +} + +static void proto_feed_reply_data (hcl_client_proto_t* proto, const hcl_bch_t* ptr, hcl_oow_t len) +{ + const hcl_bch_t* end = ptr + len; + while (ptr < end) + { + hcl_bch_t b = *ptr++; + + switch (b) + { + case '\0': + } + } +} + +/* ========================================================================= */ + +hcl_client_t* hcl_client_open (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_errnum_t* errnum) +{ + hcl_client_t* client; +#if 0 + hcl_t* hcl; + hcl_vmprim_t vmprim; + hcl_tmr_t* tmr; + dummy_hcl_xtn_t* xtn; + int pfd[2], fcv; + unsigned int trait; +#endif + + client = (hcl_client_t*)HCL_MMGR_ALLOC(mmgr, HCL_SIZEOF(*client) + xtnsize); + if (!client) + { + if (errnum) *errnum = HCL_ESYSMEM; + return HCL_NULL; + } + +#if 0 + HCL_MEMSET (&vmprim, 0, HCL_SIZEOF(vmprim)); + vmprim.log_write = log_write_for_dummy; + vmprim.syserrstrb = syserrstrb; + vmprim.dl_open = dl_open; + vmprim.dl_close = dl_close; + vmprim.dl_getsym = dl_getsym; + vmprim.vm_gettime = vm_gettime; + vmprim.vm_sleep = vm_sleep; + + hcl = hcl_open(mmgr, HCL_SIZEOF(*xtn), 2048, &vmprim, errnum); + if (!hcl) + { + HCL_MMGR_FREE (mmgr, client); + return HCL_NULL; + } + + tmr = hcl_tmr_open(hcl, 0, 1024); /* TOOD: make the timer's default size configurable */ + if (!tmr) + { + hcl_close (hcl); + HCL_MMGR_FREE (mmgr, client); + return HCL_NULL; + } + + if (pipe(pfd) <= -1) + { + hcl_tmr_close (tmr); + hcl_close (hcl); + HCL_MMGR_FREE (mmgr, client); + return HCL_NULL; + } + +#if defined(O_CLOEXEC) + fcv = fcntl(pfd[0], F_GETFD, 0); + if (fcv >= 0) fcntl(pfd[0], F_SETFD, fcv | O_CLOEXEC); + fcv = fcntl(pfd[1], F_GETFD, 0); + if (fcv >= 0) fcntl(pfd[1], F_SETFD, fcv | O_CLOEXEC); +#endif +#if defined(O_NONBLOCK) + fcv = fcntl(pfd[0], F_GETFL, 0); + if (fcv >= 0) fcntl(pfd[0], F_SETFL, fcv | O_NONBLOCK); + fcv = fcntl(pfd[1], F_GETFL, 0); + if (fcv >= 0) fcntl(pfd[1], F_SETFL, fcv | O_NONBLOCK); +#endif + + xtn = (dummy_hcl_xtn_t*)hcl_getxtn(hcl); + xtn->client = client; + + HCL_MEMSET (client, 0, HCL_SIZEOF(*client) + xtnsize); + client->mmgr = mmgr; + client->cmgr = hcl_get_utf8_cmgr(); + client->prim = *prim; + client->dummy_hcl = hcl; + client->tmr = tmr; + + client->cfg.logmask = ~0u; + client->cfg.worker_stack_size = 512000UL; + client->cfg.actor_heap_size = 512000UL; + + HCL_INITNTIME (&client->cfg.worker_idle_timeout, 0, 0); + HCL_INITNTIME (&client->cfg.actor_max_runtime, 0, 0); + + client->mux_pipe[0] = pfd[0]; + client->mux_pipe[1] = pfd[1]; + + client->wid_map.free_first = HCL_SERVER_WID_INVALID; + client->wid_map.free_last = HCL_SERVER_WID_INVALID; + + pthread_mutex_init (&client->worker_mutex, HCL_NULL); + pthread_mutex_init (&client->tmr_mutex, HCL_NULL); + pthread_mutex_init (&client->log_mutex, HCL_NULL); + + /* the dummy hcl is used for this client to perform primitive operations + * such as getting system time or logging. so the heap size doesn't + * need to be changed from the tiny value set above. */ + hcl_setoption (client->dummy_hcl, HCL_LOG_MASK, &client->cfg.logmask); + hcl_setcmgr (client->dummy_hcl, client->cmgr); + hcl_getoption (client->dummy_hcl, HCL_TRAIT, &trait); +#if defined(HCL_BUILD_DEBUG) + if (client->cfg.trait & HCL_SERVER_TRAIT_DEBUG_GC) trait |= HCL_DEBUG_GC; + if (client->cfg.trait & HCL_SERVER_TRAIT_DEBUG_BIGINT) trait |= HCL_DEBUG_BIGINT; +#endif + hcl_setoption (client->dummy_hcl, HCL_TRAIT, &trait); + + +#else + + HCL_MEMSET (client, 0, HCL_SIZEOF(*client) + xtnsize); + client->mmgr = mmgr; + client->cmgr = hcl_get_utf8_cmgr(); + +#endif + + return client; +} + +void hcl_client_close (hcl_client_t* client) +{ + HCL_MMGR_FREE (client->mmgr, client); +} + +int hcl_client_start (hcl_client_t* client, const hcl_bch_t* addrs) +{ + + /* connect */ + /* send request */ +} + + +int hcl_client_sendreq (hcl_client_t* client, const hcl_bch_t* addrs) +{ +} diff --git a/lib/hcl-c.h b/lib/hcl-c.h index 3a36683..5e94c1c 100644 --- a/lib/hcl-c.h +++ b/lib/hcl-c.h @@ -30,4 +30,27 @@ #include +typedef struct hcl_client_t hcl_client_t; + + +#if defined(__cplusplus) +extern "C" { +#endif + +HCL_EXPORT hcl_client_t* hcl_client_open ( + hcl_mmgr_t* mmgr, + hcl_oow_t xtnsize, + /*hcl_client_prim_t* prim,*/ + hcl_errnum_t* errnum +); + +HCL_EXPORT void hcl_client_close ( + hcl_client_t* client +); + + +#if defined(__cplusplus) +} +#endif + #endif diff --git a/lib/main2.c b/lib/main-s.c similarity index 100% rename from lib/main2.c rename to lib/main-s.c