source: git/Singular/misc.cc @ 84a6a7

fieker-DuValspielwiese
Last change on this file since 84a6a7 was 3aed2f, checked in by Michael Brickenstein <bricken@…>, 18 years ago
*bricken: coefStrat git-svn-id: file:///usr/local/Singular/svn/trunk@8989 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 16.7 KB
RevLine 
[0e1846]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
[2685a1]15#include "mod2.h"
[b447d5]16#include <mylimits.h>
[512a2b]17#include "omalloc.h"
[c232af]18#include "structs.h"
[0e1846]19#include "tok.h"
20#include "febase.h"
21#include "cntrlc.h"
[93266c5]22#include "page.h"
[0e1846]23#include "ipid.h"
24#include "ipshell.h"
25#include "kstd1.h"
26#include "subexpr.h"
27#include "timer.h"
[58b151c]28#include "intvec.h"
[be0d84]29#include "ring.h"
[c232af]30#include "omSingularConfig.h"
[7e5a38]31#include "p_Procs.h"
[a3705ae]32#include "version.h"
[8a679a]33
34#include "static.h"
35#ifdef HAVE_STATIC
36#undef HAVE_DYN_RL
37#endif
38
[8b6255]39#define SI_DONT_HAVE_GLOBAL_VARS
[dc32d42]40
[706c95]41//#ifdef HAVE_LIBPARSER
42//#  include "libparse.h"
43//#endif /* HAVE_LIBPARSER */
[5480da]44
[dc32d42]45#ifdef HAVE_FACTORY
[8b6255]46#include <factory.h>
[dc32d42]47#endif
[0e1846]48
[9ea9c6]49/* version strings */
50#ifdef HAVE_LIBFAC_P
51  extern const char * libfac_version;
52  extern const char * libfac_date;
53#endif
[dee0c0]54//extern "C" {
55//#include <gmp.h>
56//}
57#include <si_gmp.h>
[9ea9c6]58#ifdef HAVE_MPSR
59#include <MP_Config.h>
60#endif
61
[0e1846]62/*2
63* initialize components of Singular
64*/
65int inits(void)
66{
67  int t;
68/*4 signal handler:*/
69  init_signals();
70/*4 randomize: */
71  t=initTimer();
72  /*t=(int)time(NULL);*/
[8b6255]73  if (t==0) t=1;
[34ab5de]74#ifdef HAVE_RTIMER
75  initRTimer();
76#endif
[0e1846]77#ifdef buildin_rand
78  siSeed=t;
79#else
80  srand((unsigned int)t);
81#endif
[8b6255]82#ifdef HAVE_FACTORY
83  factoryseed(t);
[9ea9c6]84#endif
[0e1846]85/*4 private data of other modules*/
86  memset(&sLastPrinted,0,sizeof(sleftv));
[6ae4f5]87  sLastPrinted.rtyp=NONE;
[0e1846]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
[40edb03]97*#include <sys/times.h>
[0e1846]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
[62fba0c]112void singular_example(char *str)
113{
[69b4b7a]114  assume(str!=NULL);
[62fba0c]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  }
[bd4cb92]124  idhdl h=IDROOT->get(s,myynest);
[62fba0c]125  if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
126  {
127    char *lib=iiGetLibName(IDPROC(h));
[c73fc6]128    if((lib!=NULL)&&(*lib!='\0'))
[62fba0c]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        }
[c232af]139        else omFree((ADDRESS)s);
[62fba0c]140      }
141    }
142  }
[c04b94]143  else
144  {
145    char sing_file[MAXPATHLEN];
[69b4b7a]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");
[06e0e1]152    }
[c04b94]153    if (fd != NULL)
154    {
[2ddc2e2]155
[c04b94]156      int old_echo = si_echo;
157      int length, got;
158      char* s;
[2ddc2e2]159
[c04b94]160      fseek(fd, 0, SEEK_END);
161      length = ftell(fd);
162      fseek(fd, 0, SEEK_SET);
[c232af]163      s = (char*) omAlloc((length+20)*sizeof(char));
[c04b94]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);
[c232af]169        omFree(s);
[c04b94]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  }
[62fba0c]185}
186
[0e1846]187
188struct soptionStruct
189{
190  char * name;
[d4cb43b]191  unsigned   setval;
192  unsigned   resetval;
[0e1846]193};
194
195struct soptionStruct optionStruct[]=
196{
197  {"prot",         Sy_bit(OPT_PROT),           ~Sy_bit(OPT_PROT)   },
198  {"redSB",        Sy_bit(OPT_REDSB),          ~Sy_bit(OPT_REDSB)   },
[bd4fa1]199  {"notBuckets",   Sy_bit(OPT_NOT_BUCKETS),    ~Sy_bit(OPT_NOT_BUCKETS)   },
[0e1846]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)   },
[057e93c]203  {"teach",     Sy_bit(OPT_DEBUG),          ~Sy_bit(OPT_DEBUG)  },
[0e1846]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)  },
[bef194]214  {"redThrough",   Sy_bit(OPT_REDTHROUGH),     ~Sy_bit(OPT_REDTHROUGH)  },
[5ee324]215  {"lazy",         Sy_bit(OPT_OLDSTD),         ~Sy_bit(OPT_OLDSTD)  },
[0e1846]216  {"intStrategy",  Sy_bit(OPT_INTSTRATEGY),    ~Sy_bit(OPT_INTSTRATEGY)  },
[82f0a0]217  {"infRedTail",   Sy_bit(OPT_INFREDTAIL),     ~Sy_bit(OPT_INFREDTAIL)  },
[0e1846]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
225struct 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  {"notWarnSB",Sy_bit(V_NSB),       ~Sy_bit(V_NSB)        },
[369cb4]240  {"contentSB",Sy_bit(V_CONTENTSB), ~Sy_bit(V_CONTENTSB)  },
241  {"cancelunit",Sy_bit(V_CANCELUNIT),~Sy_bit(V_CANCELUNIT)},
[3f8042]242  {"modpsolve",Sy_bit(V_MODPSOLVSB),~Sy_bit(V_MODPSOLVSB)},
[07b597]243  {"geometricSB",Sy_bit(V_UPTORADICAL),~Sy_bit(V_UPTORADICAL)},
[1cf21dd]244  {"findMonomials",Sy_bit(V_FINDMONOM),~Sy_bit(V_FINDMONOM)},
[3aed2f]245  {"coefStrat",Sy_bit(V_COEFSTRAT),~Sy_bit(V_COEFSTRAT)},
[0e1846]246/*special for "none" and also end marker for showOption:*/
247  {"ne",         0,          0 }
248};
249
250BOOLEAN setOption(leftv res, leftv v)
251{
252  char *n;
253  do
254  {
[3e35a1]255    if (v->Typ()==STRING_CMD)
256    {
[2166ad3]257      n=(char *)v->CopyD(STRING_CMD);
[3e35a1]258    }
259    else
260    {
261      if (v->name==NULL)
262        return TRUE;
263      if (v->rtyp==0)
264      {
265        n=v->name;
266        v->name=NULL;
267      }
268      else
269      {
[c232af]270        n=omStrDup(v->name);
[3e35a1]271      }
272    }
[0e1846]273
274    int i;
275
[58b151c]276    if(strcmp(n,"get")==0)
[0e1846]277    {
[c232af]278      intvec *w=new intvec(2);
[58b151c]279      (*w)[0]=test;
280      (*w)[1]=verbose;
281      res->rtyp=INTVEC_CMD;
282      res->data=(void *)w;
283      goto okay;
284    }
285    if(strcmp(n,"set")==0)
286    {
287      if((v->next!=NULL)
288      &&(v->next->Typ()==INTVEC_CMD))
[0e1846]289      {
[58b151c]290        v=v->next;
[9ea9c6]291        intvec *w=(intvec*)v->Data();
[58b151c]292        test=(*w)[0];
293        verbose=(*w)[1];
[9ea9c6]294
[be0d84]295        if (TEST_OPT_INTSTRATEGY && (currRing!=NULL)
[4cbb61]296        && rField_has_simple_inverse()
297#ifdef HAVE_RING2TOM
298        && !rField_is_Ring_2toM(currRing)
299#endif
300        ) {
[58b151c]301          test &=~Sy_bit(OPT_INTSTRATEGY);
302        }
[0e1846]303        goto okay;
[9ea9c6]304      }
[58b151c]305    }
[667247]306    if(strcmp(n,"none")==0)
307    {
308      test=0;
309      verbose=0;
310      goto okay;
[9ea9c6]311    }
[58b151c]312    for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++)
313    {
314      if (strcmp(n,optionStruct[i].name)==0)
[0e1846]315      {
[58b151c]316        if (optionStruct[i].setval & validOpts)
[6227ad]317        {
[58b151c]318          test |= optionStruct[i].setval;
[bef194]319          // optOldStd disables redthrough
320          if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD))
321            test &= ~Sy_bit(OPT_REDTHROUGH);
[6227ad]322        }
[58b151c]323        else
324          Warn("cannot set option");
[be0d84]325        if (TEST_OPT_INTSTRATEGY && (currRing!=NULL)
[4cbb61]326        && rField_has_simple_inverse()
327#ifdef HAVE_RING2TOM
328        && !rField_is_Ring_2toM(currRing)
329#endif
330        ) {
[58b151c]331          test &=~Sy_bit(OPT_INTSTRATEGY);
332        }
333        goto okay;
[0e1846]334      }
[58b151c]335      else if ((strncmp(n,"no",2)==0)
336      && (strcmp(n+2,optionStruct[i].name)==0))
[0e1846]337      {
[667247]338        if (optionStruct[i].setval & validOpts)
[0e1846]339        {
[58b151c]340          test &= optionStruct[i].resetval;
[0e1846]341        }
[58b151c]342        else
343          Warn("cannot clear option");
344        goto okay;
[0e1846]345      }
346    }
[58b151c]347    for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++)
[0e1846]348    {
[58b151c]349      if (strcmp(n,verboseStruct[i].name)==0)
[0e1846]350      {
[58b151c]351        verbose |= verboseStruct[i].setval;
352        #ifdef YYDEBUG
353        #if YYDEBUG
354        if (BVERBOSE(V_YACC)) yydebug=1;
355        else                  yydebug=0;
356        #endif
357        #endif
[0e1846]358        goto okay;
359      }
[58b151c]360      else if ((strncmp(n,"no",2)==0)
361      && (strcmp(n+2,verboseStruct[i].name)==0))
[0e1846]362      {
[58b151c]363        verbose &= verboseStruct[i].resetval;
364        #ifdef YYDEBUG
365        #if YYDEBUG
366        if (BVERBOSE(V_YACC)) yydebug=1;
367        else                  yydebug=0;
368        #endif
369        #endif
370        goto okay;
[0e1846]371      }
[58b151c]372    }
373    Werror("unknown option `%s`",n);
[0e1846]374  okay:
[5ecf042]375    if (currRing != NULL)
376      currRing->options = test & TEST_RINGDEP_OPTS;
[c232af]377    omFree((ADDRESS)n);
[0e1846]378    v=v->next;
[9ea9c6]379  } while (v!=NULL);
[1e3015]380  #ifdef HAVE_TCL
381    if (tclmode)
382    {
383      BITSET tmp;
384      int i;
[a79a128]385      StringSetS("");
[1e3015]386      if ((test!=0)||(verbose!=0))
387      {
388        tmp=test;
389        if(tmp)
390        {
391          for (i=0; optionStruct[i].setval!=0; i++)
392          {
393            if (optionStruct[i].setval & test)
394            {
395              StringAppend(" %s",optionStruct[i].name);
396              tmp &=optionStruct[i].resetval;
397            }
398          }
399        }
400        tmp=verbose;
401        if (tmp)
402        {
403          for (i=0; verboseStruct[i].setval!=0; i++)
404          {
405            if (verboseStruct[i].setval & tmp)
406            {
407              StringAppend(" %s",verboseStruct[i].name);
408              tmp &=verboseStruct[i].resetval;
409            }
410          }
411        }
[b45d97]412        PrintTCLS('O',StringAppendS(""));
[a79a128]413        StringSetS("");
[1e3015]414      }
415      else
416      {
417        PrintTCLS('O'," ");
418      }
419    }
420  #endif
[c232af]421    // set global variable to show memory usage
422    if (BVERBOSE(V_SHOW_MEM)) om_sing_opt_show_mem = 1;
423    else om_sing_opt_show_mem = 0;
[0e1846]424  return FALSE;
425}
426
[979a09f]427char * showOption()
[0e1846]428{
429  int i;
430  BITSET tmp;
431
[a79a128]432  StringSetS("//options:");
[58b151c]433  if ((test!=0)||(verbose!=0))
[0e1846]434  {
435    tmp=test;
[58b151c]436    if(tmp)
[0e1846]437    {
438      for (i=0; optionStruct[i].setval!=0; i++)
439      {
440        if (optionStruct[i].setval & test)
441        {
[979a09f]442          StringAppend(" %s",optionStruct[i].name);
[0e1846]443          tmp &=optionStruct[i].resetval;
444        }
445      }
446      for (i=0; i<32; i++)
447      {
[979a09f]448        if (tmp & Sy_bit(i)) StringAppend(" %d",i);
[0e1846]449      }
450    }
451    tmp=verbose;
452    if (tmp)
453    {
454      for (i=0; verboseStruct[i].setval!=0; i++)
455      {
456        if (verboseStruct[i].setval & tmp)
457        {
[979a09f]458          StringAppend(" %s",verboseStruct[i].name);
[0e1846]459          tmp &=verboseStruct[i].resetval;
460        }
461      }
462      for (i=1; i<32; i++)
463      {
[979a09f]464        if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
[0e1846]465      }
466    }
[c232af]467    return omStrDup(StringAppendS(""));
[0e1846]468  }
[58b151c]469  else
[c232af]470    return omStrDup(StringAppendS(" none"));
[0e1846]471}
472
[9ea9c6]473char * versionString()
474{
[b7b08c]475  char* str = StringSetS("");
[923c27]476  StringAppend("Singular for %s version %s  (%lu)  %s\nwith\n",
[b7b08c]477               S_UNAME, S_VERSION1,
[923c27]478               feVersionId,singular_date);
[b7b08c]479  StringAppend("\t");
[9ea9c6]480#ifdef HAVE_FACTORY
[97454d]481              StringAppend("factory(%s),", factoryVersion);
[9ea9c6]482#endif
483#ifdef HAVE_LIBFAC_P
[38cfbb]484              StringAppend("libfac(%s,%s),\n\t",libfac_version,libfac_date);
[9ea9c6]485#endif
486#if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR)
[38cfbb]487              StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);
[9ea9c6]488#else
[38cfbb]489              StringAppendS("GMP(1.3),");
[9ea9c6]490#endif
[99d9f6]491#ifdef HAVE_NTL
[45b7d38]492#include "NTL/version.h"
493              StringAppend("NTL(%s),",NTL_VERSION);
[99d9f6]494#endif
[9ea9c6]495#ifdef HAVE_MPSR
[f69a29]496              StringAppend("MP(%s),",MP_VERSION);
[9ea9c6]497#endif
[f413ec5]498#if defined(HAVE_DYN_RL)
[2ddc2e2]499              if (fe_fgets_stdin==fe_fgets_dummy)
500                StringAppendS("no input,");
501              else if (fe_fgets_stdin==fe_fgets)
502                StringAppendS("fgets,");
503              if (fe_fgets_stdin==fe_fgets_stdin_drl)
504                StringAppendS("dynamic readline,");
[8847e42]505              #ifdef HAVE_FEREAD
[2ddc2e2]506              else if (fe_fgets_stdin==fe_fgets_stdin_emu)
507                StringAppendS("emulated readline,");
[8847e42]508              #endif
[2ddc2e2]509              else
510                StringAppendS("unknown fgets method,");
[f69a29]511#else
[f413ec5]512  #if defined(HAVE_READLINE) && !defined(FEREAD)
[7e5a38]513              StringAppendS("static readline,");
[f413ec5]514  #else
515    #ifdef HAVE_FEREAD
[2ddc2e2]516              StringAppendS("emulated readline,");
[8a679a]517    #else
518              StringAppendS("fgets,");
[f413ec5]519    #endif
520  #endif
[38cfbb]521#endif
[fb1f3a]522#ifdef HAVE_PLURAL
523              StringAppendS("Plural,");
[38cfbb]524#endif
525#ifdef HAVE_DBM
[58124a3]526              StringAppendS("DBM,\n\t");
527#else
528              StringAppendS("\n\t");
[9ea9c6]529#endif
[a3bc95e]530#ifdef HAVE_NS
[7e5a38]531              StringAppendS("namespaces,");
[0a3ddd]532#endif
[cd6b45]533#ifdef HAVE_DYNAMIC_LOADING
[7e5a38]534              StringAppendS("dynamic modules,");
[cd6b45]535#endif
[7e5a38]536              if (p_procs_dynamic) StringAppendS("dynamic p_Procs,");
[9ea9c6]537#ifdef TEST
[38cfbb]538              StringAppendS("TESTs,");
[9ea9c6]539#endif
540#if YYDEBUG
[38cfbb]541              StringAppendS("YYDEBUG=1,");
[9ea9c6]542#endif
[98555e]543#ifdef HAVE_ASSUME
[8f769bb]544             StringAppendS("ASSUME,");
[98555e]545#endif
[9ea9c6]546#ifdef MDEBUG
[38cfbb]547              StringAppend("MDEBUG=%d,",MDEBUG);
548#endif
[c232af]549#ifdef OM_CHECK
550              StringAppend("OM_CHECK=%d,",OM_CHECK);
551#endif
552#ifdef OM_TRACK
553              StringAppend("OM_TRACK=%d,",OM_TRACK);
554#endif
555#ifdef OM_NDEBUG
556              StringAppend("OM_NDEBUG,");
[58124a3]557#endif
[275397]558#ifdef PDEBUG
[b45d97]559              StringAppendS("PDEBUG,");
[275397]560#endif
561#ifdef KDEBUG
[b45d97]562              StringAppendS("KDEBUG,");
[275397]563#endif
[9ea9c6]564#ifndef __OPTIMIZE__
[b45d97]565              StringAppendS("-g,");
[12310e]566#endif
[ec93f1]567#ifdef HAVE_EIGENVAL
568              StringAppendS("eigenvalues,");
569#endif
570#ifdef HAVE_GMS
571              StringAppendS("Gauss-Manin system,");
[9ea9c6]572#endif
[38cfbb]573              StringAppend("random=%d\n",siRandomStart);
[922a71f]574              StringAppend("\tCC=%s,\n\tCXX=%s"
575#ifdef __GNUC__
576              "(" __VERSION__ ")"
577#endif
578              "\n",CC,CXX);
[9f1850]579              feStringAppendResources(0);
580              feStringAppendBrowsers(0);
[b7b08c]581              StringAppend("\n");
[09f0ee]582              return str;
[9ea9c6]583}
[cb66fa]584
[a3bc95e]585#ifdef HAVE_NS
[a78f216]586void listall(int showproc)
[a3bc95e]587{
588      idhdl hh=basePack->idroot;
589      PrintS("====== Top ==============\n");
590      while (hh!=NULL)
591      {
[a78f216]592        if (showproc || (IDTYP(hh)!=PROC_CMD))
593        {
594          if (IDDATA(hh)==(void *)currRing) PrintS("(R)");
595          else if (IDDATA(hh)==(void *)currPack) PrintS("(P)");
596          else PrintS("   ");
597          Print("::%s, typ %s level %d data %x",
598                 IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh),IDDATA(hh));
599          if ((IDTYP(hh)==RING_CMD)
600          || (IDTYP(hh)==QRING_CMD))
601            Print(" ref: %d\n",IDRING(hh)->ref);
602          else
603            PrintLn();
[d4cb43b]604        }
[a3bc95e]605        hh=IDNEXT(hh);
606      }
607      hh=basePack->idroot;
608      while (hh!=NULL)
609      {
610        if (IDDATA(hh)==(void *)basePack)
[a78f216]611          Print("(T)::%s, typ %s level %d data %x\n",
612          IDID(hh),Tok2Cmdname(IDTYP(hh)),IDLEV(hh),IDDATA(hh));
[a3bc95e]613        else
614        if ((IDTYP(hh)==RING_CMD)
615        || (IDTYP(hh)==QRING_CMD)
616        || (IDTYP(hh)==PACKAGE_CMD))
617        {
618          Print("====== %s ==============\n",IDID(hh));
619          idhdl h2=IDRING(hh)->idroot;
620          while (h2!=NULL)
621          {
[a78f216]622            if (showproc || (IDTYP(h2)!=PROC_CMD))
623            {
[06e0e1]624              if ((IDDATA(h2)==(void *)currRing)
625              && ((IDTYP(h2)==RING_CMD)||(IDTYP(h2)==QRING_CMD)))
626                PrintS("(R)");
[a78f216]627              else if (IDDATA(h2)==(void *)currPack) PrintS("(P)");
628              else PrintS("   ");
629              Print("%s::%s, typ %s level %d data %x\n",
630              IDID(hh),IDID(h2),Tok2Cmdname(IDTYP(h2)),IDLEV(h2),IDDATA(h2));
[d4cb43b]631            }
[a3bc95e]632            h2=IDNEXT(h2);
633          }
634        }
635        hh=IDNEXT(hh);
636      }
637      Print("currRing:%x, currPack:%x,basePack:%x\n",currRing,currPack,basePack);
[d66a7d]638      iiCheckPack(currPack);
[a3bc95e]639}
[5c5638]640#ifndef NDEBUG
[a3bc95e]641void checkall()
642{
643      idhdl hh=basePack->idroot;
644      while (hh!=NULL)
645      {
[a78f216]646        omCheckAddr(hh);
647        omCheckAddr(IDID(hh));
[a3bc95e]648        if (RingDependend(IDTYP(hh))) Print("%s typ %d in Top\n",IDID(hh),IDTYP(hh));
649        hh=IDNEXT(hh);
650      }
651      hh=basePack->idroot;
652      while (hh!=NULL)
653      {
654        if (IDTYP(hh)==PACKAGE_CMD)
655        {
656          idhdl h2=IDPACKAGE(hh)->idroot;
657          while (h2!=NULL)
658          {
[a78f216]659            omCheckAddr(h2);
660            omCheckAddr(IDID(h2));
[a3bc95e]661            if (RingDependend(IDTYP(h2))) Print("%s typ %d in %s\n",IDID(h2),IDTYP(h2),IDID(hh));
662            h2=IDNEXT(h2);
663          }
664        }
665        hh=IDNEXT(hh);
666      }
667}
668#endif
[5c5638]669#endif
Note: See TracBrowser for help on using the repository browser.