xcalc.h revision 2256ab8c
1/* 2 3Copyright (c) 1989 X Consortium 4 5Permission is hereby granted, free of charge, to any person obtaining 6a copy of this software and associated documentation files (the 7"Software"), to deal in the Software without restriction, including 8without limitation the rights to use, copy, modify, merge, publish, 9distribute, sublicense, and/or sell copies of the Software, and to 10permit persons to whom the Software is furnished to do so, subject to 11the following conditions: 12 13The above copyright notice and this permission notice shall be included 14in all copies or substantial portions of the Software. 15 16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 20OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22OTHER DEALINGS IN THE SOFTWARE. 23 24Except as contained in this notice, the name of the X Consortium shall 25not be used in advertising or otherwise to promote the sale, use or 26other dealings in this Software without prior written authorization 27from 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 */ 132extern XtActionsRec Actions[]; 133extern int ActionsCount; 134 135/* math.c */ 136extern void fperr(int sig) _X_NORETURN; 137extern void illerr(int sig) _X_NORETURN; 138extern void fail_op(void); 139extern int pre_op(int keynum); 140extern void post_op(void); 141 142extern void change_base(void); 143extern void numeric(int keynum); 144extern void bkspf(void); 145extern void decf(void); 146extern void eef(void); 147extern void clearf(void); 148extern void negf(void); 149extern void twoop(int keynum); 150extern void twof(int keynum); 151extern void entrf(void); 152extern void equf(void); 153extern void lparf(void); 154extern void rollf(void); 155extern void rparf(void); 156extern void drgf(void); 157extern void invf(void); 158extern void memf(int keynum); 159extern void oneop(int keynum); 160extern void offf(void); 161extern void ResetCalc(void); 162 163#ifndef IEEE 164extern jmp_buf env; 165#endif 166 167/* xcalc.c */ 168extern void do_select(Time time); 169extern void draw(char *string); 170extern void Quit(void) _X_NORETURN; 171extern void ringbell(void); 172extern void setflag(int indicator, Boolean on); 173 174extern int rpn; 175#define LCD_STR_LEN 32 176extern char dispstr[LCD_STR_LEN]; 177extern Atom wm_delete_window; 178 179#endif 180