[BACK]Return to anal.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / src / language

Annotation of OpenXM_contrib/pari-2.2/src/language/anal.h, Revision 1.2

1.2     ! noro        1: /* $Id: anal.h,v 1.27 2002/08/25 22:21:40 karim Exp $
1.1       noro        2:
                      3: Copyright (C) 2000  The PARI group.
                      4:
                      5: This file is part of the PARI/GP package.
                      6:
                      7: PARI/GP is free software; you can redistribute it and/or modify it under the
                      8: terms of the GNU General Public License as published by the Free Software
                      9: Foundation. It is distributed in the hope that it will be useful, but WITHOUT
                     10: ANY WARRANTY WHATSOEVER.
                     11:
                     12: Check the License for details. You should have received a copy of it, along
                     13: with the package; see the file 'COPYING'. If not, write to the Free Software
                     14: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
                     15:
                     16: /*************************************************************************/
                     17: /*                                                                       */
                     18: /*                 Declarations specific to the analyzer                 */
                     19: /*                                                                       */
                     20: /*************************************************************************/
                     21: /* structs */
                     22: typedef struct default_type {
                     23:   char *name;
                     24:   void *fun;
                     25: } default_type;
                     26:
                     27: typedef struct gp_args {
                     28:   int nloc, narg;
                     29:   GEN *arg;
                     30: } gp_args;
                     31:
                     32: typedef struct module {
                     33:   entree *func;
                     34:   char **help;
                     35: } module;
                     36:
                     37: /* binary I/O */
                     38: typedef struct GENbin {
                     39:   long len; /* taille(x) */
                     40:   GEN x; /* binary copy of x */
                     41:   GEN base; /* base address of p->x */
                     42: } GENbin;
                     43: #define GENbase(p) ((GEN)p+3)
                     44:
                     45: void shiftaddress(GEN x, long dec);
                     46: GENbin* copy_bin(GEN x);
                     47: GEN bin_copy(GENbin *p);
                     48:
                     49: /* stacks */
                     50: typedef struct stack {
                     51:   struct stack *prev;
                     52:   void *value;
                     53: } stack;
                     54:
1.2     ! noro       55: /* history */
        !            56: typedef struct {
        !            57:   GEN *res;    /* array of previous results, FIFO */
        !            58:   size_t size; /* # res */
        !            59:   ulong total; /* # of results computed since big bang */
        !            60: } gp_hist;
        !            61:
        !            62: /* prettyprinter */
        !            63: typedef struct {
        !            64:   pariFILE *file;
        !            65:   char *cmd;
        !            66: } gp_pp;
        !            67:
        !            68: /* path */
        !            69: typedef struct {
        !            70:   char *PATH;
        !            71:   char **dirs;
        !            72: } gp_path;
        !            73:
1.1       noro       74: void push_stack(stack **pts, void *a);
                     75: void *pop_stack(stack **pts);
                     76:
                     77: /* functions */
                     78: void   changevalue(entree *ep, GEN val);
                     79: entree *do_alias(entree *ep);
                     80: int    is_identifier(char *s);
                     81: entree *is_entry_intern(char *s, entree **table, long *hash);
                     82: long   is_keyword_char(char c);
                     83: char   *readstring(char *src, char *s);
1.2     ! noro       84: long   loop_break(void);
        !            85: long   did_break(void);
1.1       noro       86: void   print_prefixed_text(char *s, char *prefix, char *str);
1.2     ! noro       87: GEN    gp_history(gp_hist *H, long p, char *old, char *entry);
        !            88: GEN    set_hist_entry(gp_hist *H, GEN x);
        !            89:
        !            90: char*  get_analyseur(void);
        !            91: void   set_analyseur(char *s);
1.1       noro       92:
                     93: void term_color(int c);
                     94: char *term_get_color(int c);
1.2     ! noro       95: void hit_return(void);
1.1       noro       96:
                     97: void push_val(entree *ep, GEN a);
                     98: void pop_val(entree *ep);
                     99:
