Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346/* Header for expression evaluation.12Copyright 2000-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 either:89* the GNU Lesser General Public License as published by the Free10Software Foundation; either version 3 of the License, or (at your11option) any later version.1213or1415* the GNU General Public License as published by the Free Software16Foundation; either version 2 of the License, or (at your option) any17later version.1819or both in parallel, as here.2021The GNU MP Library is distributed in the hope that it will be useful, but22WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY23or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License24for more details.2526You should have received copies of the GNU General Public License and the27GNU Lesser General Public License along with the GNU MP Library. If not,28see https://www.gnu.org/licenses/. */293031#ifndef __EXPR_H__32#define __EXPR_H__3334#define MPEXPR_RESULT_OK 035#define MPEXPR_RESULT_BAD_VARIABLE 136#define MPEXPR_RESULT_BAD_TABLE 237#define MPEXPR_RESULT_PARSE_ERROR 338#define MPEXPR_RESULT_NOT_UI 4394041/* basic types */42#define MPEXPR_TYPE_NARY(n) ((n) * 0x0100)43#define MPEXPR_TYPE_MASK_ARGCOUNT MPEXPR_TYPE_NARY(0xF)44#define MPEXPR_TYPE_0ARY MPEXPR_TYPE_NARY(0)45#define MPEXPR_TYPE_UNARY MPEXPR_TYPE_NARY(1)46#define MPEXPR_TYPE_BINARY MPEXPR_TYPE_NARY(2)47#define MPEXPR_TYPE_TERNARY MPEXPR_TYPE_NARY(3)4849/* options for all */50#define MPEXPR_TYPE_LAST_UI 0x001051#define MPEXPR_TYPE_RESULT_INT 0x002052#define MPEXPR_TYPE_MASK_ARGSTYLE 0x00305354#define MPEXPR_TYPE_UNARY_UI (MPEXPR_TYPE_UNARY | MPEXPR_TYPE_LAST_UI)55#define MPEXPR_TYPE_I_UNARY (MPEXPR_TYPE_UNARY | MPEXPR_TYPE_RESULT_INT)56#define MPEXPR_TYPE_I_UNARY_UI (MPEXPR_TYPE_I_UNARY | MPEXPR_TYPE_LAST_UI)57#define MPEXPR_TYPE_BINARY_UI (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_LAST_UI)58#define MPEXPR_TYPE_I_BINARY (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_RESULT_INT)59#define MPEXPR_TYPE_I_BINARY_UI (MPEXPR_TYPE_I_BINARY| MPEXPR_TYPE_LAST_UI)60#define MPEXPR_TYPE_TERNARY_UI (MPEXPR_TYPE_TERNARY | MPEXPR_TYPE_LAST_UI)61#define MPEXPR_TYPE_I_TERNARY (MPEXPR_TYPE_TERNARY | MPEXPR_TYPE_RESULT_INT)62#define MPEXPR_TYPE_I_TERNARY_UI (MPEXPR_TYPE_I_TERNARY|MPEXPR_TYPE_LAST_UI)6364/* 0ary with options */65#define MPEXPR_TYPE_CONSTANT (MPEXPR_TYPE_0ARY | 0x0040)6667/* unary options */68#define MPEXPR_TYPE_PREFIX 0x00406970/* binary options */71#define MPEXPR_TYPE_RIGHTASSOC 0x004072#define MPEXPR_TYPE_PAIRWISE 0x00807374#define MPEXPR_TYPE_MASK_SPECIAL 0x000F7576/* unary specials */77#define MPEXPR_TYPE_NEW_TABLE (MPEXPR_TYPE_UNARY | 0x001)78#define MPEXPR_TYPE_DONE (MPEXPR_TYPE_UNARY | 0x002)79#define MPEXPR_TYPE_VARIABLE (MPEXPR_TYPE_UNARY | 0x003)80#define MPEXPR_TYPE_LOGICAL_NOT (MPEXPR_TYPE_UNARY | 0x004)81#define MPEXPR_TYPE_CLOSEPAREN (MPEXPR_TYPE_UNARY | 0x005)82#define MPEXPR_TYPE_OPENPAREN (MPEXPR_TYPE_CLOSEPAREN | MPEXPR_TYPE_PREFIX)8384/* binary specials */85#define MPEXPR_TYPE_LOGICAL_AND (MPEXPR_TYPE_BINARY | 0x001)86#define MPEXPR_TYPE_LOGICAL_OR (MPEXPR_TYPE_BINARY | 0x002)87#define MPEXPR_TYPE_ARGSEP (MPEXPR_TYPE_BINARY | 0x003)88#define MPEXPR_TYPE_QUESTION (MPEXPR_TYPE_BINARY | 0x004)89#define MPEXPR_TYPE_COLON (MPEXPR_TYPE_BINARY | 0x005)90#define MPEXPR_TYPE_MAX (MPEXPR_TYPE_BINARY | 0x006)91#define MPEXPR_TYPE_MIN (MPEXPR_TYPE_BINARY | 0x007)92#define MPEXPR_TYPE_MASK_CMP 0x00893#define MPEXPR_TYPE_MASK_CMP_LT 0x00194#define MPEXPR_TYPE_MASK_CMP_EQ 0x00295#define MPEXPR_TYPE_MASK_CMP_GT 0x00496#define MPEXPR_TYPE_CMP_LT (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_MASK_CMP \97| MPEXPR_TYPE_MASK_CMP_LT)98#define MPEXPR_TYPE_CMP_EQ (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_MASK_CMP \99| MPEXPR_TYPE_MASK_CMP_EQ)100#define MPEXPR_TYPE_CMP_GT (MPEXPR_TYPE_BINARY | MPEXPR_TYPE_MASK_CMP \101| MPEXPR_TYPE_MASK_CMP_GT)102#define MPEXPR_TYPE_CMP_LE (MPEXPR_TYPE_CMP_LT | MPEXPR_TYPE_MASK_CMP_EQ)103#define MPEXPR_TYPE_CMP_NE (MPEXPR_TYPE_CMP_LT | MPEXPR_TYPE_MASK_CMP_GT)104#define MPEXPR_TYPE_CMP_GE (MPEXPR_TYPE_CMP_GT | MPEXPR_TYPE_MASK_CMP_EQ)105106/* parse options */107#define MPEXPR_TYPE_WHOLEWORD 0x1000108#define MPEXPR_TYPE_OPERATOR 0x2000109110111#ifdef __cplusplus112extern "C" {113#endif114115typedef void (*mpexpr_fun_t) (void);116117struct mpexpr_operator_t {118const char *name;119mpexpr_fun_t fun;120int type;121int precedence;122};123124125int mpf_expr_a (const struct mpexpr_operator_t *, mpf_ptr, int,126unsigned long, const char *, size_t, mpf_srcptr [26]);127int mpf_expr (mpf_ptr, int, const char *, ...);128129int mpq_expr_a (const struct mpexpr_operator_t *, mpq_ptr,130int, const char *, size_t, mpq_srcptr [26]);131int mpq_expr (mpq_ptr, int, const char *, ...);132133int mpz_expr_a (const struct mpexpr_operator_t *, mpz_ptr, int,134const char *, size_t, mpz_srcptr [26]);135int mpz_expr (mpz_ptr, int, const char *, ...);136137#ifdef __cplusplus138} /* extern "C" */139#endif140141#endif142143144