OSDN Git Service

Deprecate obsolete <winable.h> and <pbt.h> headers.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 26 Nov 2016 22:35:10 +0000 (22:35 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 26 Nov 2016 22:35:10 +0000 (22:35 +0000)
w32api/ChangeLog
w32api/Makefile.in
w32api/include/obsolete.h.in [new file with mode: 0644]
w32api/include/pbt.h [deleted file]
w32api/include/winable.h [deleted file]

index bae99c6..8313972 100644 (file)
@@ -1,3 +1,17 @@
+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].
index 97d28b1..da832cc 100644 (file)
@@ -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 (file)
index 0000000..a69b561
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * %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 */
diff --git a/w32api/include/pbt.h b/w32api/include/pbt.h
deleted file mode 100644 (file)
index 21cb1cd..0000000
+++ /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 (file)
index 0228293..0000000
+++ /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