Commit c3174d16 authored by Dan Nicolaescu's avatar Dan Nicolaescu

Convert function definitions in lwlib files to standard C.

* lwlib/lwlib-Xaw.c: Convert function definitions to standard C.
* lwlib/lwlib-Xlw.c:
* lwlib/lwlib-utils.c:
* lwlib/lwlib.c:
* lwlib/lwlib.h:
* lwlib/xlwmenu.c: Likewise.
parent 1c027a24
2010-07-04 Dan Nicolaescu <dann@ics.uci.edu>
* lwlib-Xaw.c: Convert function definitions to standard C.
* lwlib-Xlw.c:
* lwlib-utils.c:
* lwlib.c:
* lwlib.h:
* xlwmenu.c: Likewise.
2010-07-02 Jan Djärv <jan.h.d@swipnet.se>
* lwlib-Xm.c: Remove __P and P_ from .c and .m files.
......
......@@ -70,12 +70,11 @@ struct widget_xft_data
#endif
static void xaw_generic_callback (/*Widget, XtPointer, XtPointer*/);
static void xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data);
Boolean
lw_xaw_widget_p (widget)
Widget widget;
lw_xaw_widget_p (Widget widget)
{
return (XtIsSubclass (widget, scrollbarWidgetClass) ||
XtIsSubclass (widget, dialogWidgetClass));
......@@ -427,10 +426,7 @@ xaw_update_one_widget (instance, widget, val, deep_p)
}
void
xaw_update_one_value (instance, widget, val)
widget_instance *instance;
Widget widget;
widget_value *val;
xaw_update_one_value (widget_instance *instance, Widget widget, widget_value *val)
{
/* This function is not used by the scrollbars and those are the only
Athena widget implemented at the moment so do nothing. */
......@@ -438,8 +434,7 @@ xaw_update_one_value (instance, widget, val)
}
void
xaw_destroy_instance (instance)
widget_instance *instance;
xaw_destroy_instance (widget_instance *instance)
{
#ifdef HAVE_XFT
if (instance->xft_data)
......@@ -471,9 +466,7 @@ xaw_destroy_instance (instance)
}
void
xaw_popup_menu (widget, event)
Widget widget;
XEvent *event;
xaw_popup_menu (Widget widget, XEvent *event)
{
/* An Athena menubar has not been implemented. */
return;
......@@ -557,7 +550,7 @@ static char overrideTrans[] =
/* Dialogs pop down on any key press */
static char dialogOverride[] =
"<KeyPress>Escape: lwlib_delete_dialog()";
static void wm_delete_window();
static void wm_delete_window(Widget w, XtPointer closure, XtPointer call_data);
static XtActionsRec xaw_actions [] = {
{"lwlib_delete_dialog", wm_delete_window}
};
......@@ -748,8 +741,7 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
}
Widget
xaw_create_dialog (instance)
widget_instance* instance;
xaw_create_dialog (widget_instance *instance)
{
char *name = instance->info->type;
Widget parent = instance->parent;
......@@ -813,10 +805,7 @@ xaw_create_dialog (instance)
static void
xaw_generic_callback (widget, closure, call_data)
Widget widget;
XtPointer closure;
XtPointer call_data;
xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
{
widget_instance *instance = (widget_instance *) closure;
Widget instance_widget;
......@@ -862,10 +851,7 @@ xaw_generic_callback (widget, closure, call_data)
}
static void
wm_delete_window (w, closure, call_data)
Widget w;
XtPointer closure;
XtPointer call_data;
wm_delete_window (Widget w, XtPointer closure, XtPointer call_data)
{
LWLIB_ID id;
Cardinal nkids;
......@@ -966,8 +952,7 @@ xaw_scrollbar_jump (widget, closure, call_data)
#endif
static Widget
xaw_create_scrollbar (instance)
widget_instance *instance;
xaw_create_scrollbar (widget_instance *instance)
{
#if 0
Arg av[20];
......@@ -1007,8 +992,7 @@ xaw_create_scrollbar (instance)
}
static Widget
xaw_create_main (instance)
widget_instance *instance;
xaw_create_main (widget_instance *instance)
{
Arg al[1];
int ac;
......
......@@ -72,10 +72,7 @@ x_print_complete_resource_name (widget)
if there isn't any highlighted menu item. */
static void
highlight_hook (w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
highlight_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
widget_instance *instance = (widget_instance *) client_data;
......@@ -85,29 +82,20 @@ highlight_hook (w, client_data, call_data)
}
static void
enter_hook (w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
enter_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
highlight_hook (w, client_data, call_data);
}
static void
leave_hook (w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
leave_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
highlight_hook (w, client_data, NULL);
}
static void
pre_hook (w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
widget_instance* instance = (widget_instance*)client_data;
widget_value* val;
......@@ -122,10 +110,7 @@ pre_hook (w, client_data, call_data)
}
static void
pick_hook (w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
pick_hook (Widget w, XtPointer client_data, XtPointer call_data)
{
widget_instance* instance = (widget_instance*)client_data;
widget_value* contents_val = (widget_value*)call_data;
......@@ -150,8 +135,7 @@ pick_hook (w, client_data, call_data)
/* creation functions */
static Widget
xlw_create_menubar (instance)
widget_instance* instance;
xlw_create_menubar (widget_instance *instance)
{
Widget widget;
Arg al[5];
......@@ -178,8 +162,7 @@ xlw_create_menubar (instance)
}
static Widget
xlw_create_popup_menu (instance)
widget_instance* instance;
xlw_create_popup_menu (widget_instance *instance)
{
Widget popup_shell
= XtCreatePopupShell (instance->info->name, overrideShellWidgetClass,
......@@ -214,8 +197,7 @@ xlw_creation_table [] =
};
Boolean
lw_lucid_widget_p (widget)
Widget widget;
lw_lucid_widget_p (Widget widget)
{
WidgetClass the_class = XtClass (widget);
......@@ -249,10 +231,7 @@ xlw_update_one_widget (instance, widget, val, deep_p)
}
void
xlw_update_one_value (instance, widget, val)
widget_instance* instance;
Widget widget;
widget_value* val;
xlw_update_one_value (widget_instance *instance, Widget widget, widget_value *val)
{
return;
}
......@@ -269,9 +248,7 @@ xlw_pop_instance (instance, up)
}
void
xlw_popup_menu (widget, event)
Widget widget;
XEvent *event;
xlw_popup_menu (Widget widget, XEvent *event)
{
XlwMenuWidget mw;
......@@ -304,8 +281,7 @@ xlw_popup_menu (widget, event)
/* Destruction of instances */
void
xlw_destroy_instance (instance)
widget_instance* instance;
xlw_destroy_instance (widget_instance *instance)
{
if (instance->widget)
XtDestroyWidget (instance->widget);
......
......@@ -42,8 +42,7 @@ Boston, MA 02110-1301, USA. */
/* Redisplay the contents of the widget, without first clearing it. */
void
XtNoClearRefreshWidget (widget)
Widget widget;
XtNoClearRefreshWidget (Widget widget)
{
XEvent event;
......@@ -67,10 +66,7 @@ XtNoClearRefreshWidget (widget)
* Apply a function to all the subwidgets of a given widget recursively.
*/
void
XtApplyToWidgets (w, proc, arg)
Widget w;
XtApplyToWidgetsProc proc;
XtPointer arg;
XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
{
if (XtIsComposite (w))
{
......@@ -101,10 +97,7 @@ XtApplyToWidgets (w, proc, arg)
* Stop as soon as the function returns non NULL and returns this as a value.
*/
void *
XtApplyUntilToWidgets (w, proc, arg)
Widget w;
XtApplyUntilToWidgetsProc proc;
XtPointer arg;
XtApplyUntilToWidgets (Widget w, XtApplyUntilToWidgetsProc proc, XtPointer arg)
{
void* result;
if (XtIsComposite (w))
......@@ -130,9 +123,7 @@ XtApplyUntilToWidgets (w, proc, arg)
* Returns a copy of the list of all children of a composite widget
*/
Widget *
XtCompositeChildren (widget, number)
Widget widget;
unsigned int* number;
XtCompositeChildren (Widget widget, unsigned int *number)
{
CompositeWidget cw = (CompositeWidget)widget;
Widget* result;
......@@ -153,15 +144,13 @@ XtCompositeChildren (widget, number)
}
Boolean
XtWidgetBeingDestroyedP (widget)
Widget widget;
XtWidgetBeingDestroyedP (Widget widget)
{
return widget->core.being_destroyed;
}
void
XtSafelyDestroyWidget (widget)
Widget widget;
XtSafelyDestroyWidget (Widget widget)
{
#if 0
......
......@@ -106,10 +106,7 @@ static Boolean get_one_value (widget_instance *, widget_value *);
static void show_one_widget_busy (Widget, Boolean);
void
lwlib_memset (address, value, length)
char *address;
int value;
size_t length;
lwlib_memset (char *address, int value, size_t length)
{
int i;
......@@ -118,10 +115,7 @@ lwlib_memset (address, value, length)
}
void
lwlib_bcopy (from, to, length)
char *from;
char *to;
int length;
lwlib_bcopy (char *from, char *to, int length)
{
int i;
......@@ -130,8 +124,7 @@ lwlib_bcopy (from, to, length)
}
/* utility functions for widget_instance and widget_info */
char *
safe_strdup (s)
const char *s;
safe_strdup (const char *s)
{
char *result;
if (! s) return 0;
......@@ -145,8 +138,7 @@ safe_strdup (s)
/* Like strcmp but ignore differences in case. */
static int
my_strcasecmp (s1, s2)
char *s1, *s2;
my_strcasecmp (char *s1, char *s2)
{
while (1)
{
......@@ -164,8 +156,7 @@ my_strcasecmp (s1, s2)
}
static void
safe_free_str (s)
char *s;
safe_free_str (char *s)
{
free (s);
}
......@@ -174,7 +165,7 @@ static widget_value *widget_value_free_list = 0;
static int malloc_cpt = 0;
widget_value *
malloc_widget_value ()
malloc_widget_value (void)
{
widget_value *wv;
if (widget_value_free_list)
......@@ -196,8 +187,7 @@ malloc_widget_value ()
by malloc_widget_value(), and no substructures.
*/
void
free_widget_value (wv)
widget_value *wv;
free_widget_value (widget_value *wv)
{
if (wv->free_list)
abort ();
......@@ -217,8 +207,7 @@ free_widget_value (wv)
}
static void
free_widget_value_tree (wv)
widget_value *wv;
free_widget_value_tree (widget_value *wv)
{
if (!wv)
return;
......@@ -249,9 +238,7 @@ free_widget_value_tree (wv)
}
static widget_value *
copy_widget_value_tree (val, change)
widget_value* val;
change_type change;
copy_widget_value_tree (widget_value *val, change_type change)
{
widget_value* copy;
......@@ -310,8 +297,7 @@ allocate_widget_info (type, name, id, val, pre_activate_cb,
}
static void
free_widget_info (info)
widget_info* info;
free_widget_info (widget_info *info)
{
safe_free_str (info->type);
safe_free_str (info->name);
......@@ -321,10 +307,7 @@ free_widget_info (info)
}
static void
mark_widget_destroyed (widget, closure, call_data)
Widget widget;
XtPointer closure;
XtPointer call_data;
mark_widget_destroyed (Widget widget, XtPointer closure, XtPointer call_data)
{
widget_instance* instance = (widget_instance*)closure;
......@@ -363,8 +346,7 @@ allocate_widget_instance (info, parent, pop_up_p)
}
static void
free_widget_instance (instance)
widget_instance* instance;
free_widget_instance (widget_instance *instance)
{
lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
free (instance);
......@@ -401,8 +383,7 @@ get_widget_info (id, remove_p)
/* Internal function used by the library dependent implementation to get the
widget_value for a given widget in an instance */
widget_info *
lw_get_widget_info (id)
LWLIB_ID id;
lw_get_widget_info (LWLIB_ID id)
{
return get_widget_info (id, 0);
}
......@@ -441,8 +422,7 @@ get_widget_instance (widget, remove_p)
WIDGET, or null if WIDGET is not a lwlib widget. */
widget_instance *
lw_get_widget_instance (widget)
Widget widget;
lw_get_widget_instance (Widget widget)
{
return get_widget_instance (widget, False);
}
......@@ -471,9 +451,7 @@ find_instance (id, parent, pop_up_p)
/* utility function for widget_value */
static Boolean
safe_strcmp (s1, s2)
char* s1;
char* s2;
safe_strcmp (char *s1, char *s2)
{
if (!!s1 ^ !!s2) return True;
return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2;
......@@ -500,11 +478,7 @@ safe_strcmp (s1, s2)
static widget_value *
merge_widget_value (val1, val2, level, change_p)
widget_value* val1;
widget_value* val2;
int level;
int *change_p;
merge_widget_value (widget_value *val1, widget_value *val2, int level, int *change_p)
{
change_type change, this_one_change;
widget_value* merged_next;
......@@ -658,9 +632,7 @@ merge_widget_value (val1, val2, level, change_p)
/* modifying the widgets */
static Widget
name_to_widget (instance, name)
widget_instance* instance;
char* name;
name_to_widget (widget_instance *instance, char *name)
{
Widget widget = NULL;
......@@ -814,8 +786,7 @@ lw_modify_all_widgets (id, val, deep_p)
/* creating the widgets */
static void
initialize_widget_instance (instance)
widget_instance* instance;
initialize_widget_instance (widget_instance *instance)
{
widget_value* val;
......@@ -830,9 +801,7 @@ initialize_widget_instance (instance)
static widget_creation_function
find_in_table (type, table)
char* type;
widget_creation_entry* table;
find_in_table (char *type, widget_creation_entry *table)
{
widget_creation_entry* cur;
for (cur = table; cur->type; cur++)
......@@ -842,8 +811,7 @@ find_in_table (type, table)
}
static Boolean
dialog_spec_p (name)
char* name;
dialog_spec_p (char *name)
{
/* return True if name matches [EILPQeilpq][1-9][Bb] or
[EILPQeilpq][1-9][Bb][Rr][1-9] */
......@@ -876,8 +844,7 @@ dialog_spec_p (name)
}
static void
instantiate_widget_instance (instance)
widget_instance* instance;
instantiate_widget_instance (widget_instance *instance)
{
widget_creation_function function = NULL;
......@@ -1016,8 +983,7 @@ lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb,
/* destroying the widgets */
static void
destroy_one_instance (instance)
widget_instance* instance;
destroy_one_instance (widget_instance *instance)
{
/* Remove the destroy callback on the widget; that callback will try to
dereference the instance object (to set its widget slot to 0, since the
......@@ -1059,8 +1025,7 @@ destroy_one_instance (instance)
}
void
lw_destroy_widget (w)
Widget w;
lw_destroy_widget (Widget w)
{
widget_instance* instance = get_widget_instance (w, True);
......@@ -1076,8 +1041,7 @@ lw_destroy_widget (w)
}
void
lw_destroy_all_widgets (id)
LWLIB_ID id;
lw_destroy_all_widgets (LWLIB_ID id)
{
widget_info* info = get_widget_info (id, True);
widget_instance* instance;
......@@ -1096,14 +1060,14 @@ lw_destroy_all_widgets (id)
}
void
lw_destroy_everything ()
lw_destroy_everything (void)
{
while (all_widget_info)
lw_destroy_all_widgets (all_widget_info->id);
}
void
lw_destroy_all_pop_ups ()
lw_destroy_all_pop_ups (void)
{
widget_info* info;
widget_info* next;
......@@ -1123,7 +1087,7 @@ extern Widget first_child (/* Widget */); /* garbage */
#endif
Widget
lw_raise_all_pop_up_widgets ()
lw_raise_all_pop_up_widgets (void)
{
widget_info* info;
widget_instance* instance;
......@@ -1197,23 +1161,19 @@ lw_pop_all_widgets (id, up)
}
void
lw_pop_up_all_widgets (id)
LWLIB_ID id;
lw_pop_up_all_widgets (LWLIB_ID id)
{
lw_pop_all_widgets (id, True);
}
void
lw_pop_down_all_widgets (id)
LWLIB_ID id;
lw_pop_down_all_widgets (LWLIB_ID id)
{
lw_pop_all_widgets (id, False);
}
void
lw_popup_menu (widget, event)
Widget widget;
XEvent *event;
lw_popup_menu (Widget widget, XEvent *event)
{
#if defined (USE_LUCID)
if (lw_lucid_widget_p (widget))
......@@ -1231,9 +1191,7 @@ lw_popup_menu (widget, event)
/* get the values back */
static Boolean
get_one_value (instance, val)
widget_instance* instance;
widget_value* val;
get_one_value (widget_instance *instance, widget_value *val)
{
Widget widget = name_to_widget (instance, val->name);
......@@ -1258,9 +1216,7 @@ get_one_value (instance, val)
}
Boolean
lw_get_some_values (id, val_out)
LWLIB_ID id;
widget_value* val_out;
lw_get_some_values (LWLIB_ID id, widget_value *val_out)
{
widget_info* info = get_widget_info (id, False);
widget_instance* instance;
......@@ -1282,8 +1238,7 @@ lw_get_some_values (id, val_out)
}
widget_value*
lw_get_all_values (id)
LWLIB_ID id;
lw_get_all_values (LWLIB_ID id)
{
widget_info* info = get_widget_info (id, False);
widget_value* val = info->val;
......@@ -1296,9 +1251,7 @@ lw_get_all_values (id)
/* internal function used by the library dependent implementation to get the
widget_value for a given widget in an instance */
widget_value*
lw_get_widget_value_for_widget (instance, w)
widget_instance* instance;
Widget w;
lw_get_widget_value_for_widget (widget_instance *instance, Widget w)
{
char* name = XtName (w);
widget_value* cur;
......@@ -1317,10 +1270,7 @@ static Boolean lwlib_updating;
modified to update other instances of the widgets. Closure should be the
widget_instance. */
void
lw_internal_update_other_instances (widget, closure, call_data)
Widget widget;
XtPointer closure;
XtPointer call_data;
lw_internal_update_other_instances (Widget widget, XtPointer closure, XtPointer call_data)
{
widget_instance* instance = (widget_instance*)closure;
char* name = XtName (widget);
......@@ -1357,8 +1307,7 @@ lw_internal_update_other_instances (widget, closure, call_data)
/* get the id */
LWLIB_ID
lw_get_widget_id (w)
Widget w;
lw_get_widget_id (Widget w)
{
widget_instance* instance = get_widget_instance (w, False);
......@@ -1367,9 +1316,7 @@ lw_get_widget_id (w)
/* set the keyboard focus */
void
lw_set_keyboard_focus (parent, w)
Widget parent;
Widget w;