GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/* Implementation specifics 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/* Same tests as gmp.h. */23#if defined (__STDC__) \24|| defined (__cplusplus) \25|| defined (_AIX) \26|| defined (__DECC) \27|| (defined (__mips) && defined (_SYSTYPE_SVR4)) \28|| defined (_MSC_VER) \29|| defined (_WIN32)30#define HAVE_STDARG 131#include <stdarg.h>32#else33#define HAVE_STDARG 034#include <varargs.h>35#endif3637#include "expr.h"383940#define isasciidigit(c) (isascii (c) && isdigit (c))41#define isasciicsym(c) (isascii (c) && (isalnum(c) || (c) == '_'))4243#define isasciidigit_in_base(c,base) \44(isascii (c) \45&& ((isdigit (c) && (c)-'0' < (base)) \46|| (isupper (c) && (c)-'A'+10 < (base)) \47|| (islower (c) && (c)-'a'+10 < (base))))484950union mpX_t {51mpz_t z;52mpq_t q;53mpf_t f;54};5556typedef union mpX_t *mpX_ptr;57typedef __gmp_const union mpX_t *mpX_srcptr;5859typedef void (*mpexpr_fun_one_t) __GMP_PROTO ((mpX_ptr));60typedef unsigned long (*mpexpr_fun_ui_one_t) __GMP_PROTO ((mpX_ptr));6162typedef void (*mpexpr_fun_0ary_t) __GMP_PROTO ((mpX_ptr));63typedef int (*mpexpr_fun_i_0ary_t) __GMP_PROTO ((void));6465typedef void (*mpexpr_fun_unary_t) __GMP_PROTO ((mpX_ptr, mpX_srcptr));66typedef void (*mpexpr_fun_unary_ui_t) __GMP_PROTO ((mpX_ptr, unsigned long));67typedef int (*mpexpr_fun_i_unary_t) __GMP_PROTO ((mpX_srcptr));68typedef int (*mpexpr_fun_i_unary_ui_t) __GMP_PROTO ((unsigned long));6970typedef void (*mpexpr_fun_binary_t) __GMP_PROTO ((mpX_ptr, mpX_srcptr, mpX_srcptr));71typedef void (*mpexpr_fun_binary_ui_t) __GMP_PROTO ((mpX_ptr, mpX_srcptr, unsigned long));72typedef int (*mpexpr_fun_i_binary_t) __GMP_PROTO ((mpX_srcptr, mpX_srcptr));73typedef int (*mpexpr_fun_i_binary_ui_t) __GMP_PROTO ((mpX_srcptr, unsigned long));7475typedef void (*mpexpr_fun_ternary_t)76__GMP_PROTO ((mpX_ptr, mpX_srcptr, mpX_srcptr, mpX_srcptr));77typedef void (*mpexpr_fun_ternary_ui_t)78__GMP_PROTO ((mpX_ptr, mpX_srcptr, mpX_srcptr, unsigned long));79typedef int (*mpexpr_fun_i_ternary_t)80__GMP_PROTO ((mpX_srcptr, mpX_srcptr, mpX_srcptr));81typedef int (*mpexpr_fun_i_ternary_ui_t)82__GMP_PROTO ((mpX_srcptr, mpX_srcptr, unsigned long));8384typedef size_t (*mpexpr_fun_number_t)85__GMP_PROTO ((mpX_ptr, __gmp_const char *str, size_t len, int base));86typedef void (*mpexpr_fun_swap_t) __GMP_PROTO ((mpX_ptr, mpX_ptr));87typedef unsigned long (*mpexpr_fun_get_ui_t) __GMP_PROTO ((mpX_srcptr));88typedef void (*mpexpr_fun_set_si_t) __GMP_PROTO ((mpX_srcptr, long));8990struct mpexpr_control_t {91__gmp_const struct mpexpr_operator_t *op;92int argcount;93};9495#define MPEXPR_VARIABLES 269697struct mpexpr_parse_t {98__gmp_const struct mpexpr_operator_t *table;99100mpX_ptr res;101int base;102unsigned long prec;103__gmp_const char *e;104size_t elen;105mpX_srcptr *var;106int error_code;107108int token;109__gmp_const struct mpexpr_operator_t *token_op;110111union mpX_t *data_stack;112int data_top;113int data_alloc;114int data_inited;115116struct mpexpr_control_t *control_stack;117int control_top;118int control_alloc;119120121mpexpr_fun_0ary_t mpX_clear;122mpexpr_fun_i_unary_t mpX_ulong_p;123mpexpr_fun_get_ui_t mpX_get_ui;124mpexpr_fun_unary_ui_t mpX_init;125mpexpr_fun_number_t mpX_number;126mpexpr_fun_unary_t mpX_set;127mpexpr_fun_unary_t mpX_set_or_swap;128mpexpr_fun_set_si_t mpX_set_si;129mpexpr_fun_swap_t mpX_swap;130};131132133int mpexpr_evaluate __GMP_PROTO ((struct mpexpr_parse_t *p));134int mpexpr_va_to_var __GMP_PROTO ((void *var[], va_list ap));135size_t mpexpr_mpz_number __GMP_PROTO ((mpz_ptr res,136__gmp_const char *e, size_t elen, int base));137138139