summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-17 19:03:41 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-17 19:03:41 +0000
commitd1f2ce614cc22280b8771fd152034ad72dda557a (patch)
treecb45f3ee9fb029bd1a25da1b605491bcfd1a6d3f
parent709dda59a506e0c4ad17b085aa381f35cd86176f (diff)
merge XFree86 4.3.0.1 to -CURRENT
-rw-r--r--include/X11/Xmu/Atoms.h62
-rw-r--r--include/X11/Xmu/CharSet.h53
-rw-r--r--include/X11/Xmu/CloseHook.h56
-rw-r--r--include/X11/Xmu/Converters.h345
-rw-r--r--include/X11/Xmu/CurUtil.h10
-rw-r--r--include/X11/Xmu/CvtCache.h13
-rw-r--r--include/X11/Xmu/DisplayQue.h82
-rw-r--r--include/X11/Xmu/Drawing.h223
-rw-r--r--include/X11/Xmu/Editres.h9
-rw-r--r--include/X11/Xmu/EditresP.h111
-rw-r--r--include/X11/Xmu/Error.h27
-rw-r--r--include/X11/Xmu/ExtAgent.h17
-rw-r--r--include/X11/Xmu/Initer.h28
-rw-r--r--include/X11/Xmu/StdCmap.h143
-rw-r--r--include/X11/Xmu/StdSel.h26
-rw-r--r--include/X11/Xmu/SysUtil.h20
-rw-r--r--include/X11/Xmu/WidgetNode.h57
-rw-r--r--include/X11/Xmu/WinUtil.h34
-rw-r--r--include/X11/Xmu/Xct.h41
-rw-r--r--include/X11/Xmu/Xmu.h83
-rw-r--r--src/AllCmap.c18
-rw-r--r--src/Atoms.c36
-rw-r--r--src/ClientWin.c30
-rw-r--r--src/CloseHook.c48
-rw-r--r--src/CmapAlloc.c61
-rw-r--r--src/CrCmap.c145
-rw-r--r--src/CrPixFBit.c23
-rw-r--r--src/CursorName.c26
-rw-r--r--src/CvtCache.c35
-rw-r--r--src/CvtStdSel.c53
-rw-r--r--src/DefErrMsg.c25
-rw-r--r--src/DelCmap.c12
-rw-r--r--src/DisplayQue.c42
-rw-r--r--src/Distinct.c17
-rw-r--r--src/DrRndRect.c145
-rw-r--r--src/DrawLogo.c12
-rw-r--r--src/EditresCom.c2221
-rw-r--r--src/ExtAgent.c9
-rw-r--r--src/FToCback.c9
-rw-r--r--src/GetHost.c12
-rw-r--r--src/GrayPixmap.c13
-rw-r--r--src/Initer.c50
-rw-r--r--src/LocBitmap.c95
-rw-r--r--src/Lookup.c133
-rw-r--r--src/LookupCmap.c84
-rw-r--r--src/Lower.c180
-rw-r--r--src/RdBitF.c67
-rw-r--r--src/ScrOfWin.c8
-rw-r--r--src/ShapeWidg.c261
-rw-r--r--src/StdCmap.c43
-rw-r--r--src/StrToBS.c136
-rw-r--r--src/StrToBmap.c9
-rw-r--r--src/StrToCurs.c52
-rw-r--r--src/StrToGrav.c97
-rw-r--r--src/StrToJust.c120
-rw-r--r--src/StrToLong.c61
-rw-r--r--src/StrToOrnt.c112
-rw-r--r--src/StrToShap.c94
-rw-r--r--src/StrToWidg.c123
-rw-r--r--src/UpdMapHint.c8
-rw-r--r--src/VisCmap.c25
-rw-r--r--src/WidgetNode.c107
-rw-r--r--src/Xct.c71
-rw-r--r--src/sharedlib.c4
64 files changed, 3639 insertions, 2733 deletions
diff --git a/include/X11/Xmu/Atoms.h b/include/X11/Xmu/Atoms.h
index 53c16b3..64b6b08 100644
--- a/include/X11/Xmu/Atoms.h
+++ b/include/X11/Xmu/Atoms.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Atoms.h,v 1.7 2001/12/14 19:55:33 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -61,7 +62,8 @@ extern AtomPtr
_XA_TARGETS,
_XA_TEXT,
_XA_TIMESTAMP,
- _XA_USER;
+ _XA_USER,
+ _XA_UTF8_STRING;
#define XA_ATOM_PAIR(d) XmuInternAtom(d, _XA_ATOM_PAIR)
#define XA_CHARACTER_POSITION(d) XmuInternAtom(d, _XA_CHARACTER_POSITION)
@@ -85,43 +87,39 @@ extern AtomPtr
#define XA_TEXT(d) XmuInternAtom(d, _XA_TEXT)
#define XA_TIMESTAMP(d) XmuInternAtom(d, _XA_TIMESTAMP)
#define XA_USER(d) XmuInternAtom(d, _XA_USER)
+#define XA_UTF8_STRING(d) XmuInternAtom(d, _XA_UTF8_STRING)
_XFUNCPROTOBEGIN
-extern char *XmuGetAtomName(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- Atom /* atom */
-#endif
+char *XmuGetAtomName
+(
+ Display *dpy,
+ Atom atom
+ );
+
+Atom XmuInternAtom
+(
+ Display *dpy,
+ AtomPtr atom_ptr
+ );
+
+void XmuInternStrings
+(
+ Display *dpy,
+ String *names,
+ Cardinal count,
+ Atom *atoms_return
);
-extern Atom XmuInternAtom(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- AtomPtr /* atom_ptr */
-#endif
-);
-
-extern void XmuInternStrings(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- String * /* names */,
- Cardinal /* count */,
- Atom * /* atoms_return */
-#endif
-);
+AtomPtr XmuMakeAtom
+(
+ _Xconst char *name
+ );
-extern AtomPtr XmuMakeAtom(
-#if NeedFunctionPrototypes
- _Xconst char * /* name */
-#endif
-);
-
-extern char *XmuNameOfAtom(
-#if NeedFunctionPrototypes
- AtomPtr /* atom_ptr */
-#endif
-);
+char *XmuNameOfAtom
+(
+ AtomPtr atom_ptr
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/CharSet.h b/include/X11/Xmu/CharSet.h
index e017458..dfecf45 100644
--- a/include/X11/Xmu/CharSet.h
+++ b/include/X11/Xmu/CharSet.h
@@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CharSet.h,v 1.8 2001/12/14 19:55:33 dawes Exp $ */
+
/*
* The interfaces described by this header file are for miscellaneous utilities
* and are not part of the Xlib standard.
@@ -38,26 +40,37 @@ in this Software without prior written authorization from The Open Group.
_XFUNCPROTOBEGIN
-extern void XmuCopyISOLatin1Lowered(
-#if NeedFunctionPrototypes
- char * /* dst_return */,
- _Xconst char * /* src */
-#endif
-);
-
-extern void XmuCopyISOLatin1Uppered(
-#if NeedFunctionPrototypes
- char * /* dst_return */,
- _Xconst char * /* src */
-#endif
-);
-
-extern int XmuCompareISOLatin1(
-#if NeedFunctionPrototypes
- _Xconst char * /* first */,
- _Xconst char * /* second */
-#endif
-);
+void XmuCopyISOLatin1Lowered
+(
+ char *dst_return,
+ _Xconst char *src
+ );
+
+void XmuCopyISOLatin1Uppered
+(
+ char *dst_return,
+ _Xconst char *src
+ );
+
+int XmuCompareISOLatin1
+(
+ _Xconst char *first,
+ _Xconst char *second
+ );
+
+void XmuNCopyISOLatin1Lowered
+(
+ char *dst_return,
+ _Xconst char *src,
+ int size
+ );
+
+void XmuNCopyISOLatin1Uppered
+(
+ char *dst_return,
+ _Xconst char *src,
+ int size
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/CloseHook.h b/include/X11/Xmu/CloseHook.h
index b69290a..971a763 100644
--- a/include/X11/Xmu/CloseHook.h
+++ b/include/X11/Xmu/CloseHook.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CloseHook.h,v 1.7 2001/12/14 19:55:35 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -36,43 +37,36 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xlib.h>
#include <X11/Xfuncproto.h>
+#include <X11/Xlibint.h>
typedef XPointer CloseHook;
-typedef int (*XmuCloseHookProc)(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XPointer /* data */
-#endif
-);
+typedef int (*XmuCloseHookProc)(Display *dpy, XPointer data);
_XFUNCPROTOBEGIN
-extern CloseHook XmuAddCloseDisplayHook(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- XmuCloseHookProc /* proc */,
- XPointer /* arg */
-#endif
-);
-
-extern Bool XmuLookupCloseDisplayHook(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- CloseHook /* handle */,
- XmuCloseHookProc /* proc */,
- XPointer /* arg */
-#endif
-);
-
-extern Bool XmuRemoveCloseDisplayHook(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- CloseHook /* handle */,
- XmuCloseHookProc /* proc */,
- XPointer /* arg */
-#endif
-);
+CloseHook XmuAddCloseDisplayHook
+(
+ Display *dpy,
+ XmuCloseHookProc proc,
+ XPointer arg
+ );
+
+Bool XmuLookupCloseDisplayHook
+(
+ Display *dpy,
+ CloseHook handle,
+ XmuCloseHookProc proc,
+ XPointer arg
+ );
+
+Bool XmuRemoveCloseDisplayHook
+(
+ Display *dpy,
+ CloseHook handle,
+ XmuCloseHookProc proc,
+ XPointer arg
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Converters.h b/include/X11/Xmu/Converters.h
index 3b3a448..fa1be53 100644
--- a/include/X11/Xmu/Converters.h
+++ b/include/X11/Xmu/Converters.h
@@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Converters.h,v 1.6 2001/12/14 19:55:35 dawes Exp $ */
+
/*
* The interfaces described by this header file are for miscellaneous utilities
* and are not part of the Xlib standard.
@@ -39,26 +41,14 @@ in this Software without prior written authorization from The Open Group.
_XFUNCPROTOBEGIN
-/*
- * Converters - insert in alphabetical order
- */
-
-/******************************************************************************
- * XmuCvtFunctionToCallback
- */
-extern void XmuCvtFunctionToCallback(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-
+void XmuCvtFunctionToCallback
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
-/******************************************************************************
- * XmuCvtStringToBackingStore
- */
#define XtNbackingStore "backingStore"
#define XtCBackingStore "BackingStore"
#define XtRBackingStore "BackingStore"
@@ -66,46 +56,45 @@ extern void XmuCvtFunctionToCallback(
#define XtEwhenMapped "whenMapped"
#define XtEalways "always"
#define XtEdefault "default"
-extern void XmuCvtStringToBackingStore(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-
-
-/******************************************************************************
- * XmuCvtStringToCursor
- */
-extern void XmuCvtStringToCursor(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-extern Boolean XmuCvtStringToColorCursor(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* converter_data */
-#endif
-);
+void XmuCvtStringToBackingStore
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
+
+Boolean XmuCvtBackingStoreToString
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
+
+void XmuCvtStringToCursor
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
#define XtRColorCursor "ColorCursor"
#define XtNpointerColor "pointerColor"
#define XtNpointerColorBackground "pointerColorBackground"
+Boolean XmuCvtStringToColorCursor
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
-
-/******************************************************************************
- * XmuCvtStringToGravity
- */
typedef int XtGravity;
#ifndef XtRGravity
@@ -123,86 +112,102 @@ typedef int XtGravity;
#define XtESouthEast "southeast"
#define XtEStatic "static"
#define XtEUnmap "unmap"
+void XmuCvtStringToGravity
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
+
+Boolean XmuCvtGravityToString
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
-extern void XmuCvtStringToGravity (
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-
-
-/******************************************************************************
- * XmuCvtStringToJustify
- */
typedef enum {
XtJustifyLeft, /* justify text to left side of button */
XtJustifyCenter, /* justify text in center of button */
XtJustifyRight /* justify text to right side of button */
} XtJustify;
+#ifndef XtRJustify
+#define XtRJustify "Justify"
+#endif
#define XtEleft "left"
#define XtEcenter "center"
#define XtEright "right"
#define XtEtop "top"
#define XtEbottom "bottom"
+void XmuCvtStringToJustify
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
+
+Boolean XmuCvtJustifyToString
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
-extern void XmuCvtStringToJustify(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-
-
-/******************************************************************************
- * XmuCvtStringToLong
- */
#define XtRLong "Long"
-extern void XmuCvtStringToLong(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-
-
-/******************************************************************************
- * XmuCvtStringToOrientation
- */
-typedef enum {XtorientHorizontal, XtorientVertical} XtOrientation;
-extern void XmuCvtStringToOrientation(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-
-
-/******************************************************************************
- * XmuCvtStringToBitmap
- */
-extern void XmuCvtStringToBitmap(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
+void XmuCvtStringToLong
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
+Boolean XmuCvtLongToString
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
-
-/******************************************************************************
- * XmuCvtStringToShapeStyle; is XtTypeConverter (i.e. new style)
- * no conversion arguments, not particularly useful to cache the results.
- */
+typedef enum {
+ XtorientHorizontal,
+ XtorientVertical
+} XtOrientation;
+void XmuCvtStringToOrientation
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
+
+Boolean XmuCvtOrientationToString
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
+
+void XmuCvtStringToBitmap
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
#define XtRShapeStyle "ShapeStyle"
#define XtERectangle "Rectangle"
@@ -215,51 +220,61 @@ extern void XmuCvtStringToBitmap(
#define XmuShapeEllipse 3
#define XmuShapeRoundedRectangle 4
-extern Boolean XmuCvtStringToShapeStyle(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* converter_data */
-#endif
-);
-
-extern Boolean XmuReshapeWidget(
-#if NeedFunctionPrototypes
- Widget /* w */,
- int /* shape_style */,
- int /* corner_width */,
- int /* corner_height */
-#endif
-);
-
-/******************************************************************************
- * XmuCvtStringToWidget
- */
-extern void XmuCvtStringToWidget(
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */
-#endif
-);
-
-/******************************************************************************
- * XmuNewCvtStringToWidget
- */
-extern Boolean XmuNewCvtStringToWidget(
-#if NeedFunctionPrototypes
- Display* /* display */,
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValue* /* fromVal */,
- XrmValue* /* toVal */,
- XtPointer* /* converter_data */
-#endif
-);
+Boolean XmuCvtStringToShapeStyle
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
+
+Boolean XmuCvtShapeStyleToString
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal,
+ XtPointer *converter_data
+ );
+
+Boolean XmuReshapeWidget
+(
+ Widget w,
+ int shape_style,
+ int corner_width,
+ int corner_height
+ );
+
+void XmuCvtStringToWidget
+(
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValuePtr fromVal,
+ XrmValuePtr toVal
+ );
+
+Boolean XmuNewCvtStringToWidget
+(
+ Display *display,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValue *fromVal,
+ XrmValue *toVal,
+ XtPointer *converter_data
+ );
+
+Boolean XmuCvtWidgetToString
+(
+ Display *dpy,
+ XrmValue *args,
+ Cardinal *num_args,
+ XrmValue *fromVal,
+ XrmValue *toVal,
+ XtPointer *converter_data
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/CurUtil.h b/include/X11/Xmu/CurUtil.h
index 5ac79fc..f819013 100644
--- a/include/X11/Xmu/CurUtil.h
+++ b/include/X11/Xmu/CurUtil.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CurUtil.h,v 1.6 2001/12/14 19:55:38 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -38,11 +39,10 @@ in this Software without prior written authorization from The Open Group.
_XFUNCPROTOBEGIN
-extern int XmuCursorNameToIndex(
-#if NeedFunctionPrototypes
- _Xconst char* /* name */
-#endif
-);
+int XmuCursorNameToIndex
+(
+ _Xconst char *name
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/CvtCache.h b/include/X11/Xmu/CvtCache.h
index db020e7..06cf162 100644
--- a/include/X11/Xmu/CvtCache.h
+++ b/include/X11/Xmu/CvtCache.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CvtCache.h,v 1.7 2001/12/14 19:55:39 dawes Exp $ */
/*
* Public Interfaces
@@ -48,11 +49,13 @@ typedef struct _XmuCvtCache {
_XFUNCPROTOBEGIN
-extern XmuCvtCache *_XmuCCLookupDisplay(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
+XmuCvtCache *_XmuCCLookupDisplay
+(
+ Display *dpy
+ );
+
+extern void _XmuStringToBitmapInitCache(XmuCvtCache *c);
+extern void _XmuStringToBitmapFreeCache(XmuCvtCache *c);
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/DisplayQue.h b/include/X11/Xmu/DisplayQue.h
index 57bb7a5..65c566e 100644
--- a/include/X11/Xmu/DisplayQue.h
+++ b/include/X11/Xmu/DisplayQue.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/DisplayQue.h,v 1.6 2001/12/14 19:55:40 dawes Exp $ */
#ifndef _XMU_DISPLAYQUE_H_
#define _XMU_DISPLAYQUE_H_
@@ -93,18 +94,10 @@ in this Software without prior written authorization from The Open Group.
typedef struct _XmuDisplayQueue XmuDisplayQueue;
typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry;
-typedef int (*XmuCloseDisplayQueueProc)(
-#if NeedFunctionPrototypes
- XmuDisplayQueue* /* queue */,
- XmuDisplayQueueEntry* /* entry */
-#endif
-);
+typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue,
+ XmuDisplayQueueEntry *entry);
-typedef int (*XmuFreeDisplayQueueProc)(
-#if NeedFunctionPrototypes
- XmuDisplayQueue* /* queue */
-#endif
-);
+typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue);
struct _XmuDisplayQueueEntry {
struct _XmuDisplayQueueEntry *prev, *next;
@@ -123,42 +116,37 @@ struct _XmuDisplayQueue {
_XFUNCPROTOBEGIN
-extern XmuDisplayQueue *XmuDQCreate(
-#if NeedFunctionPrototypes
- XmuCloseDisplayQueueProc /* closefunc */,
- XmuFreeDisplayQueueProc /* freefunc */,
- XPointer /* data */
-#endif
-);
-
-extern Bool XmuDQDestroy(
-#if NeedFunctionPrototypes
- XmuDisplayQueue* /* q */,
- Bool /* docallbacks */
-#endif
-);
-
-extern XmuDisplayQueueEntry *XmuDQLookupDisplay(
-#if NeedFunctionPrototypes
- XmuDisplayQueue* /* q */,
- Display* /* dpy */
-#endif
-);
-
-extern XmuDisplayQueueEntry *XmuDQAddDisplay(
-#if NeedFunctionPrototypes
- XmuDisplayQueue* /* q */,
- Display* /* dpy */,
- XPointer /* data */
-#endif
-);
-
-extern Bool XmuDQRemoveDisplay(
-#if NeedFunctionPrototypes
- XmuDisplayQueue* /* q */,
- Display* /* dpy */
-#endif
-);
+XmuDisplayQueue *XmuDQCreate
+(
+ XmuCloseDisplayQueueProc closefunc,
+ XmuFreeDisplayQueueProc freefunc,
+ XPointer data
+ );
+
+Bool XmuDQDestroy
+(
+ XmuDisplayQueue *q,
+ Bool docallbacks
+ );
+
+XmuDisplayQueueEntry *XmuDQLookupDisplay
+(
+ XmuDisplayQueue *q,
+ Display *dpy
+ );
+
+XmuDisplayQueueEntry *XmuDQAddDisplay
+(
+ XmuDisplayQueue *q,
+ Display *dpy,
+ XPointer data
+ );
+
+Bool XmuDQRemoveDisplay
+(
+ XmuDisplayQueue *q,
+ Display *dpy
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Drawing.h b/include/X11/Xmu/Drawing.h
index 3aee8d7..587fb3e 100644
--- a/include/X11/Xmu/Drawing.h
+++ b/include/X11/Xmu/Drawing.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Drawing.h,v 1.6 2001/12/14 19:55:42 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -46,126 +47,116 @@ typedef unsigned long Pixel;
_XFUNCPROTOBEGIN
-extern void XmuDrawRoundedRectangle(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Drawable /* draw */,
- GC /* gc */,
- int /* x */,
- int /* y */,
- int /* w */,
- int /* h */,
- int /* ew */,
- int /* eh */
-#endif
-);
-
-extern void XmuFillRoundedRectangle(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Drawable /* draw */,
- GC /* gc */,
- int /* x */,
- int /* y */,
- int /* w */,
- int /* h */,
- int /* ew */,
- int /* eh */
-#endif
-);
-
-extern void XmuDrawLogo(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Drawable /* drawable */,
- GC /* gcFore */,
- GC /* gcBack */,
- int /* x */,
- int /* y */,
- unsigned int /* width */,
- unsigned int /* height */
-#endif
+void XmuDrawRoundedRectangle
+(
+ Display *dpy,
+ Drawable draw,
+ GC gc,
+ int x,
+ int y,
+ int w,
+ int h,
+ int ew,
+ int eh
+ );
+
+void XmuFillRoundedRectangle
+(
+ Display *dpy,
+ Drawable draw,
+ GC gc,
+ int x,
+ int y,
+ int w,
+ int h,
+ int ew,
+ int eh
+ );
+
+void XmuDrawLogo
+(
+ Display *dpy,
+ Drawable drawable,
+ GC gcFore,
+ GC gcBack,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height
+ );
+
+Pixmap XmuCreatePixmapFromBitmap
+(
+ Display *dpy,
+ Drawable d,
+ Pixmap bitmap,
+ unsigned int width,
+ unsigned int height,
+ unsigned int depth,
+ unsigned long fore,
+ unsigned long back
);
-extern Pixmap XmuCreatePixmapFromBitmap(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Drawable /* d */,
- Pixmap /* bitmap */,
- unsigned int /* width */,
- unsigned int /* height */,
- unsigned int /* depth */,
- unsigned long /* fore */,
- unsigned long /* back */
-#endif
+Pixmap XmuCreateStippledPixmap
+(
+ Screen *screen,
+ Pixel fore,
+ Pixel back,
+ unsigned int depth
+ );
+
+void XmuReleaseStippledPixmap
+(
+ Screen *screen,
+ Pixmap pixmap
+ );
+
+Pixmap XmuLocateBitmapFile
+(
+ Screen *screen,
+ _Xconst char *name,
+ char *srcname_return,
+ int srcnamelen,
+ int *width_return,
+ int *height_return,
+ int *xhot_return,
+ int *yhot_return
+ );
+
+Pixmap XmuLocatePixmapFile
+(
+ Screen *screen,
+ _Xconst char *name,
+ unsigned long fore,
+ unsigned long back,
+ unsigned int depth,
+ char *srcname_return,
+ int srcnamelen,
+ int *width_return,
+ int *height_return,
+ int *xhot_return,
+ int *yhot_return
+ );
+
+int XmuReadBitmapData
+(
+ FILE *fstream,
+ unsigned int *width_return,
+ unsigned int *height_return,
+ unsigned char **datap_return,
+ int *xhot_return,
+ int *yhot_return
);
-extern Pixmap XmuCreateStippledPixmap(
-#if NeedFunctionPrototypes
- Screen* /* screen */,
- Pixel /* fore */,
- Pixel /* back */,
- unsigned int /* depth */
-#endif
-);
-
-extern void XmuReleaseStippledPixmap(
-#if NeedFunctionPrototypes
- Screen* /* screen */,
- Pixmap /* pixmap */
-#endif
-);
-
-extern Pixmap XmuLocateBitmapFile(
-#if NeedFunctionPrototypes
- Screen* /* screen */,
- _Xconst char* /* name */,
- char* /* srcname_return */,
- int /* srcnamelen */,
- int* /* width_return */,
- int* /* height_return, */,
- int* /* xhot_return */,
- int* /* yhot_return */
-#endif
-);
-
-extern Pixmap XmuLocatePixmapFile(
-#if NeedFunctionPrototypes
- Screen* /* screen */,
- _Xconst char* /* name */,
- unsigned long /* fore */,
- unsigned long /* back */,
- unsigned int /* depth */,
- char* /* srcname_return */,
- int /* srcnamelen */,
- int* /* width_return */,
- int* /* height_return, */,
- int* /* xhot_return */,
- int* /* yhot_return */
-#endif
-);
-
-extern int XmuReadBitmapData(
-#if NeedFunctionPrototypes
- FILE* /* fstream */,
- unsigned int* /* width_return */,
- unsigned int* /* height_return */,
- unsigned char** /* datap_return */,
- int* /* xhot_return */,
- int* /* yhot_return */
-#endif
-);
-
-extern int XmuReadBitmapDataFromFile(
-#if NeedFunctionPrototypes
- _Xconst char* /* filename */,
- unsigned int* /* width_return */,
- unsigned int* /* height_return */,
- unsigned char** /* datap_return */,
- int* /* xhot_return */,
- int* /* yhot_return */
-#endif
-);
+int XmuReadBitmapDataFromFile
+(
+ _Xconst char *filename,
+ unsigned int *width_return,
+ unsigned int *height_return,
+ unsigned char **datap_return,
+ int *xhot_return,
+ int *yhot_return
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Editres.h b/include/X11/Xmu/Editres.h
index 94e0b3b..2b2eddb 100644
--- a/include/X11/Xmu/Editres.h
+++ b/include/X11/Xmu/Editres.h
@@ -25,11 +25,18 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Editres.h,v 1.6 2001/12/14 19:55:43 dawes Exp $ */
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
-void _XEditResCheckMessages();
+void _XEditResCheckMessages
+(
+ Widget w,
+ XtPointer data,
+ XEvent *event,
+ Boolean *cont
+);
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/EditresP.h b/include/X11/Xmu/EditresP.h
index 44dfd38..b65b1c1 100644
--- a/include/X11/Xmu/EditresP.h
+++ b/include/X11/Xmu/EditresP.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/EditresP.h,v 1.6 2001/12/14 19:55:44 dawes Exp $ */
/*
* Author: Chris D. Peterson, MIT X Consortium
@@ -43,8 +44,8 @@ in this Software without prior written authorization from The Open Group.
l[0] = timestamp
l[1] = command atom name
- l[2] = ident of command.
- l[3] = protocol version number to use.
+ l[2] = ident of command
+ l[3] = protocol version number to use
@@ -279,43 +280,48 @@ in this Software without prior written authorization from The Open Group.
#define EDITRES_IS_UNREALIZED 0
/*
- * Format for atoms.
+ * Format for atoms
*/
-
#define EDITRES_FORMAT 8
#define EDITRES_SEND_EVENT_FORMAT 32
/*
* Atoms
*/
-
#define EDITRES_NAME "Editres"
#define EDITRES_COMMAND_ATOM "EditresCommand"
#define EDITRES_COMM_ATOM "EditresComm"
#define EDITRES_CLIENT_VALUE "EditresClientVal"
#define EDITRES_PROTOCOL_ATOM "EditresProtocol"
-typedef enum { SendWidgetTree = 0,
+typedef enum {
+ SendWidgetTree = 0,
SetValues = 1,
GetResources = 2,
GetGeometry = 3,
FindChild = 4,
GetValues = 5
- } EditresCommand;
+} EditresCommand;
-typedef enum {NormalResource = 0, ConstraintResource = 1} ResourceType;
+typedef enum {
+ NormalResource = 0,
+ ConstraintResource = 1
+} ResourceType;
/*
- * The type of a resource identifier.
+ * The type of a resource identifier
*/
-
typedef unsigned char ResIdent;
-typedef enum {PartialSuccess= 0, Failure= 1, ProtocolMismatch= 2} EditResError;
+typedef enum {
+ PartialSuccess = 0,
+ Failure = 1,
+ ProtocolMismatch = 2
+} EditResError;
typedef struct _WidgetInfo {
unsigned short num_widgets;
- unsigned long * ids;
+ unsigned long *ids;
Widget real_widget;
} WidgetInfo;
@@ -325,18 +331,79 @@ typedef struct _ProtocolStream {
} ProtocolStream;
/************************************************************
- *
- * Function definitions for reading and writing protocol requests.
- *
+ * Function definitions for reading and writing protocol requests
************************************************************/
-
_XFUNCPROTOBEGIN
-void _XEditResPutString8(), _XEditResPut8(), _XEditResPut16();
-void _XEditResPut32(), _XEditResPutWidgetInfo(), _XEditResPutWidget();
-void _XEditResResetStream();
-
-Boolean _XEditResGet8(), _XEditResGet16(), _XEditResGetSigned16();
-Boolean _XEditResGet32(), _XEditResGetString8(), _XEditResGetWidgetInfo();
+void _XEditResPutString8
+(
+ ProtocolStream *stream,
+ char *str
+ );
+
+void _XEditResPut8
+(
+ ProtocolStream *stream,
+ unsigned int value
+ );
+
+void _XEditResPut16
+(
+ ProtocolStream *stream,
+ unsigned int value
+ );
+
+void _XEditResPut32
+(
+ ProtocolStream *stream,
+ unsigned long value
+ );
+
+void _XEditResPutWidgetInfo
+(
+ ProtocolStream *stream,
+ WidgetInfo *info
+ );
+
+void _XEditResResetStream
+(
+ ProtocolStream *stream
+ );
+
+Bool _XEditResGet8
+(
+ ProtocolStream *stream,
+ unsigned char *value
+ );
+
+Bool _XEditResGet16
+(
+ ProtocolStream *stream,
+ unsigned short *value
+ );
+
+Bool _XEditResGetSigned16
+(
+ ProtocolStream *stream,
+ short *value
+ );
+
+Bool _XEditResGet32
+(
+ ProtocolStream *stream,
+ unsigned long *value
+ );
+
+Bool _XEditResGetString8
+(
+ ProtocolStream *stream,
+ char **str
+ );
+
+Bool _XEditResGetWidgetInfo
+(
+ ProtocolStream *stream,
+ WidgetInfo *info
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Error.h b/include/X11/Xmu/Error.h
index 0fd97c2..b8d6d58 100644
--- a/include/X11/Xmu/Error.h
+++ b/include/X11/Xmu/Error.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Error.h,v 1.6 2001/12/14 19:55:45 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -40,20 +41,18 @@ in this Software without prior written authorization from The Open Group.
_XFUNCPROTOBEGIN
-extern int XmuPrintDefaultErrorMessage(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XErrorEvent* /* event */,
- FILE* /* fp */
-#endif
-);
-
-extern int XmuSimpleErrorHandler(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XErrorEvent* /* errorp */
-#endif
-);
+int XmuPrintDefaultErrorMessage
+(
+ Display *dpy,
+ XErrorEvent *event,
+ FILE *fp
+ );
+
+int XmuSimpleErrorHandler
+(
+ Display *dpy,
+ XErrorEvent *errorp
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/ExtAgent.h b/include/X11/Xmu/ExtAgent.h
index 81e5c67..78e3495 100644
--- a/include/X11/Xmu/ExtAgent.h
+++ b/include/X11/Xmu/ExtAgent.h
@@ -25,21 +25,20 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/ExtAgent.h,v 1.6 2001/12/14 19:55:45 dawes Exp $ */
#include <X11/Intrinsic.h>
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
-extern void
-XmuRegisterExternalAgent(
-#if NeedFunctionPrototypes
- Widget /* w */,
- XtPointer /* data */,
- XEvent* /* event */,
- Boolean* /* cont */
-#endif
-);
+extern void XmuRegisterExternalAgent
+(
+ Widget w,
+ XtPointer data,
+ XEvent *event,
+ Boolean *cont
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Initer.h b/include/X11/Xmu/Initer.h
index ad744cc..5153237 100644
--- a/include/X11/Xmu/Initer.h
+++ b/include/X11/Xmu/Initer.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Initer.h,v 1.6 2001/12/14 19:55:46 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -37,27 +38,20 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Intrinsic.h>
#include <X11/Xfuncproto.h>
-typedef void (*XmuInitializerProc)(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XPointer /* data */
-#endif
-);
+typedef void (*XmuInitializerProc)(XtAppContext app_context, XPointer data);
_XFUNCPROTOBEGIN
-extern void XmuCallInitializers(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
+void XmuCallInitializers
+(
+ XtAppContext app_context
+ );
-extern void XmuAddInitializer(
-#if NeedFunctionPrototypes
- XmuInitializerProc /* func */,
- XPointer /* data */
-#endif
-);
+void XmuAddInitializer
+(
+ XmuInitializerProc func,
+ XPointer data
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/StdCmap.h b/include/X11/Xmu/StdCmap.h
index 3ee8f0d..649907a 100644
--- a/include/X11/Xmu/StdCmap.h
+++ b/include/X11/Xmu/StdCmap.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StdCmap.h,v 1.9 2001/12/14 19:55:49 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -34,78 +35,84 @@ in this Software without prior written authorization from The Open Group.
#ifndef _XMU_STDCMAP_H_
#define _XMU_STDCMAP_H_
-#include <X11/Intrinsic.h>
#include <X11/Xfuncproto.h>
_XFUNCPROTOBEGIN
-Status XmuAllStandardColormaps(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-Status XmuCreateColormap(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XStandardColormap* /* colormap */
-#endif
-);
-
-void XmuDeleteStandardColormap(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- int /* screen */,
- Atom /* property */
-#endif
-);
-
-Status XmuGetColormapAllocation(
-#if NeedFunctionPrototypes
- XVisualInfo* /* vinfo */,
- Atom /* property */,
- unsigned long* /* red_max_return */,
- unsigned long* /* green_max_return */,
- unsigned long* /* blue_max_return */
-#endif
-);
-
-Status XmuLookupStandardColormap(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- int /* screen */,
- VisualID /* visualid */,
- unsigned int /* depth */,
- Atom /* property */,
- Bool /* replace */,
- Bool /* retain */
-#endif
-);
-
-XStandardColormap *XmuStandardColormap(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- int /* screen */,
- VisualID /* visualid */,
- unsigned int /* depth */,
- Atom /* property */,
- Colormap /* cmap */,
- unsigned long /* red_max */,
- unsigned long /* green_max */,
- unsigned long /* blue_max */
-#endif
-);
-
-Status XmuVisualStandardColormaps(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- int /* screen */,
- VisualID /* visualid */,
- unsigned int /* depth */,
- Bool /* replace */,
- Bool /* retain */
-#endif
-);
+Status XmuAllStandardColormaps
+(
+ Display *dpy
+ );
+
+Status XmuCreateColormap
+(
+ Display *dpy,
+ XStandardColormap *colormap
+ );
+
+void XmuDeleteStandardColormap
+(
+ Display *dpy,
+ int screen,
+ Atom property
+ );
+
+Status XmuGetColormapAllocation
+(
+ XVisualInfo *vinfo,
+ Atom property,
+ unsigned long *red_max_return,
+ unsigned long *green_max_return,
+ unsigned long *blue_max_return
+ );
+
+Status XmuLookupStandardColormap
+(
+ Display *dpy,
+ int screen,
+ VisualID visualid,
+ unsigned int depth,
+ Atom property,
+ Bool replace,
+ Bool retain
+ );
+
+XStandardColormap *XmuStandardColormap
+(
+ Display *dpy,
+ int screen,
+ VisualID visualid,
+ unsigned int depth,
+ Atom property,
+ Colormap cmap,
+ unsigned long red_max,
+ unsigned long green_max,
+ unsigned long blue_max
+ );
+
+Status XmuVisualStandardColormaps
+(
+ Display *dpy,
+ int screen,
+ VisualID visualid,
+ unsigned int depth,
+ Bool replace,
+ Bool retain
+ );
+
+Bool XmuDistinguishableColors
+(
+ XColor *colors,
+ int count
+ );
+
+Bool XmuDistinguishablePixels
+(
+ Display *dpy,
+ Colormap cmap,
+ unsigned long *pixels,
+ int count
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/StdSel.h b/include/X11/Xmu/StdSel.h
index a38f8d7..ba6513f 100644
--- a/include/X11/Xmu/StdSel.h
+++ b/include/X11/Xmu/StdSel.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StdSel.h,v 1.8 2001/12/14 19:55:50 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -39,21 +40,18 @@ in this Software without prior written authorization from The Open Group.
_XFUNCPROTOBEGIN
-extern Boolean XmuConvertStandardSelection(
-#if NeedFunctionPrototypes
- Widget /* w */,
- Time /* time */,
- Atom* /* selection */,
- Atom* /* target */,
- Atom* /* type_return */,
- XPointer * /* value_return */,
- unsigned long * /* length_return */,
- int * /* format_return */
-#endif
-);
+Boolean XmuConvertStandardSelection
+(
+ Widget w,
+ Time timev,
+ Atom *selection,
+ Atom *target,
+ Atom *type_return,
+ XPointer *value_return,
+ unsigned long *length_return,
+ int *format_return
+ );
_XFUNCPROTOEND
#endif /* _XMU_SELECTION_H_ */
-
-
diff --git a/include/X11/Xmu/SysUtil.h b/include/X11/Xmu/SysUtil.h
index 3306492..0f24a89 100644
--- a/include/X11/Xmu/SysUtil.h
+++ b/include/X11/Xmu/SysUtil.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/SysUtil.h,v 1.9 2001/12/14 19:55:55 dawes Exp $ */
#ifndef _SYSUTIL_H_
#define _SYSUTIL_H_
@@ -33,13 +34,22 @@ in this Software without prior written authorization from The Open Group.
_XFUNCPROTOBEGIN
-extern int XmuGetHostname(
-#if NeedFunctionPrototypes
- char* /* buf_return */,
- int /* maxlen */
-#endif
+int XmuGetHostname
+(
+ char *buf_return,
+ int maxlen
);
+#ifndef _XMU_H_
+int XmuSnprintf
+(
+ char *str,
+ int size,
+ _Xconst char *fmt,
+ ...
+ );
+#endif
+
_XFUNCPROTOEND
#endif /* _SYSUTIL_H_ */
diff --git a/include/X11/Xmu/WidgetNode.h b/include/X11/Xmu/WidgetNode.h
index f24a8fa..a717544 100644
--- a/include/X11/Xmu/WidgetNode.h
+++ b/include/X11/Xmu/WidgetNode.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/WidgetNode.h,v 1.6 2001/12/14 19:55:58 dawes Exp $ */
/*
* Author: Jim Fulton, MIT X Consortium
@@ -64,36 +65,32 @@ typedef struct _XmuWidgetNode {
/* external interfaces */
_XFUNCPROTOBEGIN
-extern void XmuWnInitializeNodes (
-#if NeedFunctionPrototypes
- XmuWidgetNode * /* nodearray */,
- int /* nnodes */
-#endif
-);
-
-extern void XmuWnFetchResources (
-#if NeedFunctionPrototypes
- XmuWidgetNode * /* node */,
- Widget /* toplevel */,
- XmuWidgetNode * /* topnode */
-#endif
-);
-
-extern int XmuWnCountOwnedResources (
-#if NeedFunctionPrototypes
- XmuWidgetNode * /* node */,
- XmuWidgetNode * /* ownernode */,
- Bool /* constraints */
-#endif
-);
-
-extern XmuWidgetNode *XmuWnNameToNode (
-#if NeedFunctionPrototypes
- XmuWidgetNode * /* nodelist */,
- int /* nnodes */,
- _Xconst char * /* name */
-#endif
-);
+void XmuWnInitializeNodes
+(
+ XmuWidgetNode *nodearray,
+ int nnodes
+ );
+
+void XmuWnFetchResources
+(
+ XmuWidgetNode *node,
+ Widget toplevel,
+ XmuWidgetNode *topnode
+ );
+
+int XmuWnCountOwnedResources
+(
+ XmuWidgetNode *node,
+ XmuWidgetNode *ownernode,
+ Bool constraints
+ );
+
+XmuWidgetNode *XmuWnNameToNode
+(
+ XmuWidgetNode *nodelist,
+ int nnodes,
+ _Xconst char *name
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/WinUtil.h b/include/X11/Xmu/WinUtil.h
index 3e1eb59..850cbfa 100644
--- a/include/X11/Xmu/WinUtil.h
+++ b/include/X11/Xmu/WinUtil.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/WinUtil.h,v 1.7 2001/12/14 19:55:58 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -39,26 +40,23 @@ in this Software without prior written authorization from The Open Group.
_XFUNCPROTOBEGIN
-extern Window XmuClientWindow(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Window /* win */
-#endif
-);
+Window XmuClientWindow
+(
+ Display *dpy,
+ Window win
+ );
-extern Bool XmuUpdateMapHints(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Window /* win */,
- XSizeHints* /* hints */
-#endif
-);
+Bool XmuUpdateMapHints
+(
+ Display *dpy,
+ Window win,
+ XSizeHints *hints
+ );
-extern Screen *XmuScreenOfWindow(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Window /* w */
-#endif
+Screen *XmuScreenOfWindow
+(
+ Display *dpy,
+ Window w
);
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Xct.h b/include/X11/Xmu/Xct.h
index cb344b4..2a80e9d 100644
--- a/include/X11/Xmu/Xct.h
+++ b/include/X11/Xmu/Xct.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Xct.h,v 1.7 2001/12/14 19:55:59 dawes Exp $ */
#ifndef _Xct_h
#define _Xct_h
@@ -118,12 +119,12 @@ typedef struct _XctRec {
int can_ignore_exts;/* non-zero if ignoring extensions is
* acceptable, else zero */
XctString item; /* item returned from XctNextItem */
- int item_length; /* length of item in bytes */
+ unsigned item_length; /* length of item in bytes */
int char_size; /* number of bytes per character in
* item, with zero meaning variable */
char *encoding; /* Encoding name for item */
XctHDirection horizontal; /* direction of item */
- int horz_depth; /* current direction nesting depth */
+ unsigned horz_depth; /* current direction nesting depth */
char *GL; /* "{I} F" string for current GL */
char *GL_encoding; /* Encoding name for current GL */
int GL_set_size; /* 94 or 96 */
@@ -140,31 +141,27 @@ typedef struct _XctRec {
/* these are the external routines */
_XFUNCPROTOBEGIN
-extern XctData XctCreate(
-#if NeedFunctionPrototypes
- _Xconst unsigned char * /* string */,
- int /* length */,
- XctFlags /* flags */
-#endif
+XctData XctCreate
+(
+ _Xconst unsigned char *string,
+ int length,
+ XctFlags flags
);
-extern XctResult XctNextItem(
-#if NeedFunctionPrototypes
- XctData /* data */
-#endif
+XctResult XctNextItem
+(
+ XctData data
);
-extern void XctFree(
-#if NeedFunctionPrototypes
- XctData /* data */
-#endif
-);
+void XctFree
+(
+ XctData data
+ );
-extern void XctReset(
-#if NeedFunctionPrototypes
- XctData /* data */
-#endif
-);
+void XctReset
+(
+ XctData data
+ );
_XFUNCPROTOEND
diff --git a/include/X11/Xmu/Xmu.h b/include/X11/Xmu/Xmu.h
index 416d1fa..0959249 100644
--- a/include/X11/Xmu/Xmu.h
+++ b/include/X11/Xmu/Xmu.h
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Xmu.h,v 1.9 2001/12/14 19:55:59 dawes Exp $ */
/*
* The interfaces described by this header file are for miscellaneous utilities
@@ -34,12 +35,6 @@ in this Software without prior written authorization from The Open Group.
#ifndef _XMU_H_
#define _XMU_H_
-/*
- * This include file is obsolete and is provided only for compatibility with
- * MIT Release 3 clients. Callers should use the appropriate include file.
- *
- * DO NOT ADD ANY NEW INCLUDES OR DEFINITIONS TO THIS FILE!
- */
#include <X11/Intrinsic.h>
#include <X11/Xmu/Atoms.h> /* _XA_... */
#include <X11/Xmu/CharSet.h> /* CopyISOLatin1Lowered */
@@ -48,5 +43,81 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xmu/Error.h> /* PrintDefaultError */
#include <X11/Xmu/StdSel.h> /* ConvertStandardSelection */
+/*
+ * clip lists
+ */
+typedef struct _XmuSegment {
+ int x1, x2;
+ struct _XmuSegment *next;
+} XmuSegment;
+
+typedef struct _XmuScanline {
+ int y;
+ XmuSegment *segment;
+ struct _XmuScanline *next;
+} XmuScanline;
+
+typedef struct _XmuArea {
+ XmuScanline *scanline;
+} XmuArea;
+
+#define XmuCreateArea() XmuNewArea(0, 0, 0, 0)
+#define XmuAreaOr(dst, src) XmuAreaOrXor((dst), (src), True)
+#define XmuAreaXor(dst, src) XmuAreaOrXor((dst), (src), False)
+
+#define XmuDestroyArea(a) \
+ do { \
+ XmuDestroyScanlineList((a)->scanline); \
+ XtFree((char *)(a)); \
+ } while (0)
+
+#define FreeArea(a) \
+ do { \
+ XmuDestroyScanlineList((a)->scanline); \
+ a->scanline = (Scanline *)0; \
+ } while (0)
+
+#define XmuValidSegment(s) ((s)->x1 < (s)->x2)
+#define XmuSegmentEqu(s1, s2) ((s1)->x1 == (s2)->x1 && (s1)->x2 == (s2)->x2)
+#define XmuDestroySegment(s) XtFree((char *)(s))
+
+#define XmuDestroyScanline(s) \
+ do { \
+ XmuDestroySegmentList((s)->segment); \
+ XtFree((char*)(s)); \
+ } while (0)
+
+XmuArea *XmuNewArea(int, int, int, int);
+XmuArea *XmuAreaDup(XmuArea*);
+XmuArea *XmuAreaCopy(XmuArea*, XmuArea*);
+XmuArea *XmuAreaNot(XmuArea*, int, int, int, int);
+XmuArea *XmuAreaOrXor(XmuArea*, XmuArea*, Bool);
+XmuArea *XmuAreaAnd(XmuArea*, XmuArea*);
+Bool XmuValidArea(XmuArea*);
+Bool XmuValidScanline(XmuScanline*);
+Bool XmuScanlineEqu(XmuScanline*, XmuScanline*);
+XmuSegment *XmuNewSegment(int, int);
+void XmuDestroySegmentList(XmuSegment*);
+XmuScanline *XmuScanlineCopy(XmuScanline*, XmuScanline*);
+Bool XmuAppendSegment(XmuSegment*, XmuSegment*);
+XmuScanline *XmuOptimizeScanline(XmuScanline*);
+XmuScanline *XmuScanlineNot(XmuScanline *scanline, int, int);
+XmuScanline *XmuScanlineOr(XmuScanline*, XmuScanline*);
+XmuScanline *XmuScanlineAnd(XmuScanline*, XmuScanline*);
+XmuScanline *XmuScanlineXor(XmuScanline*, XmuScanline*);
+XmuScanline *XmuNewScanline(int, int, int);
+void XmuDestroyScanlineList(XmuScanline*);
+XmuArea *XmuOptimizeArea(XmuArea *area);
+
+#ifndef notdef
+XmuScanline *XmuScanlineOrSegment(XmuScanline*, XmuSegment*);
+XmuScanline *XmuScanlineAndSegment(XmuScanline*, XmuSegment*);
+XmuScanline *XmuScanlineXorSegment(XmuScanline*, XmuSegment*);
+#endif /* notdef */
+
+#ifndef _SYSUTIL_H_
+int XmuSnprintf(char *str, int size, _Xconst char *fmt, ...);
+#endif
+
#endif /* _XMU_H_ */
diff --git a/src/AllCmap.c b/src/AllCmap.c
index 4b24ca6..384d068 100644
--- a/src/AllCmap.c
+++ b/src/AllCmap.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/AllCmap.c,v 1.8 2001/12/14 19:55:32 dawes Exp $ */
#include <stdio.h>
#include <X11/Xlib.h>
@@ -32,7 +33,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xutil.h>
#include <X11/Xmu/StdCmap.h>
-static XVisualInfo *getDeepestVisual();
+static XVisualInfo *getDeepestVisual(int, XVisualInfo*, int);
/*
* To create all of the appropriate standard colormaps for every visual of
@@ -87,14 +88,15 @@ static XVisualInfo *getDeepestVisual();
* standard colormaps are meaningful under these classes of visuals.
*/
-Status XmuAllStandardColormaps(dpy)
- Display *dpy; /* Specifies the connection to the X server */
+Status
+XmuAllStandardColormaps(Display *dpy)
{
int nvisuals, scr;
Status status;
long vinfo_mask;
XVisualInfo template, *vinfo, *v1, *v2;
-
+
+ status = 0;
/* for each screen, determine all visuals of this server */
for (scr=0; scr < ScreenCount(dpy); scr++)
{
@@ -135,13 +137,11 @@ Status XmuAllStandardColormaps(dpy)
return status;
}
-static XVisualInfo *getDeepestVisual(visual_class, vinfo, nvisuals)
- int visual_class; /* specifies the visual class */
- XVisualInfo *vinfo; /* specifies all visuals for a screen */
- int nvisuals; /* specifies number of visuals in the list */
+static XVisualInfo *
+getDeepestVisual(int visual_class, XVisualInfo *vinfo, int nvisuals)
{
register int i;
- unsigned int maxdepth = 0;
+ register int maxdepth = 0;
XVisualInfo *v = NULL;
for (i=0; i < nvisuals; i++, vinfo++)
diff --git a/src/Atoms.c b/src/Atoms.c
index dda08cc..1d696cd 100644
--- a/src/Atoms.c
+++ b/src/Atoms.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Atoms.c,v 3.8 2001/12/14 19:55:33 dawes Exp $ */
/*
* This file contains routines to cache atoms, avoiding multiple
@@ -59,7 +60,7 @@ struct _AtomRec {
#define STATIC static
#endif
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define DeclareAtom(atom,text) \
STATIC struct _AtomRec __##atom = { text, NULL }; \
AtomPtr _##atom = &__##atom;
@@ -91,6 +92,7 @@ DeclareAtom(XA_TARGETS, "TARGETS" )
DeclareAtom(XA_TEXT, "TEXT" )
DeclareAtom(XA_TIMESTAMP, "TIMESTAMP" )
DeclareAtom(XA_USER, "USER" )
+DeclareAtom(XA_UTF8_STRING, "UTF8_STRING" )
/******************************************************************
@@ -99,12 +101,8 @@ DeclareAtom(XA_USER, "USER" )
******************************************************************/
-#if NeedFunctionPrototypes
-AtomPtr XmuMakeAtom(_Xconst char *name)
-#else
-AtomPtr XmuMakeAtom(name)
- char* name;
-#endif
+AtomPtr
+XmuMakeAtom(_Xconst char *name)
{
AtomPtr ptr = XtNew(struct _AtomRec);
ptr->name = (char *) name;
@@ -112,16 +110,15 @@ AtomPtr XmuMakeAtom(name)
return ptr;
}
-char* XmuNameOfAtom(atom_ptr)
- AtomPtr atom_ptr;
+char *
+XmuNameOfAtom(AtomPtr atom_ptr)
{
return atom_ptr->name;
}
-Atom XmuInternAtom(d, atom_ptr)
- Display *d;
- AtomPtr atom_ptr;
+Atom
+XmuInternAtom(Display *d, AtomPtr atom_ptr)
{
DisplayRec* display_rec;
for (display_rec = atom_ptr->head; display_rec != NULL;
@@ -138,20 +135,17 @@ Atom XmuInternAtom(d, atom_ptr)
}
-char *XmuGetAtomName(d, atom)
- Display *d;
- Atom atom;
+char *
+XmuGetAtomName(Display *d, Atom atom)
{
- if (atom == 0) return "(BadAtom)";
+ if (atom == 0) return (NULL);
return XGetAtomName(d, atom);
}
/* convert (names, count) to a list of atoms. Caller allocates list */
-void XmuInternStrings(d, names, count, atoms)
- Display *d;
- register String *names;
- register Cardinal count;
- register Atom *atoms; /* return */
+void
+XmuInternStrings(Display *d, register String *names,
+ register Cardinal count, register Atom *atoms)
{
(void) XInternAtoms(d, (char**)names, (int)count, FALSE, atoms);
}
diff --git a/src/ClientWin.c b/src/ClientWin.c
index faf206e..48c956d 100644
--- a/src/ClientWin.c
+++ b/src/ClientWin.c
@@ -25,23 +25,28 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/ClientWin.c,v 1.8 2002/11/27 20:54:49 tsi Exp $ */
#include <X11/Xlib.h>
#include <X11/Xatom.h>
-static Window TryChildren();
+#include <X11/Xmu/WinUtil.h>
+
+/*
+ * Prototypes
+ */
+static Window TryChildren(Display*, Window, Atom);
/* Find a window with WM_STATE, else return win itself, as per ICCCM */
-Window XmuClientWindow (dpy, win)
- Display *dpy;
- Window win;
+Window
+XmuClientWindow(Display *dpy, Window win)
{
Atom WM_STATE;
Atom type = None;
int format;
unsigned long nitems, after;
- unsigned char *data;
+ unsigned char *data = NULL;
Window inf;
WM_STATE = XInternAtom(dpy, "WM_STATE", True);
@@ -49,6 +54,8 @@ Window XmuClientWindow (dpy, win)
return win;
XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType,
&type, &format, &nitems, &after, &data);
+ if (data)
+ XFree(data);
if (type)
return win;
inf = TryChildren(dpy, win, WM_STATE);
@@ -57,11 +64,8 @@ Window XmuClientWindow (dpy, win)
return inf;
}
-static
-Window TryChildren (dpy, win, WM_STATE)
- Display *dpy;
- Window win;
- Atom WM_STATE;
+static Window
+TryChildren(Display *dpy, Window win, Atom WM_STATE)
{
Window root, parent;
Window *children;
@@ -76,14 +80,18 @@ Window TryChildren (dpy, win, WM_STATE)
if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren))
return 0;
for (i = 0; !inf && (i < nchildren); i++) {
+ data = NULL;
XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False,
AnyPropertyType, &type, &format, &nitems,
&after, &data);
+ if (data)
+ XFree(data);
if (type)
inf = children[i];
}
for (i = 0; !inf && (i < nchildren); i++)
inf = TryChildren(dpy, children[i], WM_STATE);
- if (children) XFree((char *)children);
+ if (children)
+ XFree(children);
return inf;
}
diff --git a/src/CloseHook.c b/src/CloseHook.c
index cde72fb..c3efd6e 100644
--- a/src/CloseHook.c
+++ b/src/CloseHook.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CloseHook.c,v 3.6 2001/12/14 19:55:35 dawes Exp $ */
/*
* CloseDisplayHook package - provide callback on XCloseDisplay
@@ -57,8 +58,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xmu/CloseHook.h>
-
-extern char *malloc(); /* should be void * */
+#include <stdlib.h>
/*
* Private data
@@ -82,10 +82,13 @@ typedef struct _DisplayEntry {
struct _CallbackRec *calling; /* currently being called back */
} DisplayEntry;
+/*
+ * Prototypes
+ */
+static DisplayEntry *_FindDisplayEntry(Display*, DisplayEntry**);
+static Bool _MakeExtension(Display*, int*);
static DisplayEntry *elist = NULL;
-static Bool _MakeExtension();
-static DisplayEntry *_FindDisplayEntry();
/*
@@ -107,10 +110,8 @@ static DisplayEntry *_FindDisplayEntry();
* it returns an untyped pointer that can be used with Remove or Lookup, but
* not dereferenced.
*/
-CloseHook XmuAddCloseDisplayHook (dpy, func, arg)
- Display *dpy;
- XmuCloseHookProc func; /* function to call on close display */
- XPointer arg; /* arg to pass */
+CloseHook
+XmuAddCloseDisplayHook(Display *dpy, XmuCloseHookProc func, XPointer arg)
{
DisplayEntry *de;
CallbackRec *cb;
@@ -153,11 +154,9 @@ CloseHook XmuAddCloseDisplayHook (dpy, func, arg)
* Remove - get rid of a callback. If handle is non-null, use that to compare
* entries. Otherwise, remove first instance of the function/argument pair.
*/
-Bool XmuRemoveCloseDisplayHook (dpy, handle, func, arg)
- Display *dpy;
- CloseHook handle; /* value from XmuAddCloseDisplayHook */
- XmuCloseHookProc func; /* function to call on close display */
- XPointer arg; /* arg to pass */
+Bool
+XmuRemoveCloseDisplayHook(Display *dpy, CloseHook handle,
+ XmuCloseHookProc func, XPointer arg)
{
DisplayEntry *de = _FindDisplayEntry (dpy, NULL);
register CallbackRec *h, *prev;
@@ -193,11 +192,9 @@ Bool XmuRemoveCloseDisplayHook (dpy, handle, func, arg)
* non-NULL, look for an entry that matches it; otherwise look for an entry
* with the same function/argument pair.
*/
-Bool XmuLookupCloseDisplayHook (dpy, handle, func, arg)
- Display *dpy;
- CloseHook handle; /* value from XmuAddCloseDisplayHook */
- XmuCloseHookProc func; /* function to call on close display */
- XPointer arg; /* arg to pass */
+Bool
+XmuLookupCloseDisplayHook(Display *dpy, CloseHook handle,
+ XmuCloseHookProc func, XPointer arg)
{
DisplayEntry *de = _FindDisplayEntry (dpy, NULL);
register CallbackRec *h;
@@ -227,9 +224,8 @@ Bool XmuLookupCloseDisplayHook (dpy, handle, func, arg)
* the preceeding link so that the display can be unlinked without having
* back pointers.
*/
-static DisplayEntry *_FindDisplayEntry (dpy, prevp)
- register Display *dpy;
- DisplayEntry **prevp;
+static DisplayEntry *
+_FindDisplayEntry(register Display *dpy, DisplayEntry **prevp)
{
register DisplayEntry *d, *prev;
@@ -250,9 +246,8 @@ static DisplayEntry *_FindDisplayEntry (dpy, prevp)
* the associated callback data (callback records and display entries).
*/
/* ARGSUSED */
-static int _DoCallbacks (dpy, codes)
- Display *dpy;
- XExtCodes *codes;
+static int
+_DoCallbacks(Display *dpy, XExtCodes *codes)
{
register CallbackRec *h;
DisplayEntry *prev;
@@ -284,9 +279,8 @@ static int _DoCallbacks (dpy, codes)
/*
* _MakeExtension - create an extension for this display; done once per display
*/
-static Bool _MakeExtension (dpy, extensionp)
- Display *dpy;
- int *extensionp;
+static Bool
+_MakeExtension(Display *dpy, int *extensionp)
{
XExtCodes *codes;
diff --git a/src/CmapAlloc.c b/src/CmapAlloc.c
index fde2bf8..c1cd680 100644
--- a/src/CmapAlloc.c
+++ b/src/CmapAlloc.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CmapAlloc.c,v 1.7 2001/12/14 19:55:35 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
@@ -33,16 +34,23 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
#include <stdio.h>
#define lowbit(x) ((x) & (~(x) + 1))
-static int default_allocation();
-static void best_allocation();
-static void gray_allocation();
-static int icbrt();
-static int icbrt_with_bits();
-static int icbrt_with_guess();
+/*
+ * Prototypes
+ */
+static void best_allocation(XVisualInfo*, unsigned long*, unsigned long*,
+ unsigned long*);
+static int default_allocation(XVisualInfo*, unsigned long*,
+ unsigned long*, unsigned long*);
+static void gray_allocation(int, unsigned long*, unsigned long*,
+ unsigned long*);
+static int icbrt(int);
+static int icbrt_with_bits(int, int);
+static int icbrt_with_guess(int, int);
/* To determine the best allocation of reds, greens, and blues in a
* standard colormap, use XmuGetColormapAllocation.
@@ -56,10 +64,11 @@ static int icbrt_with_guess();
* It is assumed that the visual is appropriate for the colormap property.
*/
-Status XmuGetColormapAllocation(vinfo, property, red_max, green_max, blue_max)
- XVisualInfo *vinfo;
- Atom property;
- unsigned long *red_max, *green_max, *blue_max;
+Status
+XmuGetColormapAllocation(XVisualInfo *vinfo, Atom property,
+ unsigned long *red_max,
+ unsigned long *green_max,
+ unsigned long *blue_max)
{
Status status = 1;
@@ -101,9 +110,9 @@ Status XmuGetColormapAllocation(vinfo, property, red_max, green_max, blue_max)
* Keith Packard, MIT X Consortium
*/
-static void gray_allocation(n, red_max, green_max, blue_max)
- int n; /* the number of cells of the gray scale */
- unsigned long *red_max, *green_max, *blue_max;
+static void
+gray_allocation(int n, unsigned long *red_max, unsigned long *green_max,
+ unsigned long *blue_max)
{
*red_max = (n * 30) / 100;
*green_max = (n * 59) / 100;
@@ -125,9 +134,9 @@ static void gray_allocation(n, red_max, green_max, blue_max)
* Return 0 if an allocation has been determined, non-zero otherwise.
*/
-static int default_allocation(vinfo, red, green, blue)
- XVisualInfo *vinfo;
- unsigned long *red, *green, *blue;
+static int
+default_allocation(XVisualInfo *vinfo, unsigned long *red,
+ unsigned long *green, unsigned long *blue)
{
int ngrays; /* number of gray cells */
@@ -199,9 +208,9 @@ static int default_allocation(vinfo, red, green, blue)
* defineable colormap entries.
*/
-static void best_allocation(vinfo, red, green, blue)
- XVisualInfo *vinfo;
- unsigned long *red, *green, *blue;
+static void
+best_allocation(XVisualInfo *vinfo, unsigned long *red, unsigned long *green,
+ unsigned long *blue)
{
if (vinfo->class == DirectColor || vinfo->class == TrueColor)
@@ -267,8 +276,8 @@ static void best_allocation(vinfo, red, green, blue)
* Stephen Gildea, MIT X Consortium, July 1991
*/
-static int icbrt(a) /* integer cube root */
- int a;
+static int
+icbrt(int a)
{
register int bits = 0;
register unsigned n = a;
@@ -282,9 +291,9 @@ static int icbrt(a) /* integer cube root */
}
-static int icbrt_with_bits(a, bits)
- int a;
- int bits; /* log 2 of a */
+static int
+icbrt_with_bits(int a, int bits)
+ /* bits - log 2 of a */
{
return icbrt_with_guess(a, a>>2*bits/3);
}
@@ -303,8 +312,8 @@ int icbrt_loopcount;
* We actually return floor(cbrt(a)) because that's what we need here, too.
*/
-static int icbrt_with_guess(a, guess)
- int a, guess;
+static int
+icbrt_with_guess(int a, int guess)
{
register int delta;
diff --git a/src/CrCmap.c b/src/CrCmap.c
index ab3d0a6..1c017a6 100644
--- a/src/CrCmap.c
+++ b/src/CrCmap.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CrCmap.c,v 3.7 2001/12/14 19:55:36 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
@@ -35,19 +36,38 @@ in this Software without prior written authorization from The Open Group.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
-extern char *calloc();
+/*
+ * Prototypes
+ */
+/* allocate entire map Read Only */
+static int ROmap(Display*, Colormap, unsigned long[], int, int);
+
+/* allocate a cell, prefer Read Only */
+static Status ROorRWcell(Display*, Colormap, unsigned long[], int,
+ XColor*, unsigned long);
+
+/* allocate a cell Read Write */
+static Status RWcell(Display*, Colormap, XColor*, XColor*, unsigned long*);
+
+/* for quicksort */
+static int compare(_Xconst void*, _Xconst void*);
-static int ROmap(); /* allocate entire map Read Only */
-static Status ROorRWcell(); /* allocate a cell, prefer Read Only */
-static Status RWcell(); /* allocate a cell Read Write */
-static int compare(); /* for quicksort */
-static Status contiguous(); /* find contiguous sequence of cells */
-static void free_cells(); /* frees resources before quitting */
-static Status readonly_map(); /* create a map in a RO visual type */
-static Status readwrite_map(); /* create a map in a RW visual type */
+/* find contiguous sequence of cells */
+static Status contiguous(unsigned long[], int, int, unsigned long, int*, int*);
+
+/* frees resources before quitting */
+static void free_cells(Display*, Colormap, unsigned long[], int, int);
+
+/* create a map in a RO visual type */
+static Status readonly_map(Display*, XVisualInfo*, XStandardColormap*);
+
+/* create a map in a RW visual type */
+static Status readwrite_map(Display*, XVisualInfo*, XStandardColormap*);
#define lowbit(x) ((x) & (~(x) + 1))
#define TRUEMATCH(mult,max,mask) \
@@ -74,14 +94,12 @@ static Status readwrite_map(); /* create a map in a RW visual type */
* standard colormap structure.
*/
-Status XmuCreateColormap(dpy, colormap)
- Display *dpy; /* specifies the connection under
- * which the map is created */
- XStandardColormap *colormap; /* specifies the map to be created,
- * and returns, particularly if the
- * map is created as a subset of the
- * default colormap of the screen,
- * the base_pixel of the map.
+Status
+XmuCreateColormap(Display *dpy, XStandardColormap *colormap)
+ /* dpy - specifies the connection under which the map is created
+ * colormap - specifies the map to be created, and returns, particularly
+ * if the map is created as a subset of the default colormap
+ * of the screen, the base_pixel of the map.
*/
{
XVisualInfo vinfo_template; /* template visual information */
@@ -121,8 +139,8 @@ Status XmuCreateColormap(dpy, colormap)
break;
}
} else {
- unsigned int maxdepth = 0;
- XVisualInfo *v;
+ int maxdepth = 0;
+ XVisualInfo *v = NULL;
for (i=0; i < n; i++, vinfo++)
if (vinfo->depth > maxdepth) {
@@ -148,13 +166,11 @@ Status XmuCreateColormap(dpy, colormap)
}
/****************************************************************************/
-static Status readwrite_map(dpy, vinfo, colormap)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *colormap;
+static Status
+readwrite_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
{
register unsigned long i, n; /* index counters */
- int ncolors; /* number of colors to be defined */
+ unsigned long ncolors; /* number of colors to be defined */
int npixels; /* number of pixels allocated R/W */
int first_index; /* first index of pixels to use */
int remainder; /* first index of remainder */
@@ -182,7 +198,7 @@ static Status readwrite_map(dpy, vinfo, colormap)
colormap->blue_max * colormap->blue_mult + 1;
delta = 1;
}
- if (ncolors <= 1 || ncolors > vinfo->colormap_size) return 0;
+ if (ncolors <= 1 || (int) ncolors > vinfo->colormap_size) return 0;
/* Allocate Read/Write as much of the colormap as we can possibly get.
* Then insure that the pixels we were allocated are given in
@@ -316,12 +332,15 @@ static Status readwrite_map(dpy, vinfo, colormap)
/****************************************************************************/
-static int ROmap(dpy, cmap, pixels, m, n)
- Display *dpy; /* the X server connection */
- Colormap cmap; /* specifies colormap ID */
- unsigned long pixels[]; /* returns pixel allocations */
- int m; /* specifies colormap size */
- int n; /* specifies number of colors */
+static int
+ROmap(Display *dpy, Colormap cmap, unsigned long pixels[], int m, int n)
+ /*
+ * dpy - the X server connection
+ * cmap - specifies colormap ID
+ * pixels - returns pixel allocations
+ * m - specifies colormap size
+ * n - specifies number of colors
+ */
{
register int p;
@@ -353,14 +372,16 @@ static int ROmap(dpy, cmap, pixels, m, n)
/****************************************************************************/
-static Status contiguous(pixels, npixels, ncolors, delta, first, rem)
- unsigned long pixels[]; /* specifies allocated pixels */
- int npixels; /* specifies count of alloc'd pixels */
- int ncolors; /* specifies needed sequence length */
- unsigned long delta; /* between pixels */
- int *first; /* returns first index of sequence */
- int *rem; /* returns first index after sequence,
- * or 0, if none follow */
+static Status
+contiguous(unsigned long pixels[], int npixels, int ncolors,
+ unsigned long delta, int *first, int *rem)
+ /* pixels - specifies allocated pixels
+ * npixels - specifies count of alloc'd pixels
+ * ncolors - specifies needed sequence length
+ * delta - between pixels
+ * first - returns first index of sequence
+ * rem - returns first index after sequence, or 0, if none follow
+ */
{
register int i = 1; /* walking index into the pixel array */
register int count = 1; /* length of sequence discovered so far */
@@ -389,13 +410,9 @@ static Status contiguous(pixels, npixels, ncolors, delta, first, rem)
/****************************************************************************/
-static Status ROorRWcell(dpy, cmap, pixels, npixels, color, p)
- Display *dpy;
- Colormap cmap;
- unsigned long pixels[];
- int npixels;
- XColor *color;
- unsigned long p;
+static Status
+ROorRWcell(Display *dpy, Colormap cmap, unsigned long pixels[],
+ int npixels, XColor *color, unsigned long p)
{
unsigned long pixel;
XColor request;
@@ -430,12 +447,13 @@ static Status ROorRWcell(dpy, cmap, pixels, npixels, color, p)
/****************************************************************************/
-static void free_cells(dpy, cmap, pixels, npixels, p)
- Display *dpy;
- Colormap cmap;
- unsigned long pixels[]; /* to be freed */
- int npixels; /* original number allocated */
- int p;
+static void
+free_cells(Display *dpy, Colormap cmap, unsigned long pixels[],
+ int npixels, int p)
+ /*
+ * pixels - to be freed
+ * npixels - original number allocated
+ */
{
/* One of the npixels allocated has already been freed.
* p is the index of the freed pixel.
@@ -449,12 +467,9 @@ static void free_cells(dpy, cmap, pixels, npixels, p)
/****************************************************************************/
-static Status RWcell(dpy, cmap, color, request, pixel)
- Display *dpy;
- Colormap cmap;
- XColor *color;
- XColor *request;
- unsigned long *pixel;
+static Status
+RWcell(Display *dpy, Colormap cmap, XColor *color, XColor *request,
+ unsigned long *pixel)
{
unsigned long n = *pixel;
@@ -478,20 +493,16 @@ static Status RWcell(dpy, cmap, color, request, pixel)
/****************************************************************************/
-static int compare(e1, e2)
- unsigned long *e1, *e2;
+static int
+compare(_Xconst void *e1, _Xconst void *e2)
{
- if (*e1 < *e2) return -1;
- if (*e1 > *e2) return 1;
- return 0;
+ return ((int)(*(long *)e1 - *(long *)e2));
}
/****************************************************************************/
-static Status readonly_map(dpy, vinfo, colormap)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *colormap;
+static Status
+readonly_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
{
int i, last_pixel;
XColor color;
diff --git a/src/CrPixFBit.c b/src/CrPixFBit.c
index ac736b1..be0fa06 100644
--- a/src/CrPixFBit.c
+++ b/src/CrPixFBit.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CrPixFBit.c,v 1.7 2001/12/14 19:55:37 dawes Exp $ */
/*
* This file contains miscellaneous utility routines and is not part of the
@@ -39,15 +40,21 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xos.h>
#include <X11/Xlib.h>
+#include <X11/Xmu/Drawing.h>
-Pixmap XmuCreatePixmapFromBitmap (dpy, d, bitmap, width, height, depth,
- fore, back)
- Display *dpy; /* connection to X server */
- Drawable d; /* drawable indicating screen */
- Pixmap bitmap; /* single plane pixmap */
- unsigned int width, height; /* dimensions of bitmap and pixmap */
- unsigned int depth; /* depth of pixmap to create */
- unsigned long fore, back; /* colors to use */
+Pixmap
+XmuCreatePixmapFromBitmap(Display *dpy, Drawable d, Pixmap bitmap,
+ unsigned int width, unsigned int height,
+ unsigned int depth,
+ unsigned long fore, unsigned long back)
+ /*
+ * dpy - connection to X server
+ * d - drawable indicating screen
+ * bitmap - single plane pixmap
+ * width, height - dimensions of bitmap and pixmap
+ * depth - depth of pixmap to create
+ * fore, back - colors to use
+ */
{
Pixmap pixmap;
diff --git a/src/CursorName.c b/src/CursorName.c
index 34449fc..40bad95 100644
--- a/src/CursorName.c
+++ b/src/CursorName.c
@@ -25,27 +25,18 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CursorName.c,v 3.8 2002/09/18 17:11:42 tsi Exp $ */
-#include <X11/Intrinsic.h>
#include <X11/Xmu/CharSet.h>
#include <X11/Xmu/CurUtil.h>
#include <X11/cursorfont.h>
+#include <string.h>
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-#if NeedFunctionPrototypes
-int XmuCursorNameToIndex (_Xconst char *name)
-#else
-int XmuCursorNameToIndex (name)
- char *name;
-#endif
+int
+XmuCursorNameToIndex(_Xconst char *name)
{
- static Const struct _CursorName {
- Const char *name;
+ static _Xconst struct _CursorName {
+ _Xconst char *name;
unsigned int shape;
} cursor_names[] = {
{"x_cursor", XC_X_cursor},
@@ -126,14 +117,15 @@ int XmuCursorNameToIndex (name)
{"watch", XC_watch},
{"xterm", XC_xterm},
};
- register Const struct _CursorName *table;
+#define NUM_CURSOR_NAMES (sizeof (cursor_names) / sizeof (cursor_names[0]))
+ register _Xconst struct _CursorName *table;
register int i;
char tmp[40];
if (strlen (name) >= sizeof tmp) return -1;
XmuCopyISOLatin1Lowered (tmp, name);
- for (i=0, table=cursor_names; i < XtNumber(cursor_names); i++, table++ ) {
+ for (i=0, table=cursor_names; i < NUM_CURSOR_NAMES; i++, table++ ) {
if (strcmp(tmp, table->name) == 0) return table->shape;
}
diff --git a/src/CvtCache.c b/src/CvtCache.c
index 0239b3e..b9e9153 100644
--- a/src/CvtCache.c
+++ b/src/CvtCache.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CvtCache.c,v 3.7 2001/12/14 19:55:39 dawes Exp $ */
/*
* Author: Jim Fulton, MIT X Consortium
@@ -34,32 +35,38 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xlib.h>
#include <X11/Xos.h>
#include <X11/Xmu/CvtCache.h>
+#include <stdlib.h>
-extern char *malloc();
+/*
+ * Prototypes
+ */
+static int _CloseDisplay(XmuDisplayQueue*, XmuDisplayQueueEntry*);
+static int _FreeCCDQ(XmuDisplayQueue*);
+static void _InitializeCvtCache(XmuCvtCache*);
+/*
+ * Initialization
+ */
static XmuDisplayQueue *dq = NULL;
-static int _CloseDisplay(), _FreeCCDQ();
-
/*
* internal utility callbacks
*/
-_FreeCCDQ (q)
- XmuDisplayQueue *q;
+static int
+_FreeCCDQ(XmuDisplayQueue *q)
{
XmuDQDestroy (dq, False);
dq = NULL;
+ return (0);
}
-static int _CloseDisplay (q, e)
- XmuDisplayQueue *q;
- XmuDisplayQueueEntry *e;
+static int
+_CloseDisplay(XmuDisplayQueue *q, XmuDisplayQueueEntry *e)
{
XmuCvtCache *c;
- extern void _XmuStringToBitmapFreeCache();
if (e && (c = (XmuCvtCache *)(e->data))) {
_XmuStringToBitmapFreeCache (c);
@@ -69,11 +76,9 @@ static int _CloseDisplay (q, e)
return 0;
}
-static void _InitializeCvtCache (c)
- register XmuCvtCache *c;
+static void
+_InitializeCvtCache(register XmuCvtCache *c)
{
- extern void _XmuStringToBitmapInitCache();
-
_XmuStringToBitmapInitCache (c);
/* insert calls to init any cached memory */
}
@@ -83,8 +88,8 @@ static void _InitializeCvtCache (c)
* XmuCCLookupDisplay - return the cache entry for the indicated display;
* initialize the cache if necessary
*/
-XmuCvtCache *_XmuCCLookupDisplay (dpy)
- Display *dpy;
+XmuCvtCache *
+_XmuCCLookupDisplay(Display *dpy)
{
XmuDisplayQueueEntry *e;
diff --git a/src/CvtStdSel.c b/src/CvtStdSel.c
index 9c2eb07..3020ee0 100644
--- a/src/CvtStdSel.c
+++ b/src/CvtStdSel.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/CvtStdSel.c,v 3.20 2001/12/14 19:55:39 dawes Exp $ */
/*
* This file contains routines to handle common selection targets.
@@ -54,7 +55,12 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xwinsock.h>
#define XOS_USE_MTSAFE_NETDBAPI
#else
+#ifndef Lynx
#include <sys/socket.h>
+#else
+#include <sys/types.h>
+#include <socket.h>
+#endif
#define XOS_USE_XT_LOCKING
#endif
#define X_INCLUDE_NETDB_H
@@ -62,6 +68,7 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <X11/Xos.h>
+#include <stdlib.h>
#include "Atoms.h"
#include "StdSel.h"
#include "SysUtil.h"
@@ -78,18 +85,26 @@ in this Software without prior written authorization from The Open Group.
#ifdef ultrix
#define USE_UNAME
#endif
+#ifdef CSRG_BASED
+#define USE_UNAME
+#endif
#endif /*X_OS_FILE*/
#ifdef USE_UNAME
-#ifdef ultrix
-#ifndef __STDC__
-#include <limits.h> /* fixed in Ultrix 3.0 */
-#endif
-#endif
#include <sys/utsname.h>
#endif
#endif
-static char *get_os_name ()
+/*
+ * Prototypes
+ */
+static char *get_os_name(void);
+static Bool isApplicationShell(Widget);
+
+/*
+ * Implementation
+ */
+static char *
+get_os_name(void)
{
#ifdef OS_NAME
return XtNewString(OS_NAME);
@@ -101,9 +116,9 @@ static char *get_os_name ()
if (uname (&utss) == 0) {
char *os_name;
- int len = strlen(utss.sysname);
+ int len = strlen(utss.sysname) + 1;
#ifndef hpux /* because of hostname length crock */
- len += 1 + strlen(utss.release);
+ len += 2 + strlen(utss.release);
#endif
os_name = XtMalloc (len);
strcpy (os_name, utss.sysname);
@@ -139,7 +154,7 @@ static char *get_os_name ()
#ifdef sun
return XtNewString("SunOS");
#else
-# if !defined(SYSV) && defined(unix)
+# if !defined(SYSV) && (defined(CSRG_BASED) || defined(unix))
return XtNewString("BSD");
# else
return NULL;
@@ -157,8 +172,8 @@ static char *get_os_name ()
* go that far. Then, we test whether it is an applicationShellWidget
* class by looking for an explicit class name. Seems pretty safe.
*/
-static Bool isApplicationShell(w)
- Widget w;
+static Bool
+isApplicationShell(Widget w)
{
register WidgetClass c;
@@ -171,14 +186,10 @@ static Bool isApplicationShell(w)
return False;
}
-Boolean XmuConvertStandardSelection(w, time, selection, target,
- type, value, length, format)
- Widget w;
- Time time;
- Atom *selection, *target, *type;
- XPointer *value;
- unsigned long *length;
- int *format;
+Boolean
+XmuConvertStandardSelection(Widget w, Time time, Atom *selection, Atom *target,
+ Atom *type, XPointer *value,
+ unsigned long *length, int *format)
{
Display *d = XtDisplay(w);
if (*target == XA_TIMESTAMP(d)) {
@@ -203,10 +214,12 @@ Boolean XmuConvertStandardSelection(w, time, selection, target,
*format = 8;
return True;
}
-#ifdef TCPCONN
+#if defined(TCPCONN)
if (*target == XA_IP_ADDRESS(d)) {
char hostname[1024];
+#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
+#endif
struct hostent *hostp;
hostname[0] = '\0';
diff --git a/src/DefErrMsg.c b/src/DefErrMsg.c
index 98d4392..f948463 100644
--- a/src/DefErrMsg.c
+++ b/src/DefErrMsg.c
@@ -25,20 +25,21 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/DefErrMsg.c,v 1.8 2001/12/14 19:55:39 dawes Exp $ */
#include <stdio.h>
#define NEED_EVENTS
#include <X11/Xlibint.h>
#include <X11/Xproto.h>
+#include <X11/Xmu/Error.h>
+#include <X11/Xmu/SysUtil.h>
/*
* XmuPrintDefaultErrorMessage - print a nice error that looks like the usual
* message. Returns 1 if the caller should consider exitting else 0.
*/
-int XmuPrintDefaultErrorMessage (dpy, event, fp)
- Display *dpy;
- XErrorEvent *event;
- FILE *fp;
+int
+XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
{
char buffer[BUFSIZ];
char mesg[BUFSIZ];
@@ -53,7 +54,7 @@ int XmuPrintDefaultErrorMessage (dpy, event, fp)
mesg, BUFSIZ);
(void) fprintf(fp, mesg, event->request_code);
if (event->request_code < 128) {
- sprintf(number, "%d", event->request_code);
+ XmuSnprintf(number, sizeof(number), "%d", event->request_code);
XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
} else {
/* XXX this is non-portable */
@@ -62,7 +63,7 @@ int XmuPrintDefaultErrorMessage (dpy, event, fp)
ext = ext->next)
;
if (ext)
- strcpy(buffer, ext->name);
+ XmuSnprintf(buffer, sizeof(buffer), "%s", ext->name);
else
buffer[0] = '\0';
}
@@ -73,7 +74,8 @@ int XmuPrintDefaultErrorMessage (dpy, event, fp)
mesg, BUFSIZ);
(void) fprintf(fp, mesg, event->minor_code);
if (ext) {
- sprintf(mesg, "%s.%d", ext->name, event->minor_code);
+ XmuSnprintf(mesg, sizeof(mesg),
+ "%s.%d", ext->name, event->minor_code);
XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
(void) fprintf(fp, " (%s)", buffer);
}
@@ -96,8 +98,8 @@ int XmuPrintDefaultErrorMessage (dpy, event, fp)
bext = ext;
}
if (bext)
- sprintf(buffer, "%s.%d", bext->name,
- event->error_code - bext->codes.first_error);
+ XmuSnprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
+ event->error_code - bext->codes.first_error);
else
strcpy(buffer, "Value");
XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
@@ -151,9 +153,8 @@ int XmuPrintDefaultErrorMessage (dpy, event, fp)
* and XGetGeometry; print a message for everything else. In all case, do
* not exit.
*/
-int XmuSimpleErrorHandler (dpy, errorp)
- Display *dpy;
- XErrorEvent *errorp;
+int
+XmuSimpleErrorHandler(Display *dpy, XErrorEvent *errorp)
{
switch (errorp->request_code) {
case X_QueryTree:
diff --git a/src/DelCmap.c b/src/DelCmap.c
index 9ab7717..02c73e6 100644
--- a/src/DelCmap.c
+++ b/src/DelCmap.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/DelCmap.c,v 1.7 2001/12/14 19:55:40 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
@@ -32,6 +33,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
/* To remove any standard colormap property, use XmuDeleteStandardColormap().
* XmuDeleteStandardColormap() will remove the specified property from the
@@ -39,10 +41,12 @@ in this Software without prior written authorization from The Open Group.
* property if possible.
*/
-void XmuDeleteStandardColormap(dpy, screen, property)
- Display *dpy; /* specifies the X server to connect to */
- int screen; /* specifies the screen of the display */
- Atom property; /* specifies the standard colormap property */
+void
+XmuDeleteStandardColormap(Display *dpy, int screen, Atom property)
+ /* dpy; - specifies the X server to connect to
+ * screen - specifies the screen of the display
+ * property - specifies the standard colormap property
+ */
{
XStandardColormap *stdcmaps, *s;
int count = 0;
diff --git a/src/DisplayQue.c b/src/DisplayQue.c
index c96223b..9716895 100644
--- a/src/DisplayQue.c
+++ b/src/DisplayQue.c
@@ -25,17 +25,21 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/DisplayQue.c,v 3.5 2001/12/14 19:55:40 dawes Exp $ */
/*
* Author: Jim Fulton, MIT X Consortium
*/
#include <stdio.h>
-#include <X11/Xos.h>
#include <X11/Xlib.h>
+#include <stdlib.h>
#include <X11/Xmu/DisplayQue.h>
-static int _DQCloseDisplay();
+/*
+ * Prototypes
+ */
+static int _DQCloseDisplay(Display*, XPointer);
#define CallCloseCallback(q,e) (void) (*((q)->closefunc)) ((q), (e))
#define CallFreeCallback(q) (void) (*((q)->freefunc)) ((q))
@@ -43,10 +47,10 @@ static int _DQCloseDisplay();
/*
* XmuDQCreate - create a display queue
*/
-XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
- XmuCloseDisplayQueueProc closefunc;
- XmuFreeDisplayQueueProc freefunc;
- XPointer data;
+XmuDisplayQueue *
+XmuDQCreate(XmuCloseDisplayQueueProc closefunc,
+ XmuFreeDisplayQueueProc freefunc,
+ XPointer data)
{
XmuDisplayQueue *q = (XmuDisplayQueue *) malloc (sizeof (XmuDisplayQueue));
if (q) {
@@ -65,9 +69,8 @@ XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
* optionally invoking the close callbacks.
*/
-Bool XmuDQDestroy (q, docallbacks)
- XmuDisplayQueue *q;
- Bool docallbacks;
+Bool
+XmuDQDestroy(XmuDisplayQueue *q, Bool docallbacks)
{
XmuDisplayQueueEntry *e = q->head;
@@ -85,9 +88,8 @@ Bool XmuDQDestroy (q, docallbacks)
/*
* XmuDQLookupDisplay - finds the indicated display on the given queue
*/
-XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
- XmuDisplayQueue *q;
- Display *dpy;
+XmuDisplayQueueEntry *
+XmuDQLookupDisplay(XmuDisplayQueue *q, Display *dpy)
{
XmuDisplayQueueEntry *e;
@@ -102,10 +104,8 @@ XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
* XmuDQAddDisplay - add the specified display to the queue; set data as a
* convenience. Does not ensure that dpy hasn't already been added.
*/
-XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
- XmuDisplayQueue *q;
- Display *dpy;
- XPointer data;
+XmuDisplayQueueEntry *
+XmuDQAddDisplay(XmuDisplayQueue *q, Display *dpy, XPointer data)
{
XmuDisplayQueueEntry *e;
@@ -138,9 +138,8 @@ XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
/*
* XmuDQRemoveDisplay - remove the specified display from the queue
*/
-Bool XmuDQRemoveDisplay (q, dpy)
- XmuDisplayQueue *q;
- Display *dpy;
+Bool
+XmuDQRemoveDisplay(XmuDisplayQueue *q, Display *dpy)
{
XmuDisplayQueueEntry *e;
@@ -173,9 +172,8 @@ Bool XmuDQRemoveDisplay (q, dpy)
* _DQCloseDisplay - upcalled from CloseHook to notify this queue; remove the
* display when finished
*/
-static int _DQCloseDisplay (dpy, arg)
- Display *dpy;
- XPointer arg;
+static int
+_DQCloseDisplay(Display *dpy, XPointer arg)
{
XmuDisplayQueue *q = (XmuDisplayQueue *) arg;
XmuDisplayQueueEntry *e;
diff --git a/src/Distinct.c b/src/Distinct.c
index 1cf3c45..1970a77 100644
--- a/src/Distinct.c
+++ b/src/Distinct.c
@@ -25,12 +25,16 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Distinct.c,v 3.6 2001/12/14 19:55:41 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
*/
-# include <X11/Xlib.h>
+#include <X11/Xlib.h>
+#include <stdlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/StdCmap.h>
/*
* Distinguishable colors routine. Determines if two colors are
@@ -40,9 +44,7 @@ in this Software without prior written authorization from The Open Group.
#define MIN_DISTINGUISH 10000.0
Bool
-XmuDistinguishableColors (colors, count)
-XColor *colors;
-int count;
+XmuDistinguishableColors(XColor *colors, int count)
{
double deltaRed, deltaGreen, deltaBlue;
double dist;
@@ -64,11 +66,8 @@ int count;
}
Bool
-XmuDistinguishablePixels (dpy, cmap, pixels, count)
- Display *dpy;
- Colormap cmap;
- unsigned long *pixels;
- int count;
+XmuDistinguishablePixels(Display *dpy, Colormap cmap,
+ unsigned long *pixels, int count)
{
XColor *defs;
int i, j;
diff --git a/src/DrRndRect.c b/src/DrRndRect.c
index 35aa9d7..22b29e9 100644
--- a/src/DrRndRect.c
+++ b/src/DrRndRect.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/DrRndRect.c,v 1.7 2001/12/14 19:55:41 dawes Exp $ */
/*
* XmuDrawRoundedRectangle, XmuFillRoundedRectangle
@@ -35,145 +36,143 @@ in this Software without prior written authorization from The Open Group.
*/
#include <X11/Xlib.h>
+#include <X11/Xmu/Drawing.h>
void
-XmuDrawRoundedRectangle (dpy, draw, gc, x, y, w, h, ew, eh)
- Display *dpy;
- Drawable draw;
- GC gc;
- int x, y, w, h, ew, eh;
+XmuDrawRoundedRectangle(Display *dpy, Drawable draw, GC gc,
+ int x, int y, int w, int h, int ew, int eh)
{
XArc arcs[8];
+ int ew2, eh2;
- if (ew*2 > w)
- ew = 0;
- if (eh*2 > h)
- eh = 0;
+ if ((ew2 = (ew << 1)) > w)
+ ew2 = ew = 0;
+ if ((eh2 = (eh << 1)) > h)
+ eh2 = eh = 0;
arcs[0].x = x;
arcs[0].y = y;
- arcs[0].width = ew*2;
- arcs[0].height = eh*2;
- arcs[0].angle1 = 180*64;
- arcs[0].angle2 = -90*64;
+ arcs[0].width = ew2;
+ arcs[0].height = eh2;
+ arcs[0].angle1 = 180 * 64;
+ arcs[0].angle2 = -90 * 64;
arcs[1].x = x + ew;
arcs[1].y = y;
- arcs[1].width = w - ew*2;
+ arcs[1].width = w - ew2;
arcs[1].height = 0;
- arcs[1].angle1 = 180*64;
- arcs[1].angle2 = -180*64;
+ arcs[1].angle1 = 180 * 64;
+ arcs[1].angle2 = -180 * 64;
- arcs[2].x = x + w - ew*2;
+ arcs[2].x = x + w - ew2;
arcs[2].y = y;
- arcs[2].width = ew*2;
- arcs[2].height = eh*2;
- arcs[2].angle1 = 90*64;
- arcs[2].angle2 = -90*64;
+ arcs[2].width = ew2;
+ arcs[2].height = eh2;
+ arcs[2].angle1 = 90 * 64;
+ arcs[2].angle2 = -90 * 64;
arcs[3].x = x + w;
arcs[3].y = y + eh;
arcs[3].width = 0;
- arcs[3].height = h - eh*2;
+ arcs[3].height = h - eh2;
arcs[3].angle1 = 90 * 64;
- arcs[3].angle2 = -180*64;
+ arcs[3].angle2 = -180 * 64;
- arcs[4].x = x + w - ew*2;
- arcs[4].y = y + h - eh*2;
- arcs[4].width = ew * 2;
- arcs[4].height = eh * 2;
+ arcs[4].x = x + w - ew2;
+ arcs[4].y = y + h - eh2;
+ arcs[4].width = ew2;
+ arcs[4].height = eh2;
arcs[4].angle1 = 0;
- arcs[4].angle2 = -90*64;
+ arcs[4].angle2 = -90 * 64;
arcs[5].x = x + ew;
arcs[5].y = y + h;
- arcs[5].width = w - ew*2;
+ arcs[5].width = w - ew2;
arcs[5].height = 0;
arcs[5].angle1 = 0;
- arcs[5].angle2 = -180*64;
+ arcs[5].angle2 = -180 * 64;
arcs[6].x = x;
- arcs[6].y = y + h - eh*2;
- arcs[6].width = ew*2;
- arcs[6].height = eh*2;
- arcs[6].angle1 = 270*64;
- arcs[6].angle2 = -90*64;
+ arcs[6].y = y + h - eh2;
+ arcs[6].width = ew2;
+ arcs[6].height = eh2;
+ arcs[6].angle1 = 270 * 64;
+ arcs[6].angle2 = -90 * 64;
arcs[7].x = x;
arcs[7].y = y + eh;
arcs[7].width = 0;
- arcs[7].height = h - eh*2;
- arcs[7].angle1 = 270*64;
- arcs[7].angle2 = -180*64;
- XDrawArcs (dpy, draw, gc, arcs, 8);
+ arcs[7].height = h - eh2;
+ arcs[7].angle1 = 270 * 64;
+ arcs[7].angle2 = -180 * 64;
+
+ XDrawArcs(dpy, draw, gc, arcs, 8);
}
void
-XmuFillRoundedRectangle (dpy, draw, gc, x, y, w, h, ew, eh)
- Display *dpy;
- Drawable draw;
- GC gc;
- int x, y, w, h, ew, eh;
+XmuFillRoundedRectangle(Display *dpy, Drawable draw, GC gc,
+ int x, int y, int w, int h, int ew, int eh)
{
XArc arcs[4];
XRectangle rects[3];
XGCValues vals;
+ int ew2, eh2;
XGetGCValues(dpy, gc, GCArcMode, &vals);
if (vals.arc_mode != ArcPieSlice)
XSetArcMode(dpy, gc, ArcPieSlice);
- if (ew*2 > w)
- ew = 0;
- if (eh*2 > h)
- eh = 0;
+ if ((ew2 = (ew << 1)) > w)
+ ew2 = ew = 0;
+ if ((eh2 = (eh << 1)) > h)
+ eh2 = eh = 0;
arcs[0].x = x;
arcs[0].y = y;
- arcs[0].width = ew*2;
- arcs[0].height = eh*2;
- arcs[0].angle1 = 180*64;
- arcs[0].angle2 = -90*64;
+ arcs[0].width = ew2;
+ arcs[0].height = eh2;
+ arcs[0].angle1 = 180 * 64;
+ arcs[0].angle2 = -90 * 64;
- arcs[1].x = x + w - ew*2;
+ arcs[1].x = x + w - ew2 - 1;
arcs[1].y = y;
- arcs[1].width = ew*2;
- arcs[1].height = eh*2;
- arcs[1].angle1 = 90*64;
- arcs[1].angle2 = -90*64;
-
- arcs[2].x = x + w - ew*2;
- arcs[2].y = y + h - eh*2;
- arcs[2].width = ew*2;
- arcs[2].height = eh*2;
+ arcs[1].width = ew2;
+ arcs[1].height = eh2;
+ arcs[1].angle1 = 90 * 64;
+ arcs[1].angle2 = -90 * 64;
+
+ arcs[2].x = x + w - ew2 - 1;
+ arcs[2].y = y + h - eh2 - 1;
+ arcs[2].width = ew2;
+ arcs[2].height = eh2;
arcs[2].angle1 = 0;
- arcs[2].angle2 = -90*64;
+ arcs[2].angle2 = -90 * 64;
arcs[3].x = x;
- arcs[3].y = y + h - eh*2;
- arcs[3].width = ew*2;
- arcs[3].height = eh*2;
- arcs[3].angle1 = 270*64;
- arcs[3].angle2 = -90*64;
+ arcs[3].y = y + h - eh2 - 1;
+ arcs[3].width = ew2;
+ arcs[3].height = eh2;
+ arcs[3].angle1 = 270 * 64;
+ arcs[3].angle2 = -90 * 64;
- XFillArcs (dpy, draw, gc, arcs, 4);
+ XFillArcs(dpy, draw, gc, arcs, 4);
rects[0].x = x + ew;
rects[0].y = y;
- rects[0].width = w - ew*2;
+ rects[0].width = w - ew2;
rects[0].height = h;
rects[1].x = x;
rects[1].y = y + eh;
rects[1].width = ew;
- rects[1].height = h - eh*2;
+ rects[1].height = h - eh2;
rects[2].x = x + w - ew;
rects[2].y = y + eh;
rects[2].width = ew;
- rects[2].height = h - eh*2;
+ rects[2].height = h - eh2;
- XFillRectangles (dpy, draw, gc, rects, 3);
+ XFillRectangles(dpy, draw, gc, rects, 3);
if (vals.arc_mode != ArcPieSlice)
XSetArcMode(dpy, gc, vals.arc_mode);
diff --git a/src/DrawLogo.c b/src/DrawLogo.c
index 4c093c5..4cb4299 100644
--- a/src/DrawLogo.c
+++ b/src/DrawLogo.c
@@ -25,8 +25,10 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/DrawLogo.c,v 1.8 2001/12/14 19:55:41 dawes Exp $ */
#include <X11/Xlib.h>
+#include <X11/Xmu/Drawing.h>
/*
* Draw the "official" X Window System Logo, designed by Danny Chong
@@ -37,13 +39,9 @@ in this Software without prior written authorization from The Open Group.
* if it is tiny. Also makes the various linear elements of
* the logo line up as well as possible considering rasterization.
*/
-
-XmuDrawLogo(dpy, drawable, gcFore, gcBack, x, y, width, height)
- Display *dpy;
- Drawable drawable;
- GC gcFore, gcBack;
- int x, y;
- unsigned int width, height;
+void
+XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
+ int x, int y, unsigned int width, unsigned int height)
{
unsigned int size;
int thin, gap, d31;
diff --git a/src/EditresCom.c b/src/EditresCom.c
index b4677f1..5ddd653 100644
--- a/src/EditresCom.c
+++ b/src/EditresCom.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/EditresCom.c,v 1.17 2002/12/03 18:07:59 paulo Exp $ */
/*
* Author: Chris D. Peterson, Dave Sternlicht, MIT X Consortium
@@ -38,72 +39,75 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xatom.h>
#include <X11/Xos.h> /* for strcpy declaration */
+#include <X11/Xfuncs.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xmu/EditresP.h>
#include <X11/Xmd.h>
-
+#include <X11/Xmu/CharSet.h>
+#include <X11/Xmu/SysUtil.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#define _XEditResPutBool _XEditResPut8
#define _XEditResPutResourceType _XEditResPut8
-/************************************************************
- *
- * Local structure definitions.
- *
- ************************************************************/
-
-typedef enum { BlockNone, BlockSetValues, BlockAll } EditresBlock;
+/*
+ * Types
+ */
+typedef enum {
+ BlockNone,
+ BlockSetValues,
+ BlockAll
+} EditresBlock;
typedef struct _SetValuesEvent {
- EditresCommand type; /* first field must be type. */
- WidgetInfo * widgets;
- unsigned short num_entries; /* number of set values requests. */
- char * name;
- char * res_type;
+ EditresCommand type; /* first field must be type */
+ WidgetInfo *widgets;
+ unsigned short num_entries; /* number of set values requests */
+ char *name;
+ char *res_type;
XtPointer value;
unsigned short value_len;
} SetValuesEvent;
typedef struct _SVErrorInfo {
- SetValuesEvent * event;
- ProtocolStream * stream;
- unsigned short * count;
- WidgetInfo * entry;
+ SetValuesEvent *event;
+ ProtocolStream *stream;
+ unsigned short *count;
+ WidgetInfo *entry;
} SVErrorInfo;
typedef struct _GetValuesEvent {
EditresCommand type; /* first field must be type */
- WidgetInfo * widgets;
+ WidgetInfo *widgets;
unsigned short num_entries; /* number of get values requests */
- char * name;
+ char *name;
} GetValuesEvent;
typedef struct _FindChildEvent {
- EditresCommand type; /* first field must be type. */
- WidgetInfo * widgets;
+ EditresCommand type; /* first field must be type */
+ WidgetInfo *widgets;
short x, y;
} FindChildEvent;
typedef struct _GenericGetEvent {
- EditresCommand type; /* first field must be type. */
- WidgetInfo * widgets;
- unsigned short num_entries; /* number of set values requests. */
+ EditresCommand type; /* first field must be type */
+ WidgetInfo *widgets;
+ unsigned short num_entries; /* number of set values requests */
} GenericGetEvent, GetResEvent, GetGeomEvent;
/*
- * Things that are common to all events.
+ * Common to all events
*/
-
typedef struct _AnyEvent {
- EditresCommand type; /* first field must be type. */
- WidgetInfo * widgets;
+ EditresCommand type; /* first field must be type */
+ WidgetInfo *widgets;
} AnyEvent;
/*
- * The event union.
+ * The event union
*/
-
typedef union _EditresEvent {
AnyEvent any_event;
SetValuesEvent set_values_event;
@@ -116,7 +120,7 @@ typedef struct _Globals {
EditresBlock block;
SVErrorInfo error_info;
ProtocolStream stream;
- ProtocolStream * command_stream; /* command stream. */
+ ProtocolStream *command_stream; /* command stream */
#if defined(LONG64) || defined(WORD64)
unsigned long base_address;
#endif
@@ -124,343 +128,376 @@ typedef struct _Globals {
#define CURRENT_PROTOCOL_VERSION 5L
-#define streq(a,b) (strcmp( (a), (b) ) == 0)
+#define streq(a,b) (strcmp((a), (b)) == 0)
-static Atom res_editor_command, res_editor_protocol, client_value;
-
-static Globals globals;
+/*
+ * Prototypes
+ */
+static Widget _FindChild(Widget, int, int);
+static void _XEditresGetStringValues(Widget, Arg*, int);
+static XtPointer BuildReturnPacket(ResIdent, EditresCommand, ProtocolStream*);
+static void CommandDone(Widget, Atom*, Atom*);
+static Boolean ConvertReturnCommand(Widget, Atom*, Atom*, Atom*, XtPointer*,
+ unsigned long*, int*);
+static Boolean CvtStringToBlock(Display*, XrmValue*, Cardinal*,
+ XrmValue*, XrmValue*, XtPointer*);
+static EditresEvent *BuildEvent(Widget, Atom, XtPointer, ResIdent,
+ unsigned long);
+static char *DoFindChild(Widget, EditresEvent*, ProtocolStream*);
+static char *DoGetGeometry(Widget, EditresEvent*, ProtocolStream*);
+static char *DoGetResources(Widget, EditresEvent*, ProtocolStream*);
+static char *DoSetValues(Widget, EditresEvent*, ProtocolStream*);
+static void DumpChildren(Widget, ProtocolStream*, unsigned short*);
+static char *DumpValues(Widget, EditresEvent*, ProtocolStream*);
+static char *DumpWidgets(Widget, EditresEvent*, ProtocolStream*);
+static void ExecuteCommand(Widget, Atom, ResIdent, EditresEvent*);
+static void ExecuteGetGeometry(Widget, ProtocolStream*);
+static void ExecuteGetResources(Widget w, ProtocolStream *stream);
+static void ExecuteSetValues(Widget, SetValuesEvent*, WidgetInfo*,
+ ProtocolStream*, unsigned short*);
+static void FreeEvent(EditresEvent*);
+static void GetCommand(Widget w, XtPointer, Atom*, Atom*, XtPointer,
+ unsigned long*, int*);
+static void HandleToolkitErrors(String, String, String, String,
+ String*, Cardinal*);
+static void InsertWidget(ProtocolStream*, Widget);
+static Bool IsChild(Widget, Widget, Widget);
+static Bool isApplicationShell(Widget);
+static void LoadResources(Widget);
+static Bool PositionInChild(Widget, int, int);
+static int qcmp_widget_list(register _Xconst void*, register _Xconst void*);
+static void SendCommand(Widget, Atom, ResIdent, EditresCommand,
+ ProtocolStream*);
+static void SendFailure(Widget, Atom, ResIdent, char*);
+static char *VerifyWidget(Widget, WidgetInfo*);
-static void SendFailure(), SendCommand(), InsertWidget(), ExecuteCommand();
-static void FreeEvent(), ExecuteSetValues(), ExecuteGetGeometry();
-static void ExecuteGetResources();
+/*
+ * External
+ */
+void _XEditResCheckMessages(Widget, XtPointer, XEvent*, Boolean*);
-static void GetCommand();
-static void LoadResources();
-static Boolean IsChild();
-static void DumpChildren();
-static char *DumpWidgets(), *DoSetValues(), *DoFindChild();
-static char *DoGetGeometry(), *DoGetResources(), *DumpValues();
+/*
+ * Initialization
+ */
+static Atom res_editor_command, res_editor_protocol, client_value;
+static Globals globals;
/************************************************************
- *
* Resource Editor Communication Code
- *
************************************************************/
-
-/* Function Name: _XEditResCheckMessages
- * Description: This callback routine is set on all shell widgets,
- * and checks to see if a client message event
- * has come from the resource editor.
- * Arguments: w - the shell widget.
- * data - *** UNUSED ***
- * event - The X Event that triggered this handler.
- * cont - *** UNUSED ***.
- * Returns: none.
+/*
+ * Function:
+ * _XEditResCheckMessages
+ *
+ * Parameters:
+ * data - unused
+ * event - The X Event that triggered this handler
+ * cont - unused
+ *
+ * Description:
+ * This callback routine is set on all shell widgets, and checks to
+ * see if a client message event has come from the resource editor.
*/
-
-/* ARGSUSED */
+/*ARGSUSED*/
void
-_XEditResCheckMessages(w, data, event, cont)
-Widget w;
-XtPointer data;
-XEvent *event;
-Boolean *cont;
+_XEditResCheckMessages(Widget w, XtPointer data, XEvent *event, Boolean *cont)
{
Time time;
ResIdent ident;
- static Boolean first_time = FALSE;
+ static Boolean first_time = False;
static Atom res_editor, res_comm;
- Display * dpy;
+ Display *dpy;
- if (event->type == ClientMessage) {
- XClientMessageEvent * c_event = (XClientMessageEvent *) event;
+ if (event->type == ClientMessage)
+ {
+ XClientMessageEvent * c_event = (XClientMessageEvent *)event;
dpy = XtDisplay(w);
- if (!first_time) {
+ if (!first_time)
+ {
Atom atoms[4];
- static char* names[] = {
+ static char *names[] = {
EDITRES_NAME, EDITRES_COMMAND_ATOM,
- EDITRES_PROTOCOL_ATOM, EDITRES_CLIENT_VALUE };
+ EDITRES_PROTOCOL_ATOM, EDITRES_CLIENT_VALUE
+ };
- first_time = TRUE;
- XInternAtoms(dpy, names, 4, FALSE, atoms);
+ first_time = True;
+ XInternAtoms(dpy, names, 4, False, atoms);
res_editor = atoms[0];
res_editor_command = atoms[1];
res_editor_protocol = atoms[2];
- /* Used in later procedures. */
+ /* Used in later procedures */
client_value = atoms[3];
LoadResources(w);
}
- if ((c_event->message_type != res_editor) ||
- (c_event->format != EDITRES_SEND_EVENT_FORMAT))
+ if ((c_event->message_type != res_editor)
+ || (c_event->format != EDITRES_SEND_EVENT_FORMAT))
return;
time = c_event->data.l[0];
res_comm = c_event->data.l[1];
ident = (ResIdent) c_event->data.l[2];
- if (c_event->data.l[3] != CURRENT_PROTOCOL_VERSION) {
+ if (c_event->data.l[3] != CURRENT_PROTOCOL_VERSION)
+ {
_XEditResResetStream(&globals.stream);
- _XEditResPut8(&globals.stream, CURRENT_PROTOCOL_VERSION);
+ _XEditResPut8(&globals.stream, (unsigned int) CURRENT_PROTOCOL_VERSION);
SendCommand(w, res_comm, ident, ProtocolMismatch, &globals.stream);
return;
}
XtGetSelectionValue(w, res_comm, res_editor_command,
- GetCommand, (XtPointer)(long) ident, time);
+ GetCommand, (XtPointer)(long)ident, time);
}
}
-/* Function Name: BuildEvent
- * Description: Takes the info out the protocol stream an constructs
+/*
+ * Function:
+ * BuildEvent
+ *
+ * Parameters:
+ * w - widget to own selection, in case of error
+ * sel - selection to send error message beck in
+ * data - the data for the request
+ * ident - the id number we are looking for
+ * length - length of request
+ *
+ * Description:
+ * Takes the info out the protocol stream an constructs
* the proper event structure.
- * Arguments: w - widget to own selection, in case of error.
- * sel - selection to send error message beck in.
- * data - the data for the request.
- * ident - the id number we are looking for.
- * length - length of request.
- * Returns: the event, or NULL.
+ *
+ * Returns:
+ * the event, or NULL
*/
-
-#define ERROR_MESSAGE ("Client: Improperly formatted protocol request")
-
+#if defined(ERROR_MESSAGE)
+#undef ERROR_MESSAGE
+#endif
+#define ERROR_MESSAGE "Client: Improperly formatted protocol request"
static EditresEvent *
-BuildEvent(w, sel, data, ident, length)
-Widget w;
-Atom sel;
-XtPointer data;
-ResIdent ident;
-unsigned long length;
+BuildEvent(Widget w, Atom sel, XtPointer data, ResIdent ident,
+ unsigned long length)
{
- EditresEvent * event;
+ EditresEvent *event;
ProtocolStream alloc_stream, *stream;
unsigned char temp;
register unsigned int i;
- stream = &alloc_stream; /* easier to think of it this way... */
-
- stream->current = stream->top = (unsigned char *) data;
- stream->size = HEADER_SIZE; /* size of header. */
+ stream = &alloc_stream;
+ stream->current = stream->top = (unsigned char *)data;
+ stream->size = HEADER_SIZE; /* size of header */
/*
- * Retrieve the Header.
+ * Retrieve the Header
*/
-
- if (length < HEADER_SIZE) {
- SendFailure(w, sel, ident, Failure, ERROR_MESSAGE);
- return(NULL);
+ if (length < HEADER_SIZE)
+ {
+ SendFailure(w, sel, ident, ERROR_MESSAGE);
+ return (NULL);
}
- (void) _XEditResGet8(stream, &temp);
- if (temp != ident) /* Id's don't match, ignore request. */
- return(NULL);
+ (void)_XEditResGet8(stream, &temp);
+ if (temp != ident) /* Id's don't match, ignore request */
+ return (NULL);
- event = (EditresEvent *) XtCalloc(sizeof(EditresEvent), 1);
+ event = (EditresEvent *)XtCalloc(sizeof(EditresEvent), 1);
- (void) _XEditResGet8(stream, &temp);
- event->any_event.type = (EditresCommand) temp;
- (void) _XEditResGet32(stream, &(stream->size));
- stream->top = stream->current; /* reset stream to top of value.*/
+ (void)_XEditResGet8(stream, &temp);
+ event->any_event.type = (EditresCommand)temp;
+ (void)_XEditResGet32(stream, &stream->size);
+ stream->top = stream->current; /* reset stream to top of value */
/*
- * Now retrieve the data segment.
+ * Now retrieve the data segment
*/
-
- switch(event->any_event.type) {
+ switch(event->any_event.type)
+ {
case SendWidgetTree:
break; /* no additional info */
case SetValues:
{
- SetValuesEvent * sv_event = (SetValuesEvent *) event;
+ SetValuesEvent *sv_event = (SetValuesEvent *)event;
- if ( !(_XEditResGetString8(stream, &(sv_event->name)) &&
- _XEditResGetString8(stream, &(sv_event->res_type))))
- {
+ if (!(_XEditResGetString8(stream, &sv_event->name)
+ && _XEditResGetString8(stream, &sv_event->res_type)))
goto done;
- }
/*
* Since we need the value length, we have to pull the
- * value out by hand.
+ * value out by hand
*/
-
- if (!_XEditResGet16(stream, &(sv_event->value_len)))
+ if (!_XEditResGet16(stream, &sv_event->value_len))
goto done;
- sv_event->value = XtMalloc(sizeof(char) *
- (sv_event->value_len + 1));
+ sv_event->value = XtMalloc(sizeof(char) * (sv_event->value_len + 1));
- for (i = 0; i < sv_event->value_len; i++) {
- if (!_XEditResGet8(stream,
- (unsigned char *) sv_event->value + i))
- {
+ for (i = 0; i < sv_event->value_len; i++)
+ if (!_XEditResGet8(stream, (unsigned char *)sv_event->value + i))
goto done;
- }
- }
- ((char*)sv_event->value)[i] = '\0'; /* NULL terminate that sucker. */
- if (!_XEditResGet16(stream, &(sv_event->num_entries)))
+ ((char*)sv_event->value)[i] = '\0';
+
+ if (!_XEditResGet16(stream, &sv_event->num_entries))
goto done;
sv_event->widgets = (WidgetInfo *)
XtCalloc(sizeof(WidgetInfo), sv_event->num_entries);
- for (i = 0; i < sv_event->num_entries; i++) {
+ for (i = 0; i < sv_event->num_entries; i++)
if (!_XEditResGetWidgetInfo(stream, sv_event->widgets + i))
goto done;
}
- }
break;
case FindChild:
{
- FindChildEvent * find_event = (FindChildEvent *) event;
+ FindChildEvent *find_event = (FindChildEvent *)event;
- find_event->widgets = (WidgetInfo *)
- XtCalloc(sizeof(WidgetInfo), 1);
+ find_event->widgets = (WidgetInfo *)XtCalloc(sizeof(WidgetInfo), 1);
- if (!(_XEditResGetWidgetInfo(stream, find_event->widgets) &&
- _XEditResGetSigned16(stream, &(find_event->x)) &&
- _XEditResGetSigned16(stream, &(find_event->y))))
- {
+ if (!(_XEditResGetWidgetInfo(stream, find_event->widgets)
+ && _XEditResGetSigned16(stream, &find_event->x)
+ && _XEditResGetSigned16(stream, &find_event->y)))
goto done;
}
-
- }
break;
case GetGeometry:
case GetResources:
{
- GenericGetEvent * get_event = (GenericGetEvent *) event;
+ GenericGetEvent *get_event = (GenericGetEvent *)event;
- if (!_XEditResGet16(stream, &(get_event->num_entries)))
+ if (!_XEditResGet16(stream, &get_event->num_entries))
goto done;
get_event->widgets = (WidgetInfo *)
XtCalloc(sizeof(WidgetInfo), get_event->num_entries);
- for (i = 0; i < get_event->num_entries; i++) {
+
+ for (i = 0; i < get_event->num_entries; i++)
if (!_XEditResGetWidgetInfo(stream, get_event->widgets + i))
goto done;
}
- }
break;
-
case GetValues:
{
- GetValuesEvent * gv_event = (GetValuesEvent *) event;
- _XEditResGetString8(stream, &(gv_event->name));
- _XEditResGet16(stream, &(gv_event->num_entries));
+ GetValuesEvent *gv_event = (GetValuesEvent *)event;
+
+ _XEditResGetString8(stream, &gv_event->name);
+ _XEditResGet16(stream, &gv_event->num_entries);
gv_event->widgets = (WidgetInfo *)
XtCalloc(sizeof(WidgetInfo), gv_event->num_entries);
_XEditResGetWidgetInfo(stream, gv_event->widgets);
}
break;
-
default:
{
char buf[BUFSIZ];
- sprintf(buf, "Unknown Protocol request %d.",event->any_event.type);
+ XmuSnprintf(buf, sizeof(buf),
+ "Unknown Protocol request %d.", event->any_event.type);
SendFailure(w, sel, ident, buf);
- return(NULL);
+ FreeEvent(event);
+ return (NULL);
}
}
- return(event);
- done:
+ return (event);
+ done:
SendFailure(w, sel, ident, ERROR_MESSAGE);
FreeEvent(event);
- return(NULL);
+ return (NULL);
}
-/* Function Name: FreeEvent
- * Description: Frees the event structure and any other pieces
- * in it that need freeing.
- * Arguments: event - the event to free.
- * Returns: none.
+/*
+ * Function:
+ * FreeEvent
+ *
+ * Parameters:
+ * event - event to free
+ *
+ * Description:
+ * Frees the event structure and any other pieces in it that need freeing.
*/
-
static void
-FreeEvent(event)
-EditresEvent * event;
+FreeEvent(EditresEvent *event)
{
- if (event->any_event.widgets != NULL) {
+ if (event->any_event.widgets != NULL)
+ {
XtFree((char *)event->any_event.widgets->ids);
XtFree((char *)event->any_event.widgets);
}
- if (event->any_event.type == SetValues) {
- XtFree(event->set_values_event.name); /* XtFree does not free if */
- XtFree(event->set_values_event.res_type); /* value is NULL. */
+ if (event->any_event.type == SetValues)
+ {
+ XtFree(event->set_values_event.name);
+ XtFree(event->set_values_event.res_type);
}
XtFree((char *)event);
}
-/* Function Name: GetCommand
- * Description: Gets the Command out of the selection asserted by the
- * resource manager.
- * Arguments: (See Xt XtConvertSelectionProc)
- * data - contains the ident number for the command.
- * Returns: none.
+/*
+ * Function:
+ * GetCommand
+ *
+ * Parameters:
+ * (See Xt XtConvertSelectionProc)
+ * data - contains the ident number for the command
+ *
+ * Description:
+ * Gets the Command out of the selection asserted by the resource manager.
*/
-
-/* ARGSUSED */
+/*ARGSUSED*/
static void
-GetCommand(w, data, selection, type, value, length, format)
-Widget w;
-XtPointer data, value;
-Atom *selection, *type;
-unsigned long *length;
-int * format;
+GetCommand(Widget w, XtPointer data, Atom *selection, Atom *type,
+ XtPointer value, unsigned long *length, int *format)
{
- ResIdent ident = (ResIdent)(long) data;
- EditresEvent * event;
+ ResIdent ident = (ResIdent)(long)data;
+ EditresEvent *event;
- if ( (*type != res_editor_protocol) || (*format != EDITRES_FORMAT) )
+ if (*type != res_editor_protocol || *format != EDITRES_FORMAT)
return;
- if ((event = BuildEvent(w, *selection, value, ident, *length)) != NULL) {
+ if ((event = BuildEvent(w, *selection, value, ident, *length)) != NULL)
+ {
ExecuteCommand(w, *selection, ident, event);
FreeEvent(event);
}
}
-/* Function Name: ExecuteCommand
- * Description: Executes a command string received from the
- * resource editor.
- * Arguments: w - a widget.
- * command - the command to execute.
- * value - the associated with the command.
- * Returns: none.
+/*
+ * Function:
+ * ExecuteCommand
*
- * NOTES: munges str
+ * Parameters:
+ * w - widget
+ * command - the command to execute
+ * value - the associated with the command
+ *
+ * Description:
+ * Executes a command string received from the resource editor.
*/
-
-/* ARGSUSED */
+/*ARGSUSED*/
static void
-ExecuteCommand(w, sel, ident, event)
-Widget w;
-Atom sel;
-ResIdent ident;
-EditresEvent * event;
+ExecuteCommand(Widget w, Atom sel, ResIdent ident, EditresEvent *event)
{
- char * (*func)();
- char * str;
+ char *(*func)(Widget, EditresEvent*, ProtocolStream*);
+ char *str;
- if (globals.block == BlockAll) {
+ if (globals.block == BlockAll)
+ {
SendFailure(w, sel, ident,
"This client has blocked all Editres commands.");
return;
}
- else if ((globals.block == BlockSetValues) &&
- (event->any_event.type == SetValues)) {
+ else if (globals.block == BlockSetValues
+ && event->any_event.type == SetValues)
+ {
SendFailure(w, sel, ident,
"This client has blocked all SetValues requests.");
return;
}
- switch(event->any_event.type) {
+ switch(event->any_event.type)
+ {
case SendWidgetTree:
#if defined(LONG64) || defined(WORD64)
globals.base_address = (unsigned long)w & 0xFFFFFFFF00000000;
@@ -485,7 +522,9 @@ EditresEvent * event;
default:
{
char buf[BUFSIZ];
- sprintf(buf,"Unknown Protocol request %d.",event->any_event.type);
+
+ XmuSnprintf(buf, sizeof(buf),
+ "Unknown Protocol request %d.",event->any_event.type);
SendFailure(w, sel, ident, buf);
return;
}
@@ -494,114 +533,119 @@ EditresEvent * event;
_XEditResResetStream(&globals.stream);
if ((str = (*func)(w, event, &globals.stream)) == NULL)
SendCommand(w, sel, ident, PartialSuccess, &globals.stream);
- else {
+ else
SendFailure(w, sel, ident, str);
- XtFree(str);
- }
}
-/* Function Name: ConvertReturnCommand
- * Description: Converts a selection.
- * Arguments: w - the widget that owns the selection.
- * selection - selection to convert.
- * target - target type for this selection.
- * type_ret - type of the selection.
- * value_ret - selection value;
- * length_ret - lenght of this selection.
- * format_ret - the format the selection is in.
- * Returns: True if conversion was sucessful.
+/*
+ * Function:
+ * ConvertReturnCommand
+ *
+ * Parameters:
+ * w - the widget that owns the selection
+ * selection - selection to convert
+ * target - target type for this selection
+ * type_ret - type of the selection
+ * value_ret - selection value
+ * length_ret - lenght of this selection
+ * format_ret - the format the selection is in
+ *
+ * Description:
+ * Converts a selection
+ *
+ * Returns:
+ * True if conversion was sucessful
*/
-
-/* ARGSUSED */
+/*ARGSUSED*/
static Boolean
-ConvertReturnCommand(w, selection, target,
- type_ret, value_ret, length_ret, format_ret)
-Widget w;
-Atom * selection, * target, * type_ret;
-XtPointer *value_ret;
-unsigned long * length_ret;
-int * format_ret;
+ConvertReturnCommand(Widget w, Atom *selection, Atom *target, Atom *type_ret,
+ XtPointer *value_ret, unsigned long *length_ret,
+ int *format_ret)
{
/*
- * I assume the intrinsics give me the correct selection back.
+ * I assume the intrinsics give me the correct selection back
*/
-
if ((*target != client_value))
- return(FALSE);
+ return (False);
*type_ret = res_editor_protocol;
- *value_ret = (XtPointer) globals.command_stream->real_top;
+ *value_ret = (XtPointer)globals.command_stream->real_top;
*length_ret = globals.command_stream->size + HEADER_SIZE;
*format_ret = EDITRES_FORMAT;
- return(TRUE);
+ return (True);
}
-/* Function Name: CommandDone
- * Description: done with the selection.
- * Arguments: *** UNUSED ***
- * Returns: none.
+/*
+ * Function:
+ * CommandDone
+ *
+ * Parameters:
+ * widget - unused
+ * selection - unused
+ * target - unused
+ *
+ * Description:
+ * done with the selection
*/
-
-/* ARGSUSED */
+/*ARGSUSED*/
static void
-CommandDone(widget, selection, target)
-Widget widget;
-Atom *selection;
-Atom *target;
+CommandDone(Widget widget, Atom *selection, Atom *target)
{
/* Keep the toolkit from automaticaly freeing the selection value */
}
-/* Function Name: SendFailure
- * Description: Sends a failure message.
- * Arguments: w - the widget to own the selection.
- * sel - the selection to assert.
- * ident - the identifier.
- * str - the error message.
- * Returns: none.
+/*
+ * Function:
+ * SendFailure
+ *
+ * Paramters:
+ * w - widget to own the selection
+ * sel - selection to assert
+ * ident - identifier
+ * str - error message
+ *
+ * Description:
+ * Sends a failure message
*/
-
static void
-SendFailure(w, sel, ident, str)
-Widget w;
-Atom sel;
-ResIdent ident;
-char * str;
+SendFailure(Widget w, Atom sel, ResIdent ident, char *str)
{
_XEditResResetStream(&globals.stream);
_XEditResPutString8(&globals.stream, str);
SendCommand(w, sel, ident, Failure, &globals.stream);
}
-/* Function Name: BuildReturnPacket
- * Description: Builds a return packet, given the data to send.
- * Arguments: ident - the identifier.
- * command - the command code.
- * stream - the protocol stream.
- * Returns: packet - the packet to send.
+/*
+ * Function:
+ * BuildReturnPacket
+ *
+ * Parameters:
+ * ident - identifier
+ * command - command code
+ * stream - protocol stream
+ * Description:
+ * Builds a return packet, given the data to send
+ *
+ * Returns:
+ * packet to send
*/
-
static XtPointer
-BuildReturnPacket(ident, command, stream)
-ResIdent ident;
-EditresCommand command;
-ProtocolStream * stream;
+BuildReturnPacket(ResIdent ident, EditresCommand command,
+ ProtocolStream *stream)
{
long old_alloc, old_size;
- unsigned char * old_current;
+ unsigned char *old_current;
/*
* We have cleverly keep enough space at the top of the header
* for the return protocol stream, so all we have to do is
- * fill in the space.
+ * fill in the space
*/
-
/*
* Fool the insert routines into putting the header in the right
- * place while being damn sure not to realloc (that would be very bad.
+ * place while being damn sure not to realloc (that would be very bad.)
*/
-
old_current = stream->current;
old_alloc = stream->alloc;
old_size = stream->size;
@@ -610,70 +654,78 @@ ProtocolStream * stream;
stream->alloc = stream->size + (2 * HEADER_SIZE);
_XEditResPut8(stream, ident);
- _XEditResPut8(stream, (unsigned char) command);
+ _XEditResPut8(stream, (unsigned char)command);
_XEditResPut32(stream, old_size);
stream->alloc = old_alloc;
stream->current = old_current;
stream->size = old_size;
- return((XtPointer) stream->real_top);
+ return ((XtPointer)stream->real_top);
}
-/* Function Name: SendCommand
- * Description: Builds a return command line.
- * Arguments: w - the widget to own the selection.
- * sel - the selection to assert.
- * ident - the identifier.
- * command - the command code.
- * stream - the protocol stream.
- * Returns: none.
+/*
+ * Function:
+ * SendCommand
+ * Parameters:
+ * w - widget to own the selection
+ * sel - selection to assert
+ * ident - identifier
+ * command - command code
+ * stream - protocol stream
+ *
+ * Description:
+ * Builds a return command line
*/
-
static void
-SendCommand(w, sel, ident, command, stream)
-Widget w;
-Atom sel;
-ResIdent ident;
-EditresCommand command;
-ProtocolStream * stream;
+SendCommand(Widget w, Atom sel, ResIdent ident, EditresCommand command,
+ ProtocolStream *stream)
{
BuildReturnPacket(ident, command, stream);
globals.command_stream = stream;
-/*
+ /*
* I REALLY want to own the selection. Since this was not triggered
* by a user action, and I am the only one using this atom it is safe to
- * use CurrentTime.
+ * use CurrentTime
*/
-
- XtOwnSelection(w, sel, CurrentTime,
- ConvertReturnCommand, NULL, CommandDone);
+ XtOwnSelection(w, sel, CurrentTime, ConvertReturnCommand, NULL, CommandDone);
}
/************************************************************
- *
- * Generic Utility Functions.
- *
+ * Generic Utility Functions
************************************************************/
+static int
+qcmp_widget_list(register _Xconst void *left, register _Xconst void *right)
+{
+ return (char *)*(Widget **)left - (char *)*(Widget **)right;
+}
-/* Function Name: FindChildren
- * Description: Retuns all children (popup, normal and otherwise)
- * of this widget
- * Arguments: parent - the parent widget.
- * children - the list of children.
- * normal - return normal children.
- * popup - return popup children.
- * Returns: the number of children.
+/*
+ * Function:
+ * FindChildren
+ *
+ * Parameters:
+ * parent - parent widget
+ * children - list of children
+ * normal - return normal children
+ * popup - return popup children
+ * extra - return extra children
+ *
+ * Description:
+ * Retuns all children (popup, normal and otherwise) of this widget
+ *
+ * Returns:
+ * number of children
*/
-
static int
-FindChildren(parent, children, normal, popup)
-Widget parent, **children;
-Boolean normal, popup;
+FindChildren(Widget parent, Widget **children, Bool normal, Bool popup,
+ Bool extra)
{
- CompositeWidget cw = (CompositeWidget) parent;
- int i, num_children, current = 0;
+ CompositeWidget cw = (CompositeWidget)parent;
+ Cardinal i, num_children, current = 0;
+ Widget *extra_widgets = NULL;
+ Cardinal num_extra = 0;
num_children = 0;
@@ -683,126 +735,222 @@ Boolean normal, popup;
if (XtIsComposite(parent) && normal)
num_children += cw->composite.num_children;
- if (num_children == 0) {
+ if (XtIsWidget(parent) && extra)
+ {
+ XtResourceList norm_list, cons_list;
+ Cardinal num_norm, num_cons;
+ Arg args[1];
+ Widget widget;
+
+ XtGetResourceList(XtClass(parent), &norm_list, &num_norm);
+
+ if (XtParent(parent) != NULL)
+ XtGetConstraintResourceList(XtClass(XtParent(parent)),
+ &cons_list, &num_cons);
+ else
+ num_cons = 0;
+
+ extra_widgets = (Widget *)XtMalloc(sizeof(Widget));
+ for (i = 0; i < num_norm; i++)
+ if (strcmp(norm_list[i].resource_type, XtRWidget) == 0)
+ {
+ XtSetArg(args[0], norm_list[i].resource_name, &widget);
+ XtGetValues(parent, args, 1);
+ if (widget && XtParent(widget) == parent)
+ {
+ ++num_extra;
+ extra_widgets = (Widget *)
+ XtRealloc((char *)extra_widgets, num_extra * sizeof(Widget));
+ extra_widgets[num_extra - 1] = widget;
+ }
+ }
+ for (i = 0; i < num_cons; i++)
+ if (strcmp(cons_list[i].resource_type, XtRWidget) == 0)
+ {
+ XtSetArg(args[0], cons_list[i].resource_name, &widget);
+ XtGetValues(parent, args, 1);
+ if (widget && XtParent(widget) == parent)
+ {
+ ++num_extra;
+ extra_widgets = (Widget *)
+ XtRealloc((char *)extra_widgets, num_extra * sizeof(Widget));
+ extra_widgets[num_extra - 1] = widget;
+ }
+ }
+ if (num_norm)
+ XtFree((char *)norm_list);
+ if (num_cons)
+ XtFree((char *)cons_list);
+ }
+
+ if ((num_children + num_extra) == 0)
+ {
*children = NULL;
- return(0);
+ return (0);
}
- *children =(Widget*) XtMalloc((Cardinal) sizeof(Widget) * num_children);
+ *children = (Widget *)XtMalloc(sizeof(Widget) * (num_children + num_extra));
if (XtIsComposite(parent) && normal)
- for (i = 0; i < cw->composite.num_children; i++,current++)
+ for (i = 0; i < cw->composite.num_children; i++, current++)
(*children)[current] = cw->composite.children[i];
if (XtIsWidget(parent) && popup)
- for ( i = 0; i < parent->core.num_popups; i++, current++)
+ for (i = 0; i < parent->core.num_popups; i++, current++)
(*children)[current] = parent->core.popup_list[i];
- return(num_children);
+ if (num_extra)
+ /* Check for dups */
+ {
+ Cardinal j, old_num_extra = num_extra;
+
+ qsort(extra_widgets, num_extra, sizeof(Widget), qcmp_widget_list);
+ for (i = 0; i < num_extra - 1; i++)
+ while (i < num_extra - 1 && extra_widgets[i] == extra_widgets[i + 1])
+ {
+ memmove(&extra_widgets[i], &extra_widgets[i + 1],
+ (num_extra - i) * sizeof(Widget));
+ --num_extra;
+ }
+
+ for (i = 0; i < num_children; i++)
+ for (j = 0; j < num_extra; j++)
+ if ((*children)[i] == extra_widgets[j])
+ {
+ memmove(&extra_widgets[j], &extra_widgets[j + 1],
+ (num_extra - j) * sizeof(Widget));
+ --num_extra;
+ }
+
+ if (old_num_extra != num_extra)
+ *children = (Widget *)XtRealloc((char *)*children, sizeof(Widget)
+ * (num_children + num_extra));
+
+ if (num_extra)
+ memcpy(&(*children)[num_children], extra_widgets,
+ sizeof(Widget) * num_extra);
+ }
+ if (extra_widgets)
+ XtFree((char *)extra_widgets);
+ if (num_children + num_extra == 0)
+ {
+ XtFree((char *)*children);
+ *children = NULL;
+ }
+
+ return (num_children + num_extra);
}
-/* Function Name: IsChild
- * Description: check to see of child is a child of parent.
- * Arguments: top - the top of the tree.
- * parent - the parent widget.
- * child - the child.
- * Returns: none.
+/*
+ * Function:
+ * IsChild
+ *
+ * parameters:
+ * top - top of the tree
+ * parent - parent widget
+ * child - child widget
+ *
+ * Description:
+ * Check to see of child is a child of parent
*/
-
-static Boolean
-IsChild(top, parent, child)
-Widget top, parent, child;
+static Bool
+IsChild(Widget top, Widget parent, Widget child)
{
int i, num_children;
- Widget * children;
+ Widget *children;
if (parent == NULL)
- return(top == child);
+ return (top == child);
- num_children = FindChildren(parent, &children, TRUE, TRUE);
+ num_children = FindChildren(parent, &children, True, True, True);
- for (i = 0; i < num_children; i++) {
- if (children[i] == child) {
+ for (i = 0; i < num_children; i++)
+ if (children[i] == child)
+ {
XtFree((char *)children);
- return(TRUE);
- }
+ return (True);
}
XtFree((char *)children);
- return(FALSE);
+ return (False);
}
-/* Function Name: VerifyWidget
- * Description: Makes sure all the widgets still exist.
- * Arguments: w - any widget in the tree.
- * info - the info about the widget to verify.
- * Returns: an error message or NULL.
+/*
+ * Function:
+ * VerifyWidget
+ *
+ * Parameters:
+ * w - any widget in the tree
+ * info - info about the widget to verify
+ *
+ * Description:
+ * Makes sure all the widgets still exist
*/
-
static char *
-VerifyWidget(w, info)
-Widget w;
-WidgetInfo *info;
+VerifyWidget(Widget w, WidgetInfo *info)
{
Widget top;
-
register int count;
register Widget parent;
- register unsigned long * child;
+ register unsigned long *child;
- for (top = w; XtParent(top) != NULL; top = XtParent(top)) {}
+ for (top = w; XtParent(top) != NULL; top = XtParent(top))
+ ;
parent = NULL;
child = info->ids;
count = 0;
- while (TRUE) {
+ while (True)
+ {
if (!IsChild(top, parent, (Widget) *child))
- return(XtNewString("This widget no longer exists in the client."));
+ return ("This widget no longer exists in the client.");
if (++count == info->num_widgets)
break;
- parent = (Widget) *child++;
+ parent = (Widget)*child++;
}
- info->real_widget = (Widget) *child;
- return(NULL);
+ info->real_widget = (Widget)*child;
+
+ return (NULL);
}
/************************************************************
+ * Code to Perform SetValues operations
+ ************************************************************/
+/*
+ * Function:
+ * DoSetValues
*
- * Code to Perform SetValues operations.
+ * Parameters:
+ * w - a widget in the tree
+ * event - event that caused this action
+ * stream - protocol stream to add
*
- ************************************************************/
-
-
-/* Function Name: DoSetValues
- * Description: performs the setvalues requested.
- * Arguments: w - a widget in the tree.
- * event - the event that caused this action.
- * stream - the protocol stream to add.
- * Returns: NULL.
+ * Description:
+ * Performs the setvalues requested
+ *
+ * Returns:
+ * NULL
*/
-
static char *
-DoSetValues(w, event, stream)
-Widget w;
-EditresEvent * event;
-ProtocolStream * stream;
+DoSetValues(Widget w, EditresEvent *event, ProtocolStream *stream)
{
- char * str;
+ char *str;
register unsigned i;
unsigned short count = 0;
- SetValuesEvent * sv_event = (SetValuesEvent *) event;
+ SetValuesEvent *sv_event = (SetValuesEvent *)event;
- _XEditResPut16(stream, count); /* insert 0, will be overwritten later. */
+ _XEditResPut16(stream, count); /* insert 0, will be overwritten later */
- for (i = 0 ; i < sv_event->num_entries; i++) {
- if ((str = VerifyWidget(w, &(sv_event->widgets[i]))) != NULL) {
- _XEditResPutWidgetInfo(stream, &(sv_event->widgets[i]));
+ for (i = 0; i < sv_event->num_entries; i++)
+ {
+ if ((str = VerifyWidget(w, &sv_event->widgets[i])) != NULL)
+ {
+ _XEditResPutWidgetInfo(stream, &sv_event->widgets[i]);
_XEditResPutString8(stream, str);
- XtFree(str);
count++;
}
else
@@ -813,124 +961,86 @@ ProtocolStream * stream;
/*
* Overwrite the first 2 bytes with the real count.
*/
-
*(stream->top) = count >> XER_NBBY;
*(stream->top + 1) = count;
- return(NULL);
+
+ return (NULL);
}
-/* Function Name: HandleToolkitErrors
+/*
+ * Function:
+ * HandleToolkitErrors
+ *
+ * Parameters:
+ * name - name of the error
+ * type - type of the error
+ * class - class of the error
+ * msg - the default message
+ * params - the extra parameters for this message
+ * num_params - ""
+ *
* Description: Handles X Toolkit Errors.
- * Arguments: name - name of the error.
- * type - type of the error.
- * class - class of the error.
- * msg - the default message.
- * params, num_params - the extra parameters for this message.
- * Returns: none.
*/
-
/* ARGSUSED */
static void
-HandleToolkitErrors(name, type, class, msg, params, num_params)
-String name, type, class, msg, *params;
-Cardinal * num_params;
+HandleToolkitErrors(String name, String type, String class, String msg,
+ String *params, Cardinal *num_params)
{
- SVErrorInfo * info = &globals.error_info;
- int len;
- char buf[BUFSIZ];
- char* bufp;
- char* fmt1 = "The `%s' resource is not used by this widget.";
-
- if ( streq(name, "unknownType") ) {
- if ((len = strlen (fmt1) + strlen (info->event->name)) < sizeof buf)
- bufp = buf;
- else
- bufp = XtMalloc (len + 1);
- if (bufp == NULL) {
- bufp = buf;
- strcpy (bufp, "Resource is not used by this widget.");
- } else
- sprintf(bufp, fmt1, info->event->name);
- } else if ( streq(name, "noColormap") ) {
- if ((len = strlen (msg) + strlen (params[0])) < sizeof buf)
- bufp = buf;
- else
- bufp = XtMalloc (len + 1);
- if (bufp == NULL) {
- bufp = buf;
- strcpy (bufp, "Message too long.");
- } else
- sprintf(bufp, msg, params[0]);
- } else if (streq(name, "conversionFailed") || streq(name, "conversionError")) {
- char* fmt2 = "Could not convert the string '%s' for the `%s' resource.";
- char* fmt3 = "Could not convert the `%s' resource.";
- if (streq(info->event->value, XtRString)) {
- if ((len = strlen (fmt2) + strlen (info->event->value) + strlen (info->event->name)) < sizeof buf)
- bufp = buf;
- else
- bufp = XtMalloc (len + 1);
- if (bufp == NULL) {
- bufp = buf;
- strcpy (bufp, "Could not convert the string for the resource.");
- } else
- sprintf(bufp, fmt2, info->event->value, info->event->name);
- } else {
- if ((len = strlen (fmt3) + strlen (info->event->name)) < sizeof buf)
- bufp = buf;
- else
- bufp = XtMalloc (len + 1);
- if (bufp == NULL) {
- bufp = buf;
- strcpy (bufp, "Could not convert the resource.");
- } else
- sprintf(bufp, fmt3, info->event->name);
- }
- } else {
- char* fmt4 = "Name: %s, Type: %s, Class: %s, Msg: %s";
-
- if ((len = strlen (fmt4) + strlen (name) + strlen (type) + strlen (class) + strlen (msg)) < sizeof buf)
- bufp = buf;
+ SVErrorInfo *info = &globals.error_info;
+ char buf[BUFSIZ];
+
+ if (streq(name, "unknownType"))
+ XmuSnprintf(buf, sizeof(buf),
+ "The `%s' resource is not used by this widget.",
+ info->event->name);
+ else if (streq(name, "noColormap"))
+ XmuSnprintf(buf, sizeof(buf), msg, params[0]);
+ else if (streq(name, "conversionFailed") || streq(name, "conversionError"))
+ {
+ if (streq(info->event->value, XtRString))
+ XmuSnprintf(buf, sizeof(buf),
+ "Could not convert the string '%s' for the `%s' "
+ "resource.", info->event->value, info->event->name);
else
- bufp = XtMalloc (len + 1);
- if (bufp == NULL) {
- bufp = buf;
- strcpy (bufp, "Message too long.");
- } else
- sprintf(bufp, fmt4, name, type, class, msg);
+ XmuSnprintf(buf, sizeof(buf),
+ "Could not convert the `%s' resource.",
+ info->event->name);
}
+ else
+ XmuSnprintf(buf, sizeof(buf),
+ "Name: %s, Type: %s, Class: %s, Msg: %s",
+ name, type, class, msg);
/*
- * Insert this info into the protocol stream, and update the count.
+ * Insert this info into the protocol stream, and update the count
*/
-
(*(info->count))++;
_XEditResPutWidgetInfo(info->stream, info->entry);
- _XEditResPutString8(info->stream, bufp);
- if (bufp != buf) XtFree (bufp);
+ _XEditResPutString8(info->stream, buf);
}
-/* Function Name: ExecuteSetValues
- * Description: Performs a setvalues for a given command.
- * Arguments: w - the widget to perform the set_values on.
- * sv_event - the set values event.
- * sv_info - the set_value info.
- * Returns: none.
+/*
+ * Function:
+ * ExecuteSetValues
+ *
+ * Parameters:
+ * w - widget to perform the set_values on
+ * sv_event - set values event
+ * sv_info - set_value info
+ *.
+ * Description:
+ * Performs a setvalues for a given command
*/
-
static void
-ExecuteSetValues(w, sv_event, entry, stream, count)
-Widget w;
-SetValuesEvent * sv_event;
-WidgetInfo * entry;
-ProtocolStream * stream;
-unsigned short * count;
+ExecuteSetValues(Widget w, SetValuesEvent *sv_event, WidgetInfo *entry,
+ ProtocolStream *stream, unsigned short *count)
{
XtErrorMsgHandler old;
+ SVErrorInfo *info = &globals.error_info;
- SVErrorInfo * info = &globals.error_info;
info->event = sv_event; /* No data can be passed to */
info->stream = stream; /* an error handler, so we */
- info->count = count; /* have to use a global, YUCK... */
+ info->count = count; /* have to use a global */
info->entry = entry;
old = XtAppSetWarningMsgHandler(XtWidgetToApplicationContext(w),
@@ -944,67 +1054,68 @@ unsigned short * count;
(void)XtAppSetWarningMsgHandler(XtWidgetToApplicationContext(w), old);
}
-
/************************************************************
- *
* Code for Creating and dumping widget tree.
- *
************************************************************/
-
-/* Function Name: DumpWidgets
- * Description: Given a widget it builds a protocol packet
- * containing the entire widget heirarchy.
- * Arguments: w - a widget in the tree.
- * event - the event that caused this action.
- * stream - the protocol stream to add.
- * Returns: NULL
+/* Function:
+ * DumpWidgets
+ *
+ * Parameters:
+ * w - a widget in the tree
+ * event - event that caused this action
+ * stream - protocol stream to add
+ *
+ * Description:
+ * Given a widget it builds a protocol packet containing the entire
+ * widget heirarchy.
+ *
+ * Returns:
+ * NULL
*/
-
#define TOOLKIT_TYPE ("Xt")
-
-/* ARGSUSED */
+/*ARGSUSED*/
static char *
-DumpWidgets(w, event, stream)
-Widget w;
-EditresEvent * event; /* UNUSED */
-ProtocolStream * stream;
+DumpWidgets(Widget w, EditresEvent *event, ProtocolStream *stream)
{
unsigned short count = 0;
- /* Find Tree's root. */
- for ( ; XtParent(w) != NULL; w = XtParent(w)) {}
+ /* Find Tree's root */
+ for (; XtParent(w) != NULL; w = XtParent(w))
+ ;
/*
- * hold space for count, overwritten later.
+ * hold space for count, overwritten later
*/
-
- _XEditResPut16(stream, (unsigned int) 0);
+ _XEditResPut16(stream, (unsigned int)0);
DumpChildren(w, stream, &count);
/*
- * write out toolkit type (Xt, of course...).
+ * write out toolkit type
*/
-
_XEditResPutString8(stream, TOOLKIT_TYPE);
/*
- * Overwrite the first 2 bytes with the real count.
+ * Overwrite the first 2 bytes with the real count
*/
-
*(stream->top) = count >> XER_NBBY;
*(stream->top + 1) = count;
- return(NULL);
+
+ return (NULL);
}
-/* Function Name: DumpChildren
- * Description: Adds a child's name to the list.
- * Arguments: w - the widget to dump.
- * stream - the stream to dump to.
- * count - number of dumps we have performed.
- * Returns: none.
+/*
+ * Function:
+ * DumpChildren
+ *
+ * Parameters:
+ * w - widget to dump
+ * stream - stream to dump to
+ * count - number of dumps we have performed
+ *
+ * Description:
+ * Adds a child's name to the list.
*/
-
/* This is a trick/kludge. To make shared libraries happier (linking
* against Xmu but not linking against Xt, and apparently even work
* as we desire on SVR4, we need to avoid an explicit data reference
@@ -1013,43 +1124,40 @@ ProtocolStream * stream;
* go that far. Then, we test whether it is an applicationShellWidget
* class by looking for an explicit class name. Seems pretty safe.
*/
-static Bool isApplicationShell(w)
- Widget w;
+static Bool
+isApplicationShell(Widget w)
{
register WidgetClass c;
if (!XtIsTopLevelShell(w))
- return False;
- for (c = XtClass(w); c; c = c->core_class.superclass) {
- if (!strcmp(c->core_class.class_name, "ApplicationShell"))
- return True;
- }
- return False;
+ return (False);
+ for (c = XtClass(w); c; c = c->core_class.superclass)
+ if (strcmp(c->core_class.class_name, "ApplicationShell") == 0)
+ return (True);
+
+ return (False);
}
static void
-DumpChildren(w, stream, count)
-Widget w;
-ProtocolStream * stream;
-unsigned short *count;
+DumpChildren(Widget w, ProtocolStream *stream, unsigned short *count)
{
int i, num_children;
Widget *children;
unsigned long window;
- char * class;
+ char *c_class;
(*count)++;
- InsertWidget(stream, w); /* Insert the widget into the stream. */
+ InsertWidget(stream, w); /* Insert the widget into the stream */
_XEditResPutString8(stream, XtName(w)); /* Insert name */
if (isApplicationShell(w))
- class = ((ApplicationShellWidget) w)->application.class;
+ c_class = ((ApplicationShellWidget)w)->application.class;
else
- class = XtClass(w)->core_class.class_name;
+ c_class = XtClass(w)->core_class.class_name;
- _XEditResPutString8(stream, class); /* Insert class */
+ _XEditResPutString8(stream, c_class); /* Insert class */
if (XtIsWidget(w))
if (XtIsRealized(w))
@@ -1059,13 +1167,12 @@ unsigned short *count;
else
window = EDITRES_IS_OBJECT;
- _XEditResPut32(stream, window); /* Insert window id. */
+ _XEditResPut32(stream, window); /* Insert window id */
/*
- * Find children and recurse.
+ * Find children and recurse
*/
-
- num_children = FindChildren(w, &children, TRUE, TRUE);
+ num_children = FindChildren(w, &children, True, True, True);
for (i = 0; i < num_children; i++)
DumpChildren(children[i], stream, count);
@@ -1073,60 +1180,67 @@ unsigned short *count;
}
/************************************************************
+ * Code for getting the geometry of widgets
+ ************************************************************/
+/*
+ * Function:
+ * DoGetGeometry
*
- * Code for getting the geometry of widgets.
+ * Parameters:
+ * w - widget in the tree
+ * event - event that caused this action
+ * stream - protocol stream to add
*
- ************************************************************/
-
-/* Function Name: DoGetGeometry
- * Description: retrieves the Geometry of each specified widget.
- * Arguments: w - a widget in the tree.
- * event - the event that caused this action.
- * stream - the protocol stream to add.
- * Returns: NULL
+ * Description:
+ * Retrieves the Geometry of each specified widget.
+ *
+ * Returns:
+ * NULL
*/
-
static char *
-DoGetGeometry(w, event, stream)
-Widget w;
-EditresEvent * event;
-ProtocolStream * stream;
+DoGetGeometry(Widget w, EditresEvent *event, ProtocolStream *stream)
{
unsigned i;
- char * str;
- GetGeomEvent * geom_event = (GetGeomEvent *) event;
+ char *str;
+ GetGeomEvent *geom_event = (GetGeomEvent *)event;
_XEditResPut16(stream, geom_event->num_entries);
- for (i = 0 ; i < geom_event->num_entries; i++) {
-
+ for (i = 0; i < geom_event->num_entries; i++)
+ {
/*
- * Send out the widget id.
+ * Send out the widget id
*/
+ _XEditResPutWidgetInfo(stream, &geom_event->widgets[i]);
- _XEditResPutWidgetInfo(stream, &(geom_event->widgets[i]));
- if ((str = VerifyWidget(w, &(geom_event->widgets[i]))) != NULL) {
- _XEditResPutBool(stream, True); /* an error occured. */
- _XEditResPutString8(stream, str); /* set message. */
- XtFree(str);
+ if ((str = VerifyWidget(w, &geom_event->widgets[i])) != NULL)
+ {
+ _XEditResPutBool(stream, True); /* an error occured */
+ _XEditResPutString8(stream, str); /* set message */
}
else
ExecuteGetGeometry(geom_event->widgets[i].real_widget, stream);
}
- return(NULL);
+
+ return (NULL);
}
-/* Function Name: ExecuteGetGeometry
- * Description: Gets the geometry for each widget specified.
- * Arguments: w - the widget to get geom on.
- * stream - stream to append to.
- * Returns: True if no error occured.
+/*
+ * Function:
+ * ExecuteGetGeometry
+ *
+ * Parameters:
+ * w - widget to get geometry
+ * stream - stream to append to
+ *
+ * Description:
+ * Gets the geometry for each widget specified.
+ *
+ * Returns:
+ * True if no error occured.
*/
-
static void
-ExecuteGetGeometry(w, stream)
-Widget w;
-ProtocolStream * stream;
+ExecuteGetGeometry(Widget w, ProtocolStream *stream)
{
int i;
Boolean mapped_when_man;
@@ -1135,10 +1249,11 @@ ProtocolStream * stream;
Cardinal num_args = 0;
Position x, y;
- if ( !XtIsRectObj(w) || (XtIsWidget(w) && !XtIsRealized(w)) ) {
- _XEditResPutBool(stream, False); /* no error. */
- _XEditResPutBool(stream, False); /* not visable. */
- for (i = 0; i < 5; i++) /* fill in extra space with 0's. */
+ if (!XtIsRectObj(w) || (XtIsWidget(w) && !XtIsRealized(w)))
+ {
+ _XEditResPutBool(stream, False); /* no error */
+ _XEditResPutBool(stream, False); /* not visable */
+ for (i = 0; i < 5; i++) /* fill in extra space with 0's */
_XEditResPut16(stream, 0);
return;
}
@@ -1150,24 +1265,27 @@ ProtocolStream * stream;
num_args++;
XtGetValues(w, args, num_args);
- if (!(XtIsManaged(w) && mapped_when_man) && XtIsWidget(w)) {
+ if (!(XtIsManaged(w) && mapped_when_man) && XtIsWidget(w))
+ {
XWindowAttributes attrs;
/*
* The toolkit does not maintain mapping state, we have
- * to go to the server.
+ * to go to the server
*/
-
- if (XGetWindowAttributes(XtDisplay(w), XtWindow(w), &attrs) != 0) {
- if (attrs.map_state != IsViewable) {
- _XEditResPutBool(stream, False); /* no error. */
- _XEditResPutBool(stream, False); /* not visable. */
- for (i = 0; i < 5; i++) /* fill in extra space with 0's. */
+ if (XGetWindowAttributes(XtDisplay(w), XtWindow(w), &attrs) != 0)
+ {
+ if (attrs.map_state != IsViewable)
+ {
+ _XEditResPutBool(stream, False); /* no error */
+ _XEditResPutBool(stream, False); /* not visable */
+ for (i = 0; i < 5; i++) /* fill in extra space with 0's */
_XEditResPut16(stream, 0);
return;
}
}
- else {
+ else
+ {
_XEditResPut8(stream, True); /* Error occured. */
_XEditResPutString8(stream, "XGetWindowAttributes failed.");
return;
@@ -1176,8 +1294,8 @@ ProtocolStream * stream;
XtTranslateCoords(w, -((int) border_width), -((int) border_width), &x, &y);
- _XEditResPutBool(stream, False); /* no error. */
- _XEditResPutBool(stream, True); /* Visable. */
+ _XEditResPutBool(stream, False); /* no error */
+ _XEditResPutBool(stream, True); /* Visable */
_XEditResPut16(stream, x);
_XEditResPut16(stream, y);
_XEditResPut16(stream, width);
@@ -1186,23 +1304,22 @@ ProtocolStream * stream;
}
/************************************************************
+ * Code for executing FindChild
+ ************************************************************/
+/*
+ * Function:
+ * PositionInChild
*
- * Code for executing FindChild.
+ * Parameters:
+ * child - child widget to check
+ * x - location of point to check in the parent's coord space
+ * y - ""
*
- ************************************************************/
-
-/* Function Name: PositionInChild
- * Description: returns true if this location is in the child.
- * Arguments: child - the child widget to check.
- * x, y - location of point to check in the parent's
- * coord space.
- * Returns: TRUE if the position is in this child.
+ * Description:
+ * Returns true if this location is in the child.
*/
-
-static Boolean
-PositionInChild(child, x, y)
-Widget child;
-int x, y;
+static Bool
+PositionInChild(Widget child, int x, int y)
{
Arg args[6];
Cardinal num;
@@ -1210,8 +1327,8 @@ int x, y;
Position child_x, child_y;
Boolean mapped_when_managed;
- if (!XtIsRectObj(child)) /* we must at least be a rect obj. */
- return(FALSE);
+ if (!XtIsRectObj(child)) /* we must at least be a rect obj */
+ return (False);
num = 0;
XtSetArg(args[num], XtNmappedWhenManaged, &mapped_when_managed); num++;
@@ -1225,80 +1342,84 @@ int x, y;
/*
* The only way we will know of the widget is mapped is to see if
* mapped when managed is True and this is a managed child. Otherwise
- * we will have to ask the server if this window is mapped.
+ * we will have to ask the server if this window is mapped
*/
-
- if (XtIsWidget(child) && !(mapped_when_managed && XtIsManaged(child)) ) {
+ if (XtIsWidget(child) && !(mapped_when_managed && XtIsManaged(child)))
+ {
XWindowAttributes attrs;
- if (XGetWindowAttributes(XtDisplay(child),
- XtWindow(child), &attrs) != 0) {
- /* oops */
- }
- else if (attrs.map_state != IsViewable)
- return(FALSE);
+ if (XGetWindowAttributes(XtDisplay(child), XtWindow(child), &attrs)
+ && attrs.map_state != IsViewable)
+ return (False);
}
- return (x >= child_x) &&
- (x <= (child_x + (Position)width + 2 * (Position)border_width)) &&
- (y >= child_y) &&
- (y <= (child_y + (Position)height + 2 * (Position)border_width));
+ return ((x >= child_x)
+ && (x <= (child_x + (Position)width + 2 * (Position)border_width))
+ && (y >= child_y)
+ && (y <= (child_y + (Position)height + 2 * (Position)border_width)));
}
-/* Function Name: _FindChild
- * Description: Finds the child that actually contatians the point shown.
- * Arguments: parent - a widget that is known to contain the point
- * specified.
- * x, y - The point in coordinates relative to the
- * widget specified.
- * Returns: none.
+/*
+ * Function:
+ * _FindChild
+ *
+ * Parameters:
+ * parent - widget that is known to contain the point specified
+ * x - point in coordinates relative to the widget specified
+ * y - ""
+ *
+ * Description:
+ * Finds the child that actually contains the point shown.
*/
-
static Widget
-_FindChild(parent, x, y)
-Widget parent;
-int x, y;
+_FindChild(Widget parent, int x, int y)
{
- Widget * children;
- int i = FindChildren(parent, &children, TRUE, FALSE);
+ Widget *children;
+ int i = FindChildren(parent, &children, True, False, True);
- while (i > 0) {
+ while (i > 0)
+ {
i--;
- if (PositionInChild(children[i], x, y)) {
+ if (PositionInChild(children[i], x, y))
+ {
Widget child = children[i];
XtFree((char *)children);
- return(_FindChild(child, x - child->core.x, y - child->core.y));
+ return (_FindChild(child, x - child->core.x, y - child->core.y));
}
}
XtFree((char *)children);
- return(parent);
+
+ return (parent);
}
-/* Function Name: DoFindChild
- * Description: finds the child that contains the location specified.
- * Arguments: w - a widget in the tree.
- * event - the event that caused this action.
- * stream - the protocol stream to add.
- * Returns: an allocated error message if something went horribly
- * wrong and no set values were performed, else NULL.
+/*
+ * Function:
+ * DoFindChild
+ *
+ * Parameters:
+ * w - widget in the tree
+ * event - event that caused this action
+ * stream - protocol stream to add
+ * Description:
+ * Finds the child that contains the location specified.
+ *
+ * Returns:
+ * An allocated error message if something went horribly wrong and
+ * no set values were performed, else NULL.
*/
-
static char *
-DoFindChild(w, event, stream)
-Widget w;
-EditresEvent * event;
-ProtocolStream * stream;
+DoFindChild(Widget w, EditresEvent *event, ProtocolStream *stream)
{
- char * str;
+ char *str;
Widget parent, child;
Position parent_x, parent_y;
- FindChildEvent * find_event = (FindChildEvent *) event;
+ FindChildEvent *find_event = (FindChildEvent *)event;
if ((str = VerifyWidget(w, find_event->widgets)) != NULL)
- return(str);
+ return (str);
parent = find_event->widgets->real_widget;
@@ -1309,229 +1430,247 @@ ProtocolStream * stream;
find_event->y - (int) parent_y);
InsertWidget(stream, child);
- return(NULL);
+
+ return (NULL);
}
/************************************************************
+ * Procedures for performing GetResources
+ ************************************************************/
+/*
+ * Function:
+ * DoGetResources
*
- * Procedures for performing GetResources.
+ * Parameters:
+ * w - widget in the tree
+ * event - event that caused this action
+ * stream - protocol stream to add
*
- ************************************************************/
-
-/* Function Name: DoGetResources
- * Description: Gets the Resources associated with the widgets passed.
- * Arguments: w - a widget in the tree.
- * event - the event that caused this action.
- * stream - the protocol stream to add.
- * Returns: NULL
+ * Description:
+ * Gets the Resources associated with the widgets passed.
+ *
+ * Returns:
+ * NULL
*/
-
static char *
-DoGetResources(w, event, stream)
-Widget w;
-EditresEvent * event;
-ProtocolStream * stream;
+DoGetResources(Widget w, EditresEvent *event, ProtocolStream *stream)
{
unsigned int i;
- char * str;
- GetResEvent * res_event = (GetResEvent *) event;
+ char *str;
+ GetResEvent *res_event = (GetResEvent *)event;
_XEditResPut16(stream, res_event->num_entries); /* number of replys */
- for (i = 0 ; i < res_event->num_entries; i++) {
+ for (i = 0; i < res_event->num_entries; i++)
+ {
/*
- * Send out the widget id.
+ * Send out the widget id
*/
- _XEditResPutWidgetInfo(stream, &(res_event->widgets[i]));
- if ((str = VerifyWidget(w, &(res_event->widgets[i]))) != NULL) {
- _XEditResPutBool(stream, True); /* an error occured. */
- _XEditResPutString8(stream, str); /* set message. */
- XtFree(str);
+ _XEditResPutWidgetInfo(stream, &res_event->widgets[i]);
+ if ((str = VerifyWidget(w, &res_event->widgets[i])) != NULL)
+ {
+ _XEditResPutBool(stream, True); /* an error occured */
+ _XEditResPutString8(stream, str); /* set message */
}
- else {
- _XEditResPutBool(stream, False); /* no error occured. */
- ExecuteGetResources(res_event->widgets[i].real_widget,
- stream);
+ else
+ {
+ _XEditResPutBool(stream, False); /* no error occured */
+ ExecuteGetResources(res_event->widgets[i].real_widget, stream);
}
}
- return(NULL);
+
+ return (NULL);
}
-/* Function Name: ExecuteGetResources.
- * Description: Gets the resources for any individual widget.
- * Arguments: w - the widget to get resources on.
- * stream - the protocol stream.
- * Returns: none.
+/* Function:
+ * ExecuteGetResources
+ *
+ * Parameters:
+ * w - widget to get resources on
+ * stream - protocol stream
+ *
+ * Description:
+ * Gets the resources for any individual widget
*/
-
static void
-ExecuteGetResources(w, stream)
-Widget w;
-ProtocolStream * stream;
+ExecuteGetResources(Widget w, ProtocolStream *stream)
{
XtResourceList norm_list, cons_list;
Cardinal num_norm, num_cons;
- register int i;
+ register Cardinal i;
/*
- * Get Normal Resources.
+ * Get Normal Resources
*/
-
XtGetResourceList(XtClass(w), &norm_list, &num_norm);
if (XtParent(w) != NULL)
- XtGetConstraintResourceList(XtClass(XtParent(w)),&cons_list,&num_cons);
+ XtGetConstraintResourceList(XtClass(XtParent(w)), &cons_list,&num_cons);
else
num_cons = 0;
- _XEditResPut16(stream, num_norm + num_cons); /* how many resources. */
+ _XEditResPut16(stream, num_norm + num_cons); /* how many resources */
/*
- * Insert all the normal resources.
+ * Insert all the normal resources
*/
-
- for ( i = 0; i < (int) num_norm; i++) {
+ for (i = 0; i < num_norm; i++)
+ {
_XEditResPutResourceType(stream, NormalResource);
_XEditResPutString8(stream, norm_list[i].resource_name);
_XEditResPutString8(stream, norm_list[i].resource_class);
_XEditResPutString8(stream, norm_list[i].resource_type);
}
- XtFree((char *) norm_list);
+ XtFree((char *)norm_list);
/*
- * Insert all the constraint resources.
+ * Insert all the constraint resources
*/
-
- if (num_cons > 0) {
- for ( i = 0; i < (int) num_cons; i++) {
+ if (num_cons > 0)
+ {
+ for (i = 0; i < num_cons; i++)
+ {
_XEditResPutResourceType(stream, ConstraintResource);
_XEditResPutString8(stream, cons_list[i].resource_name);
_XEditResPutString8(stream, cons_list[i].resource_class);
_XEditResPutString8(stream, cons_list[i].resource_type);
}
- XtFree((char *) cons_list);
+ XtFree((char *)cons_list);
}
}
/*
- * Function Name: DumpValues
- * Description: Returns resource values to the resource editor.
- * Arguments: event - the event that caused this action.
- * stream - the protocol stream to add.
- * Returns: NULL
+ * Function:
+ * DumpValues
+ *
+ * Parameters:
+ * event - event that caused this action
+ * stream - protocol stream to add
+ *
+ * Description:
+ * Returns resource values to the resource editor.
+ *
+ * Returns:
+ * NULL
*/
-
-static char*
-DumpValues(w, event, stream) /* ARGSUSED */
-Widget w;
-EditresEvent* event;
-ProtocolStream* stream;
+/*ARGSUSED*/
+static char *
+DumpValues(Widget w, EditresEvent* event, ProtocolStream* stream)
{
+ char *str;
Arg warg[1];
String res_value = NULL;
- GetValuesEvent * gv_event = (GetValuesEvent *)event;
-
- /* put the count in the stream. */
+ GetValuesEvent *gv_event = (GetValuesEvent *)event;
- _XEditResPut16(stream, (unsigned int) 1);
+ /* put the count in the stream */
+ _XEditResPut16(stream, (unsigned int)1);
- /* get the resource of the widget asked for by the */
- /* resource editor and insert it into the stream */
+ /*
+ * Get the resource of the widget asked for by the
+ * resource editor and insert it into the stream
+ */
XtSetArg(warg[0], gv_event->name, &res_value);
- /*_XtGetStringValues(gv_event->widgets[0].ids[0], warg, 1);*/
- if (!res_value) res_value = "NoValue";
+
+ if ((str = VerifyWidget(w, &gv_event->widgets[0])) != NULL)
+ _XEditResPutString8(stream, str);
+ else
+ {
+ _XEditresGetStringValues(gv_event->widgets[0].real_widget, warg, 1);
+ if (!res_value)
+ res_value = "NoValue";
_XEditResPutString8(stream, res_value);
- return(NULL);
+ }
+
+ return (NULL);
}
/************************************************************
+ * Code for inserting values into the protocol stream
+ ************************************************************/
+/*
+ * Function:
+ * InsertWidget
*
- * Code for inserting values into the protocol stream.
+ * Parameters:
+ * stream - protocol stream
+ * w - widget to insert
*
- ************************************************************/
-
-/* Function Name: InsertWidget
- * Description: Inserts the full parent heirarchy of this
- * widget into the protocol stream as a widget list.
- * Arguments: stream - the protocol stream.
- * w - the widget to insert.
- * Returns: none
+ * Description:
+ * Inserts the full parent hierarchy of this widget into the protocol
+ * stream as a widget list.
*/
-
static void
-InsertWidget(stream, w)
-ProtocolStream * stream;
-Widget w;
+InsertWidget(ProtocolStream *stream, Widget w)
{
Widget temp;
- unsigned long * widget_list;
+ unsigned long *widget_list;
register int i, num_widgets;
- for (temp = w, i = 0; temp != 0; temp = XtParent(temp), i++) {}
+ for (temp = w, i = 0; temp != 0; temp = XtParent(temp), i++)
+ ;
num_widgets = i;
- widget_list = (unsigned long *)
- XtMalloc(sizeof(unsigned long) * num_widgets);
+ widget_list = (unsigned long *)XtMalloc(sizeof(unsigned long) * num_widgets);
/*
- * Put the widgets into the list.
- * make sure that they are inserted in the list from parent -> child.
+ * Put the widgets into the list
+ * make sure that they are inserted in the list from parent -> child
*/
-
for (i--, temp = w; temp != NULL; temp = XtParent(temp), i--)
- widget_list[i] = (unsigned long) temp;
+ widget_list[i] = (unsigned long)temp;
- _XEditResPut16(stream, num_widgets); /* insert number of widgets. */
- for (i = 0; i < num_widgets; i++) /* insert Widgets themselves. */
+ _XEditResPut16(stream, num_widgets); /* insert number of widgets */
+ for (i = 0; i < num_widgets; i++) /* insert Widgets themselves */
_XEditResPut32(stream, widget_list[i]);
XtFree((char *)widget_list);
}
/************************************************************
+ * All of the following routines are public
+ ************************************************************/
+/*
+ * Function:
+ * _XEditResPutString8
*
- * All of the following routines are public.
+ * Parameters:
+ * stream - stream to insert string into
+ * str - string to insert
*
- ************************************************************/
-
-/* Function Name: _XEditResPutString8
- * Description: Inserts a string into the protocol stream.
- * Arguments: stream - stream to insert string into.
- * str - string to insert.
- * Returns: none.
+ * Description:
+ * Inserts a string into the protocol stream.
*/
-
void
-_XEditResPutString8(stream, str)
-ProtocolStream * stream;
-char * str;
+_XEditResPutString8(ProtocolStream *stream, char *str)
{
int i, len = strlen(str);
_XEditResPut16(stream, len);
- for (i = 0 ; i < len ; i++, str++)
+ for (i = 0; i < len; i++, str++)
_XEditResPut8(stream, *str);
}
-/* Function Name: _XEditResPut8
- * Description: Inserts an 8 bit integer into the protocol stream.
- * Arguments: stream - stream to insert string into.
- * value - value to insert.
- * Returns: none
+/*
+ * Function:
+ * _XEditResPut8
+ *
+ * Parameters:
+ * stream - stream to insert string into
+ * value - value to insert
+ *
+ * Description:
+ * Inserts an 8 bit integer into the protocol stream.
*/
-
void
-_XEditResPut8(stream, value)
-ProtocolStream * stream;
-unsigned int value;
+_XEditResPut8(ProtocolStream *stream, unsigned int value)
{
unsigned char temp;
- if (stream->size >= stream->alloc) {
+ if (stream->size >= stream->alloc)
+ {
stream->alloc += 100;
- stream->real_top = (unsigned char *) XtRealloc(
- (char *)stream->real_top,
- stream->alloc + HEADER_SIZE);
+ stream->real_top = (unsigned char *)
+ XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
stream->top = stream->real_top + HEADER_SIZE;
stream->current = stream->top + stream->size;
}
@@ -1541,51 +1680,57 @@ unsigned int value;
(stream->size)++;
}
-/* Function Name: _XEditResPut16
- * Description: Inserts a 16 bit integer into the protocol stream.
- * Arguments: stream - stream to insert string into.
- * value - value to insert.
- * Returns: void
+/*
+ * Function:
+ * _XEditResPut16
+ *
+ * Arguments:
+ * stream - stream to insert string into
+ * value - value to insert
+ *
+ * Description:
+ * Inserts a 16 bit integer into the protocol stream.
*/
-
void
-_XEditResPut16(stream, value)
-ProtocolStream * stream;
-unsigned int value;
+_XEditResPut16(ProtocolStream *stream, unsigned int value)
{
_XEditResPut8(stream, (value >> XER_NBBY) & BYTE_MASK);
_XEditResPut8(stream, value & BYTE_MASK);
}
-/* Function Name: _XEditResPut32
- * Description: Inserts a 32 bit integer into the protocol stream.
- * Arguments: stream - stream to insert string into.
- * value - value to insert.
- * Returns: void
+/*
+ * Function:
+ * _XEditResPut32
+ *
+ * Arguments:
+ * stream - stream to insert string into
+ * value - value to insert
+ *
+ * Description:
+ * Inserts a 32 bit integer into the protocol stream.
*/
-
void
-_XEditResPut32(stream, value)
-ProtocolStream * stream;
-unsigned long value;
+_XEditResPut32(ProtocolStream *stream, unsigned long value)
{
int i;
for (i = 3; i >= 0; i--)
- _XEditResPut8(stream, (value >> (XER_NBBY*i)) & BYTE_MASK);
+ _XEditResPut8(stream, (value >> (XER_NBBY * i)) & BYTE_MASK);
}
-/* Function Name: _XEditResPutWidgetInfo
- * Description: Inserts the widget info into the protocol stream.
- * Arguments: stream - stream to insert widget info into.
- * info - info to insert.
- * Returns: none
+/*
+ * Function:
+ * _XEditResPutWidgetInfo
+ *
+ * Parameters:
+ * stream - stream to insert widget info into
+ * info - info to insert
+ *
+ * Description:
+ * Inserts the widget info into the protocol stream.
*/
-
void
-_XEditResPutWidgetInfo(stream, info)
-ProtocolStream * stream;
-WidgetInfo * info;
+_XEditResPutWidgetInfo(ProtocolStream *stream, WidgetInfo *info)
{
unsigned int i;
@@ -1595,27 +1740,27 @@ WidgetInfo * info;
}
/************************************************************
+ * Code for retrieving values from the protocol stream
+ ************************************************************/
+/*
+ * Function:
+ * _XEditResResetStream
*
- * Code for retrieving values from the protocol stream.
+ * Parameters:
+ * stream - stream to reset
*
- ************************************************************/
-
-/* Function Name: _XEditResResetStream
- * Description: resets the protocol stream
- * Arguments: stream - the stream to reset.
- * Returns: none.
+ * Description:
+ * Resets the protocol stream.
*/
-
void
-_XEditResResetStream(stream)
-ProtocolStream * stream;
+_XEditResResetStream(ProtocolStream *stream)
{
stream->current = stream->top;
stream->size = 0;
- if (stream->real_top == NULL) {
- stream->real_top = (unsigned char *) XtRealloc(
- (char *)stream->real_top,
- stream->alloc + HEADER_SIZE);
+ if (stream->real_top == NULL)
+ {
+ stream->real_top = (unsigned char *)
+ XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
stream->top = stream->real_top + HEADER_SIZE;
stream->current = stream->top + stream->size;
}
@@ -1624,204 +1769,230 @@ ProtocolStream * stream;
/*
* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
*
- * The only modified field if the "current" field.
+ * The only modified field if the "current" field
*
* The only fields that must be set correctly are the "current", "top"
* and "size" fields.
*/
-
-/* Function Name: _XEditResGetg8
- * Description: Retrieves an unsigned 8 bit value
- * from the protocol stream.
- * Arguments: stream.
- * val - a pointer to value to return.
- * Returns: TRUE if sucessful.
+/*
+ * Function:
+ * _XEditResGetg8
+ *
+ * Parameters:
+ * stream - protocol stream
+ * value - a pointer to value to return
+ *
+ * Description:
+ * Retrieves an unsigned 8 bit value from the protocol stream.
+ *
+ * Returns:
+ * True if sucessful
*/
-
-Boolean
-_XEditResGet8(stream, val)
-ProtocolStream * stream;
-unsigned char * val;
+Bool
+_XEditResGet8(ProtocolStream *stream, unsigned char *value)
{
- if (stream->size < (stream->current - stream->top))
- return(FALSE);
+ if (stream->size < (unsigned long)(stream->current - stream->top))
+ return (False);
- *val = *((stream->current)++);
- return(TRUE);
+ *value = *((stream->current)++);
+ return (True);
}
-/* Function Name: _XEditResGet16
- * Description: Retrieves an unsigned 16 bit value
- * from the protocol stream.
- * Arguments: stream.
- * val - a pointer to value to return.
- * Returns: TRUE if sucessful.
+/*
+ * Function:
+ * _XEditResGet16
+ *
+ * Parameters:
+ * stream - protocol stream
+ * value - pointer to return value
+ *
+ * Description:
+ * Retrieves an unsigned 16 bit value from the protocol stream.
+ *
+ * Returns:
+ * True if sucessful
*/
-
-Boolean
-_XEditResGet16(stream, val)
-ProtocolStream * stream;
-unsigned short * val;
+Bool
+_XEditResGet16(ProtocolStream *stream, unsigned short *value)
{
unsigned char temp1, temp2;
- if ( !(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)) )
- return(FALSE);
+ if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
+ return (False);
- *val = (((unsigned short) temp1 << XER_NBBY) + ((unsigned short) temp2));
- return(TRUE);
+ *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
+ return (True);
}
-/* Function Name: _XEditResGetSigned16
- * Description: Retrieves an signed 16 bit value from the protocol stream.
- * Arguments: stream.
- * val - a pointer to value to return.
- * Returns: TRUE if sucessful.
+/*
+ * Function:
+ * _XEditResGetSigned16
+ *
+ * Parameters:
+ * stream - protocol stream
+ * value - pointer to return value
+ *
+ * Description:
+ * Retrieves an signed 16 bit value from the protocol stream.
+ *
+ * Returns:
+ * True if sucessful
*/
-
-Boolean
-_XEditResGetSigned16(stream, val)
-ProtocolStream * stream;
-short * val;
+Bool
+_XEditResGetSigned16(ProtocolStream *stream, short *value)
{
unsigned char temp1, temp2;
- if ( !(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)) )
- return(FALSE);
+ if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
+ return (False);
- if (temp1 & (1 << (XER_NBBY - 1))) { /* If the sign bit is active. */
- *val = -1; /* store all 1's */
- *val &= (temp1 << XER_NBBY); /* Now and in the MSB */
- *val &= temp2; /* and LSB */
+ if (temp1 & (1 << (XER_NBBY - 1))) /* If the sign bit is active */
+ {
+ *value = -1; /* store all 1's */
+ *value &= (temp1 << XER_NBBY); /* Now and in the MSB */
+ *value &= temp2; /* and LSB */
}
else
- *val = (((unsigned short) temp1 << XER_NBBY) + ((unsigned short) temp2));
+ *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
- return(TRUE);
+ return (True);
}
-/* Function Name: _XEditResGet32
- * Description: Retrieves an unsigned 32 bit value
- * from the protocol stream.
- * Arguments: stream.
- * val - a pointer to value to return.
- * Returns: TRUE if sucessful.
+/*
+ * Function:
+ * _XEditResGet32
+ *
+ * Parameters:
+ * stream - protocol stream
+ * value - pointer to return value
+ *
+ * Description:
+ * Retrieves an unsigned 32 bit value from the protocol stream.
+ *
+ * Returns:
+ * True if sucessful
*/
-
-Boolean
-_XEditResGet32(stream, val)
-ProtocolStream * stream;
-unsigned long * val;
+Bool
+_XEditResGet32(ProtocolStream *stream, unsigned long *value)
{
unsigned short temp1, temp2;
- if ( !(_XEditResGet16(stream, &temp1) && _XEditResGet16(stream, &temp2)) )
- return(FALSE);
+ if (!(_XEditResGet16(stream, &temp1) && _XEditResGet16(stream, &temp2)))
+ return (False);
- *val = (((unsigned short) temp1 << (XER_NBBY * 2)) +
- ((unsigned short) temp2));
- return(TRUE);
+ *value = ((unsigned short)temp1 << (XER_NBBY * 2)) + (unsigned short)temp2;
+ return (True);
}
-/* Function Name: _XEditResGetString8
- * Description: Retrieves an 8 bit string value from the protocol stream.
- * Arguments: stream - the protocol stream
- * str - the string to retrieve.
- * Returns: True if retrieval was successful.
+/* Function:
+ * _XEditResGetString8
+ *
+ * Parameters:
+ * stream - protocol stream
+ * str - string to retrieve
+ *
+ * Description:
+ * Retrieves an 8 bit string value from the protocol stream.
+ *
+ * Returns:
+ * True if retrieval was successful
*/
-
-Boolean
-_XEditResGetString8(stream, str)
-ProtocolStream * stream;
-char ** str;
+Bool
+_XEditResGetString8(ProtocolStream *stream, char **str)
{
unsigned short len;
register unsigned i;
- if (!_XEditResGet16(stream, &len)) {
- return(FALSE);
- }
+ if (!_XEditResGet16(stream, &len))
+ return (False);
*str = XtMalloc(sizeof(char) * (len + 1));
- for (i = 0; i < len; i++) {
- if (!_XEditResGet8(stream, (unsigned char *) *str + i)) {
+ for (i = 0; i < len; i++)
+ {
+ if (!_XEditResGet8(stream, (unsigned char *)*str + i))
+ {
XtFree(*str);
*str = NULL;
- return(FALSE);
+ return (False);
}
}
- (*str)[i] = '\0'; /* NULL terminate that sucker. */
- return(TRUE);
+ (*str)[i] = '\0';
+
+ return (True);
}
-/* Function Name: _XEditResGetWidgetInfo
- * Description: Retrieves the list of widgets that follow and stores
- * them in the widget info structure provided.
- * Arguments: stream - the protocol stream
- * info - the widget info struct to store into.
- * Returns: True if retrieval was successful.
+/*
+ * Function:
+ * _XEditResGetWidgetInfo
+ *
+ * Parameters:
+ * stream - protocol stream
+ * info - widget info struct to store into
+ *
+ * Description:
+ * Retrieves the list of widgets that follow and stores them in the
+ * widget info structure provided.
+ *
+ * Returns:
+ * True if retrieval was successful
*/
-
-Boolean
-_XEditResGetWidgetInfo(stream, info)
-ProtocolStream * stream;
-WidgetInfo * info;
+Bool
+_XEditResGetWidgetInfo(ProtocolStream *stream, WidgetInfo *info)
{
unsigned int i;
- if (!_XEditResGet16(stream, &(info->num_widgets)))
- return(FALSE);
+ if (!_XEditResGet16(stream, &info->num_widgets))
+ return (False);
- info->ids = (unsigned long *) XtMalloc(sizeof(long) * (info->num_widgets));
+ info->ids = (unsigned long *)XtMalloc(sizeof(long) * info->num_widgets);
- for (i = 0; i < info->num_widgets; i++) {
- if (!_XEditResGet32(stream, info->ids + i)) {
+ for (i = 0; i < info->num_widgets; i++)
+ {
+ if (!_XEditResGet32(stream, info->ids + i))
+ {
XtFree((char *)info->ids);
info->ids = NULL;
- return(FALSE);
+ return (False);
}
#if defined(LONG64) || defined(WORD64)
info->ids[i] |= globals.base_address;
#endif
}
- return(TRUE);
+ return (True);
}
/************************************************************
+ * Code for Loading the EditresBlock resource
+ ************************************************************/
+/*
+ * Function:
+ * CvStringToBlock
*
- * Code for Loading the EditresBlock resource.
+ * Parameters:
+ * dpy - display
+ * args - unused
+ * num_args - unused
+ * from_val - value to convert
+ * to_val - where to store
+ * converter_data - unused
*
- ************************************************************/
-
-/* Function Name: CvStringToBlock
- * Description: Converts a string to an editres block value.
- * Arguments: dpy - the display.
- * args, num_args - **UNUSED **
- * from_val, to_val - value to convert, and where to put result
- * converter_data - ** UNUSED **
- * Returns: TRUE if conversion was sucessful.
+ * Description:
+ * Converts a string to an editres block value.
+ *
+ * Returns:
+ * True if conversion was sucessful
*/
-
-/* ARGSUSED */
+/*ARGSUSED*/
static Boolean
-CvtStringToBlock(dpy, args, num_args, from_val, to_val, converter_data)
-Display * dpy;
-XrmValue * args;
-Cardinal * num_args;
-XrmValue * from_val, * to_val;
-XtPointer * converter_data;
+CvtStringToBlock(Display *dpy, XrmValue *args, Cardinal *num_args,
+ XrmValue *from_val, XrmValue *to_val,
+ XtPointer *converter_data)
{
- char ptr[40];
+ char ptr[16];
static EditresBlock block;
- if (strlen ((char*)from_val->addr) >= sizeof ptr) {
- to_val->size = 0;
- to_val->addr = NULL;
- return FALSE;
- }
-
- XmuCopyISOLatin1Lowered(ptr, from_val->addr);
+ XmuNCopyISOLatin1Lowered(ptr, from_val->addr, sizeof(ptr));
if (streq(ptr, "none"))
block = BlockNone;
@@ -1829,7 +2000,8 @@ XtPointer * converter_data;
block = BlockSetValues;
else if (streq(ptr, "all"))
block = BlockAll;
- else {
+ else
+ {
Cardinal num_params = 1;
String params[1];
@@ -1841,46 +2013,197 @@ XtPointer * converter_data;
return FALSE;
}
- if (to_val->addr != NULL) {
- if (to_val->size < sizeof(EditresBlock)) {
+ if (to_val->addr != NULL)
+ {
+ if (to_val->size < sizeof(EditresBlock))
+ {
to_val->size = sizeof(EditresBlock);
return FALSE;
}
*(EditresBlock *)(to_val->addr) = block;
}
else
- to_val->addr = (XtPointer) block;
+ to_val->addr = (XtPointer)block;
- to_val->size = sizeof block;
+ to_val->size = sizeof(EditresBlock);
return TRUE;
}
-
-#define XtREditresBlock ("EditresBlock")
-/* Function Name: LoadResources
- * Description: Loads a global resource the determines of this
- * application should allow Editres requests.
- * Arguments: w - any widget in the tree.
- * Returns: none.
+#define XtREditresBlock "EditresBlock"
+/*
+ * Function:
+ * LoadResources
+ *
+ * Parameters:
+ * w - any widget in the tree
+ *
+ * Description:
+ * Loads a global resource the determines of this application should
+ * allow Editres requests.
*/
-
static void
-LoadResources(w)
-Widget w;
+LoadResources(Widget w)
{
static XtResource resources[] = {
{"editresBlock", "EditresBlock", XtREditresBlock, sizeof(EditresBlock),
- XtOffsetOf(Globals, block), XtRImmediate, (XtPointer) BlockNone}
+ XtOffsetOf(Globals, block), XtRImmediate, (XtPointer)BlockNone}
};
- for (; XtParent(w) != NULL; w = XtParent(w)) {}
+ for (; XtParent(w) != NULL; w = XtParent(w))
+ ;
XtAppSetTypeConverter(XtWidgetToApplicationContext(w),
XtRString, XtREditresBlock, CvtStringToBlock,
- NULL, (Cardinal) 0, XtCacheAll, NULL);
+ NULL, 0, XtCacheAll, NULL);
- XtGetApplicationResources( w, (XtPointer) &globals, resources,
- XtNumber(resources), NULL, (Cardinal) 0);
+ XtGetApplicationResources(w, (XtPointer)&globals, resources,
+ XtNumber(resources), NULL, 0);
}
+/*
+ * Function:
+ * _XEditresGetStringValues
+ *
+ * Parameters:
+ * w - widget
+ * warg - where to store result
+ * numargs - unused
+ */
+/*ARGSUSED*/
+static void
+_XEditresGetStringValues(Widget w, Arg *warg, int numargs)
+{
+ static char buffer[32];
+ XtResourceList res_list;
+ Cardinal num_res;
+ XtResource *res = NULL;
+ long value;
+ Cardinal i;
+ char *string = "";
+ Arg args[1];
+ XrmValue to, from;
+
+ /*
+ * Look for the resource
+ */
+ XtGetResourceList(XtClass(w), &res_list, &num_res);
+ for (i = 0; i < num_res; i++)
+ if (strcmp(res_list[i].resource_name, warg->name) == 0)
+ {
+ res = &res_list[i];
+ break;
+ }
+
+ if (res == NULL && XtParent(w) != NULL)
+ {
+ XtFree((char *)res_list);
+ XtGetConstraintResourceList(XtClass(XtParent(w)), &res_list, &num_res);
+ for (i = 0; i < num_res; i++)
+ if (strcmp(res_list[i].resource_name, warg->name) == 0)
+ {
+ res = &res_list[i];
+ break;
+ }
+ }
+
+ if (res == NULL)
+ {
+ /* Couldn't find resource */
+ XtFree((char *)res_list);
+ *(XtPointer *)warg->value = NULL;
+ return;
+ }
+
+ /* try to get the value in the proper size */
+ switch (res->resource_size)
+ {
+#ifdef LONG_64
+ long v8;
+#endif
+ int v4;
+ short v2;
+ char v1;
+
+ case 1:
+ XtSetArg(args[0], res->resource_name, &v1);
+ XtGetValues(w, args, 1);
+ value = (int)v1;
+ break;
+ case 2:
+ XtSetArg(args[0], res->resource_name, &v2);
+ XtGetValues(w, args, 1);
+ value = (int)v2;
+ break;
+ case 4:
+ XtSetArg(args[0], res->resource_name, &v4);
+ XtGetValues(w, args, 1);
+ value = (int)v4;
+ break;
+#ifdef LONG_64
+ case 8:
+ XtSetArg(args[0], res->resource_name, &v8);
+ XtGetValues(w, args, 1);
+ value = (long)v8;
+ break;
+#endif
+ default:
+ fprintf(stderr, "_XEditresGetStringValues: bad size %d\n",
+ res->resource_size);
+ string = "bad size";
+ *(char **)(warg->value) = string;
+ XtFree((char *)res_list);
+ return;
+ }
+
+ /*
+ * If the resource is already String, no conversion needed
+ */
+ if (strcmp(XtRString, res->resource_type) == 0)
+ {
+ if (value == 0)
+ string = "(null)";
+ else
+ string = (char *)value;
+ }
+ else
+ {
+ from.size = res->resource_size;
+ from.addr = (XPointer)&value;
+ to.addr = NULL;
+ to.size = 0;
+
+ if (XtConvertAndStore(w,res->resource_type, &from, XtRString, &to))
+ string = to.addr;
+ else
+ {
+ string = buffer;
+ /*
+ * Conversion failed, fall back to representing it as integer
+ */
+ switch (res->resource_size)
+ {
+ case sizeof(char):
+ XmuSnprintf(buffer, sizeof(buffer), "%d", (int)(value & 0xff));
+ break;
+ case sizeof(short):
+ XmuSnprintf(buffer, sizeof(buffer), "%d", (int)(value & 0xffff));
+ break;
+ case sizeof(int):
+ XmuSnprintf(buffer, sizeof(buffer), "0x%08hx", (int)value);
+ break;
+#ifdef LONG_64
+ case sizeof(long):
+ XmuSnprintf(buffer, sizeof(buffer), "0x%016hx", value);
+ break;
+#endif
+ }
+ }
+ }
+
+ if (string == NULL)
+ string = "";
+
+ *(char **)(warg->value) = string;
+ XtFree((char *)res_list);
+}
diff --git a/src/ExtAgent.c b/src/ExtAgent.c
index ab9532d..128d539 100644
--- a/src/ExtAgent.c
+++ b/src/ExtAgent.c
@@ -25,16 +25,15 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/ExtAgent.c,v 1.7 2001/12/14 19:55:45 dawes Exp $ */
#include <X11/Intrinsic.h>
+#include <X11/Xmu/ExtAgent.h>
/* ARGSUSED */
void
-XmuRegisterExternalAgent(w, data, event, cont)
- Widget w;
- XtPointer data;
- XEvent *event;
- Boolean *cont;
+XmuRegisterExternalAgent(Widget w, XtPointer data,
+ XEvent *event, Boolean *cont)
{
/*
* This is a stub. Writers of protocol libraries
diff --git a/src/FToCback.c b/src/FToCback.c
index 68e7ac2..ecafe41 100644
--- a/src/FToCback.c
+++ b/src/FToCback.c
@@ -25,16 +25,15 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/FToCback.c,v 1.7 2001/12/14 19:55:45 dawes Exp $ */
#include <X11/Intrinsic.h>
+#include <X11/Xmu/Converters.h>
/* ARGSUSED */
void
-XmuCvtFunctionToCallback(args, num_args, fromVal, toVal)
- XrmValue *args; /* unused */
- Cardinal *num_args; /* unused */
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+XmuCvtFunctionToCallback(XrmValue *args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
static XtCallbackRec callback[2]; /* K&R: initialized to NULL */
static XtCallbackList callback_list = callback;
diff --git a/src/GetHost.c b/src/GetHost.c
index cdad709..0fe71f2 100644
--- a/src/GetHost.c
+++ b/src/GetHost.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/GetHost.c,v 3.8 2001/12/14 19:55:46 dawes Exp $ */
/*
* Author: Jim Fulton, MIT X Consortium
@@ -32,6 +33,10 @@ in this Software without prior written authorization from The Open Group.
* _XGetHostname - similar to gethostname but allows special processing.
*/
+#include <X11/Xosdefs.h>
+#include <string.h>
+#include <unistd.h>
+
#ifdef WIN32
#include <X11/Xwinsock.h>
#endif
@@ -44,9 +49,10 @@ in this Software without prior written authorization from The Open Group.
#include <sys/utsname.h>
#endif
-int XmuGetHostname (buf, maxlen)
- char *buf;
- int maxlen;
+#include <X11/Xmu/SysUtil.h>
+
+int
+XmuGetHostname(char *buf, int maxlen)
{
int len;
#ifdef WIN32
diff --git a/src/GrayPixmap.c b/src/GrayPixmap.c
index 22c0c44..4d8a51d 100644
--- a/src/GrayPixmap.c
+++ b/src/GrayPixmap.c
@@ -49,6 +49,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/Xmu/GrayPixmap.c,v 1.6 2001/12/14 19:55:46 dawes Exp $ */
#include <stdio.h>
#include <X11/Intrinsic.h>
@@ -67,10 +68,9 @@ static CacheEntry *pixmapCache = NULL;
-Pixmap XmuCreateStippledPixmap(screen, fore, back, depth)
- Screen *screen;
- Pixel fore, back;
- unsigned int depth;
+Pixmap
+XmuCreateStippledPixmap(Screen *screen, Pixel fore, Pixel back,
+ unsigned int depth)
/*
* Creates a stippled pixmap of specified depth
* caches these so that multiple requests share the pixmap
@@ -116,9 +116,8 @@ Pixmap XmuCreateStippledPixmap(screen, fore, back, depth)
return( stippled_pixmap );
}
-void XmuReleaseStippledPixmap(screen, pixmap)
- Screen *screen;
- Pixmap pixmap;
+void
+XmuReleaseStippledPixmap(Screen *screen, Pixmap pixmap)
{
register Display *display = DisplayOfScreen(screen);
CacheEntry *cachePtr, **prevP;
diff --git a/src/Initer.c b/src/Initer.c
index bcf612d..f80dfaf 100644
--- a/src/Initer.c
+++ b/src/Initer.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Initer.c,v 1.7 2001/12/14 19:55:46 dawes Exp $ */
/* Created By: Chris D. Peterson
* MIT X Consortium
@@ -40,15 +41,16 @@ struct InitializerList {
XtAppContext * app_con_list; /* a null terminated list of app_contexts. */
};
+/*
+ * Prototypes
+ */
+static Bool AddToAppconList(XtAppContext**, XtAppContext);
+
static struct InitializerList * init_list = NULL;
static Cardinal init_list_length = 0;
-static Boolean AddToAppconList();
-
void
-XmuAddInitializer(func, data)
-XmuInitializerProc func;
-XPointer data;
+XmuAddInitializer(XmuInitializerProc func, XPointer data)
{
init_list_length++;
init_list = (struct InitializerList *) XtRealloc( (char *) init_list,
@@ -61,10 +63,9 @@ XPointer data;
}
void
-XmuCallInitializers(app_con)
-XtAppContext app_con;
+XmuCallInitializers(XtAppContext app_con)
{
- int i;
+ unsigned i;
for (i = 0 ; i < init_list_length ; i++) {
if (AddToAppconList(&(init_list[i].app_con_list), app_con))
@@ -72,18 +73,24 @@ XtAppContext app_con;
}
}
-/* Function Name: AddToAppconList
- * Description: Adds an action to the application context list and
- * returns TRUE, if this app_con is already on the list then
- * it is NOT added and FALSE is returned.
- * Arguments: app_list - a NULL terminated list of application contexts.
- * app_con - an application context to test.
- * Returns: TRUE if not found, FALSE if found.
+/*
+ * Function:
+ * AddToAppconList
+ *
+ * Parameters:
+ * app_list - NULL terminated list of application contexts
+ * app_con - application context to test
+ *
+ * Description:
+ * Adds an action to the application context list and
+ * returns True, if this app_con is already on the list then
+ * it is NOT added and False is returned.
+ *
+ * Returns:
+ * True if not found, False if found
*/
-
-static Boolean
-AddToAppconList(app_list, app_con)
-XtAppContext **app_list, app_con;
+static Bool
+AddToAppconList(XtAppContext **app_list, XtAppContext app_con)
{
int i;
XtAppContext *local_list;
@@ -93,7 +100,7 @@ XtAppContext **app_list, app_con;
if (*app_list != NULL) {
for ( ; *local_list != NULL ; i++, local_list++) {
if (*local_list == app_con)
- return(FALSE);
+ return (False);
}
}
@@ -101,6 +108,7 @@ XtAppContext **app_list, app_con;
sizeof(XtAppContext *) * (i + 2) );
(*app_list)[i++] = app_con;
(*app_list)[i] = NULL;
- return(TRUE);
+
+ return (True);
}
diff --git a/src/LocBitmap.c b/src/LocBitmap.c
index 30efcaa..b2af38d 100644
--- a/src/LocBitmap.c
+++ b/src/LocBitmap.c
@@ -25,22 +25,20 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/LocBitmap.c,v 3.10 2002/05/31 18:45:45 dawes Exp $ */
/*
* Author: Jim Fulton, MIT X Consortium
*/
#include <X11/Xlib.h>
+#include <stdlib.h>
+#include <string.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <X11/Xmu/CvtCache.h>
#include <X11/Xmu/Drawing.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-extern char* malloc();
-extern void free();
-#endif
+#include <X11/Xmu/SysUtil.h>
#ifndef X_NOT_POSIX
#ifdef _POSIX_SOURCE
@@ -66,26 +64,19 @@ extern void free();
#endif
#endif /* PATH_MAX */
-static char **split_path_string();
-
+/*
+ * Prototypes
+ */
+static char **split_path_string(char*);
/*
* XmuLocateBitmapFile - read a bitmap file using the normal defaults
*/
-#if NeedFunctionPrototypes
-Pixmap XmuLocateBitmapFile (Screen *screen, _Xconst char *name, char *srcname,
+Pixmap
+XmuLocateBitmapFile(Screen *screen, _Xconst char *name, char *srcname,
int srcnamelen, int *widthp, int *heightp,
int *xhotp, int *yhotp)
-#else
-Pixmap XmuLocateBitmapFile (screen, name, srcname, srcnamelen,
- widthp, heightp, xhotp, yhotp)
- Screen *screen;
- char *name;
- char *srcname; /* RETURN */
- int srcnamelen;
- int *widthp, *heightp, *xhotp, *yhotp; /* RETURN */
-#endif
{
return XmuLocatePixmapFile (screen, name,
(unsigned long) 1, (unsigned long) 0,
@@ -97,24 +88,12 @@ Pixmap XmuLocateBitmapFile (screen, name, srcname, srcnamelen,
/*
* version that reads pixmap data as well as bitmap data
*/
-#if NeedFunctionPrototypes
-Pixmap XmuLocatePixmapFile (Screen *screen, _Xconst char *name,
+Pixmap
+XmuLocatePixmapFile(Screen *screen, _Xconst char *name,
unsigned long fore, unsigned long back,
unsigned int depth,
char *srcname, int srcnamelen,
int *widthp, int *heightp, int *xhotp, int *yhotp)
-#else
-Pixmap XmuLocatePixmapFile (screen, name, fore, back, depth,
- srcname, srcnamelen,
- widthp, heightp, xhotp, yhotp)
- Screen *screen;
- char *name;
- unsigned long fore, back;
- unsigned int depth;
- char *srcname; /* RETURN */
- int srcnamelen;
- int *widthp, *heightp, *xhotp, *yhotp; /* RETURN */
-#endif
{
#ifndef BITMAPDIR
@@ -126,12 +105,13 @@ Pixmap XmuLocatePixmapFile (screen, name, fore, back, depth,
Bool try_plain_name = True;
XmuCvtCache *cache = _XmuCCLookupDisplay (dpy);
char **file_paths = (char **) NULL;
- char filenamebuf[PATH_MAX];
- char* filename = NULL;
+ char filename[PATH_MAX];
+#if 0
char* bitmapdir = BITMAPDIR;
+#endif
unsigned int width, height;
int xhot, yhot;
- int i, tmp;
+ int i;
/*
* look in cache for bitmap path
@@ -170,35 +150,33 @@ Pixmap XmuLocatePixmapFile (screen, name, fore, back, depth,
*/
for (i = 1; i <= 4; i++) {
- char *fn = NULL;
+ char *fn = filename;
Pixmap pixmap;
unsigned char *data;
switch (i) {
case 1:
- if (!(name[0] == '/' || (name[0] == '.') && name[1] == '/'))
+#ifndef __UNIXOS2__
+ if (!(name[0] == '/' || ((name[0] == '.') && name[1] == '/')))
+#else
+ if (!(name[0] == '/' || (name[0] == '.' && name[1] == '/') ||
+ (isalpha(name[0]) && name[1] == ':')))
+#endif
continue;
fn = (char *) name;
try_plain_name = False;
break;
case 2:
if (file_paths && *file_paths) {
- tmp = strlen (*file_paths) + strlen (name) + 1;
- if (tmp < sizeof filenamebuf) filename = filenamebuf;
- else filename = malloc (tmp + 1);
- sprintf (filename, "%s/%s", *file_paths, name);
- fn = filename;
+ XmuSnprintf(filename, sizeof(filename),
+ "%s/%s", *file_paths, name);
file_paths++;
i--;
break;
}
continue;
case 3:
- tmp = strlen (bitmapdir) + strlen (name) + 1;
- if (tmp < sizeof filenamebuf) filename = filenamebuf;
- else filename = malloc (tmp + 1);
- sprintf (filename, "%s/%s", bitmapdir, name);
- fn = filename;
+ XmuSnprintf(filename, sizeof(filename), "%s/%s", BITMAPDIR, name);
break;
case 4:
if (!try_plain_name) continue;
@@ -208,8 +186,9 @@ Pixmap XmuLocatePixmapFile (screen, name, fore, back, depth,
data = NULL;
pixmap = None;
- if (fn == NULL)
- continue;
+#ifdef __UNIXOS2__
+ fn = (char*)__XOS2RedirRoot(fn);
+#endif
if (XmuReadBitmapDataFromFile (fn, &width, &height, &data,
&xhot, &yhot) == BitmapSuccess) {
pixmap = XCreatePixmapFromBitmapData (dpy, root, (char *) data,
@@ -217,10 +196,6 @@ Pixmap XmuLocatePixmapFile (screen, name, fore, back, depth,
fore, back, depth);
XFree ((char *)data);
}
- if (filename && filename != filenamebuf) {
- free (filename);
- filename = NULL;
- }
if (pixmap) {
if (widthp) *widthp = (int)width;
@@ -243,8 +218,8 @@ Pixmap XmuLocatePixmapFile (screen, name, fore, back, depth,
* split_path_string - split a colon-separated list into its constituent
* parts; to release, free list[0] and list.
*/
-static char **split_path_string (src)
- register char *src;
+static char **
+split_path_string(register char *src)
{
int nelems = 1;
register char *dst;
@@ -277,14 +252,14 @@ static char **split_path_string (src)
}
-void _XmuStringToBitmapInitCache (c)
- register XmuCvtCache *c;
+void
+_XmuStringToBitmapInitCache(register XmuCvtCache *c)
{
c->string_to_bitmap.bitmapFilePath = NULL;
}
-void _XmuStringToBitmapFreeCache (c)
- register XmuCvtCache *c;
+void
+_XmuStringToBitmapFreeCache(register XmuCvtCache *c)
{
if (c->string_to_bitmap.bitmapFilePath) {
if (c->string_to_bitmap.bitmapFilePath[0])
diff --git a/src/Lookup.c b/src/Lookup.c
index 66bf42a..a96109c 100644
--- a/src/Lookup.c
+++ b/src/Lookup.c
@@ -25,21 +25,16 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Lookup.c,v 3.8 2001/12/14 19:55:47 dawes Exp $ */
+
+#include <X11/Xmu/Lookup.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
#define XK_LATIN1
#define XK_PUBLISHING
#include <X11/keysymdef.h>
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
/* bit (1<<i) means character is in codeset i */
-static unsigned short Const latin1[128] =
+static unsigned short _Xconst latin1[128] =
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -58,7 +53,7 @@ static unsigned short Const latin1[128] =
0x0008, 0x0004, 0x000e, 0x000c, 0x000e, 0x0002, 0x0000, 0x0000};
/* bit (1<<i) means character is in codeset i */
-static unsigned short Const latin2[128] =
+static unsigned short _Xconst latin2[128] =
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -77,7 +72,7 @@ static unsigned short Const latin2[128] =
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x000c};
/* maps Cyrillic keysyms to 8859-5 */
-static unsigned char Const cyrillic[128] =
+static unsigned char _Xconst cyrillic[128] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -96,7 +91,7 @@ static unsigned char Const cyrillic[128] =
0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca};
/* maps Greek keysyms to 8859-7 */
-static unsigned char Const greek[128] =
+static unsigned char _Xconst greek[128] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -126,20 +121,17 @@ static unsigned char Const greek[128] =
#define sAPL (unsigned long)11
#define sHebrew (unsigned long)12
-int XmuLookupString (event, buffer, nbytes, keysym, status, keysymSet)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
- unsigned long keysymSet;
+int
+XmuLookupString(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status,
+ unsigned long keysymSet)
{
int count;
KeySym symbol;
unsigned long kset;
kset = keysymSet & 0xffffff;
- count = XLookupString(event, buffer, nbytes, &symbol, status);
+ count = XLookupString(event, (char *)buffer, nbytes, &symbol, status);
if (keysym) *keysym = symbol;
if ((nbytes == 0) || (symbol == NoSymbol)) {
/* nothing */
@@ -195,123 +187,90 @@ int XmuLookupString (event, buffer, nbytes, keysym, status, keysymSet)
}
/* produces ISO 8859-1 encoding plus ASCII control */
-int XmuLookupLatin1 (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupLatin1(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
- return XLookupString(event, buffer, nbytes, keysym, status);
+ return XLookupString(event, (char *)buffer, nbytes, keysym, status);
}
/* produces ISO 8859-2 encoding plus ASCII control */
-int XmuLookupLatin2 (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupLatin2(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin2);
}
/* produces ISO 8859-3 encoding plus ASCII control */
-int XmuLookupLatin3 (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupLatin3(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin3);
}
/* produces ISO 8859-4 encoding plus ASCII control */
-int XmuLookupLatin4 (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupLatin4(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin4);
}
/* produces ISO 8859-1 GL plus Katakana plus ASCII control */
-int XmuLookupKana (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupKana(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sKana);
}
/* produces JIS X0201-1976 (8-bit) */
-int XmuLookupJISX0201 (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupJISX0201(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sX0201);
}
/* produces ISO 8859-6 encoding plus ASCII control */
-int XmuLookupArabic (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupArabic(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sArabic);
}
/* produces ISO/IEC 8859-5 encoding plus ASCII control */
-int XmuLookupCyrillic (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupCyrillic(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sCyrillic);
}
/* produces ISO 8859-7 encoding plus ASCII control */
-int XmuLookupGreek (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupGreek(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sGreek);
}
/* XXX this character set needs work */
-int XmuLookupAPL (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupAPL(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sAPL);
}
/* produces ISO 8859-8 encoding plus ASCII control */
-int XmuLookupHebrew (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer;
- int nbytes;
- KeySym *keysym;
- XComposeStatus *status;
+int
+XmuLookupHebrew(register XKeyEvent *event, unsigned char *buffer, int nbytes,
+ KeySym *keysym, XComposeStatus *status)
{
return XmuLookupString(event, buffer, nbytes, keysym, status, sHebrew);
}
diff --git a/src/LookupCmap.c b/src/LookupCmap.c
index 4c57f4f..47a2a2d 100644
--- a/src/LookupCmap.c
+++ b/src/LookupCmap.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/LookupCmap.c,v 1.8 2001/12/14 19:55:47 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
@@ -35,9 +36,12 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xmu/StdCmap.h>
+#include <stdlib.h>
-extern char *malloc();
-static Status lookup();
+/*
+ * Prototypes
+ */
+static Status lookup(Display*, int, VisualID, Atom, XStandardColormap*, Bool);
/*
* To create a standard colormap if one does not currently exist, or
@@ -64,15 +68,19 @@ static Status lookup();
* RGB_BEST_MAP on a display whose colormap size is 16.
*/
-Status XmuLookupStandardColormap(dpy, screen, visualid, depth, property,
- replace, retain)
- Display *dpy; /* specifies X server connection */
- int screen; /* specifies screen of display */
- VisualID visualid; /* specifies the visual type */
- unsigned int depth; /* specifies the visual type */
- Atom property; /* a standard colormap property */
- Bool replace; /* specifies whether to replace */
- Bool retain; /* specifies whether to retain */
+Status
+XmuLookupStandardColormap(Display *dpy, int screen, VisualID visualid,
+ unsigned int depth, Atom property,
+ Bool replace, Bool retain)
+ /*
+ * dpy - specifies X server connection
+ * screen - specifies screen of display
+ * visualid - specifies the visual type
+ * depth - specifies the visual type
+ * property - a standard colormap property
+ * replace - specifies whether to replace
+ * retain - specifies whether to retain
+ */
{
Display *odpy; /* original display connection */
XStandardColormap *colormap;
@@ -186,13 +194,17 @@ Status XmuLookupStandardColormap(dpy, screen, visualid, depth, property,
* is true.
*/
-static Status lookup(dpy, screen, visualid, property, new, replace)
- Display *dpy; /* specifies display connection */
- int screen; /* specifies screen number */
- VisualID visualid; /* specifies visualid for std map */
- Atom property; /* specifies colormap property name */
- XStandardColormap *new; /* specifies a standard colormap */
- Bool replace; /* specifies whether to replace */
+static Status
+lookup(Display *dpy, int screen, VisualID visualid, Atom property,
+ XStandardColormap *cnew, Bool replace)
+ /*
+ * dpy - specifies display connection
+ * screen - specifies screen number
+ * visualid - specifies visualid for std map
+ * property - specifies colormap property name
+ * cnew - specifies a standard colormap
+ * replace - specifies whether to replace
+ */
{
register int i;
int count;
@@ -202,8 +214,8 @@ static Status lookup(dpy, screen, visualid, property, new, replace)
/* The property does not already exist */
if (! XGetRGBColormaps(dpy, win, &stdcmaps, &count, property)) {
- if (new)
- XSetRGBColormaps(dpy, win, new, 1, property);
+ if (cnew)
+ XSetRGBColormaps(dpy, win, cnew, 1, property);
return 0;
}
@@ -212,8 +224,8 @@ static Status lookup(dpy, screen, visualid, property, new, replace)
if (property != XA_RGB_DEFAULT_MAP) {
if (replace) {
XmuDeleteStandardColormap(dpy, screen, property);
- if (new)
- XSetRGBColormaps(dpy, win, new, 1, property);
+ if (cnew)
+ XSetRGBColormaps(dpy, win, cnew, 1, property);
}
XFree((char *)stdcmaps);
return 1;
@@ -227,7 +239,7 @@ static Status lookup(dpy, screen, visualid, property, new, replace)
/* No RGB_DEFAULT_MAP property matches the given visualid */
if (i == count) {
- if (new) {
+ if (cnew) {
XStandardColormap *m, *maps;
s = (XStandardColormap *) malloc((unsigned) ((count+1) * sizeof
@@ -245,16 +257,16 @@ static Status lookup(dpy, screen, visualid, property, new, replace)
m->visualid = maps->visualid;
m->killid = maps->killid;
}
- m->colormap = new->colormap;
- m->red_max = new->red_max;
- m->red_mult = new->red_mult;
- m->green_max = new->green_max;
- m->green_mult = new->green_mult;
- m->blue_max = new->blue_max;
- m->blue_mult = new->blue_mult;
- m->base_pixel = new->base_pixel;
- m->visualid = new->visualid;
- m->killid = new->killid;
+ m->colormap = cnew->colormap;
+ m->red_max = cnew->red_max;
+ m->red_mult = cnew->red_mult;
+ m->green_max = cnew->green_max;
+ m->green_mult = cnew->green_mult;
+ m->blue_max = cnew->blue_max;
+ m->blue_mult = cnew->blue_mult;
+ m->base_pixel = cnew->base_pixel;
+ m->visualid = cnew->visualid;
+ m->killid = cnew->killid;
XSetRGBColormaps(dpy, win, s, ++count, property);
free((char *) s);
@@ -274,8 +286,8 @@ static Status lookup(dpy, screen, visualid, property, new, replace)
if (count == 1) {
XmuDeleteStandardColormap(dpy, screen, property);
- if (new)
- XSetRGBColormaps(dpy, win, new, 1, property);
+ if (cnew)
+ XSetRGBColormaps(dpy, win, cnew, 1, property);
}
else {
XStandardColormap *map;
@@ -290,7 +302,7 @@ static Status lookup(dpy, screen, visualid, property, new, replace)
else if (s->killid != None)
XKillClient(dpy, s->killid);
- map = (new) ? new : stdcmaps + --count;
+ map = (cnew) ? cnew : stdcmaps + --count;
s->colormap = map->colormap;
s->red_max = map->red_max;
diff --git a/src/Lower.c b/src/Lower.c
index fc588ef..78f233c 100644
--- a/src/Lower.c
+++ b/src/Lower.c
@@ -26,96 +26,136 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Lower.c,v 1.12 2001/12/14 19:55:47 dawes Exp $ */
+
#define XK_LATIN1
#include <X11/keysymdef.h>
#include <X11/Xmu/CharSet.h>
+#include <X11/Xmu/SysUtil.h>
+
+#include <stdio.h>
+
+#ifndef HAS_SNPRINTF
+#undef SCOPE
+#define SCOPE static
+#include "snprintf.c"
+#endif
+
+#include <stdarg.h>
/*
* ISO Latin-1 case conversion routine
*/
+#define XmuTolower(c) \
+((c) >= XK_a && (c) <= XK_z ? \
+ (c) : (c) >= XK_A && (c) <= XK_Z ? \
+ (c) + (XK_a - XK_A) : (c) >= XK_Agrave && (c) <= XK_Odiaeresis ? \
+ (c) + (XK_agrave - XK_Agrave) : (c) >= XK_Ooblique && (c) <= XK_Thorn ? \
+ (c) + (XK_oslash - XK_Ooblique) : \
+ (c))
+
+#define XmuToupper(c) \
+((c) >= XK_A && (c) <= XK_Z ? \
+ (c) : (c) >= XK_a && (c) <= XK_z ? \
+ (c) - (XK_a - XK_A) : (c) >= XK_agrave && (c) <= XK_odiaeresis ? \
+ (c) - (XK_agrave - XK_Agrave) : (c) >= XK_oslash && (c) <= XK_thorn ? \
+ (c) - (XK_oslash - XK_Ooblique) : \
+ (c))
-#if NeedFunctionPrototypes
-void XmuCopyISOLatin1Lowered(char *dst, _Xconst char *src)
-#else
-void XmuCopyISOLatin1Lowered(dst, src)
- char *dst, *src;
-#endif
+/*
+ * Implementation
+ */
+void
+XmuCopyISOLatin1Lowered(char *dst, _Xconst char *src)
+{
+ register unsigned char *dest, *source;
+
+ for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+ *source;
+ source++, dest++)
+ *dest = XmuTolower(*source);
+ *dest = '\0';
+}
+
+void
+XmuCopyISOLatin1Uppered(char *dst, _Xconst char *src)
+{
+ register unsigned char *dest, *source;
+
+ for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+ *source;
+ source++, dest++)
+ *dest = XmuToupper(*source);
+ *dest = '\0';
+}
+
+int
+XmuCompareISOLatin1(_Xconst char *first, _Xconst char *second)
{
- register unsigned char *dest, *source;
+ register unsigned char *ap, *bp;
- for (dest = (unsigned char *)dst, source = (unsigned char *)src;
- *source;
- source++, dest++)
+ for (ap = (unsigned char *)first, bp = (unsigned char *)second;
+ *ap && *bp && XmuTolower(*ap) == XmuTolower(*bp);
+ ap++, bp++)
+ ;
+
+ return ((int)XmuTolower(*ap) - (int)XmuTolower(*bp));
+}
+
+void
+XmuNCopyISOLatin1Lowered(char *dst, _Xconst char *src, register int size)
+{
+ register unsigned char *dest, *source;
+
+ if (size > 0)
{
- if ((*source >= XK_A) && (*source <= XK_Z))
- *dest = *source + (XK_a - XK_A);
- else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis))
- *dest = *source + (XK_agrave - XK_Agrave);
- else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn))
- *dest = *source + (XK_oslash - XK_Ooblique);
- else
- *dest = *source;
+ for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+ *source && size > 1;
+ source++, dest++, size--)
+ *dest = XmuTolower(*source);
+ *dest = '\0';
}
- *dest = '\0';
}
-#if NeedFunctionPrototypes
-void XmuCopyISOLatin1Uppered(char *dst, _Xconst char *src)
-#else
-void XmuCopyISOLatin1Uppered(dst, src)
- char *dst, *src;
-#endif
+void
+XmuNCopyISOLatin1Uppered(char *dst, _Xconst char *src, register int size)
{
- register unsigned char *dest, *source;
+ register unsigned char *dest, *source;
- for (dest = (unsigned char *)dst, source = (unsigned char *)src;
- *source;
- source++, dest++)
+ if (size > 0)
{
- if ((*source >= XK_a) && (*source <= XK_z))
- *dest = *source - (XK_a - XK_A);
- else if ((*source >= XK_agrave) && (*source <= XK_odiaeresis))
- *dest = *source - (XK_agrave - XK_Agrave);
- else if ((*source >= XK_slash) && (*source <= XK_thorn))
- *dest = *source - (XK_oslash - XK_Ooblique);
- else
- *dest = *source;
+ for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+ *source && size > 1;
+ source++, dest++, size--)
+ *dest = XmuToupper(*source);
+ *dest = '\0';
}
- *dest = '\0';
}
-#if NeedFunctionPrototypes
-int XmuCompareISOLatin1 (_Xconst char *first, _Xconst char *second)
-#else
-int XmuCompareISOLatin1 (first, second)
- char *first, *second;
-#endif
+int
+XmuSnprintf(char *str, int size, _Xconst char *fmt, ...)
{
- register unsigned char *ap, *bp;
-
- for (ap = (unsigned char *) first, bp = (unsigned char *) second;
- *ap && *bp; ap++, bp++) {
- register unsigned char a, b;
-
- if ((a = *ap) != (b = *bp)) {
- /* try lowercasing and try again */
-
- if ((a >= XK_A) && (a <= XK_Z))
- a += (XK_a - XK_A);
- else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
- a += (XK_agrave - XK_Agrave);
- else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
- a += (XK_oslash - XK_Ooblique);
-
- if ((b >= XK_A) && (b <= XK_Z))
- b += (XK_a - XK_A);
- else if ((b >= XK_Agrave) && (b <= XK_Odiaeresis))
- b += (XK_agrave - XK_Agrave);
- else if ((b >= XK_Ooblique) && (b <= XK_Thorn))
- b += (XK_oslash - XK_Ooblique);
-
- if (a != b) return (((int) a) - ((int) b));
- }
+ va_list ap;
+ int retval;
+
+ if (size <= 0)
+ return (size);
+
+ va_start(ap, fmt);
+
+#if 0
+ retval = vsprintf(str, fmt, ap);
+ if (retval >= size)
+ {
+ fprintf(stderr, "WARNING: buffer overflow detected!\n");
+ fflush(stderr);
+ abort();
}
- return (((int) *ap) - ((int) *bp));
+#else
+ retval = vsnprintf(str, size, fmt, ap);
+#endif
+
+ va_end(ap);
+
+ return (retval);
}
diff --git a/src/RdBitF.c b/src/RdBitF.c
index 8f27e37..a6d83ee 100644
--- a/src/RdBitF.c
+++ b/src/RdBitF.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/RdBitF.c,v 3.13 2002/05/31 18:45:45 dawes Exp $ */
/*
* This file contains miscellaneous utility routines and is not part of the
@@ -49,11 +50,19 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/Xlibint.h>
#include <stdio.h>
#include <ctype.h>
+#include <X11/Xmu/Drawing.h>
#define MAX_SIZE 255
+/*
+ * Prototypes
+ */
+static void initHexTable(void);
+static int NextInt(FILE*);
+
/* shared data for the image read/parse logic */
static short hexTable[256]; /* conversion value */
static Bool initialized = False; /* easier to fill in at run time */
@@ -63,7 +72,8 @@ static Bool initialized = False; /* easier to fill in at run time */
* Table index for the hex values. Initialized once, first time.
* Used for translation value or delimiter significance lookup.
*/
-static void initHexTable()
+static void
+initHexTable(void)
{
/*
* We build the table at run time for several reasons:
@@ -96,8 +106,8 @@ static void initHexTable()
/*
* read next hex value in the input stream, return -1 if EOF
*/
-static NextInt (fstream)
- FILE *fstream;
+static int
+NextInt(FILE *fstream)
{
int ch;
int value = 0;
@@ -132,11 +142,9 @@ static NextInt (fstream)
* its arguments won't have been touched. This routine should look as much
* like the Xlib routine XReadBitmapfile as possible.
*/
-int XmuReadBitmapData (fstream, width, height, datap, x_hot, y_hot)
- FILE *fstream; /* handle on file */
- unsigned int *width, *height; /* RETURNED */
- unsigned char **datap; /* RETURNED */
- int *x_hot, *y_hot; /* RETURNED */
+int
+XmuReadBitmapData(FILE *fstream, unsigned int *width, unsigned int *height,
+ unsigned char **datap, int *x_hot, int *y_hot)
{
unsigned char *data = NULL; /* working variable */
char line[MAX_SIZE]; /* input line from file */
@@ -152,6 +160,7 @@ int XmuReadBitmapData (fstream, width, height, datap, x_hot, y_hot)
int hx = -1; /* x hotspot */
int hy = -1; /* y hotspot */
+#undef Xmalloc /* see MALLOC_0_RETURNS_NULL in Xlibint.h */
#define Xmalloc(size) malloc(size)
/* first time initialization */
@@ -255,13 +264,9 @@ int XmuReadBitmapData (fstream, width, height, datap, x_hot, y_hot)
RETURN (BitmapSuccess);
}
-#if defined(WIN32) || defined(__EMX__) /* || defined(OS2) */
-
-static int access_file (path, pathbuf, len_pathbuf, pathret)
- char* path;
- char* pathbuf;
- int len_pathbuf;
- char** pathret;
+#if defined(WIN32)
+static int
+access_file(char *path, char *pathbuf, int len_pathbuf, char **pathret)
{
if (access (path, F_OK) == 0) {
if (strlen (path) < len_pathbuf)
@@ -276,11 +281,8 @@ static int access_file (path, pathbuf, len_pathbuf, pathret)
return 0;
}
-static int AccessFile (path, pathbuf, len_pathbuf, pathret)
- char* path;
- char* pathbuf;
- int len_pathbuf;
- char** pathret;
+static int
+AccessFile(char *path, char *pathbuf, int len_pathbuf, char **pathret)
{
#ifndef MAX_PATH
#define MAX_PATH 512
@@ -298,7 +300,7 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
/* try the places set in the environment */
drive = getenv ("_XBASEDRIVE");
-#ifdef __EMX__
+#ifdef __UNIXOS2__
if (!drive)
drive = getenv ("X11ROOT");
#endif
@@ -314,7 +316,7 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
return 1;
}
-#ifndef __EMX__
+#ifndef __UNIXOS2__
/* one last place to look */
drive = getenv ("HOMEDRIVE");
if (drive) {
@@ -353,9 +355,8 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
return 0;
}
-FILE* fopen_file(path, mode)
- char* path;
- char* mode;
+FILE *
+fopen_file(char *path, char *mode)
{
char buf[MAX_PATH];
char* bufp;
@@ -377,25 +378,21 @@ FILE* fopen_file(path, mode)
#endif
-#if NeedFunctionPrototypes
-int XmuReadBitmapDataFromFile (_Xconst char *filename, unsigned int *width,
+int
+XmuReadBitmapDataFromFile(_Xconst char *filename, unsigned int *width,
unsigned int *height, unsigned char **datap,
int *x_hot, int *y_hot)
-#else
-int XmuReadBitmapDataFromFile (filename, width, height, datap, x_hot, y_hot)
- char *filename;
- unsigned int *width, *height; /* RETURNED */
- unsigned char **datap; /* RETURNED */
- int *x_hot, *y_hot; /* RETURNED */
-#endif
{
FILE *fstream;
int status;
+#ifdef __UNIXOS2__
+ filename = __XOS2RedirRoot(filename);
+#endif
if ((fstream = fopen_file (filename, "r")) == NULL) {
return BitmapOpenFailed;
}
- status = XmuReadBitmapData (fstream, width, height, datap, x_hot, y_hot);
+ status = XmuReadBitmapData(fstream, width, height, datap, x_hot, y_hot);
fclose (fstream);
return status;
}
diff --git a/src/ScrOfWin.c b/src/ScrOfWin.c
index 8e986d6..d810e46 100644
--- a/src/ScrOfWin.c
+++ b/src/ScrOfWin.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/ScrOfWin.c,v 1.7 2001/12/14 19:55:48 dawes Exp $ */
/*
* Author: Jim Fulton, MIT X Consortium
@@ -32,11 +33,10 @@ in this Software without prior written authorization from The Open Group.
#include <stdio.h>
#include <X11/Xlib.h>
+#include <X11/Xmu/WinUtil.h>
-
-Screen *XmuScreenOfWindow (dpy, w)
- Display *dpy;
- Window w;
+Screen *
+XmuScreenOfWindow(Display *dpy, Window w)
{
register int i;
Window root;
diff --git a/src/ShapeWidg.c b/src/ShapeWidg.c
index c06c6e9..2282d99 100644
--- a/src/ShapeWidg.c
+++ b/src/ShapeWidg.c
@@ -25,165 +25,224 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/ShapeWidg.c,v 1.8 2001/12/14 19:55:48 dawes Exp $ */
#include <X11/IntrinsicP.h>
#include <X11/extensions/shape.h>
#include "Converters.h"
#include "Drawing.h"
-
-static ShapeError();
-static ShapeRectangle(), ShapeOval(), ShapeEllipseOrRoundedRectangle();
-
-Boolean XmuReshapeWidget(w, shape_style, corner_width, corner_height)
- Widget w;
- int shape_style;
- int corner_width, corner_height;
+#include "Misc.h"
+
+/*
+ * Prototypes
+ */
+static void ShapeEllipseOrRoundedRectangle(Widget, Bool, int, int);
+static void ShapeError(Widget);
+static void ShapeOval(Widget);
+static void ShapeRectangle(Widget);
+
+/*
+ * Implementation
+ */
+Boolean
+XmuReshapeWidget(Widget w, int shape_style,
+ int corner_width, int corner_height)
{
- switch (shape_style) {
-
+ switch (shape_style)
+ {
case XmuShapeRectangle:
ShapeRectangle(w);
break;
-
case XmuShapeOval:
ShapeOval(w);
break;
-
case XmuShapeEllipse:
case XmuShapeRoundedRectangle:
- ShapeEllipseOrRoundedRectangle
- (w,
- ((shape_style == XmuShapeEllipse) ? True : False),
- corner_width,
- corner_height);
+ ShapeEllipseOrRoundedRectangle(w, shape_style == XmuShapeEllipse,
+ corner_width, corner_height);
break;
-
default:
ShapeError(w);
- return False;
+ return (False);
}
- return True;
+ return (True);
}
-static ShapeError(w)
- Widget w;
+static void
+ShapeError(Widget w)
{
String params[1];
Cardinal num_params = 1;
+
params[0] = XtName(w);
- XtAppWarningMsg( XtWidgetToApplicationContext(w),
+ XtAppWarningMsg(XtWidgetToApplicationContext(w),
"shapeUnknown", "xmuReshapeWidget", "XmuLibrary",
"Unsupported shape style for Command widget \"%s\"",
- params, &num_params
- );
+ params, &num_params);
}
-
-static ShapeRectangle(w)
- Widget w;
+static void
+ShapeRectangle(Widget w)
{
- XShapeCombineMask( XtDisplay(w), XtWindow(w),
- ShapeBounding, 0, 0, None, ShapeSet );
- XShapeCombineMask( XtDisplay(w), XtWindow(w),
- ShapeClip, 0, 0, None, ShapeSet );
+ XShapeCombineMask(XtDisplay(w), XtWindow(w),
+ ShapeBounding, 0, 0, None, ShapeSet);
+ XShapeCombineMask(XtDisplay(w), XtWindow(w),
+ ShapeClip, 0, 0, None, ShapeSet);
}
-
-static ShapeOval(w)
- Widget w;
+/*
+ * Function:
+ * ShapeOval
+ *
+ * Parameters:
+ * w - widget to be reshaped
+ *
+ * Description:
+ * Reshapes a widget to a oval format.
+ *
+ * Notes:
+ * X11R6.3 behaviour changed. Now if the height is larger than the
+ * width, this function inverts the sense of the oval, instead of
+ * fallbacking to ellipse.
+ */
+static void
+ShapeOval(Widget w)
{
Display *dpy = XtDisplay(w);
- unsigned width = w->core.width + (w->core.border_width<<1);
- unsigned height = w->core.height + (w->core.border_width<<1);
- Pixmap p = XCreatePixmap( dpy, XtWindow(w), width, height, 1 );
+ int width = w->core.width;
+ int height = w->core.height;
+ Pixmap p;
XGCValues values;
GC gc;
int rad;
+ if (width < 3 || height < 3)
+ return;
+ width += w->core.border_width << 1;
+ height += w->core.border_width << 1;
+
+ p = XCreatePixmap(dpy, XtWindow(w), width, height, 1);
values.foreground = 0;
values.background = 1;
values.cap_style = CapRound;
- values.line_width = height;
- gc = XCreateGC (dpy, p,
+ values.line_width = Min(width, height);
+ gc = XCreateGC(dpy, p,
GCForeground | GCBackground | GCLineWidth | GCCapStyle,
&values);
- XFillRectangle( dpy, p, gc, 0, 0, width, height );
- XSetForeground( dpy, gc, 1 );
- if (width <= height) {
- /* cannot be oval, fall back to ellipse */
- XFillArc( dpy, p, gc, 0, 0, width, height, 0, 360*64 );
- } else {
+ XFillRectangle(dpy, p, gc, 0, 0, width, height);
+ XSetForeground(dpy, gc, 1);
+
+ if (width < height)
+ {
+ rad = width >> 1;
+ XDrawLine(dpy, p, gc, rad, rad, rad, height - rad - 1);
+ }
+ else
+ {
rad = height >> 1;
- XDrawLine( dpy, p, gc, rad, rad, (int)width - rad - 1, rad );
+ XDrawLine(dpy, p, gc, rad, rad, width - rad - 1, rad);
}
- XShapeCombineMask( dpy, XtWindow(w), ShapeBounding,
- -(w->core.border_width), -(w->core.border_width),
- p, ShapeSet );
- if (w->core.border_width) {
- XSetForeground( dpy, gc, 0 );
- XFillRectangle( dpy, p, gc, 0, 0, width, height );
- values.line_width = w->core.height;
+ XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
+ -(int)w->core.border_width, -(int)w->core.border_width,
+ p, ShapeSet);
+ if (w->core.border_width)
+ {
+ XSetForeground(dpy, gc, 0);
+ XFillRectangle(dpy, p, gc, 0, 0, width, height);
+ values.line_width = Min(w->core.width, w->core.height);
values.foreground = 1;
- XChangeGC (dpy, gc, GCLineWidth|GCForeground, &values);
- if (w->core.width <= w->core.height) {
- /* cannot be oval, fall back to ellipse */
- XFillArc( dpy, p, gc, 0, 0, w->core.width, w->core.height,
- 0, 360*64 );
- } else {
+ XChangeGC(dpy, gc, GCLineWidth | GCForeground, &values);
+ if (w->core.width < w->core.height)
+ {
+ rad = w->core.width >> 1;
+ XDrawLine(dpy, p, gc, rad, rad, rad, w->core.height - rad - 1);
+ }
+ else
+ {
rad = w->core.height >> 1;
- XDrawLine( dpy, p, gc, rad, rad,
- (int)w->core.width - rad - 1, rad );
+ XDrawLine(dpy, p, gc, rad, rad, w->core.width - rad - 1, rad);
}
- XShapeCombineMask( dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet );
- } else {
- XShapeCombineMask( XtDisplay(w), XtWindow(w),
- ShapeClip, 0, 0, None, ShapeSet );
+ XShapeCombineMask(dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet);
}
- XFreePixmap( dpy, p );
- XFreeGC (dpy, gc );
-}
+ else
+ XShapeCombineMask(XtDisplay(w), XtWindow(w),
+ ShapeClip, 0, 0, None, ShapeSet);
+ XFreePixmap(dpy, p);
+ XFreeGC(dpy, gc);
+}
-static ShapeEllipseOrRoundedRectangle(w, ellipse, ew, eh)
- Widget w;
- Boolean ellipse;
- int ew, eh;
+/*
+ * Function:
+ * ShapeEllipseOrRoundedRectangle
+ *
+ * Parameters:
+ * w - widget to be reshaped
+ * ellipse - True if shape to ellise, rounded rectangle otherwise
+ * ew - horizontal radius of rounded rectangle
+ * eh - vertical radius of rouded rectangle
+ *
+ * Description:
+ * Based on the ellipse parameter, gives the widget a elliptical
+ * shape, or rounded rectangle shape.
+ *
+ * Notes:
+ * The GC is created with a line width of 2, what seens to draw the
+ * widget border correctly, if the width - height is not proportional.
+ */
+static void
+ShapeEllipseOrRoundedRectangle(Widget w, Bool ellipse, int ew, int eh)
{
Display *dpy = XtDisplay(w);
- unsigned width = w->core.width + (w->core.border_width<<1);
- unsigned height = w->core.height + (w->core.border_width<<1);
- Pixmap p = XCreatePixmap( dpy, XtWindow(w), width, height, 1 );
+ unsigned width = w->core.width;
+ unsigned height = w->core.height;
+ Pixmap p;
XGCValues values;
GC gc;
+ unsigned long mask;
+
+ if (width < 3 || width < 3)
+ return;
+ width += w->core.border_width << 1;
+ height += w->core.border_width << 1;
+
+ mask = GCForeground | GCLineWidth;
+ p = XCreatePixmap(dpy, XtWindow(w), width, height, 1);
values.foreground = 0;
- gc = XCreateGC (dpy, p, GCForeground, &values );
- XFillRectangle( dpy, p, gc, 0, 0, width, height );
- XSetForeground (dpy, gc, 1);
+ values.line_width = 2;
+
+ gc = XCreateGC(dpy, p, mask, &values);
+ XFillRectangle(dpy, p, gc, 0, 0, width, height);
+ XSetForeground(dpy, gc, 1);
if (!ellipse)
- XmuFillRoundedRectangle( dpy, p, gc, 0, 0, (int)width, (int)height,
- ew, eh );
+ XmuFillRoundedRectangle(dpy, p, gc, 1, 1, width - 2, height - 2, ew, eh);
else
- XFillArc( dpy, p, gc, 0, 0, width, height, 0, 360*64 );
- XShapeCombineMask( dpy, XtWindow(w), ShapeBounding,
- -(w->core.border_width), -(w->core.border_width),
- p, ShapeSet );
- if (w->core.border_width) {
- XSetForeground (dpy, gc, 0);
- XFillRectangle( dpy, p, gc, 0, 0, width, height );
- XSetForeground (dpy, gc, 1);
+ {
+ XDrawArc(dpy, p, gc, 1, 1, width - 2, height - 2, 0, 360 * 64);
+ XFillArc(dpy, p, gc, 2, 2, width - 4, height - 4, 0, 360 * 64);
+ }
+ XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
+ -(int)w->core.border_width, -(int)w->core.border_width,
+ p, ShapeSet);
+ if (w->core.border_width)
+ {
+ XSetForeground(dpy, gc, 0);
+ XFillRectangle(dpy, p, gc, 0, 0, width, height);
+ XSetForeground(dpy, gc, 1);
if (!ellipse)
- XmuFillRoundedRectangle( dpy, p, gc, 0, 0,
- (int)w->core.width, (int)w->core.height,
- ew, eh );
- else
- XFillArc( dpy, p, gc, 0, 0, w->core.width, w->core.height,
- 0, 360*64 );
- XShapeCombineMask( dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet );
- } else {
- XShapeCombineMask( XtDisplay(w), XtWindow(w),
- ShapeClip, 0, 0, None, ShapeSet );
+ XmuFillRoundedRectangle(dpy, p, gc, 1, 1,
+ w->core.width - 2, w->core.height - 2,
+ ew, eh);
+ else
+ XFillArc(dpy, p, gc, 0, 0, w->core.width, w->core.height,
+ 0, 360 * 64);
+ XShapeCombineMask(dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet);
}
- XFreePixmap( dpy, p );
- XFreeGC (dpy, gc);
+ else
+ XShapeCombineMask(XtDisplay(w), XtWindow(w),
+ ShapeClip, 0, 0, None, ShapeSet);
+
+ XFreePixmap(dpy, p);
+ XFreeGC(dpy, gc);
}
diff --git a/src/StdCmap.c b/src/StdCmap.c
index 60719e8..fec09ec 100644
--- a/src/StdCmap.c
+++ b/src/StdCmap.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StdCmap.c,v 1.6 2001/12/14 19:55:48 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
@@ -38,7 +39,12 @@ in this Software without prior written authorization from The Open Group.
#define lowbit(x) ((x) & (~(x) + 1))
-static Status valid_args(); /* argument restrictions */
+/*
+ * Prototypes
+ */
+/* argument restrictions */
+static Status valid_args(XVisualInfo*, unsigned long, unsigned long,
+ unsigned long, Atom);
/*
* To create any one standard colormap, use XmuStandardColormap().
@@ -55,15 +61,20 @@ static Status valid_args(); /* argument restrictions */
* caller's responsibility.
*/
-XStandardColormap *XmuStandardColormap(dpy, screen, visualid, depth, property,
- cmap, red_max, green_max, blue_max)
- Display *dpy; /* specifies X server connection */
- int screen; /* specifies display screen */
- VisualID visualid; /* identifies the visual type */
- unsigned int depth; /* identifies the visual type */
- Atom property; /* a standard colormap property */
- Colormap cmap; /* specifies colormap ID or None */
- unsigned long red_max, green_max, blue_max; /* allocations */
+XStandardColormap *
+XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
+ unsigned int depth, Atom property, Colormap cmap,
+ unsigned long red_max, unsigned long green_max,
+ unsigned long blue_max)
+ /*
+ * dpy - specifies X server connection
+ * screen - specifies display screen
+ * visualid - identifies the visual type
+ * depth - identifies the visual type
+ * property - a standard colormap property
+ * cmap - specifies colormap ID or None
+ * red_max, green_max, blue_max - allocations
+ */
{
XStandardColormap *stdcmap;
Status status;
@@ -146,10 +157,14 @@ XStandardColormap *XmuStandardColormap(dpy, screen, visualid, depth, property,
}
/****************************************************************************/
-static Status valid_args(vinfo, red_max, green_max, blue_max, property)
- XVisualInfo *vinfo; /* specifies visual */
- unsigned long red_max, green_max, blue_max; /* specifies alloc */
- Atom property; /* specifies property name */
+static Status
+valid_args(XVisualInfo *vinfo, unsigned long red_max, unsigned long green_max,
+ unsigned long blue_max, Atom property)
+ /*
+ * vinfo - specifies visual
+ * red_max, green_max, blue_max - specifies alloc
+ * property - specifies property name
+ */
{
unsigned long ncolors; /* number of colors requested */
diff --git a/src/StrToBS.c b/src/StrToBS.c
index 63b5d77..a459011 100644
--- a/src/StrToBS.c
+++ b/src/StrToBS.c
@@ -26,57 +26,121 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StrToBS.c,v 1.7 2001/12/14 19:55:50 dawes Exp $ */
+
#include <X11/Intrinsic.h>
#include "Converters.h"
#include "CharSet.h"
-#define done(address, type) \
- { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+/*
+ * Prototypes
+ */
+static void InitializeQuarks(void);
+
+/*
+ * Initialization
+ */
+static XrmQuark QnotUseful, QwhenMapped, Qalways, Qdefault;
+static Boolean haveQuarks;
-/* ARGSUSED */
+/*
+ * Implementation
+ */
+static void
+InitializeQuarks(void)
+{
+ if (!haveQuarks)
+ {
+ char name[11];
+
+ XmuNCopyISOLatin1Lowered(name, XtEnotUseful, sizeof(name));
+ QnotUseful = XrmStringToQuark(name);
+ XmuNCopyISOLatin1Lowered(name, XtEwhenMapped, sizeof(name));
+ QwhenMapped = XrmStringToQuark(name);
+ XmuNCopyISOLatin1Lowered(name, XtEalways, sizeof(name));
+ Qalways = XrmStringToQuark(name);
+ XmuNCopyISOLatin1Lowered(name, XtEdefault, sizeof(name));
+ Qdefault = XrmStringToQuark(name);
+ haveQuarks = True;
+ }
+}
+
+/*ARGSUSED*/
void
-XmuCvtStringToBackingStore (args, num_args, fromVal, toVal)
- XrmValue *args; /* unused */
- Cardinal *num_args; /* unused */
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+XmuCvtStringToBackingStore(XrmValue *args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
- char lowerString[40];
XrmQuark q;
+ char name[11];
static int backingStoreType;
- static XrmQuark XtQEnotUseful, XtQEwhenMapped, XtQEalways, XtQEdefault;
- static int haveQuarks = 0;
if (*num_args != 0)
XtWarning("String to BackingStore conversion needs no extra arguments");
- if (!haveQuarks) {
- XmuCopyISOLatin1Lowered (lowerString, XtEnotUseful);
- XtQEnotUseful = XrmStringToQuark(lowerString);
- XmuCopyISOLatin1Lowered (lowerString, XtEwhenMapped);
- XtQEwhenMapped = XrmStringToQuark(lowerString);
- XmuCopyISOLatin1Lowered (lowerString, XtEalways);
- XtQEalways = XrmStringToQuark(lowerString);
- XmuCopyISOLatin1Lowered (lowerString, XtEdefault);
- XtQEdefault = XrmStringToQuark(lowerString);
- haveQuarks = 1;
- }
- if (strlen ((char*)fromVal->addr) >= sizeof lowerString)
- XtStringConversionWarning((char *) fromVal->addr, "BackingStore");
- XmuCopyISOLatin1Lowered (lowerString, (char *) fromVal->addr);
- q = XrmStringToQuark (lowerString);
- if (q == XtQEnotUseful) {
+
+ InitializeQuarks();
+ XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
+
+ q = XrmStringToQuark (name);
+ if (q == QnotUseful)
backingStoreType = NotUseful;
- done (&backingStoreType, int);
- } else if (q == XtQEwhenMapped) {
+ else if (q == QwhenMapped)
backingStoreType = WhenMapped;
- done (&backingStoreType, int);
- } else if (q == XtQEalways) {
+ else if (q == Qalways)
backingStoreType = Always;
- done (&backingStoreType, int);
- } else if (q == XtQEdefault) {
+ else if (q == Qdefault)
backingStoreType = Always + WhenMapped + NotUseful;
- done (&backingStoreType, int);
- } else {
- XtStringConversionWarning((char *) fromVal->addr, "BackingStore");
+ else
+ {
+ XtStringConversionWarning((char *)fromVal->addr, XtRBackingStore);
+ return;
}
+ toVal->size = sizeof(int);
+ toVal->addr = (XPointer)&backingStoreType;
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtBackingStoreToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal,
+ XtPointer *data)
+{
+ static String buffer;
+ Cardinal size;
+
+ switch (*(int *)fromVal->addr)
+ {
+ case NotUseful:
+ buffer = XtEnotUseful;
+ break;
+ case WhenMapped:
+ buffer = XtEwhenMapped;
+ break;
+ case Always:
+ buffer = XtEalways;
+ break;
+ case (Always + WhenMapped + NotUseful):
+ buffer = XtEdefault;
+ break;
+ default:
+ XtWarning("Cannot convert BackingStore to String");
+ toVal->addr = NULL;
+ toVal->size = 0;
+ return (False);
+ }
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size < size)
+ {
+ toVal->size = size;
+ return (False);
+ }
+ strcpy((char *)toVal->addr, buffer);
+ }
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = sizeof(String);
+
+ return (True);
}
diff --git a/src/StrToBmap.c b/src/StrToBmap.c
index 54afe7e..db448c4 100644
--- a/src/StrToBmap.c
+++ b/src/StrToBmap.c
@@ -49,6 +49,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/Xmu/StrToBmap.c,v 1.6 2001/12/14 19:55:50 dawes Exp $ */
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
@@ -83,11 +84,9 @@ static XtConvertArgRec screenConvertArg[] = {
/*ARGSUSED*/
-void XmuCvtStringToBitmap(args, num_args, fromVal, toVal)
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+void
+XmuCvtStringToBitmap(XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
static Pixmap pixmap; /* static for cvt magic */
char *name = (char *)fromVal->addr;
diff --git a/src/StrToCurs.c b/src/StrToCurs.c
index 600e4f1..40a9bf6 100644
--- a/src/StrToCurs.c
+++ b/src/StrToCurs.c
@@ -50,12 +50,17 @@ SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/Xmu/StrToCurs.c,v 1.12 2002/09/24 18:55:21 alanh Exp $ */
+
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/Converters.h>
#include <X11/Xmu/Drawing.h>
+#include <X11/Xmu/CurUtil.h>
+#include <X11/Xmu/CharSet.h>
#ifndef X_NOT_POSIX
+#include <stdlib.h>
#ifdef _POSIX_SOURCE
#include <limits.h>
#else
@@ -118,18 +123,16 @@ static XtConvertArgRec screenConvertArg[] = {
#define FONTSPECIFIER "FONT "
/*ARGSUSED*/
-void XmuCvtStringToCursor(args, num_args, fromVal, toVal)
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+void
+XmuCvtStringToCursor(XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
static Cursor cursor; /* static for cvt magic */
char *name = (char *)fromVal->addr;
Screen *screen;
register int i;
char maskname[PATH_MAX];
- Pixmap source, mask;
+ Pixmap source, mask = 0;
/* XXX - make fg/bg resources */
static XColor bgColor = {0, 0xffff, 0xffff, 0xffff};
static XColor fgColor = {0, 0, 0, 0};
@@ -142,27 +145,36 @@ void XmuCvtStringToCursor(args, num_args, fromVal, toVal)
"String to cursor conversion needs screen argument",
(String *)NULL, (Cardinal *)NULL);
+ if (XmuCompareISOLatin1(name, "None") == 0)
+ {
+ cursor = None;
+ done(&cursor, Cursor);
+ return;
+ }
+
screen = *((Screen **) args[0].addr);
if (0 == strncmp(FONTSPECIFIER, name, strlen(FONTSPECIFIER))) {
char source_name[PATH_MAX], mask_name[PATH_MAX];
- char fmtstr[1024];
int source_char, mask_char, fields;
Font source_font, mask_font;
XrmValue fromString, toFont;
XrmValue cvtArg;
Boolean success;
Display *dpy = DisplayOfScreen(screen);
+ char *strspec = NULL;
#ifdef XMU_KLUDGE
Cardinal num;
#endif
- sprintf (fmtstr, "FONT %%%ds %%d %%%ds %%d",
- sizeof source_name - 1, sizeof mask_name - 1);
-
- fields = sscanf(name, fmtstr,
+ strspec = XtMalloc(strlen("FONT %s %d %s %d") + 21);
+ sprintf(strspec, "FONT %%%lds %%d %%%lds %%d",
+ (unsigned long)sizeof(source_name) - 1,
+ (unsigned long)sizeof(mask_name) - 1);
+ fields = sscanf(name, strspec,
source_name, &source_char,
mask_name, &mask_char);
+ XtFree(strspec);
if (fields < 2) {
XtStringConversionWarning(name, XtRCursor);
return;
@@ -239,6 +251,9 @@ void XmuCvtStringToCursor(args, num_args, fromVal, toVal)
maskname, (sizeof maskname) - 4,
NULL, NULL, &xhot, &yhot)) == None) {
XtStringConversionWarning (name, XtRCursor);
+ cursor = None;
+ done(&cursor, Cursor);
+ return;
}
len = strlen (maskname);
for (i = 0; i < 2; i++) {
@@ -287,15 +302,12 @@ void XmuCvtStringToCursor(args, num_args, fromVal, toVal)
/*ARGSUSED*/
Boolean
-XmuCvtStringToColorCursor(dpy, args, num_args, fromVal, toVal, converter_data)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *converter_data; /* unused */
+XmuCvtStringToColorCursor(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal,
+ XtPointer *converter_data)
{
Cursor cursor;
+ Screen *screen;
Pixel fg, bg;
Colormap c_map;
XColor colors[2];
@@ -310,6 +322,7 @@ XmuCvtStringToColorCursor(dpy, args, num_args, fromVal, toVal, converter_data)
return False;
}
+ screen = *((Screen **) args[0].addr);
fg = *((Pixel *) args[1].addr);
bg = *((Pixel *) args[2].addr);
c_map = *((Colormap *) args[3].addr);
@@ -319,7 +332,8 @@ XmuCvtStringToColorCursor(dpy, args, num_args, fromVal, toVal, converter_data)
cursor = *((Cursor *) ret_val.addr);
- if (cursor == None)
+ if (cursor == None || (fg == BlackPixelOfScreen(screen)
+ && bg == WhitePixelOfScreen(screen)))
new_done(Cursor, cursor);
colors[0].pixel = fg;
diff --git a/src/StrToGrav.c b/src/StrToGrav.c
index 7f74745..7ccb04a 100644
--- a/src/StrToGrav.c
+++ b/src/StrToGrav.c
@@ -25,13 +25,18 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StrToGrav.c,v 1.7 2001/12/14 19:55:52 dawes Exp $ */
#include <X11/Intrinsic.h>
#include <X11/Xmu/Converters.h>
+#include <X11/Xmu/CharSet.h>
#define done(address, type) \
- { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+{ (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+/*
+ * Initialization
+ */
static struct _namepair {
XrmQuark quark;
char *name;
@@ -58,44 +63,86 @@ static struct _namepair {
/*
* This function is deprecated as of the addition of
- * XtCvtStringToGravity in R6.
+ * XtCvtStringToGravity in R6
*/
-
-void XmuCvtStringToGravity (args, num_args, fromVal, toVal)
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+void
+XmuCvtStringToGravity(XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
- static Boolean haveQuarks = FALSE;
- char lowerName[40];
+ static Boolean haveQuarks = False;
+ char name[10];
XrmQuark q;
- char *s;
struct _namepair *np;
if (*num_args != 0)
XtWarningMsg("wrongParameters","cvtStringToGravity","XtToolkitError",
"String to Gravity conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
+ (String *)NULL, (Cardinal *)NULL);
- if (!haveQuarks) {
- for (np = names; np->name; np++) {
- np->quark = XrmPermStringToQuark (np->name);
- }
- haveQuarks = TRUE;
+ if (!haveQuarks)
+ {
+ for (np = names; np->name; np++)
+ np->quark = XrmPermStringToQuark(np->name);
+ haveQuarks = True;
}
- s = (char *) fromVal->addr;
- if (strlen(s) < sizeof lowerName) {
- XmuCopyISOLatin1Lowered (lowerName, s);
- q = XrmStringToQuark (lowerName);
+ XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
+ q = XrmStringToQuark(name);
- for (np = names; np->name; np++) {
- if (np->quark == q) {
- done (&np->gravity, XtGravity);
+ for (np = names; np->name; np++)
+ {
+ if (np->quark == q)
+ {
+ done(&np->gravity, XtGravity);
return;
}
}
+
+ XtStringConversionWarning((char *)fromVal->addr, XtRGravity);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtGravityToString(Display *dpy, XrmValue *args, Cardinal *num_args,
+ XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
+{
+ static char *buffer;
+ Cardinal size;
+ struct _namepair *np;
+ XtGravity gravity;
+
+ gravity = *(XtGravity *)fromVal->addr;
+ buffer = NULL;
+ for (np = names; np->name; np++)
+ if (np->gravity == gravity)
+ {
+ buffer = np->name;
+ break;
+ }
+
+ if (!buffer)
+ {
+ XtAppWarning(XtDisplayToApplicationContext(dpy),
+ "Cannot convert Gravity to String");
+ toVal->addr = NULL;
+ toVal->size = 0;
+
+ return (False);
+ }
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size <= size)
+ {
+ toVal->size = size;
+ return (False);
+ }
+ strcpy((char *)toVal->addr, buffer);
}
- XtStringConversionWarning((char *) fromVal->addr, XtRGravity);
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = size;
+
+ return (True);
}
diff --git a/src/StrToJust.c b/src/StrToJust.c
index 1284edb..205569c 100644
--- a/src/StrToJust.c
+++ b/src/StrToJust.c
@@ -26,50 +26,112 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StrToJust.c,v 1.7 2001/12/14 19:55:52 dawes Exp $ */
+
+#include <string.h>
#include <X11/Intrinsic.h>
#include "Converters.h"
#include "CharSet.h"
-/* ARGSUSED */
+/*
+ * Prototypes
+ */
+static void InitializeQuarks(void);
+
+/*
+ * Initialization
+ */
+static XrmQuark Qleft, Qcenter, Qright;
+static Boolean haveQuarks;
+
+/*
+ * Implementation
+ */
+static void
+InitializeQuarks(void)
+{
+ if (!haveQuarks)
+ {
+ Qleft = XrmPermStringToQuark(XtEleft);
+ Qcenter = XrmPermStringToQuark(XtEcenter);
+ Qright = XrmPermStringToQuark(XtEright);
+ haveQuarks = True;
+ }
+}
+
+/*ARGSUSED*/
void
-XmuCvtStringToJustify(args, num_args, fromVal, toVal)
- XrmValuePtr args; /* unused */
- Cardinal *num_args; /* unused */
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+XmuCvtStringToJustify(XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
static XtJustify e;
- static XrmQuark XrmQEleft;
- static XrmQuark XrmQEcenter;
- static XrmQuark XrmQEright;
- static int haveQuarks;
XrmQuark q;
- char *s = (char *) fromVal->addr;
- char lowerName[40];
+ char *s = (char *)fromVal->addr;
+ char name[7];
- if (s == NULL) return;
+ if (s == NULL)
+ return;
- if (!haveQuarks) {
- XrmQEleft = XrmPermStringToQuark(XtEleft);
- XrmQEcenter = XrmPermStringToQuark(XtEcenter);
- XrmQEright = XrmPermStringToQuark(XtEright);
- haveQuarks = 1;
- }
+ InitializeQuarks();
+ XmuNCopyISOLatin1Lowered(name, s, sizeof(name));
- if (strlen (s) < sizeof lowerName) {
+ q = XrmStringToQuark(name);
- XmuCopyISOLatin1Lowered(lowerName, s);
+ toVal->size = sizeof(XtJustify);
+ toVal->addr = (XPointer)&e;
- q = XrmStringToQuark(lowerName);
+ if (q == Qleft)
+ e = XtJustifyLeft;
+ else if (q == Qcenter)
+ e = XtJustifyCenter;
+ else if (q == Qright)
+ e = XtJustifyRight;
+ else
+ {
+ toVal->addr = NULL;
+ XtStringConversionWarning((char *)fromVal->addr, XtRJustify);
+ }
+}
- toVal->size = sizeof(XtJustify);
- toVal->addr = (XPointer) &e;
+/*ARGSUSED*/
+Boolean
+XmuCvtJustifyToString(Display *dpy, XrmValue* args, Cardinal *num_args,
+ XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
+{
+ static String buffer;
+ Cardinal size;
+
+ switch (*(XtJustify *)fromVal->addr)
+ {
+ case XtJustifyLeft:
+ buffer = XtEleft;
+ break;
+ case XtJustifyCenter:
+ buffer = XtEcenter;
+ break;
+ case XtJustifyRight:
+ buffer = XtEright;
+ break;
+ default:
+ XtWarning("Cannot convert Justify to String");
+ toVal->addr = NULL;
+ toVal->size = 0;
+ return (False);
+ }
- if (q == XrmQEleft) { e = XtJustifyLeft; return; }
- if (q == XrmQEcenter) { e = XtJustifyCenter; return; }
- if (q == XrmQEright) { e = XtJustifyRight; return; }
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size < size)
+ {
+ toVal->size = size;
+ return (False);
+ }
+ strcpy((char *)toVal->addr, buffer);
}
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = sizeof(String);
- toVal->size = 0;
- toVal->addr = NULL;
+ return (True);
}
diff --git a/src/StrToLong.c b/src/StrToLong.c
index bb39466..0eaf793 100644
--- a/src/StrToLong.c
+++ b/src/StrToLong.c
@@ -25,29 +25,56 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StrToLong.c,v 1.9 2001/12/14 19:55:52 dawes Exp $ */
-
+#include <stdio.h>
#include <X11/Intrinsic.h>
-#include "Converters.h"
-
-#define done(address, type) \
- { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+#include <X11/Xmu/SysUtil.h>
+#include <X11/Xmu/Converters.h>
-void XmuCvtStringToLong (args, num_args, fromVal, toVal)
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+void
+XmuCvtStringToLong(XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
static long l;
if (*num_args != 0)
- XtWarningMsg("wrongParameters","cvtStringToLong","XtToolkitError",
- "String to Long conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- if (sscanf((char *)fromVal->addr, "%ld", &l) == 1) {
- done(&l, long);
- } else {
- XtStringConversionWarning((char *) fromVal->addr, XtRLong);
+ XtWarning("String to Long conversion needs no extra arguments");
+ if (sscanf((char *)fromVal->addr, "%ld", &l) == 1)
+ {
+ toVal->size = sizeof(long);
+ toVal->addr = (XPointer)&l;
}
+ else
+ XtStringConversionWarning((char *)fromVal->addr, XtRLong);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtLongToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)
+{
+ static char buffer[32];
+ size_t size;
+
+ if (*num_args != 0)
+ XtWarning("Long to String conversion needs no extra arguments");
+
+ XmuSnprintf(buffer, sizeof(buffer), "%ld", *(long *)fromVal->addr);
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size < size)
+ {
+ toVal->size = size;
+ return (False);
+ }
+ strcpy((char *)toVal->addr, buffer);
+ }
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = sizeof(String);
+
+ return (True);
}
diff --git a/src/StrToOrnt.c b/src/StrToOrnt.c
index fc45af5..dec879d 100644
--- a/src/StrToOrnt.c
+++ b/src/StrToOrnt.c
@@ -26,50 +26,102 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StrToOrnt.c,v 1.7 2001/12/14 19:55:52 dawes Exp $ */
+
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "Converters.h"
#include "CharSet.h"
+/*
+ * Prototypes
+ */
+static void InitializeQuarks(void);
-#define done(address, type) \
- { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
+/*
+ * Initialization
+ */
+static XrmQuark Qhorizontal, Qvertical;
+static Boolean haveQuarks;
-/* ARGSUSED */
+/*
+ * Implementation
+ */
+static void
+InitializeQuarks(void)
+{
+ if (!haveQuarks)
+ {
+ Qhorizontal = XrmPermStringToQuark(XtEhorizontal);
+ Qvertical = XrmPermStringToQuark(XtEvertical);
+ haveQuarks = True;
+ }
+}
+
+/*ARGSUSED*/
void
-XmuCvtStringToOrientation(args, num_args, fromVal, toVal)
- XrmValuePtr args; /* unused */
- Cardinal *num_args; /* unused */
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+XmuCvtStringToOrientation(XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
static XtOrientation orient;
- static XrmQuark XtQEhorizontal;
- static XrmQuark XtQEvertical;
- static int haveQuarks = 0;
XrmQuark q;
- char lowerName[40];
+ char name[11];
+
+ InitializeQuarks();
+ XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
+ q = XrmStringToQuark(name);
+
+ toVal->size = sizeof(XtJustify);
+ toVal->addr = (XPointer)&orient;
- if (!haveQuarks) {
- XtQEhorizontal = XrmPermStringToQuark(XtEhorizontal);
- XtQEvertical = XrmPermStringToQuark(XtEvertical);
- haveQuarks = 1;
+ if (q == Qhorizontal)
+ orient = XtorientHorizontal;
+ else if (q == Qvertical)
+ orient = XtorientVertical;
+ else
+ {
+ toVal->addr = NULL;
+ XtStringConversionWarning((char *)fromVal->addr, XtROrientation);
}
+}
- if (strlen ((char*)fromVal->addr) < sizeof lowerName) {
- XmuCopyISOLatin1Lowered(lowerName, (char *) fromVal->addr);
- q = XrmStringToQuark(lowerName);
- if (q == XtQEhorizontal) {
- orient = XtorientHorizontal;
- done(&orient, XtOrientation);
- return;
- }
- if (q == XtQEvertical) {
- orient = XtorientVertical;
- done(&orient, XtOrientation);
- return;
+/*ARGSUSED*/
+Boolean
+XmuCvtOrientationToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal,
+ XtPointer *data)
+{
+ static String buffer;
+ Cardinal size;
+
+ switch (*(XtOrientation *)fromVal->addr)
+ {
+ case XtorientVertical:
+ buffer = XtEvertical;
+ break;
+ case XtorientHorizontal:
+ buffer = XtEhorizontal;
+ break;
+ default:
+ XtWarning("Cannot convert Orientation to String");
+ toVal->addr = NULL;
+ toVal->size = 0;
+ return (False);
+ }
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size < size)
+ {
+ toVal->size = size;
+ return (False);
}
+ strcpy((char *)toVal->addr, buffer);
}
- toVal->size = 0;
- toVal->addr = NULL;
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = sizeof(String);
+
+ return (True);
}
diff --git a/src/StrToShap.c b/src/StrToShap.c
index cf0c548..6c9092b 100644
--- a/src/StrToShap.c
+++ b/src/StrToShap.c
@@ -25,7 +25,9 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StrToShap.c,v 1.7 2001/12/14 19:55:53 dawes Exp $ */
+#include <string.h>
#include <X11/Intrinsic.h>
#include "Converters.h"
#include "CharSet.h"
@@ -50,39 +52,71 @@ in this Software without prior written authorization from The Open Group.
}
-Boolean XmuCvtStringToShapeStyle(dpy, args, num_args, from, toVal, data)
- Display *dpy;
- XrmValue *args; /* unused */
- Cardinal *num_args; /* unused */
- XrmValue *from;
- XrmValue *toVal;
- XtPointer *data; /* unused */
+/*ARGSUSED*/
+Boolean
+XmuCvtStringToShapeStyle(Display *dpy, XrmValue *args, Cardinal *num_args,
+ XrmValue *from, XrmValue *toVal, XtPointer *data)
{
- if ( XmuCompareISOLatin1((char*)from->addr, XtERectangle) == 0
- || XmuCompareISOLatin1((char*)from->addr, "ShapeRectangle") == 0)
- done( int, XmuShapeRectangle );
- if ( XmuCompareISOLatin1((char*)from->addr, XtEOval) == 0
- || XmuCompareISOLatin1((char*)from->addr, "ShapeOval") == 0)
- done( int, XmuShapeOval );
- if ( XmuCompareISOLatin1((char*)from->addr, XtEEllipse) == 0
- || XmuCompareISOLatin1((char*)from->addr, "ShapeEllipse") == 0)
- done( int, XmuShapeEllipse );
- if ( XmuCompareISOLatin1((char*)from->addr, XtERoundedRectangle) == 0
- || XmuCompareISOLatin1((char*)from->addr, "ShapeRoundedRectangle") == 0)
- done( int, XmuShapeRoundedRectangle );
+ String name = (String)from->addr;
+
+ if (XmuCompareISOLatin1(name, XtERectangle) == 0)
+ done(int, XmuShapeRectangle);
+ if (XmuCompareISOLatin1(name, XtEOval) == 0)
+ done(int, XmuShapeOval);
+ if (XmuCompareISOLatin1(name, XtEEllipse) == 0)
+ done(int, XmuShapeEllipse);
+ if (XmuCompareISOLatin1(name, XtERoundedRectangle) == 0)
+ done(int, XmuShapeRoundedRectangle);
+
+ XtDisplayStringConversionWarning(dpy, name, XtRShapeStyle);
+
+ return (False);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtShapeStyleToString(Display *dpy, XrmValue *args, Cardinal *num_args,
+ XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
+{
+ static char *buffer;
+ Cardinal size;
+
+ switch (*(int *)fromVal->addr)
{
- int style = 0;
- char ch, *p = (char*)from->addr;
- while ((ch = *p++)) {
- if (ch >= '0' && ch <= '9') {
- style *= 10;
- style += ch - '0';
+ case XmuShapeRectangle:
+ buffer = XtERectangle;
+ break;
+ case XmuShapeOval:
+ buffer = XtEOval;
+ break;
+ case XmuShapeEllipse:
+ buffer = XtEEllipse;
+ break;
+ case XmuShapeRoundedRectangle:
+ buffer = XtERoundedRectangle;
+ break;
+ default:
+ XtAppWarning(XtDisplayToApplicationContext(dpy),
+ "Cannot convert ShapeStyle to String");
+ toVal->addr = NULL;
+ toVal->size = 0;
+
+ return (False);
}
- else break;
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size <= size)
+ {
+ toVal->size = size;
+ return (False);
}
- if (ch == '\0' && style <= XmuShapeRoundedRectangle)
- done( int, style );
+ strcpy((char *)toVal->addr, buffer);
}
- XtDisplayStringConversionWarning( dpy, (char*)from->addr, XtRShapeStyle );
- return False;
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = size;
+
+ return (True);
}
diff --git a/src/StrToWidg.c b/src/StrToWidg.c
index 115a86c..cf12380 100644
--- a/src/StrToWidg.c
+++ b/src/StrToWidg.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/StrToWidg.c,v 1.7 2001/12/14 19:55:53 dawes Exp $ */
/*
* XmuCvtStringToWidget
@@ -40,19 +41,19 @@ in this Software without prior written authorization from The Open Group.
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/ObjectP.h>
+#include <X11/Xmu/Converters.h>
#define done(address, type) \
- { toVal->size = sizeof(type); \
- toVal->addr = (XPointer) address; \
+{ \
+ toVal->size = sizeof(type); \
+ toVal->addr = (XPointer)address; \
return; \
- }
+}
-/* ARGSUSED */
-void XmuCvtStringToWidget(args, num_args, fromVal, toVal)
- XrmValuePtr args; /* parent */
- Cardinal *num_args; /* 1 */
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
+/*ARGSUSED*/
+void
+XmuCvtStringToWidget(XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal)
{
static Widget widget, *widgetP, parent;
XrmName name = XrmStringToName(fromVal->addr);
@@ -64,43 +65,49 @@ void XmuCvtStringToWidget(args, num_args, fromVal, toVal)
parent = *(Widget*)args[0].addr;
/* try to match names of normal children */
- if (XtIsComposite(parent)) {
+ if (XtIsComposite(parent))
+ {
i = ((CompositeWidget)parent)->composite.num_children;
for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++) {
- if ((*widgetP)->core.xrm_name == name) {
+ i; i--, widgetP++)
+ if ((*widgetP)->core.xrm_name == name)
+ {
widget = *widgetP;
done(&widget, Widget);
}
}
- }
+
/* try to match names of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
- if ((*widgetP)->core.xrm_name == name) {
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++)
+ if ((*widgetP)->core.xrm_name == name)
+ {
widget = *widgetP;
done(&widget, Widget);
}
- }
+
/* try to match classes of normal children */
- if (XtIsComposite(parent)) {
+ if (XtIsComposite(parent))
+ {
i = ((CompositeWidget)parent)->composite.num_children;
for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++) {
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name) {
+ i; i--, widgetP++)
+ if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+ {
widget = *widgetP;
done(&widget, Widget);
}
}
- }
+
/* try to match classes of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name) {
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++)
+ if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+ {
widget = *widgetP;
done(&widget, Widget);
}
- }
+
XtStringConversionWarning(fromVal->addr, XtRWidget);
toVal->addr = NULL;
toVal->size = 0;
@@ -128,14 +135,10 @@ void XmuCvtStringToWidget(args, num_args, fromVal, toVal)
/*ARGSUSED*/
-Boolean XmuNewCvtStringToWidget(dpy, args, num_args, fromVal, toVal,
- converter_data)
- Display *dpy;
- XrmValue *args; /* parent */
- Cardinal *num_args; /* 1 */
- XrmValue *fromVal;
- XrmValue *toVal;
- XtPointer *converter_data;
+Boolean
+XmuNewCvtStringToWidget(Display *dpy, XrmValue *args, Cardinal *num_args,
+ XrmValue *fromVal, XrmValue *toVal,
+ XtPointer *converter_data)
{
Widget *widgetP, parent;
XrmName name = XrmStringToName(fromVal->addr);
@@ -149,35 +152,71 @@ Boolean XmuNewCvtStringToWidget(dpy, args, num_args, fromVal, toVal,
parent = *(Widget*)args[0].addr;
/* try to match names of normal children */
- if (XtIsComposite(parent)) {
+ if (XtIsComposite(parent))
+ {
i = ((CompositeWidget)parent)->composite.num_children;
for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++) {
+ i; i--, widgetP++)
if ((*widgetP)->core.xrm_name == name)
newDone(Widget, *widgetP);
}
- }
+
/* try to match names of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++)
if ((*widgetP)->core.xrm_name == name)
newDone(Widget, *widgetP);
- }
+
/* try to match classes of normal children */
- if (XtIsComposite(parent)) {
+ if (XtIsComposite(parent))
+ {
i = ((CompositeWidget)parent)->composite.num_children;
for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++) {
+ i; i--, widgetP++)
if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
newDone(Widget, *widgetP);
}
- }
+
/* try to match classes of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++)
if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
newDone(Widget, *widgetP);
- }
+
XtDisplayStringConversionWarning(dpy, (String)fromVal->addr, XtRWidget);
- return False;
+ return (False);
+}
+
+/*ARGSUSED*/
+Boolean
+XmuCvtWidgetToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
+ XrmValuePtr fromVal, XrmValuePtr toVal,
+ XtPointer *data)
+{
+ static String buffer;
+ Cardinal size;
+ Widget widget;
+
+ widget = *(Widget *)fromVal->addr;
+
+ if (widget)
+ buffer = XrmQuarkToString(widget->core.xrm_name);
+ else
+ buffer = "(null)";
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size < size)
+ {
+ toVal->size = size;
+ return (False);
+ }
+ strcpy((char *)toVal->addr, buffer);
+ }
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = sizeof(String);
+
+ return (True);
}
diff --git a/src/UpdMapHint.c b/src/UpdMapHint.c
index afd7f22..cd7ee92 100644
--- a/src/UpdMapHint.c
+++ b/src/UpdMapHint.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/UpdMapHint.c,v 1.7 2001/12/14 19:55:55 dawes Exp $ */
/*
* Author: Jim Fulton, MIT X Consortium
@@ -33,11 +34,10 @@ in this Software without prior written authorization from The Open Group.
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/Xmu/WinUtil.h>
-Bool XmuUpdateMapHints (dpy, w, hints)
- Display *dpy;
- Window w;
- XSizeHints *hints;
+Bool
+XmuUpdateMapHints(Display *dpy, Window w, XSizeHints *hints)
{
static XSizeHints *shp = NULL;
diff --git a/src/VisCmap.c b/src/VisCmap.c
index d560853..c551f29 100644
--- a/src/VisCmap.c
+++ b/src/VisCmap.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/VisCmap.c,v 1.7 2001/12/14 19:55:56 dawes Exp $ */
/*
* Author: Donna Converse, MIT X Consortium
@@ -67,20 +68,24 @@ in this Software without prior written authorization from The Open Group.
* RGB_GRAY_MAP
*/
-Status XmuVisualStandardColormaps(dpy, screen, visualid, depth, replace,
- retain)
- Display *dpy; /* specifies server connection */
- int screen; /* specifies screen number */
- VisualID visualid; /* specifies the visual */
- unsigned int depth; /* specifies the visual */
- Bool replace; /* specifies whether to replace */
- Bool retain; /* specifies whether to retain */
+Status
+XmuVisualStandardColormaps(Display *dpy, int screen, VisualID visualid,
+ unsigned int depth, Bool replace, Bool retain)
+ /*
+ * dpy - specifies server connection
+ * screen - specifies screen number
+ * visualid - specifies the visual
+ * depth - specifies the visual
+ * replace specifies - whether to replace
+ * retain - specifies whether to retain
+ */
{
Status status;
int n;
long vinfo_mask;
XVisualInfo vinfo_template, *vinfo;
-
+
+ status = 0;
vinfo_template.screen = screen;
vinfo_template.visualid = visualid;
vinfo_template.depth = depth;
@@ -158,7 +163,7 @@ Status XmuVisualStandardColormaps(dpy, screen, visualid, depth, replace,
XA_RGB_DEFAULT_MAP, replace,
retain);
if (! status) break;
- /* fall through */
+ /*FALLTHROUGH*/
case StaticGray:
diff --git a/src/WidgetNode.c b/src/WidgetNode.c
index 9c039e0..5a34156 100644
--- a/src/WidgetNode.c
+++ b/src/WidgetNode.c
@@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/WidgetNode.c,v 1.13 2002/09/24 18:55:21 alanh Exp $ */
+
/*
* Author: Jim Fulton, MIT X Consortium
*/
@@ -33,19 +35,34 @@ in this Software without prior written authorization from The Open Group.
#include <stdio.h>
+#include <stdlib.h>
#include <X11/Xos.h>
#include <X11/IntrinsicP.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xmu/CharSet.h>
#include <X11/Xmu/WidgetNode.h>
-
-static char *binsearch (key, base, nelems, elemsize, compar)
- char *key; /* template of object to find */
- char *base; /* beginning of array */
- int nelems; /* number of elements in array */
- int elemsize; /* sizeof an element */
- int (*compar)(); /* qsort-style compare function */
+/*
+ * Prototypes
+ */
+static char *binsearch(char*, char*, int, int,
+ int (*__compar)(_Xconst void*, _Xconst void*));
+static int compare_resource_entries(_Xconst void *a, _Xconst void *b);
+static XmuWidgetNode *find_resource(XmuWidgetNode*, char*, Bool);
+static void mark_resource_owner(XmuWidgetNode*);
+/*
+ * Implementation
+ */
+static char *
+binsearch(char *key, char *base, int nelems, int elemsize,
+ int compar(_Xconst void*, _Xconst void*))
+ /*
+ * key - template of object to find
+ * base - beginning of array
+ * nelems - number of elements in array
+ * elemsize - sizeof an element
+ * compar - qsort-style compare function
+ */
{
int lower = 0, upper = nelems - 1;
@@ -67,18 +84,17 @@ static char *binsearch (key, base, nelems, elemsize, compar)
}
-static int compare_resource_entries (a, b)
- register char *a, *b;
+static int
+compare_resource_entries(register _Xconst void *a,
+ register _Xconst void *b)
{
return strcmp (((XtResourceList)a)->resource_name,
((XtResourceList)b)->resource_name);
}
-static XmuWidgetNode *find_resource (node, name, cons)
- XmuWidgetNode *node;
- char *name;
- Bool cons;
+static XmuWidgetNode *
+find_resource(XmuWidgetNode *node, char *name, Bool cons)
{
register XmuWidgetNode *sup;
XtResource res;
@@ -101,10 +117,10 @@ static XmuWidgetNode *find_resource (node, name, cons)
}
-static void mark_resource_owner (node)
- register XmuWidgetNode *node;
+static void
+mark_resource_owner(register XmuWidgetNode *node)
{
- register int i;
+ register Cardinal i;
XtResourceList childres;
childres = node->resources;
@@ -125,9 +141,8 @@ static void mark_resource_owner (node)
* Public Interfaces
*/
-void XmuWnInitializeNodes (nodearray, nnodes)
- XmuWidgetNode *nodearray;
- int nnodes;
+void
+XmuWnInitializeNodes(XmuWidgetNode *nodearray, int nnodes)
{
int i;
XmuWidgetNode *wn;
@@ -144,12 +159,15 @@ void XmuWnInitializeNodes (nodearray, nnodes)
int namelen = strlen (XmuWnClassname(wn));
wn->lowered_label = XtMalloc (lablen + namelen + 2);
+#if 0
+ /* XtMalloc exits if failed */
if (!wn->lowered_label) {
fprintf (stderr,
"%s: unable to allocate %d bytes for widget name\n",
"XmuWnInitializeNodes", lablen + namelen + 2);
exit (1);
}
+#endif
wn->lowered_classname = wn->lowered_label + (lablen + 1);
XmuCopyISOLatin1Lowered (wn->lowered_label, wn->label);
XmuCopyISOLatin1Lowered (wn->lowered_classname, XmuWnClassname(wn));
@@ -190,10 +208,9 @@ void XmuWnInitializeNodes (nodearray, nnodes)
}
-void XmuWnFetchResources (node, toplevel, topnode)
- XmuWidgetNode *node;
- Widget toplevel;
- XmuWidgetNode *topnode;
+void
+XmuWnFetchResources(XmuWidgetNode *node, Widget toplevel,
+ XmuWidgetNode *topnode)
{
Widget dummy;
XmuWidgetNode *wn;
@@ -219,9 +236,9 @@ void XmuWnFetchResources (node, toplevel, topnode)
sizeof (XmuWidgetNode *));
if (!wn->resourcewn) {
fprintf (stderr,
- "%s: unable to calloc %d %d byte widget node ptrs\n",
- "XmuWnFetchResources",wn->nresources,
- sizeof (XmuWidgetNode *));
+ "%s: unable to calloc %d %ld byte widget node ptrs\n",
+ "XmuWnFetchResources", wn->nresources,
+ (unsigned long)sizeof (XmuWidgetNode *));
exit (1);
}
@@ -235,9 +252,9 @@ void XmuWnFetchResources (node, toplevel, topnode)
XtCalloc (wn->nconstraints, sizeof (XmuWidgetNode *));
if (!wn->constraintwn) {
fprintf (stderr,
- "%s: unable to calloc %d %d byte widget node ptrs\n",
+ "%s: unable to calloc %d %ld byte widget node ptrs\n",
"XmuWnFetchResources", wn->nconstraints,
- sizeof (XmuWidgetNode *));
+ (unsigned long)sizeof (XmuWidgetNode *));
exit (1);
}
@@ -259,9 +276,9 @@ void XmuWnFetchResources (node, toplevel, topnode)
}
-int XmuWnCountOwnedResources (node, ownernode, cons)
- XmuWidgetNode *node, *ownernode;
- Bool cons;
+int
+XmuWnCountOwnedResources(XmuWidgetNode *node, XmuWidgetNode *ownernode,
+ Bool cons)
{
register int i;
XmuWidgetNode **wn = (cons ? node->constraintwn : node->resourcewn);
@@ -273,33 +290,19 @@ int XmuWnCountOwnedResources (node, ownernode, cons)
}
-#if NeedFunctionPrototypes
-XmuWidgetNode *XmuWnNameToNode (XmuWidgetNode *nodelist, int nnodes,
- _Xconst char *name)
-#else
-XmuWidgetNode *XmuWnNameToNode (nodelist, nnodes, name)
- XmuWidgetNode *nodelist;
- int nnodes;
- char *name;
-#endif
+XmuWidgetNode *
+XmuWnNameToNode(XmuWidgetNode *nodelist, int nnodes, _Xconst char *name)
{
int i;
XmuWidgetNode *wn;
- char* tmpp;
char tmp[1024];
- XmuWidgetNode* ret = NULL;
- if ((i = strlen (name)) < sizeof tmp) tmpp = tmp;
- else tmpp = XtMalloc (i + 1);
- if (tmpp == NULL) return ret;
- XmuCopyISOLatin1Lowered (tmpp, name);
+ XmuNCopyISOLatin1Lowered(tmp, name, sizeof(tmp));
for (i = 0, wn = nodelist; i < nnodes; i++, wn++) {
- if (strcmp (tmpp, wn->lowered_label) == 0 ||
- strcmp (tmpp, wn->lowered_classname) == 0) {
- ret = wn;
- break;
+ if (strcmp (tmp, wn->lowered_label) == 0 ||
+ strcmp (tmp, wn->lowered_classname) == 0) {
+ return wn;
}
}
- if (tmpp != tmp) XtFree (tmpp);
- return ret;
+ return NULL;
}
diff --git a/src/Xct.c b/src/Xct.c
index 2014c4d..039ee59 100644
--- a/src/Xct.c
+++ b/src/Xct.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/Xct.c,v 1.9 2001/12/14 19:55:58 dawes Exp $ */
#include <X11/Xfuncs.h>
#include "Xct.h"
@@ -48,8 +49,7 @@ typedef struct _XctPriv {
#define IsMore(priv) ((priv)->ptr != (priv)->ptrend)
#define AmountLeft(priv) ((priv)->ptrend - (priv)->ptr)
-extern char *malloc();
-extern char *realloc();
+#include <stdlib.h>
#define HT 0x09
#define NL 0x0a
@@ -77,9 +77,23 @@ extern char *realloc();
#define HasGR 4
#define ToGL 8
+/*
+ * Prototypes
+ */
+static void ComputeGLGR(XctData);
+static int Handle94GR(XctData, int);
+static int Handle96GR(XctData, int);
+static int HandleExtended(XctData data, int);
+static int HandleGL(XctData, int);
+static int HandleMultiGL(XctData, int);
+static int HandleMultiGR(XctData data, int);
+static void ShiftGRToGL(XctData, int);
+
+/*
+ * Implementation
+ */
static void
-ComputeGLGR(data)
- register XctData data;
+ComputeGLGR(register XctData data)
{
/* XXX this will need more work if more sets are registered */
if ((data->GL_set_size == 94) && (data->GL_char_size == 1) &&
@@ -95,9 +109,7 @@ ComputeGLGR(data)
}
static int
-HandleGL(data, c)
- register XctData data;
- unsigned char c;
+HandleGL(register XctData data, int c)
{
switch (c) {
case 0x42:
@@ -118,9 +130,7 @@ HandleGL(data, c)
}
static int
-HandleMultiGL(data, c)
- register XctData data;
- unsigned char c;
+HandleMultiGL(register XctData data, int c)
{
switch (c) {
case 0x41:
@@ -153,9 +163,7 @@ HandleMultiGL(data, c)
}
static int
-Handle94GR(data, c)
- register XctData data;
- unsigned char c;
+Handle94GR(register XctData data, int c)
{
switch (c) {
case 0x49:
@@ -173,9 +181,7 @@ Handle94GR(data, c)
}
static int
-Handle96GR(data, c)
- register XctData data;
- unsigned char c;
+Handle96GR(register XctData data, int c)
{
switch (c) {
case 0x41:
@@ -225,9 +231,7 @@ Handle96GR(data, c)
}
static int
-HandleMultiGR(data, c)
- register XctData data;
- unsigned char c;
+HandleMultiGR(register XctData data, int c)
{
switch (c) {
case 0x41:
@@ -273,14 +277,12 @@ HandleMultiGR(data, c)
}
static int
-HandleExtended(data, c)
- register XctData data;
- unsigned char c;
+HandleExtended(register XctData data, int c)
{
register XctPriv priv = data->priv;
XctString enc = data->item + 6;
register XctString ptr = enc;
- int i, len;
+ unsigned i, len;
while (*ptr != 0x02) {
if (!*ptr || (++ptr == priv->ptr))
@@ -319,9 +321,7 @@ HandleExtended(data, c)
}
static void
-ShiftGRToGL(data, hasCdata)
- register XctData data;
- int hasCdata;
+ShiftGRToGL(register XctData data, int hasCdata)
{
register XctPriv priv = data->priv;
register int i;
@@ -349,16 +349,8 @@ ShiftGRToGL(data, hasCdata)
}
/* Create an XctData structure for parsing a Compound Text string. */
-#if NeedFunctionPrototypes
XctData
XctCreate(_Xconst unsigned char *string, int length, XctFlags flags)
-#else
-XctData
-XctCreate(string, length, flags)
- XctString string;
- int length;
- XctFlags flags;
-#endif
{
register XctData data;
register XctPriv priv;
@@ -382,8 +374,7 @@ XctCreate(string, length, flags)
/* Reset the XctData structure to re-parse the string from the beginning. */
void
-XctReset(data)
- register XctData data;
+XctReset(register XctData data)
{
register XctPriv priv = data->priv;
@@ -418,8 +409,7 @@ XctReset(data)
* contextual state, are reported as components of the XctData structure.
*/
XctResult
-XctNextItem(data)
- register XctData data;
+XctNextItem(register XctData data)
{
register XctPriv priv = data->priv;
unsigned char c;
@@ -675,10 +665,9 @@ XctNextItem(data)
/* Free all data associated with an XctDataStructure. */
void
-XctFree(data)
- register XctData data;
+XctFree(register XctData data)
{
- int i;
+ unsigned i;
register XctPriv priv = data->priv;
if (priv->dirstack)
diff --git a/src/sharedlib.c b/src/sharedlib.c
index 0b835b5..599de7d 100644
--- a/src/sharedlib.c
+++ b/src/sharedlib.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/Xmu/sharedlib.c,v 3.5 2001/12/14 19:56:00 dawes Exp $ */
#if defined(SUNSHLIB) && !defined(SHAREDCODE)
@@ -35,7 +36,7 @@ struct _AtomRec {
struct _DisplayRec* head;
};
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define DeclareAtom(atom) \
extern struct _AtomRec __##atom; \
AtomPtr _##atom = &__##atom;
@@ -67,5 +68,6 @@ DeclareAtom(XA_TARGETS)
DeclareAtom(XA_TEXT)
DeclareAtom(XA_TIMESTAMP)
DeclareAtom(XA_USER)
+DeclareAtom(XA_UTF8_STRING)
#endif /* SUNSHLIB */