1.2     ! noro      100: extern ulong prec;
1.1       noro      101: extern GEN gnil;
                    102:
                    103: extern char *current_function;
                    104: extern int  (*whatnow_fun)(char *, int);
                    105: extern void *foreignHandler;
                    106: extern GEN  (*foreignExprHandler)(char*);
                    107: extern char foreignExprSwitch;
                    108: extern entree * (*foreignAutoload)(char*, long);
                    109: extern void (*foreignFuncFree)(entree *);
                    110: extern int (*default_exception_handler)(long);
                    111:
                    112: /* Variables containing the list of PARI functions */
                    113: extern int    functions_tblsz;     /* hashcodes table size */
                    114: extern module *pari_modules;       /* list of functions modules */
                    115: extern entree **functions_hash;    /* functions hashtable */
                    116: extern entree **members_hash;      /* members hashtable */
                    117: extern char   *helpmessages_basic[];
                    118: extern entree functions_basic[];
                    119:
                    120: /* Variables containing the list of specific GP functions */
                    121: extern char   *helpmessages_gp[];
                    122: extern entree  functions_gp[];
                    123: extern entree  gp_member_list[];
                    124: extern char   *helpmessages_highlevel[];
                    125: extern entree  functions_highlevel[];
                    126: extern int     gp_colors[];
                    127: extern int     disable_color,added_newline;
                    128:
                    129: /* Variables containing the list of old PARI fonctions (up to 1.39.15) */
                    130: extern module *pari_oldmodules;    /* list of functions modules */
                    131: extern entree **funct_old_hash;    /* hashtable */
                    132: extern char   *oldhelpmessage[], *helpmessages_oldgp[];
                    133: extern entree  oldfonctions[], functions_oldgp[];
                    134:
                    135: /* backward compatibility */
1.2     ! noro      136: extern ulong compatible;
1.1       noro      137: enum { NONE, WARN, OLDFUN, OLDALL };
                    138: #define new_fun_set (compatible == NONE || compatible == WARN)
                    139:
                    140: /* return type for GP functions */
                    141: enum { RET_GEN, RET_INT, RET_VOID };
                    142:
                    143: #ifdef STACK_CHECK
                    144: extern void *PARI_stack_limit;
                    145: #endif
                    146:
                    147: /* entrees */
                    148: #define Epstatic 0x100
                    149: #define EpVALENCE(ep) ((ep)->valence & 0xFF)
                    150: #define EpSTATIC(ep) ((ep)->valence & 0x100)
                    151: #define EpSETSTATIC(ep) ((ep)->valence |= 0x100)
                    152: #define PARAMSHIFT 9
                    153: #define EpNPARAM(ep) ((ep)->valence >> PARAMSHIFT)
                    154: #define EpPREDEFINED(ep) (EpVALENCE(ep) < EpUSER)
                    155:
                    156: #define EpINSTALL 200
                    157: #define EpMEMBER  105
                    158: #define EpGVAR    104
                    159: #define EpVAR     103
                    160: #define EpALIAS   102
                    161: #define EpNEW     101
                    162: #define EpUSER    100
                    163:
                    164: #define NOT_CREATED_YET ((entree *)0x1L) /* for check_new_fun */
                    165: #define initial_value(ep) ((ep)+1)
                    166:
                    167: /* blocs */
                    168: #define BL_HEAD 3
                    169: #define bl_base(x) ((x) - BL_HEAD)
                    170: #define bl_next(x) (((GEN)x)[-3])
                    171: #define bl_prev(x) (((GEN)x)[-2])
                    172: #define bl_num(x)  (((GEN)x)[-1])
                    173:
                    174: /* break */
                    175: enum { br_NONE, br_BREAK, br_NEXT, br_MULTINEXT, br_RETURN }; /* break status */
                    176:
                    177: /* formatted printing */
                    178: #ifndef LONG_IS_64BIT
                    179: #  define VOIR_STRING1 "[&=%08lx] "
                    180: #  define VOIR_STRING2 "%08lx  "
                    181: #  define VOIR_STRING3 "  %08lx  :  "
                    182: #else
                    183: #  define VOIR_STRING1 "[&=%08x%08x] "
                    184: #  define VOIR_STRING2 "%08x%08x  "
                    185: #  define VOIR_STRING3 "  %08x%08x  :  "
                    186: #endif
                    187:
                    188: /* signals */
                    189: #define INIT_JMPm 1
                    190: #define INIT_SIGm 2
                    191: #define INIT_JMP     (init_opts & INIT_JMPm)
                    192: #define INIT_SIG     (init_opts & INIT_SIGm)
                    193: #define INIT_JMP_on  (init_opts |= INIT_JMPm)
                    194: #define INIT_SIG_on  (init_opts |= INIT_SIGm)
                    195: #define INIT_JMP_off (init_opts &= ~INIT_JMPm)
                    196: #define INIT_SIG_off (init_opts &= ~INIT_SIGm)
                    197:
                    198: /* gp_colors */
                    199: extern void decode_color(int n, int *c);
                    200: #define c_NONE 0xffffUL
                    201: enum { c_ERR, c_HIST, c_PROMPT, c_INPUT, c_OUTPUT, c_HELP, c_TIME, c_LAST };
                    202:
                    203: /* general printing */
                    204: #define print_text(s) print_prefixed_text((s),NULL,NULL);
                    205:
                    206: /* infiles */
                    207: #define MAX_BUFFER 64
                    208: #define mf_IN    1
                    209: #define mf_PIPE  2
                    210: #define mf_FALSE 4
                    211: #define mf_OUT   8
                    212: #define mf_PERM 16
                    213: #define mf_TEST 32
                    214:
                    215: /* for filtre */
1.2     ! noro      216: typedef struct {
        !           217:   char *s, *t, *end; /* source, target, last char read */
        !           218:   int in_string, in_comment, more_input, wait_for_brace, downcase;
        !           219:   void *data;
        !           220: } filtre_t;
        !           221:
        !           222: #define LBRACE '{'
        !           223: #define RBRACE '}'
        !           224:
        !           225: extern char *filtre0(filtre_t *F);
        !           226: extern char *filtre(char *s, int flag);
        !           227: extern void check_filtre(filtre_t *F);
        !           228:
        !           229: typedef struct Buffer {
        !           230:   char *buf;
        !           231:   ulong len;
        !           232:   jmp_buf env;
        !           233:   int flenv;
        !           234: } Buffer;
        !           235:
        !           236: typedef struct input_method {
        !           237:   int free;
        !           238:   char *prompt;
        !           239:   FILE *file;
        !           240:   char * (*fgets)(char *,int,FILE*);
        !           241:   char * (*getline)(Buffer*, char**, struct input_method*);
        !           242: } input_method;
        !           243:
        !           244: /* GP output && output format */
        !           245: enum { f_RAW, f_PRETTYMAT, f_PRETTYOLD, f_PRETTY, f_TEX };
        !           246:
        !           247: void error0(GEN *g);
        !           248: void gpwritebin(char *s, GEN x);
        !           249: void print   (GEN *g);
        !           250: void print0(GEN *g, long flag);
        !           251: void print1  (GEN *g);
        !           252: void printp  (GEN *g);
        !           253: void printp1 (GEN *g);
        !           254: void printtex(GEN *g);
        !           255: void write0  (char *s, GEN *g);
        !           256: void write1  (char *s, GEN *g);
        !           257: void writetex(char *s, GEN *g);
        !           258:
        !           259: /* for output */
        !           260: typedef struct {
        !           261:   char format; /* e,f,g */
        !           262:   long fieldw; /* 0 (ignored) or field width */
        !           263:   long sigd; /* -1 (all) or number of sign. digits printed */
        !           264:   int sp;
        !           265:   int initial;
        !           266:   int prettyp;
        !           267: } pariout_t;
        !           268:
        !           269: extern void gen_output(GEN x, pariout_t *T);
        !           270: extern char *GENtostr0(GEN x, pariout_t *T, void(*do_out)(GEN, pariout_t *));
        !           271: extern void bruti(GEN g, pariout_t *T, int nosign);
        !           272: extern void matbruti(GEN g, pariout_t *T);
        !           273: extern void sori(GEN g, pariout_t *T);
        !           274: extern void texi(GEN g, pariout_t *T, int nosign);
        !           275: extern pariout_t DFLT_OUTPUT;
        !           276:
        !           277: /* GP_DATA->flags */
        !           278: enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32,
        !           279:        USE_READLINE=64, SECURE=128, EMACS=256, TEXMACS=512, LOG=1024};
        !           280: /* GP */
        !           281: #define pariputs_opt(s) if (!(GP_DATA->flags & QUIET)) pariputs(s)
        !           282:
        !           283: #if 0 /* to debug TeXmacs interface */
        !           284: #define DATA_BEGIN  ((char) 'B')
        !           285: #define DATA_END    ((char) 'E')
        !           286: #else
        !           287: #define DATA_BEGIN  ((char) 2)
        !           288: #define DATA_END    ((char) 5)
        !           289: #endif
        !           290: #define DATA_ESCAPE ((char) 27)
        !           291:
        !           292: typedef struct {
        !           293:   gp_hist *hist;
        !           294:   gp_pp *pp;
        !           295:   gp_path *path;
        !           296:   pariout_t *fmt;
        !           297:   ulong flags, lim_lines;
        !           298:   char *help;
        !           299:   pari_timer *T;
        !           300: } gp_data;
        !           301:
        !           302: extern gp_data *GP_DATA;
        !           303:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>