added qse_mbsincl()/qse_wcsincl()/qse_mbsexcl()/qse_wcsexcl() and related functions

This commit is contained in:
hyung-hwan 2011-04-17 09:40:57 +00:00
parent bdc537fbdc
commit 212a71460f
8 changed files with 262 additions and 24 deletions

View File

@ -297,6 +297,17 @@ pio1 (QSE_T("ls -laF"), QSE_PIO_READOUT|QSE_PIO_WRITEIN|/*QSE_PIO_SHELL|*/QSE_PI
qse_printf (QSE_T("<%s>\n"), abc); qse_printf (QSE_T("<%s>\n"), abc);
} }
{
qse_char_t abc[100];
qse_strcpy (abc, QSE_T("abcdefghilklmnabcdefghik"));
qse_printf (QSE_T("ORIGINAL=><%s>\n"), abc);
qse_strexcl (abc, QSE_T("adfikl"));
qse_printf (QSE_T("AFTER EXCL<%s>\n"), abc);
qse_strincl (abc, QSE_T("bcmn"));
qse_printf (QSE_T("AFTER INCL<%s>\n"), abc);
}
{ {
qse_scm_ent_t* x1, * x2; qse_scm_ent_t* x1, * x2;

20
qse/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for qse 0.5.5. # Generated by GNU Autoconf 2.67 for qse 0.5.6.
# #
# Report bugs to <Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)>. # Report bugs to <Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)>.
# #
@ -701,8 +701,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='qse' PACKAGE_NAME='qse'
PACKAGE_TARNAME='qse' PACKAGE_TARNAME='qse'
PACKAGE_VERSION='0.5.5' PACKAGE_VERSION='0.5.6'
PACKAGE_STRING='qse 0.5.5' PACKAGE_STRING='qse 0.5.6'
PACKAGE_BUGREPORT='Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)' PACKAGE_BUGREPORT='Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)'
PACKAGE_URL='http://code.abiyo.net/@qse' PACKAGE_URL='http://code.abiyo.net/@qse'
@ -1454,7 +1454,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures qse 0.5.5 to adapt to many kinds of systems. \`configure' configures qse 0.5.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1524,7 +1524,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of qse 0.5.5:";; short | recursive ) echo "Configuration of qse 0.5.6:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1635,7 +1635,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
qse configure 0.5.5 qse configure 0.5.6
generated by GNU Autoconf 2.67 generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc. Copyright (C) 2010 Free Software Foundation, Inc.
@ -2357,7 +2357,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by qse $as_me 0.5.5, which was It was created by qse $as_me 0.5.6, which was
generated by GNU Autoconf 2.67. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@ $ $0 $@
@ -3183,7 +3183,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='qse' PACKAGE='qse'
VERSION='0.5.5' VERSION='0.5.6'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -17221,7 +17221,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by qse $as_me 0.5.5, which was This file was extended by qse $as_me 0.5.6, which was
generated by GNU Autoconf 2.67. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -17288,7 +17288,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
qse config.status 0.5.5 qse config.status 0.5.6
configured by $0, generated by GNU Autoconf 2.67, configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -1,7 +1,7 @@
dnl AC_PREREQ([2.67]) dnl AC_PREREQ([2.67])
AC_INIT([qse],[0.5.5],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[http://code.abiyo.net/@qse]) AC_INIT([qse],[0.5.6],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[http://code.abiyo.net/@qse])
AC_CONFIG_HEADER([include/qse/config.h]) AC_CONFIG_HEADER([include/qse/config.h])
AC_CONFIG_AUX_DIR([ac]) AC_CONFIG_AUX_DIR([ac])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])

View File

@ -1,5 +1,5 @@
/* /*
* $Id: str.h 433 2011-04-15 15:18:27Z hyunghwan.chung $ * $Id: str.h 435 2011-04-16 15:40:57Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -1432,6 +1432,67 @@ qse_size_t qse_wcsxdel (
# define qse_strxdel(str,len,pos,n) qse_wcsxdel(str,len,pos,n) # define qse_strxdel(str,len,pos,n) qse_wcsxdel(str,len,pos,n)
#endif #endif
qse_size_t qse_mbsexcl (
qse_mchar_t* str,
const qse_mchar_t* cs
);
qse_size_t qse_mbsxexcl (
qse_mchar_t* str,
qse_size_t len,
const qse_mchar_t* cs
);
qse_size_t qse_wcsexcl (
qse_wchar_t* str,
const qse_wchar_t* cs
);
qse_size_t qse_wcsxexcl (
qse_wchar_t* str,
qse_size_t len,
const qse_wchar_t* cs
);
#ifdef QSE_CHAR_IS_MCHAR
# define qse_strexcl(str,cs) qse_mbsexcl(str,cs)
# define qse_strxexcl(str,len,cs) qse_mbsxexcl(str,len,cs)
#else
# define qse_strexcl(str,cs) qse_wcsexcl(str,cs)
# define qse_strxexcl(str,len,cs) qse_wcsxexcl(str,len,cs)
#endif
qse_size_t qse_mbsincl (
qse_mchar_t* str,
const qse_mchar_t* cs
);
qse_size_t qse_mbsxincl (
qse_mchar_t* str,
qse_size_t len,
const qse_mchar_t* cs
);
qse_size_t qse_wcsincl (
qse_wchar_t* str,
const qse_wchar_t* cs
);
qse_size_t qse_wcsxincl (
qse_wchar_t* str,
qse_size_t len,
const qse_wchar_t* cs
);
#ifdef QSE_CHAR_IS_MCHAR
# define qse_strincl(str,cs) qse_mbsincl(str,cs)
# define qse_strxincl(str,len,cs) qse_mbsxincl(str,len,cs)
#else
# define qse_strincl(str,cs) qse_wcsincl(str,cs)
# define qse_strxincl(str,len,cs) qse_wcsxincl(str,len,cs)
#endif
qse_size_t qse_mbsset ( qse_size_t qse_mbsset (
qse_mchar_t* buf, qse_mchar_t* buf,
qse_mchar_t c, qse_mchar_t c,

View File

@ -10,9 +10,10 @@ libqsecmn_la_SOURCES = \
syscall.h mem.h \ syscall.h mem.h \
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \ mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
str_beg.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c \ str_beg.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c \
str_del.c str_dup.c str_dyn.c str_end.c str_fcpy.c str_len.c str_pac.c \ str_del.c str_dup.c str_dyn.c str_end.c str_excl.c str_fcpy.c \
str_pbrk.c str_put.c str_rev.c str_rot.c str_set.c str_spl.c \ str_incl.c str_len.c str_pac.c str_pbrk.c str_put.c str_rev.c \
str_spn.c str_str.c str_subst.c str_tok.c str_trm.c str_word.c \ str_rot.c str_set.c str_spl.c str_spn.c str_str.c str_subst.c \
str_tok.c str_trm.c str_word.c \
lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \ lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \
tio.c tio_get.c tio_put.c \ tio.c tio_get.c tio_put.c \
fio.c pio.c sio.c \ fio.c pio.c sio.c \

View File

@ -74,12 +74,14 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libqsecmn_la_DEPENDENCIES = libqsecmn_la_DEPENDENCIES =
am_libqsecmn_la_OBJECTS = mem.lo xma.lo fma.lo chr.lo chr_cnv.lo \ am_libqsecmn_la_OBJECTS = mem.lo xma.lo fma.lo chr.lo chr_cnv.lo \
rex.lo str_beg.lo str_cat.lo str_chr.lo str_cnv.lo str_cmp.lo \ rex.lo str_beg.lo str_cat.lo str_chr.lo str_cnv.lo str_cmp.lo \
str_cpy.lo str_del.lo str_dup.lo str_dyn.lo str_end.lo str_fcpy.lo \ str_cpy.lo str_del.lo str_dup.lo str_dyn.lo str_end.lo \
str_len.lo str_pac.lo str_pbrk.lo str_put.lo str_rev.lo str_rot.lo \ str_excl.lo str_fcpy.lo str_incl.lo str_len.lo str_pac.lo \
str_set.lo str_spl.lo str_spn.lo str_str.lo str_subst.lo str_tok.lo \ str_pbrk.lo str_put.lo str_rev.lo str_rot.lo str_set.lo \
str_trm.lo str_word.lo lda.lo oht.lo htb.lo rbt.lo sll.lo gdl.lo \ str_spl.lo str_spn.lo str_str.lo str_subst.lo str_tok.lo \
dll.lo opt.lo tio.lo tio_get.lo tio_put.lo fio.lo pio.lo sio.lo \ str_trm.lo str_word.lo lda.lo oht.lo htb.lo rbt.lo sll.lo \
alg_search.lo alg_sort.lo time.lo misc.lo assert.lo main.lo stdio.lo gdl.lo dll.lo opt.lo tio.lo tio_get.lo tio_put.lo fio.lo \
pio.lo sio.lo alg_search.lo alg_sort.lo time.lo misc.lo \
assert.lo main.lo stdio.lo
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS) libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
libqsecmn_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ libqsecmn_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@ -268,9 +270,10 @@ libqsecmn_la_SOURCES = \
syscall.h mem.h \ syscall.h mem.h \
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \ mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
str_beg.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c \ str_beg.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c \
str_del.c str_dup.c str_dyn.c str_end.c str_fcpy.c str_len.c str_pac.c \ str_del.c str_dup.c str_dyn.c str_end.c str_excl.c str_fcpy.c \
str_pbrk.c str_put.c str_rev.c str_rot.c str_set.c str_spl.c \ str_incl.c str_len.c str_pac.c str_pbrk.c str_put.c str_rev.c \
str_spn.c str_str.c str_subst.c str_tok.c str_trm.c str_word.c \ str_rot.c str_set.c str_spl.c str_spn.c str_str.c str_subst.c \
str_tok.c str_trm.c str_word.c \
lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \ lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \
tio.c tio_get.c tio_put.c \ tio.c tio_get.c tio_put.c \
fio.c pio.c sio.c \ fio.c pio.c sio.c \
@ -398,7 +401,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_dup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_dup.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_dyn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_dyn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_end.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_end.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_excl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_fcpy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_fcpy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_incl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_len.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_len.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_pac.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_pac.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_pbrk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_pbrk.Plo@am__quote@

80
qse/lib/cmn/str_excl.c Normal file
View File

@ -0,0 +1,80 @@
/*
* $Id$
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <qse/cmn/str.h>
qse_size_t qse_mbsexcl (qse_mchar_t* str, const qse_mchar_t* cs)
{
qse_mchar_t* p1, * p2;
p1 = p2 = str;
while (*p1 != QSE_MT('\0'))
{
if (qse_mbschr(cs,*p1) == QSE_NULL) *p2++ = *p1;
p1++;
}
*p2 = QSE_MT('\0');
return p2 - str;
}
qse_size_t qse_mbsxexcl (
qse_mchar_t* str, qse_size_t len, const qse_mchar_t* cs)
{
qse_mchar_t* p1, * p2, * end;
p1 = p2 = str;
end = p1 + len;
while (p1 < end)
{
if (qse_mbschr(cs,*p1) == QSE_NULL) *p2++ = *p1;
p1++;
}
return p2 - str;
}
qse_size_t qse_wcsexcl (qse_wchar_t* str, const qse_wchar_t* cs)
{
qse_wchar_t* p1, * p2;
p1 = p2 = str;
while (*p1 != QSE_WT('\0'))
{
if (qse_wcschr(cs,*p1) == QSE_NULL) *p2++ = *p1;
p1++;
}
*p2 = QSE_WT('\0');
return p2 - str;
}
qse_size_t qse_wcsxexcl (
qse_wchar_t* str, qse_size_t len, const qse_wchar_t* cs)
{
qse_wchar_t* p1, * p2, * end;
p1 = p2 = str;
end = p1 + len;
while (p1 < end)
{
if (qse_wcschr(cs,*p1) == QSE_NULL) *p2++ = *p1;
p1++;
}
return p2 - str;
}

80
qse/lib/cmn/str_incl.c Normal file
View File

@ -0,0 +1,80 @@
/*
* $Id$
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <qse/cmn/str.h>
qse_size_t qse_mbsincl (qse_mchar_t* str, const qse_mchar_t* cs)
{
qse_mchar_t* p1, * p2;
p1 = p2 = str;
while (*p1 != QSE_MT('\0'))
{
if (qse_mbschr(cs,*p1) != QSE_NULL) *p2++ = *p1;
p1++;
}
*p2 = QSE_MT('\0');
return p2 - str;
}
qse_size_t qse_mbsxincl (
qse_mchar_t* str, qse_size_t len, const qse_mchar_t* cs)
{
qse_mchar_t* p1, * p2, * end;
p1 = p2 = str;
end = p1 + len;
while (p1 < end)
{
if (qse_mbschr(cs,*p1) != QSE_NULL) *p2++ = *p1;
p1++;
}
return p2 - str;
}
qse_size_t qse_wcsincl (qse_wchar_t* str, const qse_wchar_t* cs)
{
qse_wchar_t* p1, * p2;
p1 = p2 = str;
while (*p1 != QSE_WT('\0'))
{
if (qse_wcschr(cs,*p1) != QSE_NULL) *p2++ = *p1;
p1++;
}
*p2 = QSE_WT('\0');
return p2 - str;
}
qse_size_t qse_wcsxincl (
qse_wchar_t* str, qse_size_t len, const qse_wchar_t* cs)
{
qse_wchar_t* p1, * p2, * end;
p1 = p2 = str;
end = p1 + len;
while (p1 < end)
{
if (qse_wcschr(cs,*p1) != QSE_NULL) *p2++ = *p1;
p1++;
}
return p2 - str;
}