diff --git a/qse/cmd/scm/scm.c b/qse/cmd/scm/scm.c
index f2d84993..17908df5 100644
--- a/qse/cmd/scm/scm.c
+++ b/qse/cmd/scm/scm.c
@@ -234,7 +234,8 @@ pio1 (QSE_T("pstat.exe /c"), QSE_PIO_READOUT|QSE_PIO_WRITEIN|/*QSE_PIO_SHELL|*/Q
{
qse_printf (QSE_T("%d\n"), (int)qse_strspn (QSE_T("abcdefg"), QSE_T("cdab")));
- qse_printf (QSE_T("%d\n"), (int)qse_strcspn (QSE_T("abcdefg"), QSE_T("fg")));
+ qse_printf (QSE_T("%d\n"), (int)qse_strcspn (QSE_T("abcdefg"), QSE_T("fg")));
+ qse_printf (QSE_T("%s\n"), qse_strpbrk (QSE_T("abcdefg"), QSE_T("fb")));
}
{
diff --git a/qse/include/qse/cmn/str.h b/qse/include/qse/cmn/str.h
index 56c7da80..f8daece3 100644
--- a/qse/include/qse/cmn/str.h
+++ b/qse/include/qse/cmn/str.h
@@ -1,5 +1,5 @@
/*
- * $Id: str.h 407 2011-03-23 02:21:14Z hyunghwan.chung $
+ * $Id: str.h 408 2011-03-23 02:45:39Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@@ -653,6 +653,34 @@ qse_size_t qse_wcscspn (
# define qse_strcspn(str1,str2) qse_wcscspn(str1,str2)
#endif
+/*
+ * The qse_mbspbrk() function searches @a str1 for the first occurrence of
+ * a character in @a str2.
+ * @return pointer to the first occurrence in @a str1 if one is found.
+ * QSE_NULL if none is found.
+ */
+qse_mchar_t* qse_mbspbrk (
+ const qse_mchar_t* str1,
+ const qse_mchar_t* str2
+);
+
+/*
+ * The qse_wcspbrk() function searches @a str1 for the first occurrence of
+ * a character in @a str2.
+ * @return pointer to the first occurrence in @a str1 if one is found.
+ * QSE_NULL if none is found.
+ */
+qse_wchar_t* qse_wcspbrk (
+ const qse_wchar_t* str1,
+ const qse_wchar_t* str2
+);
+
+#ifdef QSE_CHAR_IS_MCHAR
+# define qse_strpbrk(str1,str2) qse_mbspbrk(str1,str2)
+#else
+# define qse_strpbrk(str1,str2) qse_wcspbrk(str1,str2)
+#endif
+
/*
* string conversion
*/
diff --git a/qse/lib/cmn/str_pbrk.c b/qse/lib/cmn/str_pbrk.c
new file mode 100644
index 00000000..d24020e9
--- /dev/null
+++ b/qse/lib/cmn/str_pbrk.c
@@ -0,0 +1,53 @@
+/*
+ * $Id: str_cnv.c 402 2011-03-18 15:07:21Z 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
+
+qse_mchar_t* qse_mbspbrk (const qse_mchar_t* str1, const qse_mchar_t* str2)
+{
+ const qse_mchar_t* p1, * p2;
+
+ for (p1 = str1; *p1 != QSE_MT('\0'); p1++)
+ {
+ for (p2 = str2; *p2 != QSE_MT('\0'); p2++)
+ {
+ if (*p2 == *p1) return (qse_mchar_t*)p1;
+ }
+ }
+
+ return QSE_NULL;
+}
+
+qse_wchar_t* qse_wcspbrk (const qse_wchar_t* str1, const qse_wchar_t* str2)
+{
+ const qse_wchar_t* p1, * p2;
+
+ for (p1 = str1; *p1 != QSE_WT('\0'); p1++)
+ {
+ for (p2 = str2; *p2 != QSE_WT('\0'); p2++)
+ {
+ if (*p2 == *p1) return (qse_wchar_t*)p1;
+ }
+ }
+
+ return QSE_NULL;
+}
+
diff --git a/qse/lib/cmn/str_spn.c b/qse/lib/cmn/str_spn.c
new file mode 100644
index 00000000..d8fdf276
--- /dev/null
+++ b/qse/lib/cmn/str_spn.c
@@ -0,0 +1,106 @@
+/*
+ * $Id: str_cnv.c 402 2011-03-18 15:07:21Z 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
+
+qse_size_t qse_mbsspn (const qse_mchar_t* str1, const qse_mchar_t* str2)
+{
+ const qse_mchar_t* p1, * p2;
+ qse_size_t n = 0;
+
+ for (p1 = str1; *p1 != QSE_MT('\0'); p1++)
+ {
+ for (p2 = str2; *p2 != QSE_MT('\0'); p2++)
+ {
+ if (*p2 == *p1) goto matched;
+ }
+
+ /* didn't match anything */
+ break;
+
+ matched:
+ n++;
+ }
+
+ return n;
+}
+
+qse_size_t qse_wcsspn (const qse_wchar_t* str1, const qse_wchar_t* str2)
+{
+ const qse_wchar_t* p1, * p2;
+ qse_size_t n = 0;
+
+ for (p1 = str1; *p1 != QSE_WT('\0'); p1++)
+ {
+ for (p2 = str2; *p2 != QSE_WT('\0'); p2++)
+ {
+ if (*p2 == *p1) goto matched;
+ }
+
+ /* didn't match anything */
+ break;
+
+ matched:
+ n++;
+ }
+
+ return n;
+}
+
+qse_size_t qse_mbscspn (const qse_mchar_t* str1, const qse_mchar_t* str2)
+{
+ const qse_mchar_t* p1, * p2;
+ qse_size_t n = 0;
+
+ for (p1 = str1; *p1 != QSE_WT('\0'); p1++)
+ {
+ for (p2 = str2; *p2 != QSE_WT('\0'); p2++)
+ {
+ if (*p2 == *p1) goto done;
+ }
+
+ /* didn't match anything. increment the length */
+ n++;
+ }
+
+done:
+ return n;
+}
+
+qse_size_t qse_wcscspn (const qse_wchar_t* str1, const qse_wchar_t* str2)
+{
+ const qse_wchar_t* p1, * p2;
+ qse_size_t n = 0;
+
+ for (p1 = str1; *p1 != QSE_WT('\0'); p1++)
+ {
+ for (p2 = str2; *p2 != QSE_WT('\0'); p2++)
+ {
+ if (*p2 == *p1) goto done;
+ }
+
+ /* didn't match anything. increment the length */
+ n++;
+ }
+
+done:
+ return n;
+}
diff --git a/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt b/qse/watcom/debug/os2/lib/cmn/qsecmn.tgt
index 954b12ef..05e8a822 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
-36
+37
11
MItem
3
@@ -529,8 +529,8 @@ WVList
0
119
MItem
-32
-..\..\..\..\..\lib\cmn\str_spn.c
+33
+..\..\..\..\..\lib\cmn\str_pbrk.c
120
WString
4
@@ -548,7 +548,7 @@ WVList
123
MItem
32
-..\..\..\..\..\lib\cmn\str_utl.c
+..\..\..\..\..\lib\cmn\str_spn.c
124
WString
4
@@ -565,8 +565,8 @@ WVList
0
127
MItem
-29
-..\..\..\..\..\lib\cmn\time.c
+32
+..\..\..\..\..\lib\cmn\str_utl.c
128
WString
4
@@ -583,8 +583,8 @@ WVList
0
131
MItem
-28
-..\..\..\..\..\lib\cmn\tio.c
+29
+..\..\..\..\..\lib\cmn\time.c
132
WString
4
@@ -601,8 +601,8 @@ WVList
0
135
MItem
-32
-..\..\..\..\..\lib\cmn\tio_get.c
+28
+..\..\..\..\..\lib\cmn\tio.c
136
WString
4
@@ -620,7 +620,7 @@ WVList
139
MItem
32
-..\..\..\..\..\lib\cmn\tio_put.c
+..\..\..\..\..\lib\cmn\tio_get.c
140
WString
4
@@ -637,8 +637,8 @@ WVList
0
143
MItem
-28
-..\..\..\..\..\lib\cmn\xma.c
+32
+..\..\..\..\..\lib\cmn\tio_put.c
144
WString
4
@@ -655,26 +655,26 @@ WVList
0
147
MItem
-3
-*.h
+28
+..\..\..\..\..\lib\cmn\xma.c
148
WString
-3
-NIL
+4
+COBJ
149
WVList
0
150
WVList
0
--1
+11
1
1
0
151
MItem
-28
-..\..\..\..\..\lib\cmn\mem.h
+3
+*.h
152
WString
3
@@ -685,14 +685,14 @@ WVList
154
WVList
0
-147
+-1
1
1
0
155
MItem
-32
-..\..\..\..\..\lib\cmn\syscall.h
+28
+..\..\..\..\..\lib\cmn\mem.h
156
WString
3
@@ -703,7 +703,25 @@ WVList
158
WVList
0
-147
+151
+1
+1
+0
+159
+MItem
+32
+..\..\..\..\..\lib\cmn\syscall.h
+160
+WString
+3
+NIL
+161
+WVList
+0
+162
+WVList
+0
+151
1
1
0
diff --git a/qse/watcom/qse.wpj b/qse/watcom/qse.wpj
index 96b863ca..3ce53608 100755
--- a/qse/watcom/qse.wpj
+++ b/qse/watcom/qse.wpj
@@ -66,8 +66,8 @@ WRect
WFileName
30
release/os2/lib/cmn/qsecmn.tgt
-0
-14
+25
+25
17
VComponent
18
@@ -124,14 +124,14 @@ WRect
320
5700
4240
-0
+1
0
28
WFileName
28
debug/os2/lib/cmn/qsecmn.tgt
19
-27
+26
29
VComponent
30
@@ -163,7 +163,7 @@ WFileName
28
debug/os2/lib/scm/qsescm.tgt
0
-3
+4
35
VComponent
36
@@ -180,4 +180,4 @@ WFileName
debug/os2/cmd/scm/qsescm.tgt
0
1
-26
+32
diff --git a/qse/watcom/release/os2/lib/cmn/qsecmn.tgt b/qse/watcom/release/os2/lib/cmn/qsecmn.tgt
index 8ecbb688..82152496 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
-36
+37
11
MItem
3
@@ -593,8 +593,8 @@ WVList
0
135
MItem
-32
-..\..\..\..\..\lib\cmn\str_spn.c
+33
+..\..\..\..\..\lib\cmn\str_pbrk.c
136
WString
4
@@ -612,47 +612,47 @@ WVList
139
MItem
32
-..\..\..\..\..\lib\cmn\str_utl.c
+..\..\..\..\..\lib\cmn\str_spn.c
140
WString
4
COBJ
141
WVList
-1
-142
-MVState
-143
-WString
-3
-WCC
-144
-WString
-25
-o?2??Include directories:
-1
-145
-WString
-54
-"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
0
-146
+142
WVList
0
11
1
1
0
-147
+143
MItem
-29
-..\..\..\..\..\lib\cmn\time.c
-148
+32
+..\..\..\..\..\lib\cmn\str_utl.c
+144
WString
4
COBJ
-149
+145
WVList
+1
+146
+MVState
+147
+WString
+3
+WCC
+148
+WString
+25
+o?2??Include directories:
+1
+149
+WString
+54
+"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
0
150
WVList
@@ -663,8 +663,8 @@ WVList
0
151
MItem
-28
-..\..\..\..\..\lib\cmn\tio.c
+29
+..\..\..\..\..\lib\cmn\time.c
152
WString
4
@@ -681,8 +681,8 @@ WVList
0
155
MItem
-32
-..\..\..\..\..\lib\cmn\tio_get.c
+28
+..\..\..\..\..\lib\cmn\tio.c
156
WString
4
@@ -700,7 +700,7 @@ WVList
159
MItem
32
-..\..\..\..\..\lib\cmn\tio_put.c
+..\..\..\..\..\lib\cmn\tio_get.c
160
WString
4
@@ -717,8 +717,8 @@ WVList
0
163
MItem
-28
-..\..\..\..\..\lib\cmn\xma.c
+32
+..\..\..\..\..\lib\cmn\tio_put.c
164
WString
4
@@ -735,26 +735,26 @@ WVList
0
167
MItem
-3
-*.h
+28
+..\..\..\..\..\lib\cmn\xma.c
168
WString
-3
-NIL
+4
+COBJ
169
WVList
0
170
WVList
0
--1
+11
1
1
0
171
MItem
-28
-..\..\..\..\..\lib\cmn\mem.h
+3
+*.h
172
WString
3
@@ -765,14 +765,14 @@ WVList
174
WVList
0
-167
+-1
1
1
0
175
MItem
-32
-..\..\..\..\..\lib\cmn\syscall.h
+28
+..\..\..\..\..\lib\cmn\mem.h
176
WString
3
@@ -783,7 +783,25 @@ WVList
178
WVList
0
-167
+171
+1
+1
+0
+179
+MItem
+32
+..\..\..\..\..\lib\cmn\syscall.h
+180
+WString
+3
+NIL
+181
+WVList
+0
+182
+WVList
+0
+171
1
1
0