Update of /cvsroot/easycalc/PPCport/include In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv18192/include Added Files: calcDB.h cmatrix.h complex.h dbutil.h defuns.h display.h fp.h funcs.h history.h integ.h konvert.h mathem.h MathLib.h matrix.h meqstack.h PalmOS.h segment.h slist.h specfun.h stack.h txtask.h Log Message: 1st upload, not compiling. --- NEW FILE: dbutil.h --- /* * $Id: dbutil.h,v 1.1 2008/05/26 20:17:54 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...'. */ #ifndef _DBUTIL_H_ #define _DBUTIL_H_ //#include <PalmOS.h> Int16 open_db(const Char *name, UInt16 dbversion, UInt32 crid, UInt32 dbtype, DmOpenRef *dbref); #endif --- NEW FILE: history.h --- /* * $Id: history.h,v 1.1 2008/05/26 20:17:54 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 _HISTORY_H_ #define _HISTORY_H_ #define HISTORY_RECORDS 30 typedef struct { Boolean isrpn; Int16 xxxpad; union { dbStackItem item; TCHAR *text; }u; }tHistory; CError history_command(Functype *func,CodeStack *stack) MLIB; Int16 history_close(void) MLIB; Int16 history_open(void) MLIB; void history_shrink(Int16 count) MLIB; void history_add_line(TCHAR *line) MLIB; void history_add_item(Trpn item) MLIB; Boolean history_isrpn(UInt16 num) MLIB; UInt16 history_total(void) MLIB; TCHAR * history_get_line(UInt16 num) MLIB; Trpn history_get_item(UInt16 num) MLIB; #endif --- NEW FILE: integ.h --- /* * $Id: integ.h,v 1.1 2008/05/26 20:17:54 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 _INTEG_H_ #define _INTEG_H_ /* Precision for solving functions */ #define DEFAULT_ERROR (1E-8) #define DEFAULT_ROMBERG 6 #define MAX_ITER 2000 CError integ_fsolve(Functype *func,CodeStack *stack) NEWFUNC; CError integ_fsimps(Functype *func,CodeStack *stack) NEWFUNC; CError integ_fdydx(Functype *func,CodeStack *stack) NEWFUNC; double integ_simps(double min, double max,CodeStack *fcstack, double error,CodeStack *argarr) NEWFUNC; double integ_zero(double min, double max, double value, CodeStack *fcstack, double error,Int16 funcnum,CodeStack *argarr) NEWFUNC; double integ_derive1(double x,CodeStack *fcstack,double error, CodeStack *argarr) NEWFUNC; double integ_derive2(double x,CodeStack *fcstack,double error, CodeStack *argarr) NEWFUNC; double integ_romberg(double min,double max,CodeStack *fcstack,Int16 n, CodeStack *argarr) NEWFUNC; CError integ_fromberg(Functype *func,CodeStack *stack) NEWFUNC; double integ_intersect(double min,double max, CodeStack *f1, CodeStack *f2, double error,CodeStack *argarr) NEWFUNC; CError integ_fintersect(Functype *func,CodeStack *stack) NEWFUNC; #endif --- NEW FILE: txtask.h --- /* * $Id: txtask.h,v 1.1 2008/05/26 20:17:55 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 _TXTASK_H_ #define _TXTASK_H_ #define TXTASK_ASK 1200 CError txtask_ask(Functype *func, CodeStack *stack); #endif --- NEW FILE: display.h --- /* * $Id: display.h,v 1.1 2008/05/26 20:17:54 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 _DISPLAY_H_ #define _DISPLAY_H_ #include "konvert.h" typedef enum { disp_decimal=10, disp_hexa=16, disp_octal=8, disp_binary=2 }Tbase; typedef enum { disp_normal, disp_sci, disp_eng }Tdisp_mode; typedef struct { Int8 decPoints; Boolean stripZeros; Tdisp_mode mode; Tbase base; Boolean forceInteger; Boolean cvtUnits; }TdispPrefs; char * display_real(double number) MLIB; char * display_complex(Complex number) MLIB; char * display_integer(UInt32 number,Tbase mode) MLIB; char * display_default(Trpn rpn,Boolean complete) MLIB; char * display_list(List *list) MLIB; extern TdispPrefs dispPrefs; #endif --- NEW FILE: MathLib.h --- /* MathLib: Pilot shared library of IEEE-754 double math functions * * Library function prototypes for the calling application. This is * the file that the calling application should include in order to * get access to the routines in the library; it serves the same * function as the file "math.h" normally used on systems with * standard math libraries. Each function in the library has two * prototypes listed; the first is for the programmer-friendly * wrapper function in MathLib.c, the second is for the raw SYS_TRAP() * invocation that actually calls the library routine. * * Copyright (C) 1997 Rick Huebner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library 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 Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; see file COPYING.LIB. If not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA * * Version 1.01, 23 August 1997, Rick Huebner */ #ifndef __MATHLIB_H__ #define __MATHLIB_H__ #include "segment.h" // Library name for use with SysLibFind() #define MathLibName "MathLib" // Values for use with SysLibLoad() #define LibType 'libr' #define MathLibCreator 'MthL' // This is the major version number of the library. If new functions // are added to this library, this version number must be incremented // to protect programs which are compiled with this header from trying // to invoke the new functions in an old version of MathLib.prc, // which would be fatal. Do NOT delete any functions from this list, // or any older programs which try to use them will die. Any changes // other than adding new functions should be reflected in the minor // part of the version number, e.g. 1.1 if a bug fix, 2.0 if new // functions added. #define MathLibVersion 1 // Possible Err values from MathLib functions typedef enum MathLibErrorCode { mlErrNone = 0, mlErrOldVersion, // library is older than version passed to open() mlErrNotOpen, // close() without having called open() first mlErrNoMemory // can't allocate global data block } MathLibErrorCode; // Library reference returned by SysLibFind() or SysLibLoad() extern UInt16 MathLibRef; /***************************** * Library control functions * *****************************/ Err MathLibOpen(UInt16 refnum, UInt16 version) // Initialize library for use SYS_TRAP(sysLibTrapOpen); Err MathLibClose(UInt16 refnum, UInt16 *usecountP)// Free library resources when finished SYS_TRAP(sysLibTrapClose); Err MathLibSleep(UInt16 refnum) // Called by OS when Pilot sleeps SYS_TRAP(sysLibTrapSleep); Err MathLibWake(UInt16 refnum) // Called by OS when Pilot wakes SYS_TRAP(sysLibTrapWake); /*************************** * Trigonometric functions * ***************************/ double acos(double x) MLIB; // Arc cosine of x double asin(double x) MLIB; // Arc sine of x double atan(double x) MLIB; // Arc tangent of x double atan2(double y, double x) MLIB; // Arc tangent of y/x double cos(double x) MLIB; // Cosine of x double sin(double x) MLIB; // Sine of x double tan(double x) MLIB; // Tangent of x void sincos(double x, double *sinx, double *cosx) MLIB; // Sine and cosine of x /************************ * Hyperbolic functions * ************************/ double cosh(double x) MLIB; // Hyperbolic cosine of x double sinh(double x) MLIB; // Hyperbolic sine of x double tanh(double x) MLIB; // Hyperbolic tangent of x double acosh(double x) MLIB; // Hyperbolic arc cosine of x double asinh(double x) MLIB; // Hyperbolic arc sine of x double atanh(double x) MLIB; // Hyperbolic arc tangent of x /***************************************** * Exponential and logarithmic functions * *****************************************/ double exp(double x) MLIB; // Exponential function of x [pow(e,x)] double frexp(double x, Int16 *exponent) MLIB; // Break x into normalized fraction and an integral power of 2 double ldexp(double x, Int16 exponent) MLIB; // x * pow(2,exponent) double log(double x) MLIB; // Natural logarithm of x double log10(double x) MLIB; // Base 10 logarithm of x double modf(double x, double *intpart) MLIB; // Break x into integral and fractional parts double expm1(double x) MLIB; // exp(x) - 1 double log1p(double x) MLIB; // log(1+x) double logb(double x) MLIB; // Base 2 signed integral exponent of x double log2(double x) MLIB; // Base 2 logarithm of x /******************* * Power functions * *******************/ double pow(double x, double y) MLIB; // x to the y power [x**y] double sqrt(double x) MLIB; // Square root of x [x**0.5] double hypot(double x, double y) MLIB; // sqrt(x*x + y*y) [hypotenuse of right triangle] double cbrt(double x) MLIB; // Cube root of x [x**(1/3)] /************************************************************ * Nearest integer, absolute value, and remainder functions * ************************************************************/ double ceil(double x) MLIB; // Smallest integral value not less than x double fabs(double x) MLIB; // Absolute value of x double floor(double x) MLIB; // Largest integral value not greater than x double fmod(double x, double y) MLIB; // Modulo remainder of x/y /*************************** * Miscellaneous functions * ***************************/ Int16 isinf(double x) MLIB; // Return 0 if x is finite or NaN, +1 if +Infinity, or -1 if -Infinity Int16 finite(double x) MLIB; // Return nonzero if x is finite and not NaN double scalbn(double x, Int16 exponent) MLIB; // x * pow(2,exponent) double drem(double x, double y) MLIB; // Remainder of x/y double significand(double x) MLIB; // Fractional part of x after dividing out ilogb(x) double copysign(double x, double y) MLIB; // Return x with its sign changed to match y's Int16 isnan(double x) MLIB; // Return nonzero if x is NaN (Not a Number) Int16 ilogb(double x) MLIB; // Binary exponent of non-zero x double rint(double x) MLIB; // Integral value nearest x in direction of prevailing rounding mode double nextafter(double x, double y) MLIB; // Next machine double value after x in the direction towards y double remainder(double x, double y) MLIB; // Remainder of integer division x/y with infinite precision double scalb(double x, double exponent) MLIB;// x * pow(2,exponent) double round(double x) MLIB; // Round x to nearest integral value away from zero double trunc(double x) MLIB; // Round x to nearest integral value not larger than x UInt32 signbit(double x) MLIB; // Return signbit of x's machine representation /**************************************** * Prototypes for the system traps that * * actually perform the library calls, * * in the format mandated by the OS. * ****************************************/ Err MathLibACos(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom); Err MathLibASin(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+1); Err MathLibATan(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+2); Err MathLibATan2(UInt16 refnum, double y, double x, double *result) SYS_TRAP(sysLibTrapCustom+3); Err MathLibCos(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+4); Err MathLibSin(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+5); Err MathLibTan(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+6); Err MathLibSinCos(UInt16 refnum, double x, double *sinx, double *cosx) SYS_TRAP(sysLibTrapCustom+7); Err MathLibCosH(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+8); Err MathLibSinH(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+9); Err MathLibTanH(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+10); Err MathLibACosH(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+11); Err MathLibASinH(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+12); Err MathLibATanH(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+13); Err MathLibExp(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+14); Err MathLibFrExp(UInt16 refnum, double x, double *fraction, Int16 *exponent) SYS_TRAP(sysLibTrapCustom+15); Err MathLibLdExp(UInt16 refnum, double x, Int16 exponent, double *result) SYS_TRAP(sysLibTrapCustom+16); Err MathLibLog(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+17); Err MathLibLog10(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+18); Err MathLibModF(UInt16 refnum, double x, double *intpart, double *fracpart) SYS_TRAP(sysLibTrapCustom+19); Err MathLibExpM1(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+20); Err MathLibLog1P(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+21); Err MathLibLogB(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+22); Err MathLibLog2(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+23); Err MathLibPow(UInt16 refnum, double x, double y, double *result) SYS_TRAP(sysLibTrapCustom+24); Err MathLibSqrt(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+25); Err MathLibHypot(UInt16 refnum, double x, double y, double *result) SYS_TRAP(sysLibTrapCustom+26); Err MathLibCbrt(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+27); Err MathLibCeil(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+28); Err MathLibFAbs(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+29); Err MathLibFloor(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+30); Err MathLibFMod(UInt16 refnum, double x, double y, double *result) SYS_TRAP(sysLibTrapCustom+31); Err MathLibIsInf(UInt16 refnum, double x, Int16 *result) SYS_TRAP(sysLibTrapCustom+32); Err MathLibFinite(UInt16 refnum, double x, Int16 *result) SYS_TRAP(sysLibTrapCustom+33); Err MathLibScalBN(UInt16 refnum, double x, Int16 exponent, double *result) SYS_TRAP(sysLibTrapCustom+34); Err MathLibDRem(UInt16 refnum, double x, double y, double *result) SYS_TRAP(sysLibTrapCustom+35); Err MathLibSignificand(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+36); Err MathLibCopySign(UInt16 refnum, double x, double y, double *result) SYS_TRAP(sysLibTrapCustom+37); Err MathLibIsNaN(UInt16 refnum, double x, Int16 *result) SYS_TRAP(sysLibTrapCustom+38); Err MathLibILogB(UInt16 refnum, double x, Int16 *result) SYS_TRAP(sysLibTrapCustom+39); Err MathLibRInt16(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+40); Err MathLibNextAfter(UInt16 refnum, double x, double y, double *result) SYS_TRAP(sysLibTrapCustom+41); Err MathLibRemainder(UInt16 refnum, double x, double y, double *result) SYS_TRAP(sysLibTrapCustom+42); Err MathLibScalB(UInt16 refnum, double x, double exponent, double *result) SYS_TRAP(sysLibTrapCustom+43); Err MathLibRound(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+44); Err MathLibTrunc(UInt16 refnum, double x, double *result) SYS_TRAP(sysLibTrapCustom+45); Err MathLibSignBit(UInt16 refnum, double x, UInt32 *result) SYS_TRAP(sysLibTrapCustom+46); #endif // __MATHLIB_H__ --- NEW FILE: funcs.h --- /* * $Id: funcs.h,v 1.1 2008/05/26 20:17:54 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 _FUNCS_H_ #define _FUNCS_H_ #define FUNC_IF 0 /* Constants as indices to funcInterDef table */ #define FUNC_COV 0 #define FUNC_CORR 1 #define FUNC_QBINOM 2 #define FUNC_QBETA 3 #define FUNC_QCHISQ 4 #define FUNC_QF 5 #define FUNC_QPOISSON 6 #define FUNC_QSTUDENTT 7 #define FUNC_QWEIBULL 8 #define FUNC_QNORMAL 9 /* Maximal depth in user functions */ #define MAX_RECURS 10 /* When the 'real' argument is zero */ #define IS_ZERO(x) (fabs(x)<1E-6) #define FUNC_EMPTY 0 #define FUNC_PLUS 1 #define FUNC_MINUS 2 #define FUNC_MULTIPLY 3 #define FUNC_DIVIDE 4 #define FUNC_POWER 5 #define FUNC_EQUAL 6 #define FUNC_NEGATE 7 #define FUNC_DISCARD 8 #define FUNC_AND 9 #define FUNC_OR 10 #define FUNC_SHL 11 #define FUNC_SHR 12 #define FUNC_X 13 #define FUNC_MOD 14 #define FUNC_XOR 15 #define FUNC_ISEQUAL 16 #define FUNC_GRTHEN 17 #define FUNC_LETHEN 18 #define FUNC_GREQ 19 #define FUNC_LEEQ 20 #define FUNC_CONJ 21 #define FUNC_ITEM 22 #define FUNC_DEGREE 1 #define FUNC_RADIAN 2 #define FUNC_GONIO 3 #define FUNC_TOCIS 4 #define FUNC_DEGREE2 5 #define RAND_NUM ((double) SysRandom(0) / (double)sysRandomMax) CError convert_real_to_string(Functype *func,CodeStack *stack) PARSER; CError convert_cplx_to_string(Functype *func,CodeStack *stack) PARSER; CError define_func(Functype *func,CodeStack *stack) PARSER; CError change_param_name(Functype *func,CodeStack *stack) PARSER; CError unset_variable(Functype *func,CodeStack *stack) PARSER; CError discard_arg(Functype *func,CodeStack *stack) PARSER; CError empty_arg(Functype *func,CodeStack *stack) PARSER; CError rpn_eval_variable(Trpn *dest,Trpn source) PARSER; CError set_ans_var(Trpn ans) PARSER; CError eval_x(Functype *func,CodeStack *stack) PARSER; CError text_function(TCHAR *name,Int16 paramcount,CodeStack *stack) PARSER; void set_func_argument(Trpn *arg,UInt16 argcount) PARSER; void decr_func_argument(void) PARSER; Boolean varfunc_name_ok(TCHAR *name,rpntype type) PARSER; CError func_get_value(CodeStack *origstack,double param, double *result, CodeStack *addparms) PARSER; CError func_get_value_cplx(CodeStack *origstack,Complex* params, UInt16 paramcount, Complex *result) PARSER; CError exec_function(CodeStack *funcstack,CodeStack *varstack, Int16 paramcount) PARSER; CError func_interdef(Functype *func,CodeStack *stack) PARSER; CError func_if(Functype *func,CodeStack *stack) PARSER; CError func_item(Functype *func, CodeStack *stack) PARSER; Boolean is_constant(TCHAR *name) PARSER; extern Boolean DisableInput; #endif --- NEW FILE: cmatrix.h --- /* * $Id: cmatrix.h,v 1.1 2008/05/26 20:17:54 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999,2000,2001,2002 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 _CMATRIX_H_ #define _CMATRIX_H_ #define CMATRIX_INPUT 2101 #define CMATRIX_DET 2102 #define CMATRIX_ECHELON 2103 #define CMATRIX_IDENTITY 2104 #define CMATRIX_QRQ 2105 #define CMATRIX_QRR 2106 #define CMATRIX_QRS 2107 CError cmatrix_input(Functype *func,CodeStack *stack) MATFUNC; CMatrix * cmatrix_new(Int16 rows,Int16 cols) MATFUNC; CMatrix * cmatrix_dup(CMatrix *m) MATFUNC; void cmatrix_delete(CMatrix *m) MATFUNC; Matrix * cmatrix_to_matrix(CMatrix *cm) MATFUNC; CError cmatrix_oper(Functype *func,CodeStack *stack) MATFUNC; CMatrix * matrix_to_cmatrix(Matrix *m) MATFUNC; CError cmatrix_oper_cplx(Functype *func,CodeStack *stack) MATFUNC; CError cmatrix_func2(Functype *func,CodeStack *stack) MATFUNC; CError cmatrix_func(Functype *func,CodeStack *stack) MATFUNC; CError cmatrix_dim(Functype *func, CodeStack *stack) MATFUNC; CError cmatrix_item(Functype *func, CodeStack *stack) MATFUNC; #endif --- NEW FILE: PalmOS.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 PALM_OS_H #define PALM_OS_H 1 #define Int8 INT8 #define UInt8 UINT8 #define Int16 INT16 #define UInt16 UINT16 #define Int32 INT32 #define UInt32 UINT32 #define Char TCHAR #define Boolean bool #define Coord int #define Err int #define FieldPtr int #define IndexedColorType int #define StrCopy wcscpy #define StrLen wcslen #define StrNCompare wcsncmp #define StrCompare wcscmp #define MemPtrNew malloc #define MemPtrFree free typedef void *MemHandle; #define MemHandleLock(a) ((MemHandle) a) #define MemHandleUnlock(a) #include "DataManager.h" #include "StateManager.h" #define ErrFatalDisplayIf(a,b) #define SYS_TRAP(a) #endif --- NEW FILE: defuns.h --- /* * $Id: defuns.h,v 1.1 2008/05/26 20:17:54 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999 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 _DEFUNS_H_ #define _DEFUNS_H_ #include "segment.h" #include "konvert.h" #define MAX_FP_NUMBER 64 /* Application specific things */ #define APP_ID 'OpCl' #define LIB_ID 'OpCl' #define DBNAME _T("CalcDB-OpCl") #define HISTORYDBNAME _T("CalcDB-H-OpCl") #define SOLVERDBNAME _T("CalcDB-S-OpCl") #define DBTYPE 'Data' #define SOLVERDBTYPE 'Slvr' #define CARDNO 0 #define DBVERSION 5 #define HIST_DB_VERSION 6 #define SOLVER_DB_VERSION 1 #define PREF_DEFAULT 0 #define PREF_RESULT 1 #define PREF_GRAPH 3 #define PREF_LSTEDIT 4 #define PREF_MTXEDIT 5 #define PREF_DIA 6 /* Change this if you are changing contents of the preferences structure */ #define PREF_VERSION 44 #define PREF_RES_VERSION 2 #define PREF_GRAPH_VERSION 5 #define PREF_LSTEDIT_VERSION 1 #define PREF_MTXEDIT_VERSION 1 #define PREF_DIA_VERSION 1 /* Maximum length of normal strings copied from tSTR */ #define MAX_RSCLEN 30 #define MAX_RESULT 17 /* Rounding offset for reduce precision */ #define ROUND_OFFSET 13 #define PRECISION_TO_ZERO 1E-12 /* konvert.c constants */ #define MAX_RPNSIZE 105 #define MAX_OSTACK 45 #define NaN ((double)(3-3)/(3-3)) TCHAR * guess(Trpn item) MLIB; TCHAR * print_error(CError err); #endif --- NEW FILE: meqstack.h --- /* * $Id: meqstack.h,v 1.1 2008/05/26 20:17:54 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 _MEQSTACK_H_ #define _MEQSTACK_H_ #include "konvert.h" typedef struct { Int16 allocated; Int16 count; Tmeq *array; }Tdynmeq; Int16 meq_push(Tdynmeq *array,Tmeq item); void meq_free(Tdynmeq *array); void meq_update_t_pcount(Tdynmeq *array,Int16 position,Int16 pcount); void meq_update_f_pcount(Tdynmeq *array,Int16 position,Int16 pcount); Tmeq meq_pop(Tdynmeq *array); Tmeq meq_last(Tdynmeq *array); Tmeq meq_fetch(Tdynmeq *array); Int16 meq_count(Tdynmeq *array); Tdynmeq *meq_new(void); #endif --- NEW FILE: specfun.h --- /* * $Id: specfun.h,v 1.1 2008/05/26 20:17:55 mapibid Exp $ * * Scientific Calculator for Palms. * This file Copyright (C) 2000 Rafael Sevilla * * 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 'di...@pa...'. * */ #ifndef _SPECFUN_H #define _SPECFUN_H #include "segment.h" CError math_gambeta(Functype *func, CodeStack *stack) SPECFUN; CError math_bessels(Functype *func, CodeStack *stack) SPECFUN; CError math_elliptic(Functype *func, CodeStack *stack) SPECFUN; CError math_hypergeo(Functype *func, CodeStack *stack) SPECFUN; CError math_orthpol(Functype *func, CodeStack *stack) SPECFUN; double polevl(double x, double *coef, int N ) SPECFUN; #define EPSILON 1e-10 #endif --- NEW FILE: fp.h --- /* * $Id: fp.h,v 1.1 2008/05/26 20:17:54 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 _FP_H_ #define _FP_H_ void fp_setup_flpoint(void) PARSER; void fp_print_double(char *strP, double value) PARSER; void fp_print_g_double(char *s, double value, Int16 prec) PARSER; void fp_set_base(Tbase base) PARSER; TdispPrefs fp_set_prefs(TdispPrefs prefs) PARSER; Tdisp_mode fp_set_dispmode(Tdisp_mode newmode) PARSER; extern char flSpaceChar, flPointChar; #endif --- NEW FILE: matrix.h --- /* * $Id: matrix.h,v 1.1 2008/05/26 20:17:54 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...'. */ #ifndef _MATRIX_H_ #define _MATRIX_H_ #define MATRIX_MAX 50 #define MATRIX_INPUT 2001 #define MATRIX_DET 2002 #define MATRIX_ECHELON 2003 #define MATRIX_IDENTITY 2004 #define MATRIX_QRQ 2005 #define MATRIX_QRR 2006 #define MATRIX_QRS 2007 CError matrix_input(Functype *func,CodeStack *stack) MATFUNC; void matrix_delete(Matrix *m) MATFUNC; Matrix * matrix_new(Int16 rows,Int16 cols) MATFUNC; Matrix * matrix_dup(Matrix *m) MATFUNC; CError matrix_oper(Functype *func,CodeStack *stack) MATFUNC; CError matrix_oper_real(Functype *func,CodeStack *stack) MATFUNC; CError matrix_func(Functype *func,CodeStack *stack) MATFUNC; CError matrix_func2(Functype *func,CodeStack *stack) MATFUNC; CError matrix_item(Functype *func, CodeStack *stack) MATFUNC; CError matrix_dim(Functype *func, CodeStack *stack) MATFUNC; CError matrix_func3(Functype *func,CodeStack *stack) MATFUNC; #endif --- NEW FILE: complex.h --- /* * $Id: complex.h,v 1.1 2008/05/26 20:17:54 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 _COMPLEX_H_ #define _COMPLEX_H_ #define cplx_abs(x) (hypot((x).real,(x).imag)) Complex_gon cplx_to_gon(Complex x) MLIB; CError cplx_oper(Functype *func,CodeStack *stack) MLIB; CError cplx_math(Functype *func,CodeStack *stack) MLIB; CError cplx_round(Functype *func,CodeStack *stack) MLIB; Complex cplx_add(Complex arg1,Complex arg2) MLIB; Complex cplx_multiply(Complex arg1,Complex arg2) MLIB; Complex cplx_sub(Complex arg1,Complex arg2) MLIB; Complex cplx_div(Complex arg1,Complex arg2) MLIB; Complex cplx_sqrt(Complex arg) MLIB; Complex cplx_exp(Complex carg) MLIB; #endif --- NEW FILE: konvert.h --- /* * $Id: konvert.h,v 1.1 2008/05/26 20:17:54 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 _konvert_h_ #define _konvert_h_ #include "segment.h" #define MAX_FUNCNAME 10 #define MAX_VARNAME 10 /* First function/variable character */ #define IS_FUNC_1LETTER(x) (((x)>='a' && (x)<='z') || (x)=='_' || (x)==(TCHAR)181 || \ ((x)>='G' && (x)<='Z')) /* Other characters, inside varname can be numbers */ #define IS_FUNC_LETTER(x) (IS_FUNC_1LETTER(x) || ((x)>='0' && (x)<='9') || \ ((x)>='A' && (x)<='Z')) typedef enum { degree, radian, grad }Ttrigo_mode; typedef enum { notype=0, integer, real, function, functext, funcempty, variable, string, /* These 2 next shouldn't be in rpn, it's temporary */ oper, discard, complex, list, matrix, litem, cmatrix }rpntype; typedef enum { c_noerror=0, c_syntax, c_badfunc, c_noarg, c_badarg, c_internal, c_badmode, c_noresult, c_divbyzero, c_notvar, c_badresult, c_deeprec, c_compimp, c_range, c_badargcount, c_baddim, c_singular, c_interrupted, c_memory, c_stacklow }CError; typedef struct { double real; double imag; }Complex; typedef struct { double r; double angle; }Complex_gon; typedef struct { Int16 offs; Int16 num; Int16 paramcount; }Functype; typedef struct { Int16 paramcount; TCHAR name[MAX_FUNCNAME+1]; }TextFunctype; typedef struct { Int16 row; Int16 col; TCHAR name[MAX_FUNCNAME+1]; }LitemType; typedef struct { UInt16 size; Complex *item; }List; #define MATRIX(m,r,c) m->item[m->cols * (r) + (c)] typedef struct { Int16 rows,cols; double *item; }Matrix; typedef struct { Int16 rows,cols; Complex *item; }CMatrix; /* item on the RPN stack */ typedef struct { rpntype type; UInt16 allocsize; /* If we should free the item or not */ union { UInt32 intval; double realval; Functype funcval; /* Internal function call */ TextFunctype textfunc; /* User defined function call */ LitemType litemval; TCHAR funcname[MAX_FUNCNAME+1]; /* Empty function */ TCHAR varname[MAX_FUNCNAME+1]; TCHAR *stringval; Complex *cplxval; TCHAR *data; List *listval; Matrix *matrixval; CMatrix *cmatrixval; }u; }Trpn; typedef struct { Boolean evalRight; Int16 priority; Int16 operpri; Trpn rpn; }Tmeq; /* stack */ typedef struct { UInt16 size; UInt16 allocated; Trpn *stack; }CodeStack; struct Tdefined_funcs { const TCHAR name[MAX_FUNCNAME+1]; Int16 funcnum; CError (*function)(Functype *func,CodeStack *stack); Int16 paramcount; Boolean listsimul; Boolean matrixsimul; }; CodeStack *text_to_stack(TCHAR *buf, CError *error); Err mlib_init_mathlib(void) MLIB; void mlib_close_mathlib(void) MLIB; TCHAR ** konvert_get_sorted_fn_list(Int16 *count); extern const struct Tdefined_funcs defined_funcs[]; extern Ttrigo_mode trigo_mode; extern TCHAR parameter_name[MAX_FUNCNAME+1]; #endif --- NEW FILE: calcDB.h --- /* * $Id: calcDB.h,v 1.1 2008/05/26 20:17:54 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999 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 _CALCDB_H_ #define _CALCDB_H_ //#include <PalmOS.h> #include "konvert.h" typedef struct { Int16 size; rpntype *type; TCHAR **list; /* Do not add anything here, it gets overwritten */ }dbList; typedef struct { Int16 count; Int16 orig_offset; TCHAR param_name[MAX_FUNCNAME+1]; }dbStackHeader; typedef struct { Trpn rpn; UInt16 datasize; /* size of additional packed data */ TCHAR *data; }dbStackItem; typedef struct { dbStackHeader header; TCHAR *data; }dbPackedStack; typedef struct { rpntype type; /* This can be ONLY variable/function, nothing else can be * stored in databases */ TCHAR name[MAX_FUNCNAME+1]; union { dbStackItem data[1]; /* Variable */ dbPackedStack stack; }u; }dbPackedRecord; CError db_write_function(const TCHAR *name,CodeStack *stack,TCHAR *origtext) MLIB; CodeStack * db_read_function(const TCHAR *name,CError *err) MLIB; CError db_write_variable(const TCHAR *name,Trpn contents) MLIB; Trpn db_read_variable(const TCHAR *name,CError *err) MLIB; CError db_func_description(const TCHAR *funcname,TCHAR **dest,TCHAR *param) MLIB; dbPackedRecord * db_read_record(const TCHAR *name) MLIB; Int16 db_delete_record(const TCHAR *name) MLIB; void db_recompile_all(void) MLIB; Int16 db_open() MLIB; Int16 db_close() MLIB; Boolean db_record_exists(const TCHAR *name) MLIB; void db_delete_list(dbList *list) MLIB; dbList * db_get_list(rpntype type) MLIB; void db_save_real(const TCHAR *name, double number) MLIB; #endif --- NEW FILE: segment.h --- /* * $Id: segment.h,v 1.1 2008/05/26 20:17:55 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 _SEGMENT_H_ #define _SEGMENT_H_ #define MLIB_SECTION #define MLIB MLIB_SECTION #define BASEFUNC_SECTION #define BASEFUNC BASEFUNC_SECTION #define IFACE_SECTION #define IFACE IFACE_SECTION #define SPECFUN_SECTION #define SPECFUN SPECFUN_SECTION #define GRAPH_SECTION #define GRAPH GRAPH_SECTION #define NEWFUNC_SECTION #define NEWFUNC NEWFUNC_SECTION #define PARSER_SECTION #define PARSER PARSER_SECTION #define MATFUNC_SECTION #define MATFUNC MATFUNC_SECTION #endif --- NEW FILE: stack.h --- /* * $Id: stack.h,v 1.1 2008/05/26 20:17:55 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 _STACK_H_ #define _STACK_H_ #include "calcDB.h" #include "segment.h" dbPackedStack * stack_pack(CodeStack *stack,Int16 *size) MLIB; CodeStack * stack_unpack(dbPackedStack *packed) MLIB; dbStackItem * rpn_pack_record(Trpn item) MLIB; Trpn rpn_unpack_record(dbStackItem *record) MLIB; void rpn_delete(Trpn item) MLIB; void rpn_duplicate(Trpn *dest,Trpn source) MLIB; CError stack_get_val(CodeStack *stack,void *arg1,rpntype reqtype) MLIB; CError stack_get_val2(CodeStack *stack,void *arg1,void *arg2,rpntype reqtype) MLIB; CError stack_add_val(CodeStack *stack,void *arg,rpntype reqtype) MLIB; CError stack_item_type(CodeStack *stack,rpntype *type,Int16 itnum) MLIB; CError stack_compute(CodeStack *instack) MLIB; Trpn stack_pop(CodeStack *stack) MLIB; void stack_push(CodeStack *stack,Trpn rpn) MLIB; CodeStack * stack_new(Int16 count) MLIB; void stack_delete(CodeStack *stack) MLIB; void stack_copy(CodeStack *dest,CodeStack *orig) MLIB; CError stack_item_type_nr(CodeStack *stack,rpntype *type,Int16 itnum) MLIB; void stack_reverse(CodeStack *stack) MLIB; double reduce_precision(double value) MLIB; void stack_fix_variables(CodeStack *stack) MLIB; #endif --- NEW FILE: slist.h --- /* * $Id: slist.h,v 1.1 2008/05/26 20:17:55 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...'. */ #ifndef _LIST_H_ #define _LIST_H_ #define LIST_INPUT 1000 #define LIST_MIN 1001 #define LIST_MAX 1002 #define LIST_MEAN 1003 #define LIST_SUM 1004 #define LIST_MEDIAN 1005 #define LIST_SORTA 1006 #define LIST_SORTD 1007 #define LIST_GMEAN 1008 #define LIST_PROD 1009 #define LIST_VARIANCE 1010 #define LIST_STDDEV 1011 #define LIST_LINREG 1012 #define LIST_DIM 1013 #define LIST_CUMSUM 1014 #define LIST_MODE 1015 #define LIST_MOMENT 1016 #define LIST_SKEWNESS 1017 #define LIST_KURTOSIS 1018 #define LIST_VARCOEF 1019 #define LIST_RAND 1020 #define LIST_RNORM 1021 #define LIST_RANGE 1022 #define LIST_RTOP 1023 #define LIST_PTOR 1024 #define LIST_CONV 1025 #define LIST_CONCAT 1026 #define LIST_KRON 1027 #define LIST_SAMPLE 1028 #define LIST_FFT 1029 #define LIST_IFFT 1030 #define LIST_DFT 1031 #define LIST_IDFT 1032 #define LIST_DFTSHIFT 1033 #define LIST_FIND 1034 List * list_new(Int16 size) NEWFUNC; List * list_dup(List *oldlist) NEWFUNC; CError list_input(Functype *func,CodeStack *stack) NEWFUNC; void list_delete(List *lst) NEWFUNC; CError list_func(Functype *func,CodeStack *stack) NEWFUNC; CError list_func2(Functype *func,CodeStack *stack) NEWFUNC; CError list_func3(Functype *func,CodeStack *stack) NEWFUNC; CError list_concat(Functype *func,CodeStack *stack) NEWFUNC; CError list_stat(Functype *func,CodeStack *stack) NEWFUNC; CError list_regr(Functype *func,CodeStack *stack) NEWFUNC; CError list_rand(Functype *func,CodeStack *stack) NEWFUNC; CError list_item(Functype *func, CodeStack *stack) NEWFUNC; CError list_range(Functype *func, CodeStack *stack) NEWFUNC; CError list_mathem(Functype *func, CodeStack *stack) NEWFUNC; CError list_filter(Functype *func,CodeStack *stack) NEWFUNC; CError list_factor(Functype *func,CodeStack *stack) NEWFUNC; CError list_gcdex(Functype *func,CodeStack *stack) NEWFUNC; CError list_sift(Functype *func,CodeStack *stack) NEWFUNC; CError list_map(Functype *func,CodeStack *stack) NEWFUNC; CError list_zip(Functype *func,CodeStack *stack) NEWFUNC; CError list_repeat(Functype *func,CodeStack *stack) NEWFUNC; CError list_fourier(Functype *func,CodeStack *stack) NEWFUNC; #endif --- NEW FILE: mathem.h --- /* * $Id: mathem.h,v 1.1 2008/05/26 20:17:54 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 _INTOPS_H #define _INTOPS_H #include "segment.h" /* These are helper constants to allow one function serve * more types of operation. They needn't be unique, but must * be unique inside the function, that operates this type of * operation. */ /* The following about 20 constants are pointers to an array, * be sure you know what you do if you change them */ #define MATH_SIN 0 #define MATH_COS 1 #define MATH_TAN 2 #define MATH_SINH 3 #define MATH_COSH 4 #define MATH_TANH 5 /* */ #define MATH_ASIN 6 #define MATH_ACOS 7 #define MATH_ATAN 8 #define MATH_ASINH 9 #define MATH_ACOSH 10 #define MATH_ATANH 11 /* */ #define MATH_EXP 12 #define MATH_LN 13 #define MATH_LOG 14 #define MATH_SQRT 15 #define MATH_CBRT 16 #define MATH_ABS 17 #define MATH_LOG2 18 #define MATH_FPART 19 #define MATH_FLOOR 20 #define MATH_SIGN 21 #define MATH_CEIL 22 /* */ /****************/ #define MATH_REAL 3029 #define MATH_IMAG 3030 /* */ #define MATH_TRUNC 3031 #define MATH_ROUND 3032 /* */ #define MATH_FACT 3033 #define MATH_GAMMA 3034 /* Combinatorics */ #define MATH_PERM 3035 #define MATH_COMB 3036 /* */ #define MATH_FZERO 3037 /* */ #define MATH_HYPOT 3039 #define MATH_PTORX 3040 #define MATH_PTORY 3041 #define MATH_ATAN2 3042 #define MATH_RTOPD 3043 /* */ #define MATH_FSIMPS 3044 #define MATH_FDYDX1 3046 #define MATH_FMIN 3047 #define MATH_FMAX 3048 #define MATH_FVALUE 3049 #define MATH_ANGLE 3050 #define MATH_FDYDX2 3051 #define MATH_FROMBERG 3052 #define MATH_FINTERSECT 3053 /* */ #define MATH_SEED 3060 /* */ #define MATH_FINPV 3070 #define MATH_FINPMT 3071 #define MATH_FINFV 3072 #define MATH_FINN 3073 #ifdef SPECFUN_ENABLED /* We'll reserve values 100 and up for other special functions */ #define MATH_BETA 100 /* Beta function */ #define MATH_IGAMMA 101 /* incomplete Gamma function */ #define MATH_IBETA 102 /* incomplete Beta function */ #define MATH_ERF 103 /* error function */ #define MATH_ERFC 104 /* complementary error function */ #define MATH_BESSELJ 110 /* Bessel functions of the first kind */ #define MATH_BESSELY 111 /* Bessel functions of the second kind */ #define MATH_BESSELI 112 /* Modified Bessel functions, first kind */ #define MATH_BESSELK 113 /* Modified Bessel functions, second kind */ #define MATH_AIRY 114 /* Airy function, Ai */ #define MATH_BIRY 115 /* Airy function, Bi */ #define MATH_ELLC1 120 /* Complete Elliptic Integral, 1st kind */ #define MATH_ELLC2 121 /* Complete Elliptic Integral, 2nd kind */ #define MATH_ELLI1 122 /* Incomplete Elliptic Integral, 1st kind */ #define MATH_ELLI2 123 /* Incomplete Elliptic Integral, 1st kind */ #define MATH_SN 124 /* Jacobian elliptic function sn */ #define MATH_CN 125 /* Jacobian elliptic function cn */ #define MATH_DN 126 /* Jacobian elliptic function dn */ #define MATH_HYPGG 130 /* Gaussian hypergeometric function F */ #define MATH_HYPGC 131 /* Confluent hypergeometric function M */ #define MATH_ALGNDRF 140 /* associated Legendre functions */ #define MATH_SPHHARM 141 /* spherical harmonics */ #endif #define MATH_GCD 142 #define MATH_LCM 143 #define MATH_MODINV 144 #define MATH_MODPOW 145 #define MATH_CHINESE 146 #define MATH_PHI 147 #define MATH_ISPRIME 148 #define MATH_NEXTPRIME 149 #define MATH_PREVPRIME 150 /* Mathematical declarations */ #ifndef M_PIl #define M_PIl 3.14159265358979323846 #endif #define M_PI_SQRT 1.77245385091 CError math_cmpeq(Functype *func,CodeStack *stack) BASEFUNC; CError math_cmp(Functype *func,CodeStack *stack) BASEFUNC; CError math_oper(Functype *func,CodeStack *stack) BASEFUNC; CError math_neg(Functype *func,CodeStack *stack) BASEFUNC; CError math_trigo(Functype *func,CodeStack *stack) BASEFUNC; CError math_arctrigo(Functype *func,CodeStack *stack) BASEFUNC; CError math_math(Functype *func,CodeStack *stack) BASEFUNC; CError math_bin(Functype *func,CodeStack *stack) BASEFUNC; CError math_fact(Functype *func,CodeStack *stack) BASEFUNC; CError math_gamma(Functype *func,CodeStack *stack) BASEFUNC; CError math_int(Functype *func,CodeStack *stack) BASEFUNC; CError math_comb(Functype *func,CodeStack *stack) BASEFUNC; CError math_convcoord(Functype *func,CodeStack *stack) BASEFUNC; CError math_round(Functype *func,CodeStack *stack) BASEFUNC; CError math_apostrophe(Functype *func,CodeStack *stack) BASEFUNC; CError math_seed(Functype *func,CodeStack *stack) BASEFUNC; CError math_financial(Functype *func,CodeStack *stack) BASEFUNC; CError math_gcd(Functype *func,CodeStack *stack) BASEFUNC; CError math_modinv(Functype *func,CodeStack *stack) BASEFUNC; CError math_modpow(Functype *func,CodeStack *stack) BASEFUNC; CError math_chinese(Functype *func,CodeStack *stack) BASEFUNC; CError math_phi(Functype *func,CodeStack *stack) BASEFUNC; CError math_primes(Functype *func,CodeStack *stack) BASEFUNC; double math_rad_to_user(double angle) BASEFUNC; double math_user_to_rad(double angle) BASEFUNC; UInt8 factorize(Int32 value, Int32* dest) BASEFUNC; UInt32 gcd(UInt32 a, UInt32 b) BASEFUNC; UInt32 gcdex(UInt32 a, UInt32 b, Int32* coA, Int32* coB) BASEFUNC; double sgn(double x) MLIB; #endif |