void
get_label(int n)
{
- int val ;
char *temp;
- val = buttons[n].value ;
if (v->tstate)
temp = buttons[n].str2;
else
case 'v' : usage(v->progname) ;
break ;
default :
- toolarg : /* Pick up generic tool arguments. */
usage(v->progname) ;
}
INC ;
val = fabs(number) ;
if (v->error) return(vstrs[(int) V_ERROR]) ;
if (v->dtype == ENG || v->dtype == SCI ||
- v->dtype == FIX && val != 0.0 && (val > max_fix[(int) v->base]))
+ (v->dtype == FIX && val != 0.0 && (val > max_fix[(int) v->base])))
return(make_eng_sci(MPnumber)) ;
else if (v->dtype == FIX && val != 0.0 && mkFix)
{
else
return(make_fixed(MPnumber, MAX_DIGITS)) ;
}
+ else
+ {
+ return(make_fixed(MPnumber, MAX_DIGITS)) ;
+ }
}
else
return(make_fixed(MPnumber, MAX_DIGITS)) ;
set_item(OPITEM, vstrs[(int) V_CLR]) ;
else
set_item(OPITEM, "") ;
+ break;
+ default:
+ break;
}
(*buttons[n].func)() ;
if (!strncmp(str, sval, 2)) FPUTS("#", tmpfd) ;
sval[0] = 'F' ;
if (!strncmp(str, sval, 2)) FPUTS("#", tmpfd) ;
+ break;
+ default: break;
}
}
FPRINTF(tmpfd, "%s", str) ;
case M_FUN :
if(strcmp(val, "") != 0)
FPRINTF(tmpfd, "\nF%1d %s %s\n", cfno, val, comment) ;
+ break;
+ default: break;
}
UNLINK(rcname) ;
rcfd = fopen(rcname, "w") ;
void do_number P(()) ;
void do_numtype P(()) ;
void do_paren P(()) ;
+void set_numtype P((enum num_type dtype));
void do_nothing P(()) ;
void do_pending P(()) ;
void do_point P(()) ;
void save_pending_values P((int)) ;
void save_resources P((char *)) ;
void blank_display P(()) ;
+void ErrorDialog P((char *string));
void set_item P((enum item_type, char *)) ;
void set_title P((enum fcp_type, char *)) ;
void show_ascii_frame P(()) ;
void ds_get_screen_size P((Widget, int *, int *)) ;
+void _DtGenericMapWindow P((Widget shell, Widget parent ));
+void _DtChildPosition P((Widget w, Widget parent, Position *newX, Position *newY));
+
#endif /*!_ds_popup_h*/
XmStringFree(cstr) ;
break ;
case T_VALUE : XmTextFieldSetString(w->textfield, str) ;
+ break ;
+ default : break ;
}
}
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <ctype.h>
#include <sys/param.h>
#include <sys/stat.h>
#include "ds_xlib.h"
1.0e-15, 1.0e-16, 1.0e-17, 1.0e-18, 1.0e-19 };
static void compute_i(double *target);
+static int count_sign_changes(double *cf, int count);
void
/* the financial state is false - last key was not a fin. key */
v->funstate = 0;
- if (!(v->opsptr && !v->show_paren)) /* Don't do if processing parens. */
- if (IS_KEY(v->current, KEY_EQ) && IS_KEY(v->old_cal_value, KEY_EQ))
- if (v->new_input)
+ if (!(v->opsptr && !v->show_paren)) { /* Don't do if processing parens. */
+ if (IS_KEY(v->current, KEY_EQ) && IS_KEY(v->old_cal_value, KEY_EQ)) {
+ if (v->new_input) {
mpstr(v->MPdisp_val, v->MPresult) ;
- else
+ } else {
mpstr(v->MPlast_input, v->MPdisp_val) ;
+ }
+ }
+ }
if (!IS_KEY(v->current, KEY_EQ) && IS_KEY(v->old_cal_value, KEY_EQ))
v->cur_op = '?' ;
set_numtype(v->dtype);
}
+void
set_numtype(enum num_type dtype)
{
v->pending = 0 ;
if (!temp)
return (temp > 0) ? HUGE : -HUGE;
#else
- if (temp = isinf(result)) return (temp > 0) ? HUGE : -HUGE;
+ if ((temp = isinf(result))) return (temp > 0) ? HUGE : -HUGE;
#endif /* USL or __uxp__ */
#endif /* _AIX or __osf__ */
switch (method)
{
+ default:
case 1:
f = lsp - lsn;
f_prime = sum_pos_prime / sum_pos - sum_neg_prime / sum_neg;
#endif
#endif /* _AIX or __osf__ */
- if (new_w == w || w != 0.0 && fabs((new_w - w) / w) < FIN_EPSILON)
+ if (new_w == w || (w != 0.0 && fabs((new_w - w) / w) < FIN_EPSILON))
break;
w = new_w;
doerr(GETMESSAGE(5, 1, "ERROR: Computation Failed"));
}
-int
+static int
count_sign_changes(double *cf, int count)
{
int i, curr_sign = 0, result = 0;
#include <Xm/MessageB.h>
#include <Dt/Dt.h>
+#include <Dt/Wsm.h>
#include <Dt/HelpDialog.h>
#include "calctool.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <ctype.h>
#include <unistd.h>
#include <signal.h>
#include <sys/param.h>
static void frame_interpose P((Widget, XtPointer, XEvent *, Boolean *)) ;
static void menu_handler P((Widget, XtPointer, XEvent *, Boolean *)) ;
static void popupHandler P((Widget, XtPointer, XEvent *, Boolean *)) ;
-static void make_mode_frame P((enum mode_type)) ;
static void new_cf_value P((Widget, XtPointer, XtPointer)) ;
static void do_memory P((Widget, XtPointer, XtPointer)) ;
static void switch_mode P((enum mode_type)) ;
v->cur_ch == KEY_E ||
v->cur_ch == KEY_F)
return;
+ default: /* HEX, allow all keys */
+ break;
}
}
get_next_event(Widget widget, int ev_action, XEvent *xevent)
{
char *tmpStr, chs[2] ;
- int cval, down, nextc, up ;
+ int cval = 0, down, nextc, up ;
KeySym ksym;
XKeyPressedEvent *key_event ;
void
set_title(enum fcp_type fcptype, char *str)
{
- Widget w ;
+ Widget w;
XmString cstr ;
w = X->frframe ;
else if (fcptype == FCP_MODE)
w = X->mframe[(int) v->modetype] ;
+ else {
+ fprintf(stderr, "Unknown fcptype %d in set_title\n", fcptype);
+ return;
+ }
if (fcptype == FCP_KEY)
XtVaSetValues(w, XmNtitle, str, NULL) ;
}
else
STRCPY(v->fun_names[X->cfno], "");
+ break;
+ default : break;
}
XtDestroyWidget(X->menus[(int) X->CFtype]) ;
case M_FUN :
write_rcfile(X->CFtype, X->cfexists, X->cfno,
X->vval, X->dval) ;
+ break ;
+ default : break;
}
ignore_event = True;
void
win_display(enum fcp_type fcptype, int state)
{
- Widget widget ;
+ Widget widget = NULL;
Position newX, newY;
Arg args[3];
case M_CON : X->cfexists = 1 ; /* Always the default constants. */
break ;
case M_FUN : if (strlen(v->fun_vals[X->cfno])) X->cfexists = 1 ;
+ break;
+ default : break;
}
if (X->cfexists)
{
char *mnemonic;
XmString label;
Widget dummyHelp1, dummyHelp2, memRegs;
- Widget help, helpI, helpToc, helpT, helpR, helpO, helpU, helpV;
+ Widget helpI, helpToc, helpT, helpR, helpO, helpU, helpV;
X->popupMenu = XmCreatePopupMenu(parent, "popup", NULL, 0) ;
XtCreateManagedWidget(GETMESSAGE(2, 46,"Calculator Popup"),
mnemonic = GETMESSAGE(2, 17, "H");
label = XmStringCreateLocalized ( GETMESSAGE(2, 18, "Help") );
- help = XtVaCreateManagedWidget("help",
+ XtVaCreateManagedWidget("help",
xmCascadeButtonGadgetClass, X->popupMenu,
XmNsubMenuId, dummyHelp2,
XmNmnemonic, XStringToKeysym( mnemonic ),
{
XmAnyCallbackStruct * callback;
XEvent * event;
- XKeyPressedEvent *key_event ;
callback = (XmAnyCallbackStruct *) call_data;
event = (XEvent *) callback->event;
- key_event = (XKeyPressedEvent *) event ;
if(event->type != KeyRelease)
return;
L20:
if (MP.r[i3] < 0) goto L30 ;
- if (MP.r[i3] == 0 && MP.r[i3 + 1] + 1 << 1 <= MP.b)
+ if (MP.r[i3] == 0 && (MP.r[i3 + 1] + 1) << 1 <= MP.b)
goto L30 ;
q <<= 1 ;
/* RETURN IF NEWTON ITERATION WAS CONVERGING */
L50:
- if (MP.r[i3 - 1] == 0 || MP.r[i2] - MP.r[i3] << 1 >=
+ if (MP.r[i3 - 1] == 0 || (MP.r[i2] - MP.r[i3]) << 1 >=
MP.t - it0)
goto L70 ;
*/
L140:
- if (MP.r[i3 - 1] == 0 || MP.r[i2] - MP.r[i3] << 1 >=
+ if (MP.r[i3 - 1] == 0 || (MP.r[i2] - MP.r[i3]) << 1 >=
MP.t - it0)
goto L160 ;