From 8a57173ec2f0d562c12e815573132249e88f1a06 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Fri, 31 Aug 2012 01:17:46 +0200 Subject: [PATCH] Introduce We need ANSI C prototypes of certain Motif functions that are not published in the official header files. header file contains the prototypes extracted from the Motif source. To re-create : 1) Make sure you have sources of libXm (lib/Xm directory of the Motif distribution) accessible via imports/motif/lib/Xm 2) rm include/Xm/XmPrivate.h 3) make includes --- cde/include/Imakefile | 4 + cde/include/Xm/Imakefile | 23 +++++ cde/include/Xm/XmPrivate.h | 129 ++++++++++++++++++++++++++++ cde/include/Xm/extractprototype.awk | 57 ++++++++++++ 4 files changed, 213 insertions(+) create mode 100644 cde/include/Xm/Imakefile create mode 100644 cde/include/Xm/XmPrivate.h create mode 100644 cde/include/Xm/extractprototype.awk diff --git a/cde/include/Imakefile b/cde/include/Imakefile index 174309c5..d6fe5b9d 100644 --- a/cde/include/Imakefile +++ b/cde/include/Imakefile @@ -1,7 +1,11 @@ XCOMM $TOG: Imakefile /main/4 1997/07/09 10:03:24 samborn $ #define PassCDebugFlags /**/ +#define IHaveSubdirs HEADERS = hpversion.h EUSCompat.h +SUBDIRS = Xm + +MakeSubdirs($(SUBDIRS)) all:: diff --git a/cde/include/Xm/Imakefile b/cde/include/Xm/Imakefile new file mode 100644 index 00000000..b1b15ced --- /dev/null +++ b/cde/include/Xm/Imakefile @@ -0,0 +1,23 @@ +XCOMM +XCOMM Generate XmPrivate.h containing ANSI C +XCOMM function prototypes extracted from the private +XCOMM include headers files +XCOMM +XCOMM libXm source from Motif (lib/Xm subdirectory) +XCOMM needs to be available in ../../imports/motif/lib/Xm +XCOMM + +HEADERS = XmPrivate.h +ALLHEADERS = *.h + +includes:: $(HEADERS) + +BuildIncludes($(HEADERS),Xm,..) + +XmPrivate.h: extractprototype.awk + awk -f extractprototype.awk $(MLIBSRC)/Xm/$(ALLHEADERS) > $@ + +depend:: + +clean:: + diff --git a/cde/include/Xm/XmPrivate.h b/cde/include/Xm/XmPrivate.h new file mode 100644 index 00000000..65cb9a5d --- /dev/null +++ b/cde/include/Xm/XmPrivate.h @@ -0,0 +1,129 @@ +/* + * + * PRIVATE MOTIF FUNCTIONS + * Declarations extracted from Open Motif header files + * + */ + +#include +#ifdef __cplusplus +extern "C" { +#endif +/* Extracted from BaseClassI.h */ +extern void _XmPushWidgetExtData( + Widget widget, + XmWidgetExtData data, +#if NeedWidePrototypes + unsigned int extType) ; +#else + unsigned char extType) ; +#endif /* NeedWidePrototypes */ +extern void _XmPopWidgetExtData( + Widget widget, + XmWidgetExtData *dataRtn, +#if NeedWidePrototypes + unsigned int extType) ; +#else + unsigned char extType) ; +#endif /* NeedWidePrototypes */ +/* Extracted from MenuStateI.h */ +extern void _XmSetInDragMode( + Widget widget, +#if NeedWidePrototypes + int mode) ; +#else + Boolean mode) ; +#endif /* NeedWidePrototypes */ +/* Extracted from MenuUtilI.h */ +extern int _XmGrabPointer( + Widget widget, + int owner_events, + unsigned int event_mask, + int pointer_mode, + int keyboard_mode, + Window confine_to, + Cursor cursor, + Time time) ; +/* Extracted from SyntheticI.h */ +extern void _XmExtGetValuesHook( + Widget w, + ArgList args, + Cardinal *num_args) ; +extern void _XmGadgetImportSecondaryArgs( + Widget w, + ArgList args, + Cardinal *num_args) ; +/* Extracted from TextStrSoI.h */ +extern char * _XmStringSourceGetString(XmTextWidget tw, + XmTextPosition from, + XmTextPosition to, +#if NeedWidePrototypes + int want_wchar); +#else + Boolean want_wchar); +#endif /* NeedWidePrototypes */ +/* Extracted from TravActI.h */ +extern void _XmEnterGadget( + Widget wid, + XEvent *event, + String *params, + Cardinal *num_params) ; +extern void _XmLeaveGadget( + Widget wid, + XEvent *event, + String *params, + Cardinal *num_params) ; +extern void _XmFocusInGadget( + Widget wid, + XEvent *event, + String *params, + Cardinal *num_params) ; +extern void _XmFocusOutGadget( + Widget wid, + XEvent *event, + String *params, + Cardinal *num_params) ; +/* Extracted from TraversalI.h */ +extern Boolean _XmFocusIsHere( + Widget w) ; +extern Boolean _XmShellIsExclusive( + Widget wid) ; +/* Extracted from UniqueEvnI.h */ +extern Boolean _XmIsEventUnique(XEvent *event) ; +/* Extracted from VendorSI.h */ +extern void _XmAddGrab( + Widget wid, +#if NeedWidePrototypes + int exclusive, + int spring_loaded) ; +#else + Boolean exclusive, + Boolean spring_loaded) ; +#endif /* NeedWidePrototypes */ +extern void _XmRemoveGrab( + Widget wid) ; +/* Extracted from XmI.h */ +extern void _XmSocorro( + Widget w, + XEvent *event, + String *params, + Cardinal *num_params) ; +extern void _XmClearShadowType( + Widget w, +#if NeedWidePrototypes + int old_width, + int old_height, + int old_shadow_thickness, + int old_highlight_thickness) ; +#else + Dimension old_width, + Dimension old_height, + Dimension old_shadow_thickness, + Dimension old_highlight_thickness) ; +#endif /* NeedWidePrototypes */ +#ifdef __cplusplus +} +#endif +/************************************************************* + * END OF EXTRACTED DATA + *************************************************************/ diff --git a/cde/include/Xm/extractprototype.awk b/cde/include/Xm/extractprototype.awk new file mode 100644 index 00000000..b3b23ca1 --- /dev/null +++ b/cde/include/Xm/extractprototype.awk @@ -0,0 +1,57 @@ +BEGIN { + curfile = FILENAME; + s = ""; for (i = 0; i < 60; i++) s = s "*"; + printf("/*\n *\n * PRIVATE MOTIF FUNCTIONS\n"); + printf(" * Declarations extracted from Open Motif header files\n *\n */\n\n", s); + printf("#include \n"); + printf("#ifdef __cplusplus\nextern \"C\" {\n#endif\n"); +} +END { + printf("#ifdef __cplusplus\n}\n#endif\n"); + printf("/*%s\n * END OF EXTRACTED DATA\n *%s/\n", s, s); +} +function proto() { + if ($0 ~ /extern/) { + pattern = 0; + do { + line = $0; + if (line ~ /#if/) { + pattern = 1; + } + if (curfile != FILENAME) { + n = FILENAME; + sub(/.*\//, "", n); + printf("/* Extracted from %s */\n", n); + curfile = FILENAME; + } + print line; + getline; + if ( pattern == 0) { + terminate = (line ~ /;/); + } else { + terminate = (line ~ /^#.*endif/); + } + } while (!terminate); + } +} +/_XmClearShadowType/ { proto(); } +/_XmShellIsExclusive/ { proto(); } +/_XmGrabKeyboard/ { proto(); } +/_XmFocusIsHere/ { proto(); } +/_XmAddGrab/ { proto(); } +/_XmGrabPointer/ { proto(); } +/_XmRemoveGrab/ { proto(); } +/_XmEnterGadget/ { proto(); } +/_XmLeaveGadget/ { proto(); } +/_XmPushWidgetExtData/ { proto(); } +/_XmPopWidgetExtData/ { proto(); } +/_XmGadgetImportSecondaryArgs/ { proto(); } +/_XmExtImportArgs/ { proto(); } +/_XmExtGetValuesHook/ { proto(); } +/_XmSocorro/ { proto(); } +/_XmFocusInGadget/ { proto(); } +/_XmFocusOutGadget/ { proto(); } +/_XmIsEventUnique/ { proto(); } +/_XmSetInDragMode/ { proto(); } +/_XmStringSourceGetString/ { proto(); } +/_XmShellIsExclusive/ { proto(); } -- 2.25.1