1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /* |
---|
5 | * ABSTRACT: |
---|
6 | */ |
---|
7 | |
---|
8 | #include <string.h> |
---|
9 | #include <unistd.h> |
---|
10 | #include <stdio.h> |
---|
11 | #include <stddef.h> |
---|
12 | #include <stdlib.h> |
---|
13 | #include <time.h> |
---|
14 | |
---|
15 | #include "mod2.h" |
---|
16 | #include <mylimits.h> |
---|
17 | #include "omalloc.h" |
---|
18 | #include "structs.h" |
---|
19 | #include "tok.h" |
---|
20 | #include "febase.h" |
---|
21 | #include "cntrlc.h" |
---|
22 | #include "page.h" |
---|
23 | #include "ipid.h" |
---|
24 | #include "ipshell.h" |
---|
25 | #include "kstd1.h" |
---|
26 | #include "subexpr.h" |
---|
27 | #include "timer.h" |
---|
28 | #include "intvec.h" |
---|
29 | #include "ring.h" |
---|
30 | #include "omSingularConfig.h" |
---|
31 | #include "p_Procs.h" |
---|
32 | #include "version.h" |
---|
33 | |
---|
34 | #include "static.h" |
---|
35 | #ifdef HAVE_STATIC |
---|
36 | #undef HAVE_DYN_RL |
---|
37 | #endif |
---|
38 | |
---|
39 | #define SI_DONT_HAVE_GLOBAL_VARS |
---|
40 | |
---|
41 | //#ifdef HAVE_LIBPARSER |
---|
42 | //# include "libparse.h" |
---|
43 | //#endif /* HAVE_LIBPARSER */ |
---|
44 | |
---|
45 | #ifdef HAVE_FACTORY |
---|
46 | #include <factory.h> |
---|
47 | #endif |
---|
48 | |
---|
49 | /* version strings */ |
---|
50 | #ifdef HAVE_LIBFAC_P |
---|
51 | extern const char * libfac_version; |
---|
52 | extern const char * libfac_date; |
---|
53 | #endif |
---|
54 | //extern "C" { |
---|
55 | //#include <gmp.h> |
---|
56 | //} |
---|
57 | #include <si_gmp.h> |
---|
58 | #ifdef HAVE_MPSR |
---|
59 | #include <MP_Config.h> |
---|
60 | #endif |
---|
61 | |
---|
62 | /*2 |
---|
63 | * initialize components of Singular |
---|
64 | */ |
---|
65 | int inits(void) |
---|
66 | { |
---|
67 | int t; |
---|
68 | /*4 signal handler:*/ |
---|
69 | init_signals(); |
---|
70 | /*4 randomize: */ |
---|
71 | t=initTimer(); |
---|
72 | /*t=(int)time(NULL);*/ |
---|
73 | if (t==0) t=1; |
---|
74 | #ifdef HAVE_RTIMER |
---|
75 | initRTimer(); |
---|
76 | #endif |
---|
77 | #ifdef buildin_rand |
---|
78 | siSeed=t; |
---|
79 | #else |
---|
80 | srand((unsigned int)t); |
---|
81 | #endif |
---|
82 | #ifdef HAVE_FACTORY |
---|
83 | factoryseed(t); |
---|
84 | #endif |
---|
85 | /*4 private data of other modules*/ |
---|
86 | memset(&sLastPrinted,0,sizeof(sleftv)); |
---|
87 | sLastPrinted.rtyp=NONE; |
---|
88 | return t; |
---|
89 | } |
---|
90 | |
---|
91 | /*2 |
---|
92 | * the renice routine for very large jobs |
---|
93 | * works only on unix machines, |
---|
94 | * testet on : linux, HP 9.0 |
---|
95 | * |
---|
96 | *#ifndef MSDOS |
---|
97 | *#include <sys/times.h> |
---|
98 | *#include <sys/resource.h> |
---|
99 | *extern "C" int setpriority(int,int,int); |
---|
100 | *void very_nice() |
---|
101 | *{ |
---|
102 | *#ifndef NO_SETPRIORITY |
---|
103 | * setpriority(PRIO_PROCESS,0,19); |
---|
104 | *#endif |
---|
105 | * sleep(10); |
---|
106 | *} |
---|
107 | *#else |
---|
108 | *void very_nice(){} |
---|
109 | *#endif |
---|
110 | */ |
---|
111 | |
---|
112 | void singular_example(char *str) |
---|
113 | { |
---|
114 | assume(str!=NULL); |
---|
115 | char *s=str; |
---|
116 | while (*s==' ') s++; |
---|
117 | char *ss=s; |
---|
118 | while (*ss!='\0') ss++; |
---|
119 | while (*ss<=' ') |
---|
120 | { |
---|
121 | *ss='\0'; |
---|
122 | ss--; |
---|
123 | } |
---|
124 | idhdl h=IDROOT->get(s,myynest); |
---|
125 | if ((h!=NULL) && (IDTYP(h)==PROC_CMD)) |
---|
126 | { |
---|
127 | char *lib=iiGetLibName(IDPROC(h)); |
---|
128 | if((lib!=NULL)&&(*lib!='\0')) |
---|
129 | { |
---|
130 | Print("// proc %s from lib %s\n",s,lib); |
---|
131 | s=iiGetLibProcBuffer(IDPROC(h), 2); |
---|
132 | if (s!=NULL) |
---|
133 | { |
---|
134 | if (strlen(s)>5) |
---|
135 | { |
---|
136 | iiEStart(s,IDPROC(h)); |
---|
137 | return; |
---|
138 | } |
---|
139 | else omFree((ADDRESS)s); |
---|
140 | } |
---|
141 | } |
---|
142 | } |
---|
143 | else |
---|
144 | { |
---|
145 | char sing_file[MAXPATHLEN]; |
---|
146 | FILE *fd=NULL; |
---|
147 | char *res_m=feResource('m', 0); |
---|
148 | if (res_m!=NULL) |
---|
149 | { |
---|
150 | sprintf(sing_file, "%s/%s.sing", res_m, s); |
---|
151 | fd = feFopen(sing_file, "r"); |
---|
152 | } |
---|
153 | if (fd != NULL) |
---|
154 | { |
---|
155 | |
---|
156 | int old_echo = si_echo; |
---|
157 | int length, got; |
---|
158 | char* s; |
---|
159 | |
---|
160 | fseek(fd, 0, SEEK_END); |
---|
161 | length = ftell(fd); |
---|
162 | fseek(fd, 0, SEEK_SET); |
---|
163 | s = (char*) omAlloc((length+20)*sizeof(char)); |
---|
164 | got = fread(s, sizeof(char), length, fd); |
---|
165 | fclose(fd); |
---|
166 | if (got != length) |
---|
167 | { |
---|
168 | Werror("Error while reading file %s", sing_file); |
---|
169 | omFree(s); |
---|
170 | } |
---|
171 | else |
---|
172 | { |
---|
173 | s[length] = '\0'; |
---|
174 | strcat(s, "\n;return();\n\n"); |
---|
175 | si_echo = 2; |
---|
176 | iiEStart(s, NULL); |
---|
177 | si_echo = old_echo; |
---|
178 | } |
---|
179 | } |
---|
180 | else |
---|
181 | { |
---|
182 | Werror("no example for %s", str); |
---|
183 | } |
---|
184 | } |
---|
185 | } |
---|
186 | |
---|
187 | |
---|
188 | struct soptionStruct |
---|
189 | { |
---|
190 | char * name; |
---|
191 | unsigned setval; |
---|
192 | unsigned resetval; |
---|
193 | }; |
---|
194 | |
---|
195 | struct soptionStruct optionStruct[]= |
---|
196 | { |
---|
197 | {"prot", Sy_bit(OPT_PROT), ~Sy_bit(OPT_PROT) }, |
---|
198 | {"redSB", Sy_bit(OPT_REDSB), ~Sy_bit(OPT_REDSB) }, |
---|
199 | {"notBuckets", Sy_bit(OPT_NOT_BUCKETS), ~Sy_bit(OPT_NOT_BUCKETS) }, |
---|
200 | {"notSugar", Sy_bit(OPT_NOT_SUGAR), ~Sy_bit(OPT_NOT_SUGAR) }, |
---|
201 | {"interrupt", Sy_bit(OPT_INTERRUPT), ~Sy_bit(OPT_INTERRUPT) }, |
---|
202 | {"sugarCrit", Sy_bit(OPT_SUGARCRIT), ~Sy_bit(OPT_SUGARCRIT) }, |
---|
203 | {"teach", Sy_bit(OPT_DEBUG), ~Sy_bit(OPT_DEBUG) }, |
---|
204 | /* 9 return SB in syz, quotient, intersect */ |
---|
205 | {"returnSB", Sy_bit(OPT_RETURN_SB), ~Sy_bit(OPT_RETURN_SB) }, |
---|
206 | {"fastHC", Sy_bit(OPT_FASTHC), ~Sy_bit(OPT_FASTHC) }, |
---|
207 | /* 11-19 sort in L/T */ |
---|
208 | {"keepvars", Sy_bit(OPT_KEEPVARS), ~Sy_bit(OPT_KEEPVARS) }, |
---|
209 | {"staircaseBound",Sy_bit(OPT_STAIRCASEBOUND),~Sy_bit(OPT_STAIRCASEBOUND) }, |
---|
210 | {"multBound", Sy_bit(OPT_MULTBOUND), ~Sy_bit(OPT_MULTBOUND) }, |
---|
211 | {"degBound", Sy_bit(OPT_DEGBOUND), ~Sy_bit(OPT_DEGBOUND) }, |
---|
212 | /* 25 no redTail(p)/redTail(s) */ |
---|
213 | {"redTail", Sy_bit(OPT_REDTAIL), ~Sy_bit(OPT_REDTAIL) }, |
---|
214 | {"redThrough", Sy_bit(OPT_REDTHROUGH), ~Sy_bit(OPT_REDTHROUGH) }, |
---|
215 | {"lazy", Sy_bit(OPT_OLDSTD), ~Sy_bit(OPT_OLDSTD) }, |
---|
216 | {"intStrategy", Sy_bit(OPT_INTSTRATEGY), ~Sy_bit(OPT_INTSTRATEGY) }, |
---|
217 | {"infRedTail", Sy_bit(OPT_INFREDTAIL), ~Sy_bit(OPT_INFREDTAIL) }, |
---|
218 | /* 30: use not regularity for syz */ |
---|
219 | {"notRegularity",Sy_bit(OPT_NOTREGULARITY), ~Sy_bit(OPT_NOTREGULARITY) }, |
---|
220 | {"weightM", Sy_bit(OPT_WEIGHTM), ~Sy_bit(OPT_WEIGHTM) }, |
---|
221 | /*special for "none" and also end marker for showOption:*/ |
---|
222 | {"ne", 0, 0 } |
---|
223 | }; |
---|
224 | |
---|
225 | struct soptionStruct verboseStruct[]= |
---|
226 | { |
---|
227 | {"mem", Sy_bit(V_SHOW_MEM), ~Sy_bit(V_SHOW_MEM) }, |
---|
228 | {"yacc", Sy_bit(V_YACC), ~Sy_bit(V_YACC) }, |
---|
229 | {"redefine", Sy_bit(V_REDEFINE), ~Sy_bit(V_REDEFINE) }, |
---|
230 | {"reading", Sy_bit(V_READING), ~Sy_bit(V_READING) }, |
---|
231 | {"loadLib", Sy_bit(V_LOAD_LIB), ~Sy_bit(V_LOAD_LIB) }, |
---|
232 | {"debugLib", Sy_bit(V_DEBUG_LIB), ~Sy_bit(V_DEBUG_LIB) }, |
---|
233 | {"loadProc", Sy_bit(V_LOAD_PROC), ~Sy_bit(V_LOAD_PROC) }, |
---|
234 | {"defRes", Sy_bit(V_DEF_RES), ~Sy_bit(V_DEF_RES) }, |
---|
235 | {"debugMem", Sy_bit(V_DEBUG_MEM), ~Sy_bit(V_DEBUG_MEM) }, |
---|
236 | {"usage", Sy_bit(V_SHOW_USE), ~Sy_bit(V_SHOW_USE) }, |
---|
237 | {"Imap", Sy_bit(V_IMAP), ~Sy_bit(V_IMAP) }, |
---|
238 | {"prompt", Sy_bit(V_PROMPT), ~Sy_bit(V_PROMPT) }, |
---|
239 | {"length", Sy_bit(V_LENGTH), ~Sy_bit(V_LENGTH) }, |
---|
240 | {"notWarnSB",Sy_bit(V_NSB), ~Sy_bit(V_NSB) }, |
---|
241 | {"contentSB",Sy_bit(V_CONTENTSB), ~Sy_bit(V_CONTENTSB) }, |
---|
242 | {"cancelunit",Sy_bit(V_CANCELUNIT),~Sy_bit(V_CANCELUNIT)}, |
---|
243 | {"modpsolve",Sy_bit(V_MODPSOLVSB),~Sy_bit(V_MODPSOLVSB)}, |
---|
244 | {"geometricSB",Sy_bit(V_UPTORADICAL),~Sy_bit(V_UPTORADICAL)}, |
---|
245 | {"findMonomials",Sy_bit(V_FINDMONOM),~Sy_bit(V_FINDMONOM)}, |
---|
246 | {"coefStrat",Sy_bit(V_COEFSTRAT),~Sy_bit(V_COEFSTRAT)}, |
---|
247 | /*special for "none" and also end marker for showOption:*/ |
---|
248 | {"ne", 0, 0 } |
---|
249 | }; |
---|
250 | |
---|
251 | BOOLEAN setOption(leftv res, leftv v) |
---|
252 | { |
---|
253 | char *n; |
---|
254 | do |
---|
255 | { |
---|
256 | if (v->Typ()==STRING_CMD) |
---|
257 | { |
---|
258 | n=(char *)v->CopyD(STRING_CMD); |
---|
259 | } |
---|
260 | else |
---|
261 | { |
---|
262 | if (v->name==NULL) |
---|
263 | return TRUE; |
---|
264 | if (v->rtyp==0) |
---|
265 | { |
---|
266 | n=v->name; |
---|
267 | v->name=NULL; |
---|
268 | } |
---|
269 | else |
---|
270 | { |
---|
271 | n=omStrDup(v->name); |
---|
272 | } |
---|
273 | } |
---|
274 | |
---|
275 | int i; |
---|
276 | |
---|
277 | if(strcmp(n,"get")==0) |
---|
278 | { |
---|
279 | intvec *w=new intvec(2); |
---|
280 | (*w)[0]=test; |
---|
281 | (*w)[1]=verbose; |
---|
282 | res->rtyp=INTVEC_CMD; |
---|
283 | res->data=(void *)w; |
---|
284 | goto okay; |
---|
285 | } |
---|
286 | if(strcmp(n,"set")==0) |
---|
287 | { |
---|
288 | if((v->next!=NULL) |
---|
289 | &&(v->next->Typ()==INTVEC_CMD)) |
---|
290 | { |
---|
291 | v=v->next; |
---|
292 | intvec *w=(intvec*)v->Data(); |
---|
293 | test=(*w)[0]; |
---|
294 | verbose=(*w)[1]; |
---|
295 | #if 0 |
---|
296 | if (TEST_OPT_INTSTRATEGY && (currRing!=NULL) |
---|
297 | && rField_has_simple_inverse() |
---|
298 | #ifdef HAVE_RING2TOM |
---|
299 | && !rField_is_Ring_2toM(currRing) |
---|
300 | #endif |
---|
301 | ) { |
---|
302 | test &=~Sy_bit(OPT_INTSTRATEGY); |
---|
303 | } |
---|
304 | #endif |
---|
305 | goto okay; |
---|
306 | } |
---|
307 | } |
---|
308 | if(strcmp(n,"none")==0) |
---|
309 | { |
---|
310 | test=0; |
---|
311 | verbose=0; |
---|
312 | goto okay; |
---|
313 | } |
---|
314 | for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++) |
---|
315 | { |
---|
316 | if (strcmp(n,optionStruct[i].name)==0) |
---|
317 | { |
---|
318 | if (optionStruct[i].setval & validOpts) |
---|
319 | { |
---|
320 | test |= optionStruct[i].setval; |
---|
321 | // optOldStd disables redthrough |
---|
322 | if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD)) |
---|
323 | test &= ~Sy_bit(OPT_REDTHROUGH); |
---|
324 | } |
---|
325 | else |
---|
326 | Warn("cannot set option"); |
---|
327 | #if 0 |
---|
328 | if (TEST_OPT_INTSTRATEGY && (currRing!=NULL) |
---|
329 | && rField_has_simple_inverse() |
---|
330 | #ifdef HAVE_RING2TOM |
---|
331 | && !rField_is_Ring_2toM(currRing) |
---|
332 | #endif |
---|
333 | ) { |
---|
334 | test &=~Sy_bit(OPT_INTSTRATEGY); |
---|
335 | } |
---|
336 | #endif |
---|
337 | goto okay; |
---|
338 | } |
---|
339 | else if ((strncmp(n,"no",2)==0) |
---|
340 | && (strcmp(n+2,optionStruct[i].name)==0)) |
---|
341 | { |
---|
342 | if (optionStruct[i].setval & validOpts) |
---|
343 | { |
---|
344 | test &= optionStruct[i].resetval; |
---|
345 | } |
---|
346 | else |
---|
347 | Warn("cannot clear option"); |
---|
348 | goto okay; |
---|
349 | } |
---|
350 | } |
---|
351 | for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++) |
---|
352 | { |
---|
353 | if (strcmp(n,verboseStruct[i].name)==0) |
---|
354 | { |
---|
355 | verbose |= verboseStruct[i].setval; |
---|
356 | #ifdef YYDEBUG |
---|
357 | #if YYDEBUG |
---|
358 | if (BVERBOSE(V_YACC)) yydebug=1; |
---|
359 | else yydebug=0; |
---|
360 | #endif |
---|
361 | #endif |
---|
362 | goto okay; |
---|
363 | } |
---|
364 | else if ((strncmp(n,"no",2)==0) |
---|
365 | && (strcmp(n+2,verboseStruct[i].name)==0)) |
---|
366 | { |
---|
367 | verbose &= verboseStruct[i].resetval; |
---|
368 | #ifdef YYDEBUG |
---|
369 | #if YYDEBUG |
---|
370 | if (BVERBOSE(V_YACC)) yydebug=1; |
---|
371 | else yydebug=0; |
---|
372 | #endif |
---|
373 | #endif |
---|
374 | goto okay; |
---|
375 | } |
---|
376 | } |
---|
377 | Werror("unknown option `%s`",n); |
---|
378 | okay: |
---|
379 | if (currRing != NULL) |
---|
380 | currRing->options = test & TEST_RINGDEP_OPTS; |
---|
381 | omFree((ADDRESS)n); |
---|
382 | v=v->next; |
---|
383 | } while (v!=NULL); |
---|
384 | #ifdef HAVE_TCL |
---|
385 | if (tclmode) |
---|
386 | { |
---|
387 | BITSET tmp; |
---|
388 | int i; |
---|
389 | StringSetS(""); |
---|
390 | if ((test!=0)||(verbose!=0)) |
---|
391 | { |
---|
392 | tmp=test; |
---|
393 | if(tmp) |
---|
394 | { |
---|
395 | for (i=0; optionStruct[i].setval!=0; i++) |
---|
396 | { |
---|
397 | if (optionStruct[i].setval & test) |
---|
398 | { |
---|
399 | StringAppend(" %s",optionStruct[i].name); |
---|
400 | tmp &=optionStruct[i].resetval; |
---|
401 | } |
---|
402 | } |
---|
403 | } |
---|
404 | tmp=verbose; |
---|
405 | if (tmp) |
---|
406 | { |
---|
407 | for (i=0; verboseStruct[i].setval!=0; i++) |
---|
408 | { |
---|
409 | if (verboseStruct[i].setval & tmp) |
---|
410 | { |
---|
411 | StringAppend(" %s",verboseStruct[i].name); |
---|
412 | tmp &=verboseStruct[i].resetval; |
---|
413 | } |
---|
414 | } |
---|
415 | } |
---|
416 | PrintTCLS('O',StringAppendS("")); |
---|
417 | StringSetS(""); |
---|
418 | } |
---|
419 | else |
---|
420 | { |
---|
421 | PrintTCLS('O'," "); |
---|
422 | } |
---|
423 | } |
---|
424 | #endif |
---|
425 | // set global variable to show memory usage |
---|
426 | if (BVERBOSE(V_SHOW_MEM)) om_sing_opt_show_mem = 1; |
---|
427 | else om_sing_opt_show_mem = 0; |
---|
428 | return FALSE; |
---|
429 | } |
---|
430 | |
---|
431 | char * showOption() |
---|
432 | { |
---|
433 | int i; |
---|
434 | BITSET tmp; |
---|
435 | |
---|
436 | StringSetS("//options:"); |
---|
437 | if ((test!=0)||(verbose!=0)) |
---|
438 | { |
---|
439 | tmp=test; |
---|
440 | if(tmp) |
---|
441 | { |
---|
442 | for (i=0; optionStruct[i].setval!=0; i++) |
---|
443 | { |
---|
444 | if (optionStruct[i].setval & test) |
---|
445 | { |
---|
446 | StringAppend(" %s",optionStruct[i].name); |
---|
447 | tmp &=optionStruct[i].resetval; |
---|
448 | } |
---|
449 | } |
---|
450 | for (i=0; i<32; i++) |
---|
451 | { |
---|
452 | if (tmp & Sy_bit(i)) StringAppend(" %d",i); |
---|
453 | } |
---|
454 | } |
---|
455 | tmp=verbose; |
---|
456 | if (tmp) |
---|
457 | { |
---|
458 | for (i=0; verboseStruct[i].setval!=0; i++) |
---|
459 | { |
---|
460 | if (verboseStruct[i].setval & tmp) |
---|
461 | { |
---|
462 | StringAppend(" %s",verboseStruct[i].name); |
---|
463 | tmp &=verboseStruct[i].resetval; |
---|
464 | } |
---|
465 | } |
---|
466 | for (i=1; i<32; i++) |
---|
467 | { |
---|
468 | if (tmp & Sy_bit(i)) StringAppend(" %d",i+32); |
---|
469 | } |
---|
470 | } |
---|
471 | return omStrDup(StringAppendS("")); |
---|
472 | } |
---|
473 | else |
---|
474 | return omStrDup(StringAppendS(" none")); |
---|
475 | } |
---|
476 | |
---|
477 | char * versionString() |
---|
478 | { |
---|
479 | char* str = StringSetS(""); |
---|
480 | StringAppend("Singular for %s version %s (%lu) %s\nwith\n", |
---|
481 | S_UNAME, S_VERSION1, |
---|
482 | feVersionId,singular_date); |
---|
483 | StringAppend("\t"); |
---|
484 | #ifdef HAVE_FACTORY |
---|
485 | StringAppend("factory(%s),", factoryVersion); |
---|
486 | #endif |
---|
487 | #ifdef HAVE_LIBFAC_P |
---|
488 | StringAppend("libfac(%s,%s),\n\t",libfac_version,libfac_date); |
---|
489 | #endif |
---|
490 | #if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR) |
---|
491 | StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR); |
---|
492 | #else |
---|
493 | StringAppendS("GMP(1.3),"); |
---|
494 | #endif |
---|
495 | #ifdef HAVE_NTL |
---|
496 | #include "NTL/version.h" |
---|
497 | StringAppend("NTL(%s),",NTL_VERSION); |
---|
498 | #endif |
---|
499 | #ifdef HAVE_MPSR |
---|
500 | StringAppend("MP(%s),",MP_VERSION); |
---|
501 | #endif |
---|
502 | #if defined(HAVE_DYN_RL) |
---|
503 | if (fe_fgets_stdin==fe_fgets_dummy) |
---|
504 | StringAppendS("no input,"); |
---|
505 | else if (fe_fgets_stdin==fe_fgets) |
---|
506 | StringAppendS("fgets,"); |
---|
507 | if (fe_fgets_stdin==fe_fgets_stdin_drl) |
---|
508 | StringAppendS("dynamic readline,"); |
---|
509 | #ifdef HAVE_FEREAD |
---|
510 | else if (fe_fgets_stdin==fe_fgets_stdin_emu) |
---|
511 | StringAppendS("emulated readline,"); |
---|
512 | #endif |
---|
513 | else |
---|
514 | StringAppendS("unknown fgets method,"); |
---|
515 | #else |
---|
516 | #if defined(HAVE_READLINE) && !defined(FEREAD) |
---|
517 | StringAppendS("static readline,"); |
---|
518 | #else |
---|
519 | #ifdef HAVE_FEREAD |
---|
520 | StringAppendS("emulated readline,"); |
---|
521 | #else |
---|
522 | StringAppendS("fgets,"); |
---|
523 | #endif |
---|
524 | #endif |
---|
525 | #endif |
---|
526 | #ifdef HAVE_PLURAL |
---|
527 | StringAppendS("Plural,"); |
---|
528 | #endif |
---|
529 | #ifdef HAVE_DBM |
---|
530 | StringAppendS("DBM,\n\t"); |
---|
531 | #else |
---|
532 | StringAppendS("\n\t"); |
---|
533 | #endif |
---|
534 | #ifdef HAVE_NS |
---|
535 | StringAppendS("namespaces,"); |
---|
536 | #endif |
---|
537 | #ifdef HAVE_DYNAMIC_LOADING |
---|
538 | StringAppendS("dynamic modules,"); |
---|
539 | #endif |
---|
540 | if (p_procs_dynamic) StringAppendS("dynamic p_Procs,"); |
---|
541 | #ifdef TEST |
---|
542 | StringAppendS("TESTs,"); |
---|
543 | #endif |
---|
544 | #if YYDEBUG |
---|
545 | StringAppendS("YYDEBUG=1,"); |
---|
546 | #endif |
---|
547 | #ifdef HAVE_ASSUME |
---|
548 | StringAppendS("ASSUME,"); |
---|
549 | #endif |
---|
550 | #ifdef MDEBUG |
---|
551 | StringAppend("MDEBUG=%d,",MDEBUG); |
---|
552 | #endif |
---|
553 | #ifdef OM_CHECK |
---|
554 | StringAppend("OM_CHECK=%d,",OM_CHECK); |
---|
555 | #endif |
---|
556 | #ifdef OM_TRACK |
---|
557 | StringAppend("OM_TRACK=%d,",OM_TRACK); |
---|
558 | #endif |
---|
559 | #ifdef OM_NDEBUG |
---|
560 | StringAppend("OM_NDEBUG,"); |
---|
561 | #endif |
---|
562 | #ifdef PDEBUG |
---|
563 | StringAppendS("PDEBUG,"); |
---|
564 | #endif |
---|
565 | #ifdef KDEBUG |
---|
566 | StringAppendS("KDEBUG,"); |
---|
567 | #endif |
---|
568 | #ifndef __OPTIMIZE__ |
---|
569 | StringAppendS("-g,"); |
---|
570 | #endif |
---|
571 | #ifdef HAVE_EIGENVAL |
---|
572 | StringAppendS("eigenvalues,"); |
---|
573 | #endif |
---|
574 | #ifdef HAVE_GMS |
---|
575 | StringAppendS("Gauss-Manin system,"); |
---|
576 | #endif |
---|
577 | StringAppend("random=%d\n",siRandomStart); |
---|
578 | StringAppend("\tCC=%s,\n\tCXX=%s" |
---|
579 | #ifdef __GNUC__ |
---|
580 | "(" __VERSION__ ")" |
---|
581 | #endif |
---|
582 | "\n",CC,CXX); |
---|
583 | feStringAppendResources(0); |
---|
584 | feStringAppendBrowsers(0); |
---|
585 | StringAppend("\n"); |
---|
586 | return str; |
---|
587 | } |
---|
588 | |
---|
589 | #ifdef HAVE_NS |
---|
590 | void listall(int showproc) |
---|
591 | { |
---|
592 | idhdl hh=basePack->idroot; |
---|
593 | PrintS("====== Top ==============\n"); |
---|
594 | while (hh!=NULL) |
---|
595 | { |
---|
596 | if (showproc || (IDTYP(hh)!=PROC_CMD)) |
---|
597 | { |
---|
598 | if (IDDATA(hh)==(void *)currRing) PrintS("(R)"); |
---|
599 | else if (IDDATA(hh)==(void *)currPack) PrintS("(P)"); |
---|
600 | else PrintS(" "); |
---|
601 | Print("::%s, typ %s level %d data %x", |
---|
602 | IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh),IDDATA(hh)); |
---|
603 | if ((IDTYP(hh)==RING_CMD) |
---|
604 | || (IDTYP(hh)==QRING_CMD)) |
---|
605 | Print(" ref: %d\n",IDRING(hh)->ref); |
---|
606 | else |
---|
607 | PrintLn(); |
---|
608 | } |
---|
609 | hh=IDNEXT(hh); |
---|
610 | } |
---|
611 | hh=basePack->idroot; |
---|
612 | while (hh!=NULL) |
---|
613 | { |
---|
614 | if (IDDATA(hh)==(void *)basePack) |
---|
615 | Print("(T)::%s, typ %s level %d data %x\n", |
---|
616 | IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh),IDDATA(hh)); |
---|
617 | else |
---|
618 | if ((IDTYP(hh)==RING_CMD) |
---|
619 | || (IDTYP(hh)==QRING_CMD) |
---|
620 | || (IDTYP(hh)==PACKAGE_CMD)) |
---|
621 | { |
---|
622 | Print("====== %s ==============\n",IDID(hh)); |
---|
623 | idhdl h2=IDRING(hh)->idroot; |
---|
624 | while (h2!=NULL) |
---|
625 | { |
---|
626 | if (showproc || (IDTYP(h2)!=PROC_CMD)) |
---|
627 | { |
---|
628 | if ((IDDATA(h2)==(void *)currRing) |
---|
629 | && ((IDTYP(h2)==RING_CMD)||(IDTYP(h2)==QRING_CMD))) |
---|
630 | PrintS("(R)"); |
---|
631 | else if (IDDATA(h2)==(void *)currPack) PrintS("(P)"); |
---|
632 | else PrintS(" "); |
---|
633 | Print("%s::%s, typ %s level %d data %x\n", |
---|
634 | IDID(hh),IDID(h2),Tok2Cmdname(IDTYP(h2)),IDLEV(h2),IDDATA(h2)); |
---|
635 | } |
---|
636 | h2=IDNEXT(h2); |
---|
637 | } |
---|
638 | } |
---|
639 | hh=IDNEXT(hh); |
---|
640 | } |
---|
641 | Print("currRing:%x, currPack:%x,basePack:%x\n",currRing,currPack,basePack); |
---|
642 | iiCheckPack(currPack); |
---|
643 | } |
---|
644 | #ifndef NDEBUG |
---|
645 | void checkall() |
---|
646 | { |
---|
647 | idhdl hh=basePack->idroot; |
---|
648 | while (hh!=NULL) |
---|
649 | { |
---|
650 | omCheckAddr(hh); |
---|
651 | omCheckAddr(IDID(hh)); |
---|
652 | if (RingDependend(IDTYP(hh))) Print("%s typ %d in Top\n",IDID(hh),IDTYP(hh)); |
---|
653 | hh=IDNEXT(hh); |
---|
654 | } |
---|
655 | hh=basePack->idroot; |
---|
656 | while (hh!=NULL) |
---|
657 | { |
---|
658 | if (IDTYP(hh)==PACKAGE_CMD) |
---|
659 | { |
---|
660 | idhdl h2=IDPACKAGE(hh)->idroot; |
---|
661 | while (h2!=NULL) |
---|
662 | { |
---|
663 | omCheckAddr(h2); |
---|
664 | omCheckAddr(IDID(h2)); |
---|
665 | if (RingDependend(IDTYP(h2))) Print("%s typ %d in %s\n",IDID(h2),IDTYP(h2),IDID(hh)); |
---|
666 | h2=IDNEXT(h2); |
---|
667 | } |
---|
668 | } |
---|
669 | hh=IDNEXT(hh); |
---|
670 | } |
---|
671 | } |
---|
672 | #endif |
---|
673 | #endif |
---|