From: Mapi B. <ma...@us...> - 2008-05-26 20:08:17
|
Update of /cvsroot/easycalc/PPCport In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv13982 Added Files: ansops.h calcrsc.h chkstack.h core_display.cpp core_display.h core_globals.cpp core_globals.h core_main.cpp core_main.h core_tables.h DataManager.cpp DataManager.h dbutil.cpp EasyCalc.cpp EasyCalc.h Log Message: 1st upload, not compiling. --- NEW FILE: core_globals.h --- /***************************************************************************** * EasyCalc -- a scientific calculator * Copyright (C) 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ #ifndef CORE_GLOBALS_H #define CORE_GLOBALS_H 1 //#include "EasyCalc.h" /**********/ /* Errors */ /**********/ #define ERR_NONE 0 #define ERR_ALPHA_DATA_IS_INVALID 1 #define ERR_INSUFFICIENT_MEMORY 2 #define ERR_NOT_YET_IMPLEMENTED 3 #define ERR_OUT_OF_RANGE 4 #define ERR_DIVIDE_BY_0 5 #define ERR_INVALID_TYPE 6 #define ERR_INVALID_DATA 7 #define ERR_DIMENSION_ERROR 8 #define ERR_SIZE_ERROR 9 #define ERR_INTERNAL_ERROR 10 #define ERR_NONEXISTENT 11 #define ERR_RESTRICTED_OPERATION 12 #define ERR_YES 13 #define ERR_NO 14 #define ERR_STOP 15 #define ERR_LABEL_NOT_FOUND 16 #define ERR_NO_REAL_VARIABLES 17 #define ERR_NO_COMPLEX_VARIABLES 18 #define ERR_NO_MATRIX_VARIABLES 19 #define ERR_NO_MENU_VARIABLES 20 #define ERR_STAT_MATH_ERROR 21 #define ERR_INVALID_FORECAST_MODEL 22 #define ERR_SOLVE_INTEG_RTN_LOST 23 #define ERR_SINGULAR_MATRIX 24 #define ERR_SOLVE_SOLVE 25 #define ERR_INTEG_INTEG 26 #define ERR_RUN 27 #define ERR_INTERRUPTED 28 #define ERR_PRINTING_IS_DISABLED 29 #define ERR_INTERRUPTIBLE 30 #define ERR_NO_VARIABLES 31 /*************/ /* Key codes */ /*************/ #define NB_KEYS 37 #define KEY_SIGMA 1 #define KEY_INV 2 #define KEY_SQRT 3 #define KEY_LOG 4 #define KEY_LN 5 #define KEY_XEQ 6 #define KEY_STO 7 #define KEY_RCL 8 #define KEY_RDN 9 #define KEY_SIN 10 #define KEY_COS 11 #define KEY_TAN 12 #define KEY_ENTER 13 #define KEY_SWAP 14 #define KEY_CHS 15 #define KEY_E 16 #define KEY_BSP 17 #define KEY_UP 18 #define KEY_7 19 #define KEY_8 20 #define KEY_9 21 #define KEY_DIV 22 #define KEY_DOWN 23 #define KEY_4 24 #define KEY_5 25 #define KEY_6 26 #define KEY_MUL 27 #define KEY_SHIFT 28 #define KEY_1 29 #define KEY_2 30 #define KEY_3 31 #define KEY_SUB 32 #define KEY_EXIT 33 #define KEY_0 34 #define KEY_DOT 35 #define KEY_RUN 36 #define KEY_ADD 37 /*********************/ /* Annunciator codes */ /*********************/ #define NB_ANNUN 12 #define ANN_SHIFT 0 #define ANN_DEG 1 #define ANN_RAD 2 #define ANN_GRAD 3 #define ANN_DEC 4 #define ANN_OCT 5 #define ANN_BIN 6 #define ANN_HEX 7 #define ANN_S1 8 #define ANN_S2 9 #define ANN_S3 10 #define ANN_SG 11 /*********************/ /* Annunciator value */ /*********************/ #define ANNVAL_UNCH -1 #define ANNVAL_DEG 0 #define ANNVAL_RAD 1 #define ANNVAL_GRAD 2 #define ANNVAL_DEC 0 #define ANNVAL_OCT 1 #define ANNVAL_BIN 2 #define ANNVAL_HEX 3 #define ANNVAL_S1 0 #define ANNVAL_S2 1 #define ANNVAL_S3 2 #define ANNVAL_SG 3 /*********/ /* Menus */ /*********/ #define MENU_NONE -1 #define MENU_SHORTCUT -2 #define MENU_ALPHA1 0 #define MENU_ALPHA2 1 #define MENU_ALPHA_ABCDE1 2 #define MENU_ALPHA_ABCDE2 3 #define MENU_ALPHA_FGHI 4 #define MENU_ALPHA_JKLM 5 #define MENU_ALPHA_NOPQ1 6 #define MENU_ALPHA_NOPQ2 7 #define MENU_ALPHA_RSTUV1 8 #define MENU_ALPHA_RSTUV2 9 #define MENU_ALPHA_WXYZ 10 #define MENU_ALPHA_PAREN 11 #define MENU_ALPHA_ARROW 12 #define MENU_ALPHA_COMP 13 #define MENU_ALPHA_MATH 14 #define MENU_ALPHA_PUNC1 15 #define MENU_ALPHA_PUNC2 16 #define MENU_ALPHA_MISC1 17 #define MENU_ALPHA_MISC2 18 #define MENU_ST 19 #define MENU_IND_ST 20 #define MENU_IND 21 #define MENU_MODES1 22 #define MENU_MODES2 23 #define MENU_DISP 24 #define MENU_CLEAR1 25 #define MENU_CLEAR2 26 #define MENU_CONVERT1 27 #define MENU_CONVERT2 28 #define MENU_FLAGS 29 #define MENU_PROB 30 #define MENU_CUSTOM1 31 #define MENU_CUSTOM2 32 #define MENU_CUSTOM3 33 #define MENU_PGM_FCN1 34 #define MENU_PGM_FCN2 35 #define MENU_PGM_FCN3 36 #define MENU_PGM_FCN4 37 #define MENU_PGM_XCOMP0 38 #define MENU_PGM_XCOMPY 39 #define MENU_PRINT1 40 #define MENU_PRINT2 41 #define MENU_PRINT3 42 #define MENU_TOP_FCN 43 #define MENU_CATALOG 44 #define MENU_BLANK 45 #define MENU_PROGRAMMABLE 46 #define MENU_VARMENU 47 #define MENU_STAT1 48 #define MENU_STAT2 49 #define MENU_STAT_CFIT 50 #define MENU_STAT_MODL 51 #define MENU_MATRIX1 52 #define MENU_MATRIX2 53 #define MENU_MATRIX3 54 #define MENU_MATRIX_SIMQ 55 #define MENU_MATRIX_EDIT1 56 #define MENU_MATRIX_EDIT2 57 #define MENU_BASE 58 #define MENU_BASE_A_THRU_F 59 #define MENU_BASE_LOGIC 60 #define MENU_SOLVE 61 #define MENU_INTEG 62 #define MENU_INTEG_PARAMS 63 /***********************/ /* Variable data types */ /***********************/ /******************/ /* Emulator state */ /******************/ /* FLAGS * Note: flags whose names start with VIRTUAL_ are named here for reference * only; they are actually handled by virtual_flag_handler(). Setting or * clearing them in 'flags' has no effect. * Flags whose names are the letter 'f' followed by two digits have no * specified meaning according to the HP-42S manual; they are either user flags * or reserved. */ typedef union { char farray[100]; struct { char audio_enable; } f; } flags_struct; extern flags_struct flags; /****************/ /* More globals */ /****************/ extern int pending_command; extern bool mode_shift; extern bool mode_running; extern int (*mode_interruptible)(int); extern bool mode_stoppable; extern bool mode_getkey; extern int remove_program_catalog; extern int mode_plainmenu; extern int mode_transientmenu; /* Keystroke buffer - holds keystrokes received while * there is a program running. */ extern int keybuf_head; extern int keybuf_tail; extern int keybuf[16]; /*********************/ /* Utility functions */ /*********************/ #endif --- NEW FILE: ansops.h --- /* * $Id: ansops.h,v 1.1 2008/05/26 20:08:14 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 2000 Ondrej Palkovsky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * You can contact me at 'on...@pe...'. */ #ifndef _ANSOPS_H_ #define _ANSOPS_H_ void ans_guess() IFACE; void ans_redisplay(char *text) IFACE; #endif --- NEW FILE: core_tables.h --- /***************************************************************************** * EasyCalc -- a scientific calculator * Copyright (C) 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ #ifndef CORE_TABLES_H #define CORE_TABLES_H 1 /************/ /* Commands */ /************/ /* These are indices into the cmdlist array, * declared below (except the negative ones!) */ #define CMD_NONE -1 #define CMD_CANCELLED -2 #define CMD_LINGER1 -3 #define CMD_LINGER2 -4 #define CMD_CLX 0 #define CMD_ENTER 1 #define CMD_SWAP 2 #define CMD_RDN 3 #define CMD_CHS 4 #define CMD_DIV 5 #define CMD_MUL 6 #define CMD_SUB 7 #define CMD_ADD 8 #define CMD_LASTX 9 #define CMD_SILENT_OFF 10 #define CMD_SILENT_ON 11 #define CMD_SIN 12 #define CMD_COS 13 #define CMD_TAN 14 #define CMD_ASIN 15 #define CMD_ACOS 16 #define CMD_ATAN 17 #define CMD_LOG 18 #define CMD_10_POW_X 19 #define CMD_LN 20 #define CMD_E_POW_X 21 #define CMD_SQRT 22 #define CMD_SQUARE 23 #define CMD_INV 24 #define CMD_Y_POW_X 25 #define CMD_PERCENT 26 #define CMD_PI 27 #define CMD_COMPLEX 28 #define CMD_STO 29 #define CMD_STO_DIV 30 #define CMD_STO_MUL 31 #define CMD_STO_SUB 32 #define CMD_STO_ADD 33 #define CMD_RCL 34 #define CMD_RCL_DIV 35 #define CMD_RCL_MUL 36 #define CMD_RCL_SUB 37 #define CMD_RCL_ADD 38 #define CMD_FIX 39 #define CMD_SCI 40 #define CMD_ENG 41 #define CMD_ALL 42 #define CMD_NULL 43 #define CMD_ASTO 44 #define CMD_ARCL 45 #define CMD_CLA 46 #define CMD_DEG 47 #define CMD_RAD 48 #define CMD_GRAD 49 #define CMD_RECT 50 #define CMD_POLAR 51 #define CMD_SIZE 52 #define CMD_QUIET 53 #define CMD_CPXRES 54 #define CMD_REALRES 55 #define CMD_KEYASN 56 #define CMD_LCLBL 57 #define CMD_RDXDOT 58 #define CMD_RDXCOMMA 59 #define CMD_CLSIGMA 60 #define CMD_CLP 61 #define CMD_CLV 62 #define CMD_CLST 63 #define CMD_CLRG 64 #define CMD_DEL 65 #define CMD_CLKEYS 66 #define CMD_CLLCD 67 #define CMD_CLMENU 68 #define CMD_CLALLa 69 #define CMD_TO_DEG 70 #define CMD_TO_RAD 71 #define CMD_TO_HR 72 #define CMD_TO_HMS 73 #define CMD_TO_REC 74 #define CMD_TO_POL 75 #define CMD_IP 76 #define CMD_FP 77 #define CMD_RND 78 #define CMD_ABS 79 #define CMD_SIGN 80 #define CMD_MOD 81 #define CMD_SF 82 #define CMD_CF 83 #define CMD_FS_T 84 #define CMD_FC_T 85 #define CMD_FSC_T 86 #define CMD_FCC_T 87 #define CMD_COMB 88 #define CMD_PERM 89 #define CMD_FACT 90 #define CMD_GAMMA 91 #define CMD_RAN 92 #define CMD_SEED 93 #define CMD_LBL 94 #define CMD_RTN 95 #define CMD_INPUT 96 #define CMD_VIEW 97 #define CMD_AVIEW 98 #define CMD_XEQ 99 #define CMD_PROMPT 100 #define CMD_PSE 101 #define CMD_ISG 102 #define CMD_DSE 103 #define CMD_AIP 104 #define CMD_XTOA 105 #define CMD_AGRAPH 106 #define CMD_PIXEL 107 #define CMD_BEEP 108 #define CMD_TONE 109 #define CMD_MVAR 110 #define CMD_VARMENU 111 #define CMD_GETKEY 112 #define CMD_MENU 113 #define CMD_KEYG 114 #define CMD_KEYX 115 #define CMD_X_EQ_0 116 #define CMD_X_NE_0 117 #define CMD_X_LT_0 118 #define CMD_X_GT_0 119 #define CMD_X_LE_0 120 #define CMD_X_GE_0 121 #define CMD_X_EQ_Y 122 #define CMD_X_NE_Y 123 #define CMD_X_LT_Y 124 #define CMD_X_GT_Y 125 #define CMD_X_LE_Y 126 #define CMD_X_GE_Y 127 #define CMD_PRSIGMA 128 #define CMD_PRP 129 #define CMD_PRV 130 #define CMD_PRSTK 131 #define CMD_PRA 132 #define CMD_PRX 133 #define CMD_PRUSR 134 #define CMD_LIST 135 #define CMD_ADV 136 #define CMD_PRLCD 137 #define CMD_DELAY 138 #define CMD_PON 139 #define CMD_POFF 140 #define CMD_MAN 141 #define CMD_NORM 142 #define CMD_TRACE 143 #define CMD_SIGMAADD 144 #define CMD_SIGMASUB 145 #define CMD_GTO 146 #define CMD_END 147 #define CMD_NUMBER 148 #define CMD_STRING 149 #define CMD_RUN 150 #define CMD_SST 151 #define CMD_GTODOT 152 #define CMD_GTODOTDOT 153 #define CMD_STOP 154 #define CMD_NEWMAT 155 #define CMD_RUP 156 #define CMD_REAL_T 157 #define CMD_CPX_T 158 #define CMD_STR_T 159 #define CMD_MAT_T 160 #define CMD_DIM_T 161 #define CMD_ASSIGNa 162 #define CMD_ASSIGNb 163 #define CMD_ASGN01 164 #define CMD_ASGN02 165 #define CMD_ASGN03 166 #define CMD_ASGN04 167 #define CMD_ASGN05 168 #define CMD_ASGN06 169 #define CMD_ASGN07 170 #define CMD_ASGN08 171 #define CMD_ASGN09 172 #define CMD_ASGN10 173 #define CMD_ASGN11 174 #define CMD_ASGN12 175 #define CMD_ASGN13 176 #define CMD_ASGN14 177 #define CMD_ASGN15 178 #define CMD_ASGN16 179 #define CMD_ASGN17 180 #define CMD_ASGN18 181 #define CMD_ON 182 #define CMD_OFF 183 #define CMD_KEY1G 184 #define CMD_KEY2G 185 #define CMD_KEY3G 186 #define CMD_KEY4G 187 #define CMD_KEY5G 188 #define CMD_KEY6G 189 #define CMD_KEY7G 190 #define CMD_KEY8G 191 #define CMD_KEY9G 192 #define CMD_KEY1X 193 #define CMD_KEY2X 194 #define CMD_KEY3X 195 #define CMD_KEY4X 196 #define CMD_KEY5X 197 #define CMD_KEY6X 198 #define CMD_KEY7X 199 #define CMD_KEY8X 200 #define CMD_KEY9X 201 #define CMD_VMEXEC 202 #define CMD_VMSTO 203 #define CMD_SIGMAREG 204 #define CMD_SIGMAREG_T 205 #define CMD_CLD 206 #define CMD_ACOSH 207 #define CMD_ALENG 208 #define CMD_ALLSIGMA 209 #define CMD_AND 210 #define CMD_AOFF 211 #define CMD_AON 212 #define CMD_AROT 213 #define CMD_ASHF 214 #define CMD_ASINH 215 #define CMD_ATANH 216 #define CMD_ATOX 217 #define CMD_BASEADD 218 #define CMD_BASESUB 219 #define CMD_BASEMUL 220 #define CMD_BASEDIV 221 #define CMD_BASECHS 222 #define CMD_BEST 223 #define CMD_BINM 224 #define CMD_BIT_T 225 #define CMD_BST 226 #define CMD_CORR 227 #define CMD_COSH 228 #define CMD_CROSS 229 #define CMD_CUSTOM 230 #define CMD_DECM 231 #define CMD_DELR 232 #define CMD_DET 233 #define CMD_DIM 234 #define CMD_DOT 235 #define CMD_EDIT 236 #define CMD_EDITN 237 #define CMD_EXITALL 238 #define CMD_EXPF 239 #define CMD_E_POW_X_1 240 #define CMD_FCSTX 241 #define CMD_FCSTY 242 #define CMD_FNRM 243 #define CMD_GETM 244 #define CMD_GROW 245 #define CMD_HEXM 246 #define CMD_HMSADD 247 #define CMD_HMSSUB 248 #define CMD_I_ADD 249 #define CMD_I_SUB 250 #define CMD_INDEX 251 #define CMD_INSR 252 #define CMD_INTEG 253 #define CMD_INVRT 254 #define CMD_J_ADD 255 #define CMD_J_SUB 256 #define CMD_LINF 257 #define CMD_LINSIGMA 258 #define CMD_LN_1_X 259 #define CMD_LOGF 260 #define CMD_MEAN 261 #define CMD_NOT 262 #define CMD_OCTM 263 #define CMD_OLD 264 #define CMD_OR 265 #define CMD_PGMSLV 266 #define CMD_PGMINT 267 #define CMD_POSA 268 #define CMD_PUTM 269 #define CMD_PWRF 270 #define CMD_RCLEL 271 #define CMD_RCLIJ 272 #define CMD_RNRM 273 #define CMD_ROTXY 274 #define CMD_RSUM 275 #define CMD_SWAP_R 276 #define CMD_SDEV 277 #define CMD_SINH 278 #define CMD_SLOPE 279 #define CMD_SOLVE 280 #define CMD_STOEL 281 #define CMD_STOIJ 282 #define CMD_SUM 283 #define CMD_TANH 284 #define CMD_TRANS 285 #define CMD_UVEC 286 #define CMD_WMEAN 287 #define CMD_WRAP 288 #define CMD_X_SWAP 289 #define CMD_XOR 290 #define CMD_YINT 291 #define CMD_TO_DEC 292 #define CMD_TO_OCT 293 #define CMD_LEFT 294 #define CMD_UP 295 #define CMD_DOWN 296 #define CMD_RIGHT 297 #define CMD_PERCENT_CH 298 #define CMD_SIMQ 299 #define CMD_MATA 300 #define CMD_MATB 301 #define CMD_MATX 302 #define CMD_GOTOROW 303 #define CMD_GOTOCOLUMN 304 #define CMD_A_THRU_F 305 #define CMD_CLALLb 306 #define CMD_PGMSLVi 307 #define CMD_PGMINTi 308 #define CMD_VMSTO2 309 #define CMD_VMSOLVE 310 #define CMD_MAX 311 #define CMD_MIN 312 #define CMD_FIND 313 #define CMD_XROM 314 #define CMD_SENTINEL 315 /* command_spec.argtype */ #define ARG_NONE 0 /* No argument */ #define ARG_VAR 1 /* Variable: num, stk, var, ind */ #define ARG_REAL 2 /* Variable: num, stk, var, ind; real scalars only */ #define ARG_NAMED 3 /* Variable: var, ind */ #define ARG_NUM9 4 /* num (0..9), ind */ #define ARG_NUM11 5 /* num (0..11), ind */ #define ARG_NUM99 6 /* num (0..99), ind */ #define ARG_COUNT 7 /* numeric-only (SIMQ, DEL, SIZE, LIST) */ #define ARG_LBL 8 /* Label: num, lclbl, global, ind */ #define ARG_CKEY 9 /* Key in custom menu */ #define ARG_MKEY 10 /* Key in programmable menu (KEYG/KEYX) */ #define ARG_PRGM 11 /* Alpha label (CATSECT_PGM) */ #define ARG_RVAR 12 /* Variable (real only) (MVAR, INTEG, SOLVE) */ #define ARG_MAT 13 /* Variable (matrix only) (EDITN, INDEX) */ #define ARG_OTHER 14 /* Weirdos */ /* command_spec.flags */ #define FLAG_NONE 0 /* Boring! */ #define FLAG_PRGM_ONLY 1 /* Only allowed in program mode (LBL, DEL, ...) */ #define FLAG_IMMED 2 /* Executes in program mode (DEL, GTO.nnn, ...) */ #define FLAG_HIDDEN 4 /* Cannot be activated using XEQ "NAME" (SIMQ, ...) */ #define FLAG_NO_PRGM 8 /* Cannot be programmed (SIMQ, MATA, ...) */ #define FLAG_NO_SHOW 16 /* Do not show after keytimeout1 */ /* Builtin cmd arg types */ /* These represent data types used when a command * is executing. Compare the ARG_ macros; those * represent the data types that a command is *capable* * of accepting, and are used during command entry. */ #define ARGTYPE_NONE 0 #define ARGTYPE_NUM 1 #define ARGTYPE_NEG_NUM 2 /* Used internally */ #define ARGTYPE_STK 3 #define ARGTYPE_STR 4 #define ARGTYPE_IND_NUM 5 #define ARGTYPE_IND_STK 6 #define ARGTYPE_IND_STR 7 #define ARGTYPE_COMMAND 8 /* For backward compatibility only! */ #define ARGTYPE_LCLBL 9 #define ARGTYPE_DOUBLE 10 #define ARGTYPE_LBLINDEX 11 #define phloat float typedef struct { unsigned char type; unsigned char length; int4 target; union { int4 num; char text[15]; char stk; int cmd; /* For backward compatibility only! */ char lclbl; } val; // This used to be a member of the 'val' union, but once I changed it // from 'double' to 'phloat', that was no longer possible. phloat val_d; } arg_struct; typedef struct { char name[12]; int name_length; int (*handler)(arg_struct *arg); uint4 hp42s_code; int argtype; int flags; } command_spec; const command_spec *cmdlist(int index) TABLES_SECT; #endif --- NEW FILE: EasyCalc.h --- #pragma once #ifdef POCKETPC2003_UI_MODEL #include "resourceppc.h" #endif /***************************************************************************** * EasyCalc -- a scientific calculator * Copyright (C) 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ #ifndef EASYCALC_H #define EASYCALC_H 1 #ifndef BCD_MATH #include <math.h> #endif #define SHELL1_SECT #define SHELL2_SECT #define FILESYS_SECT #define MAIN_SECT #define COMMANDS1_SECT #define COMMANDS2_SECT #define COMMANDS3_SECT #define COMMANDS4_SECT #define COMMANDS5_SECT #define COMMANDS6_SECT #define DISPLAY_SECT #define GLOBALS_SECT #define HELPERS_SECT #define KEYDOWN_SECT #define LINALG1_SECT #define LINALG2_SECT #define MATH1_SECT #define MATH2_SECT #define PHLOAT_SECT #define STO_RCL_SECT #define TABLES_SECT #define VARIABLES_SECT #define BCD_SECT #define int2 short #define uint2 unsigned short #define int4 int #define uint4 unsigned int #define uint unsigned int #if defined(WINDOWS) && !defined(__GNUC__) #define int8 __int64 #define uint8 unsigned __int64 #define LL(x) x /* MSVC++ 6.0 lacks a few math functions that Free42 needs. * I've defined workarounds in mathfudge.c. NOTE: my versions * of isnan(), finite(), and isinf() are a bit lame -- I *think* * they handle infinities properly, but definitely not NaNs * (although NaNs shouldn't be much of a problem because the Free42 * code mostly tries to avoid them, rather than detect them after * the fact). */ #ifdef __cplusplus extern "C" { #endif int isnan(double x); int finite(double x); int isinf(double x); void sincos(double x, double *sinx, double *cosx); double asinh(double x); double acosh(double x); double atanh(double x); double expm1(double x); double log1p(double x); #ifdef _WIN32_WCE double hypot(double x, double y); #endif #ifdef __cplusplus } #endif #else #define int8 long long #define uint8 unsigned long long #define LL(x) x##LL /* NOTE: In my Linux build, all I have to do is DECLARE sincos(); glibc 2.3.3 * has it (for C99, I suppose) so I don't have to DEFINE it. On other Unixes * (e.g. MacOS X), it may not be provided by the standard libraries; in this * case, define the NO_SINCOS symbol, here or in the Makefile. * For the Palm build, we don't even need the declaration, since sincos() is * provided by MathLib. */ #ifndef PALMOS extern "C" void sincos(double x, double *sinx, double *cosx) HELPERS_SECT; #endif //#define NO_SINCOS 1 #endif // Filename, including path, max size. #define FILENAMELEN 256 // Version of the shell file #define SHELL_VERSION 1 /* Magic number and version number for the state file. * State file versions correspond to application versions as follows: * Version 1: 1.25 first release */ #define EASYCALC_MAGIC 0x4543414C #define EASYCALC_VERSION 1 void shell_beeper(int frequency, int duration); void shell_annunciators(int skin, int shf, int angle_mode, int int_mode, int run) SHELL1_SECT; void shell_powerdown() SHELL1_SECT; #endif --- NEW FILE: DataManager.cpp --- #include "StdAfx.h" #include "PalmOS.h" #include "DataManager.h" #include "defuns.h" DataManager::DataManager(void) { in_state = false; attr = 0; type = 0; creator = 0; numRecords = 0; head = NULL; } DataManager::~DataManager(void) { } extern StateManager stateMgr; // This one comes from EasyCalc.cpp LocalID DmFindDatabase (UINT16 cardNo, const TCHAR *nameP) { return ((LocalID) &stateMgr); } int DmDatabaseInfo ( UINT16 cardNo, LocalID dbID, TCHAR *nameP, UINT16 *attributesP, UINT16 *versionP, UINT32 *crDateP, UINT32 *modDateP, UINT32 *bckUpDateP, UINT32 *modNumP, LocalID *appInfoIDP, LocalID *sortInfoIDP, UINT32 *typeP, UINT32 *creatorP) { if (dbID == (LocalID) &stateMgr) { *attributesP = stateMgr.historyDB.attr; *versionP = (UINT16) (stateMgr.version); *typeP = stateMgr.historyDB.type; *creatorP = stateMgr.historyDB.creator; } return (0); } int DmSetDatabaseInfo ( UINT16 cardNo, LocalID dbID, const TCHAR *nameP, UINT16 *attributesP, UINT16 *versionP, UINT32 *crDateP, UINT32 *modDateP, UINT32 *bckUpDateP, UINT32 *modNumP, LocalID appInfoIDP, LocalID sortInfoIDP, UINT32 *typeP, UINT32 *creatorP) { if (dbID == &stateMgr) { stateMgr.historyDB.attr = *attributesP; } return (0); } DmOpenRef DmOpenDatabase (UINT cardNo, LocalID dbID, UINT16 mode) { if (dbID == (LocalID) &stateMgr) { return (&(stateMgr.historyDB)); } return (NULL); } int DmGetLastErr (void) { return (0); } int DmCreateDatabase ( UINT16 cardNo, const TCHAR *nameP, UINT32 creator, UINT32 type, bool resDB) { if (wcscmp (nameP, HISTORYDBNAME) == 0) { stateMgr.historyDB.creator = creator; stateMgr.historyDB.type = type; } return (0); } Err DmCloseDatabase (DmOpenRef dbP) { return (0); } int DmDeleteDatabase (UINT16 cardNo, LocalID dbID) { return (0); } UINT16 DmNumRecords (DmOpenRef dbP) { return (dbP->numRecords); } MemHandle DmNewRecord (DmOpenRef dbP, UInt16 *atP, UInt32 size) { if (dbP == &(stateMgr.historyDB)) { char *p = (char *) malloc ((size+8) & 0xFFFFFFFC); // Add 4 bytes, round up to next 4 bytes limit if (p == NULL) return (NULL); DataRecord *prec = NULL; DataRecord *temp = stateMgr.historyDB.head; if (*atP > stateMgr.historyDB.numRecords) *atP = stateMgr.historyDB.numRecords; for (int i=0 ; (i<*atP) && (temp != NULL) ; i++) temp = (prec = temp)->next; stateMgr.historyDB.numRecords++; if (prec == NULL) { // Insert at head temp = stateMgr.historyDB.head = new DataRecord(size, p, stateMgr.historyDB.head); } else { temp = prec->next = new DataRecord(size, p, temp); } // Put the father record address at beginning of the allocated space *((UInt32 *) p) = (UInt32) temp; return (p+4); } return (NULL); } Err DmRemoveRecord (DmOpenRef dbP, UInt16 index) { if (dbP == &(stateMgr.historyDB)) { DataRecord *prec = NULL; DataRecord *temp = stateMgr.historyDB.head; if (index >= stateMgr.historyDB.numRecords) return (-1); for (int i=0 ; (i<index) && (temp != NULL) ; i++) temp = (prec = temp)->next; stateMgr.historyDB.numRecords--; if (prec == NULL) { // Delete at head stateMgr.historyDB.head = stateMgr.historyDB.head->next; } else { prec->next = temp->next; } free (temp->ptr); delete temp; return (0); } return (-1); } Err DmWrite ( void *recordP, UInt32 offset, const void *srcP, UInt32 bytes) { char *p = (char *) recordP; // Find the record to which this data belongs DataRecord *r = (DataRecord *) (* ((UInt32 *) (((UInt32) recordP) - 4))); if (r->magic != RECORD_MAGIC) return (-1); if (offset + bytes > r->size) return (-2); memcpy (p+offset, srcP, bytes); return (0); } MemHandle DmQueryRecord (DmOpenRef dbP, UInt16 index) { if (dbP == &(stateMgr.historyDB)) { DataRecord *temp = stateMgr.historyDB.head; if (index >= stateMgr.historyDB.numRecords) return (NULL); for (int i=0 ; (i<index) && (temp != NULL) ; i++) temp = temp->next; return (temp->ptr+4); } return (NULL); } //Err DmReleaseRecord (DmOpenRef dbP, UInt16 index, Boolean dirty) { // return (0); //} DataRecord::DataRecord(void) { magic = RECORD_MAGIC; size = 0; ptr = NULL; next = NULL; } DataRecord::DataRecord(UINT32 s, void *p, DataRecord *n) { size = s; ptr = (char *) p; next = n; } DataRecord::~DataRecord(void) { } --- NEW FILE: EasyCalc.cpp --- /***************************************************************************** * EasyCalc -- a scientific calculator * Copyright (C) 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * The name and many features come from * - EasyCalc on Palm: * * It also is reusing elements from * - Free42: Thomas Okken * for its adaptation to the PocketPC world. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. [...1152 lines suppressed...] * Call handler for when the repeater timer passes the first 1/4 second. * ********************************************************************************/ static VOID CALLBACK timeout1(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) { KillTimer(NULL, timer); if (ckey != 0) { core_keytimeout1(); timer = SetTimer(NULL, 0, 1750, timeout2); } else timer = 0; } /******************************************************************************** * FUNCTION: timeout2(HWND, UINT, UINT, DWORD) * * Call handler for when the repeater timer goes beyond 2 seconds. * ********************************************************************************/ static VOID CALLBACK timeout2(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) { KillTimer(NULL, timer); if (ckey != 0) core_keytimeout2(); timer = 0; } --- NEW FILE: chkstack.h --- /* * $Id: chkstack.h,v 1.1 2008/05/26 20:08:14 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999,2000,2001 Ondrej Palkovsky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * You can contact me at 'on...@pe...'. * */ void initChkStack(void); Boolean chkStack(void); --- NEW FILE: core_main.h --- /***************************************************************************** * EasyCalc -- a scientific calculator * Copyright (C) 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ #ifndef CORE_MAIN_H #define CORE_MAIN_H 1 #include "EasyCalc.h" /*******************/ /* Keyboard repeat */ /*******************/ extern int repeating; extern int repeating_shift; extern int repeating_key; /**********************************/ /* Shell/Core interface functions */ /**********************************/ int core_repeat() MAIN_SECT; void core_keytimeout1() MAIN_SECT; void core_keytimeout2() MAIN_SECT; void core_timeout3(int repaint) MAIN_SECT; int core_alpha_menu() MAIN_SECT; int core_hex_menu() MAIN_SECT; int core_keydown(int key, int *enqueued, int *repeat) MAIN_SECT; int core_keyup() MAIN_SECT; /*******************/ /* Other functions */ /*******************/ void set_running(bool state) MAIN_SECT; void continue_running() MAIN_SECT; #endif --- NEW FILE: DataManager.h --- #pragma once #ifndef DATA_MANAGER_H #define DATA_MANAGER_H 1 #include "PalmOS.h" #define dmModeReadWrite 1 #define dmHdrAttrBackup 2 #define RECORD_MAGIC 0x52454344 class DataRecord { public: UInt32 magic; UInt32 size; char *ptr; DataRecord *next; DataRecord(void); DataRecord(UINT32 s, void *p, DataRecord *n); ~DataRecord(void); }; class DataManager { public: bool in_state; UInt16 attr; UInt32 type; UInt32 creator; UInt16 numRecords; DataRecord *head; DataManager(void); ~DataManager(void); }; typedef DataManager *DmOpenRef; typedef void *LocalID; LocalID DmFindDatabase (UINT16 cardNo, const TCHAR *nameP); Err DmDatabaseInfo ( UInt16 cardNo, LocalID dbID, Char *nameP, UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, UInt32 *modDateP, UInt32 *bckUpDateP, UInt32 *modNumP, LocalID appInfoIDP, LocalID sortInfoIDP, UInt32 *typeP, UInt32 *creatorP ); Err DmSetDatabaseInfo ( UInt16 cardNo, LocalID dbID, const Char *nameP, UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, UInt32 *modDateP, UInt32 *bckUpDateP, UInt32 *modNumP, LocalID appInfoIDP, LocalID sortInfoIDP, UInt32 *typeP, UInt32 *creatorP ); DmOpenRef DmOpenDatabase (UInt16 cardNo, LocalID dbID, UInt16 mode); Err DmGetLastErr (void); Err DmCreateDatabase ( UInt16 cardNo, const Char *nameP, UInt32 creator, UInt32 type, Boolean resDB); Err DmCloseDatabase (DmOpenRef dbP); Err DmDeleteDatabase (UInt16 cardNo, LocalID dbID); UInt16 DmNumRecords (DmOpenRef dbP); MemHandle DmNewRecord (DmOpenRef dbP, UInt16 *atP, UInt32 size); Err DmWrite ( void *recordP, UInt32 offset, const void *srcP, UInt32 bytes ); Err DmRemoveRecord (DmOpenRef dbP, UInt16 index); MemHandle DmQueryRecord (DmOpenRef dbP, UInt16 index); //Err DmReleaseRecord (DmOpenRef dbP, UInt16 index, Boolean dirty); #define DmReleaseRecord(a,b,c) #endif --- NEW FILE: dbutil.cpp --- /* * $Id: dbutil.cpp,v 1.1 2008/05/26 20:08:14 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999,2000,2007 Ondrej Palkovsky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * You can contact me at 'on...@pe...'. */ #include "StdAfx.h" #include <PalmOS.h> #include "defuns.h" static Err db_open_byid(LocalID dbid, DmOpenRef *dbref) { *dbref = DmOpenDatabase(CARDNO, dbid, dmModeReadWrite); if (*dbref) return DmGetLastErr(); return 0; } /*********************************************************************** * * FUNCTION: open_db * * DESCRIPTION: Open a database for EasyCalc. Creates a new one, * if the database does not exist or if the old database * has the wrong version * * PARAMETERS: * * RETURN: 0 - on success * other - on error * ***********************************************************************/ Int16 open_db(const Char *name, UInt16 dbversion, UInt32 crid, UInt32 dbtype, DmOpenRef *dbref) { Err err; LocalID dbid; UInt16 version; UInt32 creator; UInt32 type; UInt16 attr = 0; dbid = DmFindDatabase(CARDNO, name); if (dbid) { /* Database exists */ DmDatabaseInfo(CARDNO, dbid, NULL, /* name */ &attr, /* attrib */ &version, /* version */ NULL, /* crDate */ NULL, /* modDate */ NULL, /* bckUpDate */ NULL, /* modNum */ NULL, /* appinfoID */ NULL, /* sortInfoID */ &type, /* Type */ &creator); /* Creator */ if (version == dbversion && creator == crid && type == dbtype) { if ((attr & dmHdrAttrBackup) == 0) { attr |= dmHdrAttrBackup; DmSetDatabaseInfo(CARDNO, dbid, NULL, /* name */ &attr, /* attrib */ NULL, /* version */ NULL, /* crDate */ NULL, /* modDate */ NULL, /* bckupDate */ NULL, /* modNum */ NULL, /* appinfoID */ NULL, /* sortInfoID */ NULL, /* Type */ NULL); /* Creator */ } return db_open_byid(dbid, dbref); } /* Database exists, but with incorrect version */ err = DmDeleteDatabase(CARDNO, dbid); if (err) return err; } /* Database doesn't exist or old version */ err = DmCreateDatabase(CARDNO, name, crid, dbtype, false); if (err) return err; dbid = DmFindDatabase(CARDNO, name); version = dbversion; attr |= dmHdrAttrBackup; DmSetDatabaseInfo(CARDNO, dbid, NULL, /* name */ &attr, /* attrib */ &version, /* version */ NULL, /* crDate */ NULL, /* modDate */ NULL, /* bckUpDate */ NULL, /* modNum */ NULL, /* appinfoID */ NULL, /* sortInfoID */ NULL, /* Type */ NULL); /* Creator */ return db_open_byid(dbid, dbref); } --- NEW FILE: calcrsc.h --- // $Id: calcrsc.h,v 1.1 2008/05/26 20:08:14 mapibid Exp $ // // Resource constants for EasyCalc // Copyright (C) 2000 Ondrej Palkovsky // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301, USA. #define MAX_INPUT_LENGTH 1000 #define MAX_WORKSHEET_TITLE 32 #define MAX_WORKSHEET_NOTE 300 #define MAX_WORKSHEET_HELP 39 #define resize_index 1 #define frmBasic 1001 #define frmScientific 1002 #define frmInteger 1003 #define frmGraph 1004 #define finForm 1005 #define frmAbout 1006 #define altCompute 1007 #define altMathlib 1008 #define frmHelp 1009 #define altGuessNotFound 1010 #define altGraphBadVal 1011 #define altErrorMsg 1012 #define altAnsProblem 1013 #define altBadParameter 1015 #define frmListEdit 1016 #define frmMatrix 1017 #define frmBasicS 1018 #define slvForm 1019 #define slvTitleForm 1020 #define slvOptionsForm 1021 #define slvNoteForm 1022 #define slvExportOK 1023 #define slvExportError 1024 #define tdMenu 1000 #define resultGadget 1001 #define tdInput 1002 #define tdDoit 1003 #define btnBasic 1008 #define btnScientific 1009 #define btnInteger 1010 #define btnGraph 1011 #define tdBFin 1016 #define tdBPref 1017 #define btnHistory 1018 #define hlpMain1 1100 #define hlpMain2 1101 #define hlpMain2T 1102 #define hlpPref 1103 #define hlpFin 1104 #define hlpMemo 1105 #define hlpFunc 1106 #define hlpFuncT 1107 #define hlpGrPref 1108 #define hlpGrSetup 1109 #define hlpSolver 1110 #define btnMain0 2000 #define btnMain1 2001 #define btnMain2 2002 #define btnMain3 2003 #define btnMain4 2004 #define btnMain5 2005 #define btnMain6 2006 #define btnMain7 2007 #define btnMain8 2008 #define btnMain9 2009 #define btnMainBksp 2010 #define btnMainFwsp 2011 #define btnMainDel 2012 #define btnMainPlus 2015 #define btnMainMinus 2016 #define btnMainMult 2017 #define btnMainDivide 2018 #define btnMainNeg 2019 #define btnMainA 2071 #define btnMainB 2072 #define btnMainC 2073 #define btnMainD 2074 #define btnMainE 2075 #define btnMainF 2076 #define btnMainAnd 2077 #define btnMainOr 2078 #define btnMainShl 2079 #define btnMainShr 2080 #define btnMainClear 2081 #define btnMainAns 2082 #define btnMainOpBr 2083 #define btnMainPow 2084 #define btnMainLog 2085 #define btnMainSq1 2086 #define btnMainSqr 2087 #define btnMainSqrt 2088 #define btnMainClBr 2089 #define btnMainEE 2090 #define btnMainDot 2091 #define btnMainXor 2092 #define btnMainSel 2093 #define lstMainBtnRow 2094 #define popMainBtnRow 2095 #define btnMainInv 2096 #define btnMainLn 2097 #define btnMainSin 2098 #define btnMainCos 2099 #define btnMainTan 2101 #define btnMainExp 2102 #define btnMainPi 2103 #define btnMainDeg 2104 #define btnMainMin 2105 #define btnMainFact 2106 #define btnMainColn 2107 #define btnMainMagn 2108 #define btnMainAngl 2109 #define btnMain_i 2110 #define btnPrefMode 2111 #define btnRadixMode 2112 #define btnMatrixDone 2200 #define tblMatrix 2201 #define lstMatrix 2202 #define popMatrix 2203 #define popMatrixRows 2204 #define popMatrixCols 2205 #define lstMatrixDim 2206 #define sclMatrix 2207 #define btnMatrixLeft 2208 #define btnMatrixRight 2209 #define btnMainS1 3301 #define btnMainS2 3302 #define btnMainS3 3303 #define btnMainS4 3304 #define btnMainS5 3305 #define btnMainS6 3306 #define btnMainS7 3307 #define btnMainS8 3308 #define btnMainS9 3309 #define btnMainS10 3310 #define btnMainS11 3311 #define btnMainS12 3312 #define btnMainS13 3313 #define btnMainS14 3314 #define btnMainS15 3315 #define btnMainW1 3316 #define btnMainW2 3317 #define btnMainW3 3319 #define btnMainW4 3320 #define btnMainW5 3322 #define btnMainW6 3323 #define btnMainW7 3325 #define btnMainW8 3326 #define btnMainW9 3328 #define btnMainW10 3329 #define finFVButton 3000 #define finPVButton 3001 #define finPMTButton 3002 #define finNButton 3003 #define finIButton 3004 #define finBeginButton 3005 #define finEndButton 3006 #define finPYRButton 3007 #define finDoneButton 3010 #define finISet 3100 #define finILabel 3101 #define finPVSet 3102 #define finPVLabel 3103 #define finPMTSet 3104 #define finPMTLabel 3105 #define finNSet 3106 #define finNLabel 3107 #define finFVSet 3108 #define finFVLabel 3109 #define finPYRSet 3110 #define finPYRLabel 3111 #define varEditForm 3200 #define varEditField 3201 #define varEditOK 3202 #define varEditCancel 3203 #define varEditNameField 3204 #define altConfirmOverwrite 3205 #define varEditParam 3206 #define varEditParamLabel 3207 #define varFuncModTitle 3208 #define varVarModTitle 3209 #define varFuncNewTitle 3210 #define varVarNewTitle 3211 #define varStrVariable 3212 #define varStrFunction 3213 #define calcResPopupBut 3250 #define calcResList 3251 #define calcResPopup 3252 #define tdIntBin 3400 #define tdIntOct 3401 #define tdIntDec 3402 #define tdIntHex 3403 #define frmGrcSel 3500 #define btnGrcSelOK 3501 #define btnGrcSelCancel 3502 #define lstGrcSel 3503 #define altGrcSelectLeft 3504 #define altGrcSelectRight 3505 #define altGrcSelectValue 3506 #define altComputeResult 3507 #define altComputeCofirm 3508 #define altGrcBoundsErr 3509 #define altGrcFuncErr 3510 #define altOctalMode 3511 #define altSolverResult 3512 #define slvEquation 3601 #define slvUpdate 3602 #define slvVarList 3603 #define slvDone 3604 #define slvModify 3605 #define slvSolve 3606 #define slvCalculate 3608 #define slvWorksheet 3609 #define slvWorksheetList 3610 #define slvTitle 3611 #define slvTitleOK 3612 #define slvTitleCancel 3613 #define slvDelete 3615 #define slvOptions 3616 #define slvOptionsMin 3617 #define slvOptionsMax 3618 #define slvOptionsPrec 3619 #define slvOptionsOK 3620 #define slvOptionsCancel 3621 #define slvOptionsTitle 3622 #define slvNote 3623 #define slvNoteField 3624 #define slvNoteDone 3625 #define slvHelp 3626 #define slvMenu 3627 #define slvExport 3628 #define prefForm 4000 #define prefOK 4001 #define prefCancel 4002 #define prefNormal 4003 #define prefSci 4004 #define prefEng 4005 #define prefPrecPopup 4013 #define prefPrecList 4014 #define prefReducePrecision 4015 #define prefStrip 4016 #define prefParenth 4017 #define prefRadian 4018 #define prefDegree 4019 #define prefGrad 4020 #define prefDecimal 4022 #define prefBinary 4023 #define prefOctal 4024 #define prefHexa 4025 #define prefIntInput 4027 #define prefCvtUnits 4028 #define prefInsertHelp 4029 #define prefAcceptPref 4030 #define prefDispScien 4031 #define graphGadget 4100 #define btnGraphZoomIn 4101 #define btnGraphZoomOut 4102 #define btnGraphTrack 4103 #define graphTrackList 4104 #define graphTrackPopup 4105 #define btnGraphTrackGoto 4106 #define lstGraphCalcFunc 4107 #define btnGraphCalc 4108 #define lstGraphCalcParam 4109 #define strGrcDescription 4110 #define lstGraphCalcPolar 4111 #define btnGraphSpeed 4112 #define lstGraphSpeed 4113 #define graphMenu 4200 #define btnGraphPref 4201 #define btnGraphSetup 4202 #define btnGraphTable 4203 #define grPrefForm 4200 #define grPrefXmin 4202 #define grPrefXmax 4203 #define grPrefYmin 4204 #define grPrefYmax 4205 #define grPrefLabel1 4206 #define grPrefLabel2 4207 #define grPrefLabel3 4208 #define grPrefField1 4209 #define grPrefField2 4210 #define grPrefField3 4211 #define grPrefFunc 4212 #define grPrefPol 4213 #define grPrefPar 4214 #define grPrefDefault 4215 #define grPrefTrig 4216 #define grPrefXscale 4217 #define grPrefYscale 4218 #define ckbGrPrefLogX 4219 #define ckbGrPrefLogY 4220 #define grPrefLabel1u 4222 #define grPrefLabel2u 4223 #define grPrefLabel3u 4224 #define varList 4300 #define varListButton 4301 #define varListPopup 4302 #define varFuncListButton 4303 #define varBuiltinList 4304 #define varBuiltinListButton 4305 #define varBuiltinListPopup 4306 #define varEntryForm 4305 #define varEntryOK 4306 #define varEntryCancel 4307 #define varEntryField 4308 #define varEntryListBut 4309 #define varEntryList 4310 #define varEntryListPopup 4311 #define altBadVariableName 4312 #define histList 4400 #define histListPopup 4402 #define grSetupForm 4500 #define grSetupDone 4501 #define grSetupTable 4502 #define grSetupUp 4503 #define grSetupDown 4504 #define grSetupList 4505 #define grSetupPopup 4506 #define grSetupStrFunc 4508 #define grSetupNone 4509 #define grSetupUser 4510 #define ckbGrfun1 4511 #define ckbGrfun2 4512 #define ckbGrfun3 4513 #define ckbGrfun4 4514 #define ckbGrfun5 4515 #define ckbGrfun6 4516 #define ckbGrAxes 4517 #define ckbGrGrid 4518 #define grType1 4519 #define grType2 4520 #define grType3 4521 #define grType4 4522 #define grType5 4523 #define grType6 4524 #define grColor1 4525 #define grColor2 4526 #define grColor3 4527 #define grColor4 4528 #define grColor5 4529 #define grColor6 4530 #define grAxes 4531 #define grGrid 4532 #define grBgnd 4533 #define grBgndLbl 4534 #define grColorElem 4535 #define ckbGrAxesLabels 4536 #define grTableForm 4600 #define grTableTable 4601 #define grTableLeft 4602 #define grTableRight 4603 #define grTableDone 4604 #define grTableGoto 4605 #define grTableStep 4606 #define dinputForm 4700 #define dinputOK 4701 #define dinputCancel 4702 #define dinputField 4703 #define memoImportForm 4800 #define memoImportOK 4801 #define memoImportCancel 4802 #define memoImportList 4803 #define altMemoImportError 4804 #define memoExportQuestionForm 4805 #define memoExportOK 4806 #define memoExportCancel 4807 #define memoExportAll 4808 #define memoExportFunc 4809 #define memoExportVars 4810 #define btnListDone 4900 #define tblList 4901 #define popList1 4902 #define popList2 4903 #define popList3 4904 #define lstList 4905 #define btnListLong 4906 #define btnListInsert 4907 #define btnListDelete 4908 #define lblListLong 4909 #define sclList 4910 #define defForm 5000 #define defDone 5001 #define defList 5002 #define defNew 5003 #define defModify 5004 #define defDelete 5005 #define altConfirmDelete 5006 #define defPopupList 5007 #define defPopup 5008 #define abtLogo 6001 #define abtTitle 6002 #define abtVersion 6003 #define abtVerdate 6004 #define abthlpText 6005 #define abthlpOk 6006 #define abthlpUp 6007 #define abthlpDn 6008 #define bmpLArrow 7001 #define bmpRArrow 7002 #define bmpRootX 7003 #define bmpSquare 7004 #define bmpSquareRoot 7005 #define bmpExpon 7006 #define bmpInverse 7007 #define bmpPower 7008 #define bmpLdel 7009 #define bmpExe 7010 #define bmpIsPrime 7011 #define bmpPrevPrime 7012 #define bmpNextPrime 7013 #define frmUpdateVars 8000 #define frmUpdateResult 8001 #define frmUpdateWorksheet 8002 #define strErrCodes 8001 #define strMenuDescription 8002 #define strLocalNew 8003 #define strLocalDelete 8004 #define strLocalSaveAs 8005 #define strCredits 8006 #define strCreditsT 8007 #define strWorksheet 8008 #define strNewWorksheet 8009 #define strDescriptionVar 8010 #define strUndefined 8011 #define mitAbout 8500 #define mitListEdit 8501 #define mitMatrixEdit 8502 #define mitMemoExport 8503 #define mitMemoImport 8504 #define mitFinCalc 8505 #define mitDefMgr 8506 #define mitClearHistory 8507 #define mitCredits 8508 #define mitSolver 8509 #define sysEditMenuID 10000 #define sysEditMenuUndoCmd 10000 #define sysEditMenuCutCmd 10001 #define sysEditMenuCopyCmd 10002 #define sysEditMenuPasteCmd 10003 #define sysEditMenuSelectAllCmd 10004 #define sysEditMenuSeparator 10005 #define sysEditMenuKeyboardCmd 10006 #define sysEditMenuGraffitiCmd 10007 --- NEW FILE: core_display.h --- /***************************************************************************** * EasyCalc -- a scientific calculator * Copyright (C) 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ #ifndef CORE_DISPLAY_H #define CORE_DISPLAY_H 1 //#include "EasyCalc.h" #define MENULEVEL_COMMAND 0 #define MENULEVEL_ALPHA 1 #define MENULEVEL_TRANSIENT 2 #define MENULEVEL_PLAIN 3 #define MENULEVEL_APP 4 void squeak() DISPLAY_SECT; void redisplay() DISPLAY_SECT; void set_menu(int level, int menuid) DISPLAY_SECT; #endif --- NEW FILE: core_main.cpp --- /***************************************************************************** * EasyCalc -- a scientific calculator * Copyright (C) 2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * The name and many features come from * - EasyCalc on Palm: * * It also is reusing elements from * - Free42: Thomas Okken * for its adaptation to the PocketPC world. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ /* core_main.cpp : core functions which are not dependent on the running OS. *****************************************************************************/ #include "stdafx.h" #include "core_main.h" #include "core_globals.h" #include "core_tables.h" #include "core_display.h" #include <stdlib.h> /*------------------------------------------------------------------------------- - Constants. - -------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------- - Type declarations. - -------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------- - Global variables. - -------------------------------------------------------------------------------*/ int repeating = 0; int repeating_shift; int repeating_key; /*------------------------------------------------------------------------------- - Module variables. - -------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------- - Forward declarations. - -------------------------------------------------------------------------------*/ static void stop_interruptible() MAIN_SECT; static int handle_error(int error) MAIN_SECT; /*------------------------------------------------------------------------------- - Procedures. - -------------------------------------------------------------------------------*/ /******************************************************************************** * FUNCTION: set_shift() * * Set the shift state. * ********************************************************************************/ static void set_shift(bool state) { if (mode_shift != state) { mode_shift = state; shell_annunciators(ANNVAL_UNCH, state, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH); } } /******************************************************************************** * FUNCTION: core_repeat() * * This function is called by the shell to signal auto-repeating key events. * * It is the core's responsibility to keep track of *which* key is repeating. * * The function can return 0, to request repeating to stop; 1, which requests * * a slow repeat rate, for SST/BST; or 2, which requests a fast repeat rate, * * for number/alpha entry. * ********************************************************************************/ int core_repeat() { // For EasyCalc, no repeat. // keydown(repeating_shift, repeating_key); // int rpt = repeating; int rpt = 0; repeating = 0; return (rpt); } /******************************************************************************** * FUNCTION: core_keytimeout1() * * This function informs the emulator core that the currently pressed key has * * been held down for 1/4 of a second. (If the key is released less than 1/4 * * second after being pressed, this function is not called.) * * For keys that do not execute immediately, this marks the moment when the * * calculator displays the key's function name. * ********************************************************************************/ void core_keytimeout1() { // Function not used by EasyCalc // if ((pending_command == CMD_LINGER1) || (pending_command == CMD_LINGER2)) // return; // if ((pending_command == CMD_RUN) || (pending_command == CMD_SST)) { // int saved_pending_command = pending_command; // if (pc == -1) // pc = 0; // prgm_highlight_row = 1; // flags.f.prgm_mode = 2; /* HACK - magic value to tell redisplay() */ // /* not to suppress option menu highlights */ // pending_command = CMD_NONE; // redisplay(); // flags.f.prgm_m... [truncated message content] |