<div dir="ltr">These methods need to be added to newlib not the RTEMS cpukit.<div><br></div><div>The tests can be added to RTEMS.<br><div><br></div><div>--joel</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 12, 2017 at 1:52 PM, Aditya Upadhyay <span dir="ltr"><<a href="mailto:aadit0402@gmail.com" target="_blank">aadit0402@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
cpukit/Makefile.am | 20 +++---<br>
cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> | 4 +-<br>
cpukit/inttypes/Makefile.am | 14 ++++<br>
cpukit/inttypes/imaxabs.c | 44 +++++++++++++<br>
cpukit/inttypes/imaxdiv.c | 53 ++++++++++++++++<br>
cpukit/inttypes/strtoimax.c | 144 ++++++++++++++++++++++++++++++<wbr>++++++++++++<br>
cpukit/inttypes/strtoumax.c | 135 ++++++++++++++++++++++++++++++<wbr>+++++++++<br>
cpukit/inttypes/wcstoimax.c | 151 ++++++++++++++++++++++++++++++<wbr>++++++++++++++<br>
cpukit/inttypes/wcstoumax.c | 144 ++++++++++++++++++++++++++++++<wbr>++++++++++++<br>
cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a> | 59 +++++++++--------<br>
10 files changed, 724 insertions(+), 44 deletions(-)<br>
create mode 100644 cpukit/inttypes/Makefile.am<br>
create mode 100644 cpukit/inttypes/imaxabs.c<br>
create mode 100644 cpukit/inttypes/imaxdiv.c<br>
create mode 100644 cpukit/inttypes/strtoimax.c<br>
create mode 100644 cpukit/inttypes/strtoumax.c<br>
create mode 100644 cpukit/inttypes/wcstoimax.c<br>
create mode 100644 cpukit/inttypes/wcstoumax.c<br>
<br>
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am<br>
index 2c2f2e5..045017e 100644<br>
--- a/cpukit/Makefile.am<br>
+++ b/cpukit/Makefile.am<br>
@@ -7,6 +7,7 @@ include $(top_srcdir)/automake/<a href="http://multilib.am" rel="noreferrer" target="_blank">multili<wbr>b.am</a><br>
_SUBDIRS = . score rtems sapi posix<br>
_SUBDIRS += dev<br>
_SUBDIRS += dtc/libfdt<br>
+_SUBDIRS += inttypes<br>
_SUBDIRS += libcrypt<br>
_SUBDIRS += libcsupport libblock libfs<br>
_SUBDIRS += libdrvmgr<br>
@@ -59,25 +60,22 @@ include_HEADERS += include/memory.h<br>
include_HEADERS += libmisc/xz/xz.h<br>
<br>
include_sys_HEADERS += libcsupport/include/sys/event.<wbr>h<br>
-include_sys_HEADERS += libcsupport/include/sys/poll.h<br>
-include_sys_HEADERS += libcsupport/include/sys/<wbr>statvfs.h<br>
-include_sys_HEADERS += libcsupport/include/sys/<wbr>utsname.h<br>
-<br>
-include_sys_HEADERS += include/sys/endian.h<br>
-include_sys_HEADERS += include/sys/priority.h<br>
-<br>
-if !HAS_NEWLIB_20170522_HEADER<br>
-include_sys_HEADERS += include/sys/_iovec.h<br>
-include_sys_HEADERS += include/sys/uio.h<br>
include_sys_HEADERS += libcsupport/include/sys/filio.<wbr>h<br>
include_sys_HEADERS += libcsupport/include/sys/<wbr>ioccom.h<br>
include_sys_HEADERS += libcsupport/include/sys/ioctl.<wbr>h<br>
+include_sys_HEADERS += libcsupport/include/sys/poll.h<br>
include_sys_HEADERS += libcsupport/include/sys/<wbr>sockio.h<br>
+include_sys_HEADERS += libcsupport/include/sys/<wbr>statvfs.h<br>
include_sys_HEADERS += libcsupport/include/sys/_<wbr>termios.h<br>
include_sys_HEADERS += libcsupport/include/sys/<wbr>termios.h<br>
include_sys_HEADERS += libcsupport/include/sys/<wbr>ttycom.h<br>
include_sys_HEADERS += libcsupport/include/sys/<wbr>ttydefaults.h<br>
-endif<br>
+include_sys_HEADERS += libcsupport/include/sys/<wbr>utsname.h<br>
+<br>
+include_sys_HEADERS += include/sys/endian.h<br>
+include_sys_HEADERS += include/sys/uio.h<br>
+include_sys_HEADERS += include/sys/_iovec.h<br>
+include_sys_HEADERS += include/sys/priority.h<br>
<br>
if LIBNETWORKING<br>
include_rtems_bsdnetdir = $(includedir)/rtems/bsdnet<br>
diff --git a/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 8d5b322..ad0865b 100644<br>
--- a/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -166,9 +166,6 @@ if test x"$RTEMS_USE_NEWLIB" = xyes ; then<br>
AC_CHECK_DECLS([__getreent],[]<wbr>,[RTEMS_TOOL_CHAIN_ERROR],[#<wbr>include <sys/reent.h>])<br>
fi<br>
<br>
-AC_CHECK_HEADER([sys/socket.<wbr>h],[],[])<br>
-AM_CONDITIONAL(HAS_NEWLIB_<wbr>20170522_HEADER,[test x"${ac_cv_header_sys_socket_h}<wbr>" = xyes])<br>
-<br>
RTEMS_CHECK_MULTIPROCESSING<br>
RTEMS_CHECK_POSIX_API<br>
RTEMS_CHECK_NETWORKING<br>
@@ -464,6 +461,7 @@ score/cpu/sparc64/Makefile<br>
score/cpu/v850/Makefile<br>
score/cpu/no_cpu/Makefile<br>
posix/Makefile<br>
+inttypes/Makefile<br>
libblock/Makefile<br>
libdrvmgr/Makefile<br>
libfs/Makefile<br>
diff --git a/cpukit/inttypes/Makefile.am b/cpukit/inttypes/Makefile.am<br>
new file mode 100644<br>
index 0000000..c90b872<br>
--- /dev/null<br>
+++ b/cpukit/inttypes/Makefile.am<br>
@@ -0,0 +1,14 @@<br>
+include $(top_srcdir)/automake/<a href="http://multilib.am" rel="noreferrer" target="_blank">multili<wbr>b.am</a><br>
+include $(top_srcdir)/automake/<a href="http://compile.am" rel="noreferrer" target="_blank">compile<wbr>.am</a><br>
+<br>
+<br>
+noinst_LIBRARIES = libinttypes.a<br>
+<br>
+libinttypes_a_SOURCES = imaxdiv.c imaxabs.c strtoimax.c strtoumax.c wcstoimax.c wcstoumax.c<br>
+<br>
+libinttypes_a_CPPFLAGS = $(AM_CPPFLAGS)<br>
+<br>
+<br>
+#include $(srcdir)/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a><br>
+include $(top_srcdir)/automake/<a href="http://subdirs.am" rel="noreferrer" target="_blank">subdirs<wbr>.am</a><br>
+include $(top_srcdir)/automake/<a href="http://local.am" rel="noreferrer" target="_blank">local.<wbr>am</a><br>
diff --git a/cpukit/inttypes/imaxabs.c b/cpukit/inttypes/imaxabs.c<br>
new file mode 100644<br>
index 0000000..fe9331f<br>
--- /dev/null<br>
+++ b/cpukit/inttypes/imaxabs.c<br>
@@ -0,0 +1,44 @@<br>
+/*-<br>
+ * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org><br>
+ * All rights reserved.<br>
+ *<br>
+ * Redistribution and use in source and binary forms, with or without<br>
+ * modification, are permitted provided that the following conditions<br>
+ * are met:<br>
+ * 1. Redistributions of source code must retain the above copyright<br>
+ * notice, this list of conditions and the following disclaimer.<br>
+ * 2. Redistributions in binary form must reproduce the above copyright<br>
+ * notice, this list of conditions and the following disclaimer in the<br>
+ * documentation and/or other materials provided with the distribution.<br>
+ *<br>
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND<br>
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE<br>
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL<br>
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS<br>
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)<br>
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT<br>
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY<br>
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF<br>
+ * SUCH DAMAGE.<br>
+ */<br>
+<br>
+#if HAVE_CONFIG_H<br>
+#include "config.h"<br>
+#endif<br>
+<br>
+/* intmax_t data type defined here */<br>
+<br>
+#include <stdint.h><br>
+#include <stdio.h><br>
+<br>
+#include <rtems/inttypes.h><br>
+<br>
+<br>
+intmax_t<br>
+imaxabs(<br>
+ intmax_t j)<br>
+{<br>
+ return (j < 0 ? -j : j);<br>
+}<br>
diff --git a/cpukit/inttypes/imaxdiv.c b/cpukit/inttypes/imaxdiv.c<br>
new file mode 100644<br>
index 0000000..765481e<br>
--- /dev/null<br>
+++ b/cpukit/inttypes/imaxdiv.c<br>
@@ -0,0 +1,53 @@<br>
+/*-<br>
+ * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org><br>
+ * All rights reserved.<br>
+ *<br>
+ * Redistribution and use in source and binary forms, with or without<br>
+ * modification, are permitted provided that the following conditions<br>
+ * are met:<br>
+ * 1. Redistributions of source code must retain the above copyright<br>
+ * notice, this list of conditions and the following disclaimer.<br>
+ * 2. Redistributions in binary form must reproduce the above copyright<br>
+ * notice, this list of conditions and the following disclaimer in the<br>
+ * documentation and/or other materials provided with the distribution.<br>
+ *<br>
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND<br>
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE<br>
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL<br>
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS<br>
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)<br>
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT<br>
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY<br>
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF<br>
+ * SUCH DAMAGE.<br>
+ */<br>
+<br>
+#if HAVE_CONFIG_H<br>
+#include "config.h"<br>
+#endif<br>
+<br>
+/* intmax_t data type defined here */<br>
+<br>
+#include <stdint.h><br>
+<br>
+#include <rtems/inttypes.h><br>
+<br>
+imaxdiv_t<br>
+imaxdiv(<br>
+ intmax_t numer, intmax_t denom)<br>
+{<br>
+ imaxdiv_t retval;<br>
+<br>
+ retval.quot = numer / denom;<br>
+ retval.rem = numer % denom;<br>
+<br>
+ #if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)<br>
+ if (numer >= 0 && retval.rem < 0) {<br>
+ retval.quot++;<br>
+ retval.rem -= denom;<br>
+ }<br>
+ #endif<br>
+ return (retval);<br>
+}<br>
diff --git a/cpukit/inttypes/strtoimax.c b/cpukit/inttypes/strtoimax.c<br>
new file mode 100644<br>
index 0000000..092a2a9<br>
--- /dev/null<br>
+++ b/cpukit/inttypes/strtoimax.c<br>
@@ -0,0 +1,144 @@<br>
+/**<br>
+ * This file has no copyright assigned and is placed in the Public Domain.<br>
+ * This file is part of the mingw-w64 runtime package.<br>
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.<br>
+ */<br>
+<br>
+/*<br>
+ * This source code was extracted from the Q8 package created and<br>
+ * placed in the PUBLIC DOMAIN by Doug Gwyn <<a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a>><br>
+ * last edit: 1999/11/05 <a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a><br>
+ *<br>
+ * Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).<br>
+ *<br>
+ * This particular implementation requires the matching <inttypes.h>.<br>
+ * It also assumes that character codes for A..Z and a..z are in<br>
+ * contiguous ascending order; this is true for ASCII but not EBCDIC.<br>
+ */<br>
+<br>
+#include <stdlib.h><br>
+#include <errno.h><br>
+#include <ctype.h><br>
+#include <inttypes.h><br>
+<br>
+/* Helper macros */<br>
+<br>
+/* convert digit character to number, in any base */<br>
+<br>
+#define ToNumber(c) (isdigit(c) ? (c) - '0' : \<br>
+ isupper(c) ? (c) - 'A' + 10 : \<br>
+ islower(c) ? (c) - 'a' + 10 : \<br>
+ -1 /* "invalid" flag */ \<br>
+ )<br>
+/* validate converted digit character for specific base */<br>
+<br>
+#define valid(n, b) ((n) >= 0 && (n) < (b))<br>
+<br>
+intmax_t<br>
+strtoimax(<br>
+ nptr, endptr, base)<br>
+ register const char * __restrict__ nptr;<br>
+ char ** __restrict__ endptr;<br>
+ register int base;<br>
+{<br>
+ register uintmax_t accum;<br>
+ register int n;<br>
+ int minus;<br>
+ int toobig;<br>
+<br>
+ /* in case no conversion's performed */<br>
+<br>
+ if (endptr != NULL)<br>
+ *endptr = (char *)nptr;<br>
+<br>
+ /* unspecified behavior */<br>
+<br>
+ if (base < 0 || base == 1 || base > 36){<br>
+ errno = EDOM;<br>
+ return 0;<br>
+ }<br>
+<br>
+ /* skip initial, possibly empty sequence of white-space characters */<br>
+<br>
+ while (isspace(*nptr))<br>
+ ++nptr;<br>
+<br>
+ /* process subject sequence: */<br>
+<br>
+ /* optional sign */<br>
+<br>
+ if ((minus = *nptr == '-') || *nptr == '+')<br>
+ ++nptr;<br>
+<br>
+ if (base == 0) {<br>
+ if (*nptr == '0') {<br>
+ if (nptr[1] == 'X' || nptr[1] == 'x'){<br>
+ base = 16;<br>
+ }else{<br>
+ base = 8;<br>
+ }<br>
+ }else{<br>
+ base = 10;<br>
+ }<br>
+<br>
+ }<br>
+<br>
+ /* optional "0x" or "0X" for base 16 */<br>
+<br>
+ /* skip past this prefix */<br>
+<br>
+ if (base == 16 && *nptr == '0' && (nptr[1] == 'X' || nptr[1] == 'x'))<br>
+ nptr += 2;<br>
+<br>
+ /* check whether there is at least one valid digit */<br>
+<br>
+ n = ToNumber(*nptr);<br>
+ ++nptr;<br>
+<br>
+ /* subject seq. not of expected form */<br>
+<br>
+ if (!valid(n, base))<br>
+ return 0;<br>
+<br>
+ accum = n;<br>
+<br>
+ for (toobig = 0; n = ToNumber(*nptr), valid(n, base); ++nptr)<br>
+<br>
+ /* major wrap-around */<br>
+<br>
+ if (accum > (uintmax_t)(INTMAX_MAX / base + 2))<br>
+<br>
+ /* but keep scanning */<br>
+<br>
+ toobig = 1;<br>
+ else<br>
+ accum = base * accum + n;<br>
+<br>
+ /* points to first not-valid-digit */<br>
+<br>
+ if (endptr != NULL)<br>
+ *endptr = (char *)nptr;<br>
+<br>
+ if (minus){<br>
+ if (accum > (uintmax_t)INTMAX_MAX + 1)<br>
+ toobig = 1;<br>
+ }<br>
+ else<br>
+ if (accum > (uintmax_t)INTMAX_MAX)<br>
+ toobig = 1;<br>
+<br>
+ if (toobig){<br>
+ errno = ERANGE;<br>
+ return minus ? INTMAX_MIN : INTMAX_MAX;<br>
+ }<br>
+ else<br>
+ return (intmax_t)(minus ? -accum : accum);<br>
+}<br>
+<br>
+long long __attribute__ (<br>
+(alias ("strtoimax")))<br>
+<br>
+strtoll (<br>
+const char* __restrict__ nptr,<br>
+char ** __restrict__ endptr, int base );<br>
+<br>
diff --git a/cpukit/inttypes/strtoumax.c b/cpukit/inttypes/strtoumax.c<br>
new file mode 100644<br>
index 0000000..48c818b<br>
--- /dev/null<br>
+++ b/cpukit/inttypes/strtoumax.c<br>
@@ -0,0 +1,135 @@<br>
+/**<br>
+ * This file has no copyright assigned and is placed in the Public Domain.<br>
+ * This file is part of the mingw-w64 runtime package.<br>
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.<br>
+ */<br>
+<br>
+/*<br>
+ * This source code was extracted from the Q8 package created and<br>
+ * placed in the PUBLIC DOMAIN by Doug Gwyn <<a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a>><br>
+ * last edit: 1999/11/05 <a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a><br>
+ *<br>
+ * Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).<br>
+ *<br>
+ * This particular implementation requires the matching <inttypes.h>.<br>
+ * It also assumes that character codes for A..Z and a..z are in<br>
+ * contiguous ascending order; this is true for ASCII but not EBCDIC.<br>
+*/<br>
+<br>
+#include <stdlib.h><br>
+#include <errno.h><br>
+#include <ctype.h><br>
+#include <inttypes.h><br>
+<br>
+/* Helper macros */<br>
+<br>
+/* convert digit character to number, in any base */<br>
+<br>
+#define ToNumber(c) (isdigit(c) ? (c) - '0' : \<br>
+ isupper(c) ? (c) - 'A' + 10 : \<br>
+ islower(c) ? (c) - 'a' + 10 : \<br>
+ -1 /* "invalid" flag */ \<br>
+ )<br>
+/* validate converted digit character for specific base */<br>
+<br>
+#define valid(n, b) ((n) >= 0 && (n) < (b))<br>
+<br>
+uintmax_t<br>
+strtoumax(<br>
+ nptr, endptr, base)<br>
+ register const char * __restrict__ nptr;<br>
+ char ** __restrict__ endptr;<br>
+ register int base;<br>
+{<br>
+ register uintmax_t accum;<br>
+ register uintmax_t next;<br>
+ register int n;<br>
+ int minus;<br>
+ int toobig;<br>
+<br>
+ /* in case no conversion's performed */<br>
+<br>
+ if ( endptr != NULL )<br>
+ *endptr = (char *)nptr;<br>
+<br>
+ /* unspecified behavior */<br>
+<br>
+ if ( base < 0 || base == 1 || base > 36 ){<br>
+ errno = EDOM;<br>
+ return 0;<br>
+ }<br>
+<br>
+ /* skip initial, possibly empty sequence of white-space characters */<br>
+<br>
+ while ( isspace(*nptr) )<br>
+ ++nptr;<br>
+<br>
+ /* process subject sequence: */<br>
+<br>
+ /* optional sign (yes!) */<br>
+<br>
+ if ((minus = *nptr == '-') || *nptr == '+')<br>
+ ++nptr;<br>
+<br>
+ if (base == 0){<br>
+ if (*nptr == '0'){<br>
+ if (nptr[1] == 'X' || nptr[1] == 'x')<br>
+ base = 16;<br>
+ else<br>
+ base = 8;<br>
+ }<br>
+ else<br>
+ base = 10;<br>
+ }<br>
+<br>
+ /* optional "0x" or "0X" for base 16 */<br>
+<br>
+ if (base == 16 && *nptr == '0' && (nptr[1] == 'X' || nptr[1] == 'x'))<br>
+<br>
+ /* skip past this prefix */<br>
+<br>
+ nptr += 2;<br>
+<br>
+ /* check whether there is at least one valid digit */<br>
+<br>
+ n = ToNumber(*nptr);<br>
+ ++nptr;<br>
+<br>
+ /* subject seq. not of expected form */<br>
+<br>
+ if ( !valid(n, base) )<br>
+ return 0;<br>
+<br>
+ accum = n;<br>
+<br>
+ for ( toobig = 0; n = ToNumber(*nptr), valid(n, base); ++nptr )<br>
+<br>
+ /* major wrap-around and minor wrap-around */<br>
+<br>
+ if (accum > UINTMAX_MAX / base + 1 || (next = base * accum + n) < accum)<br>
+<br>
+ /* but keep scanning */<br>
+<br>
+ toobig = 1;<br>
+ else<br>
+ accum = next;<br>
+<br>
+ /* points to first not-valid-digit */<br>
+<br>
+ if (endptr != NULL)<br>
+ *endptr = (char *)nptr;<br>
+<br>
+ if (toobig){<br>
+ errno = ERANGE;<br>
+ return UINTMAX_MAX;<br>
+ }<br>
+ else<br>
+ return minus ? -accum : accum; /* (yes!) */<br>
+}<br>
+<br>
+unsigned long long<br>
+ __attribute__ (<br>
+ (alias ("strtoumax")))<br>
+strtoull (const char* __restrict__ nptr,<br>
+ char ** __restrict__ endptr, int base);<br>
+<br>
diff --git a/cpukit/inttypes/wcstoimax.c b/cpukit/inttypes/wcstoimax.c<br>
new file mode 100644<br>
index 0000000..4ec0e91<br>
--- /dev/null<br>
+++ b/cpukit/inttypes/wcstoimax.c<br>
@@ -0,0 +1,151 @@<br>
+/**<br>
+ * This file has no copyright assigned and is placed in the Public Domain.<br>
+ * This file is part of the mingw-w64 runtime package.<br>
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.<br>
+ */<br>
+<br>
+/*<br>
+ * This source code was extracted from the Q8 package created and<br>
+ * placed in the PUBLIC DOMAIN by Doug Gwyn <<a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a>><br>
+ * last edit: 1999/11/05 <a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a><br>
+ * Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).<br>
+ * This particular implementation requires the matching <inttypes.h>.<br>
+ * It also assumes that character codes for A..Z and a..z are in<br>
+ * contiguous ascending order; this is true for ASCII but not EBCDIC.<br>
+*/<br>
+<br>
+#include <wchar.h><br>
+#include <errno.h><br>
+#include <ctype.h><br>
+#include <inttypes.h><br>
+<br>
+/* convert digit wide character to number, in any base */<br>
+<br>
+#define ToWNumber(c) (iswdigit(c) ? (c) - L'0' : \<br>
+ iswupper(c) ? (c) - L'A' + 10 : \<br>
+ iswlower(c) ? (c) - L'a' + 10 : \<br>
+ -1 /* "invalid" flag */ \<br>
+ )<br>
+<br>
+/* validate converted digit character for specific base */<br>
+<br>
+#define valid(n, b) ((n) >= 0 && (n) < (b))<br>
+<br>
+intmax_t<br>
+wcstoimax(<br>
+ nptr, endptr, base)<br>
+ register const wchar_t * __restrict__ nptr;<br>
+ wchar_t ** __restrict__ endptr;<br>
+ register int base;<br>
+{<br>
+ /* accumulates converted value */<br>
+<br>
+ register uintmax_t accum;<br>
+<br>
+ /* numeral from digit character */<br>
+<br>
+ register int n;<br>
+<br>
+ /* set iff minus sign seen */<br>
+<br>
+ int minus;<br>
+<br>
+ /* set iff value overflows */<br>
+<br>
+ int toobig;<br>
+<br>
+ /* in case no conv performed */<br>
+<br>
+ if (endptr != NULL)<br>
+ *endptr = (wchar_t *)nptr;<br>
+<br>
+ /* unspecified behavior */<br>
+<br>
+ if (base < 0 || base == 1 || base > 36){<br>
+ errno = EDOM;<br>
+ return 0;<br>
+ }<br>
+<br>
+ /* skip initial, possibly empty sequence of white-space w.characters */<br>
+<br>
+ while (iswspace(*nptr))<br>
+ ++nptr;<br>
+<br>
+ /* process subject sequence: */<br>
+<br>
+ /* optional sign */<br>
+<br>
+ if ((minus = *nptr == L'-') || *nptr == L'+')<br>
+ ++nptr;<br>
+<br>
+ if (base == 0){<br>
+ if (*nptr == L'0'){<br>
+ if (nptr[1] == L'X' || nptr[1] == L'x')<br>
+ base = 16;<br>
+ else<br>
+ base = 8;<br>
+ }<br>
+ else<br>
+ base = 10;<br>
+ }<br>
+<br>
+ /* optional "0x" or "0X" for base 16 */<br>
+<br>
+ if ( base == 16 && *nptr == L'0' && (nptr[1] == L'X' || nptr[1] == L'x'))<br>
+<br>
+ /* skip past this prefix */<br>
+<br>
+ nptr += 2;<br>
+<br>
+ /* check whether there is at least one valid digit */<br>
+<br>
+ n = ToWNumber(*nptr);<br>
+ ++nptr;<br>
+<br>
+ /* subject seq. not of expected form */<br>
+<br>
+ if (!valid(n, base))<br>
+ return 0;<br>
+<br>
+ accum = n;<br>
+<br>
+ for (toobig = 0; n = ToWNumber(*nptr), valid(n, base); ++nptr)<br>
+<br>
+ /* major wrap-around */<br>
+<br>
+ if (accum > (uintmax_t)(INTMAX_MAX / base + 2))<br>
+<br>
+ /* but keep scanning */<br>
+<br>
+ toobig = 1;<br>
+ else<br>
+ accum = base * accum + n;<br>
+<br>
+ /* -> first not-valid-digit */<br>
+<br>
+ if (endptr != NULL)<br>
+ *endptr = (wchar_t *)nptr;<br>
+<br>
+ if (minus){<br>
+ if (accum > (uintmax_t)INTMAX_MAX + 1)<br>
+ toobig = 1;<br>
+ }<br>
+ else<br>
+ if (accum > (uintmax_t)INTMAX_MAX)<br>
+ toobig = 1;<br>
+<br>
+ if (toobig){<br>
+ errno = ERANGE;<br>
+ return minus ? INTMAX_MIN : INTMAX_MAX;<br>
+ }<br>
+ else<br>
+ return (intmax_t)(minus ? -accum : accum);<br>
+}<br>
+<br>
+long long<br>
+__attribute__ (<br>
+ (alias ("wcstoimax")))<br>
+wcstoll (<br>
+ const wchar_t* __restrict__ nptr,<br>
+ wchar_t ** __restrict__ endptr, int base);<br>
+<br>
diff --git a/cpukit/inttypes/wcstoumax.c b/cpukit/inttypes/wcstoumax.c<br>
new file mode 100644<br>
index 0000000..890126e<br>
--- /dev/null<br>
+++ b/cpukit/inttypes/wcstoumax.c<br>
@@ -0,0 +1,144 @@<br>
+/**<br>
+ * This file has no copyright assigned and is placed in the Public Domain.<br>
+ * This file is part of the mingw-w64 runtime package.<br>
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.<br>
+ */<br>
+<br>
+/*<br>
+ * This source code was extracted from the Q8 package created and<br>
+ * placed in the PUBLIC DOMAIN by Doug Gwyn <<a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a>><br>
+ * last edit: 1999/11/05 <a href="mailto:gwyn@arl.mil">gwyn@arl.mil</a><br>
+ * Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).<br>
+ * This particular implementation requires the matching <inttypes.h>.<br>
+ * It also assumes that character codes for A..Z and a..z are in<br>
+ * contiguous ascending order; this is true for ASCII but not EBCDIC.<br>
+*/<br>
+<br>
+#include <wchar.h><br>
+#include <errno.h><br>
+#include <ctype.h><br>
+#include <inttypes.h><br>
+<br>
+/* convert digit wide character to number, in any base */<br>
+<br>
+#define ToWNumber(c) (iswdigit(c) ? (c) - L'0' : \<br>
+ iswupper(c) ? (c) - L'A' + 10 : \<br>
+ iswlower(c) ? (c) - L'a' + 10 : \<br>
+ -1 /* "invalid" flag */ \<br>
+ )<br>
+<br>
+/* validate converted digit character for specific base */<br>
+#define valid(n, b) ((n) >= 0 && (n) < (b))<br>
+<br>
+uintmax_t<br>
+wcstoumax(<br>
+ nptr, endptr, base)<br>
+ register const wchar_t * __restrict__ nptr;<br>
+ wchar_t ** __restrict__ endptr;<br>
+ register int base;<br>
+{<br>
+ /* accumulates converted value */<br>
+<br>
+ register uintmax_t accum, next;<br>
+<br>
+ /* numeral from digit character */<br>
+<br>
+ register int n;<br>
+<br>
+ /* set iff minus sign seen */<br>
+<br>
+ int minus;<br>
+<br>
+ /* set iff value overflows */<br>
+<br>
+ int toobig;<br>
+<br>
+ /* in case no conv performed */<br>
+<br>
+ if (endptr != NULL)<br>
+ *endptr = (wchar_t *)nptr;<br>
+<br>
+ /* unspecified behavior */<br>
+<br>
+ if (base < 0 || base == 1 || base > 36){<br>
+ errno = EDOM;<br>
+ return 0;<br>
+ }<br>
+<br>
+<br>
+ /* skip initial, possibly empty sequence of white-space w.characters */<br>
+<br>
+ while (iswspace(*nptr))<br>
+ ++nptr;<br>
+<br>
+ /* process subject sequence: */<br>
+<br>
+ /* optional sign */<br>
+<br>
+ if ((minus = *nptr == L'-') || *nptr == L'+')<br>
+ ++nptr;<br>
+<br>
+ if (base == 0){<br>
+ if (*nptr == L'0'){<br>
+ if (nptr[1] == L'X' || nptr[1] == L'x')<br>
+ base = 16;<br>
+ else<br>
+ base = 8;<br>
+ }<br>
+ else<br>
+ base = 10;<br>
+ }<br>
+<br>
+ /* optional "0x" or "0X" for base 16 */<br>
+<br>
+ if ( base == 16 && *nptr == L'0' && (nptr[1] == L'X' || nptr[1] == L'x'))<br>
+<br>
+ /* skip past this prefix */<br>
+<br>
+ nptr += 2;<br>
+<br>
+ /* check whether there is at least one valid digit */<br>
+<br>
+ n = ToWNumber(*nptr);<br>
+ ++nptr;<br>
+<br>
+ /* subject seq. not of expected form */<br>
+<br>
+ if (!valid(n, base))<br>
+ return 0;<br>
+<br>
+ accum = n;<br>
+<br>
+ for (toobig = 0; n = ToWNumber(*nptr), valid(n, base); ++nptr)<br>
+<br>
+ /* minor wrap-around */<br>
+<br>
+ if (accum > UINTMAX_MAX / base + 1 || (next = base * accum + n) < accum)<br>
+<br>
+ /* but keep scanning */<br>
+<br>
+ toobig = 1;<br>
+ else<br>
+ accum = next;<br>
+<br>
+ /* -> first not-valid-digit */<br>
+<br>
+ if ( endptr != NULL )<br>
+ *endptr = (wchar_t *)nptr;<br>
+<br>
+ if ( toobig )<br>
+ {<br>
+ errno = ERANGE;<br>
+ return UINTMAX_MAX;<br>
+ }<br>
+ else<br>
+ return minus ? -accum : accum; /* (yes!) */<br>
+}<br>
+<br>
+unsigned long long<br>
+__attribute__ (<br>
+ (alias ("wcstoumax")))<br>
+wcstoull (<br>
+ const wchar_t* __restrict__ nptr,<br>
+ wchar_t ** __restrict__ endptr, int base);<br>
+<br>
diff --git a/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a> b/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a><br>
index ef09294..6f94076 100644<br>
--- a/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a><br>
+++ b/cpukit/<a href="http://preinstall.am" rel="noreferrer" target="_blank">preinstall.am</a><br>
@@ -71,35 +71,6 @@ $(PROJECT_INCLUDE)/sys/event.<wbr>h: libcsupport/include/sys/event.<wbr>h $(PROJECT_INCLUD<br>
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/event.h<br>
PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/event.h<br>
<br>
-$(PROJECT_INCLUDE)/sys/poll.<wbr>h: libcsupport/include/sys/poll.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/poll.h<br>
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/poll.h<br>
-<br>
-$(PROJECT_INCLUDE)/sys/<wbr>statvfs.h: libcsupport/include/sys/<wbr>statvfs.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/<wbr>statvfs.h<br>
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/<wbr>statvfs.h<br>
-<br>
-$(PROJECT_INCLUDE)/sys/<wbr>utsname.h: libcsupport/include/sys/<wbr>utsname.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/<wbr>utsname.h<br>
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/<wbr>utsname.h<br>
-<br>
-$(PROJECT_INCLUDE)/sys/<wbr>endian.h: include/sys/endian.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/endian.<wbr>h<br>
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/endian.<wbr>h<br>
-<br>
-$(PROJECT_INCLUDE)/sys/<wbr>priority.h: include/sys/priority.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/<wbr>priority.h<br>
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/<wbr>priority.h<br>
-<br>
-if !HAS_NEWLIB_20170522_HEADER<br>
-$(PROJECT_INCLUDE)/sys/_<wbr>iovec.h: include/sys/_iovec.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/_iovec.<wbr>h<br>
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/_iovec.<wbr>h<br>
-<br>
-$(PROJECT_INCLUDE)/sys/uio.h: include/sys/uio.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/uio.h<br>
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/uio.h<br>
-<br>
$(PROJECT_INCLUDE)/sys/filio.<wbr>h: libcsupport/include/sys/filio.<wbr>h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/filio.h<br>
PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/filio.h<br>
@@ -112,10 +83,18 @@ $(PROJECT_INCLUDE)/sys/ioctl.<wbr>h: libcsupport/include/sys/ioctl.<wbr>h $(PROJECT_INCLUD<br>
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/ioctl.h<br>
PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/ioctl.h<br>
<br>
+$(PROJECT_INCLUDE)/sys/poll.<wbr>h: libcsupport/include/sys/poll.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/poll.h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/poll.h<br>
+<br>
$(PROJECT_INCLUDE)/sys/sockio.<wbr>h: libcsupport/include/sys/<wbr>sockio.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/sockio.<wbr>h<br>
PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/sockio.<wbr>h<br>
<br>
+$(PROJECT_INCLUDE)/sys/<wbr>statvfs.h: libcsupport/include/sys/<wbr>statvfs.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/<wbr>statvfs.h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/<wbr>statvfs.h<br>
+<br>
$(PROJECT_INCLUDE)/sys/_<wbr>termios.h: libcsupport/include/sys/_<wbr>termios.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/_<wbr>termios.h<br>
PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/_<wbr>termios.h<br>
@@ -131,7 +110,27 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/ttycom.<wbr>h<br>
$(PROJECT_INCLUDE)/sys/<wbr>ttydefaults.h: libcsupport/include/sys/<wbr>ttydefaults.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/<wbr>ttydefaults.h<br>
PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/<wbr>ttydefaults.h<br>
-endif<br>
+<br>
+$(PROJECT_INCLUDE)/sys/<wbr>utsname.h: libcsupport/include/sys/<wbr>utsname.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/<wbr>utsname.h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/<wbr>utsname.h<br>
+<br>
+$(PROJECT_INCLUDE)/sys/<wbr>endian.h: include/sys/endian.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/endian.<wbr>h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/endian.<wbr>h<br>
+<br>
+$(PROJECT_INCLUDE)/sys/uio.h: include/sys/uio.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/uio.h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/uio.h<br>
+<br>
+$(PROJECT_INCLUDE)/sys/_<wbr>iovec.h: include/sys/_iovec.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/_iovec.<wbr>h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/_iovec.<wbr>h<br>
+<br>
+$(PROJECT_INCLUDE)/sys/<wbr>priority.h: include/sys/priority.h $(PROJECT_INCLUDE)/sys/$(<wbr>dirstamp)<br>
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/<wbr>priority.h<br>
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/<wbr>priority.h<br>
+<br>
if LIBNETWORKING<br>
$(PROJECT_INCLUDE)/rtems/<wbr>bsdnet/$(dirstamp):<br>
@$(MKDIR_P) $(PROJECT_INCLUDE)/rtems/<wbr>bsdnet<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
</font></span></blockquote></div><br></div>