1 /* 2 3 Copyright (c) 1989 X Consortium 4 5 Permission is hereby granted, free of charge, to any person obtaining 6 a copy of this software and associated documentation files (the 7 "Software"), to deal in the Software without restriction, including 8 without limitation the rights to use, copy, modify, merge, publish, 9 distribute, sublicense, and/or sell copies of the Software, and to 10 permit persons to whom the Software is furnished to do so, subject to 11 the following conditions: 12 13 The above copyright notice and this permission notice shall be included 14 in all copies or substantial portions of the Software. 15 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 OTHER DEALINGS IN THE SOFTWARE. 23 24 Except as contained in this notice, the name of the X Consortium shall 25 not be used in advertising or otherwise to promote the sale, use or 26 other dealings in this Software without prior written authorization 27 from the X Consortium. 28 29 */ 30 31 /* 32 * xcalc.h - symbolic constants for xcalc 33 * 34 * Author: Donna Converse, MIT X Consortium 35 */ 36 37 #ifndef _XCALC_H_ 38 #define _XCALC_H_ 39 40 #ifdef HAVE_CONFIG_H 41 # include "config.h" 42 #endif 43 44 #include <X11/Intrinsic.h> 45 #include <X11/StringDefs.h> 46 47 #include <stdio.h> 48 #include <X11/Xos.h> 49 #include <math.h> 50 #include <signal.h> 51 #if !defined(IEEE) && defined(SVR4) 52 #include <siginfo.h> 53 #endif 54 #include <setjmp.h> 55 #include <errno.h> 56 #include <X11/Xlocale.h> 57 58 #define kRECIP 0 /* reciprocal */ 59 #define kSQR 1 /* square */ 60 #define kSQRT 2 /* square root */ 61 #define kCLR 3 /* clear */ 62 #define kOFF 4 /* clear and quit */ 63 #define kINV 5 /* inverse */ 64 #define kSIN 6 /* sine */ 65 #define kCOS 7 /* cosine */ 66 #define kTAN 8 /* tangent */ 67 #define kDRG 9 /* degree radian grad */ 68 #define kE 10 /* the natural number e */ 69 #define kEE 11 /* scientific notation */ 70 #define kLOG 12 /* logarithm */ 71 #define kLN 13 /* natural logarithm */ 72 #define kPOW 14 /* power */ 73 #define kPI 15 /* pi */ 74 #define kFACT 16 /* factorial */ 75 #define kLPAR 17 /* left paren */ 76 #define kRPAR 18 /* right paren */ 77 #define kDIV 19 /* division */ 78 #define kSTO 20 /* store */ 79 #define kSEVEN 21 /* 7 */ 80 #define kEIGHT 22 /* 8 */ 81 #define kNINE 23 /* 9 */ 82 #define kMUL 24 /* multiplication */ 83 #define kRCL 25 /* recall */ 84 #define kFOUR 26 /* 4 */ 85 #define kFIVE 27 /* 5 */ 86 #define kSIX 28 /* 6 */ 87 #define kSUB 29 /* subtraction */ 88 #define kSUM 30 /* summation */ 89 #define kONE 31 /* 1 */ 90 #define kTWO 32 /* 2 */ 91 #define kTHREE 33 /* 3 */ 92 #define kADD 34 /* addition */ 93 #define kEXC 35 /* exchange display and memory */ 94 #define kZERO 36 /* 0 */ 95 #define kDEC 37 /* decimal point */ 96 #define kNEG 38 /* negation */ 97 #define kEQU 39 /* equals */ 98 #define kENTR 40 /* enter */ 99 #define kXXY 41 /* exchange X and Y registers */ 100 #define kEXP 42 /* exponent */ 101 #define k10X 43 /* 10 raised to a power */ 102 #define kROLL 44 /* roll stack */ 103 #define kNOP 45 /* no operation */ 104 #define kBKSP 46 /* backspace */ 105 #define kAND 47 /* bitwise and */ 106 #define kBASE 48 /* base conversion */ 107 #define kMOD 49 /* modulus */ 108 #define kNOT 50 /* bitwise not (ones compliment) */ 109 #define kOR 51 /* bitwise or */ 110 #define kSHL 52 /* arithmetic shift left */ 111 #define kSHR 53 /* arithmetic shift right */ 112 #define kXOR 54 /* bitwise xor */ 113 #define kTRUNC 55 /* truncate to integer */ 114 #define kxA 56 /* 0xa */ 115 #define kxB 57 /* 0xb */ 116 #define kxC 58 /* 0xc */ 117 #define kxD 59 /* 0xd */ 118 #define kxE 60 /* 0xe */ 119 #define kxF 61 /* 0xf */ 120 121 #define XCalc_MEMORY 0 /* memory indicator */ 122 #define XCalc_INVERSE 1 /* inverse function indicator */ 123 #define XCalc_DEGREE 2 /* degree indicator */ 124 #define XCalc_RADIAN 3 /* radian indicator */ 125 #define XCalc_GRADAM 4 /* grad indicator */ 126 #define XCalc_PAREN 5 /* parenthesis indicator */ 127 #define XCalc_HEX 6 /* hexadecimal (base 16) indicator */ 128 #define XCalc_DEC 7 /* decimal (base 10) indicator */ 129 #define XCalc_OCT 8 /* octal (base 8) indicator */ 130 131 /* actions.c */ 132 extern XtActionsRec Actions[]; 133 extern int ActionsCount; 134 135 /* math.c */ 136 extern void fperr(int sig) _X_NORETURN; 137 extern void illerr(int sig) _X_NORETURN; 138 extern void fail_op(void); 139 extern int pre_op(int keynum); 140 extern void post_op(void); 141 142 extern void change_base(void); 143 extern void numeric(int keynum); 144 extern void bkspf(void); 145 extern void decf(void); 146 extern void eef(void); 147 extern void clearf(void); 148 extern void negf(void); 149 extern void twoop(int keynum); 150 extern void twof(int keynum); 151 extern void entrf(void); 152 extern void equf(void); 153 extern void lparf(void); 154 extern void rollf(void); 155 extern void rparf(void); 156 extern void drgf(void); 157 extern void invf(void); 158 extern void memf(int keynum); 159 extern void oneop(int keynum); 160 extern void offf(void); 161 extern void ResetCalc(void); 162 163 #ifndef IEEE 164 extern jmp_buf env; 165 #endif 166 167 /* xcalc.c */ 168 extern void do_select(Time time); 169 extern void draw(char *string); 170 extern void Quit(void) _X_NORETURN; 171 extern void ringbell(void); 172 extern void setflag(int indicator, Boolean on); 173 174 extern int rpn; 175 #define LCD_STR_LEN 32 176 extern char dispstr[LCD_STR_LEN]; 177 extern Atom wm_delete_window; 178 179 #endif 180