* added QSE_MBLEN_MAX

* added qse_getcclsid() and related functions
* added qse_isblank() and realted code
This commit is contained in:
hyung-hwan 2011-08-22 23:26:26 +00:00
parent 03dad41aa2
commit 2c4ed8caf9
57 changed files with 985 additions and 448 deletions

View File

@ -39,10 +39,11 @@ DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
$(top_srcdir)/configure ac/config.guess ac/config.sub \
ac/depcomp ac/install-sh ac/ltmain.sh ac/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \

1
qse/aclocal.m4 vendored
View File

@ -949,6 +949,7 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/ax_numval.m4])
m4_include([m4/ax_pthread.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])

View File

@ -36,10 +36,11 @@ host_triplet = @host@
subdir = cmd
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ bin_PROGRAMS = qseawk$(EXEEXT)
subdir = cmd/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ bin_PROGRAMS = qsecut$(EXEEXT)
subdir = cmd/cut
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ bin_PROGRAMS = qsesed$(EXEEXT)
subdir = cmd/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ bin_PROGRAMS = qsestx$(EXEEXT)
subdir = cmd/stx
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

86
qse/configure vendored
View File

@ -15374,7 +15374,19 @@ _ACEOF
fi
done
for ac_func in wctype wctrans towctrans
for ac_func in wctype iswctype wctrans towctrans
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in isblank iswblank
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -16213,6 +16225,68 @@ _ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of mbstate_t" >&5
$as_echo_n "checking size of mbstate_t... " >&6; }
if test "${ac_cv_sizeof_mbstate_t+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (mbstate_t))" "ac_cv_sizeof_mbstate_t" "#include <wchar.h>
"; then :
else
if test "$ac_cv_type_mbstate_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (mbstate_t)
See \`config.log' for more details" "$LINENO" 5 ; }
else
ac_cv_sizeof_mbstate_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_mbstate_t" >&5
$as_echo "$ac_cv_sizeof_mbstate_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_MBSTATE_T $ac_cv_sizeof_mbstate_t
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of MB_LEN_MAX" >&5
$as_echo_n "checking numeric value of MB_LEN_MAX... " >&6; }
if test "${ax_cv_numvalof_MB_LEN_MAX+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(MB_LEN_MAX)" "ax_cv_numvalof_MB_LEN_MAX" "#include <limits.h>
"; then :
else
ax_cv_numvalof_MB_LEN_MAX=32
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_MB_LEN_MAX" >&5
$as_echo "$ax_cv_numvalof_MB_LEN_MAX" >&6; }
cat >>confdefs.h <<_ACEOF
#define NUMVALOF_MB_LEN_MAX $ax_cv_numvalof_MB_LEN_MAX
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_CHAR ${ac_cv_sizeof_char}
@ -16304,6 +16378,16 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_MBSTATE_T ${ac_cv_sizeof_mbstate_t}
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_MBLEN_MAX ${ax_cv_numvalof_MB_LEN_MAX}
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_PACKAGE_VERSION "${VERSION}"

View File

@ -93,7 +93,8 @@ dnl check functions
AC_CHECK_FUNCS([uselocale])
AC_CHECK_FUNCS([mbrlen mbrtowc wcrtomb])
AC_CHECK_FUNCS([mbsnrtowcs mbsrtowcs wcsnrtombs wcsrtombs])
AC_CHECK_FUNCS([wctype wctrans towctrans])
AC_CHECK_FUNCS([wctype iswctype wctrans towctrans])
AC_CHECK_FUNCS([isblank iswblank])
AC_CHECK_FUNCS([lseek64 stat64 fstat64 ftruncate64])
AC_CHECK_FUNCS([timegm timelocal])
AC_CHECK_FUNCS([utime utimes])
@ -132,6 +133,9 @@ AC_CHECK_SIZEOF(wchar_t)
AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(off64_t)
AC_CHECK_SIZEOF(mbstate_t,[],[#include <wchar.h>])
AX_CHECK_NUMVALOF(MB_LEN_MAX,[32],[#include <limits.h>])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_CHAR, ${ac_cv_sizeof_char}, [sizeof(char)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_SHORT, ${ac_cv_sizeof_short}, [sizeof(short)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_INT, ${ac_cv_sizeof_int}, [sizeof(int)])
@ -150,13 +154,15 @@ AC_DEFINE_UNQUOTED(QSE_SIZEOF_LONG_DOUBLE, ${ac_cv_sizeof_long_double}, [sizeof(
AC_DEFINE_UNQUOTED(QSE_SIZEOF_WCHAR_T, ${ac_cv_sizeof_wchar_t}, [sizeof(wchar_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_OFF_T, ${ac_cv_sizeof_off_t}, [sizeof(off_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_OFF64_T, ${ac_cv_sizeof_off64_t}, [sizeof(off64_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_MBSTATE_T, ${ac_cv_sizeof_mbstate_t}, [sizeof(mbstate_t)])
AC_DEFINE_UNQUOTED(QSE_MBLEN_MAX, ${ax_cv_numvalof_MB_LEN_MAX}, [MB_LEN_MAX])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_VERSION, "${VERSION}", [Package version])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_VERSION_MAJOR, $(echo ${VERSION} | cut -d. -f1), [Major version number])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_VERSION_MINOR, $(echo ${VERSION} | cut -d. -f2), [Minor version number])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_VERSION_PATCH, $(echo ${VERSION} | cut -d. -f3), [Patch level])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_AUTHOR,"${PACKAGE_BUGREPORT}", [Author's contact])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_AUTHOR,"${PACKAGE_BUGREPORT}", [Author])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_NAME,"${PACKAGE_NAME}", [package name])
AC_DEFINE_UNQUOTED(QSE_PACKAGE_URL, "${PACKAGE_URL}", [Project URL])

View File

@ -37,10 +37,11 @@ subdir = doc
DIST_COMMON = $(srcdir)/Doxyfile.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -36,10 +36,11 @@ host_triplet = @host@
subdir = doc/page
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -57,4 +57,9 @@ global heap. This means that you can split a heap to smaller subheaps.
If the size of memory blocks to allocate share the same size, you can use
#qse_fma_t for performance.
@section mem_pma Simple Memory Pool Allocator
If you want to allocate blocks quickly but ok not to be able to resize or
deallocate the blocks individually, you can use #qse_pma_t.
*/

View File

@ -36,10 +36,11 @@ host_triplet = @host@
subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ subdir = include/qse
DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ subdir = include/qse/awk
DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ subdir = include/qse/cmn
DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -1,5 +1,5 @@
/*
* $Id: chr.h 441 2011-04-22 14:28:43Z hyunghwan.chung $
* $Id: chr.h 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -21,6 +21,11 @@
#ifndef _QSE_CMN_CHR_H_
#define _QSE_CMN_CHR_H_
/** @file
* This file provides functions, types, macros for character handling.
*/
#include <qse/types.h>
#include <qse/macros.h>
@ -29,17 +34,18 @@
*/
enum qse_ccls_id_t
{
QSE_CCLS_UPPER,
QSE_CCLS_LOWER,
QSE_CCLS_ALNUM = 1,
QSE_CCLS_ALPHA,
QSE_CCLS_DIGIT,
QSE_CCLS_XDIGIT,
QSE_CCLS_ALNUM,
QSE_CCLS_SPACE,
QSE_CCLS_PRINT,
QSE_CCLS_GRAPH,
QSE_CCLS_BLANK,
QSE_CCLS_CNTRL,
QSE_CCLS_PUNCT
QSE_CCLS_DIGIT,
QSE_CCLS_GRAPH,
QSE_CCLS_LOWER,
QSE_CCLS_PRINT,
QSE_CCLS_PUNCT,
QSE_CCLS_SPACE,
QSE_CCLS_UPPER,
QSE_CCLS_XDIGIT
};
typedef enum qse_ccls_id_t qse_ccls_id_t;
typedef qse_ccls_id_t qse_mccls_id_t;
@ -56,6 +62,7 @@ typedef qse_ccls_id_t qse_wccls_id_t;
#define QSE_MCCLS_GRAPH QSE_CCLS_GRAPH
#define QSE_MCCLS_CNTRL QSE_CCLS_CNTRL
#define QSE_MCCLS_PUNCT QSE_CCLS_PUNCT
#define QSE_MCCLS_BLANK QSE_CCLS_BLANK
#define QSE_WCCLS_UPPER QSE_CCLS_UPPER
#define QSE_WCCLS_LOWER QSE_CCLS_LOWER
@ -68,69 +75,46 @@ typedef qse_ccls_id_t qse_wccls_id_t;
#define QSE_WCCLS_GRAPH QSE_CCLS_GRAPH
#define QSE_WCCLS_CNTRL QSE_CCLS_CNTRL
#define QSE_WCCLS_PUNCT QSE_CCLS_PUNCT
#define QSE_WCCLS_BLANK QSE_CCLS_BLANK
#ifdef USE_STDC
# include <ctype.h>
# include <wctype.h>
#
# define QSE_ISMUPPER(c) isupper(c)
# define QSE_ISMLOWER(c) islower(c)
# define QSE_ISMALPHA(c) isalpha(c)
# define QSE_ISMDIGIT(c) isdigit(c)
# define QSE_ISMXDIGIT(c) isxdigit(c)
# define QSE_ISMALNUM(c) isalnum(c)
# define QSE_ISMSPACE(c) isspace(c)
# define QSE_ISMPRINT(c) isprint(c)
# define QSE_ISMGRAPH(c) isgraph(c)
# define QSE_ISMCNTRL(c) iscntrl(c)
# define QSE_ISMPUNCT(c) ispunct(c)
# define QSE_TOMUPPER(c) toupper(c)
# define QSE_TOMLOWER(c) tolower(c)
#
# define QSE_ISWUPPER(c) iswupper(c)
# define QSE_ISWLOWER(c) iswlower(c)
# define QSE_ISWALPHA(c) iswalpha(c)
# define QSE_ISWDIGIT(c) iswdigit(c)
# define QSE_ISWXDIGIT(c) iswxdigit(c)
# define QSE_ISWALNUM(c) iswalnum(c)
# define QSE_ISWSPACE(c) iswspace(c)
# define QSE_ISWPRINT(c) iswprint(c)
# define QSE_ISWGRAPH(c) iswgraph(c)
# define QSE_ISWCNTRL(c) iswcntrl(c)
# define QSE_ISWPUNCT(c) iswpunct(c)
# define QSE_TOWUPPER(c) towupper(c)
# define QSE_TOWLOWER(c) towlower(c)
#else
# define QSE_ISMUPPER(c) (qse_mccls_is(c,QSE_CCLS_UPPER))
# define QSE_ISMLOWER(c) (qse_mccls_is(c,QSE_CCLS_LOWER))
# define QSE_ISMALPHA(c) (qse_mccls_is(c,QSE_CCLS_ALPHA))
# define QSE_ISMDIGIT(c) (qse_mccls_is(c,QSE_CCLS_DIGIT))
# define QSE_ISMXDIGIT(c) (qse_mccls_is(c,QSE_CCLS_XDIGIT))
# define QSE_ISMALNUM(c) (qse_mccls_is(c,QSE_CCLS_ALNUM))
# define QSE_ISMSPACE(c) (qse_mccls_is(c,QSE_CCLS_SPACE))
# define QSE_ISMPRINT(c) (qse_mccls_is(c,QSE_CCLS_PRINT))
# define QSE_ISMGRAPH(c) (qse_mccls_is(c,QSE_CCLS_GRAPH))
# define QSE_ISMCNTRL(c) (qse_mccls_is(c,QSE_CCLS_CNTRL))
# define QSE_ISMPUNCT(c) (qse_mccls_is(c,QSE_CCLS_PUNCT))
# define QSE_TOMUPPER(c) (qse_mccls_to(c,QSE_CCLS_UPPER))
# define QSE_TOMLOWER(c) (qse_mccls_to(c,QSE_CCLS_LOWER))
#
# define QSE_ISWUPPER(c) (qse_wccls_is(c,QSE_CCLS_UPPER))
# define QSE_ISWLOWER(c) (qse_wccls_is(c,QSE_CCLS_LOWER))
# define QSE_ISWALPHA(c) (qse_wccls_is(c,QSE_CCLS_ALPHA))
# define QSE_ISWDIGIT(c) (qse_wccls_is(c,QSE_CCLS_DIGIT))
# define QSE_ISWXDIGIT(c) (qse_wccls_is(c,QSE_CCLS_XDIGIT))
# define QSE_ISWALNUM(c) (qse_wccls_is(c,QSE_CCLS_ALNUM))
# define QSE_ISWSPACE(c) (qse_wccls_is(c,QSE_CCLS_SPACE))
# define QSE_ISWPRINT(c) (qse_wccls_is(c,QSE_CCLS_PRINT))
# define QSE_ISWGRAPH(c) (qse_wccls_is(c,QSE_CCLS_GRAPH))
# define QSE_ISWCNTRL(c) (qse_wccls_is(c,QSE_CCLS_CNTRL))
# define QSE_ISWPUNCT(c) (qse_wccls_is(c,QSE_CCLS_PUNCT))
# define QSE_TOWUPPER(c) (qse_wccls_to(c,QSE_CCLS_UPPER))
# define QSE_TOWLOWER(c) (qse_wccls_to(c,QSE_CCLS_LOWER))
#endif
#define QSE_MCTYPE(name) (qse_getmcclsid(name))
#define QSE_ISMCTYPE(c,t) (qse_ismccls(c,t))
#define QSE_ISMALNUM(c) (qse_ismccls(c,QSE_CCLS_ALNUM))
#define QSE_ISMALPHA(c) (qse_ismccls(c,QSE_CCLS_ALPHA))
#define QSE_ISMBLANK(c) (qse_ismccls(c,QSE_CCLS_BLANK))
#define QSE_ISMCNTRL(c) (qse_ismccls(c,QSE_CCLS_CNTRL))
#define QSE_ISMDIGIT(c) (qse_ismccls(c,QSE_CCLS_DIGIT))
#define QSE_ISMGRAPH(c) (qse_ismccls(c,QSE_CCLS_GRAPH))
#define QSE_ISMLOWER(c) (qse_ismccls(c,QSE_CCLS_LOWER))
#define QSE_ISMPRINT(c) (qse_ismccls(c,QSE_CCLS_PRINT))
#define QSE_ISMPUNCT(c) (qse_ismccls(c,QSE_CCLS_PUNCT))
#define QSE_ISMSPACE(c) (qse_ismccls(c,QSE_CCLS_SPACE))
#define QSE_ISMUPPER(c) (qse_ismccls(c,QSE_CCLS_UPPER))
#define QSE_ISMXDIGIT(c) (qse_ismccls(c,QSE_CCLS_XDIGIT))
#define QSE_TOMUPPER(c) (qse_tomccls(c,QSE_CCLS_UPPER))
#define QSE_TOMLOWER(c) (qse_tomccls(c,QSE_CCLS_LOWER))
#define QSE_WCTYPE(name) (qse_getwcclsid(name))
#define QSE_ISWCTYPE(c,t) (qse_iswccls(c,t))
#define QSE_ISWALNUM(c) (qse_iswccls(c,QSE_CCLS_ALNUM))
#define QSE_ISWALPHA(c) (qse_iswccls(c,QSE_CCLS_ALPHA))
#define QSE_ISWBLANK(c) (qse_iswccls(c,QSE_CCLS_BLANK))
#define QSE_ISWCNTRL(c) (qse_iswccls(c,QSE_CCLS_CNTRL))
#define QSE_ISWDIGIT(c) (qse_iswccls(c,QSE_CCLS_DIGIT))
#define QSE_ISWGRAPH(c) (qse_iswccls(c,QSE_CCLS_GRAPH))
#define QSE_ISWLOWER(c) (qse_iswccls(c,QSE_CCLS_LOWER))
#define QSE_ISWPRINT(c) (qse_iswccls(c,QSE_CCLS_PRINT))
#define QSE_ISWPUNCT(c) (qse_iswccls(c,QSE_CCLS_PUNCT))
#define QSE_ISWSPACE(c) (qse_iswccls(c,QSE_CCLS_SPACE))
#define QSE_ISWUPPER(c) (qse_iswccls(c,QSE_CCLS_UPPER))
#define QSE_ISWXDIGIT(c) (qse_iswccls(c,QSE_CCLS_XDIGIT))
#define QSE_TOWUPPER(c) (qse_towccls(c,QSE_CCLS_UPPER))
#define QSE_TOWLOWER(c) (qse_towccls(c,QSE_CCLS_LOWER))
#ifdef QSE_CHAR_IS_MCHAR
# define QSE_CTYPE(name) QSE_MCTYPE(name)
# define QSE_ISCTYPE(c,t) QSE_ISMCTYPE(c,t)
#
# define QSE_ISUPPER(c) QSE_ISMUPPER(c)
# define QSE_ISLOWER(c) QSE_ISMLOWER(c)
# define QSE_ISALPHA(c) QSE_ISMALPHA(c)
@ -142,9 +126,14 @@ typedef qse_ccls_id_t qse_wccls_id_t;
# define QSE_ISGRAPH(c) QSE_ISMGRAPH(c)
# define QSE_ISCNTRL(c) QSE_ISMCNTRL(c)
# define QSE_ISPUNCT(c) QSE_ISMPUNCT(c)
# define QSE_ISBLANK(c) QSE_ISMBLANK(c)
#
# define QSE_TOUPPER(c) QSE_TOMUPPER(c)
# define QSE_TOLOWER(c) QSE_TOMLOWER(c)
#else
# define QSE_CTYPE(name) QSE_WCTYPE(name)
# define QSE_ISCTYPE(c,t) QSE_ISWCTYPE(c,t)
#
# define QSE_ISUPPER(c) QSE_ISWUPPER(c)
# define QSE_ISLOWER(c) QSE_ISWLOWER(c)
# define QSE_ISALPHA(c) QSE_ISWALPHA(c)
@ -156,42 +145,115 @@ typedef qse_ccls_id_t qse_wccls_id_t;
# define QSE_ISGRAPH(c) QSE_ISWGRAPH(c)
# define QSE_ISCNTRL(c) QSE_ISWCNTRL(c)
# define QSE_ISPUNCT(c) QSE_ISWPUNCT(c)
# define QSE_ISBLANK(c) QSE_ISWBLANK(c)
#
# define QSE_TOUPPER(c) QSE_TOWUPPER(c)
# define QSE_TOLOWER(c) QSE_TOWLOWER(c)
#endif
/**
* The qse_mbstate_t type defines a structure large enough to hold
* the standard mbstate_t.
*/
typedef struct qse_mbstate_t qse_mbstate_t;
struct qse_mbstate_t
{
#if defined(QSE_SIZEOF_MBSTATE_T) && (QSE_SIZEOF_MBSTATE_T > 0)
char dummy[QSE_SIZEOF_MBSTATE_T];
#else
char dummy[1];
#endif
};
#ifdef __cplusplus
extern "C" {
#endif
qse_bool_t qse_mccls_is (
qse_bool_t qse_ismccls (
qse_mcint_t c,
qse_mccls_id_t type
);
qse_bool_t qse_wccls_is (
qse_bool_t qse_iswccls (
qse_wcint_t c,
qse_wccls_id_t type
);
qse_mcint_t qse_mccls_to (
qse_mcint_t qse_tomccls (
qse_mcint_t c,
qse_mccls_id_t type
qse_mccls_id_t type
);
qse_wcint_t qse_wccls_to (
qse_wcint_t qse_towccls (
qse_wcint_t c,
qse_wccls_id_t type
qse_wccls_id_t type
);
int qse_getwcclsidbyname (
const qse_wchar_t* name,
qse_wccls_id_t* id
);
int qse_getwcclsidbyxname (
const qse_wchar_t* name,
qse_size_t len,
qse_wccls_id_t* id
);
qse_wccls_id_t qse_getwcclsid (
const qse_wchar_t* name
);
int qse_getmcclsidbyname (
const qse_mchar_t* name,
qse_mccls_id_t* id
);
int qse_getmcclsidbyxname (
const qse_mchar_t* name,
qse_size_t len,
qse_mccls_id_t* id
);
qse_mccls_id_t qse_getmcclsid (
const qse_mchar_t* name
);
#ifdef QSE_CHAR_IS_MCHAR
# define qse_ccls_is(c,type) qse_mccls_is(c,type);
# define qse_ccls_to(c,type) qse_mccls_to(c,type);
# define qse_isccls(c,type) qse_ismccls(c,type)
# define qse_toccls(c,type) qse_tomccls(c,type)
# define qse_getcclsidbyname(name,id) qse_getmcclsidbyname(name,id)
# define qse_getcclsidbyxname(name,len,id) qse_getmcclsidbyxname(name,len,id)
# define qse_getcclsid(name) qse_getmcclsid(name)
#else
# define qse_ccls_is(c,type) qse_wccls_is(c,type);
# define qse_ccls_to(c,type) qse_wccls_to(c,type);
# define qse_isccls(c,type) qse_iswccls(c,type)
# define qse_toccls(c,type) qse_towccls(c,type)
# define qse_getcclsidbyname(name,id) qse_getwcclsidbyname(name,id)
# define qse_getcclsidbyxname(name,len,id) qse_getwcclsidbyxname(name,len,id)
# define qse_getcclsid(name) qse_getwcclsid(name)
#endif
qse_size_t qse_mbrlen (
const qse_mchar_t* mb,
qse_size_t mblen,
qse_mbstate_t* state
);
qse_size_t qse_mbrtowc (
const qse_mchar_t* mb,
qse_size_t mblen,
qse_wchar_t* wc,
qse_mbstate_t* state
);
qse_size_t qse_wcrtomb (
qse_wchar_t wc,
qse_mchar_t* mb,
qse_size_t mblen,
qse_mbstate_t* state
);
/**
* The qse_mblen() function scans a multibyte sequence to get the number of
* bytes needed to form a wide character. It does not scan more than @a mblen
@ -199,6 +261,8 @@ qse_wcint_t qse_wccls_to (
* @return number of bytes processed on success,
* 0 for invalid sequences,
* mblen + 1 for incomplete sequences
* @note This function can not handle conversion producing non-initial
* states. For each call, it assumes initial state.
*/
qse_size_t qse_mblen (
const qse_mchar_t* mb,
@ -210,6 +274,8 @@ qse_size_t qse_mblen (
* It returns 0 if an invalid multibyte sequence is detected, mblen + 1 if the
* sequence is incomplete. It returns the number of bytes processed to form a
* wide character.
* @note This function can not handle conversion producing non-initial
* states. For each call, it assumes initial state.
*/
qse_size_t qse_mbtowc (
const qse_mchar_t* mb,
@ -222,6 +288,8 @@ qse_size_t qse_mbtowc (
* It returns 0 if the wide character is illegal, mblen + 1 if mblen is not
* large enough to hold the multibyte sequence. On successful conversion, it
* returns the number of bytes in the sequence.
* @note This function can not handle conversion producing non-initial
* states. For each call, it assumes initial state.
*/
qse_size_t qse_wctomb (
qse_wchar_t wc,
@ -229,6 +297,14 @@ qse_size_t qse_wctomb (
qse_size_t mblen
);
/**
* The qse_getmbcurmax() function returns the value of MB_CUR_MAX.
* Note that QSE_MBLEN_MAX defines MB_LEN_MAX.
*/
int qse_getmbcurmax (
void
);
#ifdef __cplusplus
}
#endif

View File

@ -260,6 +260,11 @@ void* qse_fma_alloc (
qse_size_t size /**< block size in bytes*/
);
void* qse_fma_calloc (
qse_fma_t* fma,
qse_size_t size
);
/**
* The qse_fma_realloc() function is provided for consistency with other
* generic memory allocator which provides a reallocation function.

View File

@ -1,5 +1,5 @@
/*
* $Id: tio.h 547 2011-08-13 16:04:14Z hyunghwan.chung $
* $Id: tio.h 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -27,6 +27,7 @@
#include <qse/types.h>
#include <qse/macros.h>
#include <qse/cmn/chr.h>
#include <qse/cmn/str.h>
enum qse_tio_errnum_t
@ -97,13 +98,21 @@ struct qse_tio_t
void* output_arg;
/* for housekeeping */
int input_status;
qse_size_t inbuf_curp;
qse_size_t inbuf_len;
qse_size_t outbuf_len;
int input_status;
qse_size_t inbuf_curp;
qse_size_t inbuf_len;
qse_size_t outbuf_len;
qse_mchar_t inbuf[QSE_TIO_MAX_INBUF_LEN];
qse_mchar_t outbuf[QSE_TIO_MAX_OUTBUF_LEN];
#ifdef QSE_CHAR_IS_WCHAR
struct
{
qse_mbstate_t in;
qse_mbstate_t out;
} mbstate;
#endif
};
#ifdef __cplusplus

View File

@ -175,6 +175,11 @@ void* qse_xma_alloc (
qse_size_t size /**< size in bytes */
);
void* qse_xma_calloc (
qse_xma_t* xma,
qse_size_t size
);
/**
* The qse_xma_alloc() function resizes the memory block @a b to @a size bytes.
* @return pointer to a resized memory block on success, #QSE_NULL on failure

View File

@ -75,6 +75,9 @@
# define QSE_SIZEOF_OFF64_T 0
# define QSE_SIZEOF_OFF_T 4
#
# define QSE_SIZEOF_MBSTATE_T QSE_SIZEOF_LONG
# define QSE_MBLEN_MAX 16
#
# define QSE_CHAR_IS_WCHAR
#else
# error Define the size of various data types.

View File

@ -1,5 +1,5 @@
/*
* $Id: conf_msw.h 441 2011-04-22 14:28:43Z hyunghwan.chung $
* $Id: conf_msw.h 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -70,6 +70,9 @@ _M_X64 x64 platform
# define QSE_SIZEOF_OFF64_T 0
# define QSE_SIZEOF_OFF_T 8
#
# define QSE_SIZEOF_MBSTATE_T QSE_SIZEOF_LONG
# define QSE_MBLEN_MAX 16
#
# define QSE_CHAR_IS_WCHAR
#elif defined(__GNUC__) || defined(__DMC__) || defined(__POCC__)
# define QSE_SIZEOF_CHAR 1
@ -97,6 +100,9 @@ _M_X64 x64 platform
# define QSE_SIZEOF_OFF64_T 0
# define QSE_SIZEOF_OFF_T 8
#
# define QSE_SIZEOF_MBSTATE_T QSE_SIZEOF_LONG
# define QSE_MBLEN_MAX 16
#
# define QSE_CHAR_IS_WCHAR
#elif defined(_MSC_VER)
# define QSE_SIZEOF_CHAR 1
@ -128,6 +134,9 @@ _M_X64 x64 platform
# define QSE_SIZEOF_OFF64_T 0
# define QSE_SIZEOF_OFF_T 8
#
# define QSE_SIZEOF_MBSTATE_T QSE_SIZEOF_LONG
# define QSE_MBLEN_MAX 16
#
# define QSE_CHAR_IS_WCHAR
#else
# error Define the size of various data types.

View File

@ -52,6 +52,12 @@
# define QSE_SIZEOF_OFF64_T 0
# define QSE_SIZEOF_OFF_T 8
#
/* I don't know the exact mbstate size.
* but this should be large enough */
# define QSE_SIZEOF_MBSTATE_T QSE_SIZEOF_LONG
/* TODO: check the exact value */
# define QSE_MBLEN_MAX 16
#
# define QSE_CHAR_IS_WCHAR
#else
# error Define the size of various data types.

View File

@ -72,6 +72,15 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `isblank' function. */
#undef HAVE_ISBLANK
/* Define to 1 if you have the `iswblank' function. */
#undef HAVE_ISWBLANK
/* Define to 1 if you have the `iswctype' function. */
#undef HAVE_ISWCTYPE
/* Define to 1 if you have the `log' function. */
#undef HAVE_LOG
@ -241,6 +250,9 @@
*/
#undef LT_OBJDIR
/* The size of `MB_LEN_MAX', as computed by valueof. */
#undef NUMVALOF_MB_LEN_MAX
/* Name of package */
#undef PACKAGE
@ -281,7 +293,10 @@
/* Unknown Endian */
#undef QSE_ENDIAN_UNKNOWN
/* Author's contact */
/* MB_LEN_MAX */
#undef QSE_MBLEN_MAX
/* Author */
#undef QSE_PACKAGE_AUTHOR
/* package name */
@ -323,6 +338,9 @@
/* sizeof(long long) */
#undef QSE_SIZEOF_LONG_LONG
/* sizeof(mbstate_t) */
#undef QSE_SIZEOF_MBSTATE_T
/* sizeof(off64_t) */
#undef QSE_SIZEOF_OFF64_T
@ -380,6 +398,9 @@
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `mbstate_t', as computed by sizeof. */
#undef SIZEOF_MBSTATE_T
/* The size of `off64_t', as computed by sizeof. */
#undef SIZEOF_OFF64_T

