=================================================================== RCS file: /home/cvs/OpenXM_contrib/pari-2.2/src/language/Attic/anal.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- OpenXM_contrib/pari-2.2/src/language/Attic/anal.h 2001/10/02 11:17:10 1.1 +++ OpenXM_contrib/pari-2.2/src/language/Attic/anal.h 2002/09/11 07:27:03 1.2 @@ -1,4 +1,4 @@ -/* $Id: anal.h,v 1.1 2001/10/02 11:17:10 noro Exp $ +/* $Id: anal.h,v 1.2 2002/09/11 07:27:03 noro Exp $ Copyright (C) 2000 The PARI group. @@ -52,6 +52,25 @@ typedef struct stack { void *value; } stack; +/* history */ +typedef struct { + GEN *res; /* array of previous results, FIFO */ + size_t size; /* # res */ + ulong total; /* # of results computed since big bang */ +} gp_hist; + +/* prettyprinter */ +typedef struct { + pariFILE *file; + char *cmd; +} gp_pp; + +/* path */ +typedef struct { + char *PATH; + char **dirs; +} gp_path; + void push_stack(stack **pts, void *a); void *pop_stack(stack **pts); @@ -62,24 +81,27 @@ int is_identifier(char *s); entree *is_entry_intern(char *s, entree **table, long *hash); long is_keyword_char(char c); char *readstring(char *src, char *s); -long loop_break(); -long did_break(); +long loop_break(void); +long did_break(void); void print_prefixed_text(char *s, char *prefix, char *str); +GEN gp_history(gp_hist *H, long p, char *old, char *entry); +GEN set_hist_entry(gp_hist *H, GEN x); +char* get_analyseur(void); +void set_analyseur(char *s); + void term_color(int c); char *term_get_color(int c); -void hit_return(); +void hit_return(void); void push_val(entree *ep, GEN a); void pop_val(entree *ep); -extern long prec, secure; +extern ulong prec; extern GEN gnil; extern char *current_function; -extern GEN (*gp_history_fun)(long, long, char *, char *); extern int (*whatnow_fun)(char *, int); -extern void (*output_fun)(GEN); extern void *foreignHandler; extern GEN (*foreignExprHandler)(char*); extern char foreignExprSwitch; @@ -111,17 +133,13 @@ extern char *oldhelpmessage[], *helpmessages_oldgp[] extern entree oldfonctions[], functions_oldgp[]; /* backward compatibility */ -extern long compatible; +extern ulong compatible; enum { NONE, WARN, OLDFUN, OLDALL }; #define new_fun_set (compatible == NONE || compatible == WARN) /* return type for GP functions */ enum { RET_GEN, RET_INT, RET_VOID }; -/* emacs/texmacs interface */ -extern int under_emacs; -extern int under_texmacs; - #ifdef STACK_CHECK extern void *PARI_stack_limit; #endif @@ -195,8 +213,91 @@ enum { c_ERR, c_HIST, c_PROMPT, c_INPUT, c_OUTPUT, c_H #define mf_TEST 32 /* for filtre */ -#define f_COMMENT 0 -#define f_INIT 1 -#define f_KEEPCASE 2 -#define f_REG 4 -#define f_ENDFILE 8 +typedef struct { + char *s, *t, *end; /* source, target, last char read */ + int in_string, in_comment, more_input, wait_for_brace, downcase; + void *data; +} filtre_t; + +#define LBRACE '{' +#define RBRACE '}' + +extern char *filtre0(filtre_t *F); +extern char *filtre(char *s, int flag); +extern void check_filtre(filtre_t *F); + +typedef struct Buffer { + char *buf; + ulong len; + jmp_buf env; + int flenv; +} Buffer; + +typedef struct input_method { + int free; + char *prompt; + FILE *file; + char * (*fgets)(char *,int,FILE*); + char * (*getline)(Buffer*, char**, struct input_method*); +} input_method; + +/* GP output && output format */ +enum { f_RAW, f_PRETTYMAT, f_PRETTYOLD, f_PRETTY, f_TEX }; + +void error0(GEN *g); +void gpwritebin(char *s, GEN x); +void print (GEN *g); +void print0(GEN *g, long flag); +void print1 (GEN *g); +void printp (GEN *g); +void printp1 (GEN *g); +void printtex(GEN *g); +void write0 (char *s, GEN *g); +void write1 (char *s, GEN *g); +void writetex(char *s, GEN *g); + +/* for output */ +typedef struct { + char format; /* e,f,g */ + long fieldw; /* 0 (ignored) or field width */ + long sigd; /* -1 (all) or number of sign. digits printed */ + int sp; + int initial; + int prettyp; +} pariout_t; + +extern void gen_output(GEN x, pariout_t *T); +extern char *GENtostr0(GEN x, pariout_t *T, void(*do_out)(GEN, pariout_t *)); +extern void bruti(GEN g, pariout_t *T, int nosign); +extern void matbruti(GEN g, pariout_t *T); +extern void sori(GEN g, pariout_t *T); +extern void texi(GEN g, pariout_t *T, int nosign); +extern pariout_t DFLT_OUTPUT; + +/* GP_DATA->flags */ +enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32, + USE_READLINE=64, SECURE=128, EMACS=256, TEXMACS=512, LOG=1024}; +/* GP */ +#define pariputs_opt(s) if (!(GP_DATA->flags & QUIET)) pariputs(s) + +#if 0 /* to debug TeXmacs interface */ +#define DATA_BEGIN ((char) 'B') +#define DATA_END ((char) 'E') +#else +#define DATA_BEGIN ((char) 2) +#define DATA_END ((char) 5) +#endif +#define DATA_ESCAPE ((char) 27) + +typedef struct { + gp_hist *hist; + gp_pp *pp; + gp_path *path; + pariout_t *fmt; + ulong flags, lim_lines; + char *help; + pari_timer *T; +} gp_data; + +extern gp_data *GP_DATA; +