From f4339cd58e621fda320f7b3aa6a94bc0fc36fd67 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Fri, 16 Nov 2012 17:03:10 +0000 Subject: [PATCH] dtcalc: Convert functions from K&R to ansi declarations. --- cde/programs/dtcalc/calctool.c | 148 +++++++------------ cde/programs/dtcalc/calctool.h | 6 +- cde/programs/dtcalc/ds_common.c | 6 +- cde/programs/dtcalc/ds_widget.c | 9 +- cde/programs/dtcalc/ds_xlib.c | 25 +--- cde/programs/dtcalc/help.c | 39 ++--- cde/programs/dtcalc/motif.c | 253 +++++++++++--------------------- cde/programs/dtcalc/mp.c | 195 ++++++++---------------- 8 files changed, 225 insertions(+), 456 deletions(-) diff --git a/cde/programs/dtcalc/calctool.c b/cde/programs/dtcalc/calctool.c index edcfb069..43b397bd 100644 --- a/cde/programs/dtcalc/calctool.c +++ b/cde/programs/dtcalc/calctool.c @@ -312,8 +312,7 @@ struct button mode_buttons[MAXMODES * MODEKEYS] = { int -char_val(chr) -char chr ; +char_val(char chr) { if (chr >= '0' && chr <= '9') return(chr - '0') ; else if (chr >= 'a' && chr <= 'f') return(chr - 'a' + 10) ; @@ -323,7 +322,7 @@ char chr ; void -clear_display() +clear_display(void) { int i ; @@ -344,10 +343,10 @@ clear_display() set_item(INVITEM, " ") ; } - +/* Convert .dtcalcrc line to ascii values. */ +/* line Input line to be converted. */ char * -convert(line) /* Convert .dtcalcrc line to ascii values. */ -char *line ; /* Input line to be converted. */ +convert(char *line) { static char output[MAXLINE] ; /* Converted output record. */ int ctrl = 0 ; /* Set if we are processing a control character. */ @@ -373,9 +372,7 @@ char *line ; /* Input line to be converted. */ void -do_dtcalc(argc, argv) -int argc ; -char **argv ; +do_dtcalc(int argc, char **argv) { char *ptr ; @@ -432,8 +429,7 @@ char **argv ; /* Dtcalc's customised math library error-handling routine. */ void -doerr(errmes) -char *errmes ; +doerr(char *errmes) { if (!v->started) return ; STRCPY(v->display, errmes) ; @@ -443,11 +439,9 @@ char *errmes ; set_item(OPITEM, vstrs[(int) V_CLR]) ; } - +/* Get boolean resource from database. */ int -get_bool_resource(rtype, boolval) /* Get boolean resource from database. */ -enum res_type rtype ; -int *boolval ; +get_bool_resource(enum res_type rtype, int *boolval) { char *val, tempstr[MAXLINE] ; int len, n ; @@ -472,8 +466,7 @@ int *boolval ; */ int -get_index(ch) -char ch ; +get_index(char ch) { int n ; @@ -492,11 +485,9 @@ char ch ; return(n) ; } - + /* Get integer resource from database. */ int -get_int_resource(rtype, intval) /* Get integer resource from database. */ -enum res_type rtype ; -int *intval ; +get_int_resource(enum res_type rtype, int *intval) { char *val ; @@ -509,16 +500,14 @@ int *intval ; /* Get keyboard equivalent from first character of localised string. */ void -get_key_val(val, str) -char *val, *str ; +get_key_val(char *val, char *str) { *val = str[0] ; } void -get_label(n) -int n ; +get_label(int n) { int val ; char *temp; @@ -535,11 +524,9 @@ int n ; STRCPY(v->pstr, ""); } - +/* Extract command line options. */ void -get_options(argc, argv) /* Extract command line options. */ -int argc ; -char *argv[] ; +get_options(int argc, char *argv[]) { char next[MAXLINE] ; /* The next command line parameter. */ char strval[MAXLINE] ; @@ -720,8 +707,7 @@ char *argv[] ; void -getparam(s, argv, errmes) -char *s, *argv[], *errmes ; +getparam(char *s, char *argv[], char *errmes) { char *msg; @@ -738,9 +724,9 @@ char *s, *argv[], *errmes ; } +/* Read .dtcalcrc file. */ void -get_rcfile(name) /* Read .dtcalcrc file. */ -char *name ; +get_rcfile(char *name) { char line[MAXLINE] ; /* Current line from the .dtcalcrc file. */ char tmp[MAXLINE] ; /* Used to extract definitions. */ @@ -844,11 +830,9 @@ char *name ; FCLOSE(rcfd) ; } - +/* Get a string resource from database. */ int -get_str_resource(rtype, strval) /* Get a string resource from database. */ -enum res_type rtype ; -char *strval ; +get_str_resource(enum res_type rtype, char *strval) { char *val ; int i, len ; @@ -864,10 +848,9 @@ char *strval ; return(1) ; } - +/* Grey out numeric buttons depending upon base. */ void -grey_buttons(base) /* Grey out numeric buttons depending upon base. */ -enum base_type base ; +grey_buttons(enum base_type base) { char val ; int column, dim, i, n, row ; @@ -887,10 +870,9 @@ enum base_type base ; } } - +/* Process right button menu selection. */ void -handle_menu_selection(n, item) /* Process right button menu selection. */ -int n, item ; +handle_menu_selection(int n, int item) { if (item != -1) { @@ -912,9 +894,9 @@ int n, item ; } } - +/* Setup default values for various variables. */ void -init_vars() /* Setup default values for various variables. */ +init_vars(void) { int acc, i, n, size ; @@ -970,7 +952,7 @@ init_vars() /* Setup default values for various variables. */ void -initialise() +initialise(void) { int i ; @@ -983,9 +965,9 @@ initialise() } +/* Convert engineering or scientific number. */ char * -make_eng_sci(MPnumber) /* Convert engineering or scientific number. */ -int *MPnumber ; +make_eng_sci(int *MPnumber) { char fixed[MAX_DIGITS+1], *optr ; int MP1[MP_SIZE], MPatmp[MP_SIZE], MPval[MP_SIZE] ; @@ -1083,11 +1065,10 @@ int *MPnumber ; return(v->snum) ; } - +/* Convert MP number to fixed number string. */ +/* cmax Maximum characters to generate. */ char * -make_fixed(MPnumber, cmax) /* Convert MP number to fixed number string. */ -int *MPnumber ; -int cmax ; /* Maximum characters to generate. */ +make_fixed(int *MPnumber, int cmax) { char *optr ; int MP1base[MP_SIZE], MP1[MP_SIZE], MP2[MP_SIZE], MPval[MP_SIZE] ; @@ -1139,7 +1120,7 @@ int cmax ; /* Maximum characters to generate. */ void -make_items() +make_items(void) { set_item(DISPLAYITEM, v->display) ; set_item(OPITEM, " ") ; @@ -1147,11 +1128,9 @@ make_items() set_item(INVITEM, " ") ; } - +/* Convert MP number to character string. */ char * -make_number(MPnumber, mkFix) /* Convert MP number to character string. */ -int *MPnumber ; -BOOLEAN mkFix ; +make_number(int *MPnumber, BOOLEAN mkFix) { double number, val ; @@ -1248,9 +1227,9 @@ BOOLEAN mkFix ; /*ARGSUSED*/ +/* Default math library exception handling routine. */ int -matherr(exc) /* Default math library exception handling routine. */ -struct exception *exc ; +matherr(struct exception *exc) { #if 0 char msg[100]; @@ -1281,12 +1260,9 @@ struct exception *exc ; return(1) ; /* Value ignored. */ } - +/* Convert string into an MP number. */ void -MPstr_to_num(str, base, MPval) /* Convert string into an MP number. */ -char *str ; -enum base_type base ; -int *MPval ; +MPstr_to_num(char *str, enum base_type base, int *MPval) { char *optr ; int MP1[MP_SIZE], MP2[MP_SIZE], MPbase[MP_SIZE] ; @@ -1346,10 +1322,9 @@ int *MPval ; } } - +/* Append the latest parenthesis char to the display item. */ void -paren_disp(c) /* Append the latest parenthesis char to the display item. */ -char c ; +paren_disp(char c) { int i, n ; @@ -1423,10 +1398,9 @@ char c ; v->show_paren = 0 ; } - +/* Process this event. */ void -process_event(type) /* Process this event. */ -int type ; +process_event(int type) { int ival ; @@ -1479,8 +1453,7 @@ int type ; void -process_item(n) -int n ; +process_item(int n) { int i,isvalid ; @@ -1538,13 +1511,14 @@ int n ; } -/* Process a portion of the parentheses stack. */ +/* Process a portion of the parentheses stack. + startop Initial position in the operand stack. + startnum Initial position in the numeric stack. + n Number of items to process. +*/ void -process_stack(startop, startnum, n) -int startop ; /* Initial position in the operand stack. */ -int startnum ; /* Initial position in the numeric stack. */ -int n ; /* Number of items to process. */ +process_stack(int startop, int startnum, int n) { char sdisp[MAXLINE] ; /* Used to save display contents. */ int i ; @@ -1586,9 +1560,7 @@ int n ; /* Number of items to process. */ void -process_str(str, mtype) -char *str ; -enum menu_type mtype ; +process_str(char *str, enum menu_type mtype) { int i, len ; char save[80]; @@ -1639,7 +1611,7 @@ enum menu_type mtype ; void -read_rcfiles() /* Read .dtcalcrc's from home and current directories. */ +read_rcfiles(void) /* Read .dtcalcrc's from home and current directories. */ { char *home ; /* Pathname for users home directory. */ char name[MAXPATHLEN + 50] ; /* Full name of users .dtcalcrc file. */ @@ -1671,8 +1643,7 @@ read_rcfiles() /* Read .dtcalcrc's from home and current directories. */ void -show_display(MPval) -int *MPval ; +show_display(int *MPval) { if (!v->error) { @@ -1683,8 +1654,7 @@ int *MPval ; void -usage(progname) -char *progname ; +usage(char *progname) { FPRINTF(stderr, ustrs[(int) USAGE1], PATCHLEVEL) ; FPRINTF(stderr, "%s", ustrs[(int) USAGE2]) ; @@ -1693,10 +1663,7 @@ char *progname ; } void -write_rcfile(mtype, exists, cfno, val, comment) -enum menu_type mtype ; -int exists, cfno ; -char *val, *comment ; +write_rcfile(enum menu_type mtype, int exists, int cfno, char *val, char *comment) { char *home ; /* Pathname for users home directory. */ char pathname[MAXPATHLEN] ; /* Current working directory. */ @@ -1771,8 +1738,7 @@ char *val, *comment ; void -write_resources(filename) -char *filename; +write_resources(char *filename) { char intval[5] ; int MPtemp[MP_SIZE]; diff --git a/cde/programs/dtcalc/calctool.h b/cde/programs/dtcalc/calctool.h index db932824..94bf5efb 100644 --- a/cde/programs/dtcalc/calctool.h +++ b/cde/programs/dtcalc/calctool.h @@ -604,9 +604,9 @@ double mppow_di P((double *, int *)) ; double mppow_ri P((float *, int *)) ; double setbool P((BOOLEAN)) ; -int char_val P((int)) ; +int char_val P((char)) ; int get_bool_resource P((enum res_type, int *)) ; -int get_index P((int)) ; +int get_index P((char)) ; int get_int_resource P((enum res_type, int *)) ; int get_str_resource P((enum res_type, char *)) ; int main P((int, char **)) ; @@ -671,7 +671,7 @@ void make_modewin P(()) ; void make_fin_registers P(()) ; void make_registers P((int)) ; void MPstr_to_num P((char *, enum base_type, int *)) ; -void paren_disp P((int)) ; +void paren_disp P((char)) ; void process_event P((int)) ; void process_item P((int)) ; void process_parens P((int)) ; diff --git a/cde/programs/dtcalc/ds_common.c b/cde/programs/dtcalc/ds_common.c index 9b1ec684..8e62b9f3 100644 --- a/cde/programs/dtcalc/ds_common.c +++ b/cde/programs/dtcalc/ds_common.c @@ -41,8 +41,7 @@ void -read_str(str, value) -char **str, *value ; +read_str(char **str, char *value) { if (*str != NULL) FREE(*str) ; if (value != NULL && strlen(value)) @@ -55,8 +54,7 @@ char **str, *value ; char * -set_bool(value) -int value ; +set_bool(int value) { return((value) ? "true" : "false") ; } diff --git a/cde/programs/dtcalc/ds_widget.c b/cde/programs/dtcalc/ds_widget.c index f77a8d99..f6262945 100644 --- a/cde/programs/dtcalc/ds_widget.c +++ b/cde/programs/dtcalc/ds_widget.c @@ -45,9 +45,7 @@ #endif /*LINT_CAST*/ struct tW_struct * -make_textW(owner, label) -Widget owner ; -char *label ; +make_textW(Widget owner, char *label) { struct tW_struct *w ; @@ -73,10 +71,7 @@ char *label ; } void -set_text_str(w, ttype, str) -struct tW_struct *w ; -enum text_type ttype ; -char *str ; +set_text_str(struct tW_struct *w, enum text_type ttype, char *str) { XmString cstr ; diff --git a/cde/programs/dtcalc/ds_xlib.c b/cde/programs/dtcalc/ds_xlib.c index 86b8af6f..4e7b874e 100644 --- a/cde/programs/dtcalc/ds_xlib.c +++ b/cde/programs/dtcalc/ds_xlib.c @@ -63,8 +63,7 @@ */ void -ds_beep(display) -Display *display ; +ds_beep(Display *display) { XBell(display, 0) ; } @@ -88,10 +87,7 @@ Display *display ; */ char * -ds_get_resource(rDB, appname, resource) -XrmDatabase rDB ; /* Resources database. */ -char *appname ; /* Application name. */ -char *resource ; /* X resource to search for. */ +ds_get_resource(XrmDatabase rDB, char *appname, char *resource) { char app[MAXLINE], res[MAXLINE] ; char cstr[MAXLINE], nstr[MAXLINE] ; @@ -140,8 +136,7 @@ char *resource ; /* X resource to search for. */ */ XrmDatabase -ds_load_resources(display) -Display *display ; +ds_load_resources(Display *display) { XrmDatabase db, rDB ; char *home, name[MAXPATHLEN], *ptr ; @@ -211,9 +206,7 @@ Display *display ; */ void -ds_put_resource(rDB, appname, rstr, rval) -XrmDatabase *rDB ; -char *appname, *rstr, *rval ; +ds_put_resource(XrmDatabase *rDB, char *appname, char *rstr, char *rval) { char app[MAXLINE], resource[MAXLINE] ; @@ -242,11 +235,7 @@ char *appname, *rstr, *rval ; */ void -ds_save_cmdline(display, w, argc, argv) -Display *display ; -Window w ; -int argc ; -char **argv ; +ds_save_cmdline(Display *display, Window w, int argc, char **argv) { XSetCommand(display, w, argv, argc) ; } @@ -266,9 +255,7 @@ char **argv ; int -ds_save_resources(rDB, filename) -XrmDatabase rDB ; -char *filename; +ds_save_resources(XrmDatabase rDB, char *filename) { char *home; struct stat statbuf ; diff --git a/cde/programs/dtcalc/help.c b/cde/programs/dtcalc/help.c index 7c626647..045f6001 100644 --- a/cde/programs/dtcalc/help.c +++ b/cde/programs/dtcalc/help.c @@ -67,9 +67,7 @@ static Widget GetHelpDialog P(()) ; static void UnmanageCB P(()) ; void -Help(helpVolume, locationId) - char *helpVolume; - char *locationId; +Help(char *helpVolume, char *locationId) { Arg args[10]; Position newX, newY; @@ -119,10 +117,7 @@ Help(helpVolume, locationId) } void -HelpCloseCB(widget, client_data, call_data) -Widget widget; -caddr_t client_data, call_data; - +HelpCloseCB(Widget widget, caddr_t client_data, caddr_t call_data) { HelpStruct *pHelpCache = (HelpStruct *)client_data; @@ -139,9 +134,7 @@ caddr_t client_data, call_data; } void -HelpHyperlinkCB(widget, client_data, call_data) -Widget widget; -caddr_t client_data, call_data; +HelpHyperlinkCB(Widget widget, caddr_t client_data, caddr_t call_data) { DtHelpDialogCallbackStruct *pHyper = (DtHelpDialogCallbackStruct *) call_data; @@ -157,9 +150,7 @@ caddr_t client_data, call_data; void -HelpRequestCB(widget, client_data, call_data) -Widget widget; -caddr_t client_data, call_data; +HelpRequestCB(Widget widget, caddr_t client_data, caddr_t call_data) { char *helpVolume, *locationId; int topic; @@ -382,9 +373,7 @@ caddr_t client_data, call_data; } void -HelpModeCB(w, client_data, call_data) -Widget w; -caddr_t client_data, call_data; +HelpModeCB(Widget w, caddr_t client_data, caddr_t call_data) { Widget widget; char *errorMsg, *tmp; @@ -414,9 +403,7 @@ caddr_t client_data, call_data; } void -DisplayHelp( helpVolume, locationId) -char *helpVolume; -char *locationId; +DisplayHelp(char *helpVolume, char *locationId) { Arg args[10]; int n; @@ -436,7 +423,7 @@ char *locationId; static Widget -GetHelpDialog() +GetHelpDialog(void) { static HelpStruct *pHelpCache; @@ -493,9 +480,7 @@ GetHelpDialog() } void -ErrDialog( errString, visualParent ) -char *errString ; -Widget visualParent ; +ErrDialog(char *errString, Widget visualParent) { int n; Arg args[10]; @@ -542,17 +527,13 @@ Widget visualParent ; } static void -UnmanageCB(widget, client_data, call_data) -Widget widget; -XtPointer client_data, call_data; +UnmanageCB(Widget widget, XtPointer client_data, XtPointer call_data) { XtUnmanageChild(widget); } void -CenterMsgCB (widget, client_data, call_data) -Widget widget; -XtPointer client_data, call_data; +CenterMsgCB (Widget widget, XtPointer client_data, XtPointer call_data) { int n; Position newX, newY; diff --git a/cde/programs/dtcalc/motif.c b/cde/programs/dtcalc/motif.c index 345a7360..b3e01460 100644 --- a/cde/programs/dtcalc/motif.c +++ b/cde/programs/dtcalc/motif.c @@ -244,6 +244,10 @@ static void setCalcHints P(()) ; static char * _DtcalcStripSpaces P(( char * )) ; static void ProcessMotifSelection(Widget); +static void create_menu_bar(Widget parent); +static void init_colors(void); +static void create_popup(Widget parent); + extern char **environ ; @@ -274,9 +278,7 @@ extern XtPointer _XmStringUngenerate ( XmTextType output_type); int -main(argc, argv) -int argc ; -char **argv ; +main(int argc, char **argv) { Pixmap pixmap; @@ -389,16 +391,14 @@ char **argv ; } void -beep() +beep(void) { ds_beep(X->dpy) ; } static Widget -button_create(owner, row, column, maxrows, maxcols) -Widget owner ; -int row, column, maxrows, maxcols ; +button_create(Widget owner, int row, int column, int maxrows, int maxcols) { int n = row * maxcols + column ; int val ; @@ -493,9 +493,7 @@ int row, column, maxrows, maxcols ; static void -dtcalc_initialize_rframe(owner, type) -Widget owner ; -int type ; +dtcalc_initialize_rframe(Widget owner, int type) { char str[MAXLINE] ; int i ; @@ -708,8 +706,7 @@ int type ; static void -dtcalc_kkeyboard_create(owner) -Widget owner ; +dtcalc_kkeyboard_create(Widget owner) { int column, row ; Widget buttonFrame; @@ -747,8 +744,7 @@ Widget owner ; static void -dtcalc_kpanel_create(owner) -Widget owner ; +dtcalc_kpanel_create(Widget owner) { static char *mnames[] = { "base", "ttype", "num", "hyp", "inv", "op", "mode" } ; @@ -1181,16 +1177,14 @@ Widget owner ; /*ARGSUSED*/ static void -confirm_callback(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +confirm_callback(Widget widget, XtPointer client_data, XtPointer call_data) { update_cf_value(); } static void -create_cfframe() /* Create auxiliary frame for CON/FUN key. */ +create_cfframe(void) /* Create auxiliary frame for CON/FUN key. */ { int j; XmString tstr ; @@ -1341,11 +1335,9 @@ create_cfframe() /* Create auxiliary frame for CON/FUN key. */ } +/* Create popup menu for dtcalc button. */ static void -create_menu(mtype, button, n) /* Create popup menu for dtcalc button. */ -enum menu_type mtype ; -Widget button ; -int n ; +create_menu(enum menu_type mtype, Widget button, int n) { char *mstr, *tmpStr, *ptr ; int i, invalid, val ; @@ -1412,9 +1404,7 @@ int n ; /*ARGSUSED*/ static void -do_button(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +do_button(Widget widget, XtPointer client_data, XtPointer call_data) { char *str; XmString cstr ; @@ -1449,9 +1439,7 @@ XtPointer client_data, call_data ; /*ARGSUSED*/ static void -do_continue_notice(parent, str) -Widget parent ; -char *str ; +do_continue_notice(Widget parent, char *str) { XmString contstr, message, cstr ; char *tmpStr; @@ -1484,9 +1472,7 @@ char *str ; /*ARGSUSED*/ static void -do_confirm_notice(parent, str) -Widget parent ; -char *str ; +do_confirm_notice(Widget parent, char *str) { XmString confirm, cancel, message, cstr ; char *tmpStr; @@ -1523,9 +1509,7 @@ char *str ; /*ARGSUSED*/ static void -close_reg(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +close_reg(Widget widget, XtPointer client_data, XtPointer call_data) { int type = (int)client_data; @@ -1581,10 +1565,7 @@ XtPointer client_data, call_data ; * */ void -draw_button(n, fcptype, row, column, inverted) -int n; -enum fcp_type fcptype ; -int row, column, inverted ; +draw_button(int n, enum fcp_type fcptype, int row, int column, int inverted) { char str[10] ; Widget widget ; @@ -1628,8 +1609,7 @@ int row, column, inverted ; static int -event_is_keypad(xevent) -XEvent *xevent ; +event_is_keypad(XEvent *xevent) { if (xevent->type != KeyPress && xevent->type != KeyRelease) return(0) ; return(X->kparray[xevent->xkey.keycode - X->kcmin] > 0) ; @@ -1645,11 +1625,7 @@ XEvent *xevent ; */ /*ARGSUSED*/ static void -event_proc(widget, client_data, event, continue_to_dispatch) -Widget widget ; -XtPointer client_data ; -XEvent *event ; -Boolean *continue_to_dispatch ; +event_proc(Widget widget, XtPointer client_data, XEvent *event, Boolean *continue_to_dispatch) { Widget w; Arg args[3]; @@ -1875,11 +1851,7 @@ ProcessMotifSelection(Widget W) /*ARGSUSED*/ static void -frame_interpose(widget, clientData, event, continue_to_dispatch) -Widget widget ; -XtPointer clientData ; -XEvent *event ; -Boolean *continue_to_dispatch ; +frame_interpose(Widget widget, XtPointer clientData, XEvent *event, Boolean *continue_to_dispatch) { if (!v->started) return ; if (event->type == MapNotify) @@ -1894,10 +1866,7 @@ Boolean *continue_to_dispatch ; /*ARGSUSED*/ static int -get_next_event(widget, ev_action, xevent) -Widget widget ; -int ev_action ; -XEvent *xevent ; +get_next_event(Widget widget, int ev_action, XEvent *xevent) { char *tmpStr, chs[2] ; int cval, down, nextc, up ; @@ -2102,9 +2071,9 @@ XEvent *xevent ; } +/* Get dtcalc resource from merged database. */ char * -get_resource(rtype) /* Get dtcalc resource from merged database. */ -enum res_type rtype ; +get_resource(enum res_type rtype) { char str[MAXLINE] ; @@ -2114,15 +2083,14 @@ enum res_type rtype ; void -grey_button(row, column, state) -int row, column, state ; +grey_button(int row, int column, int state) { XtSetSensitive(X->kbuttons[row][column], !state) ; } void -init_graphics() +init_graphics(void) { char *tmpStr, *tmpStr1; @@ -2151,15 +2119,14 @@ init_graphics() static int -is_window_showing(widget) -Widget widget ; +is_window_showing(Widget widget) { return(XtIsManaged(widget)) ; } void -key_init() +key_init(void) { int i, j ; KeySym *tmp ; @@ -2193,8 +2160,7 @@ key_init() static KeySym -keypad_keysym(xevent) -XEvent *xevent ; +keypad_keysym(XEvent *xevent) { int i ; int keycode = xevent->xkey.keycode ; @@ -2215,14 +2181,14 @@ XEvent *xevent ; } void -load_resources() +load_resources(void) { X->rDB = ds_load_resources(X->dpy) ; } void -make_frames() +make_frames(void) { char *tool_label = NULL ; int depth ; @@ -2252,14 +2218,14 @@ make_frames() } void -make_modewin() /* Draw special mode frame plus buttons. */ +make_modewin(void) /* Draw special mode frame plus buttons. */ { switch_mode(v->modetype) ; } +/* Calculate memory register frame values. */ void -make_registers(type) /* Calculate memory register frame values. */ -int type; +make_registers(int type) { char line[MAXLINE] ; /* Current memory register line. */ char *ptr, *tmp, *tmpStr; @@ -2356,11 +2322,7 @@ int type; /*ARGSUSED*/ static void -menu_handler(widget, client_data, event, continue_to_dispatch) -Widget widget ; -XtPointer client_data ; -XEvent *event ; -Boolean *continue_to_dispatch ; +menu_handler(Widget widget, XtPointer client_data, XEvent *event, Boolean *continue_to_dispatch) { int button ; Widget menu ; @@ -2378,9 +2340,7 @@ Boolean *continue_to_dispatch ; /*ARGSUSED*/ void -menu_proc(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +menu_proc(Widget widget, XtPointer client_data, XtPointer call_data) { int choice = ((int) client_data) & 0xFFFF ; @@ -2391,9 +2351,7 @@ XtPointer client_data, call_data ; /*ARGSUSED*/ static void -new_cf_value(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +new_cf_value(Widget widget, XtPointer client_data, XtPointer call_data) { /* for hard testing when there is no Input Method available @@ -2459,17 +2417,16 @@ XtPointer client_data, call_data ; } +/* Put calc resource into database. */ void -put_resource(rtype, value) /* Put calc resource into database. */ -enum res_type rtype ; -char *value ; +put_resource(enum res_type rtype, char *value) { ds_put_resource(&(X->dtcalcDB), v->appname, calc_res[(int) rtype], value) ; } void -redraw_buttons() +redraw_buttons(void) { enum fcp_type scurwin ; int column, n, row ; @@ -2491,17 +2448,14 @@ redraw_buttons() void -save_cmdline(argc, argv) -int argc ; -char *argv[] ; +save_cmdline(int argc, char *argv[]) { ds_save_cmdline(X->dpy, XtWindow(X->kframe), argc, argv) ; } void -save_resources(filename) -char *filename; +save_resources(char *filename) { int reply = ds_save_resources(X->dtcalcDB, filename) ; @@ -2509,16 +2463,13 @@ char *filename; } void -ErrorDialog(string) -char *string; +ErrorDialog(char *string) { ErrDialog(string, X->mainWin); } void -set_item(itemno, str) -enum item_type itemno ; -char *str ; +set_item(enum item_type itemno, char *str) { Widget w ; XmString cstr ; @@ -2559,10 +2510,9 @@ char *str ; } } +/* Set new title for a window. */ void -set_title(fcptype, str) /* Set new title for a window. */ -enum fcp_type fcptype ; -char *str ; +set_title(enum fcp_type fcptype, char *str) { Widget w ; XmString cstr ; @@ -2590,9 +2540,7 @@ char *str ; /*ARGSUSED*/ void -show_ascii(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +show_ascii(Widget widget, XtPointer client_data, XtPointer call_data) { char *str ; int val ; @@ -2606,7 +2554,7 @@ XtPointer client_data, call_data ; void -show_ascii_frame() /* Display ASCII popup. */ +show_ascii_frame(void) /* Display ASCII popup. */ { int j; XmString tstr ; @@ -2726,7 +2674,7 @@ show_ascii_frame() /* Display ASCII popup. */ void -start_tool() +start_tool(void) { saveatom = XmInternAtom(X->dpy, "WM_SAVE_YOURSELF", FALSE) ; command_atom = XA_WM_COMMAND; @@ -2747,8 +2695,7 @@ start_tool() } void -clear_buttons( start ) -int start; +clear_buttons(int start) { int i, n; int row, column; @@ -2824,7 +2771,7 @@ int start; } void -make_buttons_fin() +make_buttons_fin(void) { int i, n; int row, column; @@ -2877,7 +2824,7 @@ make_buttons_fin() } void -make_buttons_log() +make_buttons_log(void) { int i, n; int row, column; @@ -2930,7 +2877,7 @@ make_buttons_log() } void -make_buttons_sci() +make_buttons_sci(void) { int i, n; int row, column; @@ -2984,8 +2931,7 @@ make_buttons_sci() static void -switch_mode(curmode) -enum mode_type curmode ; +switch_mode(enum mode_type curmode) { Arg args[2]; @@ -3019,7 +2965,7 @@ enum mode_type curmode ; static void -update_cf_value() +update_cf_value(void) { char message[MAXLINE] ; char str[MAXLINE] ; /* Temporary buffer for various strings. */ @@ -3206,9 +3152,7 @@ update_cf_value() void -win_display(fcptype, state) -enum fcp_type fcptype ; -int state ; +win_display(enum fcp_type fcptype, int state) { Widget widget ; Position newX, newY; @@ -3250,9 +3194,7 @@ int state ; /*ARGSUSED*/ void -write_cf_value(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +write_cf_value(Widget widget, XtPointer client_data, XtPointer call_data) { char message[MAXLINE] ; char str[MAXLINE] ; /* Temporary buffer for various strings. */ @@ -3324,9 +3266,7 @@ XtPointer client_data, call_data ; static void -xerror_interpose(display, error) -Display *display ; -XErrorEvent *error ; +xerror_interpose(Display *display, XErrorEvent *error) { char msg1[80]; char msg[1024]; @@ -3338,9 +3278,7 @@ XErrorEvent *error ; } static void -modelineValueChanged(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +modelineValueChanged(Widget widget, XtPointer client_data, XtPointer call_data) { Arg args[1]; int val, choice; @@ -3361,8 +3299,8 @@ XtPointer client_data, call_data ; handle_menu_selection(59, choice) ; } -create_menu_bar(parent) -Widget parent; +static void +create_menu_bar(Widget parent) { register int n; int count; @@ -3612,8 +3550,8 @@ Widget parent; } - -init_colors() +static void +init_colors(void) { int colorUse; short act, inact, prim, second; @@ -3632,10 +3570,7 @@ init_colors() } static void -do_memory( w, client_data, call_data ) -Widget w ; -XtPointer client_data ; -XtPointer call_data ; +do_memory(Widget w, XtPointer client_data, XtPointer call_data) { int type = (int)client_data; @@ -3663,7 +3598,7 @@ XtPointer call_data ; } void -read_resources() /* Read all possible resources from the database. */ +read_resources(void) /* Read all possible resources from the database. */ { char str[MAXLINE] ; char *msg; @@ -3754,9 +3689,7 @@ read_resources() /* Read all possible resources from the database. */ } void -close_cf(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +close_cf(Widget widget, XtPointer client_data, XtPointer call_data) { Arg args[1]; @@ -3770,9 +3703,7 @@ XtPointer client_data, call_data ; } void -close_ascii(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +close_ascii(Widget widget, XtPointer client_data, XtPointer call_data) { XtUnmanageChild(X->Aframe) ; ignore_event = True; @@ -3781,9 +3712,7 @@ XtPointer client_data, call_data ; } void -FocusInCB(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +FocusInCB(Widget widget, XtPointer client_data, XtPointer call_data) { Arg args[1]; @@ -3795,9 +3724,7 @@ XtPointer client_data, call_data ; } void -move_cf(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +move_cf(Widget widget, XtPointer client_data, XtPointer call_data) { char *input; int value; @@ -3836,8 +3763,8 @@ XtPointer client_data, call_data ; TimerEvent, (XtPointer) value); } -create_popup(parent) -Widget parent; +static void +create_popup(Widget parent) { char *mnemonic; XmString label; @@ -4070,11 +3997,7 @@ Widget parent; } static void -popupHandler(widget, client_data, event, continue_to_dispatch) -Widget widget ; -XtPointer client_data ; -XEvent *event ; -Boolean *continue_to_dispatch ; +popupHandler(Widget widget, XtPointer client_data, XEvent *event, Boolean *continue_to_dispatch) { XButtonPressedEvent *bevent; @@ -4145,9 +4068,7 @@ Boolean *continue_to_dispatch ; } void -set_option_menu(type, base) -int type; -int base; +set_option_menu(int type, int base) { Arg args[1]; @@ -4161,9 +4082,7 @@ int base; } void -map_popup(widget, client_data, call_data) -Widget widget ; -XtPointer client_data, call_data ; +map_popup(Widget widget, XtPointer client_data, XtPointer call_data) { XmAnyCallbackStruct * callback; XEvent * event; @@ -4182,10 +4101,7 @@ XtPointer client_data, call_data ; /*ARGSUSED*/ static void -save_state(widget, client_data, call_data) -Widget widget ; -XtPointer client_data ; -XtPointer call_data ; +save_state(Widget widget, XtPointer client_data, XtPointer call_data) { char *full_path = NULL; char *file_name = NULL; @@ -4256,9 +4172,7 @@ XtPointer call_data ; } static void -SaveSession( path, file_name ) - char *path ; - char *file_name ; +SaveSession(char *path, char *file_name) { int fd; Atom * ws_presence = NULL; @@ -4377,7 +4291,7 @@ SaveSession( path, file_name ) } void -RestoreSession() +RestoreSession(void) { Boolean status=False; char *path, *msg; @@ -4561,7 +4475,7 @@ RestoreSession() } static void -setCalcHints() +setCalcHints(void) { char *ptr; Atom * workspace_atoms = NULL; @@ -4627,9 +4541,7 @@ setCalcHints() } void -TimerEvent( client_data, id ) - XtPointer client_data; - XtIntervalId *id; +TimerEvent( XtPointer client_data, XtIntervalId *id) { Arg args[1]; @@ -4645,7 +4557,7 @@ TimerEvent( client_data, id ) /* #ifdef hpux */ #ifdef HP_EXTENSIONS static int -GetKeyboardID() +GetKeyboardID(void) { XHPDeviceList *list, *slist; int ndevices = 0, i, kbd = 0; @@ -4700,8 +4612,7 @@ GetKeyboardID() #endif static char * -_DtcalcStripSpaces(file) -char *file; +_DtcalcStripSpaces(char *file) { int i, j; diff --git a/cde/programs/dtcalc/mp.c b/cde/programs/dtcalc/mp.c index 1330e4d4..494fd44b 100644 --- a/cde/programs/dtcalc/mp.c +++ b/cde/programs/dtcalc/mp.c @@ -85,8 +85,7 @@ extern Vars v ; /* Calctool variables and options. */ void -mpabs(x, y) -int *x, *y ; +mpabs(int *x, int *y) { /* SETS Y = ABS(X) FOR MP NUMBERS X AND Y */ @@ -101,8 +100,7 @@ int *x, *y ; void -mpadd(x, y, z) -int *x, *y, *z ; +mpadd(int *x, int *y, int *z) { /* ADDS X AND Y, FORMING RESULT IN Z, WHERE X, Y AND Z ARE MP @@ -119,8 +117,7 @@ int *x, *y, *z ; void -mpadd2(x, y, z, y1, trunc) -int *x, *y, *z, *y1, *trunc ; +mpadd2(int *x, int *y, int *z, int *y1, int *trunc) { int i__1, i__2 ; @@ -235,8 +232,7 @@ L130: void -mpadd3(x, y, s, med, re) -int *x, *y, *s, *med, *re ; +mpadd3(int *x, int *y, int *s, int *med, int *re) { int i__1 ; @@ -391,8 +387,7 @@ L160: void -mpaddi(x, iy, z) -int *x, *iy, *z ; +mpaddi(int *x, int *iy, int *z) { /* ADDS MULTIPLE-PRECISION X TO INTEGER IY @@ -415,8 +410,7 @@ int *x, *iy, *z ; void -mpaddq(x, i, j, y) -int *x, *i, *j, *y ; +mpaddq(int *x, int *i, int *j, int *y) { /* ADDS THE RATIONAL NUMBER I/J TO MP NUMBER X, MP RESULT IN Y @@ -435,8 +429,7 @@ int *x, *i, *j, *y ; void -mpart1(n, y) -int *n, *y ; +mpart1(int *n, int *y) { int i__1, i__2 ; @@ -524,8 +517,7 @@ L60: void -mpasin(x, y) -int *x, *y ; +mpasin(int *x, int *y) { int i__1 ; @@ -586,8 +578,7 @@ L40: void -mpatan(x, y) -int *x, *y ; +mpatan(int *x, int *y) { int i__1, i__2 ; float r__1 ; @@ -691,9 +682,7 @@ L50: void -mpcdm(dx, z) -double *dx ; -int *z ; +mpcdm(double *dx, int *z) { int i__1 ; @@ -822,8 +811,7 @@ L130: void -mpchk(i, j) -int *i, *j ; +mpchk(int *i, int *j) { static int ib, mx ; @@ -904,8 +892,7 @@ L100: void -mpcim(ix, z) -int *ix, *z ; +mpcim(int *ix, int *z) { int i__1 ; @@ -957,9 +944,7 @@ L40: void -mpcmd(x, dz) -int *x ; -double *dz ; +mpcmd(int *x, double *dz) { int i__1 ; double d__1 ; @@ -1031,8 +1016,7 @@ L30: void -mpcmf(x, y) -int *x, *y ; +mpcmf(int *x, int *y) { int i__1 ; @@ -1096,8 +1080,7 @@ L30: void -mpcmi(x, iz) -int *x, *iz ; +mpcmi(int *x, int *iz) { int i__1 ; @@ -1167,8 +1150,7 @@ L30: void -mpcmim(x, y) -int *x, *y ; +mpcmim(int *x, int *y) { int i__1 ; @@ -1210,8 +1192,7 @@ L10: int -mpcmpi(x, i) -int *x, *i ; +mpcmpi(int *x, int *i) { int ret_val ; @@ -1236,9 +1217,7 @@ int *x, *i ; int -mpcmpr(x, ri) -int *x ; -float *ri ; +mpcmpr(int *x, float *ri) { int ret_val ; @@ -1263,9 +1242,7 @@ float *ri ; void -mpcmr(x, rz) -int *x ; -float *rz ; +mpcmr(int *x, float *rz) { int i__1 ; float r__1 ; @@ -1330,8 +1307,7 @@ L30: int -mpcomp(x, y) -int *x, *y ; +mpcomp(int *x, int *y) { int ret_val, i__1, i__2 ; @@ -1404,8 +1380,7 @@ L70: void -mpcos(x, y) -int *x, *y ; +mpcos(int *x, int *y) { static int i2 ; @@ -1455,8 +1430,7 @@ L20: void -mpcosh(x, y) -int *x, *y ; +mpcosh(int *x, int *y) { static int i2 ; @@ -1501,8 +1475,7 @@ L10: void -mpcqm(i, j, q) -int *i, *j, *q ; +mpcqm(int *i, int *j, int *q) { static int i1, j1 ; @@ -1536,9 +1509,7 @@ L40: void -mpcrm(rx, z) -float *rx ; -int *z ; +mpcrm(float *rx, int *z) { int i__1 ; @@ -1746,8 +1717,7 @@ L40: void -mpdivi(x, iy, z) -int *x, *iy, *z ; +mpdivi(int *x, int *iy, int*z) { int i__1, i__2 ; @@ -1952,8 +1922,7 @@ L240: int -mpeq(x, y) -int *x, *y ; +mpeq(int *x, int *y) { int ret_val ; @@ -1968,7 +1937,7 @@ int *x, *y ; void -mperr() +mperr(void) { /* THIS ROUTINE IS CALLED WHEN AN ERROR CONDITION IS ENCOUNTERED, AND @@ -1980,8 +1949,7 @@ mperr() void -mpexp(x, y) -int *x, *y ; +mpexp(int *x, int *y) { int i__1, i__2 ; float r__1 ; @@ -2166,8 +2134,7 @@ L110: void -mpexp1(x, y) -int *x, *y ; +mpexp1(int *x, int *y) { int i__1 ; @@ -2271,8 +2238,7 @@ L80: void -mpext(i, j, x) -int *i, *j, *x ; +mpext(int *i, int *j, int *x) { static int q, s ; @@ -2313,8 +2279,7 @@ L10: void -mpgcd(k, l) -int *k, *l ; +mpgcd(int *k, int *l) { static int i, j, is, js ; @@ -2356,8 +2321,7 @@ L30: int -mpge(x, y) -int *x, *y ; +mpge(int *x, int *y) { int ret_val ; @@ -2372,8 +2336,7 @@ int *x, *y ; int -mpgt(x, y) -int *x, *y ; +mpgt(int *x, int *y) { int ret_val ; @@ -2388,8 +2351,7 @@ int *x, *y ; int -mple(x, y) -int *x, *y ; +mple(int *x, int *y) { int ret_val ; @@ -2404,8 +2366,7 @@ int *x, *y ; void -mpln(x, y) -int *x, *y ; +mpln(int *x, int *y) { float r__1 ; @@ -2496,8 +2457,7 @@ L50: void -mplns(x, y) -int *x, *y ; +mplns(int *x, int *y) { int i__1, i__2 ; @@ -2608,8 +2568,7 @@ L80: int -mplt(x, y) -int *x, *y ; +mplt(int *x, int *y) { int ret_val ; @@ -2624,8 +2583,7 @@ int *x, *y ; void -mpmaxr(x) -int *x ; +mpmaxr(int *x) { int i__1 ; @@ -2654,8 +2612,7 @@ int *x ; void -mpmlp(u, v, w, j) -int *u, *v, *w, *j ; +mpmlp(int *u, int *v, int *w, int *j) { int i__1 ; @@ -2676,8 +2633,7 @@ int *u, *v, *w, *j ; void -mpmul(x, y, z) -int *x, *y, *z ; +mpmul(int *x, int *y, int *z) { int i__1, i__2, i__3, i__4 ; @@ -2806,8 +2762,7 @@ L110: void -mpmul2(x, iy, z, trunc) -int *x, *iy, *z, *trunc ; +mpmul2(int *x, int *iy, int *z, int *trunc) { int i__1, i__2 ; @@ -2965,8 +2920,7 @@ L130: void -mpmuli(x, iy, z) -int *x, *iy, *z ; +mpmuli(int *x, int *iy, int *z) { /* MULTIPLIES MP X BY SINGLE-PRECISION INTEGER IY GIVING MP Z. @@ -2984,8 +2938,7 @@ int *x, *iy, *z ; void -mpmulq(x, i, j, y) -int *x, *i, *j, *y ; +mpmulq(int *x, int *i, int *j, int *y) { int i__1 ; @@ -3033,8 +2986,7 @@ L50: void -mpneg(x, y) -int *x, *y ; +mpneg(int *x, int *y) { /* SETS Y = -X FOR MP NUMBERS X AND Y */ @@ -3049,8 +3001,7 @@ int *x, *y ; void -mpnzr(rs, re, z, trunc) -int *rs, *re, *z, *trunc ; +mpnzr(int *rs, int *re, int *z, int *trunc) { int i__1 ; @@ -3206,8 +3157,7 @@ L190: void -mpovfl(x) -int *x ; +mpovfl(int *x) { /* CALLED ON MULTIPLE-PRECISION OVERFLOW, IE WHEN THE @@ -3238,8 +3188,7 @@ int *x ; void -mppi(x) -int *x ; +mppi(int *x) { float r__1 ; @@ -3281,8 +3230,7 @@ int *x ; void -mppwr(x, n, y) -int *x, *n, *y ; +mppwr(int *x, int *n, int *y) { static int i2, n2, ns ; @@ -3362,8 +3310,7 @@ L70: void -mppwr2(x, y, z) -int *x, *y, *z ; +mppwr2(int *x, int *y, int *z) { static int i2 ; @@ -3421,8 +3368,7 @@ L70: void -mprec(x, y) -int *x, *y ; +mprec(int *x, int *y) { /* Initialized data */ @@ -3567,8 +3513,7 @@ L70: void -mproot(x, n, y) -int *x, *n, *y ; +mproot(int *x, int *n, int *y) { /* Initialized data */ @@ -3766,8 +3711,7 @@ L170: void -mpset(idecpl, itmax2, maxdr) -int *idecpl, *itmax2, *maxdr ; +mpset(int *idecpl, int *itmax2, int *maxdr) { int i__1 ; @@ -3881,8 +3825,7 @@ L80: void -mpsin(x, y) -int *x, *y ; +mpsin(int *x, int *y) { float r__1 ; @@ -3995,8 +3938,7 @@ L50: void -mpsin1(x, y, is) -int *x, *y, *is ; +mpsin1(int *x, int *y, int *is) { int i__1 ; @@ -4093,8 +4035,7 @@ L80: void -mpsinh(x, y) -int *x, *y ; +mpsinh(int *x, int *y) { int i__1 ; @@ -4161,8 +4102,7 @@ L30: void -mpsqrt(x, y) -int *x, *y ; +mpsqrt(int *x, int *y) { static int i, i2, iy3 ; @@ -4204,8 +4144,7 @@ L40: void -mpstr(x, y) -int *x, *y ; +mpstr(int *x, int *y) { int i__1 ; @@ -4244,8 +4183,7 @@ L10: void -mpsub(x, y, z) -int *x, *y, *z ; +mpsub(int *x, int *y, int *z) { static int y1[1] ; @@ -4264,8 +4202,7 @@ int *x, *y, *z ; void -mptanh(x, y) -int *x, *y ; +mptanh(int *x, int *y) { float r__1 ; @@ -4337,8 +4274,7 @@ L40: void -mpunfl(x) -int *x ; +mpunfl(int *x) { /* CALLED ON MULTIPLE-PRECISION UNDERFLOW, IE WHEN THE @@ -4363,9 +4299,7 @@ int *x ; double -mppow_di(ap, bp) -double *ap ; -int *bp ; +mppow_di(double *ap, int *bp) { double pow, x ; int n ; @@ -4394,8 +4328,7 @@ int *bp ; int -pow_ii(ap, bp) -int *ap, *bp ; +pow_ii(int *ap, int *bp) { int pow, x, n ; @@ -4415,9 +4348,7 @@ int *ap, *bp ; double -mppow_ri(ap, bp) -float *ap ; -int *bp ; +mppow_ri(float *ap, int *bp) { double pow, x ; int n ; -- 2.25.1