diff --git a/bin/hclx.c b/bin/hclx.c index 6c11f69..2f1b01e 100644 --- a/bin/hclx.c +++ b/bin/hclx.c @@ -24,11 +24,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "hcl-x.h" -#include "hcl-json.h" -#include "hcl-opt.h" -#include "hcl-utl.h" -#include "hcl-xutl.h" +#include +#include +#include +#include #include #include diff --git a/lib/Makefile.am b/lib/Makefile.am index 14c9c47..96e800a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -56,7 +56,6 @@ pkginclude_HEADERS = \ hcl-rbt.h \ hcl-upac.h \ hcl-utl.h \ - hcl-sys.h \ hcl-xma.h pkglib_LTLIBRARIES = libhcl.la @@ -107,20 +106,20 @@ endif if ENABLE_HCLX pkglib_LTLIBRARIES += libhclx.la -pkginclude_HEADERS += hcl-x.h hcl-tmr.h hcl-xutl.h hcl-json.h +pkginclude_HEADERS += hcl-x.h hcl-tmr.h hcl-json.h libhclx_la_SOURCES = \ hcl-json.h \ - hcl-sys.h \ hcl-tmr.h \ hcl-x.h \ hcl-xtul.h \ json.c \ - sys.c \ tmr.c \ x-client.c \ x-proto.c \ x-server.c \ - xutl.c xutl-sa.h + x-sys.c \ + x-utl.c \ + x-utl-sa.h libhclx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD) libhclx_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) libhclx_la_LIBADD = libhcl.la $(LIBADD_LIB_COMMON) diff --git a/lib/Makefile.in b/lib/Makefile.in index c98cbb4..814ba85 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -97,7 +97,7 @@ host_triplet = @host@ @ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-str.la \ @ENABLE_STATIC_MODULE_TRUE@ ../mod/libhcl-sys.la @ENABLE_HCLX_TRUE@am__append_7 = libhclx.la -@ENABLE_HCLX_TRUE@am__append_8 = hcl-x.h hcl-tmr.h hcl-xutl.h hcl-json.h +@ENABLE_HCLX_TRUE@am__append_8 = hcl-x.h hcl-tmr.h hcl-json.h subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ @@ -170,13 +170,13 @@ libhcl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(libhcl_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_HCLX_TRUE@libhclx_la_DEPENDENCIES = libhcl.la \ @ENABLE_HCLX_TRUE@ $(am__DEPENDENCIES_5) -am__libhclx_la_SOURCES_DIST = hcl-json.h hcl-sys.h hcl-tmr.h hcl-x.h \ - hcl-xtul.h json.c sys.c tmr.c x-client.c x-proto.c x-server.c \ - xutl.c xutl-sa.h +am__libhclx_la_SOURCES_DIST = hcl-json.h hcl-tmr.h hcl-x.h hcl-xtul.h \ + json.c tmr.c x-client.c x-proto.c x-server.c x-sys.c x-utl.c \ + x-utl-sa.h @ENABLE_HCLX_TRUE@am_libhclx_la_OBJECTS = libhclx_la-json.lo \ -@ENABLE_HCLX_TRUE@ libhclx_la-sys.lo libhclx_la-tmr.lo \ -@ENABLE_HCLX_TRUE@ libhclx_la-x-client.lo libhclx_la-x-proto.lo \ -@ENABLE_HCLX_TRUE@ libhclx_la-x-server.lo libhclx_la-xutl.lo +@ENABLE_HCLX_TRUE@ libhclx_la-tmr.lo libhclx_la-x-client.lo \ +@ENABLE_HCLX_TRUE@ libhclx_la-x-proto.lo libhclx_la-x-server.lo \ +@ENABLE_HCLX_TRUE@ libhclx_la-x-sys.lo libhclx_la-x-utl.lo libhclx_la_OBJECTS = $(am_libhclx_la_OBJECTS) libhclx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -212,11 +212,12 @@ am__depfiles_remade = ./$(DEPDIR)/libhcl_la-bigint.Plo \ ./$(DEPDIR)/libhcl_la-utf16.Plo ./$(DEPDIR)/libhcl_la-utf8.Plo \ ./$(DEPDIR)/libhcl_la-utl.Plo ./$(DEPDIR)/libhcl_la-xchg.Plo \ ./$(DEPDIR)/libhcl_la-xma.Plo ./$(DEPDIR)/libhclx_la-json.Plo \ - ./$(DEPDIR)/libhclx_la-sys.Plo ./$(DEPDIR)/libhclx_la-tmr.Plo \ + ./$(DEPDIR)/libhclx_la-tmr.Plo \ ./$(DEPDIR)/libhclx_la-x-client.Plo \ ./$(DEPDIR)/libhclx_la-x-proto.Plo \ ./$(DEPDIR)/libhclx_la-x-server.Plo \ - ./$(DEPDIR)/libhclx_la-xutl.Plo + ./$(DEPDIR)/libhclx_la-x-sys.Plo \ + ./$(DEPDIR)/libhclx_la-x-utl.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -244,8 +245,8 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__pkginclude_HEADERS_DIST = hcl.h hcl-chr.h hcl-cmn.h hcl-fmt.h \ - hcl-opt.h hcl-pac1.h hcl-rbt.h hcl-upac.h hcl-utl.h hcl-sys.h \ - hcl-xma.h hcl-x.h hcl-tmr.h hcl-xutl.h hcl-json.h + hcl-opt.h hcl-pac1.h hcl-rbt.h hcl-upac.h hcl-utl.h hcl-xma.h \ + hcl-x.h hcl-tmr.h hcl-json.h HEADERS = $(pkginclude_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ hcl-cfg.h.in @@ -435,7 +436,7 @@ LIBADD_LIB_COMMON = $(LIBM) $(am__append_1) $(am__append_2) \ @WIN32_TRUE@ -DHCL_DEFAULT_PFMODPOSTFIX=\"-1.dll\" \ @WIN32_TRUE@ $(am__append_4) $(am__append_5) pkginclude_HEADERS = hcl.h hcl-chr.h hcl-cmn.h hcl-fmt.h hcl-opt.h \ - hcl-pac1.h hcl-rbt.h hcl-upac.h hcl-utl.h hcl-sys.h hcl-xma.h \ + hcl-pac1.h hcl-rbt.h hcl-upac.h hcl-utl.h hcl-xma.h \ $(am__append_8) pkglib_LTLIBRARIES = libhcl.la $(am__append_7) libhcl_la_SOURCES = \ @@ -478,17 +479,17 @@ libhcl_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) libhcl_la_LIBADD = $(LIBADD_LIB_COMMON) $(am__append_6) @ENABLE_HCLX_TRUE@libhclx_la_SOURCES = \ @ENABLE_HCLX_TRUE@ hcl-json.h \ -@ENABLE_HCLX_TRUE@ hcl-sys.h \ @ENABLE_HCLX_TRUE@ hcl-tmr.h \ @ENABLE_HCLX_TRUE@ hcl-x.h \ @ENABLE_HCLX_TRUE@ hcl-xtul.h \ @ENABLE_HCLX_TRUE@ json.c \ -@ENABLE_HCLX_TRUE@ sys.c \ @ENABLE_HCLX_TRUE@ tmr.c \ @ENABLE_HCLX_TRUE@ x-client.c \ @ENABLE_HCLX_TRUE@ x-proto.c \ @ENABLE_HCLX_TRUE@ x-server.c \ -@ENABLE_HCLX_TRUE@ xutl.c xutl-sa.h +@ENABLE_HCLX_TRUE@ x-sys.c \ +@ENABLE_HCLX_TRUE@ x-utl.c \ +@ENABLE_HCLX_TRUE@ x-utl-sa.h @ENABLE_HCLX_TRUE@libhclx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) $(CPPFLAGS_PFMOD) @ENABLE_HCLX_TRUE@libhclx_la_LDFLAGS = $(LDFLAGS_LIB_COMMON) @@ -619,12 +620,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-xchg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-xma.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-json.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-sys.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-tmr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-x-client.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-x-proto.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-x-server.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-xutl.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-x-sys.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhclx_la-x-utl.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @@ -859,13 +860,6 @@ libhclx_la-json.lo: json.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) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-json.lo `test -f 'json.c' || echo '$(srcdir)/'`json.c -libhclx_la-sys.lo: sys.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-sys.lo -MD -MP -MF $(DEPDIR)/libhclx_la-sys.Tpo -c -o libhclx_la-sys.lo `test -f 'sys.c' || echo '$(srcdir)/'`sys.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclx_la-sys.Tpo $(DEPDIR)/libhclx_la-sys.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sys.c' object='libhclx_la-sys.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) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-sys.lo `test -f 'sys.c' || echo '$(srcdir)/'`sys.c - libhclx_la-tmr.lo: tmr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-tmr.lo -MD -MP -MF $(DEPDIR)/libhclx_la-tmr.Tpo -c -o libhclx_la-tmr.lo `test -f 'tmr.c' || echo '$(srcdir)/'`tmr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclx_la-tmr.Tpo $(DEPDIR)/libhclx_la-tmr.Plo @@ -894,12 +888,19 @@ libhclx_la-x-server.lo: x-server.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) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-x-server.lo `test -f 'x-server.c' || echo '$(srcdir)/'`x-server.c -libhclx_la-xutl.lo: xutl.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-xutl.lo -MD -MP -MF $(DEPDIR)/libhclx_la-xutl.Tpo -c -o libhclx_la-xutl.lo `test -f 'xutl.c' || echo '$(srcdir)/'`xutl.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclx_la-xutl.Tpo $(DEPDIR)/libhclx_la-xutl.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xutl.c' object='libhclx_la-xutl.lo' libtool=yes @AMDEPBACKSLASH@ +libhclx_la-x-sys.lo: x-sys.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-x-sys.lo -MD -MP -MF $(DEPDIR)/libhclx_la-x-sys.Tpo -c -o libhclx_la-x-sys.lo `test -f 'x-sys.c' || echo '$(srcdir)/'`x-sys.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclx_la-x-sys.Tpo $(DEPDIR)/libhclx_la-x-sys.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='x-sys.c' object='libhclx_la-x-sys.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) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-xutl.lo `test -f 'xutl.c' || echo '$(srcdir)/'`xutl.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-x-sys.lo `test -f 'x-sys.c' || echo '$(srcdir)/'`x-sys.c + +libhclx_la-x-utl.lo: x-utl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhclx_la-x-utl.lo -MD -MP -MF $(DEPDIR)/libhclx_la-x-utl.Tpo -c -o libhclx_la-x-utl.lo `test -f 'x-utl.c' || echo '$(srcdir)/'`x-utl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhclx_la-x-utl.Tpo $(DEPDIR)/libhclx_la-x-utl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='x-utl.c' object='libhclx_la-x-utl.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) $(libhclx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhclx_la-x-utl.lo `test -f 'x-utl.c' || echo '$(srcdir)/'`x-utl.c mostlyclean-libtool: -rm -f *.lo @@ -1084,12 +1085,12 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libhcl_la-xchg.Plo -rm -f ./$(DEPDIR)/libhcl_la-xma.Plo -rm -f ./$(DEPDIR)/libhclx_la-json.Plo - -rm -f ./$(DEPDIR)/libhclx_la-sys.Plo -rm -f ./$(DEPDIR)/libhclx_la-tmr.Plo -rm -f ./$(DEPDIR)/libhclx_la-x-client.Plo -rm -f ./$(DEPDIR)/libhclx_la-x-proto.Plo -rm -f ./$(DEPDIR)/libhclx_la-x-server.Plo - -rm -f ./$(DEPDIR)/libhclx_la-xutl.Plo + -rm -f ./$(DEPDIR)/libhclx_la-x-sys.Plo + -rm -f ./$(DEPDIR)/libhclx_la-x-utl.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags @@ -1165,12 +1166,12 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libhcl_la-xchg.Plo -rm -f ./$(DEPDIR)/libhcl_la-xma.Plo -rm -f ./$(DEPDIR)/libhclx_la-json.Plo - -rm -f ./$(DEPDIR)/libhclx_la-sys.Plo -rm -f ./$(DEPDIR)/libhclx_la-tmr.Plo -rm -f ./$(DEPDIR)/libhclx_la-x-client.Plo -rm -f ./$(DEPDIR)/libhclx_la-x-proto.Plo -rm -f ./$(DEPDIR)/libhclx_la-x-server.Plo - -rm -f ./$(DEPDIR)/libhclx_la-xutl.Plo + -rm -f ./$(DEPDIR)/libhclx_la-x-sys.Plo + -rm -f ./$(DEPDIR)/libhclx_la-x-utl.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/lib/hcl-sys.h b/lib/hcl-sys.h deleted file mode 100644 index b3d0d21..0000000 --- a/lib/hcl-sys.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _HCL_SYS_T_ -#define _HCL_SYS_T_ - -#include - -/* forward declaration to skip including just for struct iovec */ -typedef struct iovec hcl_iovec_t; - -#if defined(__cplusplus) -extern "C" { -#endif - -HCL_EXPORT int hcl_sys_send_iov ( - int sck, - hcl_iovec_t* iov, /* note this is not read-only and can change */ - int count -); - -HCL_EXPORT int hcl_sys_open_pipes ( - int pfd[2], - int nonblock -); - -HCL_EXPORT void hcl_sys_close_pipes ( - int pfd[2] -); - -HCL_EXPORT int hcl_sys_set_nonblock ( - int fd, - int v -); - -HCL_EXPORT int hcl_sys_set_cloexec ( - int fd, - int v -); - -HCL_EXPORT int hcl_sys_is_errno_wb ( - int no -); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/lib/hcl-x.h b/lib/hcl-x.h index 662429a..0f4b4a5 100644 --- a/lib/hcl-x.h +++ b/lib/hcl-x.h @@ -177,6 +177,68 @@ struct hcl_client_prim_t typedef struct hcl_client_prim_t hcl_client_prim_t; +/* ---------------------------------------------------------------------- */ + +#if (HCL_SIZEOF_SOCKLEN_T == 1) + #if defined(HCL_SOCKLEN_T_IS_SIGNED) + typedef hcl_int8_t hcl_scklen_t; + #else + typedef hcl_uint8_t hcl_scklen_t; + #endif +#elif (HCL_SIZEOF_SOCKLEN_T == 2) + #if defined(HCL_SOCKLEN_T_IS_SIGNED) + typedef hcl_int16_t hcl_scklen_t; + #else + typedef hcl_uint16_t hcl_scklen_t; + #endif +#elif (HCL_SIZEOF_SOCKLEN_T == 4) + #if defined(HCL_SOCKLEN_T_IS_SIGNED) + typedef hcl_int32_t hcl_scklen_t; + #else + typedef hcl_uint32_t hcl_scklen_t; + #endif +#elif (HCL_SIZEOF_SOCKLEN_T == 8) + #if defined(HCL_SOCKLEN_T_IS_SIGNED) + typedef hcl_int64_t hcl_scklen_t; + #else + typedef hcl_uint64_t hcl_scklen_t; + #endif +#else + #undef HCL_SIZEOF_SOCKLEN_T + #define HCL_SIZEOF_SOCKLEN_T HCL_SIZEOF_INT + #define HCL_SOCKLEN_T_IS_SIGNED + typedef int hcl_scklen_t; +#endif + +struct hcl_sckaddr_t +{ +#define HCL_SCKADDR_DATA_SIZE 0 + +#if (HCL_SIZEOF_STRUCT_SOCKADDR_IN > HCL_SCKADDR_DATA_SIZE) + #undef HCL_SCKADDR_DATA_SIZE + #define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_IN +#endif +#if (HCL_SIZEOF_STRUCT_SOCKADDR_IN6 > HCL_SCKADDR_DATA_SIZE) + #undef HCL_SCKADDR_DATA_SIZE + #define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_IN6 +#endif +#if (HCL_SIZEOF_STRUCT_SOCKADDR_UN > HCL_SCKADDR_DATA_SIZE) + #undef HCL_SCKADDR_DATA_SIZE + #define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_UN +#endif +#if (HCL_SIZEOF_STRUCT_SOCKADDR_LL > HCL_SCKADDR_DATA_SIZE) + #undef HCL_SCKADDR_DATA_SIZE + #define HCL_SCKADDR_DATA_SIZE HCL_SIZEOF_STRUCT_SOCKADDR_LL +#endif + +#if (HCL_SCKADDR_DATA_SIZE == 0) + #undef HCL_SCKADDR_DATA_SIZE + #define HCL_SCKADDR_DATA_SIZE 64 +#endif + hcl_uint8_t storage[HCL_SCKADDR_DATA_SIZE]; +}; +typedef struct hcl_sckaddr_t hcl_sckaddr_t; + /* ---------------------------------------------------------------------- */ #if defined(__cplusplus) @@ -479,9 +541,9 @@ HCL_EXPORT int hcl_xproto_process ( /* ---------------------------------------------------------------------- */ HCL_EXPORT int hcl_sys_send ( - int sck, - const void* data, - hcl_oow_t* size /* [IN] number of bytes to write, [OUT] number of bytes written */ + int sck, + const void* data, + hcl_oow_t* size ); HCL_EXPORT int hcl_sys_send_iov ( @@ -513,6 +575,56 @@ HCL_EXPORT int hcl_sys_is_errno_wb ( int no ); +/* ---------------------------------------------------------------------- */ + +HCL_EXPORT int hcl_ucharstosckaddr ( + hcl_t* hcl, + const hcl_uch_t* str, + hcl_oow_t len, + hcl_sckaddr_t* sckaddr, + hcl_scklen_t* scklen +); + +HCL_EXPORT int hcl_bcharstosckaddr ( + hcl_t* hcl, + const hcl_bch_t* str, + hcl_oow_t len, + hcl_sckaddr_t* sckaddr, + hcl_scklen_t* scklen +); + +#if defined(HCL_HAVE_INLINE) +static HCL_INLINE int hcl_uchars_to_sckaddr (const hcl_uch_t* str, hcl_oow_t len, hcl_sckaddr_t* sckaddr, hcl_scklen_t* scklen) +{ + return hcl_ucharstosckaddr(HCL_NULL, str, len, sckaddr, scklen); +} +static HCL_INLINE int hcl_bchars_to_sckaddr (const hcl_bch_t* str, hcl_oow_t len, hcl_sckaddr_t* sckaddr, hcl_scklen_t* scklen) +{ + return hcl_bcharstosckaddr(HCL_NULL, str, len, sckaddr, scklen); +} +#else +#define hcl_uchars_to_sckaddr(str,len,sckaddr,scklen) hcl_ucharstosckaddr(HCL_NULL,str,len,sckaddr,scklen) +#define hcl_bchars_to_sckaddr(str,len,sckaddr,scklen) hcl_bcharstosckaddr(HCL_NULL,str,len,sckaddr,scklen) +#endif + +#if defined(HCL_OOCH_IS_UCH) +# define hcl_oocharstosckaddr hcl_ucharstosckaddr +# define hcl_oochars_to_sckaddr hcl_uchars_to_sckaddr +#else +# define hcl_oocharstosckaddr hcl_bcharstosckaddr +# define hcl_oochars_to_sckaddr hcl_bchars_to_sckaddr +#endif + +/** + * The hcl_get_sckaddr_info() function returns the socket family. + * if \a scklen is not #HCL_NULL, it also sets the actual address length + * in the memory pointed to by it. + */ +HCL_EXPORT int hcl_get_sckaddr_info ( + const hcl_sckaddr_t* sckaddr, + hcl_scklen_t* scklen +); + #if defined(__cplusplus) } #endif diff --git a/lib/x-client.c b/lib/x-client.c index 17a45d6..f4f2951 100644 --- a/lib/x-client.c +++ b/lib/x-client.c @@ -24,10 +24,8 @@ */ #include -#include "hcl-prv.h" #include -#include -#include +#include "hcl-prv.h" #include #include diff --git a/lib/x-server.c b/lib/x-server.c index 5ef49d7..2ce6cd8 100644 --- a/lib/x-server.c +++ b/lib/x-server.c @@ -23,10 +23,8 @@ */ #include -#include "hcl-prv.h" #include -#include -#include +#include "hcl-prv.h" #include #include diff --git a/lib/sys.c b/lib/x-sys.c similarity index 99% rename from lib/sys.c rename to lib/x-sys.c index d8378b0..3f9b0d6 100644 --- a/lib/sys.c +++ b/lib/x-sys.c @@ -23,7 +23,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include "hcl-prv.h" #include diff --git a/lib/xutl-sa.h b/lib/x-utl-sa.h similarity index 100% rename from lib/xutl-sa.h rename to lib/x-utl-sa.h diff --git a/lib/xutl.c b/lib/x-utl.c similarity index 98% rename from lib/xutl.c rename to lib/x-utl.c index f79723d..826492a 100644 --- a/lib/xutl.c +++ b/lib/x-utl.c @@ -22,7 +22,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include "hcl-prv.h" #if defined(_WIN32) @@ -75,7 +75,7 @@ typedef union sockaddr_t sockaddr_t; #define str_to_ipv6 bchars_to_ipv6 #define str_to_ifindex bchars_to_ifindex #define str_to_sockaddr hcl_bcharstosckaddr -#include "xutl-sa.h" +#include "x-utl-sa.h" #undef ooch_mode #undef ooch_t @@ -92,7 +92,7 @@ typedef union sockaddr_t sockaddr_t; #define str_to_ipv6 uchars_to_ipv6 #define str_to_ifindex uchars_to_ifindex #define str_to_sockaddr hcl_ucharstosckaddr -#include "xutl-sa.h" +#include "x-utl-sa.h" int hcl_get_sckaddr_info (const hcl_sckaddr_t* sckaddr, hcl_scklen_t* scklen) {