⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scicalc.cxx

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 CXX
📖 第 1 页 / 共 4 页
字号:
/*                                                                        * Copyright (c) 2003 Century Software, Inc.   All Rights Reserved.      *                                                                        * This file is part of the PIXIL Operating Environment                  *                                                                        * The use, copying and distribution of this file is governed by one     * of two licenses, the PIXIL Commercial License, or the GNU General     * Public License, version 2.                                            *                                                                        * Licensees holding a valid PIXIL Commercial License may use this file  * in accordance with the PIXIL Commercial License Agreement provided    * with the Software. Others are governed under the terms of the GNU    * General Public License version 2.                                     *                                                                        * This file may be distributed and/or modified under the terms of the   * GNU General Public License version 2 as published by the Free         * Software Foundation and appearing in the file LICENSE.GPL included    * in the packaging of this file.                                       *                                                                        * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING   * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A             * PARTICULAR PURPOSE.                                                   *                                                                        * RESTRICTED RIGHTS LEGEND                                              *                                                                      * Use, duplication, or disclosure by the government is subject to       * restriction as set forth in paragraph (b)(3)(b) of the Rights in      * Technical Data and Computer Software clause in DAR 7-104.9(a).        *                                                                       * See http://embedded.centurysoftware.com/gpl/ for GPL licensing        * information.                                                          *                                                                       * See http://embedded.centurysoftware.com/license.html or               * email cetsales@centurysoftware.com for information about the PIXIL    * Commercial License Agreement, or if any conditions of this licensing  * are not clear to you.                                                 */// generated by Fast Light User Interface Designer (fluid) version 2.00// Altered by Shaun Kruger#include "SciCalc.h"#include <stdio.h>#include <string.h>#include <math.h>#ifdef NANOX#include <nano-X.h>#define DEF_STYLE (GR_WM_PROPS_APPWINDOW | GR_WM_PROPS_NOAUTORESIZE | GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)#endif//change these later...#ifndef WIDTH#define WIDTH W_W#endif//181#ifndef HEIGHT#define HEIGHT W_H#endif//262#define DEF_COLOR		FL_LIGHT3static doublegammaln(double xx){    int j;    double x, y, tmp, ser;    static double cof[6] = { 76.18009172947146,	-86.50532032941677,	24.01409824083091,	-1.231739572450155,	0.1208650973866179e-2,	-0.5395239384953e-5    };    y = x = xx;    tmp = x + 5.5;    tmp -= (x + 0.5) * log(tmp);    ser = 1.000000000190015;    for (j = 0; j < 6; j++)	ser += cof[j] / ++y;    return -tmp + log(2.5066282746310005 * ser / x);}static doubletruncf(double x){    if (x < 0.0)	x = -floor(-x);    else	x = floor(x);    return x;}inline voidSciCalc::cb_leddisplay_i(StaticText * o, void *){    o->value("0 ");}voidSciCalc::cb_leddisplay(StaticText * o, void *v){    ((SciCalc *) v)->cb_leddisplay_i(o, v);}inline voidSciCalc::cb_box_DEGRAD_i(StaticText * o, void *){    o->value(" ");}voidSciCalc::cb_box_DEGRAD(StaticText * o, void *v){    ((SciCalc *) v)->cb_box_DEGRAD_i(o, v);}inline voidSciCalc::cb_box_M_i(StaticText * o, void *){    o->value("M");}voidSciCalc::cb_box_M(StaticText * o, void *v){    ((SciCalc *) v)->cb_box_M_i(o, v);}inline voidSciCalc::cb_radio_2_i(Fl_Button *, void *){    change_base(2);}voidSciCalc::cb_radio_2(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_radio_2_i(o, v);}inline voidSciCalc::cb_radio_8_i(Fl_Button *, void *){    change_base(8);}voidSciCalc::cb_radio_8(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_radio_8_i(o, v);}inline voidSciCalc::cb_radio_10_i(Fl_Button *, void *){    change_base(10);}voidSciCalc::cb_radio_10(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_radio_10_i(o, v);}inline voidSciCalc::cb_radio_16_i(Fl_Button *, void *){    change_base(16);}voidSciCalc::cb_radio_16(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_radio_16_i(o, v);}inline voidSciCalc::cb_but_7_i(Fl_Button *, void *){    handle_number(7);}voidSciCalc::cb_but_7(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_7_i(o, v);}inline voidSciCalc::cb_but_8_i(Fl_Button *, void *){    handle_number(8);}voidSciCalc::cb_but_8(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_8_i(o, v);}inline voidSciCalc::cb_but_9_i(Fl_Button *, void *){    handle_number(9);}voidSciCalc::cb_but_9(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_9_i(o, v);}inline voidSciCalc::cb_but_4_i(Fl_Button *, void *){    handle_number(4);}voidSciCalc::cb_but_4(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_4_i(o, v);}inline voidSciCalc::cb_but_5_i(Fl_Button *, void *){    handle_number(5);}voidSciCalc::cb_but_5(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_5_i(o, v);}inline voidSciCalc::cb_but_6_i(Fl_Button *, void *){    handle_number(6);}voidSciCalc::cb_but_6(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_6_i(o, v);}inline voidSciCalc::cb_but_1_i(Fl_Button *, void *){    handle_number(1);}voidSciCalc::cb_but_1(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_1_i(o, v);}inline voidSciCalc::cb_but_2_i(Fl_Button *, void *){    handle_number(2);}voidSciCalc::cb_but_2(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_2_i(o, v);}inline voidSciCalc::cb_but_3_i(Fl_Button *, void *){    handle_number(3);}voidSciCalc::cb_but_3(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_3_i(o, v);}inline voidSciCalc::cb_but_0_i(Fl_Button *, void *){    handle_number(0);}voidSciCalc::cb_but_0(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_0_i(o, v);}inline voidSciCalc::cb_but_dot_i(Fl_Button *, void *){    handle_number(DOT);}voidSciCalc::cb_but_dot(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_dot_i(o, v);}inline voidSciCalc::cb_but_sign_i(Fl_Button *, void *){    if (!emode) {	value[top] = -value[top];	set_display(value[top], NORM);    } else {	exponent = -exponent;	value[top] = mantissa * pow(10.0, (double) exponent);	set_display(mantissa, EXP);    }}voidSciCalc::cb_but_sign(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_sign_i(o, v);}inline voidSciCalc::cb_but_C_i(Fl_Button *, void *){    init_value(top);    set_display(0.0, NORM);}voidSciCalc::cb_but_C(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_C_i(o, v);}inline voidSciCalc::cb_but_AC_i(Fl_Button *, void *){    init_value(0);    set_display(0.0, NORM);    currentbrkt = 0;    box_bracket->value("");    box_bracket->redraw();}voidSciCalc::cb_but_AC(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_AC_i(o, v);}inline voidSciCalc::cb_but_X_i(Fl_Button *, void *){    handle_operator(MULT);}voidSciCalc::cb_but_X(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_X_i(o, v);}inline voidSciCalc::cb_but_div_i(Fl_Button *, void *){    handle_operator(DIV);}voidSciCalc::cb_but_div(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_div_i(o, v);}inline voidSciCalc::cb_but_plus_i(Fl_Button *, void *){    handle_operator(PLUS);}voidSciCalc::cb_but_plus(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_plus_i(o, v);}inline voidSciCalc::cb_but_minus_i(Fl_Button *, void *){    handle_operator(MINUS);}voidSciCalc::cb_but_minus(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_minus_i(o, v);}inline voidSciCalc::cb_but_pi_i(Fl_Button *, void *){    exponent_pi();}voidSciCalc::cb_but_pi(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_pi_i(o, v);}inline voidSciCalc::cb_but_eval_i(Fl_Button *, void *){    handle_operator(EVAL);}voidSciCalc::cb_but_eval(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_eval_i(o, v);}inline voidSciCalc::cb_but_sqrt_i(Fl_Button *, void *){    if (base > 10)	handle_number(10.0);    else if (!inv) {	value[top] = sqrt(value[top]);	set_display(value[top], NORM);	ready = 1;    } else {	value[top] = pow(value[top], 2.0);	set_display(value[top], NORM);	ready = 1;    };}voidSciCalc::cb_but_sqrt(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_sqrt_i(o, v);}inline voidSciCalc::cb_but_pow_i(Fl_Button *, void *){    if (base > 10)	handle_number(11.0);    else	handle_operator(check_inv->value()? INVPOW : POW);}voidSciCalc::cb_but_pow(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_pow_i(o, v);}inline voidSciCalc::cb_but_sin_i(Fl_Button *, void *){    if (base > 10)	handle_number(12.0);    else if (!inv) {	value[top] = sin(to_drg(value[top]));	set_display(value[top], NORM);	ready = 1;    } else {	value[top] = from_drg(asin(value[top]));	set_display(value[top], NORM);	ready = 1;    };}voidSciCalc::cb_but_sin(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_sin_i(o, v);}inline voidSciCalc::cb_but_cos_i(Fl_Button *, void *){    if (base > 10)	handle_number(13.0);    else if (!inv) {	value[top] = cos(to_drg(value[top]));	set_display(value[top], NORM);	ready = 1;    } else {	value[top] = from_drg(acos(value[top]));	set_display(value[top], NORM);	ready = 1;    };}voidSciCalc::cb_but_cos(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_cos_i(o, v);}inline voidSciCalc::cb_but_tan_i(Fl_Button *, void *){    if (base > 10)	handle_number(14.0);    else if (!inv) {	value[top] = tan(to_drg(value[top]));	set_display(value[top], NORM);	ready = 1;    } else {	value[top] = from_drg(atan(value[top]));	set_display(value[top], NORM);	ready = 1;    };}voidSciCalc::cb_but_tan(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_tan_i(o, v);}inline voidSciCalc::cb_but_log_i(Fl_Button *, void *){    if (base > 10)	handle_number(15.0);    else if (!inv) {	value[top] = log10(value[top]);	set_display(value[top], NORM);	ready = 1;    } else {	value[top] = pow(10.0, value[top]);	set_display(value[top], NORM);	ready = 1;    };}voidSciCalc::cb_but_log(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_log_i(o, v);}inline voidSciCalc::cb_but_ln_i(Fl_Button *, void *){    if (!inv) {	value[top] = log(value[top]);	set_display(value[top], NORM);	ready = 1;    } else {	value[top] = exp(value[top]);	set_display(value[top], NORM);	ready = 1;    };}voidSciCalc::cb_but_ln(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_ln_i(o, v);}inline voidSciCalc::cb_but_int_i(Fl_Button *, void *){    if (!inv) {	value[top] = truncf(value[top]);	set_display(value[top], NORM);	ready = 1;    } else {	value[top] = value[top] - truncf(value[top]);	set_display(value[top], NORM);	ready = 1;    };}voidSciCalc::cb_but_int(Fl_Button * o, void *v){    ((SciCalc *) v)->cb_but_int_i(o, v);}inline voidSciCalc::cb_but_dr_i(Fl_Button *, void *){    if (!inv) {	value[top] = M_PI * value[top] / 180.0;	set_display(value[top], NORM);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -