added many charcter handling code
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
hyung-hwan 2023-11-22 00:24:57 +09:00
parent 6a861d2db5
commit 3d47a99cd2
57 changed files with 24011 additions and 138 deletions

View File

@ -48,6 +48,7 @@ pkglibdir = $(libdir)
pkginclude_HEADERS = \
hcl.h \
hcl-chr.h \
hcl-cmn.h \
hcl-fmt.h \
hcl-opt.h \
@ -64,6 +65,7 @@ libhcl_la_SOURCES = \
hcl-utl.h \
hcl-prv.h \
bigint.c \
chr.c \
cnode.c \
comp.c \
debug.c \
@ -76,6 +78,7 @@ libhcl_la_SOURCES = \
gc.c \
hcl.c \
heap.c \
mb8.c \
number.c \
obj.c \
opt-impl.h \
@ -86,6 +89,9 @@ libhcl_la_SOURCES = \
read.c \
std.c \
sym.c \
uch-case.h \
uch-prop.h \
utf16.c \
utf8.c \
utl.c \
xma.c

View File

@ -150,14 +150,15 @@ am__DEPENDENCIES_1 =
am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4)
libhcl_la_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__append_6)
am_libhcl_la_OBJECTS = libhcl_la-bigint.lo libhcl_la-cnode.lo \
libhcl_la-comp.lo libhcl_la-debug.lo libhcl_la-decode.lo \
libhcl_la-dic.lo libhcl_la-err.lo libhcl_la-exec.lo \
libhcl_la-fmt.lo libhcl_la-gc.lo libhcl_la-hcl.lo \
libhcl_la-heap.lo libhcl_la-number.lo libhcl_la-obj.lo \
libhcl_la-opt.lo libhcl_la-prim.lo libhcl_la-print.lo \
libhcl_la-rbt.lo libhcl_la-read.lo libhcl_la-std.lo \
libhcl_la-sym.lo libhcl_la-utf8.lo libhcl_la-utl.lo \
am_libhcl_la_OBJECTS = libhcl_la-bigint.lo libhcl_la-chr.lo \
libhcl_la-cnode.lo libhcl_la-comp.lo libhcl_la-debug.lo \
libhcl_la-decode.lo libhcl_la-dic.lo libhcl_la-err.lo \
libhcl_la-exec.lo libhcl_la-fmt.lo libhcl_la-gc.lo \
libhcl_la-hcl.lo libhcl_la-heap.lo libhcl_la-mb8.lo \
libhcl_la-number.lo libhcl_la-obj.lo libhcl_la-opt.lo \
libhcl_la-prim.lo libhcl_la-print.lo libhcl_la-rbt.lo \
libhcl_la-read.lo libhcl_la-std.lo libhcl_la-sym.lo \
libhcl_la-utf16.lo libhcl_la-utf8.lo libhcl_la-utl.lo \
libhcl_la-xma.lo
libhcl_la_OBJECTS = $(am_libhcl_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@ -197,17 +198,18 @@ DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/libhcl_la-bigint.Plo \
./$(DEPDIR)/libhcl_la-cnode.Plo ./$(DEPDIR)/libhcl_la-comp.Plo \
./$(DEPDIR)/libhcl_la-debug.Plo \
./$(DEPDIR)/libhcl_la-chr.Plo ./$(DEPDIR)/libhcl_la-cnode.Plo \
./$(DEPDIR)/libhcl_la-comp.Plo ./$(DEPDIR)/libhcl_la-debug.Plo \
./$(DEPDIR)/libhcl_la-decode.Plo ./$(DEPDIR)/libhcl_la-dic.Plo \
./$(DEPDIR)/libhcl_la-err.Plo ./$(DEPDIR)/libhcl_la-exec.Plo \
./$(DEPDIR)/libhcl_la-fmt.Plo ./$(DEPDIR)/libhcl_la-gc.Plo \
./$(DEPDIR)/libhcl_la-hcl.Plo ./$(DEPDIR)/libhcl_la-heap.Plo \
./$(DEPDIR)/libhcl_la-number.Plo ./$(DEPDIR)/libhcl_la-obj.Plo \
./$(DEPDIR)/libhcl_la-opt.Plo ./$(DEPDIR)/libhcl_la-prim.Plo \
./$(DEPDIR)/libhcl_la-print.Plo ./$(DEPDIR)/libhcl_la-rbt.Plo \
./$(DEPDIR)/libhcl_la-read.Plo ./$(DEPDIR)/libhcl_la-std.Plo \
./$(DEPDIR)/libhcl_la-sym.Plo ./$(DEPDIR)/libhcl_la-utf8.Plo \
./$(DEPDIR)/libhcl_la-mb8.Plo ./$(DEPDIR)/libhcl_la-number.Plo \
./$(DEPDIR)/libhcl_la-obj.Plo ./$(DEPDIR)/libhcl_la-opt.Plo \
./$(DEPDIR)/libhcl_la-prim.Plo ./$(DEPDIR)/libhcl_la-print.Plo \
./$(DEPDIR)/libhcl_la-rbt.Plo ./$(DEPDIR)/libhcl_la-read.Plo \
./$(DEPDIR)/libhcl_la-std.Plo ./$(DEPDIR)/libhcl_la-sym.Plo \
./$(DEPDIR)/libhcl_la-utf16.Plo ./$(DEPDIR)/libhcl_la-utf8.Plo \
./$(DEPDIR)/libhcl_la-utl.Plo ./$(DEPDIR)/libhcl_la-xma.Plo \
./$(DEPDIR)/libhclx_la-hcl-c.Plo \
./$(DEPDIR)/libhclx_la-hcl-s.Plo \
@ -240,9 +242,9 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__pkginclude_HEADERS_DIST = hcl.h hcl-cmn.h hcl-fmt.h hcl-opt.h \
hcl-rbt.h hcl-utl.h hcl-xma.h hcl-c.h hcl-s.h hcl-tmr.h \
hcl-xutl.h hcl-json.h
am__pkginclude_HEADERS_DIST = hcl.h hcl-chr.h hcl-cmn.h hcl-fmt.h \
hcl-opt.h hcl-rbt.h hcl-utl.h hcl-xma.h hcl-c.h hcl-s.h \
hcl-tmr.h hcl-xutl.h hcl-json.h
HEADERS = $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
hcl-cfg.h.in
@ -430,8 +432,8 @@ LIBADD_LIB_COMMON = $(LIBM) $(am__append_1) $(am__append_2) \
@WIN32_TRUE@CPPFLAGS_PFMOD = -DHCL_DEFAULT_PFMODPREFIX=\"libhcl-\" \
@WIN32_TRUE@ -DHCL_DEFAULT_PFMODPOSTFIX=\"-1.dll\" \
@WIN32_TRUE@ $(am__append_4) $(am__append_5)
pkginclude_HEADERS = hcl.h hcl-cmn.h hcl-fmt.h hcl-opt.h hcl-rbt.h \
hcl-utl.h hcl-xma.h $(am__append_8)
pkginclude_HEADERS = hcl.h hcl-chr.h hcl-cmn.h hcl-fmt.h hcl-opt.h \
hcl-rbt.h hcl-utl.h hcl-xma.h $(am__append_8)
pkglib_LTLIBRARIES = libhcl.la $(am__append_7)
libhcl_la_SOURCES = \
hcl.h \
@ -441,6 +443,7 @@ libhcl_la_SOURCES = \
hcl-utl.h \
hcl-prv.h \
bigint.c \
chr.c \
cnode.c \
comp.c \
debug.c \
@ -453,6 +456,7 @@ libhcl_la_SOURCES = \
gc.c \
hcl.c \
heap.c \
mb8.c \
number.c \
obj.c \
opt-impl.h \
@ -463,6 +467,9 @@ libhcl_la_SOURCES = \
read.c \
std.c \
sym.c \
uch-case.h \
uch-prop.h \
utf16.c \
utf8.c \
utl.c \
xma.c
@ -578,6 +585,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-bigint.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-chr.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-cnode.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-comp.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-debug.Plo@am__quote@ # am--include-marker
@ -589,6 +597,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-gc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-hcl.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-heap.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-mb8.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-number.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-obj.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-opt.Plo@am__quote@ # am--include-marker
@ -598,6 +607,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-read.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-std.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-sym.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-utf16.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-utf8.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-utl.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhcl_la-xma.Plo@am__quote@ # am--include-marker
@ -645,6 +655,13 @@ libhcl_la-bigint.lo: bigint.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-bigint.lo `test -f 'bigint.c' || echo '$(srcdir)/'`bigint.c
libhcl_la-chr.lo: chr.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-chr.lo -MD -MP -MF $(DEPDIR)/libhcl_la-chr.Tpo -c -o libhcl_la-chr.lo `test -f 'chr.c' || echo '$(srcdir)/'`chr.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-chr.Tpo $(DEPDIR)/libhcl_la-chr.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='chr.c' object='libhcl_la-chr.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) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhcl_la-chr.lo `test -f 'chr.c' || echo '$(srcdir)/'`chr.c
libhcl_la-cnode.lo: cnode.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-cnode.lo -MD -MP -MF $(DEPDIR)/libhcl_la-cnode.Tpo -c -o libhcl_la-cnode.lo `test -f 'cnode.c' || echo '$(srcdir)/'`cnode.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-cnode.Tpo $(DEPDIR)/libhcl_la-cnode.Plo
@ -722,6 +739,13 @@ libhcl_la-heap.lo: heap.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-heap.lo `test -f 'heap.c' || echo '$(srcdir)/'`heap.c
libhcl_la-mb8.lo: mb8.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-mb8.lo -MD -MP -MF $(DEPDIR)/libhcl_la-mb8.Tpo -c -o libhcl_la-mb8.lo `test -f 'mb8.c' || echo '$(srcdir)/'`mb8.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-mb8.Tpo $(DEPDIR)/libhcl_la-mb8.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mb8.c' object='libhcl_la-mb8.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) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhcl_la-mb8.lo `test -f 'mb8.c' || echo '$(srcdir)/'`mb8.c
libhcl_la-number.lo: number.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-number.lo -MD -MP -MF $(DEPDIR)/libhcl_la-number.Tpo -c -o libhcl_la-number.lo `test -f 'number.c' || echo '$(srcdir)/'`number.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-number.Tpo $(DEPDIR)/libhcl_la-number.Plo
@ -785,6 +809,13 @@ libhcl_la-sym.lo: sym.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-sym.lo `test -f 'sym.c' || echo '$(srcdir)/'`sym.c
libhcl_la-utf16.lo: utf16.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-utf16.lo -MD -MP -MF $(DEPDIR)/libhcl_la-utf16.Tpo -c -o libhcl_la-utf16.lo `test -f 'utf16.c' || echo '$(srcdir)/'`utf16.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-utf16.Tpo $(DEPDIR)/libhcl_la-utf16.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utf16.c' object='libhcl_la-utf16.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) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhcl_la-utf16.lo `test -f 'utf16.c' || echo '$(srcdir)/'`utf16.c
libhcl_la-utf8.lo: utf8.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhcl_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libhcl_la-utf8.lo -MD -MP -MF $(DEPDIR)/libhcl_la-utf8.Tpo -c -o libhcl_la-utf8.lo `test -f 'utf8.c' || echo '$(srcdir)/'`utf8.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhcl_la-utf8.Tpo $(DEPDIR)/libhcl_la-utf8.Plo
@ -1003,6 +1034,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
distclean: distclean-am
-rm -f ./$(DEPDIR)/libhcl_la-bigint.Plo
-rm -f ./$(DEPDIR)/libhcl_la-chr.Plo
-rm -f ./$(DEPDIR)/libhcl_la-cnode.Plo
-rm -f ./$(DEPDIR)/libhcl_la-comp.Plo
-rm -f ./$(DEPDIR)/libhcl_la-debug.Plo
@ -1014,6 +1046,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/libhcl_la-gc.Plo
-rm -f ./$(DEPDIR)/libhcl_la-hcl.Plo
-rm -f ./$(DEPDIR)/libhcl_la-heap.Plo
-rm -f ./$(DEPDIR)/libhcl_la-mb8.Plo
-rm -f ./$(DEPDIR)/libhcl_la-number.Plo
-rm -f ./$(DEPDIR)/libhcl_la-obj.Plo
-rm -f ./$(DEPDIR)/libhcl_la-opt.Plo
@ -1023,6 +1056,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/libhcl_la-read.Plo
-rm -f ./$(DEPDIR)/libhcl_la-std.Plo
-rm -f ./$(DEPDIR)/libhcl_la-sym.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utf16.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utl.Plo
-rm -f ./$(DEPDIR)/libhcl_la-xma.Plo
@ -1079,6 +1113,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhcl_la-bigint.Plo
-rm -f ./$(DEPDIR)/libhcl_la-chr.Plo
-rm -f ./$(DEPDIR)/libhcl_la-cnode.Plo
-rm -f ./$(DEPDIR)/libhcl_la-comp.Plo
-rm -f ./$(DEPDIR)/libhcl_la-debug.Plo
@ -1090,6 +1125,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhcl_la-gc.Plo
-rm -f ./$(DEPDIR)/libhcl_la-hcl.Plo
-rm -f ./$(DEPDIR)/libhcl_la-heap.Plo
-rm -f ./$(DEPDIR)/libhcl_la-mb8.Plo
-rm -f ./$(DEPDIR)/libhcl_la-number.Plo
-rm -f ./$(DEPDIR)/libhcl_la-obj.Plo
-rm -f ./$(DEPDIR)/libhcl_la-opt.Plo
@ -1099,6 +1135,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhcl_la-read.Plo
-rm -f ./$(DEPDIR)/libhcl_la-std.Plo
-rm -f ./$(DEPDIR)/libhcl_la-sym.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utf16.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utf8.Plo
-rm -f ./$(DEPDIR)/libhcl_la-utl.Plo
-rm -f ./$(DEPDIR)/libhcl_la-xma.Plo

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -13,7 +11,7 @@
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 WAfRRANTIES
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

