Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-08-28 01:20:10 +0400
committerJeff Johnston <jjohnstn@redhat.com>2002-08-28 01:20:10 +0400
commit7d08241b68428bba98089eb841cef8eddd87f27b (patch)
tree55ed9328010779bb79f48cdcda41c40216a2d421 /newlib/libc/stdlib
parentff2bf8523ba2d3db2fca8e9e2f8be1e4752fa57b (diff)
2002-08-27 Egor Duda <deo@logos-m.ru>
* libc/stdlib/wmemchr.c: New file. * libc/stdlib/wmemcmp.c: Ditto. * libc/stdlib/wmemcpy.c: Ditto. * libc/stdlib/wmemmove.c: Ditto. * libc/stdlib/wmemset.c: Ditto. * libc/stdlib/Makefile.am (GENERAL_SOURCES): Add new files. * configure.host: Default -DMB_CAPABLE for cygwin. * libc/include/wchar.h: Declare wmemchr(), wmemcmp(), wmemcpy(), wmemmove() and wmemset(). Add include of <_ansi.h>. * libc/stdlib/Makefile.in: Regenerate.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/Makefile.am7
-rw-r--r--newlib/libc/stdlib/Makefile.in31
-rw-r--r--newlib/libc/stdlib/wmemchr.c48
-rw-r--r--newlib/libc/stdlib/wmemcmp.c48
-rw-r--r--newlib/libc/stdlib/wmemcpy.c40
-rw-r--r--newlib/libc/stdlib/wmemmove.c40
-rw-r--r--newlib/libc/stdlib/wmemset.c46
7 files changed, 248 insertions, 12 deletions
diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am
index cdd7987a0..d90c8fad4 100644
--- a/newlib/libc/stdlib/Makefile.am
+++ b/newlib/libc/stdlib/Makefile.am
@@ -49,7 +49,12 @@ GENERAL_SOURCES = \
wcstombs.c \
wcstombs_r.c \
wctomb.c \
- wctomb_r.c
+ wctomb_r.c \
+ wmemchr.c \
+ wmemcmp.c \
+ wmemcpy.c \
+ wmemmove.c \
+ wmemset.c
EXTENDED_SOURCES = \
drand48.c \
diff --git a/newlib/libc/stdlib/Makefile.in b/newlib/libc/stdlib/Makefile.in
index 6f72debaf..6baa24f51 100644
--- a/newlib/libc/stdlib/Makefile.in
+++ b/newlib/libc/stdlib/Makefile.in
@@ -155,7 +155,12 @@ GENERAL_SOURCES = \
wcstombs.c \
wcstombs_r.c \
wctomb.c \
- wctomb_r.c
+ wctomb_r.c \
+ wmemchr.c \
+ wmemcmp.c \
+ wmemcpy.c \
+ wmemmove.c \
+ wmemset.c
EXTENDED_SOURCES = \
@@ -307,12 +312,15 @@ LIBS = @LIBS@
@USE_LIBTOOL_FALSE@realloc.$(OBJEXT) strtod.$(OBJEXT) strtol.$(OBJEXT) \
@USE_LIBTOOL_FALSE@strtoul.$(OBJEXT) wcstombs.$(OBJEXT) \
@USE_LIBTOOL_FALSE@wcstombs_r.$(OBJEXT) wctomb.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@wctomb_r.$(OBJEXT) drand48.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@ecvtbuf.$(OBJEXT) efgcvt.$(OBJEXT) erand48.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@jrand48.$(OBJEXT) lcong48.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@lrand48.$(OBJEXT) mrand48.$(OBJEXT) msize.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@mtrim.$(OBJEXT) nrand48.$(OBJEXT) rand48.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@seed48.$(OBJEXT) srand48.$(OBJEXT) strtoll.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@wctomb_r.$(OBJEXT) wmemchr.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@wmemcmp.$(OBJEXT) wmemcpy.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@wmemmove.$(OBJEXT) wmemset.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@drand48.$(OBJEXT) ecvtbuf.$(OBJEXT) efgcvt.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@erand48.$(OBJEXT) jrand48.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@lcong48.$(OBJEXT) lrand48.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@mrand48.$(OBJEXT) msize.$(OBJEXT) mtrim.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@nrand48.$(OBJEXT) rand48.$(OBJEXT) seed48.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@srand48.$(OBJEXT) strtoll.$(OBJEXT) \
@USE_LIBTOOL_FALSE@strtoll_r.$(OBJEXT) strtoull.$(OBJEXT) \
@USE_LIBTOOL_FALSE@strtoull_r.$(OBJEXT)
LTLIBRARIES = $(noinst_LTLIBRARIES)
@@ -326,10 +334,11 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
@USE_LIBTOOL_TRUE@mbstowcs.lo mbstowcs_r.lo mbtowc.lo mbtowc_r.lo \
@USE_LIBTOOL_TRUE@mlock.lo mprec.lo mstats.lo rand.lo rand_r.lo \
@USE_LIBTOOL_TRUE@realloc.lo strtod.lo strtol.lo strtoul.lo wcstombs.lo \
-@USE_LIBTOOL_TRUE@wcstombs_r.lo wctomb.lo wctomb_r.lo drand48.lo \
-@USE_LIBTOOL_TRUE@ecvtbuf.lo efgcvt.lo erand48.lo jrand48.lo lcong48.lo \
-@USE_LIBTOOL_TRUE@lrand48.lo mrand48.lo msize.lo mtrim.lo nrand48.lo \
-@USE_LIBTOOL_TRUE@rand48.lo seed48.lo srand48.lo strtoll.lo \
+@USE_LIBTOOL_TRUE@wcstombs_r.lo wctomb.lo wctomb_r.lo wmemchr.lo \
+@USE_LIBTOOL_TRUE@wmemcmp.lo wmemcpy.lo wmemmove.lo wmemset.lo \
+@USE_LIBTOOL_TRUE@drand48.lo ecvtbuf.lo efgcvt.lo erand48.lo jrand48.lo \
+@USE_LIBTOOL_TRUE@lcong48.lo lrand48.lo mrand48.lo msize.lo mtrim.lo \
+@USE_LIBTOOL_TRUE@nrand48.lo rand48.lo seed48.lo srand48.lo strtoll.lo \
@USE_LIBTOOL_TRUE@strtoll_r.lo strtoull.lo strtoull_r.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
diff --git a/newlib/libc/stdlib/wmemchr.c b/newlib/libc/stdlib/wmemchr.c
new file mode 100644
index 000000000..54487a85b
--- /dev/null
+++ b/newlib/libc/stdlib/wmemchr.c
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <stdlib.h>
+#include <wchar.h>
+
+wchar_t *
+_DEFUN (wmemchr, (s, c, n),
+ const wchar_t *s _AND
+ wchar_t c _AND
+ size_t n)
+{
+ size_t i;
+
+ for (i = 0; i < n; i++) {
+ if (*s == c) {
+ /* LINTED const castaway */
+ return (wchar_t *)s;
+ }
+ s++;
+ }
+ return NULL;
+}
diff --git a/newlib/libc/stdlib/wmemcmp.c b/newlib/libc/stdlib/wmemcmp.c
new file mode 100644
index 000000000..43159aa28
--- /dev/null
+++ b/newlib/libc/stdlib/wmemcmp.c
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * citrus Id: wmemcmp.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <wchar.h>
+
+int
+_DEFUN (wmemcmp, (s1, s2, n),
+ const wchar_t *s1 _AND
+ const wchar_t *s2 _AND
+ size_t n)
+{
+ size_t i;
+
+ for (i = 0; i < n; i++) {
+ if (*s1 != *s2) {
+ /* wchar might be unsigned */
+ return *s1 > *s2 ? 1 : -1;
+ }
+ s1++;
+ s2++;
+ }
+ return 0;
+}
diff --git a/newlib/libc/stdlib/wmemcpy.c b/newlib/libc/stdlib/wmemcpy.c
new file mode 100644
index 000000000..42748b6f4
--- /dev/null
+++ b/newlib/libc/stdlib/wmemcpy.c
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <string.h>
+#include <wchar.h>
+
+wchar_t *
+_DEFUN (wmemcpy, (d, s, n),
+ wchar_t *d _AND
+ const wchar_t *s _AND
+ size_t n)
+{
+
+ return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t));
+}
diff --git a/newlib/libc/stdlib/wmemmove.c b/newlib/libc/stdlib/wmemmove.c
new file mode 100644
index 000000000..38bad3835
--- /dev/null
+++ b/newlib/libc/stdlib/wmemmove.c
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <string.h>
+#include <wchar.h>
+
+wchar_t *
+_DEFUN (wmemmove, (d, s, n),
+ wchar_t *d _AND
+ const wchar_t *s _AND
+ size_t n)
+{
+
+ return (wchar_t *)memmove(d, s, n * sizeof(wchar_t));
+}
diff --git a/newlib/libc/stdlib/wmemset.c b/newlib/libc/stdlib/wmemset.c
new file mode 100644
index 000000000..afe0fe874
--- /dev/null
+++ b/newlib/libc/stdlib/wmemset.c
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c)1999 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * citrus Id: wmemset.c,v 1.2 2000/12/20 14:08:31 itojun Exp
+ */
+
+#include <wchar.h>
+
+wchar_t *
+_DEFUN(wmemset, (s, c, n),
+ wchar_t *s _AND
+ wchar_t c _AND
+ size_t n)
+{
+ size_t i;
+ wchar_t *p;
+
+ p = (wchar_t *)s;
+ for (i = 0; i < n; i++) {
+ *p = c;
+ p++;
+ }
+ return s;
+}