Annotation of OpenXM_contrib/pari-2.2/src/language/anal.h, Revision 1.1.1.1
1.1 noro 1: /* $Id: anal.h,v 1.17 2001/09/18 11:04:50 karim Exp $
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:
55: void push_stack(stack **pts, void *a);
56: void *pop_stack(stack **pts);
57:
58: /* functions */
59: void changevalue(entree *ep, GEN val);
60: entree *do_alias(entree *ep);
61: int is_identifier(char *s);
62: entree *is_entry_intern(char *s, entree **table, long *hash);
63: long is_keyword_char(char c);
64: char *readstring(char *src, char *s);
65: long loop_break();
66: long did_break();
67: void print_prefixed_text(char *s, char *prefix, char *str);
68:
69: void term_color(int c);
70: char *term_get_color(int c);
71: void hit_return();
72:
73: void push_val(entree *ep, GEN a);
74: void pop_val(entree *ep);
75:
76: extern long prec, secure;
77: extern GEN gnil;
78:
79: extern char *current_function;
80: extern GEN (*gp_history_fun)(long, long, char *, char *);
81: extern int (*whatnow_fun)(char *, int);
82: extern void (*output_fun)(GEN);
83: extern void *foreignHandler;
84: extern GEN (*foreignExprHandler)(char*);
85: extern char foreignExprSwitch;
86: extern entree * (*foreignAutoload)(char*, long);
87: extern void (*foreignFuncFree)(entree *);
88: extern int (*default_exception_handler)(long);
89:
90: /* Variables containing the list of PARI functions */
91: extern int functions_tblsz; /* hashcodes table size */
92: extern module *pari_modules; /* list of functions modules */
93: extern entree **functions_hash; /* functions hashtable */
94: extern entree **members_hash; /* members hashtable */
95: extern char *helpmessages_basic[];
96: extern entree functions_basic[];
97:
98: /* Variables containing the list of specific GP functions */
99: extern char *helpmessages_gp[];
100: extern entree functions_gp[];
101: extern entree gp_member_list[];
102: extern char *helpmessages_highlevel[];
103: extern entree functions_highlevel[];
104: extern int gp_colors[];
105: extern int disable_color,added_newline;
106:
107: /* Variables containing the list of old PARI fonctions (up to 1.39.15) */
108: extern module *pari_oldmodules; /* list of functions modules */
109: extern entree **funct_old_hash; /* hashtable */
110: extern char *oldhelpmessage[], *helpmessages_oldgp[];
111: extern entree oldfonctions[], functions_oldgp[];
112:
113: /* backward compatibility */
114: extern long compatible;
115: enum { NONE, WARN, OLDFUN, OLDALL };
116: #define new_fun_set (compatible == NONE || compatible == WARN)
117:
118: /* return type for GP functions */
119: enum { RET_GEN, RET_INT, RET_VOID };
120:
121: /* emacs/texmacs interface */
122: extern int under_emacs;
123: extern int under_texmacs;
124:
125: #ifdef STACK_CHECK
126: extern void *PARI_stack_limit;
127: #endif
128:
129: /* entrees */
130: #define Epstatic 0x100
131: #define EpVALENCE(ep) ((ep)->valence & 0xFF)
132: #define EpSTATIC(ep) ((ep)->valence & 0x100)
133: #define EpSETSTATIC(ep) ((ep)->valence |= 0x100)
134: #define PARAMSHIFT 9
135: #define EpNPARAM(ep) ((ep)->valence >> PARAMSHIFT)
136: #define EpPREDEFINED(ep) (EpVALENCE(ep) < EpUSER)
137:
138: #define EpINSTALL 200
139: #define EpMEMBER 105
140: #define EpGVAR 104
141: #define EpVAR 103
142: #define EpALIAS 102
143: #define EpNEW 101
144: #define EpUSER 100
145:
146: #define NOT_CREATED_YET ((entree *)0x1L) /* for check_new_fun */
147: #define initial_value(ep) ((ep)+1)
148:
149: /* blocs */
150: #define BL_HEAD 3
151: #define bl_base(x) ((x) - BL_HEAD)
152: #define bl_next(x) (((GEN)x)[-3])
153: #define bl_prev(x) (((GEN)x)[-2])
154: #define bl_num(x) (((GEN)x)[-1])
155:
156: /* break */
157: enum { br_NONE, br_BREAK, br_NEXT, br_MULTINEXT, br_RETURN }; /* break status */
158:
159: /* formatted printing */
160: #ifndef LONG_IS_64BIT
161: # define VOIR_STRING1 "[&=%08lx] "
162: # define VOIR_STRING2 "%08lx "
163: # define VOIR_STRING3 " %08lx : "
164: #else
165: # define VOIR_STRING1 "[&=%08x%08x] "
166: # define VOIR_STRING2 "%08x%08x "
167: # define VOIR_STRING3 " %08x%08x : "
168: #endif
169:
170: /* signals */
171: #define INIT_JMPm 1
172: #define INIT_SIGm 2
173: #define INIT_JMP (init_opts & INIT_JMPm)
174: #define INIT_SIG (init_opts & INIT_SIGm)
175: #define INIT_JMP_on (init_opts |= INIT_JMPm)
176: #define INIT_SIG_on (init_opts |= INIT_SIGm)
177: #define INIT_JMP_off (init_opts &= ~INIT_JMPm)
178: #define INIT_SIG_off (init_opts &= ~INIT_SIGm)
179:
180: /* gp_colors */
181: extern void decode_color(int n, int *c);
182: #define c_NONE 0xffffUL
183: enum { c_ERR, c_HIST, c_PROMPT, c_INPUT, c_OUTPUT, c_HELP, c_TIME, c_LAST };
184:
185: /* general printing */
186: #define print_text(s) print_prefixed_text((s),NULL,NULL);
187:
188: /* infiles */
189: #define MAX_BUFFER 64
190: #define mf_IN 1
191: #define mf_PIPE 2
192: #define mf_FALSE 4
193: #define mf_OUT 8
194: #define mf_PERM 16
195: #define mf_TEST 32
196:
197: /* for filtre */
198: #define f_COMMENT 0
199: #define f_INIT 1
200: #define f_KEEPCASE 2
201: #define f_REG 4
202: #define f_ENDFILE 8
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>