added qse_strspltr()

This commit is contained in:
hyung-hwan 2009-02-25 08:05:17 +00:00
parent d74fa84265
commit 6df7f43935
5 changed files with 81 additions and 17 deletions

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.61 for qse 0.5.0. # Generated by GNU Autoconf 2.61 for qse 0.5.1.
# #
# Report bugs to <bacon@abiyo.net>. # Report bugs to <bacon@abiyo.net>.
# #
@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='qse' PACKAGE_NAME='qse'
PACKAGE_TARNAME='qse' PACKAGE_TARNAME='qse'
PACKAGE_VERSION='0.5.0' PACKAGE_VERSION='0.5.1'
PACKAGE_STRING='qse 0.5.0' PACKAGE_STRING='qse 0.5.1'
PACKAGE_BUGREPORT='bacon@abiyo.net' PACKAGE_BUGREPORT='bacon@abiyo.net'
# Factoring default headers for most tests. # Factoring default headers for most tests.
@ -1415,7 +1415,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.0 to adapt to many kinds of systems. \`configure' configures qse 0.5.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1485,7 +1485,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.0:";; short | recursive ) echo "Configuration of qse 0.5.1:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1599,7 +1599,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.0 qse configure 0.5.1
generated by GNU Autoconf 2.61 generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1613,7 +1613,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.0, which was It was created by qse $as_me 0.5.1, which was
generated by GNU Autoconf 2.61. Invocation command line was generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@ $ $0 $@
@ -2313,7 +2313,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='qse' PACKAGE='qse'
VERSION='0.5.0' VERSION='0.5.1'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -29615,7 +29615,7 @@ exec 6>&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.0, which was This file was extended by qse $as_me 0.5.1, which was
generated by GNU Autoconf 2.61. Invocation command line was generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -29668,7 +29668,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\ ac_cs_version="\\
qse config.status 0.5.0 qse config.status 0.5.1
configured by $0, generated by GNU Autoconf 2.61, configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -1,5 +1,5 @@
dnl AC_PREREQ(2.59) dnl AC_PREREQ(2.59)
AC_INIT([qse],[0.5.0],[bacon@abiyo.net]) AC_INIT([qse],[0.5.1],[bacon@abiyo.net])
AC_CONFIG_HEADER([include/qse/config.h]) AC_CONFIG_HEADER([include/qse/config.h])
AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_AUX_DIR(autoconf)

View File

@ -1,5 +1,5 @@
/* /*
* $Id: str.h 75 2009-02-22 14:10:34Z hyunghwan.chung $ * $Id: str.h 83 2009-02-24 14:05:17Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -478,6 +478,26 @@ qse_size_t qse_str_nccat (
qse_size_t len qse_size_t len
); );
/****f* Common/qse_strspltr
* NAME
* qse_strspltr - split a string translating special escane sequences
* DESCRIPTION
* The argument trset is translation character set which is composed
* of multiple character pairs. An escape character followed by the
* first character in a pair is translated into the second character
* in the pair. If trset is QSE_NULL, no translation is performed.
* SYNOPSIS
*/
int qse_strspltr (
qse_char_t* str,
const qse_char_t* delim,
qse_char_t lquote,
qse_char_t rquote,
qse_char_t escape,
const qse_char_t* trset
);
/******/
/****f* Common/qse_strspl /****f* Common/qse_strspl
* NAME * NAME
* qse_strspl - split a string * qse_strspl - split a string

View File

@ -1,5 +1,5 @@
/* /*
* $Id: str_utl.c 76 2009-02-22 14:18:06Z hyunghwan.chung $ * $Id: str_utl.c 83 2009-02-24 14:05:17Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -19,9 +19,10 @@
#include <qse/cmn/str.h> #include <qse/cmn/str.h>
#include "chr.h" #include "chr.h"
int qse_strspl ( int qse_strspltr (
qse_char_t* s, const qse_char_t* delim, qse_char_t* s, const qse_char_t* delim,
qse_char_t lquote, qse_char_t rquote, qse_char_t escape) qse_char_t lquote, qse_char_t rquote,
qse_char_t escape, const qse_char_t* trset)
{ {
qse_char_t* p = s, *d; qse_char_t* p = s, *d;
qse_char_t* sp = QSE_NULL, * ep = QSE_NULL; qse_char_t* sp = QSE_NULL, * ep = QSE_NULL;
@ -53,6 +54,19 @@ int qse_strspl (
if (escape != QSE_T('\0') && *p == escape) if (escape != QSE_T('\0') && *p == escape)
{ {
if (trset != QSE_NULL && p[1] != QSE_T('\0'))
{
const qse_char_t* ep = trset;
while (*ep != QSE_T('\0'))
{
if (p[1] == *ep++)
{
p[1] = *ep;
break;
}
}
}
qse_strcpy (p, p + 1); qse_strcpy (p, p + 1);
} }
else else
@ -120,6 +134,18 @@ int qse_strspl (
if (escape != QSE_T('\0') && *p == escape) if (escape != QSE_T('\0') && *p == escape)
{ {
if (trset != QSE_NULL && p[1] != QSE_T('\0'))
{
const qse_char_t* ep = trset;
while (*ep != QSE_T('\0'))
{
if (p[1] == *ep++)
{
p[1] = *ep;
break;
}
}
}
qse_strcpy (p, p + 1); qse_strcpy (p, p + 1);
} }
else else
@ -176,6 +202,19 @@ int qse_strspl (
if (escape != QSE_T('\0') && *p == escape) if (escape != QSE_T('\0') && *p == escape)
{ {
if (trset != QSE_NULL && p[1] != QSE_T('\0'))
{
const qse_char_t* ep = trset;
while (*ep != QSE_T('\0'))
{
if (p[1] == *ep++)
{
p[1] = *ep;
break;
}
}
}
qse_strcpy (p, p + 1); qse_strcpy (p, p + 1);
} }
else else
@ -256,7 +295,12 @@ exit_point:
} }
} }
return cnt; return cnt;
} }
int qse_strspl (
qse_char_t* s, const qse_char_t* delim,
qse_char_t lquote, qse_char_t rquote, qse_char_t escape)
{
return qse_strspltr (s, delim, lquote, rquote, escape, QSE_NULL);
}

View File

@ -33,7 +33,7 @@ POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
subdir = lib/utl subdir = lib/utl
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \