From: Mapi B. <ma...@us...> - 2009-06-22 22:05:36
|
Update of /cvsroot/easycalc/PPCport/core In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24055 Added Files: core_globals.cpp core_globals.h Log Message: 2nd upload, getting closer --- 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 13 #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 #define ANN_RESMENU 12 /*********************/ /* 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: core_globals.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_globals.cpp : contains global calc state & procedures. *****************************************************************************/ #include "stdafx.h" #include "core_globals.h" #include <stdlib.h> /* Flags */ flags_struct flags; int pending_command; bool mode_shift; bool mode_running; int (*mode_interruptible)(int) = NULL; bool mode_stoppable; bool mode_getkey; int remove_program_catalog = 0; int mode_plainmenu; int mode_transientmenu; /* Keystroke buffer - holds keystrokes received while * there is a program running. */ int keybuf_head = 0; int keybuf_tail = 0; int keybuf[16]; |