diff --git a/cde/programs/dtcalc/calctool.h b/cde/programs/dtcalc/calctool.h index 94bf5efb8..519bb5123 100644 --- a/cde/programs/dtcalc/calctool.h +++ b/cde/programs/dtcalc/calctool.h @@ -674,7 +674,7 @@ void MPstr_to_num P((char *, enum base_type, int *)) ; void paren_disp P((char)) ; void process_event P((int)) ; void process_item P((int)) ; -void process_parens P((int)) ; +void process_parens P((char)) ; void process_stack P((int, int, int)) ; void process_str P((char *, enum menu_type)) ; void push_num P((int *)) ; diff --git a/cde/programs/dtcalc/functions.c b/cde/programs/dtcalc/functions.c index 8c6ddaec6..d469c36ce 100644 --- a/cde/programs/dtcalc/functions.c +++ b/cde/programs/dtcalc/functions.c @@ -56,9 +56,11 @@ double mods[] = { 1.0, 1.0e-1, 1.0e-2, 1.0e-3, 1.0e-4, 1.0e-10, 1.0e-11, 1.0e-12, 1.0e-13, 1.0e-14, 1.0e-15, 1.0e-16, 1.0e-17, 1.0e-18, 1.0e-19 }; +static void compute_i(double *target); + void -do_accuracy() /* Set display accuracy. */ +do_accuracy(void) /* Set display accuracy. */ { int i ; @@ -74,14 +76,14 @@ do_accuracy() /* Set display accuracy. */ void -do_ascii() /* Convert ASCII value. */ +do_ascii(void) /* Convert ASCII value. */ { show_ascii_frame() ; } void -do_base() /* Change the current base setting. */ +do_base(void) /* Change the current base setting. */ { if (v->current == BASE_BIN) v->base = BIN ; else if (v->current == BASE_OCT) v->base = OCT ; @@ -93,8 +95,7 @@ do_base() /* Change the current base setting. */ } void -set_base(base) -enum base_type base ; +set_base(enum base_type base) { grey_buttons(v->base) ; show_display(v->MPdisp_val) ; @@ -105,7 +106,7 @@ enum base_type base ; } void -do_business() /* Perform special business mode calculations. */ +do_business(void) /* Perform special business mode calculations. */ { Boolean need_show = TRUE; char *display_number = NULL; @@ -463,7 +464,7 @@ do_business() /* Perform special business mode calculations. */ void -do_calc() /* Perform arithmetic calculation and display result. */ +do_calc(void) /* Perform arithmetic calculation and display result. */ { double dval, dres ; int MP1[MP_SIZE] ; @@ -559,7 +560,7 @@ do_calc() /* Perform arithmetic calculation and display result. */ void -do_clear() /* Clear the calculator display and re-initialise. */ +do_clear(void) /* Clear the calculator display and re-initialise. */ { clear_display() ; if (v->error) set_item(DISPLAYITEM, "") ; @@ -568,7 +569,7 @@ do_clear() /* Clear the calculator display and re-initialise. */ void -do_constant() +do_constant(void) { if (v->current >= '0' && v->current <= '9') { @@ -579,7 +580,7 @@ do_constant() void -do_delete() /* Remove the last numeric character typed. */ +do_delete(void) /* Remove the last numeric character typed. */ { if (strlen(v->display)) v->display[strlen(v->display)-1] = '\0' ; @@ -608,7 +609,7 @@ do_delete() /* Remove the last numeric character typed. */ void -do_exchange() /* Exchange display with memory register. */ +do_exchange(void) /* Exchange display with memory register. */ { int i, MPtemp[MP_SIZE] ; @@ -625,7 +626,7 @@ do_exchange() /* Exchange display with memory register. */ void -do_expno() /* Get exponential number. */ +do_expno(void) /* Get exponential number. */ { /* the financial state is false - last key was not a fin. key */ v->funstate = 0; @@ -651,8 +652,7 @@ do_expno() /* Get exponential number. */ void -do_factorial(MPval, MPres) /* Calculate the factorial of MPval. */ -int *MPval, *MPres ; +do_factorial(int *MPval, int *MPres) /* Calculate the factorial of MPval. */ { double val ; int i, MPa[MP_SIZE], MP1[MP_SIZE], MP2[MP_SIZE] ; @@ -696,13 +696,13 @@ int *MPval, *MPres ; void -do_frame() /* Exit dtcalc. */ +do_frame(void) /* Exit dtcalc. */ { exit(0) ; } void -do_function() /* Perform a user defined function. */ +do_function(void) /* Perform a user defined function. */ { enum fcp_type scurwin ; int fno, scolumn, srow ; @@ -724,7 +724,7 @@ do_function() /* Perform a user defined function. */ void -do_immed() +do_immed(void) { double dval, dval2 ; int i, MP1[MP_SIZE], MP2[MP_SIZE] ; @@ -854,14 +854,14 @@ do_immed() void -do_keys() /* Display/undisplay the dtcalc key values. */ +do_keys(void) /* Display/undisplay the dtcalc key values. */ { v->tstate = !v->tstate ; redraw_buttons() ; } void -do_mode() /* Set special calculator mode. */ +do_mode(void) /* Set special calculator mode. */ { if (v->current == MODE_FIN) v->modetype = FINANCIAL ; else if (v->current == MODE_LOG) v->modetype = LOGICAL ; @@ -873,13 +873,13 @@ do_mode() /* Set special calculator mode. */ void -do_none() /* Null routine for empty buttons. */ +do_none(void) /* Null routine for empty buttons. */ { } void -do_number() +do_number(void) { char nextchar ; int len, n ; @@ -924,7 +924,7 @@ do_number() void -do_numtype() /* Set number type (engineering, fixed or scientific). */ +do_numtype(void) /* Set number type (engineering, fixed or scientific). */ { if (v->current == DISP_ENG) v->dtype = ENG ; else if (v->current == DISP_FIX) v->dtype = FIX ; @@ -934,8 +934,7 @@ do_numtype() /* Set number type (engineering, fixed or scientific). */ set_numtype(v->dtype); } -set_numtype( dtype ) -enum num_type dtype ; +set_numtype(enum num_type dtype) { v->pending = 0 ; show_display(v->MPdisp_val) ; @@ -945,7 +944,7 @@ enum num_type dtype ; } void -do_paren() +do_paren(void) { char *ptr ; double tmpdb; @@ -1042,7 +1041,7 @@ do_paren() } void -do_pending() +do_pending(void) { /* the financial state is false - last key was not a fin. key */ @@ -1111,7 +1110,7 @@ do_pending() void -do_point() /* Handle numeric point. */ +do_point(void) /* Handle numeric point. */ { /* the financial state is false - last key was not a fin. key */ v->funstate = 0; @@ -1134,7 +1133,7 @@ do_point() /* Handle numeric point. */ void -do_portion() +do_portion(void) { int MP1[MP_SIZE] ; @@ -1161,7 +1160,7 @@ do_portion() void -do_shift() /* Perform bitwise shift on display value. */ +do_shift(void) /* Perform bitwise shift on display value. */ { int MPtemp[MP_SIZE], shift ; BOOLEAN temp ; @@ -1189,7 +1188,7 @@ do_shift() /* Perform bitwise shift on display value. */ void -do_sto_rcl() /* Save/restore value to/from memory register. */ +do_sto_rcl(void) /* Save/restore value to/from memory register. */ { int i, MPn[MP_SIZE], n ; @@ -1240,7 +1239,7 @@ do_sto_rcl() /* Save/restore value to/from memory register. */ void -do_trig() /* Perform all trigonometric functions. */ +do_trig(void) /* Perform all trigonometric functions. */ { int i, MPtemp[MP_SIZE], MP1[MP_SIZE], MP2[MP_SIZE] ; double cval ; @@ -1349,7 +1348,7 @@ do_trig() /* Perform all trigonometric functions. */ void -do_trigtype() /* Change the current trigonometric type. */ +do_trigtype(void) /* Change the current trigonometric type. */ { if (v->current == TRIG_DEG) v->ttype = DEG ; else if (v->current == TRIG_GRA) v->ttype = GRAD ; @@ -1369,8 +1368,7 @@ do_trigtype() /* Change the current trigonometric type. */ BOOLEAN -ibool(x) -double x ; +ibool(double x) { BOOLEAN p ; @@ -1386,8 +1384,7 @@ double x ; } BOOLEAN -ibool2(x) -double x ; +ibool2(double x) { BOOLEAN p ; @@ -1425,8 +1422,7 @@ double x ; */ void -mpacos(MPx, MPretval) -int *MPx, *MPretval ; +mpacos(int *MPx, int *MPretval) { int MP0[MP_SIZE], MP1[MP_SIZE], MP2[MP_SIZE] ; int MPn1[MP_SIZE], MPpi[MP_SIZE], MPy[MP_SIZE], val ; @@ -1472,8 +1468,7 @@ int *MPx, *MPretval ; */ void -mpacosh(MPx, MPretval) -int *MPx, *MPretval ; +mpacosh(int *MPx, int *MPretval) { int MP1[MP_SIZE], val ; @@ -1503,8 +1498,7 @@ int *MPx, *MPretval ; */ void -mpasinh(MPx, MPretval) -int *MPx, *MPretval ; +mpasinh(int *MPx, int *MPretval) { int MP1[MP_SIZE], val ; @@ -1525,8 +1519,7 @@ int *MPx, *MPretval ; */ void -mpatanh(MPx, MPretval) -int *MPx, *MPretval ; +mpatanh(int *MPx, int *MPretval) { int MP0[MP_SIZE], MP1[MP_SIZE], MP2[MP_SIZE] ; int MP3[MP_SIZE], MPn1[MP_SIZE], val ; @@ -1561,8 +1554,7 @@ int *MPx, *MPretval ; */ void -mplog10(MPx, MPretval) -int *MPx, *MPretval ; +mplog10(int *MPx, int *MPretval) { int MP1[MP_SIZE], MP2[MP_SIZE], n ; @@ -1575,8 +1567,7 @@ int *MPx, *MPretval ; void -process_parens(current) -char current ; +process_parens(char current) { int i ; int last_lpar ; /* Position in stack of last left paren. */ @@ -1660,8 +1651,7 @@ char current ; void -push_num(MPval) /* Try to push value onto the numeric stack. */ -int *MPval ; +push_num(int *MPval) /* Try to push value onto the numeric stack. */ { if (v->numsptr < 0) return ; if (v->numsptr >= MAXSTACK) @@ -1683,8 +1673,7 @@ int *MPval ; void -push_op(val) /* Try to push value onto the operand stack. */ -int val ; +push_op(int val) /* Try to push value onto the operand stack. */ { if (v->opsptr < 0) return ; if (v->opsptr >= MAXSTACK) @@ -1699,8 +1688,7 @@ int val ; void -save_pending_values(val) -int val ; +save_pending_values(int val) { int n ; @@ -1717,8 +1705,7 @@ int val ; double -setbool(p) -BOOLEAN p ; +setbool(BOOLEAN p) { BOOLEAN q ; double val ; @@ -1731,9 +1718,7 @@ BOOLEAN p ; } double -do_round(result, ndigits) -double result; -int ndigits; +do_round(double result, int ndigits) { char buf2[40], buffer[100]; int temp; @@ -1765,10 +1750,7 @@ int ndigits; } BOOLEAN -try_compute_i(guess, result, method) -double guess; -double *result; -int method; +try_compute_i(double guess, double *result, int method) { double sum_pos, sum_pos_prime, sum_neg, sum_neg_prime, w = guess; double new_w; @@ -1887,8 +1869,8 @@ int method; return TRUE; } -compute_i(target) -double *target; +static void +compute_i(double *target) { double p[3]; double first_period, last_period; @@ -1952,9 +1934,7 @@ double *target; } int -count_sign_changes(cf, count) -double *cf; -int count; +count_sign_changes(double *cf, int count) { int i, curr_sign = 0, result = 0;