From 610059c0236aad6dd887214e89d7c71b3da3b8b9 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 12 Apr 2011 08:15:30 +0000 Subject: [PATCH] added qse_mbsbeg()/qse_wcsbeg()/qse_mbsend()/qse_wcsend() and related functions --- qse/include/qse/cmn/str.h | 193 ++++++++++++++-------- qse/lib/cmn/Makefile.am | 7 +- qse/lib/cmn/Makefile.in | 18 +- qse/lib/cmn/str_bas.c | 124 -------------- qse/lib/cmn/str_beg.c | 148 +++++++++++++++++ qse/lib/cmn/str_end.c | 97 +++++++++++ qse/watcom/debug/os2/lib/cmn/qsecmn.tgt | 98 ++++++----- qse/watcom/debug/win32/lib/cmn/qsecmn.tgt | 98 ++++++----- qse/watcom/qse.wpj | 12 +- qse/watcom/release/os2/lib/cmn/qsecmn.tgt | 98 ++++++----- 10 files changed, 565 insertions(+), 328 deletions(-) delete mode 100644 qse/lib/cmn/str_bas.c create mode 100644 qse/lib/cmn/str_beg.c create mode 100644 qse/lib/cmn/str_end.c diff --git a/qse/include/qse/cmn/str.h b/qse/include/qse/cmn/str.h index 5a0681a1..bbd366a0 100644 --- a/qse/include/qse/cmn/str.h +++ b/qse/include/qse/cmn/str.h @@ -1,5 +1,5 @@ /* - * $Id: str.h 428 2011-04-08 13:56:28Z hyunghwan.chung $ + * $Id: str.h 429 2011-04-11 14:15:30Z hyunghwan.chung $ * Copyright 2006-2009 Chung, Hyung-Hwan. This file is part of QSE. @@ -190,7 +190,7 @@ qse_size_t qse_wcslen ( * The qse_mbsbytes() function returns the number of bytes a null-terminated * string is holding excluding a terminating null. */ -qse_size_t qse_strbytes ( +qse_size_t qse_mbsbytes ( const qse_mchar_t* str ); @@ -1127,86 +1127,145 @@ qse_wchar_t* qse_wcsxrchr ( #endif /** - * The qse_strbeg() function checks if the a string begins with a substring. - * @return the pointer to a beginning of a matching beginning, - * QSE_NULL if no match is found. + * The qse_mbsbeg() function checks if a string begins with a substring. + * @return pointer to the beginning of a matching beginning, + * #SE_NULL if no match is found. */ -qse_char_t* qse_strbeg ( - const qse_char_t* str, - const qse_char_t* sub -); - -qse_char_t* qse_strxbeg ( - const qse_char_t* str, - qse_size_t len, - const qse_char_t* sub) -; - -/* - * The qse_strbeg() function checks if the a string begins with a substring. - * @return @a str on match, QSE_NULL on no match - */ -qse_char_t* qse_strnbeg ( - const qse_char_t* str, - const qse_char_t* sub, - qse_size_t len -); - -/* - * The qse_strbeg() function checks if the a string begins with a substring. - * @return @a str on match, QSE_NULL on no match - */ -qse_char_t* qse_strxnbeg ( - const qse_char_t* str, - qse_size_t len1, - const qse_char_t* sub, - qse_size_t len2 +qse_mchar_t* qse_mbsbeg ( + const qse_mchar_t* str, + const qse_mchar_t* sub ); /** - * The qse_strend() function checks if the a string ends with a substring. - * @return the pointer to a beginning of a matching end, - * QSE_NULL if no match is found. + * The qse_wcsbeg() function checks if a string begins with a substring. + * @return pointer to the beginning of a matching beginning, + * #QSE_NULL if no match is found. */ -qse_char_t* qse_strend ( - const qse_char_t* str, /**< a string */ - const qse_char_t* sub /**< a substring */ +qse_wchar_t* qse_wcsbeg ( + const qse_wchar_t* str, + const qse_wchar_t* sub +); + +qse_mchar_t* qse_mbsxbeg ( + const qse_mchar_t* str, + qse_size_t len, + const qse_mchar_t* sub +); + +qse_wchar_t* qse_wcsxbeg ( + const qse_wchar_t* str, + qse_size_t len, + const qse_wchar_t* sub +); + +qse_mchar_t* qse_mbsnbeg ( + const qse_mchar_t* str, + const qse_mchar_t* sub, + qse_size_t len +); + +qse_wchar_t* qse_wcsnbeg ( + const qse_wchar_t* str, + const qse_wchar_t* sub, + qse_size_t len +); + +qse_mchar_t* qse_mbsxnbeg ( + const qse_mchar_t* str, + qse_size_t len1, + const qse_mchar_t* sub, + qse_size_t len2 +); + +qse_wchar_t* qse_wcsxnbeg ( + const qse_wchar_t* str, + qse_size_t len1, + const qse_wchar_t* sub, + qse_size_t len2 +); + +#ifdef QSE_CHAR_IS_MCHAR +# define qse_strbeg(str,sub) qse_mbsxbeg(str,sub) +# define qse_strxbeg(str,len,sub) qse_mbsxbeg(str,len,sub) +# define qse_strnbeg(str,sub,len) qse_mbsnbeg(str,sub,len) +# define qse_strxnbeg(str,len1,sub,len2) qse_mbsxnbeg(str,len1,sub,len2) +#else +# define qse_strbeg(str,sub) qse_wcsxbeg(str,sub) +# define qse_strxbeg(str,len,sub) qse_wcsxbeg(str,len,sub) +# define qse_strnbeg(str,sub,len) qse_wcsnbeg(str,sub,len) +# define qse_strxnbeg(str,len1,sub,len2) qse_wcsxnbeg(str,len1,sub,len2) +#endif + +/** + * The qse_mbsend() function checks if a string ends with a substring. + * @return pointer to the beginning of a matching ending, + * #SE_NULL if no match is found. + */ +qse_mchar_t* qse_mbsend ( + const qse_mchar_t* str, + const qse_mchar_t* sub ); /** - * The qse_strxend function checks if the a string ends with a substring. - * @return the pointer to a beginning of a matching end, - * QSE_NULL if no match is found. + * The qse_wcsend() function checks if a string ends with a substring. + * @return pointer to the beginning of a matching ending, + * #QSE_NULL if no match is found. */ -qse_char_t* qse_strxend ( - const qse_char_t* str, - qse_size_t len, - const qse_char_t* sub +qse_wchar_t* qse_wcsend ( + const qse_wchar_t* str, + const qse_wchar_t* sub ); -/** - * The qse_strnend() function checks if the a string ends with a substring. - * @return the pointer to a beginning of a matching end, - * QSE_NULL if no match is found. - */ -qse_char_t* qse_strnend ( - const qse_char_t* str, - const qse_char_t* sub, - qse_size_t len +qse_mchar_t* qse_mbsxend ( + const qse_mchar_t* str, + qse_size_t len, + const qse_mchar_t* sub ); -/** - * The qse_strxnend() function checks if the a string ends with a substring. - * @return the pointer to a beginning of a matching end, - * QSE_NULL if no match is found. - */ -qse_char_t* qse_strxnend ( - const qse_char_t* str, - qse_size_t len1, - const qse_char_t* sub, - qse_size_t len2 +qse_wchar_t* qse_wcsxend ( + const qse_wchar_t* str, + qse_size_t len, + const qse_wchar_t* sub ); +qse_mchar_t* qse_mbsnend ( + const qse_mchar_t* str, + const qse_mchar_t* sub, + qse_size_t len +); + +qse_wchar_t* qse_wcsnend ( + const qse_wchar_t* str, + const qse_wchar_t* sub, + qse_size_t len +); + +qse_mchar_t* qse_mbsxnend ( + const qse_mchar_t* str, + qse_size_t len1, + const qse_mchar_t* sub, + qse_size_t len2 +); + +qse_wchar_t* qse_wcsxnend ( + const qse_wchar_t* str, + qse_size_t len1, + const qse_wchar_t* sub, + qse_size_t len2 +); + +#ifdef QSE_CHAR_IS_MCHAR +# define qse_strend(str,sub) qse_mbsxend(str,sub) +# define qse_strxend(str,len,sub) qse_mbsxend(str,len,sub) +# define qse_strnend(str,sub,len) qse_mbsnend(str,sub,len) +# define qse_strxnend(str,len1,sub,len2) qse_mbsxnend(str,len1,sub,len2) +#else +# define qse_strend(str,sub) qse_wcsxend(str,sub) +# define qse_strxend(str,len,sub) qse_wcsxend(str,len,sub) +# define qse_strnend(str,sub,len) qse_wcsnend(str,sub,len) +# define qse_strxnend(str,len1,sub,len2) qse_wcsxnend(str,len1,sub,len2) +#endif + qse_size_t qse_mbsspn ( const qse_mchar_t* str1, const qse_mchar_t* str2 diff --git a/qse/lib/cmn/Makefile.am b/qse/lib/cmn/Makefile.am index 47f45117..f178e500 100644 --- a/qse/lib/cmn/Makefile.am +++ b/qse/lib/cmn/Makefile.am @@ -9,9 +9,10 @@ lib_LTLIBRARIES = libqsecmn.la 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_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 \ + str_beg.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c \ + str_dup.c str_dyn.c str_end.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 \ diff --git a/qse/lib/cmn/Makefile.in b/qse/lib/cmn/Makefile.in index c2a2405b..0db1a238 100644 --- a/qse/lib/cmn/Makefile.in +++ b/qse/lib/cmn/Makefile.in @@ -73,10 +73,10 @@ am__installdirs = "$(DESTDIR)$(libdir)" 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_pac.lo \ - str_pbrk.lo str_put.lo str_spl.lo str_spn.lo str_str.lo str_subst.lo \ - str_trm.lo str_word.lo lda.lo oht.lo htb.lo rbt.lo sll.lo \ + rex.lo str_beg.lo str_cat.lo str_chr.lo str_cnv.lo str_cmp.lo \ + str_cpy.lo str_dup.lo str_dyn.lo str_end.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_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 @@ -267,9 +267,10 @@ lib_LTLIBRARIES = libqsecmn.la $(am__append_1) 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_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 \ + str_beg.c str_cat.c str_chr.c str_cnv.c str_cmp.c str_cpy.c \ + str_dup.c str_dyn.c str_end.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 \ @@ -387,7 +388,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_bas.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_beg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_cat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_chr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_cmp.Plo@am__quote@ @@ -395,6 +396,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_cpy.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_end.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@ diff --git a/qse/lib/cmn/str_bas.c b/qse/lib/cmn/str_bas.c deleted file mode 100644 index 2026860e..00000000 --- a/qse/lib/cmn/str_bas.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * $Id: str_bas.c 425 2011-04-03 14:57:23Z 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 . - */ - -#include -#include -#include "mem.h" - -qse_char_t* qse_strbeg (const qse_char_t* str, const qse_char_t* sub) -{ - while (*sub != QSE_T('\0')) - { - if (*str != *sub) return QSE_NULL; - str++; sub++; - } - - /* returns the pointer to the next character of the match */ - return (qse_char_t*)str; -} - -qse_char_t* qse_strxbeg ( - const qse_char_t* str, qse_size_t len, const qse_char_t* sub) -{ - const qse_char_t* end = str + len; - - while (*sub != QSE_T('\0')) - { - if (str >= end || *str != *sub) return QSE_NULL; - str++; sub++; - } - - /* returns the pointer to the next character of the match */ - return (qse_char_t*)str; -} - -qse_char_t* qse_strnbeg ( - const qse_char_t* str, const qse_char_t* sub, qse_size_t len) -{ - const qse_char_t* end = sub + len; - - while (sub < end) - { - if (*str == QSE_T('\0') || *str != *sub) return QSE_NULL; - str++; sub++; - } - - /* returns the pointer to the next character of the match */ - return (qse_char_t*)str; -} - -qse_char_t* qse_strxnbeg ( - const qse_char_t* str, qse_size_t len1, - const qse_char_t* sub, qse_size_t len2) -{ - const qse_char_t* end1, * end2; - - if (len2 > len1) return QSE_NULL; - - end1 = str + len1; - end2 = sub + len2; - - while (sub < end2) - { - if (str >= end1 || *str != *sub) return QSE_NULL; - str++; sub++; - } - - /* returns the pointer to the next character of the match */ - return (qse_char_t*)str; -} - -qse_char_t* qse_strend (const qse_char_t* str, const qse_char_t* sub) -{ - return qse_strxnend (str, qse_strlen(str), sub, qse_strlen(sub)); -} - -qse_char_t* qse_strxend ( - const qse_char_t* str, qse_size_t len, const qse_char_t* sub) -{ - return qse_strxnend (str, len, sub, qse_strlen(sub)); -} - -qse_char_t* qse_strnend ( - const qse_char_t* str, const qse_char_t* sub, qse_size_t len) -{ - return qse_strxnend (str, qse_strlen(str), sub, len); -} - -qse_char_t* qse_strxnend ( - const qse_char_t* str, qse_size_t len1, - const qse_char_t* sub, qse_size_t len2) -{ - const qse_char_t* end1, * end2; - - if (len2 > len1) return QSE_NULL; - - end1 = str + len1; - end2 = sub + len2; - - while (end2 > sub) - { - if (end1 <= str) return QSE_NULL; - if (*(--end1) != *(--end2)) return QSE_NULL; - } - - /* returns the pointer to the match start */ - return (qse_char_t*)end1; -} diff --git a/qse/lib/cmn/str_beg.c b/qse/lib/cmn/str_beg.c new file mode 100644 index 00000000..47c5c82e --- /dev/null +++ b/qse/lib/cmn/str_beg.c @@ -0,0 +1,148 @@ +/* + * $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 . + */ + +#include + +qse_mchar_t* qse_mbsbeg (const qse_mchar_t* str, const qse_mchar_t* sub) +{ + while (*sub != QSE_MT('\0')) + { + if (*str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_mchar_t*)str; +} + +qse_mchar_t* qse_mbsxbeg ( + const qse_mchar_t* str, qse_size_t len, const qse_mchar_t* sub) +{ + const qse_mchar_t* end = str + len; + + while (*sub != QSE_MT('\0')) + { + if (str >= end || *str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_mchar_t*)str; +} + +qse_mchar_t* qse_mbsnbeg ( + const qse_mchar_t* str, const qse_mchar_t* sub, qse_size_t len) +{ + const qse_mchar_t* end = sub + len; + + while (sub < end) + { + if (*str == QSE_MT('\0') || *str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_mchar_t*)str; +} + +qse_mchar_t* qse_mbsxnbeg ( + const qse_mchar_t* str, qse_size_t len1, + const qse_mchar_t* sub, qse_size_t len2) +{ + const qse_mchar_t* end1, * end2; + + if (len2 > len1) return QSE_NULL; + + end1 = str + len1; + end2 = sub + len2; + + while (sub < end2) + { + if (str >= end1 || *str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_mchar_t*)str; +} + +qse_wchar_t* qse_wcsbeg (const qse_wchar_t* str, const qse_wchar_t* sub) +{ + while (*sub != QSE_WT('\0')) + { + if (*str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_wchar_t*)str; +} + +qse_wchar_t* qse_wcsxbeg ( + const qse_wchar_t* str, qse_size_t len, const qse_wchar_t* sub) +{ + const qse_wchar_t* end = str + len; + + while (*sub != QSE_WT('\0')) + { + if (str >= end || *str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_wchar_t*)str; +} + +qse_wchar_t* qse_wcsnbeg ( + const qse_wchar_t* str, const qse_wchar_t* sub, qse_size_t len) +{ + const qse_wchar_t* end = sub + len; + + while (sub < end) + { + if (*str == QSE_WT('\0') || *str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_wchar_t*)str; +} + +qse_wchar_t* qse_wcsxnbeg ( + const qse_wchar_t* str, qse_size_t len1, + const qse_wchar_t* sub, qse_size_t len2) +{ + const qse_wchar_t* end1, * end2; + + if (len2 > len1) return QSE_NULL; + + end1 = str + len1; + end2 = sub + len2; + + while (sub < end2) + { + if (str >= end1 || *str != *sub) return QSE_NULL; + str++; sub++; + } + + /* returns the pointer to the next character of the match */ + return (qse_wchar_t*)str; +} + diff --git a/qse/lib/cmn/str_end.c b/qse/lib/cmn/str_end.c new file mode 100644 index 00000000..17f0f23a --- /dev/null +++ b/qse/lib/cmn/str_end.c @@ -0,0 +1,97 @@ +/* + * $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 . + */ + +#include + +qse_mchar_t* qse_mbsend (const qse_mchar_t* str, const qse_mchar_t* sub) +{ + return qse_mbsxnend (str, qse_mbslen(str), sub, qse_mbslen(sub)); +} + +qse_mchar_t* qse_mbsxend ( + const qse_mchar_t* str, qse_size_t len, const qse_mchar_t* sub) +{ + return qse_mbsxnend (str, len, sub, qse_mbslen(sub)); +} + +qse_mchar_t* qse_mbsnend ( + const qse_mchar_t* str, const qse_mchar_t* sub, qse_size_t len) +{ + return qse_mbsxnend (str, qse_mbslen(str), sub, len); +} + +qse_mchar_t* qse_mbsxnend ( + const qse_mchar_t* str, qse_size_t len1, + const qse_mchar_t* sub, qse_size_t len2) +{ + const qse_mchar_t* end1, * end2; + + if (len2 > len1) return QSE_NULL; + + end1 = str + len1; + end2 = sub + len2; + + while (end2 > sub) + { + if (end1 <= str) return QSE_NULL; + if (*(--end1) != *(--end2)) return QSE_NULL; + } + + /* returns the pointer to the match start */ + return (qse_mchar_t*)end1; +} + +qse_wchar_t* qse_wcsend (const qse_wchar_t* str, const qse_wchar_t* sub) +{ + return qse_wcsxnend (str, qse_wcslen(str), sub, qse_wcslen(sub)); +} + +qse_wchar_t* qse_wcsxend ( + const qse_wchar_t* str, qse_size_t len, const qse_wchar_t* sub) +{ + return qse_wcsxnend (str, len, sub, qse_wcslen(sub)); +} + +qse_wchar_t* qse_wcsnend ( + const qse_wchar_t* str, const qse_wchar_t* sub, qse_size_t len) +{ + return qse_wcsxnend (str, qse_wcslen(str), sub, len); +} + +qse_wchar_t* qse_wcsxnend ( + const qse_wchar_t* str, qse_size_t len1, + const qse_wchar_t* sub, qse_size_t len2) +{ + const qse_wchar_t* end1, * end2; + + if (len2 > len1) return QSE_NULL; + + end1 = str + len1; + end2 = sub + len2; + + while (end2 > sub) + { + if (end1 <= str) return QSE_NULL; + if (*(--end1) != *(--end2)) return QSE_NULL; + } + + /* returns the pointer to the match start */ + return (qse_wchar_t*)end1; +} diff --git a/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt b/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt index e2aefcbb..4178639b 100755 --- a/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt +++ b/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt @@ -42,7 +42,7 @@ WVList 0 10 WPickList -50 +51 11 MItem 3 @@ -476,7 +476,7 @@ WVList 107 MItem 32 -..\..\..\..\..\lib\cmn\str_bas.c +..\..\..\..\..\lib\cmn\str_beg.c 108 WString 4 @@ -619,8 +619,8 @@ WVList 0 139 MItem -33 -..\..\..\..\..\lib\cmn\str_fcpy.c +32 +..\..\..\..\..\lib\cmn\str_end.c 140 WString 4 @@ -637,8 +637,8 @@ WVList 0 143 MItem -32 -..\..\..\..\..\lib\cmn\str_len.c +33 +..\..\..\..\..\lib\cmn\str_fcpy.c 144 WString 4 @@ -656,7 +656,7 @@ WVList 147 MItem 32 -..\..\..\..\..\lib\cmn\str_pac.c +..\..\..\..\..\lib\cmn\str_len.c 148 WString 4 @@ -673,8 +673,8 @@ WVList 0 151 MItem -33 -..\..\..\..\..\lib\cmn\str_pbrk.c +32 +..\..\..\..\..\lib\cmn\str_pac.c 152 WString 4 @@ -691,8 +691,8 @@ WVList 0 155 MItem -32 -..\..\..\..\..\lib\cmn\str_put.c +33 +..\..\..\..\..\lib\cmn\str_pbrk.c 156 WString 4 @@ -710,7 +710,7 @@ WVList 159 MItem 32 -..\..\..\..\..\lib\cmn\str_spl.c +..\..\..\..\..\lib\cmn\str_put.c 160 WString 4 @@ -728,7 +728,7 @@ WVList 163 MItem 32 -..\..\..\..\..\lib\cmn\str_spn.c +..\..\..\..\..\lib\cmn\str_spl.c 164 WString 4 @@ -746,7 +746,7 @@ WVList 167 MItem 32 -..\..\..\..\..\lib\cmn\str_str.c +..\..\..\..\..\lib\cmn\str_spn.c 168 WString 4 @@ -763,8 +763,8 @@ WVList 0 171 MItem -34 -..\..\..\..\..\lib\cmn\str_subst.c +32 +..\..\..\..\..\lib\cmn\str_str.c 172 WString 4 @@ -781,8 +781,8 @@ WVList 0 175 MItem -32 -..\..\..\..\..\lib\cmn\str_trm.c +34 +..\..\..\..\..\lib\cmn\str_subst.c 176 WString 4 @@ -799,8 +799,8 @@ WVList 0 179 MItem -33 -..\..\..\..\..\lib\cmn\str_word.c +32 +..\..\..\..\..\lib\cmn\str_trm.c 180 WString 4 @@ -817,8 +817,8 @@ WVList 0 183 MItem -29 -..\..\..\..\..\lib\cmn\time.c +33 +..\..\..\..\..\lib\cmn\str_word.c 184 WString 4 @@ -835,8 +835,8 @@ WVList 0 187 MItem -28 -..\..\..\..\..\lib\cmn\tio.c +29 +..\..\..\..\..\lib\cmn\time.c 188 WString 4 @@ -853,8 +853,8 @@ WVList 0 191 MItem -32 -..\..\..\..\..\lib\cmn\tio_get.c +28 +..\..\..\..\..\lib\cmn\tio.c 192 WString 4 @@ -872,7 +872,7 @@ WVList 195 MItem 32 -..\..\..\..\..\lib\cmn\tio_put.c +..\..\..\..\..\lib\cmn\tio_get.c 196 WString 4 @@ -889,8 +889,8 @@ WVList 0 199 MItem -28 -..\..\..\..\..\lib\cmn\xma.c +32 +..\..\..\..\..\lib\cmn\tio_put.c 200 WString 4 @@ -907,26 +907,26 @@ WVList 0 203 MItem -3 -*.h +28 +..\..\..\..\..\lib\cmn\xma.c 204 WString -3 -NIL +4 +COBJ 205 WVList 0 206 WVList 0 --1 +11 1 1 0 207 MItem -28 -..\..\..\..\..\lib\cmn\mem.h +3 +*.h 208 WString 3 @@ -937,14 +937,14 @@ WVList 210 WVList 0 -203 +-1 1 1 0 211 MItem -32 -..\..\..\..\..\lib\cmn\syscall.h +28 +..\..\..\..\..\lib\cmn\mem.h 212 WString 3 @@ -955,7 +955,25 @@ WVList 214 WVList 0 -203 +207 +1 +1 +0 +215 +MItem +32 +..\..\..\..\..\lib\cmn\syscall.h +216 +WString +3 +NIL +217 +WVList +0 +218 +WVList +0 +207 1 1 0 diff --git a/qse/watcom/debug/win32/lib/cmn/qsecmn.tgt b/qse/watcom/debug/win32/lib/cmn/qsecmn.tgt index b0ded76c..545affb5 100755 --- a/qse/watcom/debug/win32/lib/cmn/qsecmn.tgt +++ b/qse/watcom/debug/win32/lib/cmn/qsecmn.tgt @@ -42,7 +42,7 @@ WVList 0 10 WPickList -50 +51 11 MItem 3 @@ -476,7 +476,7 @@ WVList 107 MItem 32 -..\..\..\..\..\lib\cmn\str_bas.c +..\..\..\..\..\lib\cmn\str_beg.c 108 WString 4 @@ -619,8 +619,8 @@ WVList 0 139 MItem -33 -..\..\..\..\..\lib\cmn\str_fcpy.c +32 +..\..\..\..\..\lib\cmn\str_end.c 140 WString 4 @@ -637,8 +637,8 @@ WVList 0 143 MItem -32 -..\..\..\..\..\lib\cmn\str_len.c +33 +..\..\..\..\..\lib\cmn\str_fcpy.c 144 WString 4 @@ -656,7 +656,7 @@ WVList 147 MItem 32 -..\..\..\..\..\lib\cmn\str_pac.c +..\..\..\..\..\lib\cmn\str_len.c 148 WString 4 @@ -673,8 +673,8 @@ WVList 0 151 MItem -33 -..\..\..\..\..\lib\cmn\str_pbrk.c +32 +..\..\..\..\..\lib\cmn\str_pac.c 152 WString 4 @@ -691,8 +691,8 @@ WVList 0 155 MItem -32 -..\..\..\..\..\lib\cmn\str_put.c +33 +..\..\..\..\..\lib\cmn\str_pbrk.c 156 WString 4 @@ -710,7 +710,7 @@ WVList 159 MItem 32 -..\..\..\..\..\lib\cmn\str_spl.c +..\..\..\..\..\lib\cmn\str_put.c 160 WString 4 @@ -728,7 +728,7 @@ WVList 163 MItem 32 -..\..\..\..\..\lib\cmn\str_spn.c +..\..\..\..\..\lib\cmn\str_spl.c 164 WString 4 @@ -746,7 +746,7 @@ WVList 167 MItem 32 -..\..\..\..\..\lib\cmn\str_str.c +..\..\..\..\..\lib\cmn\str_spn.c 168 WString 4 @@ -763,8 +763,8 @@ WVList 0 171 MItem -34 -..\..\..\..\..\lib\cmn\str_subst.c +32 +..\..\..\..\..\lib\cmn\str_str.c 172 WString 4 @@ -781,8 +781,8 @@ WVList 0 175 MItem -32 -..\..\..\..\..\lib\cmn\str_trm.c +34 +..\..\..\..\..\lib\cmn\str_subst.c 176 WString 4 @@ -799,8 +799,8 @@ WVList 0 179 MItem -33 -..\..\..\..\..\lib\cmn\str_word.c +32 +..\..\..\..\..\lib\cmn\str_trm.c 180 WString 4 @@ -817,8 +817,8 @@ WVList 0 183 MItem -29 -..\..\..\..\..\lib\cmn\time.c +33 +..\..\..\..\..\lib\cmn\str_word.c 184 WString 4 @@ -835,8 +835,8 @@ WVList 0 187 MItem -28 -..\..\..\..\..\lib\cmn\tio.c +29 +..\..\..\..\..\lib\cmn\time.c 188 WString 4 @@ -853,8 +853,8 @@ WVList 0 191 MItem -32 -..\..\..\..\..\lib\cmn\tio_get.c +28 +..\..\..\..\..\lib\cmn\tio.c 192 WString 4 @@ -872,7 +872,7 @@ WVList 195 MItem 32 -..\..\..\..\..\lib\cmn\tio_put.c +..\..\..\..\..\lib\cmn\tio_get.c 196 WString 4 @@ -889,8 +889,8 @@ WVList 0 199 MItem -28 -..\..\..\..\..\lib\cmn\xma.c +32 +..\..\..\..\..\lib\cmn\tio_put.c 200 WString 4 @@ -907,26 +907,26 @@ WVList 0 203 MItem -3 -*.h +28 +..\..\..\..\..\lib\cmn\xma.c 204 WString -3 -NIL +4 +COBJ 205 WVList 0 206 WVList 0 --1 +11 1 1 0 207 MItem -28 -..\..\..\..\..\lib\cmn\mem.h +3 +*.h 208 WString 3 @@ -937,14 +937,14 @@ WVList 210 WVList 0 -203 +-1 1 1 0 211 MItem -32 -..\..\..\..\..\lib\cmn\syscall.h +28 +..\..\..\..\..\lib\cmn\mem.h 212 WString 3 @@ -955,7 +955,25 @@ WVList 214 WVList 0 -203 +207 +1 +1 +0 +215 +MItem +32 +..\..\..\..\..\lib\cmn\syscall.h +216 +WString +3 +NIL +217 +WVList +0 +218 +WVList +0 +207 1 1 0 diff --git a/qse/watcom/qse.wpj b/qse/watcom/qse.wpj index b211b6df..95a8fb00 100755 --- a/qse/watcom/qse.wpj +++ b/qse/watcom/qse.wpj @@ -78,8 +78,8 @@ WRect WFileName 30 release/os2/lib/cmn/qsecmn.tgt -34 -40 +18 +22 20 VComponent 21 @@ -142,8 +142,8 @@ WRect WFileName 28 debug/os2/lib/cmn/qsecmn.tgt -33 -40 +24 +31 32 VComponent 33 @@ -206,8 +206,8 @@ WRect WFileName 30 debug/win32/lib/cmn/qsecmn.tgt -33 -38 +17 +22 44 VComponent 45 diff --git a/qse/watcom/release/os2/lib/cmn/qsecmn.tgt b/qse/watcom/release/os2/lib/cmn/qsecmn.tgt index d98f435b..0628f4cc 100755 --- a/qse/watcom/release/os2/lib/cmn/qsecmn.tgt +++ b/qse/watcom/release/os2/lib/cmn/qsecmn.tgt @@ -42,7 +42,7 @@ WVList 0 10 WPickList -50 +51 11 MItem 3 @@ -540,7 +540,7 @@ WVList 123 MItem 32 -..\..\..\..\..\lib\cmn\str_bas.c +..\..\..\..\..\lib\cmn\str_beg.c 124 WString 4 @@ -683,8 +683,8 @@ WVList 0 155 MItem -33 -..\..\..\..\..\lib\cmn\str_fcpy.c +32 +..\..\..\..\..\lib\cmn\str_end.c 156 WString 4 @@ -701,8 +701,8 @@ WVList 0 159 MItem -32 -..\..\..\..\..\lib\cmn\str_len.c +33 +..\..\..\..\..\lib\cmn\str_fcpy.c 160 WString 4 @@ -720,7 +720,7 @@ WVList 163 MItem 32 -..\..\..\..\..\lib\cmn\str_pac.c +..\..\..\..\..\lib\cmn\str_len.c 164 WString 4 @@ -737,8 +737,8 @@ WVList 0 167 MItem -33 -..\..\..\..\..\lib\cmn\str_pbrk.c +32 +..\..\..\..\..\lib\cmn\str_pac.c 168 WString 4 @@ -755,8 +755,8 @@ WVList 0 171 MItem -32 -..\..\..\..\..\lib\cmn\str_put.c +33 +..\..\..\..\..\lib\cmn\str_pbrk.c 172 WString 4 @@ -774,7 +774,7 @@ WVList 175 MItem 32 -..\..\..\..\..\lib\cmn\str_spl.c +..\..\..\..\..\lib\cmn\str_put.c 176 WString 4 @@ -792,7 +792,7 @@ WVList 179 MItem 32 -..\..\..\..\..\lib\cmn\str_spn.c +..\..\..\..\..\lib\cmn\str_spl.c 180 WString 4 @@ -810,7 +810,7 @@ WVList 183 MItem 32 -..\..\..\..\..\lib\cmn\str_str.c +..\..\..\..\..\lib\cmn\str_spn.c 184 WString 4 @@ -827,8 +827,8 @@ WVList 0 187 MItem -34 -..\..\..\..\..\lib\cmn\str_subst.c +32 +..\..\..\..\..\lib\cmn\str_str.c 188 WString 4 @@ -845,8 +845,8 @@ WVList 0 191 MItem -32 -..\..\..\..\..\lib\cmn\str_trm.c +34 +..\..\..\..\..\lib\cmn\str_subst.c 192 WString 4 @@ -863,8 +863,8 @@ WVList 0 195 MItem -33 -..\..\..\..\..\lib\cmn\str_word.c +32 +..\..\..\..\..\lib\cmn\str_trm.c 196 WString 4 @@ -881,8 +881,8 @@ WVList 0 199 MItem -29 -..\..\..\..\..\lib\cmn\time.c +33 +..\..\..\..\..\lib\cmn\str_word.c 200 WString 4 @@ -899,8 +899,8 @@ WVList 0 203 MItem -28 -..\..\..\..\..\lib\cmn\tio.c +29 +..\..\..\..\..\lib\cmn\time.c 204 WString 4 @@ -917,8 +917,8 @@ WVList 0 207 MItem -32 -..\..\..\..\..\lib\cmn\tio_get.c +28 +..\..\..\..\..\lib\cmn\tio.c 208 WString 4 @@ -936,7 +936,7 @@ WVList 211 MItem 32 -..\..\..\..\..\lib\cmn\tio_put.c +..\..\..\..\..\lib\cmn\tio_get.c 212 WString 4 @@ -953,8 +953,8 @@ WVList 0 215 MItem -28 -..\..\..\..\..\lib\cmn\xma.c +32 +..\..\..\..\..\lib\cmn\tio_put.c 216 WString 4 @@ -971,26 +971,26 @@ WVList 0 219 MItem -3 -*.h +28 +..\..\..\..\..\lib\cmn\xma.c 220 WString -3 -NIL +4 +COBJ 221 WVList 0 222 WVList 0 --1 +11 1 1 0 223 MItem -28 -..\..\..\..\..\lib\cmn\mem.h +3 +*.h 224 WString 3 @@ -1001,14 +1001,14 @@ WVList 226 WVList 0 -219 +-1 1 1 0 227 MItem -32 -..\..\..\..\..\lib\cmn\syscall.h +28 +..\..\..\..\..\lib\cmn\mem.h 228 WString 3 @@ -1019,7 +1019,25 @@ WVList 230 WVList 0 -219 +223 +1 +1 +0 +231 +MItem +32 +..\..\..\..\..\lib\cmn\syscall.h +232 +WString +3 +NIL +233 +WVList +0 +234 +WVList +0 +223 1 1 0