From: Mapi B. <ma...@us...> - 2009-09-24 21:16:24
|
Update of /cvsroot/easycalc/PPCport/core In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv14251 Modified Files: core_globals.h Added Files: ansops.cpp ansops.h core_display.cpp core_display.h core_main.cpp core_main.h defmgr.cpp defmgr.h Main.cpp Main.h prefs.h varmgr.cpp varmgr.h Log Message: Subset of the code, compiling, but not yet linking Index: core_globals.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/core_globals.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** core_globals.h 22 Jun 2009 22:04:26 -0000 1.1 --- core_globals.h 24 Sep 2009 21:16:09 -0000 1.2 *************** *** 105,109 **** /* Annunciator codes */ /*********************/ ! #define NB_ANNUN 13 #define ANN_SHIFT 0 #define ANN_DEG 1 --- 105,109 ---- /* Annunciator codes */ /*********************/ ! #define NB_ANNUN 14 #define ANN_SHIFT 0 #define ANN_DEG 1 *************** *** 119,126 **** #define ANN_SG 11 #define ANN_RESMENU 12 ! /*********************/ ! /* Annunciator value */ ! /*********************/ #define ANNVAL_UNCH -1 #define ANNVAL_DEG 0 --- 119,128 ---- #define ANN_SG 11 #define ANN_RESMENU 12 + #define ANN_HSTMENU 13 ! /******************************/ ! /* Annunciator value */ ! /* Note: UNCH means unchanged */ ! /******************************/ #define ANNVAL_UNCH -1 #define ANNVAL_DEG 0 --- NEW FILE: Main.cpp --- /* * $Id: Main.cpp,v 1.1 2009/09/24 21:16:09 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...'. * * 2001-09-23 - John Hodapp <bi...@em...> * Added code to force insertion point for fwd/backspace * and delete keys to work on single character even if * entire selection is highlighted. * 2001-09-31 - John Hodapp - added code to display and select trig mode * on Basic and Scientific screen. Repeating fwd/backspace. * 2001-12-8 - John Hodapp - added code to dispaly and select Radix on * Basic and Scien screens. * 2003-05-19 - Arno Welzel - added code for Sony Clie support */ #include "StdAfx.h" #include "compat/PalmOS.h" #include "konvert.h" //#include "calc.h" //#include "calcrsc.h" #include "prefs.h" #include "fp.h" #include "varmgr.h" #include "stack.h" #include "funcs.h" #include "ansops.h" #include "history.h" //#include "memo.h" #define _MAIN_C_ #include "system - UI/Skin.h" #include "Main.h" #ifdef SUPPORT_DIA #include "DIA.h" #endif Main::Main(void) { } Main::~Main(void) { } const static struct { TCHAR *string; Boolean operatr; // Prepend Ans when in the beginning of line Boolean func; // Add ')' and backspace one position Boolean nostartparen; Boolean wide; const TCHAR *helptext; }buttonString[]={ {_T("0"),false}, {_T("1"),false}, {_T("2"),false}, {_T("3"),false}, {_T("4"),false}, {_T("5"),false}, {_T("6"),false}, {_T("7"),false}, {_T("8"),false}, {_T("9"),false}, {_T("A"),false}, {_T("B"),false}, {_T("C"),false}, {_T("D"),false}, {_T("E"),false}, {_T("F"),false}, {_T("&"),true}, {_T("|"),true}, {_T(""),true}, // xor {_T("<<"),true}, {_T(">>"),true}, {_T("+"),true}, {_T("-"),true}, {_T("-"),false}, {_T("*"),true}, {_T("/"),true}, {_T("ans")}, {_T(""),false,true}, // ?? {_T("^"),true}, // power {_T("log"),false,true}, {_T("ln"),false,true}, {_T("^(-1)"),true}, // 1/x {_T("^(1/"),true,true,true}, // nth root {_T("^2"),true}, {_T("sqrt"),false,true}, {_T("sin"),false,true}, {_T("cos"),false,true}, {_T("tan"),false,true}, {_T("exp"),false,true}, {_T("fact"),false,true}, {_T("pi")}, {_T("°")}, // degrees {_T("'")}, // minutes {_T("abs"),false,true}, // Magnitude {_T("angle"),false,true}, {_T("i")}, // Complex_i {_T(":")}, // column {_T(")")}, {_T("E")}, {_T("asin"),false,true}, {_T("acos"),false,true}, {_T("atan"),false,true}, {_T("sinh"),false,true}, {_T("cosh"),false,true}, {_T("tanh"),false,true}, {_T("asinh"),false,true}, {_T("acosh"),false,true}, {_T("atanh"),false,true}, {_T("log"),false,true}, {_T("10^")}, {_T("log2"),false,true}, {_T("2^")}, {_T("fact"),false,true}, {_T("ncr"),false,true}, {_T("npr"),false,true}, {_T("round"),false,true,false,true}, {_T("trunc"),false,true,false,true}, {_T("floor"),false,true,false,true}, {_T("gamma"),false,true,false,true}, {_T("beta"),false,true,false,true}, {_T("rand"),false,false}, {_T("rNorm"),false,false}, {_T("real"),false,true,false,true}, {_T("imag"),false,true,false,true}, {_T("conj"),false,true}, {_T("exp(i*"),false,true,true,false}, {_T("fzero"),false,true,false,true,_T("min:max:f[:err]")}, {_T("fvalue"),false,true,false,true,_T("min:max:val:f[:err]")}, {_T("fmin"),false,true,false,true,_T("min:max:f[:err]")}, {_T("fmax"),false,true,false,true,_T("min:max:f[:err]")}, {_T("fd_dx"),false,true,false,true,_T("x:f[:err]")}, // d/dx {_T("fromberg"),false,true,false,true,_T("min:max:f[:n]")}, // integ {_T("fd2_dx"),false,true,false,true,_T("x:f[:err]")}, // d2/dx {_T("()=\""),false,true,true,true}, {_T("\"")}, {_T("x")}, {_T("list"),false,true,false,true}, {_T("median"),false,true,false,true}, {_T("mean"),false,true,false,true}, {_T("sum"),false,true,false,true}, {_T("lmin"),false,true}, // min {_T("lmax"),false,true}, // max {_T("prod"),false,true}, {_T("variance"),false,true,false,true}, {_T("stddev"),false,true,false,true}, {_T("dim"),false,true}, {_T("[")}, {_T("matrix"),false,true,false,true}, {_T("identity"),false,true,false,true}, {_T("det"),false,true}, {_T("qrs"),false,true}, {_T("rref"),false,true}, {_T("qrq"),false,true}, {_T("qrr"),false,true}, {_T("["),true}, // x[] {_T("]")}, {_T("qBinomial"),false,true,false,true,_T("c:n:p")}, {_T("qBeta"),false,true,false,true,_T("x:a:b")}, {_T("qChiSq"),false,true,false,true,_T("ChiSq:df")}, {_T("qF"),false,true,false,true,_T("F:df1:df2")}, {_T("qPoisson"),false,true,false,true,_T("c:lam")}, {_T("qStudentt"),false,true,false,true,_T("t:df")}, {_T("qWeibull"),false,true,false,true,_T("t:a:b")}, {_T("qNormal"),false,true,false,true,_T("z")}, {_T("range"),false,true,false,true,_T("n:start[:step]")}, {_T("rNorm"),false,true,false,true}, {_T("find"),false,true,false,true,_T("expr:data")}, {_T("sample"),false,true,false,true,_T("data:indices")}, {_T("filter"),false,true,false,true,_T("b_coefs:a_coefs:data")}, {_T("conv"),false,true,false,true}, {_T("fft"),false,true,false,true,_T("data[:N]")}, {_T("ifft"),false,true,false,true,_T("data[:N]")}, {_T("prevprime"),false,true}, {_T("isprime"),false,true}, {_T("nextprime"),false,true}, {_T("gcd"),false,true}, {_T("lcm"),false,true}, {_T("phi"),false,true}, {_T("gcdex"),false,true,false,true}, {_T("chinese"),false,true,false,true}, {_T("modinv"),false,true,false,true}, {_T("modpow"),false,true,false,true}, {_T("factor"),false,true,false,true}, {_T("besseli"),false,true,false,true,_T("n:x")}, {_T("besselj"),false,true,false,true,_T("n:x")}, {_T("besselk"),false,true,false,true,_T("n:x")}, {_T("bessely"),false,true,false,true,_T("n:x")}, {_T("ellc1"),false,true,false,true}, {_T("ellc2"),false,true,false,true}, {_T("elli1"),false,true,false,true,_T("m:phi")}, {_T("elli2"),false,true,false,true,_T("m:phi")}, {_T("euler"),false,false,false,true}, {_T("cn"),false,true}, {_T("dn"),false,true}, {_T("sn"),false,true}, {_T("igamma"),false,true,false,true,_T("a:x")}, {_T("ibeta"),false,true,false,true,_T("a:b:x")}, {_T("erf"),false,true,false,true}, {_T("erfc"),false,true,false,true}, {0,NULL,false} }; #define BUTTON_COUNT 149 /*********************************************************************** * * FUNCTION: main_replace_enters * * DESCRIPTION: Replace \n by ; * ***********************************************************************/ static void main_replace_enters (TCHAR *text) { for (;*text;text++) if (*text=='\n') *text=';'; } /*********************************************************************** * * FUNCTION: main_input_exec * * DESCRIPTION: Execute contents of input line and show the result * * PARAMETERS: Nothing * * RETURN: err - Possible error that occurred during computation * ***********************************************************************/ CError main_input_exec (TCHAR *inp, Trpn *result) { CError err; // FieldPtr pole; int inpsize; CodeStack *stack; if (*inp == '\0') return c_syntax; inpsize = (int) wcslen(inp); main_replace_enters(inp); stack = text_to_stack(inp, &err); if (!err) { err = stack_compute(stack); /* Add line to history After computing and After succesful * compilation */ if (inpsize) history_add_line(inp); if (!err) { (*result) = stack_pop(stack); err=set_ans_var(*result); rpn_delete(*result); } stack_delete(stack); } return err; } /*********************************************************************** * * FUNCTION: main_insert * * DESCRIPTION: Insert a text on an input line, handle cases like * embracing a selected text with a function, auto-closing * of brackets etc. * * PARAMETERS: fieldid - id of field where to insert text * text - text to add to input line * operatr - prepend 'ans' if on the beginning of line * func - add opening and possibly closing bracket * nostartparen - is a function without opening bracket * helptext - description of parameters of a function * * RETURN: Nothing * ***********************************************************************/ void main_insert(Skin *skin, void *hwnd_edit, const TCHAR *text, Boolean operatr, Boolean func, Boolean nostartparen, const TCHAR *helptext) { unsigned long startp, endp; skin->get_select_text(hwnd_edit, &startp, &endp); if (operatr && !func) { /* Insert 'ans' if on the beginning */ if ((skin->get_insert_pos(hwnd_edit) == 0) || ((startp != endp) && (startp == 0))) skin->insert_input_text(hwnd_edit, _T("ans")); skin->insert_input_text(hwnd_edit, text); } else if (func) { /* if selected, insert in front of selection and * put brackets around selection */ if (startp != endp) { skin->select_input_text(hwnd_edit, startp, startp); } if ((skin->get_insert_pos(hwnd_edit) == 0) && operatr) { skin->insert_input_text(hwnd_edit, _T("ans")); if (startp != endp) endp += 3; } int len = _tcslen(text); if (len) skin->insert_input_text(hwnd_edit, text); if (!nostartparen) { skin->insert_input_text(hwnd_edit, _T("(")); startp += 1; endp += 1; } if (startp != endp) { startp += len; endp += len; skin->set_insert_pos(hwnd_edit, endp); if (text[len-1] == '"') skin->insert_input_text(hwnd_edit, _T("\"")); else skin->insert_input_text(hwnd_edit, _T(")")); skin->select_input_text(hwnd_edit, startp, endp); } else if (calcPrefs.matchParenth) { /* nothing selected */ if (text[len-1] == '"') skin->insert_input_text(hwnd_edit, _T("\"")); else skin->insert_input_text(hwnd_edit, _T(")")); skin->set_insert_pos(hwnd_edit, skin->get_insert_pos(hwnd_edit)-1); } if ((startp == endp) && helptext && calcPrefs.insertHelp) { startp = skin->get_insert_pos(hwnd_edit); skin->insert_input_text(hwnd_edit, helptext); skin->select_input_text(hwnd_edit, startp, startp+_tcslen(helptext)); } } else skin->insert_input_text(hwnd_edit, text); } /*********************************************************************** * * FUNCTION: main_btnrow_click * * DESCRIPTION: Handle the tap on the button on the screen, * insert the proper text on the input line * * PARAMETERS: btnid - id of pressed button * * RETURN: true - button is in the group * false - button doesn't exist * ***********************************************************************/ static Boolean main_btnrow_click(Skin *skin, int btnid) IFACE; static Boolean main_btnrow_click(Skin *skin, int btnid) { if ((btnid < 1) || (btnid > BUTTON_COUNT)) return false; int index = btnid - 1; main_insert(skin, NULL, buttonString[index].string, buttonString[index].operatr, buttonString[index].func, buttonString[index].nostartparen, buttonString[index].helptext ); return true; } --- NEW FILE: ansops.cpp --- /* * $Id: ansops.cpp,v 1.1 2009/09/24 21:16:09 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...'. */ #include "stdafx.h" #include "compat/PalmOS.h" #include "konvert.h" #include "stack.h" //#include "result.h" #include "core_display.h" #include "defuns.h" #include "ansops.h" #include "EasyCalc.h" //#include "calcrsc.h" /*********************************************************************** * * FUNCTION: ans_redisplay * * DESCRIPTION: Executes a code and display its result on display * If the result is string, display it as formatted * * PARAMETERS: text - code to execute * * RETURN: None * ***********************************************************************/ void ans_redisplay(Skin *skin, void *hWnd_p, TCHAR *text) { CError err; CodeStack *stack; Trpn vysledek; stack = text_to_stack(text,&err); if (!err) { err = stack_compute(stack); if (!err) { vysledek = stack_pop(stack); if (vysledek.type == string) result_set_pow(skin, hWnd_p, vysledek.u.stringval); else result_set(skin, hWnd_p, vysledek); rpn_delete(vysledek); } stack_delete(stack); } if (err) result_error(skin, hWnd_p, err); return; 1; //result_draw(); } /*********************************************************************** * * FUNCTION: ans_guess * * DESCRIPTION: Guesses last entered value and displays the result on display * * PARAMETERS: None * * RETURN: None * ***********************************************************************/ void ans_guess(Skin *skin, void *hWnd_p) { TCHAR *result; CError err; Trpn ans; ans = db_read_variable(_T("ans"),&err); if (err) { FrmAlert(altAnsProblem, hWnd_p); return; } result = guess(ans); if (!result) { FrmAlert(altGuessNotFound, hWnd_p); rpn_delete(ans); return; } result_set_pow(skin, hWnd_p, result); rpn_delete(ans); MemPtrFree(result); return; 1; //result_draw(); } --- 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" #include "system - UI/skin.h" #include "compat/PalmOS.h" #include "core/mlib/display.h" #include "core/prefs.h" typedef enum { plaintext, powtext, fmtnumber }printType; typedef struct { rpntype ansType; printType formatType; Tbase dispBase; }TresultPrefs; #define MENULEVEL_COMMAND 0 #define MENULEVEL_ALPHA 1 #define MENULEVEL_TRANSIENT 2 #define MENULEVEL_PLAIN 3 #define MENULEVEL_APP 4 #ifndef _CORE_DISPLAY_C_ extern TCHAR *resMenuDesc[]; // Array of strings for the result actions menu. extern TCHAR *strErrCodes[]; // Error strings #endif void squeak(void); void redisplay(void); void set_menu(int level, int menuid); void result_copy(Skin *skin) IFACE; void result_set(Skin *skin, void *hWnd_p, Trpn item) IFACE; void result_set_text(Skin *skin, void *hWnd_p, TCHAR *text,rpntype type) IFACE; void result_set_pow(Skin *skin, void *hWnd_p, TCHAR *text) IFACE; void result_popup(Skin *skin, void *hWnd_p) IFACE; void result_action(Skin *skin, void *hWnd_p, void *hWnd_calc, int selection); void result_error(Skin *skin, void *hWnd_p, CError errcode) IFACE; TCHAR *print_error(CError err); #endif --- 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: 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/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_mode = 0; // pending_command = saved_pending_command; // } else if ((pending_command != CMD_NONE) && (pending_command != CMD_CANCELLED) // && ((cmdlist(pending_command)->flags & FLAG_NO_SHOW) == 0)) { // display_command(0); // /* If the program catalog was left up by GTO or XEQ, // * don't paint over it */ // if ((mode_transientmenu == MENU_NONE) || (pending_command == CMD_NULL)) // display_x(1); // flush_display(); // } } /******************************************************************************** * FUNCTION: core_keytimeout2() * * This function informs the emulator core that 2 seconds have passed since * * core_keytimeout1() was called. (If the key is released less than 2 seconds * * after core_keytimeout1() is called, this function is not called.) * * This marks the moment when the calculator switches from displaying the key's * * function name to displaying 'NULL' (informing the user that the key has been * * annulled and so no operation will be performed when it is released). * ********************************************************************************/ void core_keytimeout2() { // Function not used by EasyCalc // if ((pending_command == CMD_LINGER1) || (pending_command == CMD_LINGER2)) // return; // remove_program_catalog = 0; // if ((pending_command != CMD_NONE) && (pending_command != CMD_CANCELLED) // && ((cmdlist(pending_command)->flags & FLAG_NO_SHOW) == 0)) { // clear_row(0); // draw_string(0, 0, "NULL", 4); // display_x(1); // flush_display(); // pending_command = CMD_CANCELLED; // } } /******************************************************************************** * FUNCTION: core_timeout3() * * A wakeup call that the core can request by calling shell_request_timeout3(). * * Used to implement the brief linger period after MEM, SHOW, and shift- * * VARMENU. The 'repaint' parameter says whether the callback is invoked * * because the timeout period expired (1), or because a key event is on its * * way (0); if a key event is on its way, the emulator core should not repaint * * the screen, in order to avoid flashing. * ********************************************************************************/ void core_timeout3(int repaint) { // Function not used by EasyCalc // /* Remove the output of SHOW, MEM, or shift-VARMENU from the display */ // if (pending_command == CMD_LINGER1) // pending_command = CMD_CANCELLED; // else if (pending_command == CMD_LINGER2) { // flags.f.message = 0; // flags.f.two_line_message = 0; // pending_command = CMD_NONE; // if (repaint) // redisplay(); // } } /******************************************************************************** * FUNCTION: core_alpha_menu() * * The shell uses this function to check if the core is in "alpha" mode (i.e. * * the ALPHA menu or any of its submenus is active). This affects how events * * from the keyboard (the real PC keyboard, not the on-screen one emulated by * * the calc) or PalmOS Graffiti device are handled: in alpha mode, printable * * ASCII characters are sent straight to the core; outside alpha mode, all * * key events are translated sequences of key events according to the keymap * * file. * ********************************************************************************/ int core_alpha_menu() { // int *menu = get_front_menu(); // return ((menu != NULL) && (*menu >= MENU_ALPHA1) && (*menu <= MENU_ALPHA_MISC2)); return (0); } /******************************************************************************** * FUNCTION: core_hex_menu() * * The shell uses this function to check if the core is in "hex" mode (i.e. * * the A..F submenu of the BASE application is active). This affects how events * * from the keyboard (the real PC keyboard, not the on-screen one emulated by * * the calc) are handled: in hex mode, 'A' through 'F' and 'a' through 'f' are * * translated to keycodes 1 through 6, regardless of the keyboard map. * ********************************************************************************/ int core_hex_menu() { // int *menu = get_front_menu(); // return ((menu != NULL) && (*menu == MENU_BASE_A_THRU_F)); return (0); } /******************************************************************************** * FUNCTION: core_keydown() * * This function informs the emulator core that a key was pressed. Keys * * are identified using a numeric key code, which corresponds to the key * * numbers returned by the 'GETKEY' function: 'Sigma+' is 1, '1/x' is 2, * * and so on. The shift key is 28 -- 'shift' handling is performed by the * * emulator core, so it needs to receive raw key codes, unlike the 'GETKEY' * * function, which handles the shift key itself and then returns key codes in * * the range 38..74 for shifted keys. The core_keydown() function should only * * be called with key codes from 1 to 37, inclusive. * * Keys that cause immediate action should be handled immediately when this * * function is called, and calls to core_keytimeout1(), core_keytimeout2(), * * and core_keyup() should be ignored (until the next core_keydown(), that * * is!). Keys that are handled only when *released* should not be handled * * immediately when this function is called; the emulator core should store the * * key code, handle core_keytimeout1() and core_keytimeout2() as appropriate, * * and not perform any action until core_keyup() is called. * * RETURNS: a flag indicating whether or not the front end should call this * * function again as soon as possible. This will be 1 if the calculator is * * running a user program, and is only returning execution to the shell because * * it has detected that there is a pending event. * * The 'enqueued' pointer is a return parameter that the emulator core uses to * * tell the shell if it has enqueued the keystroke. If this is 1, the shell * * should not send call timeout1(), timeout2(), or keyup() for this keystroke. * * NOTE: a key code of 0 (zero) signifies 'no key'; this is needed if the shell * * is calling this function because it asked to be called (by returning 1 the * * last time) but no keystrokes are available. It is not necessary to balance * * the keydown call with a keyup in this case. * * The 'repeat' pointer is a return parameter that the emulator core uses to * * ask the shell to auto-repeat the current key. If this is set to 1 or 2, the * * shell will not call timeout1() and timeout2(), but will repeatedly call * * core_repeat() until the key is released. (1 requests a slow repeat rate, for * * SST/BST; 2 requests a fast repeat rate, for number/alpha entry.) * ********************************************************************************/ int core_keydown(int key, int *enqueued, int *repeat) { *enqueued = 0; *repeat = 0; if (key == KEY_SHIFT) { set_shift(!mode_shift); return (mode_running || (keybuf_head != keybuf_tail)); } if (mode_interruptible != NULL) { /* We're in the middle of an interruptible function * (e.g., INVRT, PRP); queue up any keystrokes and invoke * the appropriate callback to keep the funtion moving along */ int error, keep_running; if (key != 0) { /* Enqueue... */ *enqueued = 1; if (key == KEY_EXIT || (mode_stoppable && !mode_shift && (key == KEY_RUN))) { keybuf_tail = keybuf_head; stop_interruptible(); return (0); } else { if (((keybuf_head + 1) & 15) != keybuf_tail) { if (mode_shift) key = -key; keybuf[keybuf_head] = key; keybuf_head = (keybuf_head + 1) & 15; } } set_shift(false); } error = mode_interruptible(0); if (error == ERR_INTERRUPTIBLE) /* Still not done */ return (1); mode_interruptible = NULL; keep_running = handle_error(error); if (mode_running) { if (!keep_running) set_running(false); } else { shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, false); pending_command = CMD_NONE; } if (mode_running || (keybuf_tail != keybuf_head)) return (1); else { redisplay(); return (0); } } if (mode_running && !mode_getkey) { /* We're running; queue up any keystrokes and invoke * continue_running() to keep the program moving along */ if (key != 0) { if (key == KEY_EXIT) { keybuf_tail = keybuf_head; set_shift(false); set_running(false); pending_command = CMD_CANCELLED; return (0); } /* Enqueue... */ *enqueued = 1; if (!mode_shift && (key == KEY_RUN)) { keybuf_tail = keybuf_head; set_running(false); redisplay(); return (0); } if (((keybuf_head + 1) & 15) != keybuf_tail) { if (mode_shift) key = -key; keybuf[keybuf_head] = key; keybuf_head = (keybuf_head + 1) & 15; } set_shift(false); } continue_running(); if ((mode_running && !mode_getkey) || (keybuf_tail != keybuf_head)) return (1); else { if (mode_getkey) /* Technically, the program is still running, but we turn * off the 'running' annunciator so that the user has some * cue that they may now type. */ shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, false); else redisplay(); return (0); } } /* If we get here, mode_running must be false. * or a program is running but hanging in GETKEY; */ if (keybuf_tail != keybuf_head) { /* We're not running, or a program is waiting in GETKEY; * feed queued-up keystroke to keydown() */ int oldshift = 0; int oldkey = keybuf[keybuf_tail]; if (oldkey < 0) { oldkey = -oldkey; oldshift = 1; } keybuf_tail = (keybuf_tail + 1) & 15; /* If we're in GETKEY mode, the 'running' annunciator is off; * see the code circa 30 lines back. * We now turn it back on since program execution resumes. */ if (mode_getkey && mode_running) shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, true); /* Feed the dequeued key to the usual suspects */ #define keydown(a,b) keydown(oldshift, oldkey); core_keyup(); /* We've just de-queued a key; may have to enqueue * one as well, if the user is actually managing to * type while we're unwinding the keyboard buffer */ if (key != 0) { if (((keybuf_head + 1) & 15) != keybuf_tail) { if (mode_shift) key = -key; keybuf[keybuf_head] = key; keybuf_head = (keybuf_head + 1) & 15; } set_shift(false); } return (mode_running || (keybuf_head != keybuf_tail)); } /* No program is running, or it is running but waiting for a * keystroke (GETKEY); handle any new keystroke that has just come in */ if (key != 0) { int shift = mode_shift; set_shift(false); if (mode_getkey && mode_running) shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, true); keydown(shift, key); if (repeating != 0) { *repeat = repeating; repeating = 0; } return (mode_running && !mode_getkey); } /* Nothing going on at all! */ return (0); } /******************************************************************************** * FUNCTION: core_keyup() * * This function informs the emulator core that the currently pressed key (that * * is, the one whose key code was given to it in the most recent call to * * core_keydown()) has been released. * * This function is always called when a key is released, regardless of how * * long it was held down, and regardless of whether or not core_keytimeout1() * * and core_keytimeout2() were called following the most recent * * core_keydown(). * * RETURNS: a flag indicating whether or not the front end should call this * * function again as soon as possible. This will be 1 if the calculator is * * running a user program, and is only returning execution to the shell because * * it has detected that there is a pending event. * ********************************************************************************/ int core_keyup() { int error = ERR_NONE; if ((pending_command == CMD_LINGER1) || (pending_command == CMD_LINGER2)) { pending_command = CMD_LINGER2; return (mode_running || (keybuf_head != keybuf_tail)); } if (pending_command == CMD_SILENT_OFF) { shell_powerdown(); pending_command = CMD_NONE; return (0); } if (pending_command == CMD_NONE) return (mode_running || (keybuf_head != keybuf_tail)); /* if (remove_program_catalog) { if (mode_transientmenu == MENU_CATALOG) set_menu(MENULEVEL_TRANSIENT, MENU_NONE); else if (mode_plainmenu == MENU_CATALOG) set_menu(MENULEVEL_PLAIN, MENU_NONE); remove_program_catalog = 0; } if ((pending_command == CMD_CANCELLED) || (pending_command == CMD_NULL)) { pending_command = CMD_NONE; redisplay(); return (mode_running || (keybuf_head != keybuf_tail)); } mode_varmenu = (pending_command == CMD_VMSTO) || (pending_command == CMD_VMSTO2) || (pending_command == CMD_VMSOLVE) || (pending_command == CMD_VMEXEC); if (input_length > 0) { */ /* INPUT active */ /* if ((pending_command == CMD_RUN) || (pending_command == CMD_SST)) { int err = generic_sto(&input_arg, 0); if ((flags.f.trace_print || flags.f.normal_print) && flags.f.printer_exists) { char lbuf[12], rbuf[100]; int llen, rlen; string_copy(lbuf, &llen, input_name, input_length); lbuf[llen++] = '='; rlen = vartype2string(reg_x, rbuf, 100); print_wide(lbuf, llen, rbuf, rlen); } input_length = 0; if (err != ERR_NONE) { pending_command = CMD_NONE; display_error(err, 1); redisplay(); return (mode_running || (keybuf_head != keybuf_tail)); } } else if ((pending_command == CMD_GTO) || (pending_command == CMD_GTODOT) || (pending_command == CMD_GTODOTDOT) || (pending_command == CMD_RTN)) */ /* NOTE: set_running(true) also ends INPUT mode, so commands that * cause program execution to start do not have to be handled here. */ /* input_length = 0; } if (pending_command == CMD_VMEXEC) { string_copy(reg_alpha, ®_alpha_length, pending_command_arg.val.text, pending_command_arg.length); goto do_run; } if (pending_command == CMD_RUN) { do_run: if ((flags.f.trace_print || flags.f.normal_print) && flags.f.printer_exists) print_command(pending_command, &pending_command_arg); pending_command = CMD_NONE; if (pc == -1) pc = 0; set_running(true); return (1); } if (pending_command == CMD_SST) { int cmd; arg_struct arg; oldpc = pc; if (pc == -1) pc = 0; get_next_command(&pc, &cmd, &arg, 1); if ((flags.f.trace_print || flags.f.normal_print) && flags.f.printer_exists) print_program_line(current_prgm, oldpc); mode_disable_stack_lift = false; set_running(true); error = cmdlist(cmd)->handler(&arg); set_running(false); } else { if ((flags.f.trace_print || flags.f.normal_print) && flags.f.printer_exists) print_command(pending_command, &pending_command_arg); mode_disable_stack_lift = false; error = cmdlist(pending_command)->handler(&pending_command_arg); } if (error == ERR_INTERRUPTIBLE) { shell_annunciators(-1, -1, -1, 1, -1, -1); return (1); } handle_error(error); pending_command = CMD_NONE; if (!mode_getkey) redisplay(); */ return ((mode_running && !mode_getkey) || (keybuf_head != keybuf_tail)); } /******************************************************************************** * FUNCTION: set_running * * Go to running mode and display it. * ********************************************************************************/ void set_running(bool state) { if (mode_running != state) { mode_running = state; shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, state); } if (state) { /* Cancel any pending INPUT command */ // input_length = 0; // mode_goose = -2; // prgm_highlight_row = 1; } } /******************************************************************************** * FUNCTION: stop_interruptible() * * Run programs. * ********************************************************************************/ void continue_running() { /* int error; while (!shell_wants_cpu()) { int cmd; arg_struct arg; oldpc = pc; if (pc == -1) pc = 0; else if (pc >= prgms[current_prgm].size) { pc = -1; set_running(false); return; } get_next_command(&pc, &cmd, &arg, 1); if (flags.f.trace_print && flags.f.printer_exists) print_program_line(current_prgm, oldpc); mode_disable_stack_lift = false; error = cmdlist(cmd)->handler(&arg); if (error == ERR_INTERRUPTIBLE) return; if (!handle_error(error)) return; if (mode_getkey) return; }*/ } /******************************************************************************** * FUNCTION: stop_interruptible() * * Stops current running function. * ********************************************************************************/ static void stop_interruptible() { int error = mode_interruptible(1); handle_error(error); mode_interruptible = NULL; if (mode_running) set_running(false); else shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, false); pending_command = CMD_NONE; redisplay(); } /******************************************************************************** * FUNCTION: handle_error() * ********************************************************************************/ static int handle_error(int error) { /* if (mode_running) { if (error == ERR_RUN) error = ERR_NONE; if (error == ERR_NONE || error == ERR_NO || error == ERR_YES || error == ERR_STOP) flags.f.stack_lift_disable = mode_disable_stack_lift; if (error == ERR_NO) { if (prgms[current_prgm].text[pc] != CMD_END) pc += get_command_length(current_prgm, pc); } else if (error == ERR_STOP) { if (pc >= prgms[current_prgm].size) pc = -1; set_running(false); return 0; } else if (error != ERR_NONE && error != ERR_YES) { if (flags.f.error_ignore) { flags.f.error_ignore = 0; return 1; } if (solve_active() && (error == ERR_OUT_OF_RANGE || error == ERR_DIVIDE_BY_0 || error == ERR_INVALID_DATA || error == ERR_STAT_MATH_ERROR)) { unwind_stack_until_solve(); error = return_to_solve(1); if (error == ERR_STOP) set_running(false); if (error == ERR_NONE || error == ERR_RUN || error == ERR_STOP) return 0; } pc = oldpc; display_error(error, 1); set_running(false); return 0; } return 1; } else if (pending_command == CMD_SST) { if (error == ERR_RUN) error = ERR_NONE; if (error == ERR_NONE || error == ERR_NO || error == ERR_YES || error == ERR_STOP) flags.f.stack_lift_disable = mode_disable_stack_lift; if (error == ERR_NO) { if (prgms[current_prgm].text[pc] != CMD_END) pc += get_command_length(current_prgm, pc); goto noerr; } else if (error == ERR_NONE || error == ERR_YES || error == ERR_STOP) { noerr: error = ERR_NONE; if (pc > prgms[current_prgm].size) pc = -1; } else { if (flags.f.error_ignore) { flags.f.error_ignore = 0; goto noerr; } if (solve_active() && (error == ERR_OUT_OF_RANGE || error == ERR_DIVIDE_BY_0 || error == ERR_INVALID_DATA || error == ERR_STAT_MATH_ERROR)) { unwind_stack_until_solve(); error = return_to_solve(1); if (error == ERR_NONE || error == ERR_RUN || error == ERR_STOP) goto noerr; } pc = oldpc; display_error(error, 1); } return 0; } else { if (error == ERR_RUN) { set_running(true); error = ERR_NONE; } if (error == ERR_NONE || error == ERR_NO || error == ERR_YES || error == ERR_STOP) flags.f.stack_lift_disable = mode_disable_stack_lift; else if (flags.f.error_ignore) { flags.f.error_ignore = 0; error = ERR_NONE; } if (error != ERR_NONE && error != ERR_STOP) display_error(error, 1); return 0; }*/ return (0); } --- NEW FILE: varmgr.h --- /* * $Id: varmgr.h,v 1.1 2009/09/24 21:16:09 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 _VARMGR_H_ #define _VARMGR_H_ #define MAX_LIST_LENGTH 13 #define MAX_EDIT_TITLE 30 #include "Skin.h" void history_popup(Skin *skin, void *hWnd) IFACE; TCHAR *history_action(Skin *skin, void *hWnd_p, void *hWnd_calc, int selection); void varmgr_popup(Skin *skin, void *hWnd, rpntype type); TCHAR *varmgr_action(int selection); void varmgr_listVar(Skin *skin, void *hWnd); void varmgr_listVar_action(TCHAR *text, void *hWnd_calc, bool saveasvar); void varmgr_popup_builtin(Skin *skin, void *hWnd); TCHAR *varmgr_builtinAction(int selection); bool varmgr_getVarDef (TCHAR *varname, TCHAR **varDef); bool varmgr_getFctDef (TCHAR *fctname, TCHAR **fctDef, TCHAR *fctParam); Boolean varmgr_edit_save(TCHAR *namefield, TCHAR *varfield, TCHAR *paramfield, rpntype type, Boolean editname, void *hWnd_p) IFACE; Boolean varmgr_get_double(double *value,TCHAR *title) IFACE; Boolean varmgr_get_complex(Complex *value,TCHAR *title) IFACE; Boolean varmgr_get_varstring(TCHAR *varname,TCHAR *title) IFACE; #endif --- NEW FILE: ansops.h --- /* * $Id: ansops.h,v 1.1 2009/09/24 21:16:09 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(Skin *skin, void *hdc) IFACE; void ans_redisplay(Skin *skin, void *hdc, TCHAR *text) IFACE; #endif --- NEW FILE: prefs.h --- /* * $Id: prefs.h,v 1.1 2009/09/24 21:16:09 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999,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 _PREFS_H_ #define _PREFS_H_ #include "segment.h" //#include "calcrsc.h" #include "konvert.h" #include "defuns.h" #include "display.h" // Coming from calcrsc.h #define MAX_INPUT_LENGTH 1000 #define MAX_WORKSHEET_TITLE 32 #define MAX_WORKSHEET_NOTE 300 #define MAX_WORKSHEET_HELP 39 typedef struct { UInt16 form; /* last form */ UInt16 btnRow; /* Selected btnrow on scientific form */ UInt16 insertPos; /* last insert position */ UInt16 selPosStart, selPosEnd; Boolean finBegin; /* Begin/end selector in financial form */ Boolean matchParenth; /* Add ')' to functions ending with '(' */ Ttrigo_mode trigo_mode; TdispPrefs dispPrefs; Boolean insertHelp; /* Insert help strings where appropriate */ Boolean acceptPalmPref; /* Accept Palm settings about number formatting */ Boolean reducePrecision; Boolean dispScien; Int16 solverWorksheet; TCHAR input[MAX_INPUT_LENGTH+1]; }tPrefs; void prefs_read_preferences() IFACE; void prefs_save_preferences() IFACE; //Boolean PreferencesHandleEvent(EventPtr event) IFACE; extern tPrefs calcPrefs; #endif --- NEW FILE: varmgr.cpp --- /* * $Id: varmgr.cpp,v 1.1 2009/09/24 21:16:09 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...'. */ #include "stdafx.h" #include "compat/PalmOS.h" //#include <LstGlue.h> //#include <WinGlue.h> #include "konvert.h" #include "calcDB.h" #include "display.h" #include "varmgr.h" //#include "calcrsc.h" #include "stack.h" //#include "calc.h" #include "core/core_display.h" #include "funcs.h" #include "history.h" #include "defuns.h" #include "main.h" #include "EasyCalc.h" #ifdef HANDERA_SDK #include "Vga.h" #endif #ifdef SUPPORT_DIA #include "DIA.h" #endif /*********************************************************************** * * FUNCTION: history_popup * * DESCRIPTION: Displays a history list popup. * * PARAMETERS: hWnd is a pointer at an OS specific structure describing * the history popup list object. * * RETURN: Nothing * ***********************************************************************/ void history_popup (Skin *skin, void *hWnd) { int i; int numitems; bool isrpn; Trpn item; TCHAR *text; numitems = history_total(); for (i=0 ; i<numitems ; i++) { isrpn = history_isrpn(i); if (isrpn) { item = history_get_item(i); text = display_default(item,false); rpn_delete(item); } else { text = history_get_line(i); } skin->historyAddActionPopup(text, hWnd); MemPtrFree(text); } } /*********************************************************************** * * FUNCTION: history_action * * DESCRIPTION: Execute action from the history popup dialog. * * PARAMETERS: hWnd_p OS specific handle to the dialog window * hWnd_calc OS specific handle to the calculator window * * RETURN: None * ***********************************************************************/ TCHAR *history_action(Skin *skin, void *hWnd_p, void *hWnd_calc, int selection) { TCHAR *result = NULL; // Execute the action if (history_isrpn(selection)) { Trpn item = history_get_item(selection); result = display_default(item,true); rpn_delete(item); if (_tcslen(result) > 25) StrPrintF(result,_T("history(%d)"),selection); } else result = history_get_line(selection); return (result); } /*********************************************************************** * * FUNCTION: varmgr_popup * * DESCRIPTION: Popups a menu with list of variables/functions * and their values * * PARAMETERS: hWnd is a pointer at an OS specific structure describing * the popup list object. * type is the type of what to display. * * RETURN: Name of selected variable/function or NULL * ***********************************************************************/ static dbList *varlist; static TCHAR **values; void varmgr_popup(Skin *skin, void *hWnd, rpntype type) { Trpn item; ... [truncated message content] |