332
lib/chr.c Normal file
View File

@ -0,0 +1,332 @@
/*
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.
*/
#include <hcl-chr.h>
/* ---------------------------------------------------------- */
#include "uch-prop.h"
#include "uch-case.h"
/* ---------------------------------------------------------- */
#define UCH_PROP_MAP_INDEX(c) ((c) / HCL_COUNTOF(uch_prop_page_0000))
#define UCH_PROP_PAGE_INDEX(c) ((c) % HCL_COUNTOF(uch_prop_page_0000))
#define UCH_CASE_MAP_INDEX(c) ((c) / HCL_COUNTOF(uch_case_page_0000))
#define UCH_CASE_PAGE_INDEX(c) ((c) % HCL_COUNTOF(uch_case_page_0000))
#define UCH_IS_TYPE(c,type) \
((c) >= 0 && (c) <= UCH_PROP_MAX && \
(uch_prop_map[UCH_PROP_MAP_INDEX(c)][UCH_PROP_PAGE_INDEX(c)] & (type)) != 0)
int hcl_is_uch_type (hcl_uch_t c, hcl_uch_prop_t type)
{
return UCH_IS_TYPE((hcl_uchu_t)c, type);
}
int hcl_is_uch_upper (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_UPPER);
}
int hcl_is_uch_lower (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_LOWER);
}
int hcl_is_uch_alpha (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_ALPHA);
}
int hcl_is_uch_digit (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_DIGIT);
}
int hcl_is_uch_xdigit (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_XDIGIT);
}
int hcl_is_uch_alnum (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_ALNUM);
}
int hcl_is_uch_space (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_SPACE);
}
int hcl_is_uch_print (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_PRINT);
}
int hcl_is_uch_graph (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_GRAPH);
}
int hcl_is_uch_cntrl (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_CNTRL);
}
int hcl_is_uch_punct (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_PUNCT);
}
int hcl_is_uch_blank (hcl_uch_t c)
{
return UCH_IS_TYPE((hcl_uchu_t)c, HCL_UCH_PROP_BLANK);
}
hcl_uch_t hcl_to_uch_upper (hcl_uch_t c)
{
hcl_uchu_t uc = (hcl_uchu_t)c;
if (uc >= 0 && uc <= UCH_CASE_MAX)
{
uch_case_page_t* page;
page = uch_case_map[UCH_CASE_MAP_INDEX(uc)];
return uc - page[UCH_CASE_PAGE_INDEX(uc)].upper;
}
return c;
}
hcl_uch_t hcl_to_uch_lower (hcl_uch_t c)
{
hcl_uchu_t uc = (hcl_uchu_t)c;
if (uc >= 0 && uc <= UCH_CASE_MAX)
{
uch_case_page_t* page;
page = uch_case_map[UCH_CASE_MAP_INDEX(uc)];
return uc + page[UCH_CASE_PAGE_INDEX(uc)].lower;
}
return c;
}
/* ---------------------------------------------------------- */
int hcl_is_bch_type (hcl_bch_t c, hcl_bch_prop_t type)
{
switch (type)
{
case HCL_OOCH_PROP_UPPER:
return hcl_is_bch_upper(c);
case HCL_OOCH_PROP_LOWER:
return hcl_is_bch_lower(c);
case HCL_OOCH_PROP_ALPHA:
return hcl_is_bch_alpha(c);
case HCL_OOCH_PROP_DIGIT:
return hcl_is_bch_digit(c);
case HCL_OOCH_PROP_XDIGIT:
return hcl_is_bch_xdigit(c);
case HCL_OOCH_PROP_ALNUM:
return hcl_is_bch_alnum(c);
case HCL_OOCH_PROP_SPACE:
return hcl_is_bch_space(c);
case HCL_OOCH_PROP_PRINT:
return hcl_is_bch_print(c);
case HCL_OOCH_PROP_GRAPH:
return hcl_is_bch_graph(c);
case HCL_OOCH_PROP_CNTRL:
return hcl_is_bch_cntrl(c);
case HCL_OOCH_PROP_PUNCT:
return hcl_is_bch_punct(c);
case HCL_OOCH_PROP_BLANK:
return hcl_is_bch_blank(c);
}
/* must not reach here */
return 0;
}
#if !defined(hcl_to_bch_upper)
hcl_bch_t hcl_to_bch_upper (hcl_bch_t c)
{
if(hcl_is_bch_lower(c)) return c & 95;
return c;
}
#endif
#if !defined(hcl_to_bch_lower)
hcl_bch_t hcl_to_bch_lower (hcl_bch_t c)
{
if(hcl_is_bch_upper(c)) return c | 32;
return c;
}
#endif
/* ----------------------------------------------------------------------- */
/*
* See http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
*/
struct interval
{
int first;
int last;
};
/* auxiliary function for binary search in interval table */
static int bisearch(hcl_uch_t ucs, const struct interval *table, int max)
{
int min = 0;
int mid;
if (ucs < table[0].first || ucs > table[max].last) return 0;
while (max >= min)
{
mid = (min + max) / 2;
if (ucs > table[mid].last) min = mid + 1;
else if (ucs < table[mid].first) max = mid - 1;
else return 1;
}
return 0;
}
/* The following two functions define the column width of an ISO 10646
* character as follows:
*
* - The null character (U+0000) has a column width of 0.
*
* - Other C0/C1 control characters and DEL will lead to a return
* value of -1.
*
* - Non-spacing and enclosing combining characters (general
* category code Mn or Me in the Unicode database) have a
* column width of 0.
*
* - SOFT HYPHEN (U+00AD) has a column width of 1.
*
* - Other format characters (general category code Cf in the Unicode
* database) and ZERO WIDTH SPACE (U+200B) have a column width of 0.
*
* - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
* have a column width of 0.
*
* - Spacing characters in the East Asian Wide (W) or East Asian
* Full-width (F) category as defined in Unicode Technical
* Report #11 have a column width of 2.
*
* - All remaining characters (including all printable
* ISO 8859-1 and WGL4 characters, Unicode control characters,
* etc.) have a column width of 1.
*
* This implementation assumes that wchar_t characters are encoded
* in ISO 10646.
*/
int hcl_get_ucwidth (hcl_uch_t uc)
{
/* sorted list of non-overlapping intervals of non-spacing characters */
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
static const struct interval combining[] = {
{ 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 },
{ 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 },
{ 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 },
{ 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 },
{ 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED },
{ 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A },
{ 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 },
{ 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D },
{ 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 },
{ 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD },
{ 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C },
{ 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D },
{ 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC },
{ 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD },
{ 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C },
{ 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D },
{ 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 },
{ 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 },
{ 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC },
{ 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD },
{ 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D },
{ 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 },
{ 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E },
{ 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC },
{ 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 },
{ 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E },
{ 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 },
{ 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 },
{ 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 },
{ 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F },
{ 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 },
{ 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD },
{ 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD },
{ 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 },
{ 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B },
{ 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 },
{ 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 },
{ 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF },
{ 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 },
{ 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F },
{ 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B },
{ 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F },
{ 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB },
{ 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F },
{ 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 },
{ 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD },
{ 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F },
{ 0xE0100, 0xE01EF }
};
/* test for 8-bit control characters */
if (uc == 0) return 0;
if (uc < 32 || (uc >= 0x7f && uc < 0xa0)) return -1;
/* binary search in table of non-spacing characters */
if (bisearch(uc, combining, sizeof(combining) / sizeof(struct interval) - 1)) return 0;
/* if we arrive here, uc is not a combining or C0/C1 control character */
if (uc >= 0x1100)
{
if (uc <= 0x115f || /* Hangul Jamo init. consonants */
uc == 0x2329 || uc == 0x232a ||
(uc >= 0x2e80 && uc <= 0xa4cf && uc != 0x303f) || /* CJK ... Yi */
(uc >= 0xac00 && uc <= 0xd7a3) || /* Hangul Syllables */
(uc >= 0xf900 && uc <= 0xfaff) || /* CJK Compatibility Ideographs */
(uc >= 0xfe10 && uc <= 0xfe19) || /* Vertical forms */
(uc >= 0xfe30 && uc <= 0xfe6f) || /* CJK Compatibility Forms */
(uc >= 0xff00 && uc <= 0xff60) || /* Fullwidth Forms */
(uc >= 0xffe0 && uc <= 0xffe6)
#if (HCL_SIZEOF_UCH_T > 2)
||
(uc >= 0x20000 && uc <= 0x2fffd) ||
(uc >= 0x30000 && uc <= 0x3fffd)
#endif
)
{
return 2;
}
}
return 1;
}

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -13,7 +11,7 @@
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 WAfRRANTIES
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

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -13,7 +11,7 @@
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 WAfRRANTIES
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

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -263,7 +261,7 @@ static HCL_INLINE int vm_startup (hcl_t* hcl)
}
#if defined(ENABLE_GCFIN)
hcl->sem_gcfin = (moo_oop_semaphore_t)hcl->_nil;
hcl->sem_gcfin = (hcl_oop_semaphore_t)hcl->_nil;
hcl->sem_gcfin_sigreq = 0;
#endif
@ -330,7 +328,7 @@ static void vm_cleanup (hcl_t* hcl)
}
#if defined(ENABLE_GCFIN)
hcl->sem_gcfin = (moo_oop_semaphore_t)hcl->_nil;
hcl->sem_gcfin = (hcl_oop_semaphore_t)hcl->_nil;
hcl->sem_gcfin_sigreq = 0;
/* deregister all pending finalizable objects pending just in case these

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

334
lib/hcl-chr.h Normal file
View File

@ -0,0 +1,334 @@
/*
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_CHR_H_
#define _HCL_CHR_H_
#include <hcl-cmn.h>
enum hcl_ooch_prop_t
{
HCL_OOCH_PROP_UPPER = (1 << 0),
#define HCL_UCH_PROP_UPPER HCL_OOCH_PROP_UPPER
#define HCL_BCH_PROP_UPPER HCL_OOCH_PROP_UPPER
HCL_OOCH_PROP_LOWER = (1 << 1),
#define HCL_UCH_PROP_LOWER HCL_OOCH_PROP_LOWER
#define HCL_BCH_PROP_LOWER HCL_OOCH_PROP_LOWER
HCL_OOCH_PROP_ALPHA = (1 << 2),
#define HCL_UCH_PROP_ALPHA HCL_OOCH_PROP_ALPHA
#define HCL_BCH_PROP_ALPHA HCL_OOCH_PROP_ALPHA
HCL_OOCH_PROP_DIGIT = (1 << 3),
#define HCL_UCH_PROP_DIGIT HCL_OOCH_PROP_DIGIT
#define HCL_BCH_PROP_DIGIT HCL_OOCH_PROP_DIGIT
HCL_OOCH_PROP_XDIGIT = (1 << 4),
#define HCL_UCH_PROP_XDIGIT HCL_OOCH_PROP_XDIGIT
#define HCL_BCH_PROP_XDIGIT HCL_OOCH_PROP_XDIGIT
HCL_OOCH_PROP_ALNUM = (1 << 5),
#define HCL_UCH_PROP_ALNUM HCL_OOCH_PROP_XDIGIT
#define HCL_BCH_PROP_ALNUM HCL_OOCH_PROP_XDIGIT
HCL_OOCH_PROP_SPACE = (1 << 6),
#define HCL_UCH_PROP_SPACE HCL_OOCH_PROP_SPACE
#define HCL_BCH_PROP_SPACE HCL_OOCH_PROP_SPACE
HCL_OOCH_PROP_PRINT = (1 << 8),
#define HCL_UCH_PROP_PRINT HCL_OOCH_PROP_PRINT
#define HCL_BCH_PROP_PRINT HCL_OOCH_PROP_PRINT
HCL_OOCH_PROP_GRAPH = (1 << 9),
#define HCL_UCH_PROP_GRAPH HCL_OOCH_PROP_GRAPH
#define HCL_BCH_PROP_GRAPH HCL_OOCH_PROP_GRAPH
HCL_OOCH_PROP_CNTRL = (1 << 10),
#define HCL_UCH_PROP_CNTRL HCL_OOCH_PROP_CNTRL
#define HCL_BCH_PROP_CNTRL HCL_OOCH_PROP_CNTRL
HCL_OOCH_PROP_PUNCT = (1 << 11),
#define HCL_UCH_PROP_PUNCT HCL_OOCH_PROP_PUNCT
#define HCL_BCH_PROP_PUNCT HCL_OOCH_PROP_PUNCT
HCL_OOCH_PROP_BLANK = (1 << 12)
#define HCL_UCH_PROP_BLANK HCL_OOCH_PROP_BLANK
#define HCL_BCH_PROP_BLANK HCL_OOCH_PROP_BLANK
};
typedef enum hcl_ooch_prop_t hcl_ooch_prop_t;
typedef enum hcl_ooch_prop_t hcl_uch_prop_t;
typedef enum hcl_ooch_prop_t hcl_bch_prop_t;
#if defined(__cplusplus)
extern "C" {
#endif
HCL_EXPORT int hcl_is_uch_type (hcl_uch_t c, hcl_uch_prop_t type);
HCL_EXPORT int hcl_is_uch_upper (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_lower (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_alpha (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_digit (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_xdigit (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_alnum (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_space (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_print (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_graph (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_cntrl (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_punct (hcl_uch_t c);
HCL_EXPORT int hcl_is_uch_blank (hcl_uch_t c);
HCL_EXPORT hcl_uch_t hcl_to_uch_upper (hcl_uch_t c);
HCL_EXPORT hcl_uch_t hcl_to_uch_lower (hcl_uch_t c);
/* ------------------------------------------------------------------------- */
HCL_EXPORT int hcl_is_bch_type (hcl_bch_t c, hcl_bch_prop_t type);
#if defined(__has_builtin)
# if __has_builtin(__builtin_isupper)
# define hcl_is_bch_upper __builtin_isupper
# endif
# if __has_builtin(__builtin_islower)
# define hcl_is_bch_lower __builtin_islower
# endif
# if __has_builtin(__builtin_isalpha)
# define hcl_is_bch_alpha __builtin_isalpha
# endif
# if __has_builtin(__builtin_isdigit)
# define hcl_is_bch_digit __builtin_isdigit
# endif
# if __has_builtin(__builtin_isxdigit)
# define hcl_is_bch_xdigit __builtin_isxdigit
# endif
# if __has_builtin(__builtin_isalnum)
# define hcl_is_bch_alnum __builtin_isalnum
# endif
# if __has_builtin(__builtin_isspace)
# define hcl_is_bch_space __builtin_isspace
# endif
# if __has_builtin(__builtin_isprint)
# define hcl_is_bch_print __builtin_isprint
# endif
# if __has_builtin(__builtin_isgraph)
# define hcl_is_bch_graph __builtin_isgraph
# endif
# if __has_builtin(__builtin_iscntrl)
# define hcl_is_bch_cntrl __builtin_iscntrl
# endif
# if __has_builtin(__builtin_ispunct)
# define hcl_is_bch_punct __builtin_ispunct
# endif
# if __has_builtin(__builtin_isblank)
# define hcl_is_bch_blank __builtin_isblank
# endif
# if __has_builtin(__builtin_toupper)
# define hcl_to_bch_upper __builtin_toupper
# endif
# if __has_builtin(__builtin_tolower)
# define hcl_to_bch_lower __builtin_tolower
# endif
#elif (__GNUC__ >= 4)
# define hcl_is_bch_upper __builtin_isupper
# define hcl_is_bch_lower __builtin_islower
# define hcl_is_bch_alpha __builtin_isalpha
# define hcl_is_bch_digit __builtin_isdigit
# define hcl_is_bch_xdigit __builtin_isxdigit
# define hcl_is_bch_alnum __builtin_isalnum
# define hcl_is_bch_space __builtin_isspace
# define hcl_is_bch_print __builtin_isprint
# define hcl_is_bch_graph __builtin_isgraph
# define hcl_is_bch_cntrl __builtin_iscntrl
# define hcl_is_bch_punct __builtin_ispunct
# define hcl_is_bch_blank __builtin_isblank
# define hcl_to_bch_upper __builtin_toupper
# define hcl_to_bch_lower __builtin_tolower
#endif
/* the bch class functions support no locale.
* these implemenent latin-1 only */
#if !defined(hcl_is_bch_upper) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_upper (hcl_bch_t c) { return (hcl_bcu_t)c - 'A' < 26; }
#elif !defined(hcl_is_bch_upper)
# define hcl_is_bch_upper(c) ((hcl_bcu_t)(c) - 'A' < 26)
#endif
#if !defined(hcl_is_bch_lower) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_lower (hcl_bch_t c) { return (hcl_bcu_t)c - 'a' < 26; }
#elif !defined(hcl_is_bch_lower)
# define hcl_is_bch_lower(c) ((hcl_bcu_t)(c) - 'a' < 26)
#endif
#if !defined(hcl_is_bch_alpha) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_alpha (hcl_bch_t c) { return ((hcl_bcu_t)c | 32) - 'a' < 26; }
#elif !defined(hcl_is_bch_alpha)
# define hcl_is_bch_alpha(c) (((hcl_bcu_t)(c) | 32) - 'a' < 26)
#endif
#if !defined(hcl_is_bch_digit) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_digit (hcl_bch_t c) { return (hcl_bcu_t)c - '0' < 10; }
#elif !defined(hcl_is_bch_digit)
# define hcl_is_bch_digit(c) ((hcl_bcu_t)(c) - '0' < 10)
#endif
#if !defined(hcl_is_bch_xdigit) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_xdigit (hcl_bch_t c) { return hcl_is_bch_digit(c) || ((hcl_bcu_t)c | 32) - 'a' < 6; }
#elif !defined(hcl_is_bch_xdigit)
# define hcl_is_bch_xdigit(c) (hcl_is_bch_digit(c) || ((hcl_bcu_t)(c) | 32) - 'a' < 6)
#endif
#if !defined(hcl_is_bch_alnum) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_alnum (hcl_bch_t c) { return hcl_is_bch_alpha(c) || hcl_is_bch_digit(c); }
#elif !defined(hcl_is_bch_alnum)
# define hcl_is_bch_alnum(c) (hcl_is_bch_alpha(c) || hcl_is_bch_digit(c))
#endif
#if !defined(hcl_is_bch_space) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_space (hcl_bch_t c) { return c == ' ' || (hcl_bcu_t)c - '\t' < 5; }
#elif !defined(hcl_is_bch_space)
# define hcl_is_bch_space(c) ((c) == ' ' || (hcl_bcu_t)(c) - '\t' < 5)
#endif
#if !defined(hcl_is_bch_print) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_print (hcl_bch_t c) { return (hcl_bcu_t)c - ' ' < 95; }
#elif !defined(hcl_is_bch_print)
# define hcl_is_bch_print(c) ((hcl_bcu_t)(c) - ' ' < 95)
#endif
#if !defined(hcl_is_bch_graph) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_graph (hcl_bch_t c) { return (hcl_bcu_t)c - '!' < 94; }
#elif !defined(hcl_is_bch_graph)
# define hcl_is_bch_graph(c) ((hcl_bcu_t)(c) - '!' < 94)
#endif
#if !defined(hcl_is_bch_cntrl) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_cntrl (hcl_bch_t c) { return (hcl_bcu_t)c < ' ' || (hcl_bcu_t)c == 127; }
#elif !defined(hcl_is_bch_cntrl)
# define hcl_is_bch_cntrl(c) ((hcl_bcu_t)(c) < ' ' || (hcl_bcu_t)(c) == 127)
#endif
#if !defined(hcl_is_bch_punct) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_punct (hcl_bch_t c) { return hcl_is_bch_graph(c) && !hcl_is_bch_alnum(c); }
#elif !defined(hcl_is_bch_punct)
# define hcl_is_bch_punct(c) (hcl_is_bch_graph(c) && !hcl_is_bch_alnum(c))
#endif
#if !defined(hcl_is_bch_blank) && defined(HCL_HAVE_INLINE)
static HCL_INLINE int hcl_is_bch_blank (hcl_bch_t c) { return c == ' ' || c == '\t'; }
#elif !defined(hcl_is_bch_blank)
# define hcl_is_bch_blank(c) ((c) == ' ' || (c) == '\t')
#endif
#if !defined(hcl_to_bch_upper)
HCL_EXPORT hcl_bch_t hcl_to_bch_upper (hcl_bch_t c);
#endif
#if !defined(hcl_to_bch_lower)
HCL_EXPORT hcl_bch_t hcl_to_bch_lower (hcl_bch_t c);
#endif
#if defined(HCL_OOCH_IS_UCH)
# define hcl_is_ooch_type hcl_is_uch_type
# define hcl_is_ooch_upper hcl_is_uch_upper
# define hcl_is_ooch_lower hcl_is_uch_lower
# define hcl_is_ooch_alpha hcl_is_uch_alpha
# define hcl_is_ooch_digit hcl_is_uch_digit
# define hcl_is_ooch_xdigit hcl_is_uch_xdigit
# define hcl_is_ooch_alnum hcl_is_uch_alnum
# define hcl_is_ooch_space hcl_is_uch_space
# define hcl_is_ooch_print hcl_is_uch_print
# define hcl_is_ooch_graph hcl_is_uch_graph
# define hcl_is_ooch_cntrl hcl_is_uch_cntrl
# define hcl_is_ooch_punct hcl_is_uch_punct
# define hcl_is_ooch_blank hcl_is_uch_blank
# define hcl_to_ooch_upper hcl_to_uch_upper
# define hcl_to_ooch_lower hcl_to_uch_lower
#else
# define hcl_is_ooch_type hcl_is_bch_type
# define hcl_is_ooch_upper hcl_is_bch_upper
# define hcl_is_ooch_lower hcl_is_bch_lower
# define hcl_is_ooch_alpha hcl_is_bch_alpha
# define hcl_is_ooch_digit hcl_is_bch_digit
# define hcl_is_ooch_xdigit hcl_is_bch_xdigit
# define hcl_is_ooch_alnum hcl_is_bch_alnum
# define hcl_is_ooch_space hcl_is_bch_space
# define hcl_is_ooch_print hcl_is_bch_print
# define hcl_is_ooch_graph hcl_is_bch_graph
# define hcl_is_ooch_cntrl hcl_is_bch_cntrl
# define hcl_is_ooch_punct hcl_is_bch_punct
# define hcl_is_ooch_blank hcl_is_bch_blank
# define hcl_to_ooch_upper hcl_to_bch_upper
# define hcl_to_ooch_lower hcl_to_bch_lower
#endif
/* ------------------------------------------------------------------------- */
HCL_EXPORT int hcl_get_ucwidth (
hcl_uch_t uc
);
/* ------------------------------------------------------------------------- */
HCL_EXPORT hcl_oow_t hcl_uc_to_utf8 (
hcl_uch_t uc,
hcl_bch_t* utf8,
hcl_oow_t size
);
HCL_EXPORT hcl_oow_t hcl_utf8_to_uc (
const hcl_bch_t* utf8,
hcl_oow_t size,
hcl_uch_t* uc
);
HCL_EXPORT hcl_oow_t hcl_uc_to_utf16 (
hcl_uch_t uc,
hcl_bch_t* utf16,
hcl_oow_t size
);
HCL_EXPORT hcl_oow_t hcl_utf16_to_uc (
const hcl_bch_t* utf16,
hcl_oow_t size,
hcl_uch_t* uc
);
HCL_EXPORT hcl_oow_t hcl_uc_to_mb8 (
hcl_uch_t uc,
hcl_bch_t* mb8,
hcl_oow_t size
);
HCL_EXPORT hcl_oow_t hcl_mb8_to_uc (
const hcl_bch_t* mb8,
hcl_oow_t size,
hcl_uch_t* uc
);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,6 +26,7 @@
#define _HCL_PRV_H_
#include <hcl.h>
#include <hcl-chr.h>
#include <hcl-fmt.h>
#include <hcl-utl.h>

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -287,6 +285,17 @@
#define HCL_HASH_UCSTR(hv, ptr) HCL_HASH_VPTR(hv, ptr, const hcl_uch_t)
#define HCL_HASH_MORE_UCSTR(hv, ptr) HCL_HASH_MORE_VPTR(hv, ptr, const hcl_uch_t)
/* =========================================================================
* CMGR
* ========================================================================= */
enum hcl_cmgr_id_t
{
HCL_CMGR_UTF8,
HCL_CMGR_UTF16,
HCL_CMGR_MB8
};
typedef enum hcl_cmgr_id_t hcl_cmgr_id_t;
/* =========================================================================
* PATH-RELATED MACROS
@ -516,13 +525,13 @@ HCL_EXPORT hcl_oow_t hcl_copy_bcstr_unlimited (
HCL_EXPORT void hcl_fill_uchars (
hcl_uch_t* dst,
const hcl_uch_t ch,
hcl_uch_t ch,
hcl_oow_t len
);
HCL_EXPORT void hcl_fill_bchars (
hcl_bch_t* dst,
const hcl_bch_t ch,
hcl_bch_t ch,
hcl_oow_t len
);
@ -690,10 +699,35 @@ HCL_EXPORT int hcl_conv_uchars_to_bchars_with_cmgr (
# define hcl_conv_oochars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) hcl_conv_bchars_to_uchars_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
#endif
/* ------------------------------------------------------------------------- */
HCL_EXPORT hcl_cmgr_t* hcl_get_utf8_cmgr (
void
);
HCL_EXPORT hcl_cmgr_t* hcl_get_cmgr_by_id (
hcl_cmgr_id_t id
);
HCL_EXPORT hcl_cmgr_t* hcl_get_cmgr_by_bcstr (
const hcl_bch_t* name
);
HCL_EXPORT hcl_cmgr_t* hcl_get_cmgr_by_ucstr (
const hcl_uch_t* name
);
#if defined(HCL_OOCH_IS_UCH)
# define hcl_get_cmgr_by_name(name) hcl_get_cmgr_by_ucstr(name)
#else
# define hcl_get_cmgr_by_name(name) hcl_get_cmgr_by_bcstr(name)
#endif
#define hcl_get_utf8_cmgr() hcl_get_cmgr_by_id(HCL_CMGR_UTF8)
#define hcl_get_utf16_cmgr() hcl_get_cmgr_by_id(HCL_CMGR_UTF16)
#define hcl_get_mb8_cmgr() hcl_get_cmgr_by_id(HCL_CMGR_MB8)
/**
* The hcl_conv_uchars_to_utf8() function converts a unicode character string \a ucs
* to a UTF8 string and writes it into the buffer pointed to by \a bcs, but

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

39
lib/mb8.c Normal file
View File

@ -0,0 +1,39 @@
/*
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.
*/
#include "hcl-prv.h"
hcl_oow_t hcl_uc_to_mb8 (hcl_uch_t wc, hcl_bch_t* mb8, hcl_oow_t size)
{
if (size <= 0) return size + 1; /* buffer too small */
if (wc > HCL_TYPE_MAX(hcl_uint8_t)) return 0; /* illegal character */
if (mb8) *(hcl_uint8_t*)mb8 = wc;
return 1;
}
hcl_oow_t hcl_mb8_to_uc (const hcl_bch_t* mb8, hcl_oow_t size, hcl_uch_t* wc)
{
*wc = *(const hcl_uint8_t*)mb8;
return 1;
}

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -259,7 +257,7 @@
#endif
#if defined(USE_THREAD)
# define MUTEX_INIT(x) pthread_mutex_init((x), MOO_NULL)
# define MUTEX_INIT(x) pthread_mutex_init((x), HCL_NULL)
# define MUTEX_DESTROY(x) pthread_mutex_destroy(x)
# define MUTEX_LOCK(x) pthread_mutex_lock(x)
# define MUTEX_UNLOCK(x) pthread_mutex_unlock(x)
@ -2885,13 +2883,13 @@ static int open_pipes (hcl_t* hcl, int p[2])
#elif defined(HAVE_PIPE2) && defined(O_CLOEXEC) && defined(O_NONBLOCK)
/* do nothing */
#else
#if defined(FD_CLOEXEC)
#if defined(FD_CLOEXEC) && defined(F_GETFD) && defined(F_SETFD)
flags = fcntl(p[0], F_GETFD);
if (flags >= 0) fcntl (p[0], F_SETFD, flags | FD_CLOEXEC);
flags = fcntl(p[1], F_GETFD);
if (flags >= 0) fcntl (p[1], F_SETFD, flags | FD_CLOEXEC);
#endif
#if defined(O_NONBLOCK)
#if defined(O_NONBLOCK) && defined(F_GETFL) && defined(F_SETFL)
flags = fcntl(p[0], F_GETFL);
if (flags >= 0) fcntl (p[0], F_SETFL, flags | O_NONBLOCK);
flags = fcntl(p[1], F_GETFL);
@ -3146,7 +3144,7 @@ hcl_t* hcl_openstdwithmmgr (hcl_mmgr_t* mmgr, hcl_oow_t xtnsize, hcl_errnum_t* e
hcl = hcl_open(mmgr, HCL_SIZEOF(xtn_t) + xtnsize, &vmprim, errnum);
if (HCL_UNLIKELY(!hcl)) return HCL_NULL;
/* adjust the object size by the sizeof xtn_t so that moo_getxtn() returns the right pointer. */
/* adjust the object size by the sizeof xtn_t so that hcl_getxtn() returns the right pointer. */
hcl->_instsize += HCL_SIZEOF(xtn_t);
reset_log_to_default (GET_XTN(hcl));
@ -3613,7 +3611,7 @@ static HCL_INLINE int write_bytes_udo_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
/*xtn_t* xtn = GET_XTN(hcl);*/
const hcl_uint8_t* ptr;
ptr = (const hcl_uint8_t*)arg->ptr; // take the buffer as a byte series
ptr = (const hcl_uint8_t*)arg->ptr; /* take the buffer as a byte series */
if (fwrite(ptr, HCL_SIZEOF(*ptr), arg->len, (FILE*)arg->handle) < arg->len)
{

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -13,7 +11,7 @@
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 WAfRRANTIES
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

7367
lib/uch-case.h Normal file

File diff suppressed because it is too large Load Diff

15603
lib/uch-prop.h Normal file

File diff suppressed because it is too large Load Diff

83
lib/utf16.c Normal file
View File

@ -0,0 +1,83 @@
/*
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.
*/
#include "hcl-prv.h"
/* TODO: handle different endians - UTF16BE or UTF16LE */
enum
{
HIGH_SURROGATE_START = 0xD800,
HIGH_SURROGATE_END = 0xDBFF,
LOW_SURROGATE_START = 0xDC00,
LOW_SURROGATE_END = 0xDFFF
};
hcl_oow_t hcl_uc_to_utf16 (hcl_uch_t uc, hcl_bch_t* utf16, hcl_oow_t size)
{
hcl_uint16_t* u16 = (hcl_uint16_t*)utf16;
if (uc <= 0xFFFF)
{
u16[0] = (hcl_uint16_t)uc;
return 2;
}
#if (HCL_SIZEOF_UCH_T > 2)
else if (uc <= 0x10FFFF)
{
u16[0] = HIGH_SURROGATE_START | (((uc >> 16) & 0x1F) - 1) | (uc >> 10);
u16[1] = LOW_SURROGATE_START | (uc & 0x3FF);
return 4;
}
#endif
return 0; /* illegal character */
}
hcl_oow_t hcl_utf16_to_uc (const hcl_bch_t* utf16, hcl_oow_t size, hcl_uch_t* uc)
{
const hcl_uint16_t* u16 = (const hcl_uint16_t*)utf16;
if (size < 2) return 0; /* incomplete sequence */
if (u16[0] < HIGH_SURROGATE_START || u16[0] > LOW_SURROGATE_END)
{
/* BMP - U+0000 - U+D7FF, U+E000 - U+FFFF */
*uc = u16[0];
return 2;
}
#if (HCL_SIZEOF_UCH_T > 2)
else if (u16[0] >= HIGH_SURROGATE_START && u16[0] <= HIGH_SURROGATE_END) /* high-surrogate */
{
if (size < 4) return 0; /* incomplete */
if (u16[1] >= LOW_SURROGATE_START && u16[1] <= LOW_SURROGATE_END) /* low-surrogate */
{
*uc = (((u16[0] & 0x3FF) << 10) | (u16[1] & 0x3FF)) + 0x10000;
return 4;
}
}
#endif
return 0;
}

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

126
lib/utl.c
View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -848,43 +846,149 @@ HCL_INLINE int hcl_conv_ucstr_to_bcstr_with_cmgr (const hcl_uch_t* ucs, hcl_oow_
/* ----------------------------------------------------------------------- */
static hcl_cmgr_t utf8_cmgr =
static hcl_cmgr_t builtin_cmgr[] =
{
hcl_utf8_to_uc,
hcl_uc_to_utf8
/* keep the order aligned with hcl_cmgr_id_t values in <hcl-utl.h> */
{ hcl_utf8_to_uc, hcl_uc_to_utf8 },
{ hcl_utf16_to_uc, hcl_uc_to_utf16 },
{ hcl_mb8_to_uc, hcl_uc_to_mb8 }
};
hcl_cmgr_t* hcl_get_utf8_cmgr (void)
hcl_cmgr_t* hcl_get_cmgr_by_id (hcl_cmgr_id_t id)
{
return &utf8_cmgr;
return &builtin_cmgr[id];
}
static struct
{
const hcl_bch_t* name;
hcl_cmgr_id_t id;
} builtin_cmgr_tab[] =
{
{ "utf8", HCL_CMGR_UTF8 },
{ "utf16", HCL_CMGR_UTF16 },
{ "mb8", HCL_CMGR_MB8 }
};
hcl_cmgr_t* hcl_get_cmgr_by_bcstr (const hcl_bch_t* name)
{
if (name)
{
hcl_oow_t i;
for (i = 0; i < HCL_COUNTOF(builtin_cmgr_tab); i++)
{
if (hcl_comp_bcstr(name, builtin_cmgr_tab[i].name) == 0)
{
return &builtin_cmgr[builtin_cmgr_tab[i].id];
}
}
}
return HCL_NULL;
}
hcl_cmgr_t* hcl_get_cmgr_by_ucstr (const hcl_uch_t* name)
{
if (name)
{
hcl_oow_t i;
for (i = 0; i < HCL_COUNTOF(builtin_cmgr_tab); i++)
{
if (hcl_comp_ucstr_bcstr(name, builtin_cmgr_tab[i].name) == 0)
{
return &builtin_cmgr[builtin_cmgr_tab[i].id];
}
}
}
return HCL_NULL;
}
/* ----------------------------------------------------------------------- */
int hcl_conv_utf8_to_uchars (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
{
/* the source is length bound */
return hcl_conv_bchars_to_uchars_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0);
return hcl_conv_bchars_to_uchars_with_cmgr(bcs, bcslen, ucs, ucslen, &builtin_cmgr[HCL_CMGR_UTF8], 0);
}
int hcl_conv_uchars_to_utf8 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
{
/* length bound */
return hcl_conv_uchars_to_bchars_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr);
return hcl_conv_uchars_to_bchars_with_cmgr(ucs, ucslen, bcs, bcslen, &builtin_cmgr[HCL_CMGR_UTF8]);
}
int hcl_conv_utf8_to_ucstr (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
{
/* null-terminated. */
return hcl_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &utf8_cmgr, 0);
return hcl_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &builtin_cmgr[HCL_CMGR_UTF8], 0);
}
int hcl_conv_ucstr_to_utf8 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
{
/* null-terminated */
return hcl_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &utf8_cmgr);
return hcl_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &builtin_cmgr[HCL_CMGR_UTF8]);
}
/* ----------------------------------------------------------------------- */
int hcl_conv_utf16_to_uchars (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
{
/* the source is length bound */
return hcl_conv_bchars_to_uchars_with_cmgr(bcs, bcslen, ucs, ucslen, &builtin_cmgr[HCL_CMGR_UTF16], 0);
}
int hcl_conv_uchars_to_utf16 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
{
/* length bound */
return hcl_conv_uchars_to_bchars_with_cmgr(ucs, ucslen, bcs, bcslen, &builtin_cmgr[HCL_CMGR_UTF16]);
}
int hcl_conv_utf16_to_ucstr (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
{
/* null-terminated. */
return hcl_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &builtin_cmgr[HCL_CMGR_UTF16], 0);
}
int hcl_conv_ucstr_to_utf16 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
{
/* null-terminated */
return hcl_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &builtin_cmgr[HCL_CMGR_UTF16]);
}
/* ----------------------------------------------------------------------- */
int hcl_conv_mb8_to_uchars (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
{
/* the source is length bound */
return hcl_conv_bchars_to_uchars_with_cmgr(bcs, bcslen, ucs, ucslen, &builtin_cmgr[HCL_CMGR_MB8], 0);
}
int hcl_conv_uchars_to_mb8 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
{
/* length bound */
return hcl_conv_uchars_to_bchars_with_cmgr(ucs, ucslen, bcs, bcslen, &builtin_cmgr[HCL_CMGR_MB8]);
}
int hcl_conv_mb8_to_ucstr (const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
{
/* null-terminated. */
return hcl_conv_bcstr_to_ucstr_with_cmgr(bcs, bcslen, ucs, ucslen, &builtin_cmgr[HCL_CMGR_MB8], 0);
}
int hcl_conv_ucstr_to_mb8 (const hcl_uch_t* ucs, hcl_oow_t* ucslen, hcl_bch_t* bcs, hcl_oow_t* bcslen)
{
/* null-terminated */
return hcl_conv_ucstr_to_bcstr_with_cmgr(ucs, ucslen, bcs, bcslen, &builtin_cmgr[HCL_CMGR_MB8]);
}
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
int hcl_convbtouchars (hcl_t* hcl, const hcl_bch_t* bcs, hcl_oow_t* bcslen, hcl_uch_t* ucs, hcl_oow_t* ucslen)
{
/* length bound */

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,3 +1,27 @@
/*
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.
*/
static int str_to_ipv4 (const ooch_t* str, hcl_oow_t len, struct in_addr* inaddr)
{
const ooch_t* end;

View File

@ -1,6 +1,4 @@
/*
* $Id$
*
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -23,6 +21,7 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <hcl-xutl.h>
#include "hcl-prv.h"