* Activate.c (XMenuActivate): Callback's first arg is readonly.
* AddPane.c (XMenuAddPane): Label is readonly. Rename local
to avoid shadowing.
* AddSel.c (XMenuAddSelection): Help arg is readonly. Rename local.
* Create.c (atoi, atof): Remove decls; include <stdlib.h>.
(MAX_INACT_PNUM, TILE_BUF_SIZE): Remove; unused.
(x_get_resource_string): Args are readonly.
(XAllocDisplayColor): colorName is readonly.
(XMenuCreate): def_env is readonly. Remove unused locals. Avoid
"else;".
* Destroy.c (XMenuDestroy): Return void.
* Error.c (XMenuError): Remove const pointer.
* EvHand.c (XMenuEventHandler): Return void.
* FindPane.c, FindSel.c: Include <string.h>.
* InsPane.c (XMenuInsertPane): Rename local to avoid shadowing.
* InsSel.c (XMenuInsertSelection): Likewise.
* Internal.c (toggle_color, BUFFER_SIZE): Remove; unused.
(_XMErrorList): Now const.
(_XMWinQueInit, _XMRecomputeGlobals, _XMTransToOrigin, _XMRefreshPane):
(_XMRefreshSelection): Return void.
(_XMWinQueFlush, _XMRefreshSelection): Rename locals to avoid
shadowing.
(_XMWinQueFlush): Use stack, not heap. Don't use uninitialized var.
* SetAEQ.c (XMenuSetAEQ): Now returns void.
* SetFrz.c (XMenuSetFreeze): Likewise.
* X10.h (XAssoc): Use void * for generic pointer.
* XDelAssoc.c: Include XMenuInt.h rather than duplicating part of it.
* XDestAssoc.c, XMakeAssoc.c: Likewise.
* XDestAssoc.c (XDestroyAssocTable): Return void.
* XMakeAssoc.c (XMakeAssoc): Use void * for generic pointer.
* XMenu.h, XMenuInt.h: Adjust to signature changes. Use const
for pointers to readonly storage.
* insque.c: Include XMenuInt.h, to check our own signature.
(emacs_insque, emacs_remque): Use void * for generic pointers.
int y_pos, /* Y coordinate of menu position. */
unsigned int event_mask, /* Mouse button event mask. */
char **data, /* Pointer to return data value. */
- void (* help_callback) (char *, int, int)) /* Help callback. */
+ void (*help_callback) (char const *, int, int)) /* Help callback. */
{
int status; /* X routine call status. */
int orig_x; /* Upper left menu origin X coord. */
#include "XMenuInt.h"
int
-XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active)
-
+XMenuAddPane(Display *display, register XMenu *menu, register char const *label, int active)
+
/* Menu object to be modified. */
/* Selection label. */
/* Make selection active? */
{
register XMPane *pane; /* Newly created pane. */
- register XMSelect *select; /* Initial selection for the new pane. */
+ register XMSelect *sel; /* Initial selection for the new pane. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
* Set up the initial selection.
* Values not explicitly set are zeroed by calloc.
*/
- select->next = select;
- select->prev = select;
- select->type = SL_HEADER;
- select->serial = -1;
- select->parent_p = pane;
+ sel->next = sel;
+ sel->prev = sel;
+ sel->type = SL_HEADER;
+ sel->serial = -1;
+ sel->parent_p = pane;
/*
* Fill the XMPane structure.
pane->label = label;
pane->label_width = label_width;
pane->label_length = label_length;
- pane->s_list = select;
+ pane->s_list = sel;
/*
* Insert the pane at the end of the pane list.
_XMErrorCode = XME_NO_ERROR;
return((menu->p_count - 1));
}
-
#include "XMenuInt.h"
int
-XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help)
-
+XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char const *help)
+
/* Menu object to be modified. */
/* Pane number to be modified. */
/* Data value. */
/* Help string */
{
register XMPane *pane; /* Pane containing the new selection. */
- register XMSelect *select; /* Newly created selection. */
+ register XMSelect *sel; /* Newly created selection. */
int label_length; /* Label lenght in characters. */
/*
* Calloc the XMSelect structure.
*/
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
*/
if (!strcmp (label, "--") || !strcmp (label, "---"))
{
- select->type = SEPARATOR;
- select->active = 0;
+ sel->type = SEPARATOR;
+ sel->active = 0;
}
else
{
- select->type = SELECTION;
- select->active = active;
+ sel->type = SELECTION;
+ sel->active = active;
}
- select->serial = -1;
- select->label = label;
- select->label_width = label_width;
- select->label_length = label_length;
- select->data = data;
- select->parent_p = pane;
- select->help_string = help;
+ sel->serial = -1;
+ sel->label = label;
+ sel->label_width = label_width;
+ sel->label_length = label_length;
+ sel->data = data;
+ sel->parent_p = pane;
+ sel->help_string = help;
/*
* Insert the selection at the end of the selection list.
*/
- emacs_insque(select, pane->s_list->prev);
+ emacs_insque(sel, pane->s_list->prev);
/*
* Update the selection count.
_XMErrorCode = XME_NO_ERROR;
return((pane->s_count - 1));
}
-
+2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
+
+ Modernize to C89, for better static checking.
+ * Activate.c (XMenuActivate): Callback's first arg is readonly.
+ * AddPane.c (XMenuAddPane): Label is readonly. Rename local
+ to avoid shadowing.
+ * AddSel.c (XMenuAddSelection): Help arg is readonly. Rename local.
+ * Create.c (atoi, atof): Remove decls; include <stdlib.h>.
+ (MAX_INACT_PNUM, TILE_BUF_SIZE): Remove; unused.
+ (x_get_resource_string): Args are readonly.
+ (XAllocDisplayColor): colorName is readonly.
+ (XMenuCreate): def_env is readonly. Remove unused locals. Avoid
+ "else;".
+ * Destroy.c (XMenuDestroy): Return void.
+ * Error.c (XMenuError): Remove const pointer.
+ * EvHand.c (XMenuEventHandler): Return void.
+ * FindPane.c, FindSel.c: Include <string.h>.
+ * InsPane.c (XMenuInsertPane): Rename local to avoid shadowing.
+ * InsSel.c (XMenuInsertSelection): Likewise.
+ * Internal.c (toggle_color, BUFFER_SIZE): Remove; unused.
+ (_XMErrorList): Now const.
+ (_XMWinQueInit, _XMRecomputeGlobals, _XMTransToOrigin, _XMRefreshPane):
+ (_XMRefreshSelection): Return void.
+ (_XMWinQueFlush, _XMRefreshSelection): Rename locals to avoid
+ shadowing.
+ (_XMWinQueFlush): Use stack, not heap. Don't use uninitialized var.
+ * SetAEQ.c (XMenuSetAEQ): Now returns void.
+ * SetFrz.c (XMenuSetFreeze): Likewise.
+ * X10.h (XAssoc): Use void * for generic pointer.
+ * XDelAssoc.c: Include XMenuInt.h rather than duplicating part of it.
+ * XDestAssoc.c, XMakeAssoc.c: Likewise.
+ * XDestAssoc.c (XDestroyAssocTable): Return void.
+ * XMakeAssoc.c (XMakeAssoc): Use void * for generic pointer.
+ * XMenu.h, XMenuInt.h: Adjust to signature changes. Use const
+ for pointers to readonly storage.
+ * insque.c: Include XMenuInt.h, to check our own signature.
+ (emacs_insque, emacs_remque): Use void * for generic pointers.
+
2011-03-07 Chong Yidong <cyd@stupidchicken.com>
* Version 23.3 released.
#include <config.h>
#include "XMenuInt.h"
-
+#include <stdlib.h>
#ifdef EMACS_BITMAP_FILES
#include "../src/bitmaps/dimple1.xbm"
#define DEF_MENU_STYLE LEFT
#define DEF_MENU_MODE BOX
#define DEF_INACT_PNUM 3
-#define MAX_INACT_PNUM 4
#define DEF_P_STYLE CENTER
#define XASSOC_TABLE_SIZE 64
-#define TILE_BUF_SIZE 5
-
-int atoi(const char *);
-double atof(const char *);
-char *x_get_resource_string (char *attribute, char *class);
+char *x_get_resource_string (char const *, char const *);
static Status
-XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *color, XColor *junk)
+XAllocDisplayColor(Display *display, Colormap map, char const *colorName,
+ XColor *color, XColor *junk)
{
return (colorName!=0 &&
XParseColor(display, map, colorName, color) &&
XMenu *
-XMenuCreate(Display *display, Window parent, register char *def_env)
+XMenuCreate(Display *display, Window parent, register char const *def_env)
/* ID of previously opened display */
/* Window ID of the menu's parent window. */
/* X Defaults program environment name. */
{
- register int i; /* Loop counter. */
- register int j; /* Loop counter. */
register char *def_val; /* X Default value temp variable. */
register XMenu *menu; /* Pointer to the new menu. */
int reverse; /* Reverse video mode. */
XMStyle p_style; /* Pane display style. */
- char *p_fnt_name; /* Flag font name. */
+ char const *p_fnt_name; /* Flag font name. */
XFontStruct *p_fnt_info; /* Flag font structure */
int p_fnt_pad; /* Flag font padding in pixels. */
double p_spread; /* Pane spread in flag height fractions. */
GC pane_GC; /* Pane graphics context. */
XMStyle s_style; /* Selection display style. */
- char *s_fnt_name; /* Selection font name. */
+ char const *s_fnt_name; /* Selection font name. */
XFontStruct *s_fnt_info; /* Selection font structure. */
int s_fnt_pad; /* Selection font padding in pixels. */
int s_fnt_height; /* Selection font character height */
GC inverse_select_GC; /* GC used for inverse video selection. */
GC inact_GC; /* GC for inactive pane header and */
/* selections. */
- GC inact_GC_noexpose;
XColor color_def; /* Temp color definition holder. */
- XColor screen_def; /* Temp screen color definition holder */
XColor p_bdr_color; /* Color of border. */
XColor s_bdr_color; /* Color of highlight. */
XColor p_frg_color; /* Color of pane foreground color. */
int inact_pnum; /* Inactive background pattern number. */
- Pixel p_bdr_pixel; /* Pane border pixel. */
- Pixel s_bdr_pixel; /* Selection border pixel. */
- Pixel p_frg_pixel; /* Pane foreground pixel. */
- Pixel s_frg_pixel; /* Selection foreground pixel. */
- Pixel bkgnd_pixel; /* Menu background pixel. */
-
- int *width, *height;
- Pixmap *bitmap;
- int *x_hot, *y_hot;
- int status; /* Return code from XReadBitmapFile. */
-
Pixmap cursor; /* Cursor pixmap holder. */
Pixmap cursor_mask; /* Cursor mask pixmap holder. */
Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */
&mouse_color, &color_def)
);
- else ;
+ else {}
def_val = x_get_resource_string ("menuBackground", "MenuBackground");
if (
"white",
&bkgnd_color, &color_def)
);
- else;
+ else {}
def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern");
if (def_val != NULL) {
"black",
&s_frg_color, &color_def)
) ;
- else ;
+ else {}
def_val = x_get_resource_string ("selectionBorder", "SelectionBorder");
"black",
&s_bdr_color, &color_def)
) ;
- else ;
+ else {}
def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth");
if (def_val != NULL) s_bdr_width = atoi(def_val);
valuemask |= (GCGraphicsExposures);
values->graphics_exposures = False;
- inact_GC_noexpose = XCreateGC (display,
- root,
- valuemask, values);
/*
_XMErrorCode = XME_NO_ERROR;
return(menu);
}
-
#include "XMenuInt.h"
+void
XMenuDestroy(Display *display, register XMenu *menu)
-
+
/* Menu object to destroy. */
{
register XMPane *p_ptr; /* Pointer to the current pane. */
*/
free(menu);
}
-
#include "XMenuInt.h"
-char *
+char const *
XMenuError(void)
{
static char message[128]; /* Error message buffer. */
sprintf(message, "Unknown _XMErrorCode: %d", _XMErrorCode);
return(message);
}
-
#include "XMenuInt.h"
+void
XMenuEventHandler(int (*handler) (XEvent*))
{
/*
*/
_XMEventHandler = handler;
}
-
*/
#include "XMenuInt.h"
+#include <string.h>
int
XMenuFindPane(register XMenu *menu, register char *label)
_XMErrorCode = XME_P_NOT_FOUND;
return (XM_FAILURE);
}
-
*/
#include "XMenuInt.h"
+#include <string.h>
int
XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
_XMErrorCode = XME_S_NOT_FOUND;
return (XM_FAILURE);
}
-
{
register XMPane *p_ptr; /* XMPane pointer. */
register XMPane *pane; /* Newly created pane. */
- register XMSelect *select; /* Initial selection for the new pane. */
+ register XMSelect *sel; /* Initial selection for the new pane. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
* Set up the initial selection.
* Values not explicitly set are zeroed by calloc.
*/
- select->next = select;
- select->prev = select;
- select->type = SL_HEADER;
- select->serial = -1;
- select->parent_p = pane;
+ sel->next = sel;
+ sel->prev = sel;
+ sel->type = SL_HEADER;
+ sel->serial = -1;
+ sel->parent_p = pane;
/*
* Fill the XMPane structure.
pane->label = label;
pane->label_width = label_width;
pane->label_length = label_length;
- pane->s_list = select;
+ pane->s_list = sel;
/*
* Insert the pane after the pane with the pane
_XMErrorCode = XME_NO_ERROR;
return(p_num);
}
-
register XMPane *p_ptr; /* XMPane pointer. */
register XMSelect *s_ptr; /* XMSelect pointer. */
- XMSelect *select; /* Newly created selection. */
+ XMSelect *sel; /* Newly created selection. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
/*
* Calloc the XMSelect structure.
*/
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
*/
if (!strcmp (label, "--") || !strcmp (label, "---"))
{
- select->type = SEPARATOR;
- select->active = 0;
+ sel->type = SEPARATOR;
+ sel->active = 0;
}
else
{
- select->type = SELECTION;
- select->active = active;
+ sel->type = SELECTION;
+ sel->active = active;
}
- select->active = active;
- select->serial = -1;
- select->label = label;
- select->label_width = label_width;
- select->label_length = label_length;
- select->data = data;
- select->parent_p = p_ptr;
+ sel->active = active;
+ sel->serial = -1;
+ sel->label = label;
+ sel->label_width = label_width;
+ sel->label_length = label_length;
+ sel->data = data;
+ sel->parent_p = p_ptr;
/*
* Insert the selection after the selection with the selection
* number one less than the desired number for the new selection.
*/
- emacs_insque(select, s_ptr);
+ emacs_insque(sel, s_ptr);
/*
* Update the selection count.
_XMErrorCode = XME_NO_ERROR;
return(s_num);
}
-
#include <config.h>
#include "XMenuInt.h"
-/*
- * Toggle color macro.
- */
-#define toggle_color(x) \
- ((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color)
-
/*
* Internal Window creation queue sizes.
*/
#define S_QUE_SIZE 300
#define P_QUE_SIZE 20
-#define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE)
/*
/*
* _XMErrorList - Global XMenu error code description strings.
*/
-char *
+char const *const
_XMErrorList[XME_CODE_COUNT] = {
"No error", /* XME_NO_ERROR */
"Menu not initialized", /* XME_NOT_INIT */
* _XMWinQueInit - Internal routine to initialize the window
* queue.
*/
+void
_XMWinQueInit(void)
{
/*
*/
int
_XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr)
-
+
/* Menu being manipulated. */
/* XMPane being queued. */
{
*/
int
_XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr)
-
+
/* Menu being manipulated. */
/* XMSelection being queued. */
{
* selection window queues.
*/
int
-_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select)
-
+_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *sel)
+
/* Menu being manipulated. */
/* Current pane. */
{
register XMPane *p_ptr; /* XMPane pointer. */
register XMSelect *s_ptr; /* XMSelect pointer. */
unsigned long valuemask; /* Which attributes to set. */
- XSetWindowAttributes *attributes; /* Attributes to be set. */
+ XSetWindowAttributes attributes_buf; /* Attributes to be set. */
+ XSetWindowAttributes *attributes = &attributes_buf;
/*
* If the pane window queue is not empty...
* set up attributes for pane window to be created.
*/
valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect);
- attributes = (XSetWindowAttributes *)malloc(sizeof(XSetWindowAttributes));
attributes->border_pixel = menu->p_bdr_color;
attributes->background_pixmap = menu->inact_pixmap;
attributes->override_redirect = True;
* _XMRecomputeGlobals - Internal subroutine to recompute menu wide
* global values.
*/
+void
_XMRecomputeGlobals(register Display *display, register XMenu *menu)
/*X11 display variable. */
/* Menu object to compute from. */
*/
int
_XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num)
-
+
/* Menu object being recomputed. */
/* Selection pointer. */
/* Selection sequence number. */
* recomputed before calling this routine or
* unpredictable results will follow.
*/
+void
_XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y)
/* Not used. Included for consistency. */
/* Menu being computed against. */
* _XMRefreshPane - Internal subroutine to completely refresh
* the contents of a pane.
*/
+void
_XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane)
{
register XMSelect *s_list = pane->s_list;
* _XMRefreshSelection - Internal subroutine that refreshes
* a single selection window.
*/
-_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *select)
+void
+_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *sel)
{
- register int width = select->window_w;
- register int height = select->window_h;
+ register int width = sel->window_w;
+ register int height = sel->window_h;
register int bdr_width = menu->s_bdr_width;
- if (select->type == SEPARATOR) {
+ if (sel->type == SEPARATOR) {
XDrawLine(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->window_x,
- select->window_y + height / 2,
- select->window_x + width,
- select->window_y + height / 2);
+ sel->window_x,
+ sel->window_y + height / 2,
+ sel->window_x + width,
+ sel->window_y + height / 2);
}
- else if (select->activated) {
+ else if (sel->activated) {
if (menu->menu_mode == INVERT) {
XFillRectangle(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->window_x, select->window_y,
+ sel->window_x, sel->window_y,
width, height);
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->inverse_select_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
else {
/*
*/
XDrawRectangle(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->window_x + (bdr_width >> 1),
- select->window_y + (bdr_width >> 1 ),
+ sel->window_x + (bdr_width >> 1),
+ sel->window_y + (bdr_width >> 1 ),
width - bdr_width,
height - bdr_width);
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
}
else {
XClearArea(display,
- select->parent_p->window,
- select->window_x, select->window_y,
+ sel->parent_p->window,
+ sel->window_x, sel->window_y,
width, height,
False);
- if (select->active) {
+ if (sel->active) {
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
else {
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->inact_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
}
}
-
#include "XMenuInt.h"
+void
XMenuSetAEQ(register XMenu *menu, register int aeq)
/* Menu object to be modified. */
/* AEQ mode? */
*/
menu->aeq = aeq;
}
-
#include "XMenuInt.h"
+void
XMenuSetFreeze(register XMenu *menu, register int freeze)
/* Menu object to be modified. */
/* Freeze mode? */
*/
menu->freeze = freeze;
}
-
struct _XAssoc *prev; /* Previous obejct in this bucket. */
Display *display; /* Display which owns the id. */
XID x_id; /* X Window System id. */
- char *data; /* Pointer to untyped memory. */
+ void *data; /* Pointer to untyped memory. */
} XAssoc;
/*
char *XLookUpAssoc(Display *dpy, XAssocTable *table, XID x_id);
#endif /* _X10_H_ */
-
#include "copyright.h"
-
-#include <X11/Xlib.h>
-#include "X10.h"
-struct qelem {
- struct qelem *q_forw;
- struct qelem *q_back;
- char q_data[1];
-};
-void emacs_remque(struct qelem*);
+#include "XMenuInt.h"
/*
* XDeleteAssoc - Delete an association in an XAssocTable keyed on
/* It is apparently not in the table. */
return;
}
-
#include "copyright.h"
-
-#include <X11/Xlib.h>
-#include "X10.h"
+#include "XMenuInt.h"
/*
* XDestroyAssocTable - Destroy (free the memory associated with)
* an XAssocTable.
*/
+void
XDestroyAssocTable(register XAssocTable *table)
{
register int i;
/* Free the table. */
free((char *)table);
}
-
#include <config.h>
-#include <X11/Xlib.h>
+#include "XMenuInt.h"
#include <X11/Xresource.h>
-#include "X10.h"
#include <errno.h>
#ifndef NULL
#define NULL 0
#endif
-struct qelem {
- struct qelem *q_forw;
- struct qelem *q_back;
- char q_data[1];
-};
-void emacs_insque (struct qelem *elem, struct qelem *prev);
-
/*
* XMakeAssoc - Insert data into an XAssocTable keyed on an XId.
* Data is inserted into the table only once. Redundant inserts are
* bucket is sorted (lowest XId to highest XId).
*/
void
-XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register caddr_t data)
+XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID x_id, register void *data)
{
int hash;
register XAssoc *bucket;
/* Insert the new entry. */
emacs_insque((struct qelem *)new_entry, (struct qelem *)Entry->prev);
}
-
* XMenu error code and error list definitions.
*/
extern int _XMErrorCode;
-extern char *_XMErrorList[];
+extern char const *const _XMErrorList[];
/*
* Define the XMWindow datatypes.
int active; /* Window active? */
int activated; /* Window activated? */
int serial; /* -- Pane serial number. */
- char *label; /* -- Pane label. */
+ char const *label; /* -- Pane label. */
int label_width; /* -- Pane label width in pixels. */
int label_length; /* -- Pane label length in chars. */
int label_x; /* -- Pane label X offset. */
struct _xmwindow *pad_l9; /* ---- */
char *data; /* -- Selection data pointer. */
struct _xmpane *parent_p; /* -- Selection parent pane structure. */
- char *help_string; /* Help string or null. */
+ char const *help_string; /* Help string or null. */
} XMSelect;
/*
* XMenu library routine declarations.
*/
-XMenu *XMenuCreate(Display *display, Window parent, register char *def_env);
-int XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active);
-int XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help);
-int XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int active);
-int XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_num, char *data, char *label, int active);
-int XMenuFindPane(register XMenu *menu, register char *label);
-int XMenuFindSelection(register XMenu *menu, int p_num, register char *label);
-int XMenuChangePane(register XMenu *menu, register int p_num, char *label);
-int XMenuChangeSelection(Display *display, register XMenu *menu, register int p_num, register int s_num, char *data, int data_sw, char *label, int label_sw);
-int XMenuSetPane(register XMenu *menu, register int p_num, register int active);
-int XMenuSetSelection(register XMenu *menu, register int p_num, register int s_num, int active);
-int XMenuRecompute(Display *display, register XMenu *menu);
-int XMenuEventHandler(int (*handler) (XEvent *)); /* No value actually returned. */
-int XMenuLocate(register Display *display, register XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height);
-int XMenuSetFreeze(register XMenu *menu, register int freeze); /* No value actually returned. */
+XMenu *XMenuCreate(Display *display, Window parent, char const *def_env);
+int XMenuAddPane(Display *display, XMenu *menu, char const *label, int active);
+int XMenuAddSelection(Display *display, XMenu *menu, int p_num, char *data, char *label, int active, char const *help);
+int XMenuInsertPane(XMenu *menu, int p_num, char *label, int active);
+int XMenuInsertSelection(XMenu *menu, int p_num, int s_num, char *data, char *label, int active);
+int XMenuFindPane(XMenu *menu, char *label);
+int XMenuFindSelection(XMenu *menu, int p_num, char *label);
+int XMenuChangePane(XMenu *menu, int p_num, char *label);
+int XMenuChangeSelection(Display *display, XMenu *menu, int p_num, int s_num, char *data, int data_sw, char *label, int label_sw);
+int XMenuSetPane(XMenu *menu, int p_num, int active);
+int XMenuSetSelection(XMenu *menu, int p_num, int s_num, int active);
+int XMenuRecompute(Display *display, XMenu *menu);
+void XMenuEventHandler(int (*handler) (XEvent *));
+int XMenuLocate(Display *display, XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height);
+void XMenuSetFreeze(XMenu *menu, int freeze);
void XMenuActivateSetWaitFunction(Wait_func func, void *data);
-int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char *, int, int));
-char *XMenuPost(register Display *display, register XMenu *menu, register int *p_num, register int *s_num, register int x_pos, register int y_pos, int event_mask);
-int XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num);
-int XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num);
-int XMenuDestroy(Display *display, register XMenu *menu); /* No value actually returned. */
-char *XMenuError(void);
+int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char const *, int, int));
+char *XMenuPost(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, int event_mask);
+int XMenuDeletePane(Display *display, XMenu *menu, int p_num);
+int XMenuDeleteSelection(Display *display, XMenu *menu, int p_num, int s_num);
+void XMenuDestroy(Display *display, XMenu *menu);
+char const *XMenuError(void);
+void XMenuSetAEQ(XMenu *menu, int aeq);
#endif
/* Don't add after this point. */
-
/*
* Internal routine declarations.
*/
-int _XMWinQueInit(void); /* No value actually returned. */
-int _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr);
-int _XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr);
-int _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select);
-XMPane *_XMGetPanePtr(register XMenu *menu, register int p_num);
-XMSelect *_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num);
-int _XMRecomputeGlobals(register Display *display, register XMenu *menu); /* No value actually returned. */
-int _XMRecomputePane(register Display *display, register XMenu *menu, register XMPane *p_ptr, register int p_num);
-int _XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num);
-int _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y); /* No value actually returned. */
-int _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane); /* No value actually returned. */
+void _XMWinQueInit(void);
+int _XMWinQueAddPane(Display *display, XMenu *menu, XMPane *p_ptr);
+int _XMWinQueAddSelection(Display *display, XMenu *menu, XMSelect *s_ptr);
+int _XMWinQueFlush(Display *display, XMenu *menu, XMPane *pane, XMSelect *select);
+XMPane *_XMGetPanePtr(XMenu *menu, int p_num);
+XMSelect *_XMGetSelectionPtr(XMPane *p_ptr, int s_num);
+void _XMRecomputeGlobals(Display *display, XMenu *menu);
+int _XMRecomputePane(Display *display, XMenu *menu, XMPane *p_ptr, int p_num);
+int _XMRecomputeSelection(Display *display, XMenu *menu, XMSelect *s_ptr, int s_num);
+void _XMTransToOrigin(Display *display, XMenu *menu, XMPane *p_ptr, XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y);
+void _XMRefreshPane(Display *display, XMenu *menu, XMPane *pane);
+void _XMRefreshSelection(Display *display, XMenu *menu, XMSelect *select);
+void emacs_insque (void *elem, void *prev);
+void emacs_remque (void *elem);
+void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id);
+void XDestroyAssocTable(XAssocTable *table);
+void XMakeAssoc(Display *dpy, XAssocTable *table, XID x_id, void *data);
+void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id);
#endif
/* Don't add stuff after this #endif */
-
their callers have been renamed to emacs_mumble to allow us to
include this file in the menu library on all systems. */
+#include "XMenuInt.h"
struct qelem {
struct qelem *q_forw;
/* Insert ELEM into a doubly-linked list, after PREV. */
void
-emacs_insque (struct qelem *elem, struct qelem *prev)
+emacs_insque (void *velem, void *vprev)
{
+ struct qelem *elem = velem;
+ struct qelem *prev = vprev;
struct qelem *next = prev->q_forw;
prev->q_forw = elem;
if (next)
/* Unlink ELEM from the doubly-linked list that it is in. */
-emacs_remque (struct qelem *elem)
+void
+emacs_remque (void *velem)
{
+ struct qelem *elem = velem;
struct qelem *next = elem->q_forw;
struct qelem *prev = elem->q_back;
if (next)
if (prev)
prev->q_forw = next;
}
-