+2016-11-26 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ 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 <keithmarshall@users.sourceforge.net>
Update <winuser.h> and <dbt.h>; fix issue [#2317].
# 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
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
--- /dev/null
+/*
+ * %HEADER%
+ *
+ * Obsolete header replaced by <%REPLACEMENT%>; this stub is retained for
+ * backward compatibility only.
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+ * 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 */
+++ /dev/null
-#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
+++ /dev/null
-#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