GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/* Header for expression evaluation.12Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.34This file is part of the GNU MP Library.56The GNU MP Library is free software; you can redistribute it and/or modify7it under the terms of the GNU Lesser General Public License as published by8the Free Software Foundation; either version 2.1 of the License, or (at your9option) any later version.1011The GNU MP Library is distributed in the hope that it will be useful, but12WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY13or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public14License for more details.1516You should have received a copy of the GNU Lesser General Public License17along with the GNU MP Library; see the file COPYING.LIB. If not, write to18the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,19MA 02110-1301, USA. */202122#ifndef __EXPR_H__23#define __EXPR_H__2425#define MPEXPR_RESULT_OK 026#define MPEXPR_RESULT_BAD_VARIABLE 127#define MPEXPR_RESULT_BAD_TABLE 228#define MPEXPR_RESULT_PARSE_ERROR 329#define MPEXPR_RESULT_NOT_UI 4303132/* basic types */33#define MPEXPR_TYPE_NARY(n) ((n) * 0x0100)34#define MPEXPR_TYPE_MASK_ARGCOUNT MPEXPR_TYPE_NARY(0xF)35#define MPEXPR_TYPE_0ARY MPEXPR_TYPE_NARY(0)36#define MPEXPR_TYPE_UNARY MPEXPR_TYPE_NARY(1)37#define MPEXPR_TYPE_BINARY MPEXPR_TYPE_NARY(2)38#define MPEXPR_TYPE_TERNARY MPEXPR_TYPE_NARY(3)3940/* options for all */41#define MPEXPR_TYPE_LAST_UI 0x001042#define MPEXPR_TYPE_RESULT_INT 0x002043#define MPEXPR_TYPE_MASK_ARGSTYLE 0x00304445#define MPEXPR_TYPE_UNARY_UI (MPEXPR_TYPE_UNARY | MPEXPR_TYPE_LAST_UI)46#define MPEXPR_TYPE_I_UNARY (MPEXPR_TYPE_UNARY | MPEXPR_TYPE_RESULT_INT)47#define MPEXPR_TYPE_I_UNARY_UI (MPEXPR_TYPE_I_UNARY | MPEXPR_TYPE_LAST_UI)48#define MPEXPR_TYPE_BINARY_UI (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_LAST_UI)49#define MPEXPR_TYPE_I_BINARY (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_RESULT_INT)50#define MPEXPR_TYPE_I_BINARY_UI (MPEXPR_TYPE_I_BINARY| MPEXPR_TYPE_LAST_UI)51#define MPEXPR_TYPE_TERNARY_UI (MPEXPR_TYPE_TERNARY | MPEXPR_TYPE_LAST_UI)52#define MPEXPR_TYPE_I_TERNARY (MPEXPR_TYPE_TERNARY | MPEXPR_TYPE_RESULT_INT)53#define MPEXPR_TYPE_I_TERNARY_UI (MPEXPR_TYPE_I_TERNARY|MPEXPR_TYPE_LAST_UI)5455/* 0ary with options */56#define MPEXPR_TYPE_CONSTANT (MPEXPR_TYPE_0ARY | 0x0040)5758/* unary options */59#define MPEXPR_TYPE_PREFIX 0x00406061/* binary options */62#define MPEXPR_TYPE_RIGHTASSOC 0x004063#define MPEXPR_TYPE_PAIRWISE 0x00806465#define MPEXPR_TYPE_MASK_SPECIAL 0x000F6667/* unary specials */68#define MPEXPR_TYPE_NEW_TABLE (MPEXPR_TYPE_UNARY | 0x001)69#define MPEXPR_TYPE_DONE (MPEXPR_TYPE_UNARY | 0x002)70#define MPEXPR_TYPE_VARIABLE (MPEXPR_TYPE_UNARY | 0x003)71#define MPEXPR_TYPE_LOGICAL_NOT (MPEXPR_TYPE_UNARY | 0x004)72#define MPEXPR_TYPE_CLOSEPAREN (MPEXPR_TYPE_UNARY | 0x005)73#define MPEXPR_TYPE_OPENPAREN (MPEXPR_TYPE_CLOSEPAREN | MPEXPR_TYPE_PREFIX)7475/* binary specials */76#define MPEXPR_TYPE_LOGICAL_AND (MPEXPR_TYPE_BINARY | 0x001)77#define MPEXPR_TYPE_LOGICAL_OR (MPEXPR_TYPE_BINARY | 0x002)78#define MPEXPR_TYPE_ARGSEP (MPEXPR_TYPE_BINARY | 0x003)79#define MPEXPR_TYPE_QUESTION (MPEXPR_TYPE_BINARY | 0x004)80#define MPEXPR_TYPE_COLON (MPEXPR_TYPE_BINARY | 0x005)81#define MPEXPR_TYPE_MAX (MPEXPR_TYPE_BINARY | 0x006)82#define MPEXPR_TYPE_MIN (MPEXPR_TYPE_BINARY | 0x007)83#define MPEXPR_TYPE_MASK_CMP 0x00884#define MPEXPR_TYPE_MASK_CMP_LT 0x00185#define MPEXPR_TYPE_MASK_CMP_EQ 0x00286#define MPEXPR_TYPE_MASK_CMP_GT 0x00487#define MPEXPR_TYPE_CMP_LT (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_MASK_CMP \88| MPEXPR_TYPE_MASK_CMP_LT)89#define MPEXPR_TYPE_CMP_EQ (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_MASK_CMP \90| MPEXPR_TYPE_MASK_CMP_EQ)91#define MPEXPR_TYPE_CMP_GT (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_MASK_CMP \92| MPEXPR_TYPE_MASK_CMP_GT)93#define MPEXPR_TYPE_CMP_LE (MPEXPR_TYPE_CMP_LT | MPEXPR_TYPE_MASK_CMP_EQ)94#define MPEXPR_TYPE_CMP_NE (MPEXPR_TYPE_CMP_LT | MPEXPR_TYPE_MASK_CMP_GT)95#define MPEXPR_TYPE_CMP_GE (MPEXPR_TYPE_CMP_GT | MPEXPR_TYPE_MASK_CMP_EQ)9697/* parse options */98#define MPEXPR_TYPE_WHOLEWORD 0x100099#define MPEXPR_TYPE_OPERATOR 0x2000100101102typedef void (*mpexpr_fun_t) __GMP_PROTO ((void));103104struct mpexpr_operator_t {105__gmp_const char *name;106mpexpr_fun_t fun;107int type;108int precedence;109};110111112int mpf_expr_a __GMP_PROTO ((__gmp_const struct mpexpr_operator_t *table,113mpf_ptr res, int base, unsigned long prec,114__gmp_const char *e, size_t elen,115mpf_srcptr var[26]));116int mpf_expr __GMP_PROTO ((mpf_ptr res, int base, __gmp_const char *e, ...));117118int mpq_expr_a __GMP_PROTO ((__gmp_const struct mpexpr_operator_t *table,119mpq_ptr res, int base,120__gmp_const char *e, size_t elen,121mpq_srcptr var[26]));122int mpq_expr __GMP_PROTO ((mpq_ptr res, int base, __gmp_const char *e, ...));123124int mpz_expr_a __GMP_PROTO ((__gmp_const struct mpexpr_operator_t *table,125mpz_ptr res, int base,126__gmp_const char *e, size_t elen,127mpz_srcptr var[26]));128int mpz_expr __GMP_PROTO ((mpz_ptr res, int base, __gmp_const char *e, ...));129130#endif131132133