added qse_mbstrm()/qse_wcstrm()/qse_mbspac()/qse_wcspac() and related functions

This commit is contained in:
hyung-hwan 2011-04-09 07:56:28 +00:00
parent c0afd55a3a
commit 10901ba0df
10 changed files with 596 additions and 294 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: str.h 427 2011-04-07 06:46:25Z hyunghwan.chung $
* $Id: str.h 428 2011-04-08 13:56:28Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -135,14 +135,31 @@ typedef qse_wchar_t* (*qse_wcsxsubst_subst_t) (
}
/**
* The qse_strtrmx_op_t defines a string trimming operation.
* The qse_mbstrmx_op_t defines a string trimming operation.
*/
enum qse_strtrmx_op_t
enum qse_mbstrmx_op_t
{
QSE_STRTRMX_LEFT = (1 << 0), /**< trim leading spaces */
QSE_STRTRMX_RIGHT = (1 << 1) /**< trim trailing spaces */
QSE_MBSTRMX_LEFT = (1 << 0), /**< trim leading spaces */
QSE_MBSTRMX_RIGHT = (1 << 1) /**< trim trailing spaces */
};
/**
* The qse_wcstrmx_op_t defines a string trimming operation.
*/
enum qse_wcstrmx_op_t
{
QSE_WCSTRMX_LEFT = (1 << 0), /**< trim leading spaces */
QSE_WCSTRMX_RIGHT = (1 << 1) /**< trim trailing spaces */
};
#ifdef QSE_CHAR_IS_MCHAR
# define QSE_STRTRMX_LEFT QSE_MBSTRMX_LEFT
# define QSE_STRTRMX_RIGHT QSE_MBSTRMX_RIGHT
#else
# define QSE_STRTRMX_LEFT QSE_WCSTRMX_LEFT
# define QSE_STRTRMX_RIGHT QSE_WCSTRMX_RIGHT
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -1441,73 +1458,160 @@ int qse_wcsspltrn (
#endif
/**
* The qse_strtrmx() function strips leading spaces and/or trailing
* The qse_mbstrmx() function strips leading spaces and/or trailing
* spaces off a string depending on the opt parameter. You can form
* the op parameter by bitwise-OR'ing one or more of the following
* values:
*
* - QSE_STRTRMX_LEFT - trim leading spaces
* - QSE_STRTRMX_RIGHT - trim trailing spaces
* - QSE_MBSTRMX_LEFT - trim leading spaces
* - QSE_MBSTRMX_RIGHT - trim trailing spaces
*
* Should it remove leading spaces, it just returns the pointer to
* the first non-space character in the string. Should it remove trailing
* spaces, it inserts a QSE_T('\0') character after the last non-space
* spaces, it inserts a QSE_MT('\0') character after the last non-space
* characters. Take note of this behavior.
*
* @code
* qse_char_t a[] = QSE_T(" this is a test string ");
* qse_printf (QSE_T("[%s]\n"), qse_strtrmx(a,QSE_STRTRMX_LEFT|QSE_STRTRMX_RIGHT));
* qse_mchar_t a[] = QSE_MT(" this is a test string ");
* qse_mbstrmx (a, QSE_MBSTRMX_LEFT|QSE_MBSTRMX_RIGHT);
* @endcode
*
* @return pointer to a trimmed string.
*/
qse_char_t* qse_strtrmx (
qse_char_t* str, /**< a string */
int op /**< operation code XOR'ed of qse_strtrmx_op_t values */
qse_mchar_t* qse_mbstrmx (
qse_mchar_t* str, /**< string */
int opt /**< option OR'ed of #qse_mbstrmx_op_t values */
);
/**
* The qse_strtrm() function strips leading spaces and/or trailing
* spaces off a string. All characters between the first and the last non-space
* character inclusive are relocated to the beginning of memory pointed to
* by @a str; QSE_T('\0') is inserted after the last non-space character.
* @return length of the string without leading and trailing spaces.
* The qse_wcstrmx() function strips leading spaces and/or trailing
* spaces off a string depending on the opt parameter. You can form
* the op parameter by bitwise-OR'ing one or more of the following
* values:
*
* - QSE_WCSTRMX_LEFT - trim leading spaces
* - QSE_WCSTRMX_RIGHT - trim trailing spaces
*
* Should it remove leading spaces, it just returns the pointer to
* the first non-space character in the string. Should it remove trailing
* spaces, it inserts a QSE_WT('\0') character after the last non-space
* characters. Take note of this behavior.
*
* @code
* qse_wchar_t a[] = QSE_WT(" this is a test string ");
* qse_wcstrmx (a, QSE_STRTRMX_LEFT|QSE_STRTRMX_RIGHT);
* @endcode
*
* @return pointer to a trimmed string.
*/
qse_size_t qse_strtrm (
qse_char_t* str /**< string */
qse_wchar_t* qse_wcstrmx (
qse_wchar_t* str, /**< a string */
int opt /**< option OR'ed of #qse_wcstrmx_op_t values */
);
/**
* The qse_strxtrm() function strips leading spaces and/or trailing
* The qse_mbstrm() function strips leading spaces and/or trailing
* spaces off a string. All characters between the first and the last non-space
* character inclusive are relocated to the beginning of memory pointed to
* by @a str; QSE_T('\0') is inserted after the last non-space character.
* by @a str; QSE_MT('\0') is inserted after the last non-space character.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_strxtrm (
qse_char_t* str, /**< string */
qse_size_t qse_mbstrm (
qse_mchar_t* str /**< string */
);
/**
* The qse_wcstrm() function strips leading spaces and/or trailing
* spaces off a string. All characters between the first and the last non-space
* character inclusive are relocated to the beginning of memory pointed to
* by @a str; QSE_WT('\0') is inserted after the last non-space character.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_wcstrm (
qse_wchar_t* str /**< string */
);
/**
* The qse_mbsxtrm() function strips leading spaces and/or trailing
* spaces off a string. All characters between the first and the last non-space
* character inclusive are relocated to the beginning of memory pointed to
* by @a str; QSE_MT('\0') is inserted after the last non-space character.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_mbsxtrm (
qse_mchar_t* str, /**< string */
qse_size_t len /**< length */
);
/**
* The qse_strpac() function folds repeated whitespaces into one as well
* The qse_wcsxtrm() function strips leading spaces and/or trailing
* spaces off a string. All characters between the first and the last non-space
* character inclusive are relocated to the beginning of memory pointed to
* by @a str; QSE_WT('\0') is inserted after the last non-space character.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_wcsxtrm (
qse_wchar_t* str, /**< string */
qse_size_t len /**< length */
);
#ifdef QSE_CHAR_IS_MCHAR
# define qse_strtrmx(str,opt) qse_mbstrmx(str,opt)
# define qse_strtrm(str) qse_mbstrm(str)
# define qse_strxtrm(str,len) qse_mbsxtrm(str,len)
#else
# define qse_strtrmx(str,opt) qse_wcstrmx(str,opt)
# define qse_strtrm(str) qse_wcstrm(str)
# define qse_strxtrm(str,len) qse_wcsxtrm(str,len)
#endif
/**
* The qse_mbspac() function folds repeated whitespaces into one as well
* as stripping leading whitespaces and trailing whitespaces.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_strpac (
qse_char_t* str /**< string */
qse_size_t qse_mbspac (
qse_mchar_t* str /**< string */
);
/**
* The qse_strxpac() function folds repeated whitespaces into one as well
* The qse_wcspac() function folds repeated whitespaces into one as well
* as stripping leading whitespaces and trailing whitespaces.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_strxpac (
qse_char_t* str, /**< string */
qse_size_t qse_wcspac (
qse_wchar_t* str /**< string */
);
/**
* The qse_mbsxpac() function folds repeated whitespaces into one as well
* as stripping leading whitespaces and trailing whitespaces.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_mbsxpac (
qse_mchar_t* str, /**< string */
qse_size_t len /**< length */
);
/**
* The qse_wcsxpac() function folds repeated whitespaces into one as well
* as stripping leading whitespaces and trailing whitespaces.
* @return length of the string without leading and trailing spaces.
*/
qse_size_t qse_wcsxpac (
qse_wchar_t* str, /**< string */
qse_size_t len /**< length */
);
#ifdef QSE_CHAR_IS_MCHAR
# define qse_strpac(str) qse_mbspac(str)
# define qse_strxpac(str,len) qse_mbsxpac(str,len)
#else
# define qse_strpac(str) qse_wcspac(str)
# define qse_strxpac(str,len) qse_wcsxpac(str,len)
#endif
/**
* The qse_mbstowcslen() function scans a null-terminated multibyte string
* to calculate the number of wide characters it can be converted to.

View File

@ -10,8 +10,8 @@ libqsecmn_la_SOURCES = \
syscall.h mem.h \
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
str_bas.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c str_dup.c \
str_dyn.c str_fcpy.c str_len.c str_pbrk.c str_put.c str_spl.c \
str_spn.c str_str.c str_subst.c str_utl.c str_word.c \
str_dyn.c str_fcpy.c str_len.c str_pac.c str_pbrk.c str_put.c \
str_spl.c str_spn.c str_str.c str_subst.c str_trm.c str_word.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 \
fio.c pio.c sio.c \

View File

@ -74,9 +74,9 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libqsecmn_la_DEPENDENCIES =
am_libqsecmn_la_OBJECTS = mem.lo xma.lo fma.lo chr.lo chr_cnv.lo \
rex.lo str_bas.lo str_cat.lo str_chr.lo str_cnv.lo str_cmp.lo \
str_cpy.lo str_dup.lo str_dyn.lo str_fcpy.lo str_len.lo \
str_cpy.lo str_dup.lo str_dyn.lo str_fcpy.lo str_len.lo str_pac.lo \
str_pbrk.lo str_put.lo str_spl.lo str_spn.lo str_str.lo str_subst.lo \
str_utl.lo str_word.lo lda.lo oht.lo htb.lo rbt.lo sll.lo \
str_trm.lo str_word.lo lda.lo oht.lo htb.lo rbt.lo sll.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
@ -268,8 +268,8 @@ libqsecmn_la_SOURCES = \
syscall.h mem.h \
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
str_bas.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c str_dup.c \
str_dyn.c str_fcpy.c str_len.c str_pbrk.c str_put.c str_spl.c \
str_spn.c str_str.c str_subst.c str_utl.c str_word.c \
str_dyn.c str_fcpy.c str_len.c str_pac.c str_pbrk.c str_put.c \
str_spl.c str_spn.c str_str.c str_subst.c str_trm.c str_word.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 \
fio.c pio.c sio.c \
@ -397,13 +397,14 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_dyn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_fcpy.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_pbrk.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_put.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_spl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_spn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_str.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_subst.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_utl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_trm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_word.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tio.Plo@am__quote@

142
qse/lib/cmn/str_pac.c Normal file
View File

@ -0,0 +1,142 @@
/*
* $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>
#include <qse/cmn/chr.h>
qse_size_t qse_mbspac (qse_mchar_t* str)
{
qse_mchar_t* p = str, * q = str;
while (QSE_ISMSPACE(*p)) p++;
while (*p != QSE_MT('\0'))
{
if (QSE_ISMSPACE(*p))
{
*q++ = *p++;
while (QSE_ISMSPACE(*p)) p++;
}
else *q++ = *p++;
}
if (q > str && QSE_ISMSPACE(q[-1])) q--;
*q = QSE_MT('\0');
return q - str;
}
qse_size_t qse_mbsxpac (qse_mchar_t* str, qse_size_t len)
{
qse_mchar_t* p = str, * q = str, * end = str + len;
int followed_by_space = 0;
int state = 0;
while (p < end)
{
if (state == 0)
{
if (!QSE_ISMSPACE(*p))
{
*q++ = *p;
state = 1;
}
}
else if (state == 1)
{
if (QSE_ISMSPACE(*p))
{
if (!followed_by_space)
{
followed_by_space = 1;
*q++ = *p;
}
}
else
{
followed_by_space = 0;
*q++ = *p;
}
}
p++;
}
return (followed_by_space) ? (q - str -1): (q - str);
}
qse_size_t qse_wcspac (qse_wchar_t* str)
{
qse_wchar_t* p = str, * q = str;
while (QSE_ISWSPACE(*p)) p++;
while (*p != QSE_WT('\0'))
{
if (QSE_ISWSPACE(*p))
{
*q++ = *p++;
while (QSE_ISWSPACE(*p)) p++;
}
else *q++ = *p++;
}
if (q > str && QSE_ISWSPACE(q[-1])) q--;
*q = QSE_WT('\0');
return q - str;
}
qse_size_t qse_wcsxpac (qse_wchar_t* str, qse_size_t len)
{
qse_wchar_t* p = str, * q = str, * end = str + len;
int followed_by_space = 0;
int state = 0;
while (p < end)
{
if (state == 0)
{
if (!QSE_ISWSPACE(*p))
{
*q++ = *p;
state = 1;
}
}
else if (state == 1)
{
if (QSE_ISWSPACE(*p))
{
if (!followed_by_space)
{
followed_by_space = 1;
*q++ = *p;
}
}
else
{
followed_by_space = 0;
*q++ = *p;
}
}
p++;
}
return (followed_by_space) ? (q - str -1): (q - str);
}

177
qse/lib/cmn/str_trm.c Normal file
View File

@ -0,0 +1,177 @@
/*
* $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>
#include <qse/cmn/chr.h>
#include "mem.h"
qse_mchar_t* qse_mbstrmx (qse_mchar_t* str, int opt)
{
qse_mchar_t* p = str;
qse_mchar_t* s = QSE_NULL, * e = QSE_NULL;
while (*p != QSE_MT('\0'))
{
if (!QSE_ISMSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (opt & QSE_MBSTRMX_RIGHT) e[1] = QSE_MT('\0');
if (opt & QSE_MBSTRMX_LEFT) str = s;
return str;
}
qse_size_t qse_mbstrm (qse_mchar_t* str)
{
qse_mchar_t* p = str;
qse_mchar_t* s = QSE_NULL, * e = QSE_NULL;
while (*p != QSE_MT('\0'))
{
if (!QSE_ISMSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (e != QSE_NULL)
{
e[1] = QSE_MT('\0');
if (str != s)
QSE_MEMCPY (str, s, (e - s + 2) * QSE_SIZEOF(*str));
return e - s + 1;
}
str[0] = QSE_MT('\0');
return 0;
}
qse_size_t qse_mbsxtrm (qse_mchar_t* str, qse_size_t len)
{
qse_mchar_t* p = str, * end = str + len;
qse_mchar_t* s = QSE_NULL, * e = QSE_NULL;
while (p < end)
{
if (!QSE_ISMSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (e != QSE_NULL)
{
/* do not insert a terminating null */
/*e[1] = QSE_MT('\0');*/
if (str != s)
QSE_MEMCPY (str, s, (e - s + 2) * QSE_SIZEOF(*str));
return e - s + 1;
}
/* do not insert a terminating null */
/*str[0] = QSE_MT('\0');*/
return 0;
}
qse_wchar_t* qse_wcstrmx (qse_wchar_t* str, int opt)
{
qse_wchar_t* p = str;
qse_wchar_t* s = QSE_NULL, * e = QSE_NULL;
while (*p != QSE_MT('\0'))
{
if (!QSE_ISWSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (opt & QSE_WCSTRMX_RIGHT) e[1] = QSE_MT('\0');
if (opt & QSE_WCSTRMX_LEFT) str = s;
return str;
}
qse_size_t qse_wcstrm (qse_wchar_t* str)
{
qse_wchar_t* p = str;
qse_wchar_t* s = QSE_NULL, * e = QSE_NULL;
while (*p != QSE_MT('\0'))
{
if (!QSE_ISWSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (e != QSE_NULL)
{
e[1] = QSE_MT('\0');
if (str != s)
QSE_MEMCPY (str, s, (e - s + 2) * QSE_SIZEOF(*str));
return e - s + 1;
}
str[0] = QSE_MT('\0');
return 0;
}
qse_size_t qse_wcsxtrm (qse_wchar_t* str, qse_size_t len)
{
qse_wchar_t* p = str, * end = str + len;
qse_wchar_t* s = QSE_NULL, * e = QSE_NULL;
while (p < end)
{
if (!QSE_ISWSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (e != QSE_NULL)
{
/* do not insert a terminating null */
/*e[1] = QSE_MT('\0');*/
if (str != s)
QSE_MEMCPY (str, s, (e - s + 2) * QSE_SIZEOF(*str));
return e - s + 1;
}
/* do not insert a terminating null */
/*str[0] = QSE_MT('\0');*/
return 0;
}

View File

@ -1,160 +0,0 @@
/*
* $Id: str_utl.c 427 2011-04-07 06:46:25Z hyunghwan.chung $
*
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>
#include <qse/cmn/chr.h>
#include "mem.h"
qse_char_t* qse_strtrmx (qse_char_t* str, int opt)
{
qse_char_t* p = str;
qse_char_t* s = QSE_NULL, * e = QSE_NULL;
while (*p != QSE_T('\0'))
{
if (!QSE_ISSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (opt & QSE_STRTRMX_RIGHT) e[1] = QSE_T('\0');
if (opt & QSE_STRTRMX_LEFT) str = s;
return str;
}
qse_size_t qse_strtrm (qse_char_t* str)
{
qse_char_t* p = str;
qse_char_t* s = QSE_NULL, * e = QSE_NULL;
while (*p != QSE_T('\0'))
{
if (!QSE_ISSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (e != QSE_NULL)
{
e[1] = QSE_T('\0');
if (str != s)
QSE_MEMCPY (str, s, (e - s + 2) * QSE_SIZEOF(qse_char_t));
return e - s + 1;
}
str[0] = QSE_T('\0');
return 0;
}
qse_size_t qse_strxtrm (qse_char_t* str, qse_size_t len)
{
qse_char_t* p = str, * end = str + len;
qse_char_t* s = QSE_NULL, * e = QSE_NULL;
while (p < end)
{
if (!QSE_ISSPACE(*p))
{
if (s == QSE_NULL) s = p;
e = p;
}
p++;
}
if (e != QSE_NULL)
{
/* do not insert a terminating null */
/*e[1] = QSE_T('\0');*/
if (str != s)
QSE_MEMCPY (str, s, (e - s + 2) * QSE_SIZEOF(qse_char_t));
return e - s + 1;
}
/* do not insert a terminating null */
/*str[0] = QSE_T('\0');*/
return 0;
}
qse_size_t qse_strpac (qse_char_t* str)
{
qse_char_t* p = str, * q = str;
while (QSE_ISSPACE(*p)) p++;
while (*p != QSE_T('\0'))
{
if (QSE_ISSPACE(*p))
{
*q++ = *p++;
while (QSE_ISSPACE(*p)) p++;
}
else *q++ = *p++;
}
if (q > str && QSE_ISSPACE(q[-1])) q--;
*q = QSE_T('\0');
return q - str;
}
qse_size_t qse_strxpac (qse_char_t* str, qse_size_t len)
{
qse_char_t* p = str, * q = str, * end = str + len;
int followed_by_space = 0;
int state = 0;
while (p < end)
{
if (state == 0)
{
if (!QSE_ISSPACE(*p))
{
*q++ = *p;
state = 1;
}
}
else if (state == 1)
{
if (QSE_ISSPACE(*p))
{
if (!followed_by_space)
{
followed_by_space = 1;
*q++ = *p;
}
}
else
{
followed_by_space = 0;
*q++ = *p;
}
}
p++;
}
return (followed_by_space) ? (q - str -1): (q - str);
}

View File

@ -42,7 +42,7 @@ WVList
0
10
WPickList
49
50
11
MItem
3
@ -655,8 +655,8 @@ WVList
0
147
MItem
33
..\..\..\..\..\lib\cmn\str_pbrk.c
32
..\..\..\..\..\lib\cmn\str_pac.c
148
WString
4
@ -673,8 +673,8 @@ WVList
0
151
MItem
32
..\..\..\..\..\lib\cmn\str_put.c
33
..\..\..\..\..\lib\cmn\str_pbrk.c
152
WString
4
@ -692,7 +692,7 @@ WVList
155
MItem
32
..\..\..\..\..\lib\cmn\str_spl.c
..\..\..\..\..\lib\cmn\str_put.c
156
WString
4
@ -710,7 +710,7 @@ WVList
159
MItem
32
..\..\..\..\..\lib\cmn\str_spn.c
..\..\..\..\..\lib\cmn\str_spl.c
160
WString
4
@ -728,7 +728,7 @@ WVList
163
MItem
32
..\..\..\..\..\lib\cmn\str_str.c
..\..\..\..\..\lib\cmn\str_spn.c
164
WString
4
@ -745,8 +745,8 @@ WVList
0
167
MItem
34
..\..\..\..\..\lib\cmn\str_subst.c
32
..\..\..\..\..\lib\cmn\str_str.c
168
WString
4
@ -763,8 +763,8 @@ WVList
0
171
MItem
32
..\..\..\..\..\lib\cmn\str_utl.c
34
..\..\..\..\..\lib\cmn\str_subst.c
172
WString
4
@ -781,8 +781,8 @@ WVList
0
175
MItem
33
..\..\..\..\..\lib\cmn\str_word.c
32
..\..\..\..\..\lib\cmn\str_trm.c
176
WString
4
@ -799,8 +799,8 @@ WVList
0
179
MItem
29
..\..\..\..\..\lib\cmn\time.c
33
..\..\..\..\..\lib\cmn\str_word.c
180
WString
4
@ -817,8 +817,8 @@ WVList
0
183
MItem
28
..\..\..\..\..\lib\cmn\tio.c
29
..\..\..\..\..\lib\cmn\time.c
184
WString
4
@ -835,8 +835,8 @@ WVList
0
187
MItem
32
..\..\..\..\..\lib\cmn\tio_get.c
28
..\..\..\..\..\lib\cmn\tio.c
188
WString
4
@ -854,7 +854,7 @@ WVList
191
MItem
32
..\..\..\..\..\lib\cmn\tio_put.c
..\..\..\..\..\lib\cmn\tio_get.c
192
WString
4
@ -871,8 +871,8 @@ WVList
0
195
MItem
28
..\..\..\..\..\lib\cmn\xma.c
32
..\..\..\..\..\lib\cmn\tio_put.c
196
WString
4
@ -889,26 +889,26 @@ WVList
0
199
MItem
3
*.h
28
..\..\..\..\..\lib\cmn\xma.c
200
WString
3
NIL
4
COBJ
201
WVList
0
202
WVList
0
-1
11
1
1
0
203
MItem
28
..\..\..\..\..\lib\cmn\mem.h
3
*.h
204
WString
3
@ -919,14 +919,14 @@ WVList
206
WVList
0
199
-1
1
1
0
207
MItem
32
..\..\..\..\..\lib\cmn\syscall.h
28
..\..\..\..\..\lib\cmn\mem.h
208
WString
3
@ -937,7 +937,25 @@ WVList
210
WVList
0
199
203
1
1
0
211
MItem
32
..\..\..\..\..\lib\cmn\syscall.h
212
WString
3
NIL
213
WVList
0
214
WVList
0
203
1
1
0

View File

@ -42,7 +42,7 @@ WVList
0
10
WPickList
49
50
11
MItem
3
@ -655,8 +655,8 @@ WVList
0
147
MItem
33
..\..\..\..\..\lib\cmn\str_pbrk.c
32
..\..\..\..\..\lib\cmn\str_pac.c
148
WString
4
@ -673,8 +673,8 @@ WVList
0
151
MItem
32
..\..\..\..\..\lib\cmn\str_put.c
33
..\..\..\..\..\lib\cmn\str_pbrk.c
152
WString
4
@ -692,7 +692,7 @@ WVList
155
MItem
32
..\..\..\..\..\lib\cmn\str_spl.c
..\..\..\..\..\lib\cmn\str_put.c
156
WString
4
@ -710,7 +710,7 @@ WVList
159
MItem
32
..\..\..\..\..\lib\cmn\str_spn.c
..\..\..\..\..\lib\cmn\str_spl.c
160
WString
4
@ -728,7 +728,7 @@ WVList
163
MItem
32
..\..\..\..\..\lib\cmn\str_str.c
..\..\..\..\..\lib\cmn\str_spn.c
164
WString
4
@ -745,8 +745,8 @@ WVList
0
167
MItem
34
..\..\..\..\..\lib\cmn\str_subst.c
32
..\..\..\..\..\lib\cmn\str_str.c
168
WString
4
@ -763,8 +763,8 @@ WVList
0
171
MItem
32
..\..\..\..\..\lib\cmn\str_utl.c
34
..\..\..\..\..\lib\cmn\str_subst.c
172
WString
4
@ -781,8 +781,8 @@ WVList
0
175
MItem
33
..\..\..\..\..\lib\cmn\str_word.c
32
..\..\..\..\..\lib\cmn\str_trm.c
176
WString
4
@ -799,8 +799,8 @@ WVList
0
179
MItem
29
..\..\..\..\..\lib\cmn\time.c
33
..\..\..\..\..\lib\cmn\str_word.c
180
WString
4
@ -817,8 +817,8 @@ WVList
0
183
MItem
28
..\..\..\..\..\lib\cmn\tio.c
29
..\..\..\..\..\lib\cmn\time.c
184
WString
4
@ -835,8 +835,8 @@ WVList
0
187
MItem
32
..\..\..\..\..\lib\cmn\tio_get.c
28
..\..\..\..\..\lib\cmn\tio.c
188
WString
4
@ -854,7 +854,7 @@ WVList
191
MItem
32
..\..\..\..\..\lib\cmn\tio_put.c
..\..\..\..\..\lib\cmn\tio_get.c
192
WString
4
@ -871,8 +871,8 @@ WVList
0
195
MItem
28
..\..\..\..\..\lib\cmn\xma.c
32
..\..\..\..\..\lib\cmn\tio_put.c
196
WString
4
@ -889,26 +889,26 @@ WVList
0
199
MItem
3
*.h
28
..\..\..\..\..\lib\cmn\xma.c
200
WString
3
NIL
4
COBJ
201
WVList
0
202
WVList
0
-1
11
1
1
0
203
MItem
28
..\..\..\..\..\lib\cmn\mem.h
3
*.h
204
WString
3
@ -919,14 +919,14 @@ WVList
206
WVList
0
199
-1
1
1
0
207
MItem
32
..\..\..\..\..\lib\cmn\syscall.h
28
..\..\..\..\..\lib\cmn\mem.h
208
WString
3
@ -937,7 +937,25 @@ WVList
210
WVList
0
199
203
1
1
0
211
MItem
32
..\..\..\..\..\lib\cmn\syscall.h
212
WString
3
NIL
213
WVList
0
214
WVList
0
203
1
1
0

View File

@ -78,8 +78,8 @@ WRect
WFileName
30
release/os2/lib/cmn/qsecmn.tgt
22
24
34
40
20
VComponent
21
@ -142,8 +142,8 @@ WRect
WFileName
28
debug/os2/lib/cmn/qsecmn.tgt
31
35
33
40
32
VComponent
33
@ -206,8 +206,8 @@ WRect
WFileName
30
debug/win32/lib/cmn/qsecmn.tgt
18
26
33
38
44
VComponent
45

View File

@ -42,7 +42,7 @@ WVList
0
10
WPickList
49
50
11
MItem
3
@ -719,8 +719,8 @@ WVList
0
163
MItem
33
..\..\..\..\..\lib\cmn\str_pbrk.c
32
..\..\..\..\..\lib\cmn\str_pac.c
164
WString
4
@ -737,8 +737,8 @@ WVList
0
167
MItem
32
..\..\..\..\..\lib\cmn\str_put.c
33
..\..\..\..\..\lib\cmn\str_pbrk.c
168
WString
4
@ -756,7 +756,7 @@ WVList
171
MItem
32
..\..\..\..\..\lib\cmn\str_spl.c
..\..\..\..\..\lib\cmn\str_put.c
172
WString
4
@ -774,7 +774,7 @@ WVList
175
MItem
32
..\..\..\..\..\lib\cmn\str_spn.c
..\..\..\..\..\lib\cmn\str_spl.c
176
WString
4
@ -792,7 +792,7 @@ WVList
179
MItem
32
..\..\..\..\..\lib\cmn\str_str.c
..\..\..\..\..\lib\cmn\str_spn.c
180
WString
4
@ -809,8 +809,8 @@ WVList
0
183
MItem
34
..\..\..\..\..\lib\cmn\str_subst.c
32
..\..\..\..\..\lib\cmn\str_str.c
184
WString
4
@ -827,30 +827,32 @@ WVList
0
187
MItem
32
..\..\..\..\..\lib\cmn\str_utl.c
34
..\..\..\..\..\lib\cmn\str_subst.c
188
WString
4
COBJ
189
WVList
1
0
190
MVState
WVList
0
11
1
1
0
191
WString
3
WCC
MItem
32
..\..\..\..\..\lib\cmn\str_trm.c
192
WString
25
o?2??Include directories:
1
4
COBJ
193
WString
54
"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
WVList
0
194
WVList