1 /* $XConsortium: calctool.h /main/7 1996/10/29 14:10:36 mustafa $ */
4 * Contains the none user interface includes for the Desktop *
7 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
8 * (c) Copyright 1993, 1994 International Business Machines Corp. *
9 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
10 * (c) Copyright 1993, 1994 Novell, Inc. *
14 #include <X11/Intrinsic.h>
15 #include <Dt/UserMsg.h>
16 #include <Dt/DtNlUtils.h>
19 /* Undefine DEC so the enum value DEC works */
26 #define MSGFILE_LABEL "dtcalc.label"
27 #define MSGFILE_MESSAGE "dtcalc.message"
29 extern char *MSGFILE_LABEL ;
30 extern char *MSGFILE_MESSAGE ;
34 #define LGET(s) (char *) dgettext(MSGFILE_LABEL, s)
35 #define MGET(s) (char *) dgettext(MSGFILE_MESSAGE, s)
37 #define dgettext(f, s) (s)
38 #define bindtextdomain(f, s)
40 #ifndef NO_MESSAGE_CATALOG
42 # define _CLIENT_CAT_NAME "dtcalc.cat"
44 # define _CLIENT_CAT_NAME "dtcalc"
45 # endif /* __ultrix */
46 extern char *_DtGetMessage(char *filename, int set, int n, char *s);
47 # define GETMESSAGE(set, number, string)\
48 (_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
50 # define GETMESSAGE(set, number, string)\
54 #if !(defined(sun) && (_XOPEN_VERSION==3))
78 /* For all function declarations, if ANSI then use a prototype. */
82 #else /* ! __STDC__ */
87 #define HIL_PC101_KBD 1
89 #define SERIAL_PC101_KBD 3
90 #define FIRST_HIL_KBD 0xC0
91 #define LAST_HIL_KBD 0xDF
93 #define PS2_DIN_NAME "PS2_DIN_KEYBOARD"
96 extern char *getenv P((const char *)) ;
97 extern char *mktemp P((char *)) ;
99 extern double drand48 P(()) ;
104 #define FIN_EPSILON 1.0e-10
105 #define MAX_FIN_ITER 1000
107 #define MP_SIZE 150 /* Size of the multiple precision values. */
109 #define FCLOSE (void) fclose /* To make lint happy. */
110 #define FPRINTF (void) fprintf
111 #define FPUTS (void) fputs
112 #define FREE (void) free
113 #define MEMCPY (void) memcpy
114 #define MKTEMP (void) mktemp
115 #define REWIND (void) rewind
116 #define SPRINTF (void) sprintf
117 #define SSCANF (void) sscanf
118 #define STRCPY (void) strcpy
119 #define STRNCAT (void) strncat
120 #define UNLINK (void) unlink
122 /* Various pseudo events used by the dtcalc program. */
123 #define KEYBOARD_DOWN 100 /* Keyboard character was pressed. */
124 #define KEYBOARD_UP 101 /* Keyboard character was released. */
125 #define LASTEVENTPLUSONE 102 /* Not one of the above. */
137 enum base_type { BIN, OCT, DEC, HEX } ; /* Base definitions. */
139 /* Command line options (for saving). */
140 enum cmd_type { CMD_ACC, CMD_MODE, CMD_BASE, CMD_DISP, CMD_MENU_BAR,
141 CMD_SESSION, CMD_TRIG, CMD_DUMMY } ;
143 /* Frame/Canvas/Pixwin types. */
144 enum fcp_type { FCP_KEY, FCP_REG, FCP_MODE, FCP_FIN_REG } ;
146 /* Help string types. */
147 enum help_type { H_ACC, H_BASE, H_CON, H_EXCH,
148 H_FUN, H_MODE, H_NUM,
149 H_RCL, H_STO, H_TRIG,
150 H_ABUT, H_AFRAME, H_APANEL,
151 H_APPEARANCE, H_APPLY, H_ATEXT, H_CFCBUT,
152 H_CFDESC, H_CFFRAME, H_CFNO, H_CFPANEL,
153 H_CFVAL, H_DEF, H_DISPLAY, H_PFRAME,
154 H_PPANEL, H_RESET, H_STYLE, H_DUMMY } ;
156 /* Pseudo panel items. */
157 enum item_type { BASEITEM, TTYPEITEM, NUMITEM, HYPITEM,
158 INVITEM, OPITEM, MODEITEM, DISPLAYITEM } ;
160 /* Motif labels for various items. */
161 enum label_type { L_LCALC, L_UCALC, L_CONNO, L_NEWCON, L_FUNNO,
162 L_NEWFUN, L_MEMT, L_PROPT, L_DESC, L_VALUE,
163 L_CONB, L_FUNB, L_FINMEMT, L_DUMMY } ;
165 /* Popup menu types. */
166 enum menu_type { M_ACC, M_BASE, M_CON, M_EXCH, M_FUN, M_MODE,
167 M_NUM, M_RCL, M_STO, M_TRIG, M_NONE
170 /* Message string types. */
171 enum mess_type { MESS_PARAM, MESS_CON, MESS_DUMMY } ;
173 /* Calculator modes. */
174 enum mode_type { FINANCIAL, LOGICAL, SCIENTIFIC } ;
176 enum mp_type { MP_ADD2A, MP_ADD2B, MP_PART1, MP_ASIN, /* MP error types. */
178 MP_CHKD, MP_CHKE, MP_CHKF, MP_CHKG,
179 MP_CHKH, MP_CHKI, MP_CHKJ, MP_CHKL,
180 MP_CHKM, MP_CHKN, MP_CMD, MP_CMR,
181 MP_CQM, MP_DIVA, MP_DIVB, MP_DIVIA,
182 MP_DIVIB, MP_EXPA, MP_EXPB, MP_EXP1,
183 MP_LNA, MP_LNB, MP_LNSA,
184 MP_LNSB, MP_LNSC, MP_MULA, MP_MULB,
185 MP_MULC, MP_MUL2A, MP_MUL2B, MP_MULQ,
186 MP_NZRA, MP_NZRB, MP_NZRC,
187 MP_OVFL, MP_PI, MP_PWRA,
188 MP_PWRB, MP_PWR2A, MP_PWR2B, MP_RECA,
189 MP_RECB, MP_RECC, MP_RECD, MP_ROOTA,
190 MP_ROOTB, MP_ROOTC, MP_ROOTD,
191 MP_ROOTE, MP_ROOTF, MP_SETB,
192 MP_SETC, MP_SETD, MP_SETE, MP_SIN,
193 MP_SIN1, MP_SQRT, MP_TAN, MP_DUMMY } ;
195 enum num_type { ENG, FIX, SCI } ; /* Number display mode. */
197 enum op_type { OP_SET, OP_CLEAR, OP_NOP } ; /* Operation item settings. */
199 enum opt_type { O_ACCVAL, O_ACCRANGE, O_BASE, O_DISPLAY,
200 O_MODE, O_TRIG, O_SESSION, O_DUMMY } ;
202 enum prop_type { P_CHAR, P_ASCIIT, P_DUMMY } ;
205 enum res_type { R_ACCURACY, R_BASE, R_DISPLAY, R_MODE, R_FREGS,
206 R_REGS, R_TRIG, R_BEEP, R_ICON, R_WORKSPACE,
207 R_HEIGHT, R_WIDTH, R_X, R_Y, R_DISPLAYED,
208 R_REG0, R_REG1, R_REG2, R_REG3, R_REG4,
209 R_REG5, R_REG6, R_REG7, R_REG8, R_REG9,
210 R_FREG0, R_FREG1, R_FREG2, R_FREG3, R_FREG4,
211 R_FREG5, R_MENUBAR, R_KEYS, R_DUMMY } ;
213 enum trig_type { DEG, GRAD, RAD } ; /* Trigonometric types. */
215 /* Usage message types. */
216 enum usage_type { USAGE1, USAGE2, USAGE3, U_DUMMY } ;
218 enum var_type { V_CANCEL,
219 V_CLR, V_CONFIRM, V_CONTINUE,
221 V_FUNWNAME, V_HYP, V_INV,
222 V_INVCON, V_LCON, V_LFUN,
223 V_NOCHANGE, V_NUMSTACK, V_OPSTACK, V_OWRITE,
224 V_RANGE, V_TRUE, V_UCON, V_UFUN,
225 V_NORSAVE, V_DUMMY } ;
227 /* Abbreviations for the dtcalc keyboard and menu equivalents. */
229 #define KEY_BLNKD buttons[0].value /* q */
230 #define KEY_FUN buttons[1].value /* F */
231 #define KEY_CON buttons[2].value /* # */
232 #define KEY_KEYS buttons[3].value /* k */
234 #define KEY_INT buttons[4].value /* CTL('i') */
235 #define KEY_FRAC buttons[5].value /* CTL('f') */
236 #define KEY_ABS buttons[6].value /* CTL('u') */
237 #define KEY_EXP buttons[7].value /* E */
239 #define KEY_ACC buttons[8].value /* A */
240 #define KEY_STO buttons[9].value /* S */
241 #define KEY_RCL buttons[10].value /* R */
242 #define KEY_EXCH buttons[11].value /* X */
244 #define KEY_BLNK1 buttons[12].value /* q */
245 #define KEY_BLNK2 buttons[13].value /* q */
246 #define KEY_BLNK3 buttons[14].value /* q */
247 #define KEY_BLNK4 buttons[15].value /* q */
249 #define KEY_BLNK5 buttons[16].value /* q */
250 #define KEY_BLNK6 buttons[17].value /* q */
251 #define KEY_BLNK7 buttons[18].value /* q */
252 #define KEY_BLNK8 buttons[19].value /* q */
254 #define KEY_BLNK9 buttons[20].value /* q */
255 #define KEY_BLNKA buttons[21].value /* q */
256 #define KEY_BLNKB buttons[22].value /* q */
257 #define KEY_BLNKC buttons[23].value /* q */
259 #define KEY_REC buttons[24].value /* r */
260 #define KEY_SQR buttons[25].value /* @ */
261 #define KEY_SQRT buttons[26].value /* s */
262 #define KEY_PER buttons[27].value /* % */
264 #define KEY_LPAR buttons[28].value /* ( */
265 #define KEY_RPAR buttons[29].value /* ) */
266 #define KEY_BSP buttons[30].value /* CTL('h') */
267 #define KEY_CLR buttons[31].value /* del */
269 #define KEY_D buttons[32].value /* d */
270 #define KEY_E buttons[33].value /* e */
271 #define KEY_F buttons[34].value /* f */
272 #define KEY_CHS buttons[35].value /* C */
274 #define KEY_A buttons[36].value /* a */
275 #define KEY_B buttons[37].value /* b */
276 #define KEY_C buttons[38].value /* c */
277 #define KEY_MUL buttons[39].value /* x */
279 #define KEY_7 buttons[40].value /* 7 */
280 #define KEY_8 buttons[41].value /* 8 */
281 #define KEY_9 buttons[42].value /* 9 */
282 #define KEY_DIV buttons[43].value /* / */
284 #define KEY_4 buttons[44].value /* 4 */
285 #define KEY_5 buttons[45].value /* 5 */
286 #define KEY_6 buttons[46].value /* 6 */
287 #define KEY_SUB buttons[47].value /* - */
289 #define KEY_1 buttons[48].value /* 1 */
290 #define KEY_2 buttons[49].value /* 2 */
291 #define KEY_3 buttons[50].value /* 3 */
292 #define KEY_ADD buttons[51].value /* + */
294 #define KEY_0 buttons[52].value /* 0 */
295 #define KEY_PNT buttons[53].value /* . */
296 #define KEY_EQ buttons[54].value /* = */
297 #define KEY_QUIT buttons[55].value /* q */
299 /* these are the extra definitions for MODE, BASE, and DISP */
300 #define KEY_BASE buttons[56].value /* B */
301 #define KEY_DISP buttons[57].value /* D */
302 #define KEY_MODE buttons[58].value /* M */
303 #define KEY_TRIG buttons[59].value /* T */
305 #define ACC_START 0 /* 0 */
306 #define ACC_END 9 /* 9 */
308 #define MEM_START 10 /* 0 */
309 #define MEM_END 19 /* 9 */
311 #define BASE_BIN menu_entries[20].val /* b */
312 #define BASE_OCT menu_entries[21].val /* o */
313 #define BASE_DEC menu_entries[22].val /* d */
314 #define BASE_HEX menu_entries[23].val /* h */
316 #define DISP_ENG menu_entries[24].val /* e */
317 #define DISP_FIX menu_entries[25].val /* f */
318 #define DISP_SCI menu_entries[26].val /* s */
320 #define TRIG_DEG menu_entries[27].val /* d */
321 #define TRIG_GRA menu_entries[28].val /* g */
322 #define TRIG_RAD menu_entries[29].val /* r */
324 #define MODE_BAS menu_entries[30].val /* b */
325 #define MODE_FIN menu_entries[31].val /* f */
326 #define MODE_LOG menu_entries[32].val /* l */
327 #define MODE_SCI menu_entries[33].val /* s */
329 #define KEY_TERM mode_buttons[0].value /* T */
330 #define KEY_RATE mode_buttons[1].value /* CTL('r') */
331 #define KEY_PV mode_buttons[2].value /* p */
332 #define KEY_PMT mode_buttons[3].value /* P */
333 #define KEY_FV mode_buttons[4].value /* v */
334 #define KEY_PYR mode_buttons[5].value /* y */
335 #define KEY_FCLR mode_buttons[6].value /* L */
336 #define KEY_CTRM mode_buttons[7].value /* CTL('t') */
337 #define KEY_DDB mode_buttons[8].value /* CTL('d') */
338 #define KEY_SLN mode_buttons[9].value /* CTL('s') */
339 #define KEY_SYD mode_buttons[10].value /* CTL('y') */
341 #define KEY_LSFT mode_buttons[16].value /* < */
342 #define KEY_RSFT mode_buttons[17].value /* > */
343 #define KEY_16 mode_buttons[18].value /* [ */
344 #define KEY_32 mode_buttons[19].value /* ] */
345 #define KEY_OR mode_buttons[20].value /* | */
346 #define KEY_AND mode_buttons[21].value /* & */
347 #define KEY_NOT mode_buttons[22].value /* ~ */
348 #define KEY_XOR mode_buttons[23].value /* ^ */
349 #define KEY_XNOR mode_buttons[24].value /* n */
351 #define KEY_INV mode_buttons[32].value /* i */
352 #define KEY_HYP mode_buttons[33].value /* h */
353 #define KEY_ETOX mode_buttons[34].value /* { */
354 #define KEY_TTOX mode_buttons[35].value /* } */
355 #define KEY_YTOX mode_buttons[36].value /* y */
356 #define KEY_FACT mode_buttons[37].value /* ! */
357 #define KEY_COS mode_buttons[38].value /* CTL('c') */
358 #define KEY_SIN mode_buttons[39].value /* CTL('s') */
359 #define KEY_TAN mode_buttons[40].value /* CTL('t') */
360 #define KEY_LN mode_buttons[41].value /* N */
361 #define KEY_LOG mode_buttons[42].value /* G */
362 #define KEY_RAND mode_buttons[43].value /* ? */
364 #define BCOLS 4 /* No of columns of buttons. */
365 #define BROWS 14 /* No of rows of buttons. */
366 #define CALC_CANCEL 1 /* Cancel button pressed on notice. */
367 #define CALC_CONFIRM 2 /* Confirm button pressed on notice. */
368 #define CTL(n) n - 96 /* Generate control character value. */
369 #define EQUAL(a, b) !strncmp(a, b, strlen(b))
370 #define EXTRA 4 /* Extra useful character definitions. */
372 #define INC { argc-- ; argv++ ; }
373 #define IS_KEY(v, n) (v == n)
377 #define LINT_CAST(arg) (arg ? 0 : 0)
379 #define LINT_CAST(arg) (arg)
383 #define MAXCMDS (int) CMD_DUMMY /* Max. no. of command line opts. */
384 #define MAX_DIGITS 41 /* Maximum displayable number of digits. */
386 /* Maximum number of various graphics pieces. */
387 #define MAXFCP 3 /* Max no of frames/canvases/pixwins. */
388 #define MAXHELP (int) H_DUMMY /* Max. no. help strings. */
389 #define MAXIMAGES 3 /* Maximum number of button images. */
390 #define MAXITEMS 8 /* Maximum number of panel items. */
391 #define MAXLABELS (int) L_DUMMY /* Max no. Motif label strings. */
392 #define MAXMENUS 13 /* Maximum number of popup menus. */
393 #define MAXMESS (int) MESS_DUMMY /* Max. no. message strings. */
394 #define MAXMPERRS (int) MP_DUMMY /* Max. no. MP error types. */
397 #define MAXLINE 256 /* Length of character strings. */
400 #define MAXBASES 4 /* Max. no. of numeric bases. */
401 #define MAXDISPMODES 3 /* Max. no. of display modes. */
402 #define MAXENTRIES 55 /* Max. no. of menu entries. */
403 #define MAXMODES 3 /* Max. no. of calculator modes. */
404 #define MAXOPTS (int) O_DUMMY /* Max. no. option types. */
405 #define MAXPSTRS (int) P_DUMMY /* Max. no. property strings. */
406 #define MAXREGS 10 /* Max. no. of memory registers. */
407 #define FINREGS 6 /* Max. no. of Fin. memory regs. */
408 #define MAXRESOURCES (int) R_DUMMY /* Max. number. of X resources. */
409 #define MAXSTACK 256 /* Parenthese stack size. */
410 #define MAXTRIGMODES 3 /* Max. no. of trig. modes. */
411 #define MAXUSAGE (int) U_DUMMY /* Max. no. usage strings. */
412 #define MAXVKEYS 6 /* No. of valid keys after error. */
413 #define MAXVMESS (int) V_DUMMY /* Max. no. various messages. */
415 #define MCOLS 8 /* No. of columns of "special" keys. */
416 #define MROWS 2 /* No. of rows of "special" keys. */
417 #define MODEKEYS MCOLS * MROWS
419 #define MAXCOLS BCOLS
420 #define MAXROWS BROWS
423 #define MIN(x,y) ((x) < (y) ? (x) : (y))
426 #define NOBUTTONS BROWS * BCOLS
429 #define RCNAME ".dtcalcrc"
432 #define TITEMS NOBUTTONS + EXTRA /* Total definitions. */
434 #ifndef TRUE /* Boolean definitions. */
442 typedef unsigned long BOOLEAN ;
445 char *str ; /* Button display string. */
446 char *str2 ; /* Button display string, with key. */
447 char value ; /* Unique button keyboard equivalent. */
448 enum op_type opdisp ; /* Is button selected during operation? */
449 enum menu_type mtype ; /* Type of popup menu (if any). */
450 char *resname ; /* Button resource name. */
451 void (*func)() ; /* Function to obey on button press. */
455 char *str ; /* Menu entry string to be displayed. */
456 char val ; /* Value when selected. */
460 char *title ; /* Menu title. */
461 int total ; /* Number of menu entries. */
462 int mindex ; /* Index into menu string array. */
463 int defval ; /* Default menu item position (from 1). */
466 struct calcVars { /* Calctool variables and options. */
467 char *appname ; /* Application name for resources. */
468 char con_names[MAXREGS][MAXLINE] ; /* Selectable constant names. */
469 char cur_op ; /* Current arithmetic operation. */
470 char current ; /* Current button/character pressed. */
471 char display[MAXLINE] ; /* Current calculator display. */
472 char *exp_posn ; /* Position of the exponent sign. */
473 char fnum[MAX_DIGITS+1] ; /* Scratchpad for fixed numbers. */
474 char fun_names[MAXREGS][MAXLINE] ; /* Function names from .dtcalcrc. */
475 char fun_vals[MAXREGS][MAXLINE] ; /* Function defs from .dtcalcrc. */
476 char *iconlabel ; /* The dtcalc icon label. */
477 char old_cal_value ; /* Previous calculation operator. */
478 char *progname ; /* Name of this program. */
479 char pstr[5] ; /* Current button text string. */
480 char *selection ; /* Current [Get] selection. */
481 char *shelf ; /* PUT selection shelf contents. */
482 char snum[MAX_DIGITS+1] ; /* Scratchpad for scientific numbers. */
483 char *titleline ; /* Value of titleline (if present). */
484 char *workspaces ; /* workspace names calc is in */
491 int MPcon_vals[MAXREGS][MP_SIZE] ; /* Selectable constants. */
492 int MPdebug ; /* If set, debug info. to stderr. */
493 int MPerrors ; /* If set, output errors to stderr. */
494 int MPdisp_val[MP_SIZE] ; /* Value of the current display. */
495 int MPlast_input[MP_SIZE] ; /* Previous number input by user. */
496 int MPmvals[MAXREGS][MP_SIZE] ; /* Memory register values. */
497 double MPfvals[FINREGS] ; /* Financial Memory register values. */
498 int *MPnumstack[MAXSTACK] ; /* Numeric stack for parens. */
499 int MPresult[MP_SIZE] ; /* Current calculator total value. */
500 int MPtresults[3][MP_SIZE] ; /* Current trigonometric results. */
502 enum base_type base ; /* Current base: BIN, OCT, DEC or HEX. */
503 enum fcp_type curwin ; /* Window current event occured in. */
504 enum fcp_type pending_win ; /* Window that pending op came from. */
505 enum mode_type modetype ; /* Current calculator mode. */
506 enum mode_type pending_mode ; /* Mode for pending op. */
507 enum num_type dtype ; /* Number display mode. */
508 enum trig_type ttype ; /* Trig. type (deg, grad or rad). */
509 BOOLEAN num_lock; /* Indicator of the state of NUM_LOCK */
510 int accuracy ; /* Number of digits precision (Max 9). */
511 int beep ; /* Indicates whether there is a beep sound on error. */
512 int column ; /* Column number of current key/mouse press. */
513 int cur_ch ; /* Current character if keyboard event. */
514 int error ; /* Indicates some kind of display error. */
515 int event_type ; /* Type of event being currently processed. */
516 int hasicon ; /* Set if user gave icon name on command line. */
517 int hyperbolic ; /* If set, trig functions will be hyperbolic. */
518 int iconic ; /* Set if window is currently iconic. */
519 int inverse ; /* If set, trig and log functions will be inversed. */
520 int ismenu ; /* Set when do_pending called via a popup menu. */
521 int key_exp ; /* Set if entering exponent number. */
522 int new_input ; /* New number input since last op. */
523 int noparens ; /* Count of left brackets still to be matched. */
524 int numsptr ; /* Pointer into the parenthese numeric stack. */
525 int opsptr ; /* Pointer into the parentheses operand stack. */
526 int opstack[MAXSTACK] ; /* Stack containing parentheses input. */
527 int pending ; /* Set for command depending on multiple presses. */
528 int pending_n ; /* Offset into function table for pending op. */
529 int pending_op ; /* Arithmetic operation for pending command. */
530 int pointed ; /* Whether a decimal point has been given. */
531 int row ; /* Row number of current key/mouse press. */
532 int rstate ; /* Indicates if memory register frame is displayed. */
533 int frstate ; /* Indicates if financial memory register
534 frame is displayed. */
535 int show_paren ; /* Set if we wish to show DISPLAYITEM during parens. */
536 int started ; /* Set just before window is displayed. */
537 int toclear ; /* Indicates if display should be cleared. */
538 int tstate ; /* Indicates current button set being displayed. */
539 int funstate ; /* whether the last key pressed was a fin. func. key*/
540 int defState ; /* Set when calculator has just been cleared */
547 typedef struct calcVars *Vars ;
549 /* Structure, resource definitions, for View's optional parameters. */
559 } ApplicationArgs, *ApplicationArgsPtr;
561 ApplicationArgs application_args;
563 /* MP definitions. */
565 #define C_abs(x) ((x) >= 0 ? (x) : -(x))
566 #define dabs(x) (double) C_abs(x)
567 #define min(a, b) ((a) <= (b) ? (a) : (b))
568 #define max(a, b) ((a) >= (b) ? (a) : (b))
569 #define dmax(a, b) (double) max(a, b)
570 #define dmin(a, b) (double) min(a, b)
572 BOOLEAN ibool P((double)) ;
573 BOOLEAN ibool2 P((double)) ;
575 char *convert P((char *)) ;
576 char *get_resource P((enum res_type)) ;
577 char *make_eng_sci P((int *)) ;
578 char *make_fixed P((int *, int)) ;
579 char *make_number P((int *, BOOLEAN)) ;
581 double mppow_di P((double *, int *)) ;
582 double mppow_ri P((float *, int *)) ;
583 double setbool P((BOOLEAN)) ;
585 int char_val P((int)) ;
586 int get_bool_resource P((enum res_type, int *)) ;
587 int get_index P((int)) ;
588 int get_int_resource P((enum res_type, int *)) ;
589 int get_str_resource P((enum res_type, char *)) ;
590 int main P((int, char **)) ;
593 void check_ow_beep P(()) ;
594 void clear_display P(()) ;
595 void doerr P((char *)) ;
596 void do_accuracy P(()) ;
597 void do_ascii P(()) ;
599 void set_base P(()) ;
600 void do_business P(()) ;
602 void do_dtcalc P((int, char **)) ;
603 void do_clear P(()) ;
604 void do_constant P(()) ;
605 void do_delete P(()) ;
606 void do_exchange P(()) ;
607 void do_expno P(()) ;
608 void do_factorial P((int *, int *)) ;
609 void do_frame P(()) ;
610 void do_function P(()) ;
611 void do_immed P(()) ;
615 void do_number P(()) ;
616 void do_numtype P(()) ;
617 void do_paren P(()) ;
618 void do_nothing P(()) ;
619 void do_pending P(()) ;
620 void do_point P(()) ;
621 void do_portion P(()) ;
622 double do_round P((double, int)) ;
623 void do_shift P(()) ;
624 void do_sto_rcl P(()) ;
626 void do_trigtype P(()) ;
627 void draw_button P((int, enum fcp_type, int, int, int)) ;
628 void get_display P(()) ;
629 void get_key_val P((char *, char *)) ;
630 void get_label P((int)) ;
631 void get_options P((int, char **)) ;
632 void getparam P((char *, char **, char *)) ;
633 void get_rcfile P((char *)) ;
634 void grey_button P((int, int, int)) ;
635 void grey_buttons P((enum base_type)) ;
636 void handle_menu_selection P((int, int)) ;
637 void handle_selection P(()) ;
638 void initialise P(()) ;
639 void init_cmdline_opts P(()) ;
640 void init_graphics P(()) ;
641 void init_options P(()) ;
642 void init_text P(()) ;
643 void init_vars P(()) ;
644 void key_init P(()) ;
645 void load_resources P(()) ;
646 void make_frames P(()) ;
647 void make_items P(()) ;
648 void make_modewin P(()) ;
649 void make_fin_registers P(()) ;
650 void make_registers P((int)) ;
651 void MPstr_to_num P((char *, enum base_type, int *)) ;
652 void paren_disp P((int)) ;
653 void process_event P((int)) ;
654 void process_item P((int)) ;
655 void process_parens P((int)) ;
656 void process_stack P((int, int, int)) ;
657 void process_str P((char *, enum menu_type)) ;
658 void push_num P((int *)) ;
659 void push_op P((int)) ;
660 void put_resource P((enum res_type, char *)) ;
661 void read_rcfiles P(()) ;
662 void read_resources P(()) ;
663 void redraw_buttons P(()) ;
664 void save_cmdline P((int, char **)) ;
665 void save_pending_values P((int)) ;
666 void save_resources P((char *)) ;
667 void blank_display P(()) ;
668 void set_item P((enum item_type, char *)) ;
669 void set_title P((enum fcp_type, char *)) ;
670 void show_ascii_frame P(()) ;
671 void show_display P((int *)) ;
673 void start_tool P(()) ;
674 void switch_hands P((int)) ;
675 void usage P((char *)) ;
676 void win_display P((enum fcp_type, int)) ;
677 void write_cmdline P(()) ;
678 void write_rcfile P((enum menu_type, int, int, char *, char *)) ;
679 void write_resources P((char *)) ;
680 void RestoreSession P(()) ;
681 void TimerEvent P(( XtPointer, XtIntervalId *)) ;
682 void ErrDialog P(( char *, Widget ));
684 /* MP routines not found in the Brent FORTRAN package. */
685 void mpacos P((int *, int *)) ;
686 void mpacosh P((int *, int *)) ;
687 void mpasinh P((int *, int *)) ;
688 void mpatanh P((int *, int *)) ;
689 void mplog10 P((int *, int *)) ;
691 /* Brent MP routines in mp.c. */
692 int mpcmpi P((int *, int *)) ;
693 int mpcmpr P((int *, float *)) ;
694 int mpcomp P((int *, int *)) ;
695 int pow_ii P((int *, int *)) ;
697 int mpeq P((int *, int *)) ;
698 int mpge P((int *, int *)) ;
699 int mpgt P((int *, int *)) ;
700 int mple P((int *, int *)) ;
701 int mplt P((int *, int *)) ;
703 void mpabs P((int *, int *)) ;
704 void mpadd P((int *, int *, int *)) ;
705 void mpadd2 P((int *, int *, int *, int *, int *)) ;
706 void mpadd3 P((int *, int *, int *, int *, int *)) ;
707 void mpaddi P((int *, int *, int *)) ;
708 void mpaddq P((int *, int *, int *, int *)) ;
709 void mpart1 P((int *, int *)) ;
710 void mpasin P((int *, int *)) ;
711 void mpatan P((int *, int *)) ;
712 void mpcdm P((double *, int *)) ;
713 void mpchk P((int *, int *)) ;
714 void mpcim P((int *, int *)) ;
715 void mpcmd P((int *, double *)) ;
716 void mpcmf P((int *, int *)) ;
717 void mpcmi P((int *, int *)) ;
718 void mpcmim P((int *, int *)) ;
719 void mpcmr P((int *, float *)) ;
720 void mpcos P((int *, int *)) ;
721 void mpcosh P((int *, int *)) ;
722 void mpcqm P((int *, int *, int *)) ;
723 void mpcrm P((float *, int *)) ;
724 void mpdiv P((int *, int *, int *)) ;
725 void mpdivi P((int *, int *, int *)) ;
727 void mpexp P((int *, int *)) ;
728 void mpexp1 P((int *, int *)) ;
729 void mpext P((int *, int *, int *)) ;
730 void mpgcd P((int *, int *)) ;
731 void mpln P((int *, int *)) ;
732 void mplns P((int *, int *)) ;
733 void mpmaxr P((int *)) ;
734 void mpmlp P((int *, int *, int *, int *)) ;
735 void mpmul P((int *, int *, int *)) ;
736 void mpmul2 P((int *, int *, int *, int *)) ;
737 void mpmuli P((int *, int *, int *)) ;
738 void mpmulq P((int *, int *, int *, int *)) ;
739 void mpneg P((int *, int *)) ;
740 void mpnzr P((int *, int *, int *, int *)) ;
741 void mpovfl P((int *)) ;
742 void mppi P((int *)) ;
743 void mppwr P((int *, int *, int *)) ;
744 void mppwr2 P((int *, int *, int *)) ;
745 void mprec P((int *, int *)) ;
746 void mproot P((int *, int *, int *)) ;
747 void mpset P((int *, int *, int *)) ;
748 void mpsin P((int *, int *)) ;
749 void mpsin1 P((int *, int *, int *)) ;
750 void mpsinh P((int *, int *)) ;
751 void mpsqrt P((int *, int *)) ;
752 void mpstr P((int *, int *)) ;
753 void mpsub P((int *, int *, int *)) ;
754 void mptanh P((int *, int *)) ;
755 void mpunfl P((int *)) ;
758 void Help P((char *, char *)) ;
759 void HelpRequestCB P(()) ;
760 void HelpModeCB P(()) ;
761 void HelpCloseCB P(()) ;
762 void HelpHyperlinkCB P(()) ;
763 void DisplayHelp P((char *, char *)) ;
764 void CenterMsgCB P(()) ;
765 void HelpHelp P(()) ;
766 void SetWmHnts P(()) ;
768 void _DtmapCB P((Widget, XtPointer, XtPointer)) ;
770 void set_option_menu P((int, int)) ;