View File

@ -38,10 +38,11 @@ subdir = include/qse/cut
DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -37,10 +37,11 @@ subdir = include/qse/net
DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ subdir = include/qse/sed
DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -37,10 +37,11 @@ subdir = include/qse/stx
DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -36,10 +36,11 @@ host_triplet = @host@
subdir = lib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ host_triplet = @host@
subdir = lib/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -1,5 +1,5 @@
/*
* $Id: parse.c 551 2011-08-15 13:52:48Z hyunghwan.chung $
* $Id: parse.c 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -5909,9 +5909,11 @@ retry:
{
/* not handled yet */
if (c == QSE_T('\0'))
{
SETERR_ARG_LOC (
awk, QSE_AWK_ELXCHR,
QSE_T("<NUL>"), 5, &tok->loc);
}
else
{
qse_char_t cc = (qse_char_t)c;

View File

@ -38,10 +38,11 @@ host_triplet = @host@
subdir = lib/cmn
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -1,5 +1,5 @@
/*
* $Id: chr.c 441 2011-04-22 14:28:43Z hyunghwan.chung $
* $Id: chr.c 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -19,61 +19,80 @@
*/
#include <qse/cmn/chr.h>
#include <qse/cmn/str.h>
#include <ctype.h>
#include <wctype.h>
static qse_bool_t is_mupper (qse_mcint_t c) { return isupper(c); }
static qse_bool_t is_mlower (qse_mcint_t c) { return islower(c); }
static qse_bool_t is_malpha (qse_mcint_t c) { return isalpha(c); }
static qse_bool_t is_mdigit (qse_mcint_t c) { return isdigit(c); }
static qse_bool_t is_mxdigit (qse_mcint_t c) { return isxdigit(c); }
static qse_bool_t is_malnum (qse_mcint_t c) { return isalnum(c); }
static qse_bool_t is_mspace (qse_mcint_t c) { return isspace(c); }
static qse_bool_t is_mprint (qse_mcint_t c) { return isprint(c); }
static qse_bool_t is_mgraph (qse_mcint_t c) { return isgraph(c); }
static qse_bool_t is_mblank (qse_mcint_t c)
{
#ifdef HAVE_ISBLANK
return isblank(c);
#else
return c == QSE_MT(' ') || c == QSE_MT('\t');
#endif
}
static qse_bool_t is_mcntrl (qse_mcint_t c) { return iscntrl(c); }
static qse_bool_t is_mdigit (qse_mcint_t c) { return isdigit(c); }
static qse_bool_t is_mgraph (qse_mcint_t c) { return isgraph(c); }
static qse_bool_t is_mlower (qse_mcint_t c) { return islower(c); }
static qse_bool_t is_mprint (qse_mcint_t c) { return isprint(c); }
static qse_bool_t is_mpunct (qse_mcint_t c) { return ispunct(c); }
static qse_bool_t is_mspace (qse_mcint_t c) { return isspace(c); }
static qse_bool_t is_mupper (qse_mcint_t c) { return isupper(c); }
static qse_bool_t is_mxdigit (qse_mcint_t c) { return isxdigit(c); }
static qse_bool_t is_wupper (qse_wcint_t c) { return iswupper(c); }
static qse_bool_t is_wlower (qse_wcint_t c) { return iswlower(c); }
static qse_bool_t is_walpha (qse_wcint_t c) { return iswalpha(c); }
static qse_bool_t is_wdigit (qse_wcint_t c) { return iswdigit(c); }
static qse_bool_t is_wxdigit (qse_wcint_t c) { return iswxdigit(c); }
static qse_bool_t is_walnum (qse_wcint_t c) { return iswalnum(c); }
static qse_bool_t is_wspace (qse_wcint_t c) { return iswspace(c); }
static qse_bool_t is_wprint (qse_wcint_t c) { return iswprint(c); }
static qse_bool_t is_wgraph (qse_wcint_t c) { return iswgraph(c); }
static qse_bool_t is_wblank (qse_wcint_t c)
{
#ifdef HAVE_ISWBLANK
return iswblank(c);
#else
return c == QSE_WT(' ') || c == QSE_WT('\t');
#endif
}
static qse_bool_t is_wcntrl (qse_wcint_t c) { return iswcntrl(c); }
static qse_bool_t is_wdigit (qse_wcint_t c) { return iswdigit(c); }
static qse_bool_t is_wgraph (qse_wcint_t c) { return iswgraph(c); }
static qse_bool_t is_wlower (qse_wcint_t c) { return iswlower(c); }
static qse_bool_t is_wprint (qse_wcint_t c) { return iswprint(c); }
static qse_bool_t is_wpunct (qse_wcint_t c) { return iswpunct(c); }
static qse_bool_t is_wspace (qse_wcint_t c) { return iswspace(c); }
static qse_bool_t is_wupper (qse_wcint_t c) { return iswupper(c); }
static qse_bool_t is_wxdigit (qse_wcint_t c) { return iswxdigit(c); }
qse_bool_t qse_mccls_is (qse_mcint_t c, qse_mccls_id_t type)
qse_bool_t qse_ismccls (qse_mcint_t c, qse_mccls_id_t type)
{
/* TODO: use GetStringTypeW/A for WIN32 to implement these */
static qse_bool_t (*f[]) (qse_mcint_t) =
{
is_mupper,
is_mlower,
is_malpha,
is_mdigit,
is_mxdigit,
is_malnum,
is_mspace,
is_mprint,
is_mgraph,
is_malpha,
is_mblank,
is_mcntrl,
is_mpunct
is_mdigit,
is_mgraph,
is_mlower,
is_mprint,
is_mpunct,
is_mspace,
is_mupper,
is_mxdigit
};
QSE_ASSERTX (type >= QSE_MCCLS_UPPER && type <= QSE_MCCLS_PUNCT,
QSE_ASSERTX (type >= QSE_WCCLS_ALNUM && type <= QSE_WCCLS_XDIGIT,
"The character type should be one of qse_mccls_id_t values");
return f[type] (c);
return f[type-1] (c);
}
qse_mcint_t qse_mccls_to (qse_mcint_t c, qse_mccls_id_t type)
qse_mcint_t qse_tomccls (qse_mcint_t c, qse_mccls_id_t type)
{
QSE_ASSERTX (type >= QSE_MCCLS_UPPER && type <= QSE_MCCLS_LOWER,
QSE_ASSERTX (type == QSE_MCCLS_UPPER || type == QSE_MCCLS_LOWER,
"The character type should be one of QSE_MCCLS_UPPER and QSE_MCCLS_LOWER");
if (type == QSE_MCCLS_UPPER) return toupper(c);
@ -81,7 +100,7 @@ qse_mcint_t qse_mccls_to (qse_mcint_t c, qse_mccls_id_t type)
return c;
}
qse_bool_t qse_wccls_is (qse_wcint_t c, qse_wccls_id_t type)
qse_bool_t qse_iswccls (qse_wcint_t c, qse_wccls_id_t type)
{
/*
#ifdef HAVE_WCTYPE
@ -124,28 +143,29 @@ qse_bool_t qse_wccls_is (qse_wcint_t c, qse_wccls_id_t type)
*/
static qse_bool_t (*f[]) (qse_wcint_t) =
{
is_wupper,
is_wlower,
is_walpha,
is_wdigit,
is_wxdigit,
is_walnum,
is_wspace,
is_wprint,
is_wgraph,
is_walpha,
is_wblank,
is_wcntrl,
is_wpunct
is_wdigit,
is_wgraph,
is_wlower,
is_wprint,
is_wpunct,
is_wspace,
is_wupper,
is_wxdigit
};
QSE_ASSERTX (type >= QSE_WCCLS_UPPER && type <= QSE_WCCLS_PUNCT,
QSE_ASSERTX (type >= QSE_WCCLS_ALNUM && type <= QSE_WCCLS_XDIGIT,
"The character type should be one of qse_wccls_id_t values");
return f[type] (c);
return f[type-1] (c);
/*
#endif
*/
}
qse_wcint_t qse_wccls_to (qse_wcint_t c, qse_wccls_id_t type)
qse_wcint_t qse_towccls (qse_wcint_t c, qse_wccls_id_t type)
{
/*
#ifdef HAVE_WCTRANS
@ -168,11 +188,189 @@ qse_wcint_t qse_wccls_to (qse_wcint_t c, qse_wccls_id_t type)
return towctrans (c, desc[type]);
#else
*/
QSE_ASSERTX (type >= QSE_WCCLS_UPPER && type <= QSE_WCCLS_LOWER,
QSE_ASSERTX (type == QSE_WCCLS_UPPER || type == QSE_WCCLS_LOWER,
"The type should be one of QSE_WCCLS_UPPER and QSE_WCCLS_LOWER");
return (type == QSE_CCLS_UPPER)? towupper(c): towlower(c);
if (type == QSE_WCCLS_UPPER) return towupper(c);
if (type == QSE_WCCLS_LOWER) return towlower(c);
return c;
/*
#endif
*/
}
static struct wtab_t
{
const qse_wchar_t* name;
int class;
} wtab[] =
{
{ QSE_WT("alnum"), QSE_WCCLS_ALNUM },
{ QSE_WT("alpha"), QSE_WCCLS_ALPHA },
{ QSE_WT("blank"), QSE_WCCLS_BLANK },
{ QSE_WT("cntrl"), QSE_WCCLS_CNTRL },
{ QSE_WT("digit"), QSE_WCCLS_DIGIT },
{ QSE_WT("graph"), QSE_WCCLS_GRAPH },
{ QSE_WT("lower"), QSE_WCCLS_LOWER },
{ QSE_WT("print"), QSE_WCCLS_PRINT },
{ QSE_WT("punct"), QSE_WCCLS_PUNCT },
{ QSE_WT("space"), QSE_WCCLS_SPACE },
{ QSE_WT("upper"), QSE_WCCLS_UPPER },
{ QSE_WT("xdigit"), QSE_WCCLS_XDIGIT }
};
int qse_getwcclsidbyname (const qse_wchar_t* name, qse_wccls_id_t* id)
{
int left = 0, right = QSE_COUNTOF(wtab) - 1, mid;
while (left <= right)
{
int n;
struct wtab_t* kwp;
mid = (left + right) / 2;
kwp = &wtab[mid];
n = qse_wcscmp (name, wtab->name);
if (n > 0)
{
/* if left, right, mid were of qse_size_t,
* you would need the following line.
if (mid == 0) break;
*/
right = mid - 1;
}
else if (n < 0) left = mid + 1;
else
{
*id = kwp->class;
return 0;
}
}
return -1;
}
int qse_getwcclsidbyxname (const qse_wchar_t* name, qse_size_t len, qse_wccls_id_t* id)
{
int left = 0, right = QSE_COUNTOF(wtab) - 1, mid;
while (left <= right)
{
int n;
struct wtab_t* kwp;
mid = (left + right) / 2;
kwp = &wtab[mid];
n = qse_wcsxcmp (name, len, wtab->name);
if (n > 0)
{
/* if left, right, mid were of qse_size_t,
* you would need the following line.
if (mid == 0) break;
*/
right = mid - 1;
}
else if (n < 0) left = mid + 1;
else
{
*id = kwp->class;
return 0;
}
}
return -1;
}
qse_wccls_id_t qse_getwcclsid (const qse_wchar_t* name)
{
qse_wccls_id_t id;
return (qse_getwcclsidbyname(name,&id) <= -1)? ((qse_wccls_id_t)0): id;
}
static struct mtab_t
{
const qse_mchar_t* name;
int class;
} mtab[] =
{
{ QSE_MT("alnum"), QSE_MCCLS_ALNUM },
{ QSE_MT("alpha"), QSE_MCCLS_ALPHA },
{ QSE_MT("blank"), QSE_MCCLS_BLANK },
{ QSE_MT("cntrl"), QSE_MCCLS_CNTRL },
{ QSE_MT("digit"), QSE_MCCLS_DIGIT },
{ QSE_MT("graph"), QSE_MCCLS_GRAPH },
{ QSE_MT("lower"), QSE_MCCLS_LOWER },
{ QSE_MT("print"), QSE_MCCLS_PRINT },
{ QSE_MT("punct"), QSE_MCCLS_PUNCT },
{ QSE_MT("space"), QSE_MCCLS_SPACE },
{ QSE_MT("upper"), QSE_MCCLS_UPPER },
{ QSE_MT("xdigit"), QSE_MCCLS_XDIGIT },
{ QSE_NULL, 0 }
};
int qse_getmcclsidbyname (const qse_mchar_t* name, qse_mccls_id_t* id)
{
int left = 0, right = QSE_COUNTOF(mtab) - 1, mid;
while (left <= right)
{
int n;
struct mtab_t* kwp;
mid = (left + right) / 2;
kwp = &mtab[mid];
n = qse_mbscmp (name, mtab->name);
if (n > 0)
{
/* if left, right, mid were of qse_size_t,
* you would need the following line.
if (mid == 0) break;
*/
right = mid - 1;
}
else if (n < 0) left = mid + 1;
else
{
*id = kwp->class;
return 0;
}
}
return (qse_mccls_id_t)0;
}
int qse_getmcclsidbyxname (const qse_mchar_t* name, qse_size_t len, qse_mccls_id_t* id)
{
int left = 0, right = QSE_COUNTOF(mtab) - 1, mid;
while (left <= right)
{
int n;
struct mtab_t* kwp;
mid = (left + right) / 2;
kwp = &mtab[mid];
n = qse_mbsxcmp (name, len, mtab->name);
if (n > 0)
{
/* if left, right, mid were of qse_size_t,
* you would need the following line.
if (mid == 0) break;
*/
right = mid - 1;
}
else if (n < 0) left = mid + 1;
else
{
*id = kwp->class;
return 0;
}
}
return (qse_mccls_id_t)0;
}
qse_mccls_id_t qse_getmcclsid (const qse_mchar_t* name)
{
qse_mccls_id_t id;
return (qse_getmcclsidbyname(name,&id) <= -1)? ((qse_mccls_id_t)0): id;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: chr_cnv.c 451 2011-05-03 14:00:38Z hyunghwan.chung $
* $Id: chr_cnv.c 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -38,22 +38,22 @@
# include <stdlib.h>
#endif
qse_size_t qse_mblen (const qse_mchar_t* mb, qse_size_t mblen)
qse_size_t qse_mbrlen (
const qse_mchar_t* mb, qse_size_t mbl, qse_mbstate_t* state)
{
#ifdef HAVE_MBRLEN
size_t n;
mbstate_t mbs = { 0 };
n = mbrlen (mb, mblen, &mbs);
n = mbrlen (mb, mbl, (mbstate_t*)state);
if (n == 0) return 1; /* a null character */
if (n == (size_t)-1) return 0; /* invalid sequence */
if (n == (size_t)-2) return mblen + 1; /* incomplete sequence */
if (n == (size_t)-2) return mbl + 1; /* incomplete sequence */
return (qse_size_t)n;
#if 0
n = mblen (mb, mblen, &mbs);
n = mblen (mb, mbl);
if (n == 0) return 1; /* a null character */
if (n == (size_t)-1) return 0; /* invalid or incomplete sequence */
return (qse_size_t)n;
@ -63,13 +63,14 @@ qse_size_t qse_mblen (const qse_mchar_t* mb, qse_size_t mblen)
#endif
}
qse_size_t qse_mbtowc (const qse_mchar_t* mb, qse_size_t mblen, qse_wchar_t* wc)
qse_size_t qse_mbrtowc (
const qse_mchar_t* mb, qse_size_t mbl,
qse_wchar_t* wc, qse_mbstate_t* state)
{
#ifdef HAVE_MBRTOWC
size_t n;
mbstate_t mbs = { 0 };
n = mbrtowc (wc, mb, mblen, &mbs);
n = mbrtowc (wc, mb, mbl, (mbstate_t*)state);
if (n == 0)
{
*wc = QSE_WT('\0');
@ -77,51 +78,38 @@ qse_size_t qse_mbtowc (const qse_mchar_t* mb, qse_size_t mblen, qse_wchar_t* wc)
}
if (n == (size_t)-1) return 0; /* invalid sequence */
if (n == (size_t)-2) return mblen + 1; /* incomplete sequence */
if (n == (size_t)-2) return mbl + 1; /* incomplete sequence */
return (qse_size_t)n;
#else
#error #### NOT SUPPORTED ####
#endif
}
qse_size_t qse_wctomb (qse_wchar_t wc, qse_mchar_t* mb, qse_size_t mblen)
qse_size_t qse_wcrtomb (
qse_wchar_t wc, qse_mchar_t* mb,
qse_size_t mbl, qse_mbstate_t* state)
{
#ifdef HAVE_WCRTOMB
size_t n;
mbstate_t mbs = { 0 };
/* man mbsinit
* For 8-bit encodings, all states are equivalent to the initial state.
* For multibyte encodings like UTF-8, EUC-*, BIG5 or SJIS, the wide char
* acter to multibyte conversion functions never produce non-initial
* states, but the multibyte to wide-character conversion functions like
* mbrtowc(3) do produce non-initial states when interrupted in the middle
* of a character.
*/
#ifdef _SCO_DS
/* SCO defines MB_CUR_MAX as shown below:
* extern unsigned char __ctype[];
* #define MB_CUR_MAX ((int)__ctype[520])
* Some hacks are needed for compilation with a C89 compiler. */
# undef MB_CUR_MAX
# define MB_CUR_MAX 32
#endif
if (mblen < MB_CUR_MAX)
if (mbl < QSE_MBLEN_MAX)
{
qse_mchar_t buf[MB_CUR_MAX];
/* the buffer given is too small. try conversion on
* a temporary buffer large enough to handle all locales
* and copy the result to the original buffer.
*/
qse_mchar_t buf[QSE_MBLEN_MAX];
n = wcrtomb (buf, wc, &mbs);
if (n > mblen) return mblen + 1; /* buffer to small */
n = wcrtomb (buf, wc, (mbstate_t*)state);
if (n > mbl) return mbl + 1; /* buffer to small */
if (n == (size_t)-1) return 0; /* illegal character */
QSE_MEMCPY (mb, buf, mblen);
QSE_MEMCPY (mb, buf, mbl);
}
else
{
n = wcrtomb (mb, wc, &mbs);
if (n > mblen) return mblen + 1; /* buffer to small */
n = wcrtomb (mb, wc, (mbstate_t*)state);
if (n > mbl) return mbl + 1; /* buffer to small */
if (n == (size_t)-1) return 0; /* illegal character */
}
@ -131,3 +119,33 @@ qse_size_t qse_wctomb (qse_wchar_t wc, qse_mchar_t* mb, qse_size_t mblen)
#endif
}
/* man mbsinit
* For 8-bit encodings, all states are equivalent to the initial state.
* For multibyte encodings like UTF-8, EUC-*, BIG5 or SJIS, the wide char
* acter to multibyte conversion functions never produce non-initial
* states, but the multibyte to wide-character conversion functions like
* mbrtowc(3) do produce non-initial states when interrupted in the middle
* of a character.
*/
qse_size_t qse_mblen (const qse_mchar_t* mb, qse_size_t mbl)
{
qse_mbstate_t state = { { 0, } };
return qse_mbrlen (mb, mbl, &state);
}
qse_size_t qse_mbtowc (const qse_mchar_t* mb, qse_size_t mbl, qse_wchar_t* wc)
{
qse_mbstate_t state = { { 0, } };
return qse_mbrtowc (mb, mbl, wc, &state);
}
qse_size_t qse_wctomb (qse_wchar_t wc, qse_mchar_t* mb, qse_size_t mbl)
{
qse_mbstate_t state = { { 0, } };
return qse_wcrtomb (wc, mb, mbl, &state);
}
int qse_mbcurmax (void)
{
return MB_CUR_MAX;
}

View File

@ -139,6 +139,13 @@ void* qse_fma_alloc (qse_fma_t* fma, qse_size_t size)
return blk;
}
void* qse_fma_calloc (qse_fma_t* fma, qse_size_t size)
{
void* ptr = qse_fma_alloc (fma, size);
if (size) QSE_MEMSET (ptr, 0, size);
return ptr;
}
void* qse_fma_realloc (qse_fma_t* fma, void* blk, qse_size_t size)
{
if (blk)

View File

@ -380,46 +380,46 @@ static void adjust (rbt_t* rbt, pair_t* pair)
{
while (pair != rbt->root)
{
pair_t* tmp, * tmp2, * xpar;
pair_t* tmp, * tmp2, * x_par;
int leftwise;
xpar = pair->parent;
if (xpar->color == QSE_RBT_BLACK) break;
x_par = pair->parent;
if (x_par->color == QSE_RBT_BLACK) break;
QSE_ASSERT (xpar->parent != QSE_NULL);
QSE_ASSERT (x_par->parent != QSE_NULL);
if (xpar == xpar->parent->child[LEFT])
if (x_par == x_par->parent->child[LEFT])
{
tmp = xpar->parent->child[RIGHT];
tmp2 = xpar->child[RIGHT];
tmp = x_par->parent->child[RIGHT];
tmp2 = x_par->child[RIGHT];
leftwise = 1;
}
else
{
tmp = xpar->parent->child[LEFT];
tmp2 = xpar->child[LEFT];
tmp = x_par->parent->child[LEFT];
tmp2 = x_par->child[LEFT];
leftwise = 0;
}
if (tmp->color == QSE_RBT_RED)
{
xpar->color = QSE_RBT_BLACK;
x_par->color = QSE_RBT_BLACK;
tmp->color = QSE_RBT_BLACK;
xpar->parent->color = QSE_RBT_RED;
pair = xpar->parent;
x_par->parent->color = QSE_RBT_RED;
pair = x_par->parent;
}
else
{
if (pair == tmp2)
{
pair = xpar;
pair = x_par;
rotate (rbt, pair, leftwise);
xpar = pair->parent;
x_par = pair->parent;
}
xpar->color = QSE_RBT_BLACK;
xpar->parent->color = QSE_RBT_RED;
rotate (rbt, xpar->parent, !leftwise);
x_par->color = QSE_RBT_BLACK;
x_par->parent->color = QSE_RBT_RED;
rotate (rbt, x_par->parent, !leftwise);
}
}
}
@ -510,24 +510,24 @@ static pair_t* change_pair_val (
static pair_t* insert (
rbt_t* rbt, void* kptr, size_t klen, void* vptr, size_t vlen, int opt)
{
pair_t* xcur = rbt->root;
pair_t* xpar = QSE_NULL;
pair_t* xnew;
pair_t* x_cur = rbt->root;
pair_t* x_par = QSE_NULL;
pair_t* x_new;
while (!IS_NIL(rbt,xcur))
while (!IS_NIL(rbt,x_cur))
{
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(xcur), KLEN(xcur));
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(x_cur), KLEN(x_cur));
if (n == 0)
{
switch (opt)
{
case UPSERT:
case UPDATE:
return change_pair_val (rbt, xcur, vptr, vlen);
return change_pair_val (rbt, x_cur, vptr, vlen);
case ENSERT:
/* return existing pair */
return xcur;
return x_cur;
case INSERT:
/* return failure */
@ -535,44 +535,44 @@ static pair_t* insert (
}
}
xpar = xcur;
x_par = x_cur;
if (n > 0) xcur = xcur->right;
else /* if (n < 0) */ xcur = xcur->left;
if (n > 0) x_cur = x_cur->right;
else /* if (n < 0) */ x_cur = x_cur->left;
}
if (opt == UPDATE) return QSE_NULL;
xnew = qse_rbt_allocpair (rbt, kptr, klen, vptr, vlen);
if (xnew == QSE_NULL) return QSE_NULL;
x_new = qse_rbt_allocpair (rbt, kptr, klen, vptr, vlen);
if (x_new == QSE_NULL) return QSE_NULL;
if (xpar == QSE_NULL)
if (x_par == QSE_NULL)
{
/* the tree contains no pair */
QSE_ASSERT (rbt->root == &rbt->nil);
rbt->root = xnew;
rbt->root = x_new;
}
else
{
/* perform normal binary insert */
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(xpar), KLEN(xpar));
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(x_par), KLEN(x_par));
if (n > 0)
{
QSE_ASSERT (xpar->right == &rbt->nil);
xpar->right = xnew;
QSE_ASSERT (x_par->right == &rbt->nil);
x_par->right = x_new;
}
else
{
QSE_ASSERT (xpar->left == &rbt->nil);
xpar->left = xnew;
QSE_ASSERT (x_par->left == &rbt->nil);
x_par->left = x_new;
}
xnew->parent = xpar;
adjust (rbt, xnew);
x_new->parent = x_par;
adjust (rbt, x_new);
}
rbt->root->color = QSE_RBT_BLACK;
return xnew;
return x_new;
}
pair_t* qse_rbt_upsert (
@ -603,95 +603,95 @@ pair_t* qse_rbt_update (
pair_t* qse_rbt_cbsert (
rbt_t* rbt, void* kptr, size_t klen, cbserter_t cbserter, void* ctx)
{
pair_t* xcur = rbt->root;
pair_t* xpar = QSE_NULL;
pair_t* xnew;
pair_t* x_cur = rbt->root;
pair_t* x_par = QSE_NULL;
pair_t* x_new;
while (!IS_NIL(rbt,xcur))
while (!IS_NIL(rbt,x_cur))
{
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(xcur), KLEN(xcur));
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(x_cur), KLEN(x_cur));
if (n == 0)
{
/* back up the contents of the current pair
* in case it is reallocated */
pair_t tmp = *xcur;
pair_t tmp = *x_cur;
/* call the callback function to manipulate the pair */
xnew = cbserter (rbt, xcur, kptr, klen, ctx);
if (xnew == QSE_NULL)
x_new = cbserter (rbt, x_cur, kptr, klen, ctx);
if (x_new == QSE_NULL)
{
/* error returned by the callback function */
return QSE_NULL;
}
if (xnew != xcur)
if (x_new != x_cur)
{
/* the current pair has been reallocated, which implicitly
* means the previous contents were wiped out. so the contents
* backed up will be used for restoration/migration */
xnew->color = tmp.color;
xnew->left = tmp.left;
xnew->right = tmp.right;
xnew->parent = tmp.parent;
x_new->color = tmp.color;
x_new->left = tmp.left;
x_new->right = tmp.right;
x_new->parent = tmp.parent;
if (tmp.parent)
{
if (tmp.parent->left == xcur)
if (tmp.parent->left == x_cur)
{
tmp.parent->left = xnew;
tmp.parent->left = x_new;
}
else
{
QSE_ASSERT (tmp.parent->right == xcur);
tmp.parent->right = xnew;
QSE_ASSERT (tmp.parent->right == x_cur);
tmp.parent->right = x_new;
}
}
if (!IS_NIL(rbt,tmp.left)) tmp.left->parent = xnew;
if (!IS_NIL(rbt,tmp.right)) tmp.right->parent = xnew;
if (!IS_NIL(rbt,tmp.left)) tmp.left->parent = x_new;
if (!IS_NIL(rbt,tmp.right)) tmp.right->parent = x_new;
if (xcur == rbt->root) rbt->root = xnew;
if (x_cur == rbt->root) rbt->root = x_new;
}
return xnew;
return x_new;
}
xpar = xcur;
x_par = x_cur;
if (n > 0) xcur = xcur->right;
else /* if (n < 0) */ xcur = xcur->left;
if (n > 0) x_cur = x_cur->right;
else /* if (n < 0) */ x_cur = x_cur->left;
}
xnew = cbserter (rbt, QSE_NULL, kptr, klen, ctx);
if (xnew == QSE_NULL) return QSE_NULL;
x_new = cbserter (rbt, QSE_NULL, kptr, klen, ctx);
if (x_new == QSE_NULL) return QSE_NULL;
if (xpar == QSE_NULL)
if (x_par == QSE_NULL)
{
/* the tree contains no pair */
QSE_ASSERT (rbt->root == &rbt->nil);
rbt->root = xnew;
rbt->root = x_new;
}
else
{
/* perform normal binary insert */
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(xpar), KLEN(xpar));
int n = rbt->mancbs->comper (rbt, kptr, klen, KPTR(x_par), KLEN(x_par));
if (n > 0)
{
QSE_ASSERT (xpar->right == &rbt->nil);
xpar->right = xnew;
QSE_ASSERT (x_par->right == &rbt->nil);
x_par->right = x_new;
}
else
{
QSE_ASSERT (xpar->left == &rbt->nil);
xpar->left = xnew;
QSE_ASSERT (x_par->left == &rbt->nil);
x_par->left = x_new;
}
xnew->parent = xpar;
adjust (rbt, xnew);
x_new->parent = x_par;
adjust (rbt, x_new);
}
rbt->root->color = QSE_RBT_BLACK;
return xnew;
return x_new;
}
@ -910,65 +910,65 @@ static QSE_INLINE qse_rbt_walk_t walk_recursively (
static QSE_INLINE void walk (
rbt_t* rbt, walker_t walker, void* ctx, int l, int r)
{
pair_t* xcur = rbt->root;
pair_t* x_cur = rbt->root;
pair_t* prev = rbt->root->parent;
while (xcur && !IS_NIL(rbt,xcur))
while (x_cur && !IS_NIL(rbt,x_cur))
{
if (prev == xcur->parent)
if (prev == x_cur->parent)
{
/* the previous node is the parent of the current node.
* it indicates that we're going down to the child[l] */
if (!IS_NIL(rbt,xcur->child[l]))
if (!IS_NIL(rbt,x_cur->child[l]))
{
/* go to the child[l] child */
prev = xcur;
xcur = xcur->child[l];
prev = x_cur;
x_cur = x_cur->child[l];
}
else
{
if (walker (rbt, xcur, ctx) == QSE_RBT_WALK_STOP) break;
if (walker (rbt, x_cur, ctx) == QSE_RBT_WALK_STOP) break;
if (!IS_NIL(rbt,xcur->child[r]))
if (!IS_NIL(rbt,x_cur->child[r]))
{
/* go down to the right node if exists */
prev = xcur;
xcur = xcur->child[r];
prev = x_cur;
x_cur = x_cur->child[r];
}
else
{
/* otherwise, move up to the parent */
prev = xcur;
xcur = xcur->parent;
prev = x_cur;
x_cur = x_cur->parent;
}
}
}
else if (prev == xcur->child[l])
else if (prev == x_cur->child[l])
{
/* the left child has been already traversed */
if (walker (rbt, xcur, ctx) == QSE_RBT_WALK_STOP) break;
if (walker (rbt, x_cur, ctx) == QSE_RBT_WALK_STOP) break;
if (!IS_NIL(rbt,xcur->child[r]))
if (!IS_NIL(rbt,x_cur->child[r]))
{
/* go down to the right node if it exists */
prev = xcur;
xcur = xcur->child[r];
prev = x_cur;
x_cur = x_cur->child[r];
}
else
{
/* otherwise, move up to the parent */
prev = xcur;
xcur = xcur->parent;
prev = x_cur;
x_cur = x_cur->parent;
}
}
else
{
/* both the left child and the right child have been traversed */
QSE_ASSERT (prev == xcur->child[r]);
QSE_ASSERT (prev == x_cur->child[r]);
/* just move up to the parent */
prev = xcur;
xcur = xcur->parent;
prev = x_cur;
x_cur = x_cur->parent;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.c 471 2011-05-22 14:14:36Z hyunghwan.chung $
* $Id: rex.c 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -497,7 +497,7 @@ struct ccinfo_t
static int cc_isalnum (exec_t* e, qse_char_t c) { return QSE_ISALNUM (c); }
static int cc_isalpha (exec_t* e, qse_char_t c) { return QSE_ISALPHA (c); }
static int cc_isblank (exec_t* e, qse_char_t c) { return ISBLANK(c); }
static int cc_isblank (exec_t* e, qse_char_t c) { return QSE_ISBLANK(c); }
static int cc_iscntrl (exec_t* e, qse_char_t c) { return QSE_ISCNTRL (c); }
static int cc_isdigit (exec_t* e, qse_char_t c) { return QSE_ISDIGIT (c); }
static int cc_isgraph (exec_t* e, qse_char_t c) { return QSE_ISGRAPH (c); }

View File

@ -1,5 +1,5 @@
/*
* $Id: str_cnv.c 504 2011-07-11 16:31:33Z hyunghwan.chung $
* $Id: str_cnv.c 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -134,18 +134,24 @@ qse_ulong_t qse_strxtoulong (const qse_char_t* str, qse_size_t len)
return v;
}
/*
* TODO: fix wrong mbstate handling
*/
qse_size_t qse_mbstowcslen (const qse_mchar_t* mcs, qse_size_t* wcslen)
{
qse_wchar_t wc;
qse_size_t n, ml, wl = 0;
const qse_mchar_t* p = mcs;
qse_mbstate_t state = {{ 0, }};
while (*p != '\0') p++;
ml = p - mcs;
for (p = mcs; ml > 0; p += n, ml -= n)
{
n = qse_mbtowc (p, ml, &wc);
n = qse_mbrtowc (p, ml, &wc, &state);
/* insufficient input or wrong sequence */
if (n == 0 || n > ml) break;
wl++;
@ -155,15 +161,17 @@ qse_size_t qse_mbstowcslen (const qse_mchar_t* mcs, qse_size_t* wcslen)
return p - mcs;
}
qse_size_t qse_mbsntowcsnlen (const qse_mchar_t* mcs, qse_size_t mcslen, qse_size_t* wcslen)
qse_size_t qse_mbsntowcsnlen (
const qse_mchar_t* mcs, qse_size_t mcslen, qse_size_t* wcslen)
{
qse_wchar_t wc;
qse_size_t n, ml = mcslen, wl = 0;
const qse_mchar_t* p = mcs;
qse_mbstate_t state = {{ 0, }};
for (p = mcs; ml > 0; p += n, ml -= n)
{
n = qse_mbtowc (p, ml, &wc);
n = qse_mbrtowc (p, ml, &wc, &state);
/* insufficient or invalid sequence */
if (n == 0 || n > ml) break;
wl++;
@ -212,12 +220,13 @@ qse_size_t qse_mbsntowcsn (
qse_size_t mlen = mbslen, n;
const qse_mchar_t* p;
qse_wchar_t* q, * qend ;
qse_mbstate_t state = {{ 0, }};
qend = wcs + *wcslen;
for (p = mbs, q = wcs; mlen > 0 && q < qend; p += n, mlen -= n)
{
n = qse_mbtowc (p, mlen, q);
n = qse_mbrtowc (p, mlen, q, &state);
if (n == 0 || n > mlen)
{
/* wrong sequence or insufficient input */
@ -236,10 +245,11 @@ qse_size_t qse_wcstombslen (const qse_wchar_t* wcs, qse_size_t* mbslen)
const qse_wchar_t* p = wcs;
qse_mchar_t mbs[32];
qse_size_t mlen = 0;
qse_mbstate_t state = {{ 0, }};
while (*p != QSE_WT('\0'))
{
qse_size_t n = qse_wctomb (*p, mbs, QSE_COUNTOF(mbs));
qse_size_t n = qse_wcrtomb (*p, mbs, QSE_COUNTOF(mbs), &state);
if (n == 0) break; /* illegal character */
/* it assumes that mbs is large enough to hold a character */
@ -265,10 +275,11 @@ qse_size_t qse_wcsntombsnlen (
const qse_wchar_t* end = wcs + wcslen;
qse_mchar_t mbs[32];
qse_size_t mlen = 0;
qse_mbstate_t state = {{ 0, }};
while (p < end)
{
qse_size_t n = qse_wctomb (*p, mbs, QSE_COUNTOF(mbs));
qse_size_t n = qse_wcrtomb (*p, mbs, QSE_COUNTOF(mbs), &state);
if (n == 0) break; /* illegal character */
/* it assumes that mbs is large enough to hold a character */
@ -291,10 +302,11 @@ qse_size_t qse_wcstombs (
{
const qse_wchar_t* p = wcs;
qse_size_t rem = *mbslen;
qse_mbstate_t state = {{ 0, }};
while (*p != QSE_WT('\0') && rem > 1)
{
qse_size_t n = qse_wctomb (*p, mbs, rem);
qse_size_t n = qse_wcrtomb (*p, mbs, rem, &state);
if (n == 0 || n > rem)
{
/* illegal character or buffer not enough */
@ -330,10 +342,11 @@ qse_size_t qse_wcsntombsn (
const qse_wchar_t* p = wcs;
const qse_wchar_t* end = wcs + wcslen;
qse_size_t len = *mbslen;
qse_mbstate_t state = {{ 0, }};
while (p < end && len > 0)
{
qse_size_t n = qse_wctomb (*p, mbs, len);
qse_size_t n = qse_wcrtomb (*p, mbs, len, &state);
if (n == 0 || n > len)
{
/* illegal character or buffer not enough */

View File

@ -1,5 +1,5 @@
/*
* $Id: tio_get.c 441 2011-04-22 14:28:43Z hyunghwan.chung $
* $Id: tio_get.c 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -79,7 +79,8 @@ static qse_ssize_t tio_getc (qse_tio_t* tio, qse_char_t* c)
#else
left = tio->inbuf_len - tio->inbuf_curp;
n = qse_mbtowc (&tio->inbuf[tio->inbuf_curp], left, &curc);
n = qse_mbrtowc (
&tio->inbuf[tio->inbuf_curp], left, &curc, &tio->mbstate.in);
if (n == 0)
{
/* illegal sequence */

View File

@ -1,5 +1,5 @@
/*
* $Id: tio_put.c 441 2011-04-22 14:28:43Z hyunghwan.chung $
* $Id: tio_put.c 554 2011-08-22 05:26:26Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -23,9 +23,9 @@
static qse_ssize_t tio_putc (qse_tio_t* tio, qse_char_t c)
{
#ifndef QSE_CHAR_IS_MCHAR
#ifdef QSE_CHAR_IS_WCHAR
qse_size_t n, i;
qse_mchar_t mc[50];
qse_mchar_t mc[QSE_MBLEN_MAX];
#endif
if (tio->outbuf_len >= QSE_COUNTOF(tio->outbuf))
@ -38,12 +38,14 @@ static qse_ssize_t tio_putc (qse_tio_t* tio, qse_char_t c)
}
#ifdef QSE_CHAR_IS_MCHAR
tio->outbuf[tio->outbuf_len++] = c;
if (tio->outbuf_len >= QSE_COUNTOF(tio->outbuf))
return qse_tio_flush (tio);
#else
n = qse_wctomb (c, mc, QSE_COUNTOF(mc));
#else /* QSE_CHAR_IS_WCHAR */
n = qse_wcrtomb (c, mc, QSE_COUNTOF(mc), &tio->mbstate.out);
if (n == 0)
{
tio->errnum = QSE_TIO_EILCHR;
@ -63,6 +65,7 @@ static qse_ssize_t tio_putc (qse_tio_t* tio, qse_char_t c)
if (qse_tio_flush (tio) == -1) return -1;
}
}
#endif
if (c == QSE_T('\n') && tio->outbuf_len > 0)

View File

@ -521,6 +521,13 @@ static void* _realloc_merge (qse_xma_t* xma, void* b, qse_size_t size)
return b;
}
void* qse_xma_calloc (qse_xma_t* xma, qse_size_t size)
{
void* ptr = qse_xma_alloc (xma, size);
if (size) QSE_MEMSET (ptr, 0, size);
return ptr;
}
void* qse_xma_realloc (qse_xma_t* xma, void* b, qse_size_t size)
{
void* n;

View File

@ -38,10 +38,11 @@ host_triplet = @host@
subdir = lib/cut
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -167,7 +167,7 @@ void qse_cut_clear (qse_cut_t* cut)
int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
{
const qse_char_t* p = str;
const qse_char_t* xnd = str + len;
const qse_char_t* lastp = str + len;
qse_cint_t c;
int sel = QSE_SED_SEL_CHAR;
@ -189,13 +189,13 @@ int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
if (len <= 0) return 0;
/* compile the selector string */
xnd--; c = CC (p, xnd);
lastp--; c = CC (p, lastp);
while (1)
{
qse_size_t start = 0, end = 0;
int mask = 0;
while (QSE_ISSPACE(c)) c = NC (p, xnd);
while (QSE_ISSPACE(c)) c = NC (p, lastp);
if (EOF(c))
{
if (cut->sel.count > 0)
@ -212,7 +212,7 @@ int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
/* the next character is the input delimiter.
* the output delimiter defaults to the input
* delimiter. */
c = NC (p, xnd);
c = NC (p, lastp);
if (EOF(c))
{
SETERR0 (cut, QSE_CUT_ESELNV);
@ -221,13 +221,13 @@ int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
cut->sel.din = c;
cut->sel.dout = c;
c = NC (p, xnd);
c = NC (p, lastp);
}
else if (c == QSE_T('D'))
{
/* the next two characters are the input and
* the output delimiter each. */
c = NC (p, xnd);
c = NC (p, lastp);
if (EOF(c))
{
SETERR0 (cut, QSE_CUT_ESELNV);
@ -235,7 +235,7 @@ int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
}
cut->sel.din = c;
c = NC (p, xnd);
c = NC (p, lastp);
if (EOF(c))
{
SETERR0 (cut, QSE_CUT_ESELNV);
@ -243,15 +243,15 @@ int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
}
cut->sel.dout = c;
c = NC (p, xnd);
c = NC (p, lastp);
}
else
{
if (c == QSE_T('c') || c == QSE_T('f'))
{
sel = c;
c = NC (p, xnd);
while (QSE_ISSPACE(c)) c = NC (p, xnd);
c = NC (p, lastp);
while (QSE_ISSPACE(c)) c = NC (p, lastp);
}
if (QSE_ISDIGIT(c))
@ -259,33 +259,33 @@ int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
do
{
start = start * 10 + (c - QSE_T('0'));
c = NC (p, xnd);
c = NC (p, lastp);
}
while (QSE_ISDIGIT(c));
while (QSE_ISSPACE(c)) c = NC (p, xnd);
while (QSE_ISSPACE(c)) c = NC (p, lastp);
mask |= MASK_START;
}
else start++;
if (c == QSE_T('-'))
{
c = NC (p, xnd);
while (QSE_ISSPACE(c)) c = NC (p, xnd);
c = NC (p, lastp);
while (QSE_ISSPACE(c)) c = NC (p, lastp);
if (QSE_ISDIGIT(c))
{
do
{
end = end * 10 + (c - QSE_T('0'));
c = NC (p, xnd);
c = NC (p, lastp);
}
while (QSE_ISDIGIT(c));
mask |= MASK_END;
}
else end = MAX;
while (QSE_ISSPACE(c)) c = NC (p, xnd);
while (QSE_ISSPACE(c)) c = NC (p, lastp);
}
else end = start;
@ -313,7 +313,7 @@ int qse_cut_comp (qse_cut_t* cut, const qse_char_t* str, qse_size_t len)
}
if (EOF(c)) break;
if (c == QSE_T(',')) c = NC (p, xnd);
if (c == QSE_T(',')) c = NC (p, lastp);
}
return 0;

View File

@ -37,10 +37,11 @@ host_triplet = @host@
subdir = lib/net
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ host_triplet = @host@
subdir = lib/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -37,10 +37,11 @@ host_triplet = @host@
subdir = lib/stx
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

25
qse/m4/ax_numval.m4 Normal file
View File

@ -0,0 +1,25 @@
#
# This is a blindly modified variant of AC_CHECK_SIZEOF.
#
# AX_CHECK_NUMVALOF(TYPE, DEFAULT, [INCLUDES = DEFAULT-INCLUDES])
# ---------------------------------------------------------------
AC_DEFUN([AX_CHECK_NUMVALOF],
[AS_LITERAL_IF(m4_translit([[$1]], [[$2]], [p]), [],
[m4_fatal([$0: requires literal arguments])])]
[
_AC_CACHE_CHECK_INT(
[numeric value of $1],
[AS_TR_SH([ax_cv_numvalof_$1])],
[($1)],
[AC_INCLUDES_DEFAULT([$3])],
[AS_TR_SH([ax_cv_numvalof_$1])=$2])
AC_DEFINE_UNQUOTED(
AS_TR_CPP(numvalof_$1),
$AS_TR_SH([ax_cv_numvalof_$1]),
[The size of `$1', as computed by valueof.])
]
)# AX_CHECK_NUMVALOF

View File

@ -36,10 +36,11 @@ host_triplet = @host@
subdir = regress
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -1,7 +1,5 @@
AUTOMAKE_OPTIONS = no-dependencies
noinst_SCRIPTS = regress.sh
EXTRA_DIST = \
regress.out \
regress.out.xma \
@ -154,3 +152,5 @@ EXTRA_DIST = \
lisp/old-awklisp \
lisp/startup
all-local:
chmod +x $(DESTDIR)$(builddir)/regress.sh

View File

@ -14,7 +14,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@ -38,17 +37,17 @@ subdir = regress/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/regress.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES = regress.sh
CONFIG_CLEAN_VPATH_FILES =
SCRIPTS = $(noinst_SCRIPTS)
depcomp =
am__depfiles_maybe =
SOURCES =
@ -196,7 +195,6 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = no-dependencies
noinst_SCRIPTS = regress.sh
EXTRA_DIST = \
regress.out \
regress.out.xma \
@ -429,7 +427,7 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
all-am: Makefile $(SCRIPTS)
all-am: Makefile all-local
installdirs:
install: install-am
install-exec: install-exec-am
@ -524,18 +522,22 @@ uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
.PHONY: all all-am all-local check check-am clean clean-generic \
clean-libtool distclean distclean-generic distclean-libtool \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am
all-local:
chmod +x $(DESTDIR)$(builddir)/regress.sh
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -38,10 +38,11 @@ subdir = regress/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/regress.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -36,10 +36,11 @@ host_triplet = @host@
subdir = samples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -40,10 +40,11 @@ bin_PROGRAMS = awk01$(EXEEXT) awk02$(EXEEXT) awk03$(EXEEXT) \
subdir = samples/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -42,10 +42,11 @@ bin_PROGRAMS = xma$(EXEEXT) fma$(EXEEXT) pma$(EXEEXT) chr$(EXEEXT) \
subdir = samples/cmn
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ bin_PROGRAMS = cut01$(EXEEXT)
subdir = samples/cut
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -38,10 +38,11 @@ bin_PROGRAMS = http01$(EXEEXT)
subdir = samples/net
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -39,10 +39,11 @@ bin_PROGRAMS = sed01$(EXEEXT) $(am__EXEEXT_1)
subdir = samples/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d