1 /* 2 * Calcoo: codes.h 3 * 4 * Copyright (C) 2001, 2002 Alexei Kaminski 5 * 6 */ 7 8 #ifndef CODES_H 9 #define CODES_H 10 11 #define SIGN_PLUS 1 12 #define SIGN_MINUS -1 13 14 /* display formats */ 15 #define FORMAT_FIX 0 16 #define FORMAT_SCI 1 17 #define FORMAT_ENG 2 18 19 #define ENTER_MODE_TRADITIONAL 0 20 #define ENTER_MODE_HP28 1 21 22 #define STACK_MODE_XYZT 0 23 #define STACK_MODE_INFINITE 1 24 25 /*-----------------------------------------------------------------------*/ 26 /* these are the codes to be assigned to cpu->last_action and only for this */ 27 28 #define ACTION_INPUT 10 29 30 #define ACTION_ENTER 11 /* both RPN and algebraic modes 31 * not only the <Enter> key, but many other actions 32 * actually, for any action that stops input, 33 * and that is not "Clear" or (in algebraic mode) 34 * binop 35 * Actually, the <Enter> key corresponds to this 36 * action only when enter_mode is set to hp28, 37 * otherwise, it corresponds to ACTION_ENTER_PUSH */ 38 39 #define ACTION_BINOP 12 /* only for algebraic mode, in RPN, use ACTION_ENTER */ 40 41 #define ACTION_CLEAR 13 /* both RPN and algebraic modes 42 * we need it to be able to get rid of 0 that appears 43 * on the display when there is nothing to display. 44 * I mean that in the process of input the number 45 * being read is stored in cpu->d (display) rather 46 * than in cpu->x. Since there is zero on the 47 * display before input, setting cpu->last_action 48 * to ACTION_CLEAR signals that this zero must 49 * be removed from the display before we put the 50 * digits from the input there */ 51 52 #define ACTION_ENTER_PUSH 14 /* only RPN mode 53 * <Enter> in ENTER_MODE_TRADITIONAL; 54 * in ENTER_MODE_HP28, ACTION_ENTER is used */ 55 56 #define ACTION_ERROR 15 57 /*---------------------------------------------------------------------*/ 58 59 /* the value has the real information about priority: 60 * higher values for higher priorities */ 61 62 #define PRIORITY_CODE_MIN 0 /* for ")" and "=" */ 63 #define PRIORITY_CODE_ADD 1 64 #define PRIORITY_CODE_MUL 2 65 #define PRIORITY_CODE_POW 3 66 67 68 /*===================================================================== 69 * 70 * Codes for buttons 71 * 72 * also used as codes for corresponding operations, if applicable 73 * 74 * the maximum possible code is NUMBER_OF_BUTTONS - 1 75 * it is defined in body.h 76 * 77 *======================================================================*/ 78 79 /* The real numerical values of the folowing ten codes are not supposed to be 80 * important. The translation must be done by digit_to_code and 81 * code_to_digit. */ 82 #define CODE_0 0 83 #define CODE_1 1 84 #define CODE_2 2 85 #define CODE_3 3 86 #define CODE_4 4 87 #define CODE_5 5 88 #define CODE_6 6 89 #define CODE_7 7 90 #define CODE_8 8 91 #define CODE_9 9 92 93 /* attention! careful with these codes! 94 * there used to be constructions like 95 * "for (i = CODE_ADD; i <= CODE_POWER; i++)" 96 * they must have been eradicated, but who knows...*/ 97 #define CODE_EQ 10 98 #define CODE_ADD 11 99 #define CODE_SUB 12 100 #define CODE_MUL 13 101 #define CODE_DIV 14 102 #define CODE_POW 15 103 #define CODE_ENTER 16 104 105 #define CODE_NO_OPERATION 19 106 107 #define CODE_DOT 21 108 #define CODE_SIGN 22 109 #define CODE_EXP 23 110 #define CODE_EXP_SIGN 24 111 112 #define CODE_LOG 31 113 #define CODE_10TOX 32 114 #define CODE_LN 33 115 #define CODE_ETOX 34 116 #define CODE_SQRT 35 117 #define CODE_SQR 36 118 #define CODE_INVX 37 119 #define CODE_PI 38 120 #define CODE_FACT 39 121 122 #define CODE_SIN 41 123 #define CODE_COS 42 124 #define CODE_TAN 43 125 126 #define CODE_DEG 46 127 #define CODE_RAD 47 128 129 #define CODE_ARC 48 130 #define CODE_HYP 49 131 132 #define CODE_EXCH_XY 50 133 #define CODE_STACK_UP 51 134 #define CODE_STACK_DOWN 52 135 #define CODE_LEFT_PAREN 53 136 #define CODE_RIGHT_PAREN 54 137 138 #define CODE_ASIN 61 139 #define CODE_SINH 62 140 #define CODE_ASINH 63 141 142 #define CODE_ACOS 64 143 #define CODE_COSH 65 144 #define CODE_ACOSH 66 145 146 #define CODE_ATAN 67 147 #define CODE_TANH 68 148 #define CODE_ATANH 69 149 150 #define CODE_CLEAR_ALL 100 151 #define CODE_CLEAR_X 101 152 153 #define CODE_DEG_RAD 108 154 #define CODE_FORMAT 109 155 156 #define CODE_MEM_TO_X 110 157 #define CODE_MEM_PLUS 111 158 #define CODE_EXCH_XMEM 118 159 #define CODE_X_TO_MEM 119 160 #define CODE_SWITCH_TO_MEM0 120 161 #define CODE_SWITCH_TO_MEM1 121 162 163 #define CODE_UNDO 133 164 #define CODE_REDO 134 165 #define CODE_INFO 135 166 #define CODE_SETTINGS 136 167 #define CODE_COPY 137 168 #define CODE_PASTE 138 169 170 #define CODE_EXIT 150 171 172 /* the maximum possible code is NUMBER_OF_BUTTONS - 1, 173 * which is defined in body.h */ 174 175 #endif /* CODES_H */ 176 177