This list is closed, nobody may subscribe to it.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(13) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
|
Jun
(38) |
Jul
(10) |
Aug
(70) |
Sep
(63) |
Oct
(61) |
Nov
(41) |
Dec
(28) |
| 2002 |
Jan
(43) |
Feb
(11) |
Mar
(9) |
Apr
(2) |
May
(97) |
Jun
(94) |
Jul
(13) |
Aug
(49) |
Sep
(41) |
Oct
(24) |
Nov
(55) |
Dec
(126) |
| 2003 |
Jan
(90) |
Feb
(75) |
Mar
(32) |
Apr
(24) |
May
(54) |
Jun
(54) |
Jul
(22) |
Aug
(4) |
Sep
(16) |
Oct
(8) |
Nov
(6) |
Dec
(13) |
| 2004 |
Jan
|
Feb
(17) |
Mar
(60) |
Apr
(21) |
May
(12) |
Jun
|
Jul
(13) |
Aug
|
Sep
(29) |
Oct
|
Nov
|
Dec
(2) |
| 2005 |
Jan
(22) |
Feb
(3) |
Mar
(2) |
Apr
(13) |
May
(82) |
Jun
(18) |
Jul
(30) |
Aug
(17) |
Sep
(3) |
Oct
(19) |
Nov
(4) |
Dec
(8) |
| 2006 |
Jan
(1) |
Feb
(6) |
Mar
(2) |
Apr
(40) |
May
|
Jun
(21) |
Jul
(1) |
Aug
(410) |
Sep
(3) |
Oct
|
Nov
(56) |
Dec
(7) |
| 2007 |
Jan
(19) |
Feb
|
Mar
(4) |
Apr
(8) |
May
(19) |
Jun
(6) |
Jul
(4) |
Aug
(6) |
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(2) |
| 2008 |
Jan
(13) |
Feb
(18) |
Mar
(12) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
(6) |
Mar
(8) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
(11) |
Oct
(13) |
Nov
(17) |
Dec
(6) |
| 2010 |
Jan
(24) |
Feb
(10) |
Mar
(27) |
Apr
(20) |
May
(108) |
Jun
(8) |
Jul
(23) |
Aug
(38) |
Sep
(49) |
Oct
(17) |
Nov
(12) |
Dec
(14) |
| 2011 |
Jan
(17) |
Feb
(7) |
Mar
(28) |
Apr
(8) |
May
(20) |
Jun
(11) |
Jul
(7) |
Aug
(12) |
Sep
(4) |
Oct
(20) |
Nov
(19) |
Dec
(2) |
| 2012 |
Jan
(2) |
Feb
(6) |
Mar
(5) |
Apr
(24) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(18) |
Sep
(38) |
Oct
(26) |
Nov
(12) |
Dec
(6) |
| 2013 |
Jan
(19) |
Feb
(18) |
Mar
(44) |
Apr
(35) |
May
(18) |
Jun
(21) |
Jul
(10) |
Aug
(19) |
Sep
(44) |
Oct
(25) |
Nov
(1) |
Dec
(2) |
| 2014 |
Jan
(8) |
Feb
|
Mar
|
Apr
(5) |
May
(1) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
(4) |
Nov
(4) |
Dec
(7) |
| 2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(4) |
Jul
(6) |
Aug
(2) |
Sep
(8) |
Oct
(2) |
Nov
(1) |
Dec
(3) |
| 2016 |
Jan
(7) |
Feb
(9) |
Mar
(5) |
Apr
(5) |
May
(9) |
Jun
(4) |
Jul
(20) |
Aug
(4) |
Sep
(7) |
Oct
(6) |
Nov
(9) |
Dec
(2) |
| 2017 |
Jan
(7) |
Feb
(7) |
Mar
(5) |
Apr
|
May
(1) |
Jun
(4) |
Jul
(12) |
Aug
(4) |
Sep
(1) |
Oct
(4) |
Nov
(11) |
Dec
(14) |
| 2018 |
Jan
(3) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
|
2
(3) |
3
|
4
|
5
|
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
|
13
|
14
|
15
(1) |
16
|
17
|
18
(1) |
19
|
|
20
|
21
(1) |
22
|
23
|
24
|
25
|
26
(1) |
|
27
(1) |
28
(1) |
29
|
30
|
|
|
|
|
From: Keith M. <no...@so...> - 2016-11-28 14:17:34
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via baddeff0bb85a2054392eb93292f21436d8db1f4 (commit)
from 4e63e20ec6744810e18508ffc6ceaddfb1bd4b9d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/baddeff0bb85a2054392eb93292f21436d8db1f4/
commit baddeff0bb85a2054392eb93292f21436d8db1f4
Author: Keith Marshall <kei...@us...>
Date: Mon Nov 28 14:14:48 2016 +0000
Implement POSIX.1 compatible setenv() and unsetenv() functions.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index d902839..df2e26e 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,17 @@
+2016-11-28 Keith Marshall <kei...@us...>
+
+ Implement POSIX.1 compatible setenv() and unsetenv() functions.
+
+ * mingwex/setenv.c: New file; it implements...
+ (__mingw_setenv): ...this function, providing common code for...
+ * include/stdlib.h [_POSIX_C_SOURCE >= 200112L] (setenv, unsetenv):
+ ...these user visible functions, implemented as __CRT_ALIAS inlines;
+ qualify them as __JMPSTUB__ and __LIBIMPL__ respectively, so ensuring
+ that their corresponding external representations are automatically
+ added to libmingwex.a
+
+ * Makefile.in (libmingwex.a): Add setenv.$OBJEXT
+
2016-11-27 Keith Marshall <kei...@us...>
Work around another C++11 compliance issue; fix bug [#2321].
diff --git a/mingwrt/Makefile.in b/mingwrt/Makefile.in
index c95d788..0a3e5c3 100644
--- a/mingwrt/Makefile.in
+++ b/mingwrt/Makefile.in
@@ -491,7 +491,7 @@ $(addsuffix fmt.$(OBJEXT),varo crto geto seto crtn getn setn): %.$(OBJEXT): ofmt
#
libmingwex.a: $(addsuffix .$(OBJEXT), mingw-aligned-malloc mingw-fseek)
libmingwex.a: $(addsuffix .$(OBJEXT), glob getopt basename dirname nsleep)
-libmingwex.a: $(addsuffix .$(OBJEXT), mkstemp mkdtemp cryptnam)
+libmingwex.a: $(addsuffix .$(OBJEXT), mkstemp mkdtemp cryptnam setenv)
libmingwex.a: $(addsuffix .$(OBJEXT), tdelete tfind tsearch twalk)
diff --git a/mingwrt/include/stdlib.h b/mingwrt/include/stdlib.h
index e4b98f6..7ca7eb7 100644
--- a/mingwrt/include/stdlib.h
+++ b/mingwrt/include/stdlib.h
@@ -824,6 +824,24 @@ __cdecl __MINGW_NOTHROW char *mkdtemp (char *__dirname_template)
{ return __mingw_mkdtemp( __dirname_template ); }
#endif /* _POSIX_C_SOURCE >= 200809L (for mkdtemp()) */
+
+#if _POSIX_C_SOURCE >= 200112L
+/* setenv() and unsetenv() are also available, from POSIX.1-2001 onwards.
+ */
+__cdecl __MINGW_NOTHROW int setenv( const char *, const char *, int );
+__cdecl __MINGW_NOTHROW int unsetenv( const char * );
+
+__cdecl __MINGW_NOTHROW int __mingw_setenv( const char *, const char *, int );
+
+__CRT_ALIAS __JMPSTUB__(( FUNCTION = setenv ))
+__cdecl __MINGW_NOTHROW int setenv( const char *__n, const char *__v, int __f )
+{ return __mingw_setenv( __n, __v, __f ); }
+
+__CRT_ALIAS __LIBIMPL__(( FUNCTION = unsetenv ))
+__cdecl __MINGW_NOTHROW int unsetenv( const char *__name )
+{ return __mingw_setenv( __name, NULL, 1 ); }
+
+#endif /* _POSIX_C_SOURCE >= 200112L (for setenv()) */
#endif /* _STDLIB_H */
_END_C_DECLS
diff --git a/mingwrt/mingwex/setenv.c b/mingwrt/mingwex/setenv.c
new file mode 100644
index 0000000..57b804d
--- /dev/null
+++ b/mingwrt/mingwex/setenv.c
@@ -0,0 +1,105 @@
+/*
+ * setenv.c
+ *
+ * Implementation of POSIX standard IEEE 1003.1-2001 setenv() function;
+ * may also be invoked inline, as "retval = setenv( varname, NULL, 1 )",
+ * to implement the complementary unsetenv() function.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#define _POSIX_C_SOURCE 200112L
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+int __mingw_setenv( const char *var, const char *value, int overwrite )
+{
+ /* Core implementation for both setenv() and unsetenv() functions;
+ * at the outset, assume that the requested operation may fail.
+ */
+ int retval = -1;
+
+ /* The specified "var" name MUST be non-NULL, not a zero-length
+ * string, and must not include any '=' character.
+ */
+ if( var && *var && (strchr( var, '=' ) == NULL) )
+ {
+ /* A properly named variable may be added to, removed from,
+ * or modified within the environment, ONLY if "overwrite"
+ * mode is enabled, OR if the named variable does not yet
+ * exist...
+ */
+ if( overwrite || getenv( var ) == NULL )
+ {
+ /* ... in which cases, we convert the specified name and
+ * value into the appropriate form for use with putenv(),
+ * (noting that we accept a NULL "value" as equivalent to
+ * a zero-length string, which renders putenv() as the
+ * equivalent of unsetenv()).
+ */
+ const char *fmt = "%s=%s";
+ const char *val = value ? value : "";
+ char buf[1 + snprintf( NULL, 0, fmt, var, val )];
+ snprintf( buf, sizeof( buf ), fmt, var, val );
+
+ /* "buf" is now formatted as "var=value", in the form
+ * required by putenv(), but it exists only within our
+ * volatile stack-frame space. POSIX.1 suggests that we
+ * should copy it to more persistent storage, before it
+ * is passed to putenv(), to associate an environment
+ * pointer with it. However, we note that Microsoft's
+ * putenv() implementation appears to make such a copy
+ * in any case, so we do not do so; (in fact, if we did
+ * strdup() it (say), then we would leak memory).
+ */
+ if( (retval = putenv( buf )) != 0 )
+ /*
+ * If putenv() returns non-zero, indicating failure, the
+ * most probable explanation is that there wasn't enough
+ * free memory; ensure that errno is set accordingly.
+ */
+ errno = ENOMEM;
+ }
+ else
+ /* The named variable already exists, and overwrite mode
+ * was not enabled; there is nothing to be done.
+ */
+ retval = 0;
+ }
+ else
+ /* The specified environment variable name was invalid.
+ */
+ errno = EINVAL;
+
+ /* Succeed or fail, "retval" has now been set to indicate the
+ * appropriate status for return.
+ */
+ return retval;
+}
+
+/* $RCSfile$: end of file */
-----------------------------------------------------------------------
Summary of changes:
mingwrt/ChangeLog | 14 ++++++
mingwrt/Makefile.in | 2 +-
mingwrt/include/stdlib.h | 18 ++++++++
mingwrt/mingwex/setenv.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 138 insertions(+), 1 deletions(-)
create mode 100644 mingwrt/mingwex/setenv.c
hooks/post-receive
--
Repository: mingw-org-wsl
|
|
From: Keith M. <no...@so...> - 2016-11-27 12:57:50
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via 4e63e20ec6744810e18508ffc6ceaddfb1bd4b9d (commit)
from d03bac43951c5b26c4e7a4db2b9362ec9f65f653 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/4e63e20ec6744810e18508ffc6ceaddfb1bd4b9d/
commit 4e63e20ec6744810e18508ffc6ceaddfb1bd4b9d
Author: Keith Marshall <kei...@us...>
Date: Sun Nov 27 12:40:01 2016 +0000
Work around another C++11 compliance issue; fix bug [#2321].
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 3a71f3a..d902839 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,11 @@
+2016-11-27 Keith Marshall <kei...@us...>
+
+ Work around another C++11 compliance issue; fix bug [#2321].
+
+ * include/excpt.h (__try1_setup, __except1_teardown): Add spaces to
+ separate each use of '__wsize' and '__ts' macros from all surrounding
+ string literals, to ensure that C++ parses them as distinct tokens.
+
2016-11-21 Keith Marshall <kei...@us...>
Replace defective powf() and powl() function implementations.
diff --git a/mingwrt/include/excpt.h b/mingwrt/include/excpt.h
index df03176..c5eebbb 100644
--- a/mingwrt/include/excpt.h
+++ b/mingwrt/include/excpt.h
@@ -135,8 +135,8 @@ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
__hook = __typecast_alloca( EXCEPTION_REGISTRATION ); \
__hook->handler = __handler; \
__asm__ __volatile__ \
- ( "mov{%z0}\t{%%|%0, "__wsize" }"__ts":{|[}0x0{, %0|]}\n\t" \
- "mov{%z1}\t{%1, %%|"__wsize" }"__ts":{|[}0x0{|], %1}" \
+ ( "mov{%z0}\t{%%|%0, " __wsize " }" __ts ":{|[}0x0{, %0|]}\n\t" \
+ "mov{%z1}\t{%1, %%|" __wsize " }" __ts ":{|[}0x0{|], %1}" \
:"=r"(__hook->prev):"r"(__hook):"memory" \
); \
}
@@ -152,9 +152,9 @@ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
#define __except1_teardown(__wsize,__ts) \
{ register EXCEPTION_REGISTRATION *__hook; \
__asm__ __volatile__ \
- ( "mov{%z0}\t{%%|%0, "__wsize" }"__ts":{|[}0x0{, %0|]}\n\t" \
- "mov{%z0}\t{(}%0{)}, {|"__wsize" [}%0{|]}\n\t" \
- "mov{%z0}\t{%0, %%|"__wsize" }"__ts":{|[}0x0{|], %0}" \
+ ( "mov{%z0}\t{%%|%0, " __wsize " }" __ts ":{|[}0x0{, %0|]}\n\t" \
+ "mov{%z0}\t{(}%0{)}, {|" __wsize " [}%0{|]}\n\t" \
+ "mov{%z0}\t{%0, %%|" __wsize " }" __ts ":{|[}0x0{|], %0}" \
:"+r"(__hook)::"memory" \
); \
}
-----------------------------------------------------------------------
Summary of changes:
mingwrt/ChangeLog | 8 ++++++++
mingwrt/include/excpt.h | 10 +++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
hooks/post-receive
--
Repository: mingw-org-wsl
|
|
From: Keith M. <no...@so...> - 2016-11-26 22:37:52
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via d03bac43951c5b26c4e7a4db2b9362ec9f65f653 (commit)
via 8d57d999b93b2bc755e94ca9841a3536cfc86aa6 (commit)
from ae89720834d70256a18af17ca64ff49892431c63 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/d03bac43951c5b26c4e7a4db2b9362ec9f65f653/
commit d03bac43951c5b26c4e7a4db2b9362ec9f65f653
Author: Keith Marshall <kei...@us...>
Date: Sat Nov 26 22:35:10 2016 +0000
Deprecate obsolete <winable.h> and <pbt.h> headers.
diff --git a/w32api/ChangeLog b/w32api/ChangeLog
index bae99c6..8313972 100644
--- a/w32api/ChangeLog
+++ b/w32api/ChangeLog
@@ -1,3 +1,17 @@
+2016-11-26 Keith Marshall <kei...@us...>
+
+ Deprecate obsolete <winable.h> and <pbt.h> headers.
+
+ * Makefile.in (%.h.in): Generalize vpath definition.
+ (obsolete_headers, obsolete_header_script, w32api_dist_headers)
+ (w32api_generated_headers, replace_headers, macro_name): New macros.
+ (install-w32api-headers): Add dependency on w32api_dist_headers.
+ (%.h): New static pattern rule; it generates generic dependants of...
+ * include/obsolete.h.in: ...this new template for obsolete headers.
+
+ * include/winable.h include/pbt.h: Delete them; they are obsolete;
+ replace them by install-time generated generic stubs.
+
2016-11-25 Keith Marshall <kei...@us...>
Update <winuser.h> and <dbt.h>; fix issue [#2317].
diff --git a/w32api/Makefile.in b/w32api/Makefile.in
index 97d28b1..da832cc 100644
--- a/w32api/Makefile.in
+++ b/w32api/Makefile.in
@@ -120,8 +120,7 @@ ${top_srcdir}/%: ${top_srcdir}/../%
# Propagate package version, as configured, consistently throughout
# the package build.
#
-vpath w32api.h.in ${top_srcdir}/include
-vpath _mingw.h.in ${mingwrt_srcdir}/include
+vpath %.h.in ${top_srcdir}/include ${mingwrt_srcdir}/include
w32api.h _mingw.h: configure.ac
@@ -264,8 +263,28 @@ w32api-include-dirs: includedir
w32api-lib-dirs: libdir
install-headers: install-w32api-headers
-install-w32api-headers: w32api.h w32api-include-dirs
- $(call INSTALL_DATA,w32api.h ${srcdir}/include/*.h,${includedir})
+
+obsolete_headers := winable.h pbt.h
+winable.h pbt.h: replacement = winuser.h
+
+$(obsolete_headers): %.h: obsolete.h.in
+ $(if $(subst ./,,$(dir $@)),mkdir -p $(@D))
+ $(obsolete_header_script) $< > $@
+
+obsolete_header_script = sed -e 's,%HEADER%,$@,' \
+ -e "s,%PACKAGE%,$(call macro_name,$(PACKAGE_TARNAME))," \
+ -e 's,<REPLACEMENT>,$(call replace_header,$(replacement)),' \
+ -e "s,%GUARD_MACRO%,$(call macro_name,$@)," \
+ -e 's,%REPLACEMENT%,$(replacement),'
+
+replace_header = $(if $(subst ./,,$(dir $1)),<$1>,"$1")
+macro_name = `echo $1 | tr .a-z- _A-Z_`
+
+w32api_generated_headers := w32api.h $(obsolete_headers)
+w32api_dist_headers := $(w32api_generated_headers) ${srcdir}/include/*.h
+
+install-w32api-headers: $(w32api_dist_headers) w32api-include-dirs
+ $(call INSTALL_DATA,$(w32api_dist_headers),${includedir})
for dir in $(w32api_extra_include_dirs); do \
$(call INSTALL_DATA,${srcdir}/include/$$dir/*.h,${includedir}); \
done
diff --git a/w32api/include/obsolete.h.in b/w32api/include/obsolete.h.in
new file mode 100644
index 0000000..a69b561
--- /dev/null
+++ b/w32api/include/obsolete.h.in
@@ -0,0 +1,50 @@
+/*
+ * %HEADER%
+ *
+ * Obsolete header replaced by <%REPLACEMENT%>; this stub is retained for
+ * backward compatibility only.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice, this permission notice, and the following
+ * disclaimer shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef _%GUARD_MACRO%
+#pragma GCC system_header
+#define _%GUARD_MACRO%
+
+/* Header <%HEADER%> is obsolete, and we would like to advise the user to
+ * use <%REPLACEMENT%> instead; however...
+ */
+#ifndef __IN_%PACKAGE%_TESTSUITE__
+/* ...this warning may interfere with any testsuite results, so display it
+ * only in normal use, (i.e. suppress it when running the testsuite)...
+ */
+#warning "<%HEADER%> is obsolete; please use <%REPLACEMENT%> instead."
+#endif
+/* ...always including the appropriate replacement header, regardless.
+ */
+#include <REPLACEMENT>
+
+#endif /* !_%GUARD_MACRO%: $RCSfile$: end of file */
diff --git a/w32api/include/pbt.h b/w32api/include/pbt.h
deleted file mode 100644
index 21cb1cd..0000000
--- a/w32api/include/pbt.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _PBT_H
-#define _PBT_H
-#if __GNUC__ >= 3
-#pragma GCC system_header
-#endif
-
-/* Also in winuser.h */
-#define PBT_APMQUERYSUSPEND 0
-#define PBT_APMQUERYSTANDBY 1
-#define PBT_APMQUERYSUSPENDFAILED 2
-#define PBT_APMQUERYSTANDBYFAILED 3
-#define PBT_APMSUSPEND 4
-#define PBT_APMSTANDBY 5
-#define PBT_APMRESUMECRITICAL 6
-#define PBT_APMRESUMESUSPEND 7
-#define PBT_APMRESUMESTANDBY 8
-#define PBT_APMBATTERYLOW 9
-#define PBT_APMPOWERSTATUSCHANGE 10
-#define PBT_APMOEMEVENT 11
-#define PBT_APMRESUMEAUTOMATIC 18
-
-#define PBTF_APMRESUMEFROMFAILURE 1
-
-#endif
diff --git a/w32api/include/winable.h b/w32api/include/winable.h
deleted file mode 100644
index 0228293..0000000
--- a/w32api/include/winable.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef _WINABLE_H
-#define _WINABLE_H
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if (_WIN32_WINNT < 0x0403)
-#define INPUT_MOUSE 0x00000000
-#define INPUT_KEYBOARD 0x00000001
-#define INPUT_HARDWARE 0x00000002
-#endif /* (_WIN32_WINNT < 0x04030) */
-#if (WINVER < 0x0500)
-#define CHILDID_SELF 0
-#define OBJID_WINDOW 0x00000000
-#define OBJID_SYSMENU 0xFFFFFFFF
-#define OBJID_TITLEBAR 0xFFFFFFFE
-#define OBJID_MENU 0xFFFFFFFD
-#define OBJID_CLIENT 0xFFFFFFFC
-#define OBJID_VSCROLL 0xFFFFFFFB
-#define OBJID_HSCROLL 0xFFFFFFFA
-#define OBJID_SIZEGRIP 0xFFFFFFF9
-#define OBJID_CARET 0xFFFFFFF8
-#define OBJID_CURSOR 0xFFFFFFF7
-#define OBJID_ALERT 0xFFFFFFF6
-#define OBJID_SOUND 0xFFFFFFF5
-#define GUI_CARETBLINKING 0x00000001
-#define GUI_INMOVESIZE 0x00000002
-#define GUI_INMENUMODE 0x00000004
-#define GUI_SYSTEMMENUMODE 0x00000008
-#define GUI_POPUPMENUMODE 0x00000010
-#define WINEVENT_OUTOFCONTEXT 0x0000
-#define WINEVENT_SKIPOWNTHREAD 0x0001
-#define WINEVENT_SKIPOWNPROCESS 0x0002
-#define WINEVENT_INCONTEXT 0x0004
-#endif /* (WINVER < 0x0500) */
-#if (_WIN32_WINNT < 0x0403)
-typedef struct tagMOUSEINPUT {
- LONG dx;
- LONG dy;
- DWORD mouseData;
- DWORD dwFlags;
- DWORD time;
- ULONG_PTR dwExtraInfo;
-} MOUSEINPUT,*PMOUSEINPUT;
-typedef struct tagKEYBDINPUT {
- WORD wVk;
- WORD wScan;
- DWORD dwFlags;
- DWORD time;
- ULONG_PTR dwExtraInfo;
-} KEYBDINPUT,*PKEYBDINPUT;
-typedef struct tagHARDWAREINPUT {
- DWORD uMsg;
- WORD wParamL;
- WORD wParamH;
-} HARDWAREINPUT,*PHARDWAREINPUT;
-typedef struct tagINPUT {
- DWORD type;
- _ANONYMOUS_UNION union {
- MOUSEINPUT mi;
- KEYBDINPUT ki;
- HARDWAREINPUT hi;
- } DUMMYUNIONNAME;
-} INPUT,*PINPUT,*LPINPUT;
-#endif /* (_WIN32_WINNT < 0x0403) */
-#if (WINVER < 0x0500)
-typedef VOID (*WINEVENTPROC)(HWINEVENTHOOK,DWORD,HWND,LONG,LONG,DWORD,DWORD);
-typedef struct tagGUITHREADINFO {
- DWORD cbSize;
- DWORD flags;
- HWND hwndActive;
- HWND hwndFocus;
- HWND hwndCapture;
- HWND hwndMenuOwner;
- HWND hwndMoveSize;
- HWND hwndCaret;
- RECT rcCaret;
-} GUITHREADINFO,*PGUITHREADINFO,*LPGUITHREADINFO;
-#endif /* (WINVER < 0x0500) */
-
-BOOL WINAPI BlockInput(BOOL);
-#if (_WIN32_WINNT < 0x0403)
-UINT WINAPI SendInput(UINT,LPINPUT,int);
-#endif
-#if (WINVER < 0x0500)
-BOOL WINAPI GetGUIThreadInfo(DWORD,LPGUITHREADINFO);
-void WINAPI NotifyWinEvent(DWORD,HWND,LONG,LONG);
-HWINEVENTHOOK WINAPI SetWinEventHook(UINT,UINT,HMODULE,WINEVENTPROC,DWORD,DWORD,UINT);
-BOOL WINAPI UnhookWinEvent(HWINEVENTHOOK);
-#endif /* (WINVER < 0x0500) */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
https://sf.net/p/mingw/mingw-org-wsl/ci/8d57d999b93b2bc755e94ca9841a3536cfc86aa6/
commit 8d57d999b93b2bc755e94ca9841a3536cfc86aa6
Author: Keith Marshall <kei...@us...>
Date: Fri Nov 25 21:29:02 2016 +0000
Update <winuser.h> and <dbt.h>; fix issue [#2317].
diff --git a/w32api/ChangeLog b/w32api/ChangeLog
index e599aa4..bae99c6 100644
--- a/w32api/ChangeLog
+++ b/w32api/ChangeLog
@@ -1,3 +1,41 @@
+2016-11-25 Keith Marshall <kei...@us...>
+
+ Update <winuser.h> and <dbt.h>; fix issue [#2317].
+
+ * include/winuser.h: Tidy layout; add copyright notice.
+ [WINVER, _WIN32_WINDOWS, _WIN32_WINNT]: Compare them symbolically.
+ (__WINUSER_H_SOURCED__): New internal macro; define it, to facilitate
+ selective inclusion of content from other headers; delete when done.
+ (BSM_ALLCOMPONENTS, BSF_ALLOWSFW, BSM_APPLICATIONS, BSM_ALLDESKTOPS)
+ (BSM_INSTALLABLEDRIVERS, BSM_NETDRIVER, BSM_VXDS, BSF_FLUSHDISK)
+ (BSF_FORCEIFHUNG, BSF_IGNORECURRENTTASK, BSF_LUID, BSF_NOHANG)
+ (BSF_NOTIMEOUTIFNOTHUNG, BSF_POSTMESSAGE, BSF_QUERY, BSF_RETURNHDESK)
+ (BSF_SENDNOTIFYMESSAGE): Delete; do not define them locally; retrieve
+ them selectively from <dbt.h>, where they are properly defined.
+ [WINVER >= WIN2K/WIN98] (BlockInput): Add missing declaration.
+ (KillTimer, TIMERPROC): Declare timer event parameters as UINT_PTR;
+ formerly UINT, which doesn't match 64-bit size required for Win64.
+ (SetTimer): Likewise; also declare similar return type.
+ (WINEVENTPROC): Add missing CALLBACK attribute.
+ (_BEGIN_C_DECLS, _END_C_DECLS): Use them.
+
+ * include/w32api.h (__AW_ALIAS__): New macro; define it.
+ * include/sdkddkver.h (_WIN32_WINNT_NT4SP3): New macro; define it.
+
+ * include/dbt.h: Tidy layout; add copyright notice.
+ (_BEGIN_C_DECLS, _END_C_DECLS): Also prefer them here.
+ [__WINUSER_H_SOURCED__] (_DBT_H): Do not define; expose only...
+ (BSM_ALLCOMPONENTS, BSF_ALLOWSFW, BSM_APPLICATIONS, BSM_ALLDESKTOPS)
+ (BSM_INSTALLABLEDRIVERS, BSM_NETDRIVER, BSM_VXDS, BSF_FLUSHDISK)
+ (BSF_FORCEIFHUNG, BSF_IGNORECURRENTTASK, BSF_LUID, BSF_NOHANG)
+ (BSF_NOTIMEOUTIFNOTHUNG, BSF_POSTMESSAGE, BSF_QUERY, BSF_RETURNHDESK)
+ (BSF_SENDNOTIFYMESSAGE): ...these, to be duplicated in <winuser.h>
+ (__AW_ALIAS__): Use it to define ANSI/UNICODE specific aliases for...
+ (DEV_BROADCAST_PORT, DEV_BROADCAST_DEVICEINTERFACE): ...these generic
+ structure typedef names, and their respectively corresponding...
+ (PDEV_BROADCAST_PORT, PDEV_BROADCAST_DEVICEINTERFACE): ...pointer
+ type names.
+
2016-09-17 Keith Marshall <kei...@us...>
Fix a minor ISO-C++11 conformity issue.
diff --git a/w32api/include/dbt.h b/w32api/include/dbt.h
index 69c15af..0e6e3d6 100644
--- a/w32api/include/dbt.h
+++ b/w32api/include/dbt.h
@@ -1,154 +1,211 @@
+/*
+ * dbt.h
+ *
+ * Device management API manifest constants and type definitions.
+ *
+ * $Id$
+ *
+ * Written by Anders Norlander <ano...@he...>
+ * Copyright (C) 1998, 1999, 2002-2004, 2016, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
#ifndef _DBT_H
-#define _DBT_H
-#if __GNUC__ >=3
#pragma GCC system_header
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define DBT_NO_DISK_SPACE 0x47
-#define DBT_CONFIGMGPRIVATE 0x7FFF
-#define DBT_DEVICEARRIVAL 0x8000
-#define DBT_DEVICEQUERYREMOVE 0x8001
-#define DBT_DEVICEQUERYREMOVEFAILED 0x8002
-#define DBT_DEVICEREMOVEPENDING 0x8003
-#define DBT_DEVICEREMOVECOMPLETE 0x8004
-#define DBT_DEVICETYPESPECIFIC 0x8005
-#define DBT_DEVTYP_OEM 0
-#define DBT_DEVTYP_DEVNODE 1
-#define DBT_DEVTYP_VOLUME 2
-#define DBT_DEVTYP_PORT 3
-#define DBT_DEVTYP_NET 4
-#if (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500)
-#define DBT_DEVTYP_DEVICEINTERFACE 5
-#define DBT_DEVTYP_HANDLE 6
-#endif /* (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500) */
-#define DBT_APPYBEGIN 0
-#define DBT_APPYEND 1
-#define DBT_DEVNODES_CHANGED 7
-#define DBT_QUERYCHANGECONFIG 0x17
-#define DBT_CONFIGCHANGED 0x18
-#define DBT_CONFIGCHANGECANCELED 0x19
-#define DBT_MONITORCHANGE 0x1B
-#define DBT_SHELLLOGGEDON 32
-#define DBT_CONFIGMGAPI32 34
-#define DBT_VXDINITCOMPLETE 35
-#define DBT_VOLLOCKQUERYLOCK 0x8041
-#define DBT_VOLLOCKLOCKTAKEN 0x8042
-#define DBT_VOLLOCKLOCKFAILED 0x8043
-#define DBT_VOLLOCKQUERYUNLOCK 0x8044
-#define DBT_VOLLOCKLOCKRELEASED 0x8045
-#define DBT_VOLLOCKUNLOCKFAILED 0x8046
-#define DBT_USERDEFINED 0xFFFF
-#define DBTF_MEDIA 1
-#define DBTF_NET 2
-
-/* Also defined in winuser.h */
-#define BSM_ALLCOMPONENTS 0
-#define BSM_APPLICATIONS 8
-#define BSM_ALLDESKTOPS 16
-#define BSM_INSTALLABLEDRIVERS 4
-#define BSM_NETDRIVER 2
-#define BSM_VXDS 1
-#define BSF_FLUSHDISK 0x00000004
-#define BSF_FORCEIFHUNG 0x00000020
-#define BSF_IGNORECURRENTTASK 0x00000002
-#define BSF_NOHANG 0x00000008
-#define BSF_NOTIMEOUTIFNOTHUNG 0x00000040
-#define BSF_POSTMESSAGE 0x00000010
-#define BSF_QUERY 0x00000001
-#if (_WIN32_WINNT >= 0x0500)
-#define BSF_ALLOWSFW 0x00000080
-#define BSF_SENDNOTIFYMESSAGE 0x00000100
-#endif /* (_WIN32_WINNT >= 0x0500) */
-#if (_WIN32_WINNT >= 0x0501)
-#define BSF_LUID 0x00000400
-#define BSF_RETURNHDESK 0x00000200
-#endif /* (_WIN32_WINNT >= 0x0501) */
-
-#define BSF_MSGSRV32ISOK_BIT 31
-#define BSF_MSGSRV32ISOK 0x80000000
-
-typedef struct _DEV_BROADCAST_HDR {
- DWORD dbch_size;
- DWORD dbch_devicetype;
- DWORD dbch_reserved;
-} DEV_BROADCAST_HDR,*PDEV_BROADCAST_HDR;
-typedef struct _DEV_BROADCAST_OEM {
- DWORD dbco_size;
- DWORD dbco_devicetype;
- DWORD dbco_reserved;
- DWORD dbco_identifier;
- DWORD dbco_suppfunc;
-} DEV_BROADCAST_OEM,*PDEV_BROADCAST_OEM;
-typedef struct _DEV_BROADCAST_PORT_A {
- DWORD dbcp_size;
- DWORD dbcp_devicetype;
- DWORD dbcp_reserved;
- char dbcp_name[1];
+
+#ifndef __WINUSER_H_SOURCED__
+/* Part of <dbt.h> is made available for selective inclusion by <winuser.h>;
+ * define the <dbt.h> multiple inclusion guard only when NOT included as an
+ * adjunct to <winuser.h>
+ */
+#define _DBT_H
+
+/* When including <dbt.h> in its own right, ensure that the standard set of
+ * W32API utility macros and data types is defined.
+ */
+#include <windef.h>
+
+_BEGIN_C_DECLS
+
+#define DBT_NO_DISK_SPACE 0x47
+#define DBT_CONFIGMGPRIVATE 0x7FFF
+#define DBT_DEVICEARRIVAL 0x8000
+#define DBT_DEVICEQUERYREMOVE 0x8001
+#define DBT_DEVICEQUERYREMOVEFAILED 0x8002
+#define DBT_DEVICEREMOVEPENDING 0x8003
+#define DBT_DEVICEREMOVECOMPLETE 0x8004
+#define DBT_DEVICETYPESPECIFIC 0x8005
+#define DBT_DEVTYP_OEM 0
+#define DBT_DEVTYP_DEVNODE 1
+#define DBT_DEVTYP_VOLUME 2
+#define DBT_DEVTYP_PORT 3
+#define DBT_DEVTYP_NET 4
+
+#if _WIN32_WINDOWS >= _WIN32_WINDOWS_98 || _WIN32_WINNT >= _WIN32_WINNT_WIN2K
+#define DBT_DEVTYP_DEVICEINTERFACE 5
+#define DBT_DEVTYP_HANDLE 6
+#endif /* >= _WIN32_WINDOWS_98 || >= _WIN32_WINNT_WIN2K */
+
+#define DBT_APPYBEGIN 0
+#define DBT_APPYEND 1
+#define DBT_DEVNODES_CHANGED 7
+#define DBT_QUERYCHANGECONFIG 0x17
+#define DBT_CONFIGCHANGED 0x18
+#define DBT_CONFIGCHANGECANCELED 0x19
+#define DBT_MONITORCHANGE 0x1B
+#define DBT_SHELLLOGGEDON 32
+#define DBT_CONFIGMGAPI32 34
+#define DBT_VXDINITCOMPLETE 35
+#define DBT_VOLLOCKQUERYLOCK 0x8041
+#define DBT_VOLLOCKLOCKTAKEN 0x8042
+#define DBT_VOLLOCKLOCKFAILED 0x8043
+#define DBT_VOLLOCKQUERYUNLOCK 0x8044
+#define DBT_VOLLOCKLOCKRELEASED 0x8045
+#define DBT_VOLLOCKUNLOCKFAILED 0x8046
+#define DBT_USERDEFINED 0xFFFF
+#define DBTF_MEDIA 1
+#define DBTF_NET 2
+
+#endif /* !__WINUSER_H_SOURCED__ */
+/* The following definitions are shared with <winuser.h>; thus, we
+ * ALWAYS define them, whether within the __WINUSER_H_SOURCED__ scope,
+ * or regular inclusion of <dbt.h>
+ */
+#define BSM_ALLCOMPONENTS 0
+#define BSM_APPLICATIONS 8
+#define BSM_ALLDESKTOPS 16
+#define BSM_INSTALLABLEDRIVERS 4
+#define BSM_NETDRIVER 2
+#define BSM_VXDS 1
+#define BSF_FLUSHDISK 0x00000004
+#define BSF_FORCEIFHUNG 0x00000020
+#define BSF_IGNORECURRENTTASK 0x00000002
+#define BSF_NOHANG 0x00000008
+#define BSF_NOTIMEOUTIFNOTHUNG 0x00000040
+#define BSF_POSTMESSAGE 0x00000010
+#define BSF_QUERY 0x00000001
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN2K
+#define BSF_ALLOWSFW 0x00000080
+#define BSF_SENDNOTIFYMESSAGE 0x00000100
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WINXP
+#define BSF_LUID 0x00000400
+#define BSF_RETURNHDESK 0x00000200
+
+#endif /* >= _WIN32_WINNT_WINXP */
+#endif /* >= _WIN32_WINNT_WIN2K */
+
+#ifndef __WINUSER_H_SOURCED__
+/* The remaining definitions are NOT shared with <winuser.h>, so are
+ * NOT defined within the __WINUSER_H_SOURCED__ scope.
+ */
+#define BSF_MSGSRV32ISOK_BIT 31
+#define BSF_MSGSRV32ISOK 0x80000000
+
+typedef struct _DEV_BROADCAST_HDR
+{ DWORD dbch_size;
+ DWORD dbch_devicetype;
+ DWORD dbch_reserved;
+} DEV_BROADCAST_HDR, *PDEV_BROADCAST_HDR;
+
+typedef struct _DEV_BROADCAST_OEM
+{ DWORD dbco_size;
+ DWORD dbco_devicetype;
+ DWORD dbco_reserved;
+ DWORD dbco_identifier;
+ DWORD dbco_suppfunc;
+} DEV_BROADCAST_OEM, *PDEV_BROADCAST_OEM;
+
+typedef struct _DEV_BROADCAST_PORT_A
+{ DWORD dbcp_size;
+ DWORD dbcp_devicetype;
+ DWORD dbcp_reserved;
+ char dbcp_name[1];
} DEV_BROADCAST_PORT_A, *PDEV_BROADCAST_PORT_A;
-typedef struct _DEV_BROADCAST_PORT_W {
- DWORD dbcp_size;
- DWORD dbcp_devicetype;
- DWORD dbcp_reserved;
- wchar_t dbcp_name[1];
+
+typedef struct _DEV_BROADCAST_PORT_W
+{ DWORD dbcp_size;
+ DWORD dbcp_devicetype;
+ DWORD dbcp_reserved;
+ wchar_t dbcp_name[1];
} DEV_BROADCAST_PORT_W, *PDEV_BROADCAST_PORT_W;
-typedef struct _DEV_BROADCAST_USERDEFINED {
- struct _DEV_BROADCAST_HDR dbud_dbh;
- char dbud_szName[1];
+
+/* Map generic type name references for UNICODE/non-UNICODE usage
+ * of the preceding pair of structured data types.
+ */
+typedef __AW_ALIAS__(DEV_BROADCAST_PORT);
+typedef __AW_ALIAS__(PDEV_BROADCAST_PORT);
+
+typedef struct _DEV_BROADCAST_USERDEFINED
+{ struct _DEV_BROADCAST_HDR dbud_dbh;
+ char dbud_szName[1];
} DEV_BROADCAST_USERDEFINED;
-typedef struct _DEV_BROADCAST_VOLUME {
- DWORD dbcv_size;
- DWORD dbcv_devicetype;
- DWORD dbcv_reserved;
- DWORD dbcv_unitmask;
- WORD dbcv_flags;
-} DEV_BROADCAST_VOLUME,*PDEV_BROADCAST_VOLUME;
-
-#ifdef UNICODE
-typedef DEV_BROADCAST_PORT_W DEV_BROADCAST_PORT, *PDEV_BROADCAST_PORT;
-#else
-typedef DEV_BROADCAST_PORT_A DEV_BROADCAST_PORT, *PDEV_BROADCAST_PORT;
-#endif
-
-#if (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500)
-typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A {
- DWORD dbcc_size;
- DWORD dbcc_devicetype;
- DWORD dbcc_reserved;
- GUID dbcc_classguid;
- char dbcc_name[1];
+
+typedef struct _DEV_BROADCAST_VOLUME
+{ DWORD dbcv_size;
+ DWORD dbcv_devicetype;
+ DWORD dbcv_reserved;
+ DWORD dbcv_unitmask;
+ WORD dbcv_flags;
+} DEV_BROADCAST_VOLUME, *PDEV_BROADCAST_VOLUME;
+
+#if _WIN32_WINDOWS >= _WIN32_WINDOWS_98 || _WIN32_WINNT >= _WIN32_WINNT_WIN2K
+
+typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A
+{ DWORD dbcc_size;
+ DWORD dbcc_devicetype;
+ DWORD dbcc_reserved;
+ GUID dbcc_classguid;
+ char dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE_A, *PDEV_BROADCAST_DEVICEINTERFACE_A;
-typedef struct _DEV_BROADCAST_DEVICEINTERFACE_W {
- DWORD dbcc_size;
- DWORD dbcc_devicetype;
- DWORD dbcc_reserved;
- GUID dbcc_classguid;
- wchar_t dbcc_name[1];
+
+typedef struct _DEV_BROADCAST_DEVICEINTERFACE_W
+{ DWORD dbcc_size;
+ DWORD dbcc_devicetype;
+ DWORD dbcc_reserved;
+ GUID dbcc_classguid;
+ wchar_t dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE_W, *PDEV_BROADCAST_DEVICEINTERFACE_W;
-#ifdef UNICODE
-typedef DEV_BROADCAST_DEVICEINTERFACE_W DEV_BROADCAST_DEVICEINTERFACE;
-typedef PDEV_BROADCAST_DEVICEINTERFACE_W PDEV_BROADCAST_DEVICEINTERFACE;
-#else
-typedef DEV_BROADCAST_DEVICEINTERFACE_A DEV_BROADCAST_DEVICEINTERFACE;
-typedef PDEV_BROADCAST_DEVICEINTERFACE_A PDEV_BROADCAST_DEVICEINTERFACE;
-#endif
-
-typedef struct _DEV_BROADCAST_HANDLE {
- DWORD dbch_size;
- DWORD dbch_devicetype;
- DWORD dbch_reserved;
- HANDLE dbch_handle;
- DWORD dbch_hdevnotify;
- GUID dbch_eventguid;
- LONG dbch_nameoffset;
- BYTE dbch_data[1];
+/* Map generic type name references for UNICODE/non-UNICODE usage
+ * of the preceding pair of structured data types.
+ */
+typedef __AW_ALIAS__(DEV_BROADCAST_DEVICEINTERFACE);
+typedef __AW_ALIAS__(PDEV_BROADCAST_DEVICEINTERFACE);
+
+typedef struct _DEV_BROADCAST_HANDLE
+{ DWORD dbch_size;
+ DWORD dbch_devicetype;
+ DWORD dbch_reserved;
+ HANDLE dbch_handle;
+ DWORD dbch_hdevnotify;
+ GUID dbch_eventguid;
+ LONG dbch_nameoffset;
+ BYTE dbch_data[1];
} DEV_BROADCAST_HANDLE, *PDEV_BROADCAST_HANDLE;
-#endif /* (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500) */
+#endif /* >= _WIN32_WINDOWS_98 || >= _WIN32_WINNT_WIN2K */
+
+_END_C_DECLS
-#ifdef __cplusplus
-}
-#endif
-#endif
+#endif /* !__WINUSER_H_SOURCED__ */
+#endif /* !_DBT_H: $RCSfile$: end of file */
diff --git a/w32api/include/sdkddkver.h b/w32api/include/sdkddkver.h
index 2e448a3..d82e417 100644
--- a/w32api/include/sdkddkver.h
+++ b/w32api/include/sdkddkver.h
@@ -61,6 +61,7 @@
*/
#define _WIN32_WINNT_NT4 0x0400 /* Windows NT4 */
#define _WIN32_WINNT_NT4E 0x0401 /* Windows NT4E */
+#define _WIN32_WINNT_NT4SP3 0x0403 /* Windows NT4 + ServicePack 3 */
#define _WIN32_WINDOWS_95 0x0400 /* Windows 95 */
#define _WIN32_WINDOWS_98 0x0410 /* Windows 98 */
#define _WIN32_WINDOWS_ME 0x0490 /* Windows Millenium Edition */
diff --git a/w32api/include/w32api.h.in b/w32api/include/w32api.h.in
index e7ebf5b..2e07447 100644
--- a/w32api/include/w32api.h.in
+++ b/w32api/include/w32api.h.in
@@ -170,6 +170,12 @@
#define __AW__WCHAR_T__(__TEXT__) __AW_STRING_A__(L##__TEXT__)
#define __AW_STRING_W__(__TEXT__) __AW__WCHAR_T__(__TEXT__)
+/* A further use of __AW_EXTENDED__, encapsulated in __AW_ALIAS__,
+ * provides a convenient generic mapping for type names which have
+ * alternative representations for UNICODE and non-UNICODE usage.
+ */
+#define __AW_ALIAS__(__NAME__) __AW_EXTENDED__(__NAME__) __NAME__
+
#ifdef __cplusplus
/* When compiling C++ code, these macros provide a convenient notation
* for designating those sections of system header files which declare
diff --git a/w32api/include/winuser.h b/w32api/include/winuser.h
index 2938dce..024438a 100644
--- a/w32api/include/winuser.h
+++ b/w32api/include/winuser.h
@@ -1,3417 +1,3691 @@
+/*
+ * winuser.h
+ *
+ * General user interface manifest constants, type definitions, and
+ * function declarations.
+ *
+ * $Id$
+ *
+ * Written by Anders Norlander <ano...@he...>
+ * Copyright (C) 1998-2012, 2016, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
#ifndef _WINUSER_H
-#define _WINUSER_H
-#if __GNUC__ >= 3
#pragma GCC system_header
-#endif
+#define _WINUSER_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* Define a temporary inclusion guard macro, to permit selective inclusion
+ * of formerly duplicated content from its primary source headers.
+ */
+#define __WINUSER_H_SOURCED__
+
+_BEGIN_C_DECLS
#ifndef WINUSERAPI
#ifdef __W32API_USE_DLLIMPORT__
-#define WINUSERAPI DECLSPEC_IMPORT
+#define WINUSERAPI DECLSPEC_IMPORT
#else
#define WINUSERAPI
#endif
#endif
-#define MNGO_NOINTERFACE 0x00
-#define MNGO_NOERROR 0x01
-#define MNGOF_TOPGAP 0x01
-#define MNGOF_BOTTOMGAP 0x02
-
-#define WC_DIALOG MAKEINTATOM(0x8002)
-#define FALT 16
-#define FCONTROL 8
-#define FNOINVERT 2
-#define FSHIFT 4
-#define FVIRTKEY 1
-#define ATF_TIMEOUTON 1
-#define ATF_ONOFFFEEDBACK 2
-#define ATF_AVAILABLE 4 /* May be obsolete. Not in recent MS docs. */
-#define WH_MIN (-1)
-#define WH_MSGFILTER (-1)
-#define WH_JOURNALRECORD 0
-#define WH_JOURNALPLAYBACK 1
-#define WH_KEYBOARD 2
-#define WH_GETMESSAGE 3
-#define WH_CALLWNDPROC 4
-#define WH_CBT 5
-#define WH_SYSMSGFILTER 6
-#define WH_MOUSE 7
-#define WH_HARDWARE 8
-#define WH_DEBUG 9
-#define WH_SHELL 10
-#define WH_FOREGROUNDIDLE 11
-#define WH_CALLWNDPROCRET 12
-#define WH_KEYBOARD_LL 13
-#define WH_MOUSE_LL 14
-#define WH_MAX 14
-#define WH_MINHOOK WH_MIN
-#define WH_MAXHOOK WH_MAX
-#define HC_ACTION 0
-#define HC_GETNEXT 1
-#define HC_SKIP 2
-#define HC_NOREMOVE 3
-#define HC_NOREM 3
-#define HC_SYSMODALON 4
-#define HC_SYSMODALOFF 5
-#define HCBT_MOVESIZE 0
-#define HCBT_MINMAX 1
-#define HCBT_QS 2
-#define HCBT_CREATEWND 3
-#define HCBT_DESTROYWND 4
-#define HCBT_ACTIVATE 5
-#define HCBT_CLICKSKIPPED 6
-#define HCBT_KEYSKIPPED 7
-#define HCBT_SYSCOMMAND 8
-#define HCBT_SETFOCUS 9
-#define CF_TEXT 1
-#define CF_BITMAP 2
-#define CF_METAFILEPICT 3
-#define CF_SYLK 4
-#define CF_DIF 5
-#define CF_TIFF 6
-#define CF_OEMTEXT 7
-#define CF_DIB 8
-#define CF_PALETTE 9
-#define CF_PENDATA 10
-#define CF_RIFF 11
-#define CF_WAVE 12
-#define CF_UNICODETEXT 13
-#define CF_ENHMETAFILE 14
-#define CF_HDROP 15
-#define CF_LOCALE 16
-#if (_WIN32_WINNT >= 0x0500)
-#define CF_DIBV5 17
-#define CF_MAX 18
+#define MNGO_NOINTERFACE 0x00
+#define MNGO_NOERROR 0x01
+#define MNGOF_TOPGAP 0x01
+#define MNGOF_BOTTOMGAP 0x02
+
+#define WC_DIALOG MAKEINTATOM(0x8002)
+#define FALT 16
+#define FCONTROL 8
+#define FNOINVERT 2
+#define FSHIFT 4
+#define FVIRTKEY 1
+#define ATF_TIMEOUTON 1
+#define ATF_ONOFFFEEDBACK 2
+#define ATF_AVAILABLE 4 /* may be obsolete */
+#define WH_MIN (-1)
+#define WH_MSGFILTER (-1)
+#define WH_JOURNALRECORD 0
+#define WH_JOURNALPLAYBACK 1
+#define WH_KEYBOARD 2
+#define WH_GETMESSAGE 3
+#define WH_CALLWNDPROC 4
+#define WH_CBT 5
+#define WH_SYSMSGFILTER 6
+#define WH_MOUSE 7
+#define WH_HARDWARE 8
+#define WH_DEBUG 9
+#define WH_SHELL 10
+#define WH_FOREGROUNDIDLE 11
+#define WH_CALLWNDPROCRET 12
+#define WH_KEYBOARD_LL 13
+#define WH_MOUSE_LL 14
+#define WH_MAX 14
+#define WH_MINHOOK WH_MIN
+#define WH_MAXHOOK WH_MAX
+#define HC_ACTION 0
+#define HC_GETNEXT 1
+#define HC_SKIP 2
+#define HC_NOREMOVE 3
+#define HC_NOREM 3
+#define HC_SYSMODALON 4
+#define HC_SYSMODALOFF 5
+#define HCBT_MOVESIZE 0
+#define HCBT_MINMAX 1
+#define HCBT_QS 2
+#define HCBT_CREATEWND 3
+#define HCBT_DESTROYWND 4
+#define HCBT_ACTIVATE 5
+#define HCBT_CLICKSKIPPED 6
+#define HCBT_KEYSKIPPED 7
+#define HCBT_SYSCOMMAND 8
+#define HCBT_SETFOCUS 9
+#define CF_TEXT 1
+#define CF_BITMAP 2
+#define CF_METAFILEPICT 3
+#define CF_SYLK 4
+#define CF_DIF 5
+#define CF_TIFF 6
+#define CF_OEMTEXT 7
+#define CF_DIB 8
+#define CF_PALETTE 9
+#define CF_PENDATA 10
+#define CF_RIFF 11
+#define CF_WAVE 12
+#define CF_UNICODETEXT 13
+#define CF_ENHMETAFILE 14
+#define CF_HDROP 15
+#define CF_LOCALE 16
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN2K
+#define CF_DIBV5 17
+#define CF_MAX 18
#else
-#define CF_MAX 17
+#define CF_MAX 17
#endif
-#define CF_OWNERDISPLAY 128
-#define CF_DSPTEXT 129
-#define CF_DSPBITMAP 130
-#define CF_DSPMETAFILEPICT 131
-#define CF_DSPENHMETAFILE 142
-#define CF_PRIVATEFIRST 512
-#define CF_PRIVATELAST 767
-#define CF_GDIOBJFIRST 768
-#define CF_GDIOBJLAST 1023
-#define HKL_NEXT 1
-#define HKL_PREV 0
-#define KLF_ACTIVATE 1
-#define KLF_SUBSTITUTE_OK 2
-#define KLF_UNLOADPREVIOUS 4
-#define KLF_REORDER 8
-#define KLF_REPLACELANG 16
-#define KLF_NOTELLSHELL 128
-#define KLF_SETFORPROCESS 256
-#define KL_NAMELENGTH 9
-#define MF_ENABLED 0
-#define MF_GRAYED 1
-#define MF_DISABLED 2
-#define MF_BITMAP 4
-#define MF_CHECKED 8
-#define MF_MENUBARBREAK 32
-#define MF_MENUBREAK 64
-#define MF_OWNERDRAW 256
-#define MF_POPUP 16
-#define MF_SEPARATOR 0x800
-#define MF_STRING 0
-#define MF_UNCHECKED 0
-#define MF_DEFAULT 4096
-#define MF_SYSMENU 0x2000
-#define MF_HELP 0x4000
-#define MF_END 128
-#define MF_RIGHTJUSTIFY 0x4000
-#define MF_MOUSESELECT 0x8000
-#define MF_INSERT 0
-#define MF_CHANGE 128
-#define MF_APPEND 256
-#define MF_DELETE 512
-#define MF_REMOVE 4096
-#define MF_USECHECKBITMAPS 512
-#define MF_UNHILITE 0
-#define MF_HILITE 128
-
-/* Also defined in dbt.h */
-#define BSM_ALLCOMPONENTS 0
-#define BSM_APPLICATIONS 8
-#define BSM_ALLDESKTOPS 16
-#define BSM_INSTALLABLEDRIVERS 4
-#define BSM_NETDRIVER 2
-#define BSM_VXDS 1
-#define BSF_FLUSHDISK 0x00000004
-#define BSF_FORCEIFHUNG 0x00000020
-#define BSF_IGNORECURRENTTASK 0x00000002
-#define BSF_NOHANG 0x00000008
-#define BSF_NOTIMEOUTIFNOTHUNG 0x00000040
-#define BSF_POSTMESSAGE 0x00000010
-#define BSF_QUERY 0x00000001
-#if (_WIN32_WINNT >= 0x0500)
-#define BSF_ALLOWSFW 0x00000080
-#define BSF_SENDNOTIFYMESSAGE 0x00000100
-#endif /* (_WIN32_WINNT >= 0x0500) */
-#if (_WIN32_WINNT >= 0x0501)
-#define BSF_LUID 0x00000400
-#define BSF_RETURNHDESK 0x00000200
-#endif /* (_WIN32_WINNT >= 0x0501) */
-
-#define BROADCAST_QUERY_DENY 1112363332
-#define ENUM_CURRENT_SETTINGS ((DWORD)-1)
-#define ENUM_REGISTRY_SETTINGS ((DWORD)-2)
-#define CDS_UPDATEREGISTRY 1
-#define CDS_TEST 2
-#define CDS_FULLSCREEN 4
-#define CDS_GLOBAL 8
-#define CDS_SET_PRIMARY 16
-#define CDS_RESET 0x40000000
-#define CDS_SETRECT 0x20000000
-#define CDS_NORESET 0x10000000
-#define DISP_CHANGE_SUCCESSFUL 0
-#define DISP_CHANGE_RESTART 1
-#define DISP_CHANGE_FAILED (-1)
-#define DISP_CHANGE_BADMODE (-2)
-#define DISP_CHANGE_NOTUPDATED (-3)
-#define DISP_CHANGE_BADFLAGS (-4)
-#define DISP_CHANGE_BADPARAM (-5)
-#define DISP_CHANGE_BADDUALVIEW (-6)
-#define BST_CHECKED 1
-#define BST_INDETERMINATE 2
-#define BST_UNCHECKED 0
-#define BST_FOCUS 8
-#define BST_PUSHED 4
-#define MF_BYCOMMAND 0
-#define MF_BYPOSITION 1024
-#define MF_UNCHECKED 0
-#define MF_HILITE 128
-#define MF_UNHILITE 0
-#define CWP_ALL 0
-#define CWP_SKIPINVISIBLE 1
-#define CWP_SKIPDISABLED 2
-#define CWP_SKIPTRANSPARENT 4
-#define IMAGE_BITMAP 0
-#define IMAGE_ICON 1
-#define IMAGE_CURSOR 2
-#define IMAGE_ENHMETAFILE 3
-#define DF_ALLOWOTHERACCOUNTHOOK 1
-#define DESKTOP_CREATEMENU 4
-#define DESKTOP_CREATEWINDOW 2
-#define DESKTOP_ENUMERATE 64
-#define DESKTOP_HOOKCONTROL 8
-#define DESKTOP_JOURNALPLAYBACK 32
-#define DESKTOP_JOURNALRECORD 16
-#define DESKTOP_READOBJECTS 1
-#define DESKTOP_SWITCHDESKTOP 256
-#define DESKTOP_WRITEOBJECTS 128
-#define CW_USEDEFAULT 0x80000000
-#define WS_BORDER 0x800000
-#define WS_CAPTION 0xc00000
-#define WS_CHILD 0x40000000
-#define WS_CHILDWINDOW 0x40000000
-#define WS_CLIPCHILDREN 0x2000000
-#define WS_CLIPSIBLINGS 0x4000000
-#define WS_DISABLED 0x8000000
-#define WS_DLGFRAME 0x400000
-#define WS_GROUP 0x20000
-#define WS_HSCROLL 0x100000
-#define WS_ICONIC 0x20000000
-#define WS_MAXIMIZE 0x1000000
-#define WS_MAXIMIZEBOX 0x10000
-#define WS_MINIMIZE 0x20000000
-#define WS_MINIMIZEBOX 0x20000
-#define WS_OVERLAPPED 0
-#define WS_OVERLAPPEDWINDOW 0xcf0000
-#define WS_POPUP 0x80000000
-#define WS_POPUPWINDOW 0x80880000
-#define WS_SIZEBOX 0x40000
-#define WS_SYSMENU 0x80000
-#define WS_TABSTOP 0x10000
-#define WS_THICKFRAME 0x40000
-#define WS_TILED 0
-#define WS_TILEDWINDOW 0xcf0000
-#define WS_VISIBLE 0x10000000
-#define WS_VSCROLL 0x200000
-#define MDIS_ALLCHILDSTYLES 1
-#define BS_3STATE 5
-#define BS_AUTO3STATE 6
-#define BS_AUTOCHECKBOX 3
-#define BS_AUTORADIOBUTTON 9
-#define BS_BITMAP 128
-#define BS_BOTTOM 0x800
-#define BS_CENTER 0x300
-#define BS_CHECKBOX 2
-#define BS_DEFPUSHBUTTON 1
-#define BS_GROUPBOX 7
-#define BS_ICON 64
-#define BS_LEFT 256
-#define BS_LEFTTEXT 32
-#define BS_MULTILINE 0x2000
-#define BS_NOTIFY 0x4000
-#define BS_OWNERDRAW 0xb
-#define BS_PUSHBUTTON 0
-#define BS_PUSHLIKE 4096
-#define BS_RADIOBUTTON 4
-#define BS_RIGHT 512
-#define BS_RIGHTBUTTON 32
-#define BS_TEXT 0
-#define BS_TOP 0x400
-#define BS_USERBUTTON 8
-#define BS_VCENTER 0xc00
-#define BS_FLAT 0x8000
-#define CBS_AUTOHSCROLL 64
-#define CBS_DISABLENOSCROLL 0x800
-#define CBS_DROPDOWN 2
-#define CBS_DROPDOWNLIST 3
-#define CBS_HASSTRINGS 512
-#define CBS_LOWERCASE 0x4000
-#define CBS_NOINTEGRALHEIGHT 0x400
-#define CBS_OEMCONVERT 128
-#define CBS_OWNERDRAWFIXED 16
-#define CBS_OWNERDRAWVARIABLE 32
-#define CBS_SIMPLE 1
-#define CBS_SORT 256
-#define CBS_UPPERCASE 0x2000
-#define ES_AUTOHSCROLL 128
-#define ES_AUTOVSCROLL 64
-#define ES_CENTER 1
-#define ES_LEFT 0
-#define ES_LOWERCASE 16
-#define ES_MULTILINE 4
-#define ES_NOHIDESEL 256
-#define ES_NUMBER 0x2000
-#define ES_OEMCONVERT 0x400
-#define ES_PASSWORD 32
-#define ES_READONLY 0x800
-#define ES_RIGHT 2
-#define ES_UPPERCASE 8
-#define ES_WANTRETURN 4096
-#define LBS_DISABLENOSCROLL 4096
-#define LBS_EXTENDEDSEL 0x800
-#define LBS_HASSTRINGS 64
-#define LBS_MULTICOLUMN 512
-#define LBS_MULTIPLESEL 8
-#define LBS_NODATA 0x2000
-#define LBS_NOINTEGRALHEIGHT 256
-#define LBS_NOREDRAW 4
-#define LBS_NOSEL 0x4000
-#define LBS_NOTIFY 1
-#define LBS_OWNERDRAWFIXED 16
-#define LBS_OWNERDRAWVARIABLE 32
-#define LBS_SORT 2
-#define LBS_STANDARD 0xa00003
-#define LBS_USETABSTOPS 128
-#define LBS_WANTKEYBOARDINPUT 0x400
-#define SBS_BOTTOMALIGN 4
-#define SBS_HORZ 0
-#define SBS_LEFTALIGN 2
-#define SBS_RIGHTALIGN 4
-#define SBS_SIZEBOX 8
-#define SBS_SIZEBOXBOTTOMRIGHTALIGN 4
-#define SBS_SIZEBOXTOPLEFTALIGN 2
-#define SBS_SIZEGRIP 16
-#define SBS_TOPALIGN 2
-#define SBS_VERT 1
-#define SS_BITMAP 14
-#define SS_BLACKFRAME 7
-#define SS_BLACKRECT 4
-#define SS_CENTER 1
-#define SS_CENTERIMAGE 512
-#define SS_ENHMETAFILE 15
-#define SS_ETCHEDFRAME 18
-#define SS_ETCHEDHORZ 16
-#define SS_ETCHEDVERT 17
-#define SS_GRAYFRAME 8
-#define SS_GRAYRECT 5
-#define SS_ICON 3
-#define SS_LEFT 0
-#define SS_LEFTNOWORDWRAP 0xc
-#define SS_NOPREFIX 128
-#define SS_NOTIFY 256
-#define SS_OWNERDRAW 0xd
-#define SS_REALSIZEIMAGE 0x800
-#define SS_RIGHT 2
-#define SS_RIGHTJUST 0x400
-#define SS_SIMPLE 11
-#define SS_SUNKEN 4096
-#define SS_WHITEFRAME 9
-#define SS_WHITERECT 6
-#define SS_USERITEM 10
-#define SS_TYPEMASK 0x0000001FL
-#define SS_ENDELLIPSIS 0x00004000L
-#define SS_PATHELLIPSIS 0x00008000L
-#define SS_WORDELLIPSIS 0x0000C000L
-#define SS_ELLIPSISMASK 0x0000C000L
-#define DS_3DLOOK 4
-#define DS_ABSALIGN 1
-#define DS_CENTER 0x800
-#define DS_CENTERMOUSE 4096
-#define DS_CONTEXTHELP 0x2000
-#define DS_CONTROL 0x400
-#define DS_FIXEDSYS 8
-#define DS_LOCALEDIT 32
-#define DS_MODALFRAME 128
-#define DS_NOFAILCREATE 16
-#define DS_NOIDLEMSG 256
-#define DS_SETFONT 64
-#define DS_SETFOREGROUND 512
-#define DS_SYSMODAL 2
-#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS)
-#define WS_EX_ACCEPTFILES 16
-#define WS_EX_APPWINDOW 0x40000
-#define WS_EX_CLIENTEDGE 512
-#define WS_EX_COMPOSITED 0x2000000 /* XP */
-#define WS_EX_CONTEXTHELP 0x400
-#define WS_EX_CONTROLPARENT 0x10000
-#define WS_EX_DLGMODALFRAME 1
-#define WS_EX_LAYERED 0x80000 /* w2k */
-#define WS_EX_LAYOUTRTL 0x400000 /* w98, w2k */
-#define WS_EX_LEFT 0
-#define WS_EX_LEFTSCROLLBAR 0x4000
-#define WS_EX_LTRREADING 0
-#define WS_EX_MDICHILD 64
-#define WS_EX_NOACTIVATE 0x8000000 /* w2k */
-#define WS_EX_NOINHERITLAYOUT 0x100000 /* w2k */
-#define WS_EX_NOPARENTNOTIFY 4
-#define WS_EX_OVERLAPPEDWINDOW 0x300
-#define WS_EX_PALETTEWINDOW 0x188
-#define WS_EX_RIGHT 0x1000
-#define WS_EX_RIGHTSCROLLBAR 0
-#define WS_EX_RTLREADING 0x2000
-#define WS_EX_STATICEDGE 0x20000
-#define WS_EX_TOOLWINDOW 128
-#define WS_EX_TOPMOST 8
-#define WS_EX_TRANSPARENT 32
-#define WS_EX_WINDOWEDGE 256
-#define WINSTA_ALL_ACCESS 895
-#define WINSTA_ACCESSCLIPBOARD 4
-#define WINSTA_ACCESSGLOBALATOMS 32
-#define WINSTA_CREATEDESKTOP 8
-#define WINSTA_ENUMDESKTOPS 1
-#define WINSTA_ENUMERATE 256
-#define WINSTA_EXITWINDOWS 64
-#define WINSTA_READATTRIBUTES 2
-#define WINSTA_READSCREEN 512
-#define WINSTA_WRITEATTRIBUTES 16
-#define DDL_READWRITE 0
-#define DDL_READONLY 1
-#define DDL_HIDDEN 2
-#define DDL_SYSTEM 4
-#define DDL_DIRECTORY 16
-#define DDL_ARCHIVE 32
-#define DDL_POSTMSGS 8192
-#define DDL_DRIVES 16384
-#define DDL_EXCLUSIVE 32768
-#define DC_ACTIVE 0x00000001
-#define DC_SMALLCAP 0x00000002
-#define DC_ICON 0x00000004
-#define DC_TEXT 0x00000008
-#define DC_INBUTTON 0x00000010
-#if (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500)
-#define DC_GRADIENT 0x00000020
+
+#define CF_OWNERDISPLAY 128
+#define CF_DSPTEXT 129
+#define CF_DSPBITMAP 130
+#define CF_DSPMETAFILEPICT 131
+#define CF_DSPENHMETAFILE 142
+#define CF_PRIVATEFIRST 512
+#define CF_PRIVATELAST 767
+#define CF_GDIOBJFIRST 768
+#define CF_GDIOBJLAST 1023
+#define HKL_NEXT 1
+#define HKL_PREV 0
+#define KLF_ACTIVATE 1
+#define KLF_SUBSTITUTE_OK 2
+#define KLF_UNLOADPREVIOUS 4
+#define KLF_REORDER 8
+#define KLF_REPLACELANG 16
+#define KLF_NOTELLSHELL 128
+#define KLF_SETFORPROCESS 256
+#define KL_NAMELENGTH 9
+#define MF_ENABLED 0
+#define MF_GRAYED 1
+#define MF_DISABLED 2
+#define MF_BITMAP 4
+#define MF_CHECKED 8
+#define MF_MENUBARBREAK 32
+#define MF_MENUBREAK 64
+#define MF_OWNERDRAW 256
+#define MF_POPUP 16
+#define MF_SEPARATOR 0x800
+#define MF_STRING 0
+#define MF_UNCHECKED 0
+#define MF_DEFAULT 4096
+#define MF_SYSMENU 0x2000
+#define MF_HELP 0x4000
+#define MF_END 128
+#define MF_RIGHTJUSTIFY 0x4000
+#define MF_MOUSESELECT 0x8000
+#define MF_INSERT 0
+#define MF_CHANGE 128
+#define MF_APPEND 256
+#define MF_DELETE 512
+#define MF_REMOVE 4096
+#define MF_USECHECKBITMAPS 512
+#define MF_UNHILITE 0
+#define MF_HILITE 128
+
+/* To reduce maintainence, and to avoid any possibility that we might
+ * introduce inconsistent definitions, we selectively...
+ */
+#include <dbt.h>
+/*
+ * ...to obtain definitions for:
+ *
+ * BSM_ALLCOMPONENTS, BSM_APPLICATIONS, BSM_ALLDESKTOPS,
+ * BSM_INSTALLABLEDRIVERS, BSM_NETDRIVER, BSM_VXDS, BSF_FLUSHDISK,
+ * BSF_FORCEIFHUNG, BSF_IGNORECURRENTTASK, BSF_NOHANG,
+ * BSF_NOTIMEOUTIFNOTHUNG, BSF_POSTMESSAGE, BSF_QUERY,
+ *
+ * with the addition of this pair, which require Win2K or later:
+ *
+ * BSF_ALLOWSFW, BSF_SENDNOTIFYMESSAGE,
+ *
+ * and these, which require WinXP or later:
+ *
+ * BSF_LUID, and BSF_RETURNHDESK
+ *
+ * (end of selective <dpt.h> inclusion).
+ *
+ */
+#define BROADCAST_QUERY_DENY 1112363332
+#define ENUM_CURRENT_SETTINGS ((DWORD)(-1))
+#define ENUM_REGISTRY_SETTINGS ((DWORD)(-2))
+#define CDS_UPDATEREGISTRY 1
+#define CDS_TEST 2
+#define CDS_FULLSCREEN 4
+#define CDS_GLOBAL 8
+#define CDS_SET_PRIMARY 16
+#define CDS_RESET 0x40000000
+#define CDS_SETRECT 0x20000000
+#define CDS_NORESET 0x10000000
+#define DISP_CHANGE_SUCCESSFUL 0
+#define DISP_CHANGE_RESTART 1
+#define DISP_CHANGE_FAILED (-1)
+#define DISP_CHANGE_BADMODE (-2)
+#define DISP_CHANGE_NOTUPDATED (-3)
+#define DISP_CHANGE_BADFLAGS (-4)
+#define DISP_CHANGE_BADPARAM (-5)
+#define DISP_CHANGE_BADDUALVIEW (-6)
+#define BST_CHECKED 1
+#define BST_INDETERMINATE 2
+#define BST_UNCHECKED 0
+#define BST_FOCUS 8
+#define BST_PUSHED 4
+#define MF_BYCOMMAND 0
+#define MF_BYPOSITION 1024
+#define MF_UNCHECKED 0
+#define MF_HILITE 128
+#define MF_UNHILITE 0
+#define CWP_ALL 0
+#define CWP_SKIPINVISIBLE 1
+#define CWP_SKIPDISABLED 2
+#define CWP_SKIPTRANSPARENT 4
+#define IMAGE_BITMAP 0
+#define IMAGE_ICON 1
+#define IMAGE_CURSOR 2
+#define IMAGE_ENHMETAFILE 3
+#define DF_ALLOWOTHERACCOUNTHOOK 1
+#define DESKTOP_CREATEMENU 4
+#define DESKTOP_CREATEWINDOW 2
+#define DESKTOP_ENUMERATE 64
+#define DESKTOP_HOOKCONTROL 8
+#define DESKTOP_JOURNALPLAYBACK 32
+#define DESKTOP_JOURNALRECORD 16
+#define DESKTOP_READOBJECTS 1
+#define DESKTOP_SWITCHDESKTOP 256
+#define DESKTOP_WRITEOBJECTS 128
+#define CW_USEDEFAULT 0x80000000
+#define WS_BORDER 0x800000
+#define WS_CAPTION 0xC00000
+#define WS_CHILD 0x40000000
+#define WS_CHILDWINDOW 0x40000000
+#define WS_CLIPCHILDREN 0x2000000
+#define WS_CLIPSIBLINGS 0x4000000
+#define WS_DISABLED 0x8000000
+#define WS_DLGFRAME 0x400000
+#define WS_GROUP 0x20000
+#define WS_HSCROLL 0x100000
+#define WS_ICONIC 0x20000000
+#define WS_MAXIMIZE 0x1000000
+#define WS_MAXIMIZEBOX 0x10000
+#define WS_MINIMIZE 0x20000000
+#define WS_MINIMIZEBOX 0x20000
+#define WS_OVERLAPPED 0
+#define WS_OVERLAPPEDWINDOW 0xCF0000
+#define WS_POPUP 0x80000000
+#define WS_POPUPWINDOW 0x80880000
+#define WS_SIZEBOX 0x40000
+#define WS_SYSMENU 0x80000
+#define WS_TABSTOP 0x10000
+#define WS_THICKFRAME 0x40000
+#define WS_TILED 0
+#define WS_TILEDWINDOW 0xCF0000
+#define WS_VISIBLE 0x10000000
+#define WS_VSCROLL 0x200000
+#define MDIS_ALLCHILDSTYLES 1
+#define BS_3STATE 5
+#define BS_AUTO3STATE 6
+#define BS_AUTOCHECKBOX 3
+#define BS_AUTORADIOBUTTON 9
+#define BS_BITMAP 128
+#define BS_BOTTOM 0x800
+#define BS_CENTER 0x300
+#define BS_CHECKBOX 2
+#define BS_DEFPUSHBUTTON 1
+#define BS_GROUPBOX 7
+#define BS_ICON 64
+#define BS_LEFT 256
+#define BS_LEFTTEXT 32
+#define BS_MULTILINE 0x2000
+#define BS_NOTIFY 0x4000
+#define BS_OWNERDRAW 0xB
+#define BS_PUSHBUTTON 0
+#define BS_PUSHLIKE 4096
+#define BS_RADIOBUTTON 4
+#define BS_RIGHT 512
+#define BS_RIGHTBUTTON 32
+#define BS_TEXT 0
+#define BS_TOP 0x400
+#define BS_USERBUTTON 8
+#define BS_VCENTER 0xC00
+#define BS_FLAT 0x8000
+#define CBS_AUTOHSCROLL 64
+#define CBS_DISABLENOSCROLL 0x800
+#define CBS_DROPDOWN 2
+#define CBS_DROPDOWNLIST 3
+#define CBS_HASSTRINGS 512
+#define CBS_LOWERCASE 0x4000
+#define CBS_NOINTEGRALHEIGHT 0x400
+#define CBS_OEMCONVERT 128
+#define CBS_OWNERDRAWFIXED 16
+#define CBS_OWNERDRAWVARIABLE 32
+#define CBS_SIMPLE 1
+#define CBS_SORT 256
+#define CBS_UPPERCASE 0x2000
+#define ES_AUTOHSCROLL 128
+#define ES_AUTOVSCROLL 64
+#define ES_CENTER 1
+#define ES_LEFT 0
+#define ES_LOWERCASE 16
+#define ES_MULTILINE 4
+#define ES_NOHIDESEL 256
+#define ES_NUMBER 0x2000
+#define ES_OEMCONVERT 0x400
+#define ES_PASSWORD 32
+#define ES_READONLY 0x800
+#define ES_RIGHT 2
+#define ES_UPPERCASE 8
+#define ES_WANTRETURN 4096
+#define LBS_DISABLENOSCROLL 4096
+#define LBS_EXTENDEDSEL 0x800
+#define LBS_HASSTRINGS 64
+#define LBS_MULTICOLUMN 512
+#define LBS_MULTIPLESEL 8
+#define LBS_NODATA 0x2000
+#define LBS_NOINTEGRALHEIGHT 256
+#define LBS_NOREDRAW 4
+#define LBS_NOSEL 0x4000
+#define LBS_NOTIFY 1
+#define LBS_OWNERDRAWFIXED 16
+#define LBS_OWNERDRAWVARIABLE 32
+#define LBS_SORT 2
+#define LBS_STANDARD 0xA00003
+#define LBS_USETABSTOPS 128
+#define LBS_WANTKEYBOARDINPUT 0x400
+#define SBS_BOTTOMALIGN 4
+#define SBS_HORZ 0
+#define SBS_LEFTALIGN 2
+#define SBS_RIGHTALIGN 4
+#define SBS_SIZEBOX 8
+#define SBS_SIZEBOXBOTTOMRIGHTALIGN 4
+#define SBS_SIZEBOXTOPLEFTALIGN 2
+#define SBS_SIZEGRIP 16
+#define SBS_TOPALIGN 2
+#define SBS_VERT 1
+#define SS_BITMAP 14
+#define SS_BLACKFRAME 7
+#define SS_BLACKRECT 4
+#define SS_CENTER 1
+#define SS_CENTERIMAGE 512
+#define SS_ENHMETAFILE 15
+#define SS_ETCHEDFRAME 18
+#define SS_ETCHEDHORZ 16
+#define SS_ETCHEDVERT 17
+#define SS_GRAYFRAME 8
+#define SS_GRAYRECT 5
+#define SS_ICON 3
+#define SS_LEFT 0
+#define SS_LEFTNOWORDWRAP 0xC
+#define SS_NOPREFIX 128
+#define SS_NOTIFY 256
+#define SS_OWNERDRAW 0xD
+#define SS_REALSIZEIMAGE 0x800
+#define SS_RIGHT 2
+#define SS_RIGHTJUST 0x400
+#define SS_SIMPLE 11
+#define SS_SUNKEN 4096
+#define SS_WHITEFRAME 9
+#define SS_WHITERECT 6
+#define SS_USERITEM 10
+#define SS_TYPEMASK 0x0000001FL
+#define SS_ENDELLIPSIS 0x00004000L
+#define SS_PATHELLIPSIS 0x00008000L
+#define SS_WORDELLIPSIS 0x0000C000L
+#define SS_ELLIPSISMASK 0x0000C000L
+#define DS_3DLOOK 4
+#define DS_ABSALIGN 1
+#define DS_CENTER 0x800
+#define DS_CENTERMOUSE 4096
+#define DS_CONTEXTHELP 0x2000
+#define DS_CONTROL 0x400
+#define DS_FIXEDSYS 8
+#define DS_LOCALEDIT 32
+#define DS_MODALFRAME 128
+#define DS_NOFAILCREATE 16
+#define DS_NOIDLEMSG 256
+#define DS_SETFONT 64
+#define DS_SETFOREGROUND 512
+#define DS_SYSMODAL 2
+#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS)
+#define WS_EX_ACCEPTFILES 16
+#define WS_EX_APPWINDOW 0x40000
+#define WS_EX_CLIENTEDGE 512
+#define WS_EX_COMPOSITED 0x2000000 /* XP */
+#define WS_EX_CONTEXTHELP 0x400
+#define WS_EX_CONTROLPARENT 0x10000
+#define WS_EX_DLGMODALFRAME 1
+#define WS_EX_LAYERED 0x80000 /* W2K */
+#define WS_EX_LAYOUTRTL 0x400000 /* W98, W2K */
+#define WS_EX_LEFT 0
+#define WS_EX_LEFTSCROLLBAR 0x4000
+#define WS_EX_LTRREADING 0
+#define WS_EX_MDICHILD 64
+#define WS_EX_NOACTIVATE 0x8000000 /* W2K */
+#define WS_EX_NOINHERITLAYOUT 0x100000 /* W2K */
+#define WS_EX_NOPARENTNOTIFY 4
+#define WS_EX_OVERLAPPEDWINDOW 0x300
+#define WS_EX_PALETTEWINDOW 0x188
+#define WS_EX_RIGHT 0x1000
+#define WS_EX_RIGHTSCROLLBAR 0
+#define WS_EX_RTLREADING 0x2000
+#define WS_EX_STATICEDGE 0x20000
+#define WS_EX_TOOLWINDOW 128
+#define WS_EX_TOPMOST 8
+#define WS_EX_TRANSPARENT 32
+#define WS_EX_WINDOWEDGE 256
+#define WINSTA_ALL_ACCESS 895
+#define WINSTA_ACCESSCLIPBOARD 4
+#define WINSTA_ACCESSGLOBALATOMS 32
+#define WINSTA_CREATEDESKTOP 8
+#define WINSTA_ENUMDESKTOPS 1
+#define WINSTA_ENUMERATE 256
+#define WINSTA_EXITWINDOWS 64
+#define WINSTA_READATTRIBUTES 2
+#define WINSTA_READSCREEN 512
+#define WINSTA_WRITEATTRIBUTES 16
+#define DDL_READWRITE 0
+#define DDL_READONLY 1
+#define DDL_HIDDEN 2
+#define DDL_SYSTEM 4
+#define DDL_DIRECTORY 16
+#define DDL_ARCHIVE 32
+#define DDL_POSTMSGS 8192
+#define DDL_DRIVES 16384
+#define DDL_EXCLUSIVE 32768
+#define DC_ACTIVE 0x00000001
+#define DC_SMALLCAP 0x00000002
+#define DC_ICON 0x00000004
+#define DC_TEXT 0x00000008
+#define DC_INBUTTON 0x00000010
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN2K || _WIN32_WINDOWS >= _WIN32_WINDOWS_98
+#define DC_GRADIENT 0x00000020
#endif
-#if (_WIN32_WINNT >= 0x0501)
-#define DC_BUTTONS 0x00001000
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WINXP
+#define DC_BUTTONS 0x00001000
#endif
+
/* Where are these documented? */
-#define DC_CAPTION (DC_ICON|DC_TEXT|DC_BUTTONS)
-#define DC_NC (DC_CAPTION|DC_FRAME)
-
-#define BDR_RAISEDOUTER 1
-#define BDR_SUNKENOUTER 2
-#define BDR_RAISEDINNER 4
-#define BDR_SUNKENINNER 8
-#define BDR_OUTER 3
-#define BDR_INNER 0xc
-#define BDR_RAISED 5
-#define BDR_SUNKEN 10
-#define EDGE_RAISED (BDR_RAISEDOUTER|BDR_RAISEDINNER)
-#define EDGE_SUNKEN (BDR_SUNKENOUTER|BDR_SUNKENINNER)
-#define EDGE_ETCHED (BDR_SUNKENOUTER|BDR_RAISEDINNER)
-#define EDGE_BUMP (BDR_RAISEDOUTER|BDR_SUNKENINNER)
-#define BF_LEFT 1
-#define BF_TOP 2
-#define BF_RIGHT 4
-#define BF_BOTTOM 8
-#define BF_TOPLEFT (BF_TOP|BF_LEFT)
-#define BF_TOPRIGHT (BF_TOP|BF_RIGHT)
-#define BF_BOTTOMLEFT (BF_BOTTOM|BF_LEFT)
-#define BF_BOTTOMRIGHT (BF_BOTTOM|BF_RIGHT)
-#define BF_RECT (BF_LEFT|BF_TOP|BF_RIGHT|BF_BOTTOM)
-#define BF_DIAGONAL 16
-#define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL|BF_TOP|BF_RIGHT)
-#define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL|BF_TOP|BF_LEFT)
-#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL|BF_BOTTOM|BF_LEFT)
-#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT)
-#define BF_MIDDLE 0x800
-#define BF_SOFT 0x1000
-#define BF_ADJUST 0x2000
-#define BF_FLAT 0x4000
-#define BF_MONO 0x8000
-#define DFC_CAPTION 1
-#define DFC_MENU 2
-#define DFC_SCROLL 3
-#define DFC_BUTTON 4
-#if (WINVER >= 0x0500)
-#define DFC_POPUPMENU 5
-#endif /* WINVER >= 0x0500 */
-#define DFCS_CAPTIONCLOSE 0
-#define DFCS_CAPTIONMIN 1
-#define DFCS_CAPTIONMAX 2
-#define DFCS_CAPTIONRESTORE 3
-#define DFCS_CAPTIONHELP 4
-#define DFCS_MENUARROW 0
-#define DFCS_MENUCHECK 1
-#define DFCS_MENUBULLET 2
-#define DFCS_MENUARROWRIGHT 4
-#define DFCS_SCROLLUP 0
-#define DFCS_SCROLLDOWN 1
-#define DFCS_SCROLLLEFT 2
-#define DFCS_SCROLLRIGHT 3
-#define DFCS_SCROLLCOMBOBOX 5
-#define DFCS_SCROLLSIZEGRIP 8
-#define DFCS_SCROLLSIZEGRIPRIGHT 16
-#define DFCS_BUTTONCHECK 0
-#define DFCS_BUTTONRADIOIMAGE 1
-#define DFCS_BUTTONRADIOMASK 2
-#define DFCS_BUTTONRADIO 4
-#define DFCS_BUTTON3STATE 8
-#define DFCS_BUTTONPUSH 16
-#define DFCS_INACTIVE 256
-#define DFCS_PUSHED 512
-#define DFCS_CHECKED 1024
-#if (WINVER >= 0x0500)
-#define DFCS_TRANSPARENT 0x800
-#define DFCS_HOT 0x1000
+#define DC_CAPTION (DC_ICON | DC_TEXT | DC_BUTTONS)
+#define DC_NC (DC_CAPTION | DC_FRAME)
+
+#define BDR_RAISEDOUTER 1
+#define BDR_SUNKENOUTER 2
+#define BDR_RAISEDINNER 4
+#define BDR_SUNKENINNER 8
+#define BDR_OUTER 3
+#define BDR_INNER 0xC
+#define BDR_RAISED 5
+#define BDR_SUNKEN 10
+#define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER)
+#define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER)
+#define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER)
+#define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER)
+#define BF_LEFT 1
+#define BF_TOP 2
+#define BF_RIGHT 4
+#define BF_BOTTOM 8
+#define BF_TOPLEFT (BF_TOP | BF_LEFT)
+#define BF_TOPRIGHT (BF_TOP | BF_RIGHT)
+#define BF_BOTTOMLEFT (BF_BOTTOM | BF_LEFT)
+#define BF_BOTTOMRIGHT (BF_BOTTOM | BF_RIGHT)
+#define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM)
+#define BF_DIAGONAL 16
+#define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL | BF_TOP | BF_RIGHT)
+#define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL | BF_TOP | BF_LEFT)
+#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT)
+#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT)
+#define BF_MIDDLE 0x800
+#define BF_SOFT 0x1000
+#define BF_ADJUST 0x2000
+#define BF_FLAT 0x4000
+#define BF_MONO 0x8000
+#define DFC_CAPTION 1
+#define DFC_MENU 2
+#define DFC_SCROLL 3
+#define DFC_BUTTON 4
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN2K
+#define DFC_POPUPMENU 5
+#endif /* >= _WIN32_WINNT_WIN2K */
+
+#define DFCS_CAPTIONCLOSE 0
+#define DFCS_CAPTIONMIN 1
+#define DFCS_CAPTIONMAX 2
+#define DFCS_CAPTIONRESTORE 3
+#define DFCS_CAPTIONHELP 4
+#define DFCS_MENUARROW 0
+#define DFCS_MENUCHECK 1
+#define DFCS_MENUBULLET 2
+#define DFCS_MENUARROWRIGHT 4
+#define DFCS_SCROLLUP 0
+#define DFCS_SCROLLDOWN 1
+#define DFCS_SCROLLLEFT 2
+#define DFCS_SCROLLRIGHT 3
+#define DFCS_SCROLLCOMBOBOX 5
+#define DFCS_SCROLLSIZEGRIP 8
+#define DFCS_SCROLLSIZEGRIPRIGHT 16
+#define DFCS_BUTTONCHECK 0
+#define DFCS_BUTTONRADIOIMAGE 1
+#define DFCS_BUTTONRADIOMASK 2
+#define DFCS_BUTTONRADIO 4
+#define DFCS_BUTTON3STATE 8
+#define DFCS_BUTTONPUSH 16
+#define DFCS_INACTIVE 256
+#define DFCS_PUSHED 512
+#define DFCS_CHECKED 1024
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN2K
+#define DFCS_TRANSPARENT 0x800
+#define DFCS_HOT 0x1000
#endif
-#define DFCS_ADJUSTRECT 0x2000
-#define DFCS_FLAT 0x4000
-#define DFCS_MONO 0x8000
-#define DST_COMPLEX 0
-#define DST_TEXT 1
-#define DST_PREFIXTEXT 2
-#define DST_ICON 3
-#define DST_BITMAP 4
-#define DSS_NORMAL 0
-#define DSS_UNION 16
-#define DSS_DISABLED 32
-#define DSS_MONO 128
-#define DSS_RIGHT 0x8000
-#define DT_BOTTOM 8
-#define DT_CALCRECT 1024
-#define DT_CENTER 1
-#define DT_EDITCONTROL 8192
-#define DT_END_ELLIPSIS 32768
-#define DT_PATH_ELLIPSIS 16384
-#define DT_WORD_ELLIPSIS 0x40000
-#define DT_EXPANDTABS 64
-#define DT_EXTERNALLEADING 512
-#define DT_LEFT 0
-#define DT_MODIFYSTRING 65536
-#define DT_NOCLIP 256
-#define DT_NOPREFIX 2048
-#define DT_RIGHT 2
-#define DT_RTLREADING 131072
-#define DT_SINGLELINE 32
-#define DT_TABSTOP 128
-#define DT_TOP 0
-#define DT_VCENTER 4
-#define DT_WORDBREAK 16
-#define DT_INTERNAL 4096
-#define WB_ISDELIMITER 2
-#define WB_LEFT 0
-#define WB_RIGHT 1
-#define SB_HORZ 0
-#define SB_VERT 1
-#define SB_CTL 2
-#define SB_BOTH 3
-#define ESB_DISABLE_BOTH 3
-#define ESB_DISABLE_DOWN 2
-#define ESB_DISABLE_LEFT 1
-#define ESB_DISABLE_LTUP 1
-#define ESB_DISABLE_RIGHT 2
-#define ESB_DISABLE_RTDN 2
-#define ESB_DISABLE_UP 1
-#define ESB_ENABLE_BOTH 0
-#define SB_LINEUP 0
-#define SB_LINEDOWN 1
-#define SB_LINELEFT 0
-#define SB_LINERIGHT 1
-#define SB_PAGEUP 2
-#define SB_PAGEDOWN 3
-#define SB_PAGELEFT 2
-#define SB_PAGERIGHT 3
-#define SB_THUMBPOSITION 4
-#define SB_THUMBTRACK 5
-#define SB_ENDSCROLL 8
-#define SB_LEFT 6
-#define SB_RIGHT 7
-#define SB_BOTTOM 7
-#define SB_TOP 6
-#define IS_INTRESOURCE(i) (((ULONG_PTR)(i) >> 16) == 0)
-#define MAKEINTRESOURCEA(i) (LPSTR)((DWORD)((WORD)(i)))
-#define MAKEINTRESOURCEW(i) (LPWSTR)((DWORD)((WORD)(i)))
+
+#define DFCS_ADJUSTRECT 0x2000
+#define DFCS_FLAT 0x4000
+#define DFCS_MONO 0x8000
+#define DST_COMPLEX 0
+#define DST_TEXT 1
+#define DST_PREFIXTEXT 2
+#define DST_ICON 3
+#define DST_BITMAP 4
+#define DSS_NORMAL 0
+#define DSS_UNION 16
+#define DSS_DISABLED 32
+#define DSS_MONO 128
+#define DSS_RIGHT 0x8000
+#define DT_BOTTOM 8
+#define DT_CALCRECT 1024
+#define DT_CENTER 1
+#define DT_EDITCONTROL 8192
+#define DT_END_ELLIPSIS 32768
+#define DT_PATH_ELLIPSIS 16384
+#define DT_WORD_ELLIPSIS 0x40000
+#define DT_EXPANDTABS 64
+#define DT_EXTERNALLEADING 512
+#define DT_LEFT 0
+#define DT_MODIFYSTRING 65536
+#define DT_NOCLIP 256
+#define DT_NOPREFIX 2048
+#define DT_RIGHT 2
+#define DT_RTLREADING 131072
+#define DT_SINGLELINE 32
+#define DT_TABSTOP 128
+#define DT_TOP 0
+#define DT_VCENTER 4
+#define DT_WORDBREAK 16
+#define DT_INTERNAL 4096
+#define WB_ISDELIMITER 2
+#define WB_LEFT 0
+#define WB_RIGHT 1
+#define SB_HORZ 0
+#define SB_VERT 1
+#define SB_CTL 2
+#define SB_BOTH 3
+#define ESB_DISABLE_BOTH 3
+#define ESB_DISABLE_DOWN 2
+#define ESB_DISABLE_LEFT 1
+#define ESB_DISABLE_LTUP 1
+#define ESB_DISABLE_RIGHT 2
+#define ESB_DISABLE_RTDN 2
+#define ESB_DISABLE_UP 1
+#define ESB_ENABLE_BOTH 0
+#define SB_LINEUP 0
+#define SB_LINEDOWN 1
+#define SB_LINELEFT 0
+#define SB_LINERIGHT 1
+#define SB_PAGEUP 2
+#define SB_PAGEDOWN 3
+#define SB_PAGELEFT 2
+#define SB_PAGERIGHT 3
+#define SB_THUMBPOSITION 4
+#define SB_THUMBTRACK 5
+#define SB_ENDSCROLL 8
+#define SB_LEFT 6
+#define SB_RIGHT 7
+#define SB_BOTTOM 7
+#define SB_TOP 6
+#define IS_INTRESOURCE(i) (((ULONG_PTR)(i) >> 16) == 0)
+#define MAKEINTRESOURCEA(i) (LPSTR)((DWORD)((WORD)(i)))
+#define MAKEINTRESOURCEW(i) (LPWSTR)((DWORD)((WORD)(i)))
+
#ifndef XFree86Server
-# define RT_CURSOR MAKEINTRESOURCE(1)
-# define RT_FONT MAKEINTRESOURCE(8)
-#endif /* ndef XFree86Server */
-#define RT_BITMAP MAKEINTRESOURCE(2)
-#define RT_ICON MAKEINTRESOURCE(3)
-#define RT_MENU MAKEINTRESOURCE(4)
-#define RT_DIALOG MAKEINTRESOURCE(5)
-#defi...
[truncated message content] |
|
From: Keith M. <no...@so...> - 2016-11-21 19:29:59
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via ae89720834d70256a18af17ca64ff49892431c63 (commit)
from 5b105e818576eea61eff243db85ce5fb7b5973aa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/ae89720834d70256a18af17ca64ff49892431c63/
commit ae89720834d70256a18af17ca64ff49892431c63
Author: Keith Marshall <kei...@us...>
Date: Mon Nov 21 19:24:19 2016 +0000
Replace defective powf() and powl() function implementations.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index b5ea2ae..3a71f3a 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,17 @@
+2016-11-21 Keith Marshall <kei...@us...>
+
+ Replace defective powf() and powl() function implementations.
+
+ * mingwex/math/powf.c mingwex/math/powl.c: Delete; replaced by...
+ * mingwex/math/pow_generic.sx: ...this new file; it implements...
+ (__x87pow): ...this generic power function back-end, serving...
+ (pow, powf, powl): ...each of these front-end entry points.
+
+ * Makefile.in (libmingwex.a): Add x87pow.$OBJEXT
+
+ * include/math.h (powf): Remove inline implementation; it no longer
+ offers any inline advantage.
+
2016-11-18 Keith Marshall <kei...@us...>
Implement unit tests for power functions.
diff --git a/mingwrt/Makefile.in b/mingwrt/Makefile.in
index bf5a702..c95d788 100644
--- a/mingwrt/Makefile.in
+++ b/mingwrt/Makefile.in
@@ -462,7 +462,7 @@ libmingwex.a: $(addsuffix .$(OBJEXT), cosf cosl acosf acosl sinf sinl asinf \
powf powl powi powif powil remainder remainderf remainderl remquo remquof \
remquol rint rintf rintl round roundf roundl scalbn scalbnf scalbnl signbit \
signbitf signbitl sqrtf sqrtl tgamma tgammaf tgammal trunc truncf truncl \
- x87cvt x87cvtf x87log x87log1p)
+ x87cvt x87cvtf x87log x87log1p x87pow)
# Replacement I/O functions in libmingwex.a, providing better POSIX
# compatibility than their Microsoft equivalents.
diff --git a/mingwrt/include/math.h b/mingwrt/include/math.h
index af94513..2ac331c 100644
--- a/mingwrt/include/math.h
+++ b/mingwrt/include/math.h
@@ -650,10 +650,6 @@ extern long double __cdecl hypotl (long double, long double);
/* 7.12.7.4 The pow functions. Double in C89 */
extern float __cdecl powf (float, float);
-#ifndef __NO_INLINE__
-__CRT_INLINE float __cdecl powf (float x, float y)
- {return (float) pow (x, y);}
-#endif
extern long double __cdecl powl (long double, long double);
/* 7.12.7.5 The sqrt functions. Double in C89. */
diff --git a/mingwrt/mingwex/math/pow_generic.sx b/mingwrt/mingwex/math/pow_generic.sx
new file mode 100644
index 0000000..65436b4
--- /dev/null
+++ b/mingwrt/mingwex/math/pow_generic.sx
@@ -0,0 +1,423 @@
+/*
+ * pow_generic.sx
+ *
+ * Generic implementation for the pow(), powl(), and powf() functions.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#undef __function
+
+#if defined _powl_source
+# define __function _powl
+# define __yoffset __xoffset+12
+# define __fldx fldt __xoffset(%esp)
+# define __fldy fldt __yoffset(%esp)
+
+#elif defined _powf_source
+# define __function _powf
+# define __yoffset __xoffset+4
+# define __fldx flds __xoffset(%esp)
+# define __fldy flds __yoffset(%esp)
+# define ___x87cvt ___x87cvtf
+
+#elif defined _pow_source
+# define __function _pow
+# define __yoffset __xoffset+8
+# define __fldx fldl __xoffset(%esp)
+# define __fldy fldl __yoffset(%esp)
+#endif
+
+#ifdef __MINGW64__
+# define __xoffset 8
+# define esp rsp
+# define eax rax
+# define edx rdx
+#else
+# define __xoffset 4
+#endif
+
+.text
+.align 4
+#ifdef __function
+/* A specific front-end entry point name has been identified; thus,
+ * we are assembling the front-end stub implementation for just one
+ * of the three supported functions, with C language prototypes:
+ *
+ * double pow (double x, double y);
+ * long double powl (long double x, long double y);
+ * float powf (float x, float y);
+ */
+.globl __function
+.def __function; .scl 2; .type 32; .endef
+
+__function:
+/* First, load x and y into the FPU, using the appropriate operand
+ * size specification for the specified front-end entry point, then
+ * hand off control to the generic back-end function.
+ */
+ __fldx /* x */
+ __fldy /* y ; x */
+
+#ifdef _powl_source
+/* For the long double powl (long double, long double) form of the
+ * primary function, we can simply delegate computation of the REAL10
+ * result to the ___x87pow() handler, with that returning directly
+ * to powl()'s own caller...
+ */
+ jmp ___x87pow
+
+#else
+/* ...whereas for each of double pow (double, double) form, and its
+ * float powf (float, float) sibling, we must call the backend handler
+ * to compute an intermediate REAL10 result...
+ */
+ call ___x87pow
+
+/* ...then return that via the appropriate type conversion/validation
+ * handler, to obtain the ultimately required REAL8 or REAL4 result.
+ */
+ jmp ___x87cvt
+
+#endif
+#else
+/* No specific function entry point identified; implement the generic
+ * back-end, which is common to all supported front-end entry points;
+ * it also provides the error reporting API.
+ */
+#include "errno.sx"
+
+.align 4
+.globl ___x87pow
+.def ___x87pow; .scl 2; .type 32; .endef
+
+___x87pow:
+ fxam /* classify y input value */
+ fnstsw %ax /* copy FPU flags to CPU flags */
+ fld1 /* +1.0 ; y ; x */
+ sahf /* examine ZF = C3 and PF = C2 */
+ jnz 30f /* y is non-zero */
+ jp 30f /* y is non-zero, denormalized */
+
+/* In the case where y is zero, then POSIX says that the value of x is
+ * irrelevant, (even if it is indefinite); the return value is +1.0
+ */
+ fstp %st(2) /* y ; x^y = 1.0 */
+ fstp %st(0) /* x^y */
+ ret
+
+/* When y is non-zero, proceed to consideration of the x argument value;
+ * (this is necessary, even if the value of y is indeterminate).
+ */
+30: movb %ah, %dl /* save y classification flags */
+ fucomp %st(2) /* y ; x */
+ fnstsw %ax /* copy FPU flags to CPU flags */
+ fxch /* x ; y */
+ sahf /* examine ZF = C3 and PF = C2 */
+ jp 32f /* return x^y = indeterminate x */
+ jnz 40f /* x != +1.0 */
+
+/* For this specific case, where x == +1.0, POSIX says that the return
+ * value shall be +1.0, (even if the value of y is indeterminate).
+ */
+ fld1 /* x^y = 1.0 ; y ; x */
+31: fstp %st(1) /* x^y ; x */
+32: fstp %st(1) /* x^y */
+ ret
+
+/* In any other case, if either x or y is NaN, then POSIX requires that
+ * NaN shall be returned; first check for x being NaN, or infinite.
+ */
+40: fxam /* classify x input value */
+ fnstsw %ax /* copy FPU flags to CPU flags */
+ sahf /* test for infinity or NaN */
+ jnc 50f /* x is finite, so pass it on */
+ jnp 32b /* return x^y = x as NaN */
+
+/* We've identified that x is infinite; how we handle this boundary
+ * condition depends on whether it's a +ve infinity, or a -ve.
+ */
+ testb $0x02, %ah /* x ; y */
+ jnz 42f /* x is -ve infinity */
+
+/* In the case where x is +ve infinity, POSIX stipulates that the return
+ * value should be +ve infinity when y > 0.0, or +0.0 when y < 0.0; first
+ * deal with the y > 0.0 case.
+ */
+ testb $0x02, %dl /* check if y is +ve, or -ve? */
+ jz 32b /* +ve: return x^y = x = +ve infinity */
+
+/* Alternatively, in the case when x is +ve infinity, and y < 0.0, we
+ * substitute 0.0 for x, then return it as the value for x^y.
+ */
+41: fldz /* 0.0 ; x ; y */
+ jmp 31b /* return x^y = 0.0 */
+
+/* Similarly, in the case where x is -ve infinity, we must again return
+ * infinity for y > 0.0, or 0.0 for y < 0.0; however, in this case, the
+ * sign of the returned value must be -ve if y is an odd valued integer,
+ * or +ve for any other value of y.
+ */
+42: testb $0x02, %dl /* check if y is +ve, or -ve? */
+ jz 43f /* when +ve, return signed infinity */
+
+/* Fall through when x is -ve infinity and y < 0.0; substitute -0.0 for
+ * the infinite value of x, then adjust the sign depending on whether y
+ * is an odd valued integer, or any other value.
+ */
+ fldz /* 0.0 ; x ; y */
+ fstp %st(1) /* 0.0 ; y */
+ fchs /* -0.0 ; y */
+
+/* Determine if y is non-integral, or an even valued integer, in either
+ * of which cases we force a +ve return value, or an odd valued integer,
+ * in whiich case we leave the sign of the return value as it is; begin
+ * by checking if y/2 is an integer, which asserts that y itself is an
+ * even valued integer.
+ */
+43: fld1 /* 1.0 ; x ; y */
+ fchs /* -1.0 ; x ; y */
+ fld %st(2) /* y ; -1.0 ; x ; y */
+ fscale /* y/2 ; -1.0 ; x ; y */
+ fst %st(1) /* y/2 ; y/2 ; x ; y */
+ frndint /* int(y/2) ; y/2 ; x ; y */
+ fucompp /* x ; y */
+ fnstsw %ax /* check if int(y/2) == y/2 ? */
+ sahf /* hence y is an even valued integer */
+ je 44f /* so go force +ve x^y return value */
+
+/* When we've established that y is not an even valued integer, we must
+ * still confirm the possibility that it is an odd valued integer; i.e.
+ * if it is an integer, it must be odd valued.
+ */
+ fld %st(1) /* y ; x ; y */
+ fld %st(0) /* y ; y ; x ; y */
+ frndint /* int(y) ; y ; x ; y */
+ fucompp /* x ; y */
+ fnstsw %ax /* check if int(y) == y ? */
+ sahf /* hence y is an odd valued integer */
+ je 32b /* so return x^y as is */
+
+/* When y is either an even valued integer, or not an integer at all:
+ */
+44: fabs /* make x^y value +ve */
+ jmp 32b /* then return it */
+
+/* When x is finite, we still need to check the possibility that y may
+ * be NaN, or may be infinite.
+ */
+50: xchgb %dl, %ah /* reload y classification flags */
+ movb %ah, %dh /* save a copy */
+ sahf /* check for y finite, infinite, or NaN */
+ jnc 60f /* y is also finite */
+ jp 52f /* y is infinite, but not NaN */
+
+/* y is NaN; pop x off FPU stack, and return x^y as NaN value of y.
+ */
+51: fstp %st(0) /* y */
+ ret /* return x^y = y */
+
+/* We've identified x as finite, but y as infinite; POSIX defines
+ * boundary conditions about the range -1.0 < x < +1.0, which may be
+ * differentiated by comparison between +1.0 and |x|. We've already
+ * that x != +1.0, so if we now identify that |x| == +1.0, then this
+ * must represent x == -1.0, a boundary condition for which POSIX
+ * prescribes a return value of +1.0
+ */
+52: fabs /* |x| ; y */
+ fld1 /* 1.0 ; |x| ; y */
+ fucom %st(1) /* check for |x| == 1.0 */
+ fnstsw %ax /* copy FPU flags to CPU flags */
+ sahf /* if ZF == 1 -> |x| == 1.0 */
+ je 31b /* return x^y = |x| = +1.0 */
+
+/* When |x| != 1.0, we have no further use for the comparative values
+ * of 1.0 and |x|, on the FPU stack; discard them, then check the flag
+ * state to establish whether x lies within the boundary range.
+ */
+ fstp %st(0) /* |x| ; y */
+ fstp %st(0) /* y */
+ jnb 53f /* -1.0 < x < +1.0 */
+
+/* This represents the POSIX boundary condition where y is infinite,
+ * and |x| > 1.0; for this condition, POSIX specifies a return value
+ * of x^y = 0.0 if y is -ve infinity, otherwise x^y = y.
+ */
+ test $0x02, %dh /* if y is -ve infinity */
+ jnz 41b /* then go return +0.0 */
+ ret /* else return -ve infinity */
+
+/* Here, we have -1.0 < x < +1.0, and y is infinite; for this case,
+ * POSIX prescribes a return value of +0.0 when y is +ve infinity, or
+ * +ve infinity when y itself -ve infinity.
+ */
+53: test $0x02, %dh /* if y is +ve infinity */
+ jz 41b /* then go return +0.0 */
+ fabs /* else force to +ve infinity */
+ ret /* and return it */
+
+/* We've now established that both x and y are finite, but we must
+ * still consider the special restrictions which apply when x == 0.0
+ * or x < 0.0
+ */
+60: movb %dl, %ah /* review x value classification */
+ sahf /* examining ZF = C3 and PF = C2 */
+ jnz 70f /* x is non-zero */
+ jp 70f /* x is non-zero, denormalized */
+
+/* When x is zero, the return value is (possibly signed) zero for
+ * all y > 0.0, but infinite, and reported as a pole error, for any
+ * y < 0.0
+ */
+ testb $0x02, %dh /* if y is -ve? */
+ jnz 61f /* then go process the pole error */
+
+/* For the case where y > 0.0, the sign of the original x value is
+ * preserved when y is an odd valued integer, or forced to +0.0 for
+ * any other +ve value of y; (obviously, if x is already +0.0, the
+ * sign preservation condition becomes irrelevant).
+ */
+ testb $0x02, %ah /* if x == +0.0 */
+ jz 32b /* then just go return it */
+ jmp 43b /* else go ajust sign */
+
+/* For the pole error case, we must substitute an infinity for the
+ * original value of x; a convenient way to achieve this is to take
+ * the logarithm of x, (which is -ve infinity by definition).
+ */
+61: fld1 /* 1.0 ; 0.0 ; y */
+ fxch %st(1) /* 0.0 ; 1.0 ; y */
+ fyl2x /* 1.0 * log2(0.0) = -inf ; y */
+
+/* To diagnose the pole error, we will set errno = ERANGE, (which
+ * is compliant with POSIX); on Win32, we call __errno() to get a
+ * pointer to errno itself, but note that we haven't done with EDX
+ * yet, so we must guard against possible modification during the
+ * execution of __errno().
+ */
+ pushl %edx /* we must save this */
+ errno ERANGE /* because this may change it */
+ popl %edx /* restore saved value */
+
+/* The returned infinity must preserve the sign of the original x,
+ * when y is an odd valued integer, otherwise it is forced to +inf;
+ * (obviously, if x is +0.0, we may just force +inf anyway).
+ */
+ testb $0x02, %dl /* if x is -0.0 */
+ jnz 43b /* then go do signed return */
+ fabs /* else force to +inf */
+ jmp 32b /* and return it */
+
+/* When both x and y are finite and non-zero, then we must check
+ * for a possible domain error condition, which occurs when x < 0
+ * and y has any value which is not an integer.
+ */
+70: testb $0x02, %ah /* if x > 0.0 */
+ jz 80f /* then result is computable */
+
+/* Here, x < 0.0; the result may still be computable, if (and only
+ * if) the value of y is an integer.
+ */
+ fld %st(1) /* y ; x ; y */
+ fld %st(0) /* y ; y ; x ; y */
+ frndint /* int(y) ; y ; x ; y */
+ fucompp /* x ; y */
+ fnstsw %ax /* copy FPU flags to CPU flags */
+ sahf /* to test if y == int(y) ? */
+ je 71f /* then result is computable */
+
+/* Fall through when x < 0.0 and y is not an integer; in this case
+ * we must set errno to report a domain error, and return NaN.
+ */
+ fsqrt /* NaN ; y */
+ errno EDOM /* set errno = EDOM */
+ jmp 32b /* return NaN */
+
+/* When x < 0.0 and y is an integer, we may still compute x^y
+ * according to the relationship x^y = -1^y * 2^(y * log2(|x|))
+ */
+71: fabs /* |x| ; y */
+ fld %st(1) /* y ; |x| ; y */
+ fxch %st(1) /* |x| ; y ; y */
+ call 80f /* |x|^y ; y */
+ fchs /* assume y is odd valued */
+ jmp 43b /* adjust if even valued */
+
+/* When x > 0.0, and y is finite, we may proceed to compute x^y,
+ * according to the relationship: x^y = 2^(y * log2(x)); first we
+ * compute log2(x), preferring the FYL2XP1 method for values of x
+ * close to zero, but falling back on FYL2X for x > 1.29
+ */
+80: call ___x87log /* y*log2(x) */
+
+/* Having computed the value of y * log2(x), we may now compute
+ * the final result as 2^(y * log2(x)). We must compute this in
+ * stages, combining 2^frac(y * log2(x)) * 2^int(y * log2(x)) to
+ * yielding the final result for x^y; first separate y * log2(x)
+ * into fractional and integer parts:
+ */
+ fld %st /* y*log2(x) ; y*log2(x) */
+ frndint /* int(y*log2(x)) ; y*log2(x) */
+ fxch %st(1) /* y*log2(x) ; int(y*log2(x)) */
+ fsub %st(1), %st /* frac(y*log2(x)) ; int(y*log2(x)) */
+
+/* Now compute the intermediate 2^frac(y * log(x)) - 1.0 result:
+ */
+ f2xm1 /* 2^frac(y*log2(x))-1 ; int(y*log2(x)) */
+
+/* Add the 1.0 deficit, to yield the 2^frac(y * log2(x)) result:
+ */
+ fld1 /* 1 ; 2^frac(y*log2(x))-1 ; int(y*log2(x)) */
+ faddp /* 2^frac(y*log2(x)) ; int(y*log2(x)) */
+
+/* Finally, multiply by 2^int(y * log2(x)), to yield the x^y result:
+ */
+ fscale /* x^y ; int(y*log2(x)) */
+ fstp %st(1) /* x^y */
+
+/* At this point, the value of x^y should not be zero; if it is, then
+ * the computation has underflowed, in which case POSIX recommends that
+ * errno should be set to ERANGE. Alternatively, if the result becomes
+ * infinite then the computation has overflowed, in which case POSIX
+ * requires that errno be so set. Check if either is appropriate.
+ */
+ fxam /* classify x^y result */
+ fnstsw %ax /* copy FPU status flags */
+ sahf /* to test via CPU flags, hence report */
+ jbe 81f /* ZF -> underflow; CF -> overflow */
+ ret /* else return x^y, errno unchanged */
+
+/* Here, we provide an alternative function return, for use when either
+ * overflow or underflow is detected during the computation of x^y; it
+ * returns whatever x^y value has been computed, after having set errno
+ * to indicate the ERANGE condition.
+ */
+81: errno ERANGE /* set errno = ERANGE */
+ ret /* return x^y, errno = ERANGE */
+#endif
+
+/* vim: set autoindent filetype=asm formatoptions=croql: */
+/* $RCSfile$: end of file */
diff --git a/mingwrt/mingwex/math/powf.c b/mingwrt/mingwex/math/powf.c
deleted file mode 100644
index 1af4d2d..0000000
--- a/mingwrt/mingwex/math/powf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <math.h>
-float powf (float x, float y)
- {return (float) pow (x, y);}
diff --git a/mingwrt/mingwex/math/powl.c b/mingwrt/mingwex/math/powl.c
deleted file mode 100644
index 03d7122..0000000
--- a/mingwrt/mingwex/math/powl.c
+++ /dev/null
@@ -1,803 +0,0 @@
-/*
- * powl.c
- *
- * Power function, long double precision
- *
- *
- *
- * SYNOPSIS:
- *
- * long double x, y, z, powl();
- *
- * z = powl( x, y );
- *
- *
- *
- * DESCRIPTION:
- *
- * Computes x raised to the yth power. Analytically,
- *
- * x**y = exp( y log(x) ).
- *
- * Following Cody and Waite, this program uses a lookup table
- * of 2**-i/32 and pseudo extended precision arithmetic to
- * obtain several extra bits of accuracy in both the logarithm
- * and the exponential.
- *
- *
- *
- * ACCURACY:
- *
- * The relative error of pow(x,y) can be estimated
- * by y dl ln(2), where dl is the absolute error of
- * the internally computed base 2 logarithm. At the ends
- * of the approximation interval the logarithm equal 1/32
- * and its relative error is about 1 lsb = 1.1e-19. Hence
- * the predicted relative error in the result is 2.3e-21 y .
- *
- * Relative error:
- * arithmetic domain # trials peak rms
- *
- * IEEE +-1000 40000 2.8e-18 3.7e-19
- * .001 < x < 1000, with log(x) uniformly distributed.
- * -1000 < y < 1000, y uniformly distributed.
- *
- * IEEE 0,8700 60000 6.5e-18 1.0e-18
- * 0.99 < x < 1.01, 0 < y < 8700, uniformly distributed.
- *
- *
- * ERROR MESSAGES:
- *
- * message condition value returned
- * pow overflow x**y > MAXNUM INFINITY
- * pow underflow x**y < 1/MAXNUM 0.0
- * pow domain x<0 and y noninteger 0.0
- *
- */
-
-/*
-Cephes Math Library Release 2.7: May, 1998
-Copyright 1984, 1991, 1998 by Stephen L. Moshier
-*/
-
-/*
-Modified for mingw
-2002-07-22 Danny Smith <dan...@us...>
-*/
-
-#ifdef __MINGW32__
-#include "cephes_mconf.h"
-#else
-#include "mconf.h"
-
-static char fname[] = {"powl"};
-#endif
-
-#ifndef _SET_ERRNO
-#define _SET_ERRNO(x)
-#endif
-
-
-/* Table size */
-#define NXT 32
-/* log2(Table size) */
-#define LNXT 5
-
-#ifdef UNK
-/* log(1+x) = x - .5x^2 + x^3 * P(z)/Q(z)
- * on the domain 2^(-1/32) - 1 <= x <= 2^(1/32) - 1
- */
-static long double P[] = {
- 8.3319510773868690346226E-4L,
- 4.9000050881978028599627E-1L,
- 1.7500123722550302671919E0L,
- 1.4000100839971580279335E0L,
-};
-static long double Q[] = {
-/* 1.0000000000000000000000E0L,*/
- 5.2500282295834889175431E0L,
- 8.4000598057587009834666E0L,
- 4.2000302519914740834728E0L,
-};
-/* A[i] = 2^(-i/32), rounded to IEEE long double precision.
- * If i is even, A[i] + B[i/2] gives additional accuracy.
- */
-static long double A[33] = {
- 1.0000000000000000000000E0L,
- 9.7857206208770013448287E-1L,
- 9.5760328069857364691013E-1L,
- 9.3708381705514995065011E-1L,
- 9.1700404320467123175367E-1L,
- 8.9735453750155359320742E-1L,
- 8.7812608018664974155474E-1L,
- 8.5930964906123895780165E-1L,
- 8.4089641525371454301892E-1L,
- 8.2287773907698242225554E-1L,
- 8.0524516597462715409607E-1L,
- 7.8799042255394324325455E-1L,
- 7.7110541270397041179298E-1L,
- 7.5458221379671136985669E-1L,
- 7.3841307296974965571198E-1L,
- 7.2259040348852331001267E-1L,
- 7.0710678118654752438189E-1L,
- 6.9195494098191597746178E-1L,
- 6.7712777346844636413344E-1L,
- 6.6261832157987064729696E-1L,
- 6.4841977732550483296079E-1L,
- 6.3452547859586661129850E-1L,
- 6.2092890603674202431705E-1L,
- 6.0762367999023443907803E-1L,
- 5.9460355750136053334378E-1L,
- 5.8186242938878875689693E-1L,
- 5.6939431737834582684856E-1L,
- 5.5719337129794626814472E-1L,
- 5.4525386633262882960438E-1L,
- 5.3357020033841180906486E-1L,
- 5.2213689121370692017331E-1L,
- 5.1094857432705833910408E-1L,
- 5.0000000000000000000000E-1L,
-};
-static long double B[17] = {
- 0.0000000000000000000000E0L,
- 2.6176170809902549338711E-20L,
--1.0126791927256478897086E-20L,
- 1.3438228172316276937655E-21L,
- 1.2207982955417546912101E-20L,
--6.3084814358060867200133E-21L,
- 1.3164426894366316434230E-20L,
--1.8527916071632873716786E-20L,
- 1.8950325588932570796551E-20L,
- 1.5564775779538780478155E-20L,
- 6.0859793637556860974380E-21L,
--2.0208749253662532228949E-20L,
- 1.4966292219224761844552E-20L,
- 3.3540909728056476875639E-21L,
--8.6987564101742849540743E-22L,
--1.2327176863327626135542E-20L,
- 0.0000000000000000000000E0L,
-};
-
-/* 2^x = 1 + x P(x),
- * on the interval -1/32 <= x <= 0
- */
-static long double R[] = {
- 1.5089970579127659901157E-5L,
- 1.5402715328927013076125E-4L,
- 1.3333556028915671091390E-3L,
- 9.6181291046036762031786E-3L,
- 5.5504108664798463044015E-2L,
- 2.4022650695910062854352E-1L,
- 6.9314718055994530931447E-1L,
-};
-
-#define douba(k) A[k]
-#define doubb(k) B[k]
-#define MEXP (NXT*16384.0L)
-/* The following if denormal numbers are supported, else -MEXP: */
-#ifdef DENORMAL
-#define MNEXP (-NXT*(16384.0L+64.0L))
-#else
-#define MNEXP (-NXT*16384.0L)
-#endif
-/* log2(e) - 1 */
-#define LOG2EA 0.44269504088896340735992L
-#endif
-
-
-#ifdef IBMPC
-static const uLD P[] = {
-{ { 0xb804,0xa8b7,0xc6f4,0xda6a,0x3ff4, XPD } },
-{ { 0x7de9,0xcf02,0x58c0,0xfae1,0x3ffd, XPD } },
-{ { 0x405a,0x3722,0x67c9,0xe000,0x3fff, XPD } },
-{ { 0xcd99,0x6b43,0x87ca,0xb333,0x3fff, XPD } }
-};
-static const uLD Q[] = {
-{ { 0x6307,0xa469,0x3b33,0xa800,0x4001, XPD } },
-{ { 0xfec2,0x62d7,0xa51c,0x8666,0x4002, XPD } },
-{ { 0xda32,0xd072,0xa5d7,0x8666,0x4001, XPD } }
-};
-static const uLD A[] = {
-{ { 0x0000,0x0000,0x0000,0x8000,0x3fff, XPD } },
-{ { 0x033a,0x722a,0xb2db,0xfa83,0x3ffe, XPD } },
-{ { 0xcc2c,0x2486,0x7d15,0xf525,0x3ffe, XPD } },
-{ { 0xf5cb,0xdcda,0xb99b,0xefe4,0x3ffe, XPD } },
-{ { 0x392f,0xdd24,0xc6e7,0xeac0,0x3ffe, XPD } },
-{ { 0x48a8,0x7c83,0x06e7,0xe5b9,0x3ffe, XPD } },
-{ { 0xe111,0x2a94,0xdeec,0xe0cc,0x3ffe, XPD } },
-{ { 0x3755,0xdaf2,0xb797,0xdbfb,0x3ffe, XPD } },
-{ { 0x6af4,0xd69d,0xfcca,0xd744,0x3ffe, XPD } },
-{ { 0xe45a,0xf12a,0x1d91,0xd2a8,0x3ffe, XPD } },
-{ { 0x80e4,0x1f84,0x8c15,0xce24,0x3ffe, XPD } },
-{ { 0x27a3,0x6e2f,0xbd86,0xc9b9,0x3ffe, XPD } },
-{ { 0xdadd,0x5506,0x2a11,0xc567,0x3ffe, XPD } },
-{ { 0x9456,0x6670,0x4cca,0xc12c,0x3ffe, XPD } },
-{ { 0x36bf,0x580c,0xa39f,0xbd08,0x3ffe, XPD } },
-{ { 0x9ee9,0x62fb,0xaf47,0xb8fb,0x3ffe, XPD } },
-{ { 0x6484,0xf9de,0xf333,0xb504,0x3ffe, XPD } },
-{ { 0x2590,0xd2ac,0xf581,0xb123,0x3ffe, XPD } },
-{ { 0x4ac6,0x42a1,0x3eea,0xad58,0x3ffe, XPD } },
-{ { 0x0ef8,0xea7c,0x5ab4,0xa9a1,0x3ffe, XPD } },
-{ { 0x38ea,0xb151,0xd6a9,0xa5fe,0x3ffe, XPD } },
-{ { 0x6819,0x0c49,0x4303,0xa270,0x3ffe, XPD } },
-{ { 0x11ae,0x91a1,0x3260,0x9ef5,0x3ffe, XPD } },
-{ { 0x5539,0xd54e,0x39b9,0x9b8d,0x3ffe, XPD } },
-{ { 0xa96f,0x8db8,0xf051,0x9837,0x3ffe, XPD } },
-{ { 0x0961,0xfef7,0xefa8,0x94f4,0x3ffe, XPD } },
-{ { 0xc336,0xab11,0xd373,0x91c3,0x3ffe, XPD } },
-{ { 0x53c0,0x45cd,0x398b,0x8ea4,0x3ffe, XPD } },
-{ { 0xd6e7,0xea8b,0xc1e3,0x8b95,0x3ffe, XPD } },
-{ { 0x8527,0x92da,0x0e80,0x8898,0x3ffe, XPD } },
-{ { 0x7b15,0xcc48,0xc367,0x85aa,0x3ffe, XPD } },
-{ { 0xa1d7,0xac2b,0x8698,0x82cd,0x3ffe, XPD } },
-{ { 0x0000,0x0000,0x0000,0x8000,0x3ffe, XPD } }
-};
-static const uLD B[] = {
-{ { 0x0000,0x0000,0x0000,0x0000,0x0000, XPD } },
-{ { 0x1f87,0xdb30,0x18f5,0xf73a,0x3fbd, XPD } },
-{ { 0xac15,0x3e46,0x2932,0xbf4a,0xbfbc, XPD } },
-{ { 0x7944,0xba66,0xa091,0xcb12,0x3fb9, XPD } },
-{ { 0xff78,0x40b4,0x2ee6,0xe69a,0x3fbc, XPD } },
-{ { 0xc895,0x5069,0xe383,0xee53,0xbfbb, XPD } },
-{ { 0x7cde,0x9376,0x4325,0xf8ab,0x3fbc, XPD } },
-{ { 0xa10c,0x25e0,0xc093,0xaefd,0xbfbd, XPD } },
-{ { 0x7d3e,0xea95,0x1366,0xb2fb,0x3fbd, XPD } },
-{ { 0x5d89,0xeb34,0x5191,0x9301,0x3fbd, XPD } },
-{ { 0x80d9,0xb883,0xfb10,0xe5eb,0x3fbb, XPD } },
-{ { 0x045d,0x288c,0xc1ec,0xbedd,0xbfbd, XPD } },
-{ { 0xeded,0x5c85,0x4630,0x8d5a,0x3fbd, XPD } },
-{ { 0x9d82,0xe5ac,0x8e0a,0xfd6d,0x3fba, XPD } },
-{ { 0x6dfd,0xeb58,0xaf14,0x8373,0xbfb9, XPD } },
-{ { 0xf938,0x7aac,0x91cf,0xe8da,0xbfbc, XPD } },
-{ { 0x0000,0x0000,0x0000,0x0000,0x0000, XPD } }
-};
-static const uLD R[] = {
-{ { 0xa69b,0x530e,0xee1d,0xfd2a,0x3fee, XPD } },
-{ { 0xc746,0x8e7e,0x5960,0xa182,0x3ff2, XPD } },
-{ { 0x63b6,0xadda,0xfd6a,0xaec3,0x3ff5, XPD } },
-{ { 0xc104,0xfd99,0x5b7c,0x9d95,0x3ff8, XPD } },
-{ { 0xe05e,0x249d,0x46b8,0xe358,0x3ffa, XPD } },
-{ { 0x5d1d,0x162c,0xeffc,0xf5fd,0x3ffc, XPD } },
-{ { 0x79aa,0xd1cf,0x17f7,0xb172,0x3ffe, XPD } }
-};
-
-/* 10 byte sizes versus 12 byte */
-#define douba(k) (A[(k)].ld)
-#define doubb(k) (B[(k)].ld)
-#define MEXP (NXT*16384.0L)
-#ifdef DENORMAL
-#define MNEXP (-NXT*(16384.0L+64.0L))
-#else
-#define MNEXP (-NXT*16384.0L)
-#endif
-static const
-union
-{
- unsigned short L[6];
- long double ld;
-} log2ea = {{0xc2ef,0x705f,0xeca5,0xe2a8,0x3ffd, XPD}};
-
-#define LOG2EA (log2ea.ld)
-/*
-#define LOG2EA 0.44269504088896340735992L
-*/
-#endif
-
-#ifdef MIEEE
-static long P[] = {
-0x3ff40000,0xda6ac6f4,0xa8b7b804,
-0x3ffd0000,0xfae158c0,0xcf027de9,
-0x3fff0000,0xe00067c9,0x3722405a,
-0x3fff0000,0xb33387ca,0x6b43cd99,
-};
-static long Q[] = {
-/* 0x3fff0000,0x80000000,0x00000000, */
-0x40010000,0xa8003b33,0xa4696307,
-0x40020000,0x8666a51c,0x62d7fec2,
-0x40010000,0x8666a5d7,0xd072da32,
-};
-static long A[] = {
-0x3fff0000,0x80000000,0x00000000,
-0x3ffe0000,0xfa83b2db,0x722a033a,
-0x3ffe0000,0xf5257d15,0x2486cc2c,
-0x3ffe0000,0xefe4b99b,0xdcdaf5cb,
-0x3ffe0000,0xeac0c6e7,0xdd24392f,
-0x3ffe0000,0xe5b906e7,0x7c8348a8,
-0x3ffe0000,0xe0ccdeec,0x2a94e111,
-0x3ffe0000,0xdbfbb797,0xdaf23755,
-0x3ffe0000,0xd744fcca,0xd69d6af4,
-0x3ffe0000,0xd2a81d91,0xf12ae45a,
-0x3ffe0000,0xce248c15,0x1f8480e4,
-0x3ffe0000,0xc9b9bd86,0x6e2f27a3,
-0x3ffe0000,0xc5672a11,0x5506dadd,
-0x3ffe0000,0xc12c4cca,0x66709456,
-0x3ffe0000,0xbd08a39f,0x580c36bf,
-0x3ffe0000,0xb8fbaf47,0x62fb9ee9,
-0x3ffe0000,0xb504f333,0xf9de6484,
-0x3ffe0000,0xb123f581,0xd2ac2590,
-0x3ffe0000,0xad583eea,0x42a14ac6,
-0x3ffe0000,0xa9a15ab4,0xea7c0ef8,
-0x3ffe0000,0xa5fed6a9,0xb15138ea,
-0x3ffe0000,0xa2704303,0x0c496819,
-0x3ffe0000,0x9ef53260,0x91a111ae,
-0x3ffe0000,0x9b8d39b9,0xd54e5539,
-0x3ffe0000,0x9837f051,0x8db8a96f,
-0x3ffe0000,0x94f4efa8,0xfef70961,
-0x3ffe0000,0x91c3d373,0xab11c336,
-0x3ffe0000,0x8ea4398b,0x45cd53c0,
-0x3ffe0000,0x8b95c1e3,0xea8bd6e7,
-0x3ffe0000,0x88980e80,0x92da8527,
-0x3ffe0000,0x85aac367,0xcc487b15,
-0x3ffe0000,0x82cd8698,0xac2ba1d7,
-0x3ffe0000,0x80000000,0x00000000,
-};
-static long B[51] = {
-0x00000000,0x00000000,0x00000000,
-0x3fbd0000,0xf73a18f5,0xdb301f87,
-0xbfbc0000,0xbf4a2932,0x3e46ac15,
-0x3fb90000,0xcb12a091,0xba667944,
-0x3fbc0000,0xe69a2ee6,0x40b4ff78,
-0xbfbb0000,0xee53e383,0x5069c895,
-0x3fbc0000,0xf8ab4325,0x93767cde,
-0xbfbd0000,0xaefdc093,0x25e0a10c,
-0x3fbd0000,0xb2fb1366,0xea957d3e,
-0x3fbd0000,0x93015191,0xeb345d89,
-0x3fbb0000,0xe5ebfb10,0xb88380d9,
-0xbfbd0000,0xbeddc1ec,0x288c045d,
-0x3fbd0000,0x8d5a4630,0x5c85eded,
-0x3fba0000,0xfd6d8e0a,0xe5ac9d82,
-0xbfb90000,0x8373af14,0xeb586dfd,
-0xbfbc0000,0xe8da91cf,0x7aacf938,
-0x00000000,0x00000000,0x00000000,
-};
-static long R[] = {
-0x3fee0000,0xfd2aee1d,0x530ea69b,
-0x3ff20000,0xa1825960,0x8e7ec746,
-0x3ff50000,0xaec3fd6a,0xadda63b6,
-0x3ff80000,0x9d955b7c,0xfd99c104,
-0x3ffa0000,0xe35846b8,0x249de05e,
-0x3ffc0000,0xf5fdeffc,0x162c5d1d,
-0x3ffe0000,0xb17217f7,0xd1cf79aa,
-};
-
-#define douba(k) (*(long double *)&A[3*(k)])
-#define doubb(k) (*(long double *)&B[3*(k)])
-#define MEXP (NXT*16384.0L)
-#ifdef DENORMAL
-#define MNEXP (-NXT*(16384.0L+64.0L))
-#else
-#define MNEXP (-NXT*16382.0L)
-#endif
-static long L[3] = {0x3ffd0000,0xe2a8eca5,0x705fc2ef};
-#define LOG2EA (*(long double *)(&L[0]))
-#endif
-
-
-#define F W
-#define Fa Wa
-#define Fb Wb
-#define G W
-#define Ga Wa
-#define Gb u
-#define H W
-#define Ha Wb
-#define Hb Wb
-
-#ifndef __MINGW32__
-extern long double MAXNUML;
-#endif
-
-static VOLATILE long double z;
-static long double w, W, Wa, Wb, ya, yb, u;
-
-#ifdef __MINGW32__
-static __inline__ long double reducl( long double );
-extern long double __powil ( long double, int );
-extern long double powl ( long double x, long double y);
-#else
-#ifdef ANSIPROT
-extern long double floorl ( long double );
-extern long double fabsl ( long double );
-extern long double frexpl ( long double, int * );
-extern long double ldexpl ( long double, int );
-extern long double polevll ( long double, void *, int );
-extern long double p1evll ( long double, void *, int );
-extern long double __powil ( long double, int );
-extern int isnanl ( long double );
-extern int isfinitel ( long double );
-static long double reducl( long double );
-extern int signbitl ( long double );
-#else
-long double floorl(), fabsl(), frexpl(), ldexpl();
-long double polevll(), p1evll(), __powil();
-static long double reducl();
-int isnanl(), isfinitel(), signbitl();
-#endif /* __MINGW32__ */
-
-#ifdef INFINITIES
-extern long double INFINITYL;
-#else
-#define INFINITYL MAXNUML
-#endif
-
-#ifdef NANS
-extern long double NANL;
-#endif
-#ifdef MINUSZERO
-extern long double NEGZEROL;
-#endif
-
-#endif /* __MINGW32__ */
-
-#ifdef __MINGW32__
-
-/* No error checking. We handle Infs and zeros ourselves. */
-static __inline__ long double
-__fast_ldexpl (long double x, int expn)
-{
- long double res;
- __asm__ ("fscale"
- : "=t" (res)
- : "0" (x), "u" ((long double) expn));
- return res;
-}
-
-#define ldexpl __fast_ldexpl
-
-#endif
-
-
-long double powl( long double x, long double y )
-{
- /* double F, Fa, Fb, G, Ga, Gb, H, Ha, Hb */
- int i, nflg, iyflg, yoddint;
- long e;
-
- if( y == 0.0L )
- return( 1.0L );
-
-#ifdef NANS
- if( isnanl(x) )
- {
- _SET_ERRNO (EDOM);
- return( x );
- }
- if( isnanl(y) )
- {
- _SET_ERRNO (EDOM);
- return( y );
- }
-#endif
-
- if( y == 1.0L )
- return( x );
-
- if( isinfl(y) && (x == -1.0L || x == 1.0L) )
- return( y );
-
- if( x == 1.0L )
- return( 1.0L );
-
- if( y >= MAXNUML )
- {
- _SET_ERRNO (ERANGE);
-#ifdef INFINITIES
- if( x > 1.0L )
- return( INFINITYL );
-#else
- if( x > 1.0L )
- return( MAXNUML );
-#endif
- if( x > 0.0L && x < 1.0L )
- return( 0.0L );
-#ifdef INFINITIES
- if( x < -1.0L )
- return( INFINITYL );
-#else
- if( x < -1.0L )
- return( MAXNUML );
-#endif
- if( x > -1.0L && x < 0.0L )
- return( 0.0L );
- }
- if( y <= -MAXNUML )
- {
- _SET_ERRNO (ERANGE);
- if( x > 1.0L )
- return( 0.0L );
-#ifdef INFINITIES
- if( x > 0.0L && x < 1.0L )
- return( INFINITYL );
-#else
- if( x > 0.0L && x < 1.0L )
- return( MAXNUML );
-#endif
- if( x < -1.0L )
- return( 0.0L );
-#ifdef INFINITIES
- if( x > -1.0L && x < 0.0L )
- return( INFINITYL );
-#else
- if( x > -1.0L && x < 0.0L )
- return( MAXNUML );
-#endif
- }
- if( x >= MAXNUML )
- {
-#if INFINITIES
- if( y > 0.0L )
- return( INFINITYL );
-#else
- if( y > 0.0L )
- return( MAXNUML );
-#endif
- return( 0.0L );
- }
-
- w = floorl(y);
- /* Set iyflg to 1 if y is an integer. */
- iyflg = 0;
- if( w == y )
- iyflg = 1;
-
- /* Test for odd integer y. */
- yoddint = 0;
- if( iyflg )
- {
- ya = fabsl(y);
- ya = floorl(0.5L * ya);
- yb = 0.5L * fabsl(w);
- if( ya != yb )
- yoddint = 1;
- }
-
- if( x <= -MAXNUML )
- {
- if( y > 0.0L )
- {
-#ifdef INFINITIES
- if( yoddint )
- return( -INFINITYL );
- return( INFINITYL );
-#else
- if( yoddint )
- return( -MAXNUML );
- return( MAXNUML );
-#endif
- }
- if( y < 0.0L )
- {
-#ifdef MINUSZERO
- if( yoddint )
- return( NEGZEROL );
-#endif
- return( 0.0 );
- }
- }
-
-
- nflg = 0; /* flag = 1 if x<0 raised to integer power */
- if( x <= 0.0L )
- {
- if( x == 0.0L )
- {
- if( y < 0.0 )
- {
-#ifdef MINUSZERO
- if( signbitl(x) && yoddint )
- return( -INFINITYL );
-#endif
-#ifdef INFINITIES
- return( INFINITYL );
-#else
- return( MAXNUML );
-#endif
- }
- if( y > 0.0 )
- {
-#ifdef MINUSZERO
- if( signbitl(x) && yoddint )
- return( NEGZEROL );
-#endif
- return( 0.0 );
- }
- if( y == 0.0L )
- return( 1.0L ); /* 0**0 */
- else
- return( 0.0L ); /* 0**y */
- }
- else
- {
- if( iyflg == 0 )
- { /* noninteger power of negative number */
- mtherr( fname, DOMAIN );
- _SET_ERRNO (EDOM);
-#ifdef NANS
- return(NANL);
-#else
- return(0.0L);
-#endif
- }
- nflg = 1;
- }
- }
-
- /* Integer power of an integer. */
-
- if( iyflg )
- {
- i = w;
- w = floorl(x);
- if( (w == x) && (fabsl(y) < 32768.0) )
- {
- w = __powil( x, (int) y );
- return( w );
- }
- }
-
-
- if( nflg )
- x = fabsl(x);
-
- /* separate significand from exponent */
- x = frexpl( x, &i );
- e = i;
-
- /* find significand in antilog table A[] */
- i = 1;
- if( x <= douba(17) )
- i = 17;
- if( x <= douba(i+8) )
- i += 8;
- if( x <= douba(i+4) )
- i += 4;
- if( x <= douba(i+2) )
- i += 2;
- if( x >= douba(1) )
- i = -1;
- i += 1;
-
-
- /* Find (x - A[i])/A[i]
- * in order to compute log(x/A[i]):
- *
- * log(x) = log( a x/a ) = log(a) + log(x/a)
- *
- * log(x/a) = log(1+v), v = x/a - 1 = (x-a)/a
- */
- x -= douba(i);
- x -= doubb(i/2);
- x /= douba(i);
-
-
- /* rational approximation for log(1+v):
- *
- * log(1+v) = v - v**2/2 + v**3 P(v) / Q(v)
- */
- z = x*x;
- w = x * ( z * polevll( x, P, 3 ) / p1evll( x, Q, 3 ) );
- w = w - ldexpl( z, -1 ); /* w - 0.5 * z */
-
- /* Convert to base 2 logarithm:
- * multiply by log2(e) = 1 + LOG2EA
- */
- z = LOG2EA * w;
- z += w;
- z += LOG2EA * x;
- z += x;
-
- /* Compute exponent term of the base 2 logarithm. */
- w = -i;
- w = ldexpl( w, -LNXT ); /* divide by NXT */
- w += e;
- /* Now base 2 log of x is w + z. */
-
- /* Multiply base 2 log by y, in extended precision. */
-
- /* separate y into large part ya
- * and small part yb less than 1/NXT
- */
- ya = reducl(y);
- yb = y - ya;
-
- /* (w+z)(ya+yb)
- * = w*ya + w*yb + z*y
- */
- F = z * y + w * yb;
- Fa = reducl(F);
- Fb = F - Fa;
-
- G = Fa + w * ya;
- Ga = reducl(G);
- Gb = G - Ga;
-
- H = Fb + Gb;
- Ha = reducl(H);
- w = ldexpl( Ga + Ha, LNXT );
-
- /* Test the power of 2 for overflow */
- if( w > MEXP )
- {
- _SET_ERRNO (ERANGE);
- mtherr( fname, OVERFLOW );
- return( INFINITYL );
- }
-
- if( w < MNEXP )
- {
- _SET_ERRNO (ERANGE);
- mtherr( fname, UNDERFLOW );
- return( 0.0L );
- }
-
- e = w;
- Hb = H - Ha;
-
- if( Hb > 0.0L )
- {
- e += 1;
- Hb -= (1.0L/NXT); /*0.0625L;*/
- }
-
- /* Now the product y * log2(x) = Hb + e/NXT.
- *
- * Compute base 2 exponential of Hb,
- * where -0.0625 <= Hb <= 0.
- */
- z = Hb * polevll( Hb, R, 6 ); /* z = 2**Hb - 1 */
-
- /* Express e/NXT as an integer plus a negative number of (1/NXT)ths.
- * Find lookup table entry for the fractional power of 2.
- */
- if( e < 0 )
- i = 0;
- else
- i = 1;
- i = e/NXT + i;
- e = NXT*i - e;
- w = douba( e );
- z = w * z; /* 2**-e * ( 1 + (2**Hb-1) ) */
- z = z + w;
- z = ldexpl( z, i ); /* multiply by integer power of 2 */
-
- if( nflg )
- {
- /* For negative x,
- * find out if the integer exponent
- * is odd or even.
- */
- w = ldexpl( y, -1 );
- w = floorl(w);
- w = ldexpl( w, 1 );
- if( w != y )
- z = -z; /* odd exponent */
- }
-
- return( z );
-}
-
-static __inline__ long double
-__convert_inf_to_maxnum(long double x)
-{
- if (isinf(x))
- return (x > 0.0L ? MAXNUML : -MAXNUML);
- else
- return x;
-}
-
-
-/* Find a multiple of 1/NXT that is within 1/NXT of x. */
-static __inline__ long double reducl( long double x )
-{
- long double t;
-
- /* If the call to ldexpl overflows, set it to MAXNUML.
- * This avoids Inf - Inf = Nan result when calculating the 'small'
- * part of a reduction. Instead, the small part becomes Inf,
- * causing under/overflow when adding it to the 'large' part.
- * There must be a cleaner way of doing this.
- */
- t = __convert_inf_to_maxnum (ldexpl( x, LNXT ));
- t = floorl( t );
- t = ldexpl( t, -LNXT );
- return(t);
-}
-----------------------------------------------------------------------
Summary of changes:
mingwrt/ChangeLog | 14 +
mingwrt/Makefile.in | 2 +-
mingwrt/include/math.h | 4 -
mingwrt/mingwex/math/pow_generic.sx | 423 ++++++++++++++++++
mingwrt/mingwex/math/powf.c | 3 -
mingwrt/mingwex/math/powl.c | 803 -----------------------------------
6 files changed, 438 insertions(+), 811 deletions(-)
create mode 100644 mingwrt/mingwex/math/pow_generic.sx
delete mode 100644 mingwrt/mingwex/math/powf.c
delete mode 100644 mingwrt/mingwex/math/powl.c
hooks/post-receive
--
Repository: mingw-org-wsl
|
|
From: Keith M. <no...@so...> - 2016-11-18 14:47:39
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via 5b105e818576eea61eff243db85ce5fb7b5973aa (commit)
from dc40b1a95487de09173b7186eeb63b15ec17c145 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/5b105e818576eea61eff243db85ce5fb7b5973aa/
commit 5b105e818576eea61eff243db85ce5fb7b5973aa
Author: Keith Marshall <kei...@us...>
Date: Fri Nov 18 09:34:08 2016 +0000
Implement unit tests for power functions.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 2ae49ab..b5ea2ae 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,13 @@
+2016-11-18 Keith Marshall <kei...@us...>
+
+ Implement unit tests for power functions.
+
+ * tests/testsuite.at.in: m4_include...
+ * tests/Makefile.in (testsuite): ...and add dependency on...
+ * tests/powerfunc.at: ...this new file; it specifies unit tests to
+ check POSIX.1-2008 compliance of results and errno assignment from...
+ (pow, powf, powl): ...each of these functions.
+
2016-11-14 Keith Marshall <kei...@us...>
Add POSIX compliant errno assignments to log functions.
diff --git a/mingwrt/tests/Makefile.in b/mingwrt/tests/Makefile.in
index 9de9826..1a57f37 100644
--- a/mingwrt/tests/Makefile.in
+++ b/mingwrt/tests/Makefile.in
@@ -102,7 +102,7 @@ autotest_missing = $(call missing,autom4te,Unable to compile the testsuite)
testsuite: %: %.at
$(AUTOTEST_COMPILE) -o $* $<
-testsuite: headers.at ansiprintf.at logarithms.at
+testsuite: headers.at ansiprintf.at logarithms.at powerfunc.at
# Display a diagnostic message, explaining that any specified program
# is required, but has not been installed.
diff --git a/mingwrt/tests/powerfunc.at b/mingwrt/tests/powerfunc.at
new file mode 100644
index 0000000..e76cd51
--- /dev/null
+++ b/mingwrt/tests/powerfunc.at
@@ -0,0 +1,274 @@
+# powerfunc.at
+#
+# Autotest module to verify correct operation of the pow(), powf(),
+# and powl() functions; inspired by MinGW-Bug [#2306], and implemented
+# to evaluate each boundary condition specified by POSIX.1-2008.
+#
+# $Id$
+#
+# Written by Keith Marshall <kei...@us...>
+# Copyright (C) 2016, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+#
+# All tests specified herein are written in the C language.
+#
+MINGW_AT_LANG([C])
+
+# MINGW_AT_CHECK_RUN_POW( FUNCTION, X, Y, EXPOUT )
+# ------------------------------------------------
+# Set up the test case to evaluate FUNCTION, (one of pow, powf,
+# or powl), with X and Y as arguments; confirm the the resultant
+# output matches EXPOUT.
+#
+# Note: the M4 macros pow_datatype, pow_strtod, and pow_format
+# MUST have been defined, before this macro is expanded.
+#
+m4_define([MINGW_AT_CHECK_RUN_POW],[
+AT_SETUP([$1 (x = $2, y = $3)])
+AT_KEYWORDS([C $1])MINGW_AT_DATA_CRLF([expout],[[$4
+]])MINGW_AT_CHECK_RUN([[[
+#define _XOPEN_SOURCE 700
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <tgmath.h>
+#include <errno.h>
+
+#define EOK 0
+
+const char *errdesc( void )
+{ /* A minimal replacement for strerror(), so we keep strict
+ * control of the descriptions for those errors which any of
+ * the pow() functions may report.
+ */
+ static char desc[8] = "";
+ switch( errno )
+ { case EOK: return "ok";
+ case EDOM: return "domain error";
+ case ERANGE: return "range error";
+ default: snprintf( desc, sizeof( desc ), "%d", errno );
+ }
+ return desc;
+}
+
+int main()
+{ /* Convert the specified X and Y arguments to the appropriate
+ * data type, invoke the specified FUNCTION, report its result,
+ * and any error which may have occurred.
+ */
+ ]]pow_datatype[[ result, x = ]]pow_strtod($2)[[, y = ]]pow_strtod($3)[[;
+ errno = EOK; result = $1(x, y); printf("]]pow_format[[", result, errdesc());
+ return EOK;
+}]]],,[expout])dnl
+AT_CLEANUP
+])
+
+# MINGW_AT_CHECK_POW_FUNCTION( NAME )
+# -----------------------------------
+# Check the behaviour of function NAME, (one of pow, powf, or powl),
+# for a selection of values of X and Y; further comments, embedded
+# within this macro, specify POSIX.1-2008 mandatory outcomes.
+#
+m4_define([MINGW_AT_CHECK_POW_FUNCTION],[dnl
+AT_BANNER([Power function tests: ]pow_datatype[ data.])
+#
+# On successful completion, return x to the power y
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+2.0],[+2.5e+0],[+5.656854e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+1.2],[+2.5e+0],[+1.577441e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+0.3],[+2.5e+0],[+4.929503e-002 (ok)])
+#
+# For finite x < 0, and finite non-integral y, report "domain error",
+# and return "NaN"; (note that MinGW's printf(), as used to report the
+# result, always treats NaN as being unsigned, so we will always see
+# it reported as "+nan", irrespective of sign bit).
+#
+MINGW_AT_CHECK_RUN_POW([$1],[-2.0],[+2.5e+0],[+nan (domain error)])
+MINGW_AT_CHECK_RUN_POW([$1],[-2.0],[-2.5e+0],[+nan (domain error)])
+#
+# For finite x < 0, and finite integral y, no "domain error" arises;
+# the result is analytically computable as -1.0^y * 2^(y*log2(|x|)).
+#
+MINGW_AT_CHECK_RUN_POW([$1],[-2.5],[+2.0e+0],[+6.250000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-2.5],[+3.0e+0],[-1.562500e+001 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-1.5],[-2.0e+0],[+4.444444e-001 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-1.5],[-3.0e+0],[-2.962963e-001 (ok)])
+#
+# For non-zero result with no representation which is distinguishable
+# from zero, (i.e. underflow), report "range error" and return zero.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+0.2],[+2.5e+4],[+0.000000e+000 (range error)])
+#
+# When |x| == 0, and y < 0, report "range error", (indicating a pole
+# error), and return infinity with the sign of x if y is an odd valued
+# -ve integer value, or +ve infinity for any other -ve value of y.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+0.0],[-1.0e+0],[+inf (range error)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[-1.0e+0],[-inf (range error)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[-7.0e+0],[-inf (range error)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[-2.0e+0],[+inf (range error)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[-1.1e+0],[+inf (range error)])
+#
+# When x == +1.0, for any value of y (including NaN), return +1.0
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+1.0],[+2.5e+4],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+1.0],[+Inf], [+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+1.0],[+NaN], [+1.000000e+000 (ok)])
+#
+# for any value of x, (including infinity or NaN), when |y| is zero,
+# return +1.0
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+2.5],[+0.0e+0],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-2.5],[-0.0e+0],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+Inf],[+0.0e+0],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+Inf],[-0.0e+0],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[+0.0e+0],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[-0.0e+0],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+NaN],[+0.0e+0],[+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+NaN],[-0.0e+0],[+1.000000e+000 (ok)])
+#
+# Other than the preceding special cases, if either x or y is NaN,
+# return "NaN"; (POSIX specifies NO errno assignment).
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+NaN],[+2.5e+0],[+nan (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-NaN],[+2.5e+0],[+nan (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+2.5],[-NaN], [+nan (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-2.5],[+NaN], [+nan (ok)])
+#
+# For any odd integer value of y > 0, if |x| == 0, return signed
+# zero, with same sign as x, (i.e. value of x itself).
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+0.0],[+3.0e+0],[+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[+3.0e+0],[-0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+0.0],[+7.0e+0],[+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[+7.0e+0],[-0.000000e+000 (ok)])
+#
+# For any other y > 0, (i.e. +ve but not an odd integer), if |x| == 0,
+# return +0.0
+#
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[+2.5e+0],[+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.0],[+3.5e+4],[+0.000000e+000 (ok)])
+#
+# If x == -1, and y is +ve or -ve infinity, return +1.0
+#
+MINGW_AT_CHECK_RUN_POW([$1],[-1.0],[+Inf], [+1.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-1.0],[-Inf], [+1.000000e+000 (ok)])
+#
+# When |x| < 1, and y is infinite, return +ve infinity when y is -ve
+# infinity, or +0.0 when y is +ve infinity.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[-0.3],[-Inf], [+inf (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+0.7],[-Inf], [+inf (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+0.3],[+Inf], [+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-0.7],[+Inf], [+0.000000e+000 (ok)])
+#
+# When |x| > 1, and y is infinite, return +0.0 when y is -ve infinity,
+# or +ve infinity when y is +ve infinity.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+5.3],[-Inf], [+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-1.7],[-Inf], [+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-5.3],[+Inf], [+inf (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+1.7],[+Inf], [+inf (ok)])
+#
+# If x is -ve infinity, and y < 0, return -ve zero if y is an odd
+# valued -ve integer, otherwise return +ve zero.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[-3.0e+0],[-0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[-2.0e+0],[+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[-3.5e+0],[+0.000000e+000 (ok)])
+#
+# If x is -ve infinity, and y > 0, return -ve infinity if y is an odd
+# valued +ve integer, otherwise return +ve infinity.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[+3.0e+0],[-inf (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[+2.0e+0],[+inf (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[-Inf],[+3.5e+0],[+inf (ok)])
+#
+# If x is +ve infinity, and y < 0, return +ve zero.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+Inf],[-1.0e-4],[+0.000000e+000 (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+Inf],[-2.5e+4],[+0.000000e+000 (ok)])
+#
+# If x is +ve infinity, and y > 0, return +ve infinity.
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+Inf],[+1.0e-4],[+inf (ok)])
+MINGW_AT_CHECK_RUN_POW([$1],[+Inf],[+2.5e+4],[+inf (ok)])
+#
+# For result of magnitude greater than largest representable value,
+# (i.e. overflow), report "range error", and return infinity; (this
+# occurs at progressively lesser result boundaries, as we choose to
+# evaluate with decreasing precision, i.e. using powl(), pow(), or
+# powf(), respectively. Only the first in this progression should
+# pass without overflow in all three cases; the last will overflow
+# in all cases, but to keep it in order, we must define it after
+# each of those which behave differently in each case).
+#
+MINGW_AT_CHECK_RUN_POW([$1],[+2.0],[+2.5e+1],[+3.355443e+007 (ok)])
+])
+
+# Set up the test sequence for the pow() function.
+#
+m4_define([pow_datatype],[double])
+m4_define([pow_strtod],[[strtod("$1",NULL)]])
+m4_define([pow_format],[[%+.6e (%s)\n]])
+#
+MINGW_AT_CHECK_POW_FUNCTION([pow])
+#
+# Add the three variants on the final progression, the first two of
+# which differ in each specific pow(), powf(), and powl() case, and
+# the final one, which is consistent, but we wish to keep it last.
+#
+MINGW_AT_CHECK_RUN_POW([pow],[+2.0],[+2.5e+2],[+1.809251e+075 (ok)])
+MINGW_AT_CHECK_RUN_POW([pow],[+2.0],[+2.5e+3],[+inf (range error)])
+MINGW_AT_CHECK_RUN_POW([pow],[+2.0],[+2.5e+4],[+inf (range error)])
+
+# Repeat for the powf() function.
+#
+m4_define([pow_datatype],[float])
+m4_define([pow_strtod],[[strtof("$1",NULL)]])
+m4_define([pow_format],[[%+.6e (%s)\n]])
+#
+MINGW_AT_CHECK_POW_FUNCTION([powf])
+#
+# Once again, complete the progression of the final test case.
+#
+MINGW_AT_CHECK_RUN_POW([powf],[+2.0],[+2.5e+2],[+inf (range error)])
+MINGW_AT_CHECK_RUN_POW([powf],[+2.0],[+2.5e+3],[+inf (range error)])
+MINGW_AT_CHECK_RUN_POW([powf],[+2.0],[+2.5e+4],[+inf (range error)])
+
+# And finally, for the powl() function.
+#
+m4_define([pow_datatype],[long double])
+m4_define([pow_strtod],[[strtold("$1",NULL)]])
+m4_define([pow_format],[[%+.6Le (%s)\n]])
+#
+MINGW_AT_CHECK_POW_FUNCTION([powl])
+#
+# Once again, complete the progression of the final test case.
+#
+MINGW_AT_CHECK_RUN_POW([powl],[+2.0],[+2.5e+2],[+1.809251e+075 (ok)])
+MINGW_AT_CHECK_RUN_POW([powl],[+2.0],[+2.5e+3],[+3.758280e+752 (ok)])
+MINGW_AT_CHECK_RUN_POW([powl],[+2.0],[+2.5e+4],[+inf (range error)])
+
+# vim: filetype=config formatoptions=croql
+# $RCSfile$: end of file
diff --git a/mingwrt/tests/testsuite.at.in b/mingwrt/tests/testsuite.at.in
index 3252925..bfe660c 100644
--- a/mingwrt/tests/testsuite.at.in
+++ b/mingwrt/tests/testsuite.at.in
@@ -89,6 +89,7 @@ MINGW_AT_LANG([C])
m4_include([headers.at])
m4_include([ansiprintf.at])
m4_include([logarithms.at])
+m4_include([powerfunc.at])
# vim: filetype=config formatoptions=croql
# $RCSfile$: end of file
-----------------------------------------------------------------------
Summary of changes:
mingwrt/ChangeLog | 10 ++
mingwrt/tests/Makefile.in | 2 +-
mingwrt/tests/powerfunc.at | 274 +++++++++++++++++++++++++++++++++++++++++
mingwrt/tests/testsuite.at.in | 1 +
4 files changed, 286 insertions(+), 1 deletions(-)
create mode 100644 mingwrt/tests/powerfunc.at
hooks/post-receive
--
Repository: mingw-org-wsl
|
|
From: Keith M. <no...@so...> - 2016-11-15 20:54:23
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via dc40b1a95487de09173b7186eeb63b15ec17c145 (commit)
via 41931fd90880e5bcca47b828e460445f88a88469 (commit)
from 41dede5c0355d8b1365160399bda032b4a91cca7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/dc40b1a95487de09173b7186eeb63b15ec17c145/
commit dc40b1a95487de09173b7186eeb63b15ec17c145
Author: Keith Marshall <kei...@us...>
Date: Mon Nov 14 17:57:05 2016 +0000
Add POSIX compliant errno assignments to log functions.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index afd0b85..2ae49ab 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,44 @@
+2016-11-14 Keith Marshall <kei...@us...>
+
+ Add POSIX compliant errno assignments to log functions.
+
+ * include/errno.h: Make it assembly language compatible.
+ [__ASSEMBLER__]: Omit <_mingw.h>; do not declare prototype for...
+ (_errno): ...this accessor function; the declaration is syntactically
+ invalid, in assembly language code.
+
+ * mingwex/math/errno.sx: New file; when included by other assembly
+ language files, it provides bindings for assignement of any constant
+ defined in <errno.h> to the global errno variable, facilitated by...
+ (errno): ...this new GAS macro.
+
+ * mingwex/math/log_generic.sx: New file; it provides a generic back
+ end implementation for multiple logarithmic functions, accessed via...
+ (___x87log, ___x87log_chk): ...this pair of entry points, serving...
+ (log, logf, log): ...each of these primary functions; it replaces...
+ * mingwex/math/logf.s mingwex/math/logl.s: ...these; delete them.
+
+ * mingwex/math/log1p_generic.sx mingwex/math/log10_generic.sx
+ * mingwex/math/log2_generic.sx: New files; each acts as a wrapper for
+ log_generic.sx, providing the front end entry stubs for each of...
+ (log1p, log1pf, log1pl, log10, log10f, log10l, log2, log2f, log2l):
+ ...these functions; thus, they provide complete replacements for...
+ * mingwex/math/log1p.s mingwex/math/log1pf.s mingwex/math/log1pl.s
+ * mingwex/math/log10f.s mingwex/math/log10l.s mingwex/math/log2.s
+ * mingwex/math/log2f.s mingwex/math/log2l.s: ...these; delete them.
+
+ * mingwex/math/x87cvt_generic.sx: New file; it implements...
+ (___x87cvt, ___x87cvtf): ...this pair of return value conversion
+ routines, for conversion from the FPU's internal REAL10 data format,
+ to REAL8 and REAL4, for double and float functions respectively.
+
+ * Makefile.in (libmingwex.a): Add dependencies on...
+ (x87cvt.$OBJEXT), x87cvtf.$OBJEXT), x87log.$OBJEXT), x87logf.$OBJEXT):
+ ...these object modules; implement pattern rule to build them from...
+ (x87cvt_generic.sx, log_generic.sx): ...these generic sources; also
+ provide for building the respective log function entry stubs from
+ their respective generic sources.
+
2016-11-08 Keith Marshall <kei...@us...>
Implement unit tests for logarithmic functions.
diff --git a/mingwrt/Makefile.in b/mingwrt/Makefile.in
index f9cd502..bf5a702 100644
--- a/mingwrt/Makefile.in
+++ b/mingwrt/Makefile.in
@@ -178,6 +178,7 @@ INCLUDES = -nostdinc -I . -I ${top_srcdir}/include -I ${w32api_srcdir}/include \
-I ${top_srcdir} -I ${top_srcdir}/profile -iwithprefixbefore include
ALL_CFLAGS = $(CFLAGS) $(DEPFLAGS) $(INCLUDES) $(NTDDI_VERSION_SPEC)
+ALL_CPPFLAGS = $(CPPFLAGS) $(DEPFLAGS) $(INCLUDES) $(NTDDI_VERSION_SPEC)
# The general case, for compiling object files from C source,
# requires a small adjustment to the default implicit rule.
@@ -460,7 +461,8 @@ libmingwex.a: $(addsuffix .$(OBJEXT), cosf cosl acosf acosl sinf sinl asinf \
nearbyint nearbyintf nearbyintl nextafterf nextafterl nexttoward nexttowardf \
powf powl powi powif powil remainder remainderf remainderl remquo remquof \
remquol rint rintf rintl round roundf roundl scalbn scalbnf scalbnl signbit \
- signbitf signbitl sqrtf sqrtl tgamma tgammaf tgammal trunc truncf truncl)
+ signbitf signbitl sqrtf sqrtl tgamma tgammaf tgammal trunc truncf truncl \
+ x87cvt x87cvtf x87log x87log1p)
# Replacement I/O functions in libmingwex.a, providing better POSIX
# compatibility than their Microsoft equivalents.
@@ -521,6 +523,21 @@ $(addsuffix .$(OBJEXT), % %f %l): %_generic.c
$(addsuffix .$(OBJEXT), llround llroundf llroundl): %.$(OBJEXT): lround_generic.c
$(CC) -c -D FUNCTION=$* $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
+# Similarly, we may need to compile quux.o, quuxf.o, and quuxl.o
+# variants from a common quux_generic.sx assembly language file.
+#
+vpath %.sx ${mingwrt_srcdir}/mingwex/math
+$(addsuffix .$(OBJEXT), % %f %l): %_generic.sx
+ $(CC) -c -D_$*_source $(ALL_CPPFLAGS) $(ASFLAGS) -o $*.$(OBJEXT) $<
+ $(CC) -c -D_$*f_source $(ALL_CPPFLAGS) $(ASFLAGS) -o $*f.$(OBJEXT) $<
+ $(CC) -c -D_$*l_source $(ALL_CPPFLAGS) $(ASFLAGS) -o $*l.$(OBJEXT) $<
+
+# Several generically implemented functions also require separate
+# assembly of their generic back-end support routines.
+#
+x87%.$(OBJEXT): %_generic.sx
+ $(CC) -c $(ALL_CPPFLAGS) $(ASFLAGS) -o $@ $<
+
# Historically, MinGW.org's libm.a has been a dummy, delivering
# nothing of value; FIXME: IMO, this sucks; it should deliver the
# non-MSVCRT.DLL math functions, as noted above.
diff --git a/mingwrt/include/errno.h b/mingwrt/include/errno.h
index ad58267..8db04f3 100644
--- a/mingwrt/include/errno.h
+++ b/mingwrt/include/errno.h
@@ -32,9 +32,14 @@
#ifndef _ERRNO_H
#define _ERRNO_H
-/* All MinGW headers are expected to include <_mingw.h>
+/* All MinGW headers are expected to include <_mingw.h>; however...
+ */
+#ifndef __ASSEMBLER__
+/* ...the overhead of doing so is unwarranted, when <errno.h> has been
+ * included directly in preprocessed assembly language code.
*/
#include <_mingw.h>
+#endif
/* Error code numbers.
*
@@ -89,7 +94,11 @@
#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */
#define EILSEQ 42 /* Illegal byte sequence */
-#ifndef RC_INVOKED
+/* C language function prototype declarations are unnecessary, when
+ * compiling resource files, and they actually represent syntactically
+ * invalid statements, in preprocessed assembly language code.
+ */
+#if ! defined RC_INVOKED && ! defined __ASSEMBLER__
_BEGIN_C_DECLS
@@ -106,7 +115,7 @@ _CRTIMP int* __cdecl __MINGW_NOTHROW _errno(void);
_END_C_DECLS
-#endif /* ! RC_INVOKED */
+#endif /* ! RC_INVOKED && !__ASSEMBLY__ */
#if defined __PTW32_H && ! defined _PTW32_ERRNO_H
/* As a courtesy to users of pthreads-win32, ensure that the appropriate
diff --git a/mingwrt/mingwex/math/errno.sx b/mingwrt/mingwex/math/errno.sx
new file mode 100644
index 0000000..1e87892
--- /dev/null
+++ b/mingwrt/mingwex/math/errno.sx
@@ -0,0 +1,51 @@
+/*
+ * errno.sx
+ *
+ * Assembly language wrapper for <errno.h>, also providing macros
+ * for manipulation of the "errno" global variable from within any
+ * preprocessed assembly language source file.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+.globl __errno
+.def __errno; .scl 2; .type 32; .endef
+
+#ifdef __MINGW64__
+# define eax rax
+#endif
+
+.macro errno code
+/* Assign a specified error code to the global "errno" variable.
+ */
+ call __errno /* get address of "errno" variable */
+ movl $\code, (%eax) /* store specified "errno" value */
+.endm
+
+#include <errno.h> /* for symbolic error code definitions */
+
+/* vim: set autoindent filetype=asm formatoptions=croql: */
+/* $RCSfile$: end of file */
diff --git a/mingwrt/mingwex/math/log10_generic.sx b/mingwrt/mingwex/math/log10_generic.sx
new file mode 100644
index 0000000..829f036
--- /dev/null
+++ b/mingwrt/mingwex/math/log10_generic.sx
@@ -0,0 +1,78 @@
+/*
+ * log10_generic.sx
+ *
+ * Generic wrapper for implementation entry stubs for each of the log10(),
+ * log10l(), and log10f() functions.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ * Adapted from original code written by J. T. Conklin <jt...@ne...>,
+ * with modifications by Ulrich Drepper <dr...@cy...>, to improve
+ * accuracy in the computation of log10(x) as x --> 1.0. This wrapper
+ * provides only definitions for derivation of the implementations by
+ * inclusion of the log_generic.sx source file.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#undef ___function
+
+/* Each of the log10(), log10f(), and log10l() functions returns a common
+ * (base-10) logarithm; this may be computed directly, using either the FYL2X,
+ * or the FYL2X1P instruction, by setting the scaling factor (y) to the common
+ * logarithm of two.
+ */
+#define __fldy fldlg2
+
+/* The first step is to identify the primary entry point name, and associated
+ * back-end names, for each of the three supported functions, (each of which
+ * to be assembled separately, using a GCC command of the form:
+ *
+ * gcc -c -D_<function>_source log10_generic.sx -o <function>.o
+ *
+ * to create the three entry stubs, with appropriate mappings to the back-end
+ * implementation provided by log_generic.sx
+ */
+#if defined _log10_source
+# define ___function _log10 /* log10() function entry point name */
+# define ___x87cvt ___x87cvt /* return value conversion helper */
+# define __fldx fldl /* FLD instruction to load x value */
+
+#elif defined _log10l_source
+# define ___function _log10l /* log10l() function entry point name */
+# define __fldx fldt /* FLD instruction to load x value */
+
+#elif defined _log10f_source
+# define ___function _log10f /* log10f() function entry point name */
+# define ___x87cvt ___x87cvtf /* return value conversion helper */
+# define __fldx flds /* FLD instruction to load x value */
+#endif
+
+/* Actual implementation of the entry point stubs, in terms of the preceding
+ * definitions, is delegated to the log_generic.sx source file.
+ */
+#include "log_generic.sx"
+
+/* vim: set autoindent filetype=asm formatoptions=croql: */
+/* $RCSfile$: end of file */
diff --git a/mingwrt/mingwex/math/log10f.s b/mingwrt/mingwex/math/log10f.s
deleted file mode 100644
index c36297a..0000000
--- a/mingwrt/mingwex/math/log10f.s
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Public domain.
- * Adapted for float type by Ulrich Drepper <dr...@cy...>.
- *
- * Changed to use fyl2xp1 for values near 1, <dr...@cy...>.
- */
-
- .file "log10f.s"
- .text
- .align 4
-one: .double 1.0
- /* It is not important that this constant is precise. It is only
- a value which is known to be on the safe side for using the
- fyl2xp1 instruction. */
-limit: .double 0.29
-
- .text
- .align 4
-.globl _log10f
- .def _log10f; .scl 2; .type 32; .endef
-_log10f:
- fldlg2 /* log10(2) */
- flds 4(%esp) /* x : log10(2) */
- fxam
- fnstsw
- fld %st /* x : x : log10(2) */
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-4: fsubl one /* x-1 : x : log10(2) */
- fld %st /* x-1 : x-1 : x : log10(2) */
- fabs /* |x-1| : x-1 : x : log10(2) */
- fcompl limit /* x-1 : x : log10(2) */
- fnstsw /* x-1 : x : log10(2) */
- andb $0x45, %ah
- jz 2f
- fstp %st(1) /* x-1 : log10(2) */
- fyl2xp1 /* log10(x) */
- ret
-
-2: fstp %st(0) /* x : log10(2) */
- fyl2x /* log10(x) */
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log10l.s b/mingwrt/mingwex/math/log10l.s
deleted file mode 100644
index cc99e1c..0000000
--- a/mingwrt/mingwex/math/log10l.s
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <dr...@cy...>.
- *
- * Changed to use fyl2xp1 for values near 1, <dr...@cy...>.
- *
- * Removed header file dependency for use in libmingwex.a by
- * Danny Smith <dan...@us...>
- */
-
- .file "log10l.s"
- .text
- .align 4
-one: .double 1.0
- /* It is not important that this constant is precise. It is only
- a value which is known to be on the safe side for using the
- fyl2xp1 instruction. */
-limit: .double 0.29
-
- .text
- .align 4
-.globl _log10l
- .def _log10l; .scl 2; .type 32; .endef
-_log10l:
- fldlg2 /* log10(2) */
- fldt 4(%esp) /* x : log10(2) */
- fxam
- fnstsw
- fld %st /* x : x : log10(2) */
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-4: fsubl one /* x-1 : x : log10(2) */
- fld %st /* x-1 : x-1 : x : log10(2) */
- fabs /* |x-1| : x-1 : x : log10(2) */
- fcompl limit /* x-1 : x : log10(2) */
- fnstsw /* x-1 : x : log10(2) */
- andb $0x45, %ah
- jz 2f
- fstp %st(1) /* x-1 : log10(2) */
- fyl2xp1 /* log10(x) */
- ret
-
-2: fstp %st(0) /* x : log10(2) */
- fyl2x /* log10(x) */
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log1p.s b/mingwrt/mingwex/math/log1p.s
deleted file mode 100644
index ff795d4..0000000
--- a/mingwrt/mingwex/math/log1p.s
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Public domain.
- * Removed header file dependency for use in libmingwex.a by
- * Danny Smith <dan...@us...>
- */
-
- .file "log1p.s"
- .text
- .align 4
- /* The fyl2xp1 can only be used for values in
- -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
- 0.29 is a safe value.
- */
-limit: .double 0.29
-one: .double 1.0
-/*
- * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
- * otherwise fyl2x with the needed extra computation.
- */
-.globl _log1p;
- .def _log1p; .scl 2; .type 32; .endef
-_log1p:
- fldln2
- fldl 4(%esp)
- fxam
- fnstsw
- fld %st
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-
-4: fabs
- fcompl limit
- fnstsw
- sahf
- jc 2f
- faddl one
- fyl2x
- ret
-
-2: fyl2xp1
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log1p_generic.sx b/mingwrt/mingwex/math/log1p_generic.sx
new file mode 100644
index 0000000..e03c76d
--- /dev/null
+++ b/mingwrt/mingwex/math/log1p_generic.sx
@@ -0,0 +1,86 @@
+/*
+ * log1p_generic.sx
+ *
+ * Generic wrapper for implementation entry stubs for each of the log1p(),
+ * log1pl(), and log1pf() functions.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ * Adapted from original code written by J. T. Conklin <jt...@ne...>,
+ * with modifications by Ulrich Drepper <dr...@cy...>, to improve
+ * accuracy in the computation of log1p(x) as x --> 0.0. This wrapper
+ * provides only definitions for derivation of the implementations by
+ * inclusion of the log_generic.sx source file.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#undef ___function
+
+/* Each of the log1p(), log1pf(), and log1pl() functions returns a natural
+ * logarithm; this may be computed directly, using either the FYL2X, or the
+ * FYL2X1P instruction, by setting the scaling factor (y) to the natural
+ * logarithm of two.
+ */
+#define __fldy fldln2
+
+/* The first step is to identify the primary entry point name, and associated
+ * back-end names, for each of the three supported functions, (each of which is
+ * to be assembled separately, using a GCC command of the form:
+ *
+ * gcc -c -D_<function>_source log1p_generic.sx -o <function>.o
+ *
+ * to create the three entry stubs, with appropriate mappings to the back-end
+ * implementation provided by log_generic.sx
+ */
+#if defined _log1p_source
+# define ___function _log1p /* log1p() function entry point name */
+# define ___x87cvt ___x87cvt /* return value conversion helper */
+# define __fldx fldl /* FLD instruction to load x value */
+
+#elif defined _log1pl_source
+# define ___function _log1pl /* log1pl() function entry point name */
+# define __fldx fldt /* FLD instruction to load x value */
+
+#elif defined _log1pf_source
+# define ___function _log1pf /* log1pf() function entry point name */
+# define ___x87cvt ___x87cvtf /* return value conversion helper */
+# define __fldx flds /* FLD instruction to load x value */
+#endif
+
+/* Each of the log1p(), log1pf(), and log1pl() functions shares a common
+ * back-end implementation, which is distinct from the log_generic.sx default;
+ * redirect it accordingly.
+ */
+#define ___x87log ___x87log1p /* redirected back-end implementation */
+#define ___x87log_chk ___x87log1p_chk /* input value validation helper */
+
+/* Actual implementation of the entry point stubs, and corresponding back-end
+ * implementation in terms of the preceding definitions, is delegated to the
+ * log_generic.sx source file.
+ */
+#include "log_generic.sx"
+
+/* vim: set autoindent filetype=asm formatoptions=croql: */
+/* $RCSfile$: end of file */
diff --git a/mingwrt/mingwex/math/log1pf.s b/mingwrt/mingwex/math/log1pf.s
deleted file mode 100644
index 17aee6e..0000000
--- a/mingwrt/mingwex/math/log1pf.s
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Public domain.
- * Removed header file dependency for use in libmingwex.a by
- * Danny Smith <dan...@us...>
- */
-
- .file "log1pf.s"
- .text
- .align 4
- /* The fyl2xp1 can only be used for values in
- -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
- 0.29 is a safe value.
- */
-limit: .float 0.29
-one: .float 1.0
-/*
- * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
- * otherwise fyl2x with the needed extra computation.
- */
-.globl _log1pf;
- .def _log1pf; .scl 2; .type 32; .endef
-_log1pf:
- fldln2
- flds 4(%esp)
- fxam
- fnstsw
- fld %st
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-
-4: fabs
- fcomps limit
- fnstsw
- sahf
- jc 2f
- fadds one
- fyl2x
- ret
-
-2: fyl2xp1
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log1pl.s b/mingwrt/mingwex/math/log1pl.s
deleted file mode 100644
index 65e1d0a..0000000
--- a/mingwrt/mingwex/math/log1pl.s
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <dr...@cy...>.
-* Removed header file dependency for use in libmingwex.a by
- * Danny Smith <dan...@us...>
- */
-
- .file "log1pl.s"
- .text
- .align 4
- /* The fyl2xp1 can only be used for values in
- -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
- 0.29 is a safe value.
- */
-limit: .tfloat 0.29
- /* Please note: we use a double value here. Since 1.0 has
- an exact representation this does not effect the accuracy
- but it helps to optimize the code. */
-one: .double 1.0
-
-/*
- * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
- * otherwise fyl2x with the needed extra computation.
- */
-.globl _log1pl;
- .def _log1pl; .scl 2; .type 32; .endef
-_log1pl:
- fldln2
- fldt 4(%esp)
- fxam
- fnstsw
- fld %st
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-4:
- fabs
- fldt limit
- fcompp
- fnstsw
- sahf
- jnc 2f
- faddl one
- fyl2x
- ret
-
-2: fyl2xp1
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log2.s b/mingwrt/mingwex/math/log2.s
deleted file mode 100644
index 10bdc2b..0000000
--- a/mingwrt/mingwex/math/log2.s
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Adapted for use as log2 by Ulrich Drepper <dr...@cy...>.
- * Public domain.
- *
- * Changed to use fyl2xp1 for values near 1, <dr...@cy...>.
- *
- * Removed header file dependency for use in libmingwex.a by
- * Danny Smith <dan...@us...>
- */
-
- .file "log2.s"
- .text
- .align 4
-one: .double 1.0
- /* It is not important that this constant is precise. It is only
- a value which is known to be on the safe side for using the
- fyl2xp1 instruction. */
-limit: .double 0.29
-
- .text
- .align 4
-.globl _log2
- .def _log2; .scl 2; .type 32; .endef
-_log2:
- fldl one
- fldl 4(%esp) /* x : 1 */
- fxam
- fnstsw
- fld %st /* x : x : 1 */
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-4: fsub %st(2), %st /* x-1 : x : 1 */
- fld %st /* x-1 : x-1 : x : 1 */
- fabs /* |x-1| : x-1 : x : 1 */
- fcompl limit /* x-1 : x : 1 */
- fnstsw /* x-1 : x : 1 */
- andb $0x45, %ah
- jz 2f
- fstp %st(1) /* x-1 : 1 */
- fyl2xp1 /* log(x) */
- ret
-
-2: fstp %st(0) /* x : 1 */
- fyl2x /* log(x) */
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log2_generic.sx b/mingwrt/mingwex/math/log2_generic.sx
new file mode 100644
index 0000000..97c2844
--- /dev/null
+++ b/mingwrt/mingwex/math/log2_generic.sx
@@ -0,0 +1,77 @@
+/*
+ * log2_generic.sx
+ *
+ * Generic wrapper for implementation entry stubs for each of the log2(),
+ * log2l(), and log2f() functions.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ * Adapted from original code written by J. T. Conklin <jt...@ne...>,
+ * with modifications by Ulrich Drepper <dr...@cy...>, to improve
+ * accuracy in the computation of log2(x) as x --> 1.0. This wrapper
+ * provides only definitions for derivation of the implementations by
+ * inclusion of the log_generic.sx source file.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#undef ___function
+
+/* Each of the log2(), log2f(), and log2l() functions returns a base-2
+ * logarithm; this may be computed directly, using either the FYL2X, or
+ * the FYL2X1P instruction, by setting the scaling factor (y) to one.
+ */
+#define __fldy fld1
+
+/* The first step is to identify the primary entry point name, and associated
+ * back-end names, for each of the three supported functions, (each of which
+ * to be assembled separately, using a GCC command of the form:
+ *
+ * gcc -c -D_<function>_source log10_generic.sx -o <function>.o
+ *
+ * to create the three entry stubs, with appropriate mappings to the back-end
+ * implementation provided by log_generic.sx
+ */
+#if defined _log2_source
+# define ___function _log2 /* log2() function entry point name */
+# define ___x87cvt ___x87cvt /* return value conversion helper */
+# define __fldx fldl /* FLD instruction to load x value */
+
+#elif defined _log2l_source
+# define ___function _log2l /* log2l() function entry point name */
+# define __fldx fldt /* FLD instruction to load x value */
+
+#elif defined _log2f_source
+# define ___function _log2f /* log2f() function entry point name */
+# define ___x87cvt ___x87cvtf /* return value conversion helper */
+# define __fldx flds /* FLD instruction to load x value */
+#endif
+
+/* Actual implementation of the entry point stubs, in terms of the preceding
+ * definitions, is delegated to the log_generic.sx source file.
+ */
+#include "log_generic.sx"
+
+/* vim: set autoindent filetype=asm formatoptions=croql: */
+/* $RCSfile$: end of file */
diff --git a/mingwrt/mingwex/math/log2f.s b/mingwrt/mingwex/math/log2f.s
deleted file mode 100644
index 3b52a9b..0000000
--- a/mingwrt/mingwex/math/log2f.s
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Adapted for use as log2 by Ulrich Drepper <dr...@cy...>.
- * Public domain.
- *
- * Changed to use fyl2xp1 for values near 1, <dr...@cy...>.
- *
- * Removed header file dependency for use in libmingwex.a by
- * Danny Smith <dan...@us...>
- */
-
- .file "log2f.s"
- .text
- .align 4
-one: .double 1.0
- /* It is not important that this constant is precise. It is only
- a value which is known to be on the safe side for using the
- fyl2xp1 instruction. */
-limit: .double 0.29
-
- .text
- .align 4
-.globl _log2f
- .def _log2f; .scl 2; .type 32; .endef
-_log2f:
- fldl one
- flds 4(%esp) /* x : 1 */
- fxam
- fnstsw
- fld %st /* x : x : 1 */
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-4: fsub %st(2), %st /* x-1 : x : 1 */
- fld %st /* x-1 : x-1 : x : 1 */
- fabs /* |x-1| : x-1 : x : 1 */
- fcompl limit /* x-1 : x : 1 */
- fnstsw /* x-1 : x : 1 */
- andb $0x45, %ah
- jz 2f
- fstp %st(1) /* x-1 : 1 */
- fyl2xp1 /* log(x) */
- ret
-
-2: fstp %st(0) /* x : 1 */
- fyl2x /* log(x) */
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log2l.s b/mingwrt/mingwex/math/log2l.s
deleted file mode 100644
index 044b67c..0000000
--- a/mingwrt/mingwex/math/log2l.s
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Adapted for use as log2 by Ulrich Drepper <dr...@cy...>.
- * Public domain.
- *
- * Changed to use fyl2xp1 for values near 1, <dr...@cy...>.
- */
-
- .file "log2l.s"
- .text
- .align 4
-one: .double 1.0
- /* It is not important that this constant is precise. It is only
- a value which is known to be on the safe side for using the
- fyl2xp1 instruction. */
-limit: .double 0.29
-
- .text
- .align 4
-.globl _log2l
- .def _log2l; .scl 2; .type 32; .endef
-_log2l:
- fldl one
- fldt 4(%esp) /* x : 1 */
- fxam
- fnstsw
- fld %st /* x : x : 1 */
- sahf
- jc 3f /* in case x is NaN or ±Inf */
-4: fsub %st(2), %st /* x-1 : x : 1 */
- fld %st /* x-1 : x-1 : x : 1 */
- fabs /* |x-1| : x-1 : x : 1 */
- fcompl limit /* x-1 : x : 1 */
- fnstsw /* x-1 : x : 1 */
- andb $0x45, %ah
- jz 2f
- fstp %st(1) /* x-1 : 1 */
- fyl2xp1 /* log(x) */
- ret
-
-2: fstp %st(0) /* x : 1 */
- fyl2x /* log(x) */
- ret
-
-3: jp 4b /* in case x is ±Inf */
- fstp %st(1)
- fstp %st(1)
- ret
diff --git a/mingwrt/mingwex/math/log_generic.sx b/mingwrt/mingwex/math/log_generic.sx
new file mode 100644
index 0000000..176b7df
--- /dev/null
+++ b/mingwrt/mingwex/math/log_generic.sx
@@ -0,0 +1,242 @@
+/*
+ * log_generic.sx
+ *
+ * Generic implementation for each of the log(), logl(), logf(), log1p(),
+ * log1pl(), log1pf(), log2(), log2l(), log2f(), log10(), log10l(), and
+ * log10f() functions.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ * Adapted from original code written by J. T. Conklin <jt...@ne...>,
+ * with modifications by Ulrich Drepper <dr...@cy...>, to improve
+ * accuracy in the computation of log(x) as x --> 1.0. This adaptation
+ * folds several similar sources into a single generic unit, and adds
+ * assignment of errno on exception, as prescribed by POSIX.1-2008.
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef ___function
+
+/* Each of the log(), logf(), and logl() functions returns a natural
+ * logarithm; this may be computed directly, using either the FYL2X, or
+ * the FYL2X1P instruction, by setting the scaling factor (y) to the
+ * natural logarithm of two.
+ */
+#define __fldy fldln2
+
+/* The first step is to identify the primary entry point name, and associated
+ * back-end names, for each of the twelve supported functions, (each of which
+ * is to be assembled separately, using a GCC command of the form:
+ *
+ * gcc -c -D_<function>_source log_generic.sx -o <function>.o
+ *
+ */
+#if defined _log_source
+# define ___function _log /* log() function entry point name */
+# define ___x87cvt ___x87cvt /* return value conversion helper */
+# define __fldx fldl /* FLD instruction to load x value */
+
+#elif defined _logl_source
+# define ___function _logl /* logl() function entry point name */
+# define __fldx fldt /* FLD instruction to load x value */
+
+#elif defined _logf_source
+# define ___function _logf /* logf() function entry point name */
+# define ___x87cvt ___x87cvtf /* return value conversion helper */
+# define __fldx flds /* FLD instruction to load x value */
+
+#endif
+#endif
+#ifdef __MINGW64__
+/* On 64-bit machine architecture...
+ */
+# define __xarg 8(%rsp) /* x is 8 bytes above return address */
+#else
+/* ...whereas, on 32-bit architecture...
+ */
+# define __xarg 4(%esp) /* x is 4 bytes above return address */
+#endif
+
+.text
+.align 4
+#ifdef ___function
+/* A function entry point name has been specified; assemble the corresponding
+ * entry point stub function.
+ */
+.globl ___function
+.def ___function; .scl 2; .type 32; .endef
+
+___function:
+/* Primary function entry point (generically named).
+ */
+ __fldy /* load scaling factor (y) for FYL2X */
+ __fldx __xarg /* push x value on top of FPU stack --> x : y */
+
+#ifdef ___x87cvt
+/* A return value conversion routine has been specified, (thus, this is the
+ * entry point stub for one of the float/REAL4 or double/REAL8 functions); we
+ * must call the appropriate back-end, then return to our own caller via the
+ * specified conversion routine.
+ */
+ call ___x87log_chk /* get REAL10 representation of return value */
+ jmp ___x87cvt /* convert to REAL8 or REAL4, and return it */
+
+#else
+/* No return value conversion specified, (thus this is a REAL10/long double
+ * function entry point stub); allow the back-end to return directly to our
+ * own caller.
+ */
+ jmp ___x87log_chk /* compute and return REAL10 result */
+
+#endif
+#else
+/* No specific function entry point identified; implement one of the generic
+ * back-ends, each of which is common to some subset of supported front-end
+ * entry points, and also provides the error reporting API.
+ */
+#include "errno.sx"
+
+/* This constant need not be precise; it serves only as a known safe maximum
+ * absolute value of x - 1, for which the FYL2XP1 instruction provides greater
+ * accuracy than the FYL2X instruction.
+ */
+limit: .float 0.29
+
+.align 4
+.globl ___x87log_chk
+.def ___x87log_chk; .scl 2; .type 32; .endef
+
+___x87log_chk:
+/* Common back-end entry point for all supported functions; identical in each
+ * of its ___x87log_chk and ___x87log1p_chk incarnations, it provides initial
+ * input value validation, to filter out NaN input values.
+ */
+ fxam /* classify x */
+ fnstsw %ax /* copy FPU condition codes... */
+ sahf /* ...into CPU flags register */
+ jnc 20f /* x is neither NaN nor infinite */
+ jp 11f /* x is infinite: handle accordingly */
+10: fstp %st(1) /* x is NaN; discard scale factor */
+ ret /* return x as NaN */
+
+/* In the case when the input value of x is infinite, we must handle it
+ * appropriately, depending on whether it is +ve or -ve.
+ */
+11: testb $2, %ah /* examine the sign bit */
+ jnz 20f /* x is -ve infinity: process it */
+ jmp 10b /* x is +ve infinity: just return it */
+
+.align 4
+.globl ___x87log
+.def ___x87log; .scl 2; .type 32; .endef
+
+___x87log:
+#ifdef ___x87log
+/* Implementation specific to the ___x87log1p redirection of the back-end; it
+ * computes the REAL10 representation of log(x+1), scaled as appropriate to
+ * the required logarithm base.
+ */
+20: fld %st /* x : x : y */
+ fabs /* |x| : x : y */
+ fcomps limit /* x : y */
+ fnstsw %ax /* copy FPU condition codes... */
+ sahf /* ...into CPU flags register */
+ jb 24f /* -0.29 < x < +0.29 */
+
+/* The value of x lies outside the -0.29 < x < +0.29 range, within which the
+ * FYL2X1P instruction may be used legitimately, to compute log2(x+1) directly;
+ * instead, we must explicitly add one, and use the FYL2X instruction.
+ */
+ fld1 /* 1 : x : y */
+ faddp %st, %st(1) /* x+1 : y */
+ fyl2x /* y*log(x+1) */
+#else
+/* Implementation specific to the default ___x87log form of the back-end; it
+ * computes the REAL10 representation of log(x), scaled as appropriate to the
+ * required logarithm base. In this case, we begin by computing x - 1, and
+ * checking if it lies in the -0.29 < x - 1 < +0.29 range, within which we
+ * prefer to use FYL2X1P, rather than FYL2X, (for improved accuracy).
+ */
+20: fld1 /* 1 : x : y */
+ fld %st(1) /* x : 1 : x : y */
+ fsub %st(1), %st /* x-1 : 1 : x : y */
+ fst %st(1) /* x-1 : x-1 : x : y */
+ fabs /* |x-1| : x-1 : x : y */
+ fcomps limit /* x-1 : x : y */
+ fnstsw %ax /* copy FPU condition codes... */
+ sahf /* ...into CPU flags register */
+ jb 24f /* +0.71 < x < +1.29 */
+
+/* The value of x lies outside the 0.71 < x < 1.29 range, (within which the
+ * best accuracy is achieved by use of FYL2XP1 with the x - 1 value on the
+ * top of the FPU stack); we must use FYL2X with the original value of x.
+ */
+ fstp %st(0) /* drop x-1; keep x : y */
+ fyl2x /* y*log(x) */
+#endif
+/* Fall through to check for pole errors, or domain errors, which may have
+ * been detected during computation of the logarithm; (this code is common
+ * to both ___x87log and ___x87logp1 back-end implementations).
+ */
+21: fxam /* classify computed logarithm */
+ fnstsw %ax /* copy FPU condition codes... */
+ sahf /* ...into CPU flags register */
+ jnc 22f /* result is finite; go return it */
+ jp 23f /* result is infinite ==> pole error */
+
+/* Fall through when result is NaN; this implies an attempt to compute the
+ * logarithm of a number which is less than zero, which is a domain error.
+ */
+ errno EDOM /* set errno = EDOM */
+22: ret /* return computed result */
+
+/* Handle the case of an infinite computed result; (it must be -inf, which
+ * results from attempting to compute the logarithm of zero). POSIX calls
+ * this a pole error, to be identified thus:
+ */
+23: errno ERANGE /* set errno = ERANGE */
+ ret /* return computed -inf result */
+
+#ifdef ___x87log
+/* This is the final part of the ___x87log1p back-end implementation; this
+ * is used when -0.29 < x < +0.29, to compute log(x+1) directly, using the
+ * FYL2XP1 instruction.
+ */
+24: fyl2xp1 /* y * log2(x+1) */
+#else
+/* This is the final part of the default ___x87log back-end implementation;
+ * this is used when +0.71 < x < +1.29, to compute log(x) indirectly, from
+ * the previously computed x - 1 value, using the FYL2XP1 instruction.
+ */
+24: fstp %st(1) /* drop x; keep x-1 : y */
+ fyl2xp1 /* y * log2(x) */
+#endif
+/* For both back-end implementations, we finish off by executing the common
+ * result validation routine, as implemented above.
+ */
+ jmp 21b /* go validate and return result */
+#endif
+/* vim: set autoindent filetype=asm formatoptions=croql: */
+/* $RCSfile$: end of file */
diff --git a/mingwrt/mingwex/math/logf.s b/mingwrt/mingwex/math/logf.s
deleted file mode 100644
index f622b27..0000000
--- a/mingwrt/mingwex/math/logf.s
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Public domain.
- * Adapted for float by Ulrich Drepper <dr...@cy...>.
- *
- * Changed to use fyl2xp1 for values near 1, <dr...@cy...>.
- */
-
- .file "logf.s"
- .text
- .align 4
-one: .double 1.0
- /* It is not important that this constant is precise. It is only
- a value which is known to be on the safe side for using the
- fyl2xp1 instruction. */
-limit: .double 0.29
-
- .text
- .align 4
-.globl _logf
- .def _logf; .scl 2; .type 32; .endef
-_logf:
- fldln2 /* log(2) */
- flds 4(%esp) /* x : log(2) */
- fld %st /* x : x : log(2) */
- fsubl one /* x-1 : x : log(2) */
- fld %st /* x-1 : x-1 : x : log(2) */
- fabs /* |x-1| : x-1 : x : log(2) */
- fcompl limit /* x-1 : x : log(2) */
- fnstsw /* x-1 : x : log(2) */
- andb $0x45, %ah
- jz 2f
- fstp %st(1) /* x-1 : log(2) */
- fyl2xp1 /* log(x) */
- ret
-
-2: fstp %st(0) /* x : log(2) */
- fyl2x /* log(x) */
- ret
diff --git a/mingwrt/mingwex/math/logl.s b/mingwrt/mingwex/math/logl.s
deleted file mode 100644
index 6672f9d..0000000
--- a/mingwrt/mingwex/math/logl.s
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Written by J.T. Conklin <jt...@ne...>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <dr...@cy...>.
- *
- * Removed header file dependency for use in libmingwex.a by
- * Danny Smith <dan...@us...>
- */
- .file "logl.s"
- .text
- .align 4
-one: .double 1.0
- /* It is not important that this constant is precise. It is only
- a value which is known to be on the safe side for using the
- fyl2xp1 instruction. */
-limit: .double 0.29
-
- .text
- .align 4
-.globl _logl
- .def _logl; .scl 2; .type 32; .endef
-_logl:
- fldln2 /* log(2) */
- fldt 4(%esp) /* x : log(2) */
- fld %st /* x : x : log(2) */
- fsubl one /* x-1 : x : log(2) */
- fld %st /* x-1 : x-1 : x : log(2) */
- fabs /* |x-1| : x-1 : x : log(2) */
- fcompl limit /* x-1 : x : log(2) */
- fnstsw /* x-1 : x : log(2) */
- andb $0x45, %ah
- jz 2f
- fstp %st(1) /* x-1 : log(2) */
- fyl2xp1 /* log(x) */
- ret
-
-2: fstp %st(0) /* x : log(2) */
- fyl2x /* log(x) */
- ret
diff --git a/mingwrt/mingwex/math/x87cvt_generic.sx b/mingwrt/mingwex/math/x87cvt_generic.sx
new file mode 100644
index 0000000..50f9778
--- /dev/null
+++ b/mingwrt/mingwex/math/x87cvt_generic.sx
@@ -0,0 +1,113 @@
+/*
+ * x87cvt_generic.sx
+ *
+ * Generic helper routine to convert a REAL10 return value, in FPU st(0)
+ * register, to REAL8 or REAL4; also sets errno to ERANGE, if overflow or
+ * underflow occurs during conversion.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <kei...@us...>
+ * Copyright (C) 2016, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+#undef __function
+
+#if defined _x87cvtf_source
+/* This represents the configuration for conversion from REAL10 to REAL4,
+ * (equivalent to C's float type); the function entry point is designated
+ * as __x87cvtf(), and the converting/validating store is performed using
+ * the FSTPS instruction...
+ */
+# define __function ___x87cvtf
+# define __fstp fstps
+# define __fld flds
+
+#else
+/* ...whereas the anonymous alternative represents conversion from REAL10
+ * to REAL8, (equivalent to C's double type; note that no conversion is
+ * required for C's long double type, since the original REAL10 value is
+ * already equivalent to it). In this case, the function entry point is
+ * designated as ___x87cvt(), and the store uses the FSTPL instruction.
+ */
+# define __function ___x87cvt
+# define __fstp fstpl
+# define __fld fldl
+#endif
+
+#ifdef __MINGW64__
+# define esp rsp
+#endif
+
+.macro fjnbe dest
+/* Examine the value currently stored in the FPU st(0) register; jump to
+ * the specified "dest" label, if this value is finite and non-zero.
+ */
+ fxam /* examine st(0) register */
+ fnstsw %ax /* copy FPU status flags... */
+ sahf /* ...to CPU flags register */
+ jnbe \dest /* jump if finite non-zero */
+.endm
+
+#include "errno.sx"
+
+.globl __function
+.def __function; .scl 2; .type 32; .endef
+
+.text
+.align 4
+__function:
+/* Fastcall helper function, equivalent to:
+ *
+ * double ___x87cvt (long double = REAL10 in FPU st(0));
+ * float ___x87cvtf (long double = REAL10 in FPU st(0));
+ *
+ * Check that the intermediate REAL10 result, passed in FPU register
+ * st(0), is both finite and non-zero, and that it will remain so when
+ * converted to REAL8 (when invoked as ___x87cvt), or to REAL4 (when
+ * invoked as ___x87cvtf); returns converted result, and sets errno
+ * if either overflow or underflow occurs during conversion.
+ */
+ fjnbe 20f /* proceed if finite non-zero */
+10: ret /* else return result as-is */
+
+/* Proceed when the original REAL10 value is both finite and non-zero;
+ * convert to the ultimately designated REAL8 or REAL4 result, by saving
+ * it temporarily to scratch memory immediately below the current stack,
+ * returning immediately when the converted result remains finite and
+ * non-zero.
+ */
+20: sub $12, %esp /* create scratch pad */
+ __fstp (%esp) /* convert and store REAL10 value */
+ __fld (%esp) /* reload converted result value */
+ add $12, %esp /* discard scratch pad */
+ fjnbe 10b /* return if finite non-zero result */
+
+/* Fall through to here when the conversion either overflows, becoming
+ * infinite, or underflows to zero; set errno prior to returning.
+ */
+ errno ERANGE /* else set errno = ERANGE */
+ ret /* and return augmented value */
+
+/* vim: set autoindent filetype=asm formatoptions=croql: */
+/* $RCSfile$: end of file */
https://sf.net/p/mingw/mingw-org-wsl/ci/41931fd90880e5bcca47b828e460445f88a88469/
commit 41931fd90880e5bcca47b828e460445f88a88469
Author: Keith Marshall <kei...@us...>
Date: Tue Nov 8 14:11:39 2016 +0000
Implement unit tests for logarithmic functions.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 520ed70..afd0b85 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,14 @@
+2016-11-08 Keith Marshall <kei...@us...>
+
+ Implement unit tests for logarithmic functions.
+
+ * tests/testsuite.at.in: m4_include...
+ * tests/Makefile.in (testsuite): ...and add dependency on...
+ * tests/logarithms.at: ...this new file; it specifies unit tests to
+ check POSIX.1-2008 compliance of results and errno assignment from...
+ (log, logf, logl, log1p, log1pf, log1pl, log10, log10f, log10l, log2)
+ (log2f, log2l): ...each of these functions.
+
2016-11-02 Keith Marshall <kei...@us...>
Implement unit tests for ANSI printf() functions.
diff --git a/mingwrt/tests/Makefile.in b/mingwrt/tests/Makefile.in
index dcae350..9de9826 100644
--- a/mingwrt/tests/Makefile.in
+++ b/mingwrt/tests/Makefile.in
@@ -102,7 +102,7 @@ autotest_missing = $(call missing,autom4te,Unable to compile the testsuite)
testsuite: %: %.at
$(AUTOTEST_COMPILE) -o $* $<
-testsuite: headers.at ansiprintf.at
+testsuite: headers.at ansiprintf.at logarithms.at
# Display a diagnostic message, explaining that any specified program
# is required, but has not been installed.
diff --git a/mingwrt/tests/logarithms.at b/mingwrt/tests/logarithms.at
new file mode 100644
index 0000000..a1b431b
--- /dev/null
+++ b/mingwrt/tests/logarithms.at
@@ -0,0 +1,329 @@
+# logarithms.at
+#
+# Autotest module to verify correct operation of the log(), logf(),
+# logl(), log10(), log10f(), log10l(), log1p(), log1pf(), log1pl(),
+# log2(), log2f(), and log2l() functions, with respect to each of
+# the boundary conditions specified by POSIX.1-2008.
+#
+# $Id$
+#
+# Written by Keith Marshall <kei...@us...>
+# Copyright (C) 2016, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+#
+# All tests specified herein are written in the C language.
+#
+MINGW_AT_LANG([C])
+
+# MINGW_AT_CHECK_RUN_LOG( FUNCTION, X )
+# -------------------------------------
+# Set up the test case to evaluate FUNCTION, (one of log, logf,
+# logl, log10, log10f, log10l, log1p, log1pf, log1pl, log2, log2f,
+# or log2l), with X as argument; confirm the the resultant output
+# matches that specified by _FUNCTION_expout(X).
+#
+# Note: the M4 macros log_datatype, log_strtod, and log_format
+# MUST have been defined, before this macro is expanded.
+#
+m4_define([MINGW_AT_CHECK_RUN_LOG],[
+AT_SETUP([$1 (x = $2)])AT_KEYWORDS([C logarithms $1])
+MINGW_AT_DATA_CRLF([expout],[_$1_expout([$2])
+])MINGW_AT_CHECK_RUN([[[
+#define _XOPEN_SOURCE 700
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <tgmath.h>
+#include <errno.h>
+
+#define EOK 0
+
+const char *errdesc( void )
+{ /* A minimal replacement for strerror(), so we keep strict
+ * control of the descriptions for those errors which any of
+ * the log() functions may report.
+ */
+ static char desc[8] = "";
+ switch( errno )
+ { case EOK: return "ok";
+ case EDOM: return "domain error";
+ case ERANGE: return "range error";
+ default: snprintf( desc, sizeof( desc ), "%d", errno );
+ }
+ return desc;
+}
+
+int main()
+{ /* Convert the specified X argument to the appropriate data type,
+ * invoke the specified FUNCTION, report its result, and any error
+ * which may have occurred.
+ */
+ ]]log_datatype[[ result, x = ]]log_strtod($2)[[; errno = EOK;
+ result = $1(x); printf("]]log_format[[", result, errdesc());
+ return EOK;
+}]]],,[expout])dnl
+AT_CLEANUP
+])
+
+# MINGW_AT_CHECK_LOG_FUNCTION( NAME )
+# -----------------------------------
+# Check the behaviour of function NAME, (one of log, logf, or logl,
+# log1p, log1pf, or log1pl, log10, log10f, or log10l, log2, log2f or
+# log2l), for a selection of values of X.
+#
+m4_define([MINGW_AT_CHECK_LOG_FUNCTION],[dnl
+AT_BANNER([Logarithmic function $1() tests: ]log_datatype[ data.])
+#
+# On successful completion, return log(x) with the appropriate base.
+#
+MINGW_AT_CHECK_RUN_LOG([$1],[-1.30000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[-1.00000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[-0.30000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[-0.29000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[-0.28000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[-0.00001e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.00000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.00001e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.28000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.29000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.30000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.70000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.71000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.72000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+0.99999e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.00000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.00001e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.28000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.29000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.30000e+000])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.28000e+038])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.28000e+308])
+MINGW_AT_CHECK_RUN_LOG([$1],[+1.28000e+999])
+MINGW_AT_CHECK_RUN_LOG([$1],[-inf])
+])
+
+# _log_expout( X )
+# ----------------
+# Define expected outcomes for log(X), logf(X), and logl(X), given
+# a specific input value of X; these represent the Naperian (base-e)
+# logarithms for the specified X values.
+#
+m4_define([_log_expout],[m4_if(dnl
+[$1],[+1.28000e+999],[+inf (ok)],
+[_logl_expout([$1])])])
+m4_define([_logf_expout],[m4_if(dnl
+dnl All of the conventional log(X) algorithms suffer from loss of
+dnl precision in the region where X --> 1.0; this is particularly
+dnl evident in the case of the REAL4 (float) implementations, which
+dnl deviate from the expected value (--> 0.00000) after only three
+dnl significant digits.
+[$1],[+0.99999e+000],[-1.00136e-005 (ok)],dnl expected loss of precision...
+[$1],[+1.00001e+000],[+1.00135e-005 (ok)],dnl for values of X near 1.0
+[$1],[+1.28000e+308],[+inf (ok)],
+[_log_expout([$1])])])
+m4_define([_logl_expout],[m4_if(dnl
+[$1],[+0.00001e+000],[-1.15129e+001 (ok)],
+[$1],[+0.28000e+000],[-1.27297e+000 (ok)],
+[$1],[+0.29000e+000],[-1.23787e+000 (ok)],
+[$1],[+0.30000e+000],[-1.20397e+000 (ok)],
+[$1],[+0.70000e+000],[-3.56675e-001 (ok)],
+[$1],[+0.71000e+000],[-3.42490e-001 (ok)],
+[$1],[+0.72000e+000],[-3.28504e-001 (ok)],
+[$1],[+0.99999e+000],[-1.00001e-005 (ok)],
+[$1],[+1.00001e+000],[+9.99995e-006 (ok)],
+[$1],[+1.28000e+000],[+2.46860e-001 (ok)],
+[$1],[+1.29000e+000],[+2.54642e-001 (ok)],
+[$1],[+1.30000e+000],[+2.62364e-001 (ok)],
+[_logx_expout([$1])])])
+
+# _log10_expout( X )
+# ------------------
+# Define expected outcomes for log10(X), log10f(X), and log10l(X),
+# given any specific input value of X; these represent the base-10
+# logarithms for the specified X values.
+#
+m4_define([_log10_expout],[m4_if(dnl
+[$1],[+1.28000e+999],[+inf (ok)],
+[_log10l_expout([$1])])])
+m4_define([_log10f_expout],[m4_if(dnl
+dnl As in the logf(X) case, log10f(X) shows marked deviation from
+dnl expectation as X --> 1.0; once again, we observe deviation after
+dnl only three significant digits, at |X-1.0| == 1.0e-5, for this
+dnl REAL4 (float) implementation, (with additional deviation in
+dnl the sixth significant digit, around |X-1.0| --> 0.28).
+[$1],[+0.72000e+000],[-1.42667e-001 (ok)],dnl last digit difference
+[$1],[+0.99999e+000],[-4.34886e-006 (ok)],dnl expected loss of precision...
+[$1],[+1.00001e+000],[+4.34882e-006 (ok)],dnl for values of X near 1.0
+[$1],[+1.28000e+308],[+inf (ok)],
+[_log10_expout([$1])])])
+m4_define([_log10l_expout],[m4_if(dnl
+[$1],[+0.00001e+000],[-5.00000e+000 (ok)],
+[$1],[+0.28000e+000],[-5.52842e-001 (ok)],
+[$1],[+0.29000e+000],[-5.37602e-001 (ok)],
+[$1],[+0.30000e+000],[-5.22879e-001 (ok)],
+[$1],[+0.70000e+000],[-1.54902e-001 (ok)],
+[$1],[+0.71000e+000],[-1.48742e-001 (ok)],
+[$1],[+0.72000e+000],[-1.42668e-001 (ok)],
+[$1],[+0.99999e+000],[-4.34297e-006 (ok)],
+[$1],[+1.00001e+000],[+4.34292e-006 (ok)],
+[$1],[+1.28000e+000],[+1.07210e-001 (ok)],
+[$1],[+1.29000e+000],[+1.10590e-001 (ok)],
+[$1],[+1.30000e+000],[+1.13943e-001 (ok)],
+[$1],[+1.28000e+038],[+3.81072e+001 (ok)],
+[$1],[+1.28000e+308],[+3.08107e+002 (ok)],
+[$1],[+1.28000e+999],[+9.99107e+002 (ok)],
+[_logx_expout([$1])])])
+
+# _log1p_expout( X )
+# ------------------
+# Define expected outcomes for log1p(X+1), log1pf(X+1), and log1pl(X+1),
+# given a specific input value of X; these represent the Naperian (base-e)
+# logarithms for the specified X+1 values.
+#
+m4_define([_log1p_expout],[m4_if(dnl
+[$1],[+1.28000e+999],[+inf (ok)],
+[_log1pl_expout([$1])])])
+m4_define([_log1pf_expout],[m4_if(dnl
+dnl While the log1p(X) algorithm yields much better accuracy in the region
+dnl where X --> 0.0, (equivalent to X --> 1.0 for the other algorithms), we
+dnl may still observe some loss of precision (in the sixth significant digit
+dnl here) for the REAL4 implementation; (since the limit of precision for
+dnl REAL4 is no more than seven significant digits anyway, this represents
+dnl no more than a rounding effect from the least significant available
+dnl digit, so this may be considered reasonable accuracy).
+[$1],[-0.00001e+000],[-1.00000e-005 (ok)],
+[$1],[+1.28000e+308],[+inf (ok)],
+[_log1p_expout([$1])])])
+m4_define([_log1pl_expout],[m4_if(dnl
+[$1],[-1.00000e+000],[-inf (range error)],
+[$1],[-0.30000e+000],[-3.56675e-001 (ok)],
+[$1],[-0.29000e+000],[-3.42490e-001 (ok)],
+[$1],[-0.28000e+000],[-3.28504e-001 (ok)],
+[$1],[-0.00001e+000],[-1.00001e-005 (ok)],
+[$1],[+0.00000e+000],[+0.00000e+000 (ok)],
+[$1],[+0.00001e+000],[+9.99995e-006 (ok)],
+[$1],[+0.28000e+000],[+2.46860e-001 (ok)],
+[$1],[+0.29000e+000],[+2.54642e-001 (ok)],
+[$1],[+0.30000e+000],[+2.62364e-001 (ok)],
+[$1],[+0.70000e+000],[+5.30628e-001 (ok)],
+[$1],[+0.71000e+000],[+5.36493e-001 (ok)],
+[$1],[+0.72000e+000],[+5.42324e-001 (ok)],
+[$1],[+0.99999e+000],[+6.93142e-001 (ok)],
+[$1],[+1.00000e+000],[+6.93147e-001 (ok)],
+[$1],[+1.00001e+000],[+6.93152e-001 (ok)],
+[$1],[+1.28000e+000],[+8.24175e-001 (ok)],
+[$1],[+1.29000e+000],[+8.28552e-001 (ok)],
+[$1],[+1.30000e+000],[+8.32909e-001 (ok)],
+[_logx_expout([$1])])])
+
+# _log2_expout( X )
+# -----------------
+# Define expected outcomes for log(X), logf(X), and logl(X), given
+# a specific input value of X; these represent the Naperian (base-e)
+# logarithms for the specified X values.
+#
+m4_define([_log2_expout],[m4_if(dnl
+[$1],[+1.28000e+999],[+inf (ok)],
+[_log2l_expout([$1])])])
+m4_define([_log2f_expout],[m4_if(dnl
+dnl As in the case of other log(X) implementations, the REAL4 (float)
+dnl implementation again exhibits severe loss of precision beyond the
+dnl third significant digit, in the X --> 1.0 region.
+[$1],[+0.99999e+000],[-1.44466e-005 (ok)],dnl bad rounding error here!
+[$1],[+1.00001e+000],[+1.44465e-005 (ok)],dnl and here.
+[$1],[+1.28000e+308],[+inf (ok)],
+[_log2_expout([$1])])])
+m4_define([_log2l_expout],[m4_if(dnl
+[$1],[+0.00001e+000],[-1.66096e+001 (ok)],
+[$1],[+0.28000e+000],[-1.83650e+000 (ok)],
+[$1],[+0.29000e+000],[-1.78588e+000 (ok)],
+[$1],[+0.30000e+000],[-1.73697e+000 (ok)],
+[$1],[+0.70000e+000],[-5.14573e-001 (ok)],
+[$1],[+0.71000e+000],[-4.94109e-001 (ok)],
+[$1],[+0.72000e+000],[-4.73931e-001 (ok)],
+[$1],[+0.99999e+000],[-1.44270e-005 (ok)],
+[$1],[+1.00001e+000],[+1.44269e-005 (ok)],
+[$1],[+1.28000e+000],[+3.56144e-001 (ok)],
+[$1],[+1.29000e+000],[+3.67371e-001 (ok)],
+[$1],[+1.30000e+000],[+3.78512e-001 (ok)],
+[$1],[+1.28000e+038],[+1.26589e+002 (ok)],
+[$1],[+1.28000e+308],[+1.02351e+003 (ok)],
+[$1],[+1.28000e+999],[+3.31896e+003 (ok)],
+[_logx_expout([$1])])])
+
+# _logx_expout( X )
+# -----------------
+# Define expected outcomes, given a specific input value for X,
+# which may be expected to be the same for ALL of the implemented
+# logarithm algorithms, (unless otherwise specified for a specific
+# algorithm; note that this includes the Naperian logarithm values
+# for very large X, which are the same for both log(X) and log1p(X),
+# since the difference between X and X+1.0 becomes insignificant at
+# such large values of X).
+m4_define([_logx_expout],[m4_if(dnl
+[$1],[+0.00000e+000],[-inf (range error)],
+[$1],[+1.00000e+...
[truncated message content] |
|
From: Keith M. <no...@so...> - 2016-11-02 19:33:47
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via 41dede5c0355d8b1365160399bda032b4a91cca7 (commit)
via 386fe3a1b10e97c7cd7f137b3be64d7e4553cdf3 (commit)
via 5fe5d0aa874341cc015b0b71f5b5a6d9f3de8e7d (commit)
via 96666e31b322ff73f7ad6f70b0c556b25bbb9c2d (commit)
via 368f7458251031d44d4debe1cf4b0488d82b5ede (commit)
via 022f01137f06bea7f9f34eab8b4c1acc2a03f7a0 (commit)
via 7602ad983922b3d73049121fd49b113a635ee3ee (commit)
via 59b93789d30cec514fda088b71bbd06e4feb9b9d (commit)
via 89581f43949c2a7358e0e886dff3af6b9632869b (commit)
via 05ab3d1afdda01c240fb712b61017fd6f3a05a45 (commit)
via f1f19426a44d72d53625cdedadde367597545ee2 (commit)
via 1228fe8f7a29aa43f087c72c17d44395bf3b51a6 (commit)
via 55eabac9897f4814feb7523898d0e854240a6d91 (commit)
via 41eb88b2e179769d5f3ed19e9245da4c3691fa61 (commit)
via 16886ec1adc8c60608e9befa7c3ff9081aa8870f (commit)
via ca342c21c6722e39da7cc58b68b1a3267a13a3f5 (commit)
via ff51a7e2f51cbacd39ce0e466504295fc13e5935 (commit)
via 8f3e997526003e41ff5e38447785c4d4ebd66664 (commit)
via 49f9e149bc7c4ea96d0f04c35da1b4a43f20751a (commit)
via 82b5d808add5a0e1e6396fda6b15d36e0d93573b (commit)
via cfb391e9a622f725779c0150f5fcdc865a718efb (commit)
via 1c4f53bbf59753843994a1a1bb09bf81743bf15c (commit)
from f5236db2ca9a50305b1be938177a4b00a853080e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/41dede5c0355d8b1365160399bda032b4a91cca7/
commit 41dede5c0355d8b1365160399bda032b4a91cca7
Author: Keith Marshall <kei...@us...>
Date: Wed Nov 2 17:03:51 2016 +0000
Implement unit tests for ANSI printf() functions.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 751d0c0..520ed70 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,11 @@
+2016-11-02 Keith Marshall <kei...@us...>
+
+ Implement unit tests for ANSI printf() functions.
+
+ * tests/Makefile.in (testsuite): Add dependency for...
+ * tests/ansiprintf.at: ...this new file, and...
+ * tests/testsuite.at.in: ...m4_include it.
+
2016-11-01 Keith Marshall <kei...@us...>
Fix another printf() hex-float formatting bug.
diff --git a/mingwrt/tests/Makefile.in b/mingwrt/tests/Makefile.in
index 19ca799..dcae350 100644
--- a/mingwrt/tests/Makefile.in
+++ b/mingwrt/tests/Makefile.in
@@ -99,9 +99,11 @@ AUTOTEST_COMPILE = $(autotest_@AUTOTEST_COMPILE@)
autotest_command = autom4te --language autotest --include ${srcdir}
autotest_missing = $(call missing,autom4te,Unable to compile the testsuite)
-testsuite: %: %.at headers.at
+testsuite: %: %.at
$(AUTOTEST_COMPILE) -o $* $<
+testsuite: headers.at ansiprintf.at
+
# Display a diagnostic message, explaining that any specified program
# is required, but has not been installed.
#
diff --git a/mingwrt/tests/ansiprintf.at b/mingwrt/tests/ansiprintf.at
new file mode 100644
index 0000000..65cbc30
--- /dev/null
+++ b/mingwrt/tests/ansiprintf.at
@@ -0,0 +1,298 @@
+# ansiprintf.at
+#
+# Autotest module to verify correct operation of MinGW.org's suite of
+# ANSI compliant replacements for the printf() family of functions.
+#
+# $Id$
+#
+# Written by Keith Marshall <kei...@us...>
+# Copyright (C) 2016, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+#
+# All tests specified herein are written in the C language.
+#
+MINGW_AT_LANG([C])
+
+# MINGW_AT_CHECK_PRINTF( FORMAT, ARGS, EXPOUT )
+# ---------------------------------------------
+# Set up the test case to evaluate the behaviour of printf() when
+# invoked with the specified (unquoted) FORMAT, and the given comma
+# separated list of ARGS; confirm that the resultant output matches
+# EXPOUT, (which is interpreted as CRLF delimited text).
+#
+m4_define([MINGW_AT_CHECK_PRINTF],[dnl
+AT_SETUP([printf ("$1", $2)])_MINGW_AT_CHECK_PRINTF([$1],[$2],[$3])dnl
+])m4_define([_MINGW_AT_CHECK_PRINTF],[dnl
+AT_KEYWORDS([C printf])
+MINGW_AT_DATA_CRLF([expout],[[$3
+]])MINGW_AT_CHECK_RUN([[[
+#define _XOPEN_SOURCE 700
+#include <stdio.h>
+#include <tgmath.h>
+int main()
+{ printf ("::]$1[::\n", ]$2[); return 0;
+}]]],,[expout])dnl
+AT_CLEANUP
+])# MINGW_AT_CHECK_PRINTF
+
+# MINGW_AT_XFAIL_PRINTF( FORMAT, ARGS, EXPOUT )
+# ---------------------------------------------
+# A variation on MINGW_AT_CHECK_PRINTF, used to introduce any test
+# from which the output is likely to differ from that which might be
+# expected for the given format and arguments, (e.g. the display of
+# numeric digits beyond the limit of precision for the data type).
+#
+m4_define([MINGW_AT_XFAIL_PRINTF],[dnl
+AT_SETUP([printf ("$1", $2)])AT_XFAIL_IF([true])dnl
+_MINGW_AT_CHECK_PRINTF([$1],[$2],[$3])dnl
+])# MINGW_AT_XFAIL_PRINTF
+
+
+# Test behaviour of "%d" format conversion, for decimal
+# display of integer values.
+#
+AT_BANNER([[ISO-C99 printf() integer value formatting.]])
+MINGW_AT_CHECK_PRINTF([[%20d]], [+0], [:: 0::])
+MINGW_AT_CHECK_PRINTF([[%+20d]], [-0], [:: +0::])
+MINGW_AT_CHECK_PRINTF([[%020d]], [+0], [::00000000000000000000::])
+MINGW_AT_CHECK_PRINTF([[%-20d]], [-0], [::0 ::])
+MINGW_AT_CHECK_PRINTF([[%20d]], [+55], [:: 55::])
+MINGW_AT_CHECK_PRINTF([[%20d]], [-55], [:: -55::])
+MINGW_AT_CHECK_PRINTF([[%+20d]], [+55], [:: +55::])
+MINGW_AT_CHECK_PRINTF([[%+20d]], [-55], [:: -55::])
+MINGW_AT_CHECK_PRINTF([[%020d]], [+55], [::00000000000000000055::])
+MINGW_AT_CHECK_PRINTF([[%-20d]], [+55], [::55 ::])
+
+
+# Test behaviour of "%#x" format conversion, for hexadecimal
+# display of integer values.
+#
+AT_BANNER([[ISO-C99 printf() hexadecimal integer formatting.]])
+MINGW_AT_CHECK_PRINTF([[%#20x]], [-0], [:: 0::])
+MINGW_AT_CHECK_PRINTF([[%#+20x]], [+0], [:: 0::])
+MINGW_AT_CHECK_PRINTF([[%#020x]], [-0], [::00000000000000000000::])
+MINGW_AT_CHECK_PRINTF([[%#-20x]], [+0], [::0 ::])
+MINGW_AT_CHECK_PRINTF([[%#20x]], [+77], [:: 0x4d::])
+MINGW_AT_CHECK_PRINTF([[%#20x]], [-77], [:: 0xffffffb3::])
+MINGW_AT_CHECK_PRINTF([[%#+20x]], [+77], [:: 0x4d::])
+MINGW_AT_CHECK_PRINTF([[%#+20x]], [-77], [:: 0xffffffb3::])
+MINGW_AT_CHECK_PRINTF([[%#020x]], [+77], [::0x00000000000000004d::])
+MINGW_AT_CHECK_PRINTF([[%#-20x]], [+77], [::0x4d ::])
+
+
+# Test effect of alignment and sign flags on "%f" format conversion.
+#
+AT_BANNER([[ISO-C99 printf() fixed point real number formatting.]])
+MINGW_AT_CHECK_PRINTF([[%20f]], [M_E], [:: 2.718282::])
+MINGW_AT_CHECK_PRINTF([[% 20f]], [M_E], [:: 2.718282::])
+MINGW_AT_CHECK_PRINTF([[%+20f]], [M_E], [:: +2.718282::])
+MINGW_AT_CHECK_PRINTF([[% 020f]], [M_E], [:: 000000000002.718282::])
+MINGW_AT_CHECK_PRINTF([[%020f]], [M_E], [::0000000000002.718282::])
+MINGW_AT_CHECK_PRINTF([[%+020f]], [M_E], [::+000000000002.718282::])
+MINGW_AT_CHECK_PRINTF([[%+ 020f]], [M_E], [::+000000000002.718282::])
+MINGW_AT_CHECK_PRINTF([[%-20f]], [M_E], [::2.718282 ::])
+MINGW_AT_CHECK_PRINTF([[%- 20f]], [M_E], [:: 2.718282 ::])
+MINGW_AT_CHECK_PRINTF([[%-+20f]], [M_E], [::+2.718282 ::])
+MINGW_AT_CHECK_PRINTF([[%- +20f]], [M_E], [::+2.718282 ::])
+MINGW_AT_CHECK_PRINTF([[%-020f]], [M_E], [::2.718282 ::])
+
+
+# Test the effect of "%f" format conversion, with a value which
+# requires in excess the representable 15-digit maximum precision
+# of the double data type; ideally, a value with an exact binary
+# representation would be displayed exactly, but we expect this
+# to fail, with garbage beyond the 15-digit boundary.
+#
+AT_BANNER([[ISO-C99 printf() fixed point formatting imprecision.]])
+MINGW_AT_XFAIL_PRINTF([[%30.1f]], [1e+26], [:: 100000000000000000000000000.0::])
+
+
+# Test default behaviour of "%g" format conversion; (this should
+# have no non-significant trailing zeros, nor should it end with
+# a radix point without following non-zero fractional digits).
+#
+AT_BANNER([[ISO-C99 printf() floating point real number formatting.]])
+MINGW_AT_CHECK_PRINTF([[%20g]], [1.75e+02], [:: 175::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [1.75e+05], [:: 175000::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [1.75e+15], [:: 1.75e+015::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [1.75e+00], [:: 1.75::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [1.75e-03], [:: 0.00175::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [1.75e-15], [:: 1.75e-015::])
+
+
+# Test effect of alignment and sign flags on "%g" format conversion.
+#
+AT_BANNER([[ISO-C99 printf() floating point formatting with flags.]])
+MINGW_AT_CHECK_PRINTF([[%+20g]], [M_E], [:: +2.71828::])
+MINGW_AT_CHECK_PRINTF([[%020g]], [M_E], [::00000000000002.71828::])
+MINGW_AT_CHECK_PRINTF([[% 020g]], [M_E], [:: 0000000000002.71828::])
+MINGW_AT_CHECK_PRINTF([[%+020g]], [M_E], [::+0000000000002.71828::])
+MINGW_AT_CHECK_PRINTF([[%+ 020g]], [M_E], [::+0000000000002.71828::])
+MINGW_AT_CHECK_PRINTF([[%-20g]], [M_E], [::2.71828 ::])
+MINGW_AT_CHECK_PRINTF([[%- 20g]], [M_E], [:: 2.71828 ::])
+MINGW_AT_CHECK_PRINTF([[%-+20g]], [M_E], [::+2.71828 ::])
+MINGW_AT_CHECK_PRINTF([[%- +20g]], [M_E], [::+2.71828 ::])
+MINGW_AT_CHECK_PRINTF([[%-020g]], [M_E], [::2.71828 ::])
+
+
+# Test effect of "#" flag on "%g" format conversion; (this should
+# override suppression of non-significant trailing zeros).
+#
+AT_BANNER([[ISO-C99 printf() alternative floating point formatting.]])
+MINGW_AT_CHECK_PRINTF([[%#20g]], [1.75e+02], [:: 175.000::])
+MINGW_AT_CHECK_PRINTF([[%#20g]], [1.75e+05], [:: 175000.::])
+MINGW_AT_CHECK_PRINTF([[%#20g]], [1.75e+15], [:: 1.75000e+015::])
+MINGW_AT_CHECK_PRINTF([[%#20g]], [1.75e+00], [:: 1.75000::])
+MINGW_AT_CHECK_PRINTF([[%#20g]], [1.75e-03], [:: 0.00175000::])
+MINGW_AT_CHECK_PRINTF([[%#20g]], [1.75e-15], [:: 1.75000e-015::])
+
+
+# Test transition between "%e" and "%f" style representations, for
+# default precision "%g" format conversion.
+#
+AT_BANNER([[ISO-C99 printf() floating point format style transitions.]])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e-6], [:: 2.71828e-006::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e-5], [:: 2.71828e-005::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e-4], [:: 0.000271828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e-3], [:: 0.00271828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e-2], [:: 0.0271828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e-1], [:: 0.271828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+0], [:: 2.71828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+1], [:: 27.1828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+2], [:: 271.828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+3], [:: 2718.28::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+4], [:: 27182.8::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+5], [:: 271828::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+6], [:: 2.71828e+006::])
+MINGW_AT_CHECK_PRINTF([[%20g]], [M_E * 1e+7], [:: 2.71828e+007::])
+
+
+# Test the effect of varying precision, as specified by the "*" format
+# modifier, on "%g" format conversion; (-ve precision implies default;
+# zero or +ve specifies actual significant digits).
+#
+AT_BANNER([[ISO-C99 printf() variable precision floating point format.]])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [-2, M_E], [:: 2.71828::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [-1, M_E], [:: 2.71828::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+0, M_E], [:: 3::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+1, M_E], [:: 3::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+2, M_E], [:: 2.7::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+3, M_E], [:: 2.72::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+4, M_E], [:: 2.718::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+5, M_E], [:: 2.7183::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+6, M_E], [:: 2.71828::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+7, M_E], [:: 2.718282::])
+MINGW_AT_CHECK_PRINTF([[%20.*g]], [+8, M_E], [:: 2.7182818::])
+
+
+# Test variations of "%e" format conversion.
+#
+AT_BANNER([[ISO-C99 printf() scientific style floating point format.]])
+MINGW_AT_CHECK_PRINTF([[%20.7e]], [+M_E * 0.0], [:: 0.0000000e+000::])
+MINGW_AT_CHECK_PRINTF([[%20.7e]], [-M_E * 0.0], [:: -0.0000000e+000::])
+MINGW_AT_CHECK_PRINTF([[%20.7e]], [+M_E * 1.0], [:: 2.7182818e+000::])
+MINGW_AT_CHECK_PRINTF([[%20.7e]], [-M_E * 1.0], [:: -2.7182818e+000::])
+MINGW_AT_CHECK_PRINTF([[%20.7e]], [+M_E / 0.0], [:: inf::])
+MINGW_AT_CHECK_PRINTF([[%20.7e]], [-M_E / 0.0], [:: -inf::])
+MINGW_AT_CHECK_PRINTF([[%20.7e]], [-0.0 / 0.0], [:: nan::])
+MINGW_AT_CHECK_PRINTF([[%-20.7e]], [+M_E * 0.0], [::0.0000000e+000 ::])
+MINGW_AT_CHECK_PRINTF([[%-20.7e]], [-M_E * 0.0], [::-0.0000000e+000 ::])
+MINGW_AT_CHECK_PRINTF([[%-20.7e]], [+M_E * 1.0], [::2.7182818e+000 ::])
+MINGW_AT_CHECK_PRINTF([[%-20.7e]], [-M_E * 1.0], [::-2.7182818e+000 ::])
+MINGW_AT_CHECK_PRINTF([[%-20.7e]], [+M_E / 0.0], [::inf ::])
+MINGW_AT_CHECK_PRINTF([[%-20.7e]], [-M_E / 0.0], [::-inf ::])
+MINGW_AT_CHECK_PRINTF([[%-20.7e]], [-0.0 / 0.0], [::nan ::])
+MINGW_AT_CHECK_PRINTF([[%+20.7e]], [+M_E * 0.0], [:: +0.0000000e+000::])
+MINGW_AT_CHECK_PRINTF([[%+20.7e]], [-M_E * 0.0], [:: -0.0000000e+000::])
+MINGW_AT_CHECK_PRINTF([[%+20.7e]], [+M_E * 1.0], [:: +2.7182818e+000::])
+MINGW_AT_CHECK_PRINTF([[%+20.7e]], [-M_E * 1.0], [:: -2.7182818e+000::])
+MINGW_AT_CHECK_PRINTF([[%+20.7e]], [+M_E / 0.0], [:: +inf::])
+MINGW_AT_CHECK_PRINTF([[%+20.7e]], [-M_E / 0.0], [:: -inf::])
+MINGW_AT_CHECK_PRINTF([[%+20.7e]], [-0.0 / 0.0], [:: +nan::])
+
+
+# Test variations of "%a" format conversion; (the following integer
+# value confirms correct size of the floating point entity passed on
+# the printf() argument stack).
+#
+AT_BANNER([[ISO-C99 printf() hexadecimal floating point formatting.]])
+MINGW_AT_CHECK_PRINTF([[%16a%4d]], [0.000, 77], [:: 0x0p+0 77::])
+MINGW_AT_CHECK_PRINTF([[%16.3a%4d]], [0.000, 99], [:: 0x0.000p+0 99::])
+MINGW_AT_CHECK_PRINTF([[%16a%4d]], [1.750, 77], [:: 0xep-3 77::])
+MINGW_AT_CHECK_PRINTF([[%016a%4d]], [1.750, 77], [::0x0000000000ep-3 77::])
+MINGW_AT_CHECK_PRINTF([[%-016a%4d]], [1.750, 77], [::0xep-3 77::])
+MINGW_AT_CHECK_PRINTF([[%16.0a%4d]], [1.450, 44], [:: 0xcp-3 44::])
+MINGW_AT_CHECK_PRINTF([[%16.1a%4d]], [1.999, 99], [:: 0x8.0p-2 99::])
+MINGW_AT_CHECK_PRINTF([[%16La%4d]], [1.750L, 77], [:: 0xep-3 77::])
+MINGW_AT_CHECK_PRINTF([[%016La%4d]], [1.750L, 77], [::0x0000000000ep-3 77::])
+MINGW_AT_CHECK_PRINTF([[%16.0La%4d]], [1.450L, 44], [:: 0xcp-3 44::])
+MINGW_AT_CHECK_PRINTF([[%16.1La%4d]], [1.999L, 99], [:: 0x8.0p-2 99::])
+
+
+# MINGW_AT_CHECK_SNPRINTF( FORMAT, MAXCOUNT, INITCOUNT )
+# ------------------------------------------------------
+# Test the behaviour of the snprintf() function, with respect to
+# output truncation at specified MAXCOUNT (no more than 32), when
+# writing string "Sample text; sufficient buffer" subject to the
+# specified. Also supports testing the effect of "%n" counting
+# on an internal integer variable, initialized to INITCOUNT.
+#
+m4_define([MINGW_AT_CHECK_SNPRINTF],[dnl
+AT_SETUP([snprintf (output, $2, "$1", ...)])
+AT_KEYWORDS([C printf])MINGW_AT_DATA_CRLF([expout],[[$4
+]])MINGW_AT_CHECK_RUN([[[
+#define _XOPEN_SOURCE 700
+#include <stdio.h>
+int main()
+{ char output[32]; int capture = ]$3[;
+ const char *sample = "Sample text; sufficient buffer";
+ int total = snprintf (output, ]$2[, "]$1[", sample, &capture);
+ snprintf (NULL, 0, "]$1[", output, &capture);
+ printf ("%s: %d required; %d captured\n", output, total, capture);
+ return 0;
+}]]],,[expout])dnl
+AT_CLEANUP
+])# MINGW_AT_CHECK_SNPRINTF
+
+
+# Tests for snprintf() with limited length internal buffer.
+#
+AT_BANNER([ISO-C99 snprintf() buffer length control.])
+MINGW_AT_CHECK_SNPRINTF([[%s]],[32],[1024],dnl
+[Sample text; sufficient buffer: 30 required; 1024 captured])
+MINGW_AT_CHECK_SNPRINTF([[%s]],[12],[1024],dnl
+[Sample text: 30 required; 1024 captured])
+
+
+# Tests for effect of "%n" output length counting.
+#
+AT_BANNER([ISO-C99 snprintf() intermediate output counting.])
+MINGW_AT_CHECK_SNPRINTF([[%s%n]],[32],[1024],dnl
+[Sample text; sufficient buffer: 30 required; 30 captured])
+MINGW_AT_CHECK_SNPRINTF([[%s%n]],[12],[1024],dnl
+[Sample text: 30 required; 11 captured])
+MINGW_AT_CHECK_SNPRINTF([[%s%hhn]],[12],[1024],dnl
+[Sample text: 30 required; 1035 captured])
+
+# vim: filetype=config formatoptions=croql
+# $RCSfile$: end of file
diff --git a/mingwrt/tests/testsuite.at.in b/mingwrt/tests/testsuite.at.in
index 527b21d..3e565e4 100644
--- a/mingwrt/tests/testsuite.at.in
+++ b/mingwrt/tests/testsuite.at.in
@@ -87,6 +87,7 @@ MINGW_AT_LANG([C])
# collection of autotest M4 include files.
#
m4_include([headers.at])
+m4_include([ansiprintf.at])
# vim: filetype=config formatoptions=croql
# $RCSfile$: end of file
https://sf.net/p/mingw/mingw-org-wsl/ci/386fe3a1b10e97c7cd7f137b3be64d7e4553cdf3/
commit 386fe3a1b10e97c7cd7f137b3be64d7e4553cdf3
Merge: 96666e3 5fe5d0a
Author: Keith Marshall <kei...@us...>
Date: Tue Nov 1 20:08:15 2016 +0000
Fix another printf() hex-float formatting bug.
diff --cc mingwrt/ChangeLog
index a9f3822,1529dcf..751d0c0
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@@ -1,12 -1,13 +1,20 @@@
+ 2016-11-01 Keith Marshall <kei...@us...>
+
+ Fix another printf() hex-float formatting bug.
+
+ * mingwex/stdio/pformat.c (__pformat_emit_xfloat)
+ [stream->flags & PFORMAT_ZEROFILL]: Ignore this; it should be...
+ [(stream->flags & PFORMAT_JUSTIFY) == PFORMAT_ZEROFILL]: ...thus.
+
2016-10-30 Keith Marshall <kei...@us...>
+ Merge post 2016-10-18 updates from legacy branch.
+
+ * include/io.h include/wchar.h: Updated.
+ * mingwex/stdio/pformat.c: Likewise.
+
+2016-10-30 Keith Marshall <kei...@us...>
+
Work around MSDN inconsistencies in _finddata_t naming.
* include/io.h (_finddata64_t, _wfinddata64_): Define them
https://sf.net/p/mingw/mingw-org-wsl/ci/96666e31b322ff73f7ad6f70b0c556b25bbb9c2d/
commit 96666e31b322ff73f7ad6f70b0c556b25bbb9c2d
Merge: 7602ad9 368f745
Author: Keith Marshall <kei...@us...>
Date: Sun Oct 30 19:12:05 2016 +0000
Merge post 2016-10-18 updates from legacy branch.
diff --cc mingwrt/ChangeLog
index 217d325,0526d23..a9f3822
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@@ -1,10 -1,24 +1,38 @@@
+ 2016-10-30 Keith Marshall <kei...@us...>
+
++ Merge post 2016-10-18 updates from legacy branch.
++
++ * include/io.h include/wchar.h: Updated.
++ * mingwex/stdio/pformat.c: Likewise.
++
++2016-10-30 Keith Marshall <kei...@us...>
++
+ Work around MSDN inconsistencies in _finddata_t naming.
+
+ * include/io.h (_finddata64_t, _wfinddata64_): Define them
+ respectively as aberrant alternative data type names for each of...
+ (__finddata64_t, __wfinddata64_t): ...these original names.
+ (_wfinddata32_t): Similarly, define this with...
+ (__wfinddata32_t): ...this alternative name.
+
+ * include/wchar.h (_wfinddata32_t): Correct references in comments.
+
+ 2016-10-30 Keith Marshall <kei...@us...>
+
+ Fix a potentially infinite printf() format conversion loop.
+
+ * mingwex/stdio/pformat.c (__pformat_emit_xfloat)
+ [value.__pformat_fpreg_mantissa == 0]: Do not attempt to normalize
+ it; there are no 1-bits to promote, so repeated shifting until one
+ appears in most significant position will never terminate.
+
+2016-10-18 Keith Marshall <kei...@us...>
+
+ Merge mingwrt-3.22.4 updates into 5.0-active branch.
+
+ * configure.ac: Preserve original 5.0-active state.
+ * include/wchar.h: Update per 2016-10-17 commits.
+
2016-10-17 Keith Marshall <kei...@us...>
Prepare and tag mingwrt-3.22.4 patch release.
https://sf.net/p/mingw/mingw-org-wsl/ci/7602ad983922b3d73049121fd49b113a635ee3ee/
commit 7602ad983922b3d73049121fd49b113a635ee3ee
Merge: f1f1942 59b9378
Author: Keith Marshall <kei...@us...>
Date: Tue Oct 18 12:02:44 2016 +0100
Merge mingwrt-3.22.4 updates into 5.0-active branch.
diff --cc mingwrt/ChangeLog
index 9bea175,ccc3a63..217d325
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@@ -1,26 -1,19 +1,49 @@@
++2016-10-18 Keith Marshall <kei...@us...>
++
++ Merge mingwrt-3.22.4 updates into 5.0-active branch.
++
++ * configure.ac: Preserve original 5.0-active state.
++ * include/wchar.h: Update per 2016-10-17 commits.
++
+ 2016-10-17 Keith Marshall <kei...@us...>
+
+ Prepare and tag mingwrt-3.22.4 patch release.
+
+ * configure.ac (AC_INIT): Increment patch level.
+
+ 2016-10-17 Keith Marshall <kei...@us...>
+
+ Resolve an ANSI mode <string.h> vs. <wchar.h> conflict.
+
+ * include/wchar.h [!(_WCHAR_H && _STRING_H)]: Change condition...
+ [!(_WCHAR_H && (_STRING_H && !__STRICT_ANSI__))]: ...to this; the
+ guarded declarations are not exposed by including <string.h> when...
+ [__STRICT_ANSI__]: ...this is defined; hence, we must declare them
+ when including <wchar.h>, even after including <string.h>
+
+2016-10-14 Keith Marshall <kei...@us...>
+
+ Add dependency tracking for tests/Makefile.
+
+ * tests/Makefile.in (top_builddir): Define it.
+ (Makefile): Add automatic rebuild rule, tracking both srcdir and
+ top_builddir prerequisite changes.
+
+2016-10-14 Keith Marshall <kei...@us...>
+
+ Correct a minor typographic error.
+
+ * tests/atlocal.in (autoconf_input): Replace invalid AC_SUBST tag...
+ (configure_input): ...with this correctly named alternative.
+
+2016-10-14 Keith Marshall <kei...@us...>
+
+ Merge mingwrt-3.22.3 updates into 5.0-active branch.
+
+ * configure.ac: Preserve original 5.0-active state.
+ * include/_mingw.h.in include/string.h include/sys/types.h
+ * include/io.h: Update per 2016-10-13 commits.
+
2016-10-13 Keith Marshall <kei...@us...>
Prepare and tag mingwrt-3.22.3 patch release.
https://sf.net/p/mingw/mingw-org-wsl/ci/f1f19426a44d72d53625cdedadde367597545ee2/
commit f1f19426a44d72d53625cdedadde367597545ee2
Author: Keith Marshall <kei...@us...>
Date: Fri Oct 14 15:46:46 2016 +0100
Add dependency tracking for tests/Makefile.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 06e200f..9bea175 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,5 +1,13 @@
2016-10-14 Keith Marshall <kei...@us...>
+ Add dependency tracking for tests/Makefile.
+
+ * tests/Makefile.in (top_builddir): Define it.
+ (Makefile): Add automatic rebuild rule, tracking both srcdir and
+ top_builddir prerequisite changes.
+
+2016-10-14 Keith Marshall <kei...@us...>
+
Correct a minor typographic error.
* tests/atlocal.in (autoconf_input): Replace invalid AC_SUBST tag...
diff --git a/mingwrt/tests/Makefile.in b/mingwrt/tests/Makefile.in
index cbbd237..19ca799 100644
--- a/mingwrt/tests/Makefile.in
+++ b/mingwrt/tests/Makefile.in
@@ -29,6 +29,7 @@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
# The default rule is "check"; it is a synonym for the "check-recursive"
# request, from the parent directory's make process, which initiates the
@@ -43,6 +44,11 @@ check-local: testsuite
check-install: testsuite.install
check-pretest: testsuite.pretest headers.at.pretest
+vpath Makefile.in ${srcdir}
+vpath config.status ${top_builddir}
+Makefile: %: %.in config.status
+ cd ${top_builddir}; ./config.status $(notdir ${CURDIR})/$@
+
LN_S = @LN_S@
# Favour any copy of the testsuite which already exists in the build
https://sf.net/p/mingw/mingw-org-wsl/ci/1228fe8f7a29aa43f087c72c17d44395bf3b51a6/
commit 1228fe8f7a29aa43f087c72c17d44395bf3b51a6
Author: Keith Marshall <kei...@us...>
Date: Fri Oct 14 15:00:52 2016 +0100
Correct a minor typographic error.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 37c0efa..06e200f 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,5 +1,12 @@
2016-10-14 Keith Marshall <kei...@us...>
+ Correct a minor typographic error.
+
+ * tests/atlocal.in (autoconf_input): Replace invalid AC_SUBST tag...
+ (configure_input): ...with this correctly named alternative.
+
+2016-10-14 Keith Marshall <kei...@us...>
+
Merge mingwrt-3.22.3 updates into 5.0-active branch.
* configure.ac: Preserve original 5.0-active state.
diff --git a/mingwrt/tests/atlocal.in b/mingwrt/tests/atlocal.in
index 7ee21d3..82a36e4 100644
--- a/mingwrt/tests/atlocal.in
+++ b/mingwrt/tests/atlocal.in
@@ -1,4 +1,4 @@
-# @autoconf_input@
+# @configure_input@
#
# Autotest configuration template for MinGW.org Runtime Library Package
#
https://sf.net/p/mingw/mingw-org-wsl/ci/55eabac9897f4814feb7523898d0e854240a6d91/
commit 55eabac9897f4814feb7523898d0e854240a6d91
Author: Keith Marshall <kei...@us...>
Date: Fri Oct 14 14:41:44 2016 +0100
Make package installation prefix consistent throughout.
diff --git a/ChangeLog b/ChangeLog
index ee3de1a..a33f5aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-10-14 Keith Marshall <kei...@us...>
+
+ Make package installation prefix consistent throughout.
+
+ * configure.ac (AC_PREFIX_DEFAULT): Assign it; match it to...
+ * mingwrt/configure.ac w32api/configure.ac: ...these.
+
2016-07-19 Keith Marshall <kei...@us...>
Update install-sh to match mingw.org/build-aux package.
diff --git a/configure.ac b/configure.ac
index bdf0a4a..39303e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@
#
AC_PREREQ([2.64])
AC_INIT([MinGW System Libraries],[__VERSION__],[__BUG_REPORT_URL__],[wsl])
+ AC_PREFIX_DEFAULT([/mingw])
AC_PROG_MKDIR_P
AC_PATH_PROG([LN],[ln],[ln])
https://sf.net/p/mingw/mingw-org-wsl/ci/41eb88b2e179769d5f3ed19e9245da4c3691fa61/
commit 41eb88b2e179769d5f3ed19e9245da4c3691fa61
Merge: f5236db 16886ec
Author: Keith Marshall <kei...@us...>
Date: Fri Oct 14 14:21:59 2016 +0100
Merge mingwrt-3.22.3 updates into 5.0-active branch.
diff --cc .hgtags
index 66dcc91,5f2d424..2ec86b4
--- a/.hgtags
+++ b/.hgtags
@@@ -1,8 -1,8 +1,6 @@@
e6ff0d91cb5027521a314fd0c5eaaedcc7521c19 mingwrt-3.21-release
283116261e256a65a941ce62e80059843d4d8c51 mingwrt-3.21.1-release
--ef4db1b16b1422d4eb06cbe47f0f3c08e11d2f8d mingwrt-3.22-release
ef4db1b16b1422d4eb06cbe47f0f3c08e11d2f8d w32api-3.18-release
--ef4db1b16b1422d4eb06cbe47f0f3c08e11d2f8d mingwrt-3.22-release
b1ff7f59f95a8334245c7e7c07795514e55b6921 mingwrt-3.22-release
cd1bc4d018548b498e0e74e52bea935b0904d1f2 w32api-3.18.1-release
c42986e81e9ce0a5fcf8f09012f9d0f038032bac mingwrt-3.22.1-release
diff --cc mingwrt/ChangeLog
index d3ecf7f,d9ff374..37c0efa
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@@ -1,3 -1,44 +1,52 @@@
++2016-10-14 Keith Marshall <kei...@us...>
++
++ Merge mingwrt-3.22.3 updates into 5.0-active branch.
++
++ * configure.ac: Preserve original 5.0-active state.
++ * include/_mingw.h.in include/string.h include/sys/types.h
++ * include/io.h: Update per 2016-10-13 commits.
++
+ 2016-10-13 Keith Marshall <kei...@us...>
+
+ Prepare and tag mingwrt-3.22.3 patch release.
+
+ * configure.ac (AC_INIT): Increment patch level.
+
+ 2016-10-13 Keith Marshall <kei...@us...>
+
+ Emulate glibc <string.h> POSIX.1 non-compliance.
+
+ * include/_mingw.h.in (_EMULATE_GLIBC): New feature test macro.
+ [_GNU_SOURCE || _BSD_SOURCE || !__STRICT_ANSI__]: Enable it when...
+ [_XOPEN_SOURCE || _POSIX_C_SOURCE || _POSIX_SOURCE]: ...none of
+ these have been pre-defined by the user.
+
+ * include/string.h [_EMULATE_GLIBC]: Include <strings.h> in full...
+ (strcasecmp, strncasecmp): ...so prototypes for these are declared.
+ [!_EMULATE_GLIBC]: Preserve partial <strings.h> include, guarded by...
+ [__STRING_H_SOURCED__]: ...this context selector, so suppressing the
+ declarations of those function prototypes.
+
+ 2016-10-13 Keith Marshall <kei...@us...>
+
+ Resolve some non-ANSI typedef omissions.
+
+ * include/sys/types.h (off_t, ssize_t): Always typedef them when...
+ [_POSIX_C_SOURCE || !_NO_OLDNAMES]: ...either of these prevails.
+
+ * include/io.h (_fsize_t): Do not suppress its typedef when...
+ [__STRICT_ANSI__]: ...this compiler option applies, irrespective of...
+ [!(_IO_H && _WCHAR_H)]: ...this, which otherwise causes supression.
+
+ 2016-09-20 Keith Marshall <kei...@us...>
+
+ Prepare and tag mingwrt-3.22.2 patch release.
+
+ * configure.ac (AC_INIT): Increment patch level.
+ * config.guess config.sub: Delete, per 2016-07-16 commit.
+ * include/stdlib.h: Backport, per 2016-09-14 commit.
+ * include/wchar.h: Backport, per 2016-09-17 commits.
+
2016-09-17 Keith Marshall <kei...@us...>
Add missing <wchar.h> declarations when compiling C++.
-----------------------------------------------------------------------
Summary of changes:
.hgtags | 6 +-
ChangeLog | 7 +
configure.ac | 1 +
mingwrt/ChangeLog | 131 +++++++++++++++++
mingwrt/include/_mingw.h.in | 8 +
mingwrt/include/io.h | 38 ++++-
mingwrt/include/string.h | 15 ++-
mingwrt/include/sys/types.h | 18 ++-
mingwrt/include/wchar.h | 20 ++-
mingwrt/mingwex/stdio/pformat.c | 206 ++++++++++++++-------------
mingwrt/tests/Makefile.in | 10 ++-
mingwrt/tests/ansiprintf.at | 298 +++++++++++++++++++++++++++++++++++++++
mingwrt/tests/atlocal.in | 2 +-
mingwrt/tests/testsuite.at.in | 1 +
14 files changed, 634 insertions(+), 127 deletions(-)
create mode 100644 mingwrt/tests/ansiprintf.at
hooks/post-receive
--
Repository: mingw-org-wsl
|
|
From: Keith M. <no...@so...> - 2016-11-02 19:33:43
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The tag, mingwrt-3.22.4-release has been created
at 89581f43949c2a7358e0e886dff3af6b9632869b (commit)
- Log -----------------------------------------------------------------
commit 89581f43949c2a7358e0e886dff3af6b9632869b
Author: Keith Marshall <kei...@us...>
Date: Mon Oct 17 22:25:34 2016 +0100
Prepare and tag mingwrt-3.22.4 patch release.
-----------------------------------------------------------------------
hooks/post-receive
--
Repository: mingw-org-wsl
|
|
From: Keith M. <no...@so...> - 2016-11-02 19:33:41
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, legacy has been updated
via 5fe5d0aa874341cc015b0b71f5b5a6d9f3de8e7d (commit)
via 368f7458251031d44d4debe1cf4b0488d82b5ede (commit)
via 022f01137f06bea7f9f34eab8b4c1acc2a03f7a0 (commit)
from 59b93789d30cec514fda088b71bbd06e4feb9b9d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
mingwrt/ChangeLog | 29 ++++++
mingwrt/include/io.h | 34 ++++++-
mingwrt/include/wchar.h | 4 +-
mingwrt/mingwex/stdio/pformat.c | 206 ++++++++++++++++++++-------------------
4 files changed, 166 insertions(+), 107 deletions(-)
hooks/post-receive
--
Repository: mingw-org-wsl
|