FORM  4.1
structs.h
Go to the documentation of this file.
1 
17 /* #[ License : */
18 /*
19  * Copyright (C) 1984-2013 J.A.M. Vermaseren
20  * When using this file you are requested to refer to the publication
21  * J.A.M.Vermaseren "New features of FORM" math-ph/0010025
22  * This is considered a matter of courtesy as the development was paid
23  * for by FOM the Dutch physics granting agency and we would like to
24  * be able to track its scientific use to convince FOM of its value
25  * for the community.
26  *
27  * This file is part of FORM.
28  *
29  * FORM is free software: you can redistribute it and/or modify it under the
30  * terms of the GNU General Public License as published by the Free Software
31  * Foundation, either version 3 of the License, or (at your option) any later
32  * version.
33  *
34  * FORM is distributed in the hope that it will be useful, but WITHOUT ANY
35  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
36  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
37  * details.
38  *
39  * You should have received a copy of the GNU General Public License along
40  * with FORM. If not, see <http://www.gnu.org/licenses/>.
41  */
42 /* #] License : */
43 
44 #ifndef __STRUCTS__
45 
46 #define __STRUCTS__
47 #ifdef _MSC_VER
48 #include <wchar.h> /* off_t */
49 #endif
50 /*
51  #[ sav&store :
52 */
53 
58 typedef struct PoSiTiOn {
59  off_t p1;
60 } POSITION;
61 
62 /* Next are the index structs for stored and saved expressions */
63 
74 typedef struct {
75  UBYTE headermark[8];
77  UBYTE lenWORD;
78  UBYTE lenLONG;
79  UBYTE lenPOS;
80  UBYTE lenPOINTER;
81  UBYTE endianness[16];
82  UBYTE sSym;
83  UBYTE sInd;
84  UBYTE sVec;
85  UBYTE sFun;
86  UBYTE maxpower[16];
87  UBYTE wildoffset[16];
88  UBYTE revision;
89  UBYTE reserved[512-8-4-16-4-16-16-1];
90 } STOREHEADER;
91 
92 STATIC_ASSERT(sizeof(STOREHEADER) == 512);
93 
99 typedef struct InDeXeNtRy {
104  WORD nsymbols;
105  WORD nindices;
106  WORD nvectors;
107  WORD nfunctions;
108  WORD size;
109  SBYTE name[MAXENAME+1];
110  PADPOSITION(0,1,0,5,MAXENAME+1);
111 } INDEXENTRY;
112 
118 #define INFILEINDEX ((512-2*sizeof(POSITION))/sizeof(INDEXENTRY))
119 
123 #define EMPTYININDEX (512-2*sizeof(POSITION)-INFILEINDEX*sizeof(INDEXENTRY))
124 
137 typedef struct FiLeInDeX {
140  INDEXENTRY expression[INFILEINDEX];
141  SBYTE empty[EMPTYININDEX];
142 } FILEINDEX;
143 
144 STATIC_ASSERT(sizeof(FILEINDEX) == 512);
145 
150 typedef struct FiLeDaTa {
151  FILEINDEX Index;
152  POSITION Fill;
153  POSITION Position;
154  WORD Handle;
155  WORD dirtyflag;
156  PADPOSITION(0,0,0,2,0);
157 } FILEDATA;
158 
165 typedef struct VaRrEnUm {
166  WORD *start;
167  WORD *lo;
168  WORD *hi;
169 } VARRENUM;
170 
177 typedef struct ReNuMbEr {
178  POSITION startposition;
179  /* First stage renumbering */
184  /* Second stage renumbering */
185  WORD *symnum;
186  WORD *indnum;
187  WORD *vecnum;
188  WORD *funnum;
189  PADPOSITION(4,0,0,0,sizeof(VARRENUM)*4);
190 } *RENUMBER;
191 
192 /*
193  #] sav&store :
194  #[ Variables :
195 */
196 
204 typedef struct {
205  void *lijst;
206  char *message;
207  int num;
208  int maxnum;
209  int size;
210  int numglobal;
211  int numtemp;
212  int numclear;
213  PADPOINTER(0,6,0,0);
214 } LIST;
215 
221 typedef struct {
222  char *name;
223  TFUN func;
224  int type;
225  int flags;
226 } KEYWORD;
227 
234 typedef struct NaMeNode {
235  LONG name;
236  WORD parent;
237  WORD left;
238  WORD right;
239  WORD balance;
240  WORD type;
241  WORD number;
242  PADLONG(0,6,0);
243 } NAMENODE;
244 
252 typedef struct NaMeTree {
255  UBYTE *namebuffer;
258  LONG nodesize;
259  LONG nodefill;
260  LONG namesize;
261  LONG namefill;
262  LONG oldnamefill;
263  LONG oldnodefill;
269  WORD headnode;
270  PADPOINTER(10,0,1,0);
271 } NAMETREE;
272 
281 typedef struct tree {
282  int parent;
283  int left;
284  int right;
285  int value;
286  int blnce;
287  int usage;
288 } COMPTREE;
289 
294 typedef struct MiNmAx {
295  WORD mini;
296  WORD maxi;
297  WORD size;
298 } MINMAX;
299 
304 typedef struct BrAcKeTiNdEx { /* For indexing brackets in local expressions */
305  POSITION start; /* Place where bracket starts - start of expr */
306  POSITION next; /* Place of next indexed bracket in expr */
307  LONG bracket; /* Offset of position in bracketbuffer */
308  LONG termsinbracket;
309  PADPOSITION(0,2,0,0,0);
310 } BRACKETINDEX;
311 
316 typedef struct BrAcKeTiNfO {
319  LONG bracketbuffersize;
320  LONG indexbuffersize;
321  LONG bracketfill;
322  LONG indexfill;
323  WORD SortType;
324  PADPOINTER(4,0,1,0);
325 } BRACKETINFO;
326 
337 typedef struct TaBlEs {
339 #ifdef WITHPTHREADS
340  WORD **prototype;
341  WORD **pattern;
342 #else
343  WORD *prototype;
344  WORD *pattern;
345 #endif
347  WORD *flags;
349  UBYTE *argtail;
351  struct TaBlEs *spare;
352  WORD *buffers;
353  LONG totind;
354  LONG reserved;
355  LONG defined;
356  LONG mdefined;
358  int numind;
359  int bounds;
360  int strict;
361  int sparse;
362  int numtree;
363  int rootnum;
365  WORD bufnum;
366  WORD bufferssize;
367  WORD buffersfill;
368  WORD tablenum;
369  WORD mode;
370  WORD numdummies;
371  PADPOINTER(4,8,6,0);
372 } *TABLES;
373 
378 typedef struct ExPrEsSiOn {
379  POSITION onfile;
380  POSITION prototype;
381  RENUMBER renum; /* For Renumbering of global stored expressions */
382  BRACKETINFO *bracketinfo;
383  BRACKETINFO *newbracketinfo;
384  WORD *renumlists;
386  WORD *inmem; /* If in memory like e.g. a polynomial */
387  LONG counter;
388  LONG name;
389  WORD hidelevel;
390  WORD vflags; /* Various flags */
391  WORD printflag;
392  WORD status;
393  WORD replace;
394  WORD node;
395  WORD whichbuffer;
396  WORD namesize;
397  WORD compression;
398  WORD numdummies;
399  WORD numfactors;
400 #ifdef PARALLELCODE
401  WORD partodo; /* Whether to be done in parallel mode */
402  PADPOSITION(5,2,0,12,0);
403 #else
404  PADPOSITION(5,2,0,11,0);
405 #endif
406 } *EXPRESSIONS;
407 
412 typedef struct SyMbOl { /* Don't change unless altering .sav too */
413  LONG name; /* Location in names buffer */
414  WORD minpower; /* Minimum power admissible */
415  WORD maxpower; /* Maximum power admissible */
416  WORD complex; /* Properties wrt complex conjugation */
417  WORD number; /* Number when stored in file */
418  WORD flags; /* Used to indicate usage when storing */
419  WORD node;
420  WORD namesize;
421  WORD dimension; /* For dimensionality checks */
422  PADLONG(0,8,0);
423 } *SYMBOLS;
424 
429 typedef struct InDeX { /* Don't change unless altering .sav too */
430  LONG name; /* Location in names buffer */
431  WORD type; /* Regular or dummy */
432  WORD dimension; /* Value of d_(n,n) or -number of symbol */
433  WORD number; /* Number when stored in file */
434  WORD flags; /* Used to indicate usage when storing */
435  WORD nmin4; /* Used for n-4 if dimension < 0 */
436  WORD node;
437  WORD namesize;
438  PADLONG(0,7,0);
439 } *INDICES;
440 
445 typedef struct VeCtOr { /* Don't change unless altering .sav too */
446  LONG name; /* Location in names buffer */
447  WORD complex; /* Properties under complex conjugation */
448  WORD number; /* Number when stored in file */
449  WORD flags; /* Used to indicate usage when storing */
450  WORD node;
451  WORD namesize;
452  WORD dimension; /* For dimensionality checks */
453  PADLONG(0,6,0);
454 } *VECTORS;
455 
461 typedef struct FuNcTiOn { /* Don't change unless altering .sav too */
463  LONG symminfo;
464  LONG name;
465  WORD commute;
466  WORD complex;
467  WORD number;
468  WORD flags;
469  WORD spec;
470  WORD symmetric;
471  WORD node;
472  WORD namesize;
473  WORD dimension; /* For dimensionality checks */
474  WORD maxnumargs;
475  WORD minnumargs;
476  PADPOINTER(2,0,11,0);
477 } *FUNCTIONS;
478 
483 typedef struct SeTs {
484  LONG name; /* Location in names buffer */
485  WORD type; /* Symbol, vector, index or function */
486  WORD first; /* First element in setstore */
487  WORD last; /* Last element in setstore */
488  WORD node;
489  WORD namesize;
490  WORD dimension; /* For dimensionality checks */
491  PADLONG(0,6,0);
492 } *SETS;
493 
498 typedef struct DuBiOuS { /* Undeclared objects. Just for compiler. */
499  LONG name; /* Location in names buffer */
500  WORD node;
501  WORD dummy;
502  PADLONG(0,2,0);
503 } *DUBIOUSV;
504 
505 typedef struct FaCdOlLaR {
506  WORD *where; /* A pointer(!) to the content */
507  LONG size;
508  WORD type; /* Type can be DOLNUMBER or DOLTERMS */
509  WORD value; /* in case it is a (short) number */
510  PADPOINTER(1,0,2,0);
511 } FACDOLLAR;
512 
513 typedef struct DoLlArS {
514  WORD *where; /* A pointer(!) to the object */
515  FACDOLLAR *factors; /* an array of factors. nfactors elements */
516 #ifdef WITHPTHREADS
517  pthread_mutex_t pthreadslockread;
518  pthread_mutex_t pthreadslockwrite;
519 #endif
520  LONG size; /* The number of words */
521  LONG name;
522  WORD type;
523  WORD node;
524  WORD index;
525  WORD zero;
526  WORD numdummies;
527  WORD nfactors;
528 #ifdef WITHPTHREADS
529  PADPOINTER(2,0,6,sizeof(pthread_mutex_t)*2);
530 #else
531  PADPOINTER(2,0,6,0);
532 #endif
533 } *DOLLARS;
534 
539 typedef struct MoDoPtDoLlArS {
540 #ifdef WITHPTHREADS
541  DOLLARS dstruct; /* If local dollar: list of DOLLARS for each thread */
542 #endif
543  WORD number;
544  WORD type;
545 #ifdef WITHPTHREADS
546  PADPOINTER(0,0,2,0);
547 #endif
548 } MODOPTDOLLAR;
549 
554 typedef struct fixedset {
555  char *name;
556  char *description;
557  int type;
558  int dimension;
559 } FIXEDSET;
560 
565 typedef struct TaBlEbAsEsUbInDeX {
566  POSITION where;
567  LONG size;
568  PADPOSITION(0,1,0,0,0);
570 
575 typedef struct TaBlEbAsE {
576  POSITION fillpoint;
577  POSITION current;
578  UBYTE *name;
579  int *tablenumbers; /* Number of each table */
580  TABLEBASESUBINDEX *subindex; /* For each table */
581  int numtables;
582  PADPOSITION(3,0,1,0,0);
583 } TABLEBASE;
584 
591 typedef struct {
592  WORD *location;
593  int numargs;
594  int numfunnies;
595  int numwildcards;
596  int symmet;
597  int tensor;
598  int commute;
599  PADPOINTER(0,6,0,0);
600 } FUN_INFO;
601 
602 /*
603  #] Variables :
604  #[ Files :
605 */
606 
618 typedef struct FiLe {
619  POSITION POposition; /* File position */
620  POSITION filesize; /* Because SEEK_END is unsafe on IBM */
621  WORD *PObuffer; /* Address of the intermediate buffer */
622  WORD *POstop; /* End of the buffer */
623  WORD *POfill; /* Fill position of the buffer */
624  WORD *POfull; /* Full buffer when only cached */
625 #ifdef WITHPTHREADS
626  WORD *wPObuffer; /* Address of the intermediate worker buffer */
627  WORD *wPOstop; /* End of the worker buffer */
628  WORD *wPOfill; /* Fill position of the worker buffer */
629  WORD *wPOfull; /* Full buffer when only worker cached */
630 #endif
631  char *name; /* name of the file */
632 #ifdef WITHZLIB
633  z_streamp zsp; /* The pointer to the stream struct for gzip */
634  Bytef *ziobuffer; /* The output buffer for compression */
635 #endif
636  ULONG numblocks; /* Number of blocks in file */
637  ULONG inbuffer; /* Block in the buffer */
638  LONG POsize; /* size of the buffer */
639 #ifdef WITHZLIB
640  LONG ziosize; /* size of the zoutbuffer */
641 #endif
642 #ifdef WITHPTHREADS
643  LONG wPOsize; /* size of the worker buffer */
644  pthread_mutex_t pthreadslock;
645 #endif
646  int handle;
647  int active; /* File is open or closed. Not used. */
648 #ifdef WITHPTHREADS
649 #ifdef WITHZLIB
650  PADPOSITION(11,5,2,0,sizeof(pthread_mutex_t));
651 #else
652  PADPOSITION(9,4,2,0,sizeof(pthread_mutex_t));
653 #endif
654 #else
655 #ifdef WITHZLIB
656  PADPOSITION(7,4,2,0,0);
657 #else
658  PADPOSITION(5,3,2,0,0);
659 #endif
660 #endif
661 } FILEHANDLE;
662 
672 typedef struct StreaM {
673  off_t fileposition;
674  off_t linenumber;
675  off_t prevline;
676  UBYTE *buffer;
677  UBYTE *pointer;
678  UBYTE *top;
679  UBYTE *FoldName;
680  UBYTE *name;
681  UBYTE *pname;
683  LONG buffersize;
684  LONG bufferposition;
685  LONG inbuffer;
686  int previous;
687  int handle;
688  int type;
689  int prevars;
690  int previousNoShowInput;
691  int eqnum;
692  int afterwards;
693  int olddelay;
694  int oldnoshowinput;
695  UBYTE isnextchar;
696  UBYTE nextchar[2];
697  UBYTE reserved;
698  PADPOSITION(6,3,9,0,4);
699 } STREAM;
700 
701 /*
702  #] Files :
703  #[ Traces :
704 */
705 
715 typedef struct TrAcEs { /* For computing 4 dimensional traces */
716  WORD *accu; /* NUMBER * 2 */
717  WORD *accup;
718  WORD *termp;
719  WORD *perm; /* number */
720  WORD *inlist; /* number */
721  WORD *nt3; /* number/2 */
722  WORD *nt4; /* number/2 */
723  WORD *j3; /* number*2 */
724  WORD *j4; /* number*2 */
725  WORD *e3; /* number*2 */
726  WORD *e4; /* number */
727  WORD *eers; /* number/2 */
728  WORD *mepf; /* number/2 */
729  WORD *mdel; /* number/2 */
730  WORD *pepf; /* number*2 */
731  WORD *pdel; /* number*3/2 */
732  WORD sgn;
733  WORD stap;
734  WORD step1,kstep,mdum;
735  WORD gamm,ad,a3,a4,lc3,lc4;
736  WORD sign1,sign2,gamma5,num,level,factor,allsign;
737  WORD finalstep;
738  PADPOINTER(0,0,19,0);
739 } TRACES;
740 
748 typedef struct TrAcEn { /* For computing n dimensional traces */
749  WORD *accu; /* NUMBER */
750  WORD *accup;
751  WORD *termp;
752  WORD *perm; /* number */
753  WORD *inlist; /* number */
754  WORD sgn,num,level,factor,allsign;
755  PADPOINTER(0,0,5,0);
756 } *TRACEN;
757 
758 /*
759  #] Traces :
760  #[ Preprocessor :
761 */
762 
767 typedef struct pReVaR {
768  UBYTE *name;
769  UBYTE *value;
770  UBYTE *argnames;
771  int nargs;
772  int wildarg;
773  PADPOINTER(0,2,0,0);
774 } PREVAR;
775 
780 typedef struct {
781  WORD *buffer;
782  int oldcompiletype;
783  int oldparallelflag;
784  int oldnumpotmoddollars;
785  WORD size;
786  WORD numdollars;
787  WORD oldcbuf;
788  WORD oldrbuf;
789  WORD inscbuf;
790  PADPOINTER(0,3,5,0);
791 } INSIDEINFO;
792 
798 typedef struct {
799  UBYTE *buffer;
800  LONG size;
801  PADPOINTER(1,0,0,0);
802 } PRELOAD;
803 
808 typedef struct {
809  PRELOAD p;
810  UBYTE *name;
811  int loadmode;
812  PADPOINTER(0,1,0,0);
813 } PROCEDURE;
814 
822 typedef struct DoLoOp {
824  UBYTE *name;
825  UBYTE *vars; /* for {} or name of expression */
826  UBYTE *contents;
827  UBYTE *dollarname;
828  LONG startlinenumber;
829  LONG firstnum;
830  LONG lastnum;
831  LONG incnum;
832  int type;
833  int NoShowInput;
834  int errorsinloop;
835  int firstloopcall;
836  WORD firstdollar; /* When >= 0 we have to get the value from a dollar */
837  WORD lastdollar; /* When >= 0 we have to get the value from a dollar */
838  WORD incdollar; /* When >= 0 we have to get the value from a dollar */
839  WORD NumPreTypes;
840  WORD PreIfLevel;
841  WORD PreSwitchLevel;
842  PADPOINTER(4,4,6,0);
843 } DOLOOP;
844 
852 struct bit_field { /* Assume 8 bits per byte */
853  UBYTE bit_0 : 1;
854  UBYTE bit_1 : 1;
855  UBYTE bit_2 : 1;
856  UBYTE bit_3 : 1;
857  UBYTE bit_4 : 1;
858  UBYTE bit_5 : 1;
859  UBYTE bit_6 : 1;
860  UBYTE bit_7 : 1;
861 /*
862  UINT bit_0 : 1;
863  UINT bit_1 : 1;
864  UINT bit_2 : 1;
865  UINT bit_3 : 1;
866  UINT bit_4 : 1;
867  UINT bit_5 : 1;
868  UINT bit_6 : 1;
869  UINT bit_7 : 1;
870 */
871 };
872 
877 typedef struct bit_field set_of_char[32];
878 
883 typedef struct bit_field *one_byte;
884 
889 typedef struct {
890  WORD newlogonly;
891  WORD newhandle;
892  WORD oldhandle;
893  WORD oldlogonly;
894  WORD oldprinttype;
895  WORD oldsilent;
896 } HANDLERS;
897 
898 /*
899  #] Preprocessor :
900  #[ Varia :
901 */
902 
908 typedef struct CbUf {
909  WORD *Buffer;
910  WORD *Top;
911  WORD *Pointer;
912  WORD **lhs;
913  WORD **rhs;
914  LONG *CanCommu;
915  LONG *NumTerms;
916  WORD *numdum;
917  WORD *dimension;
919  LONG BufferSize;
920  int numlhs;
921  int numrhs;
922  int maxlhs;
923  int maxrhs;
924  int mnumlhs;
925  int mnumrhs;
926  int numtree;
927  int rootnum;
928  int MaxTreeSize;
929  PADPOINTER(1,9,0,0);
930 } CBUF;
931 
939 typedef struct ChAnNeL {
940  char *name;
941  int handle;
942  PADPOINTER(0,1,0,0);
943 } CHANNEL;
944 
954 typedef struct {
955  UBYTE *parameter;
956  int type;
957  int flags;
958  LONG value;
960 
969 typedef struct NeStInG {
970  WORD *termsize;
971  WORD *funsize;
972  WORD *argsize;
973 } *NESTING;
974 
981 typedef struct StOrEcAcHe {
982  POSITION position;
983  POSITION toppos;
984  struct StOrEcAcHe *next;
985  WORD buffer[2];
986  PADPOSITION(1,0,0,2,0);
987 } *STORECACHE;
988 
994 typedef struct PeRmUtE {
995  WORD *objects;
996  WORD sign;
997  WORD n;
998  WORD cycle[MAXMATCH];
999  PADPOINTER(0,0,MAXMATCH+2,0);
1000 } PERM;
1001 
1007 typedef struct DiStRiBuTe {
1008  WORD *obj1;
1009  WORD *obj2;
1010  WORD *out;
1011  WORD sign;
1012  WORD n1;
1013  WORD n2;
1014  WORD n;
1015  WORD cycle[MAXMATCH];
1016  PADPOINTER(0,0,(MAXMATCH+4),0);
1017 } DISTRIBUTE;
1018 
1028 typedef struct sOrT {
1029  FILEHANDLE file; /* The own sort file */
1030  POSITION SizeInFile[3]; /* Sizes in the various files */
1031  WORD *lBuffer; /* The large buffer */
1032  WORD *lTop; /* End of the large buffer */
1033  WORD *lFill; /* The filling point of the large buffer */
1034  WORD *used; /* auxiliary during actual sort */
1035  WORD *sBuffer; /* The small buffer */
1036  WORD *sTop; /* End of the small buffer */
1037  WORD *sTop2; /* End of the extension of the small buffer */
1038  WORD *sHalf; /* Halfway point in the extension */
1039  WORD *sFill; /* Filling point in the small buffer */
1040  WORD **sPointer; /* Pointers to terms in the small buffer */
1041  WORD **PoinFill; /* Filling point for pointers to the sm.buf */
1042  WORD **SplitScratch; /* Excess pointer space for the merge sort */
1043  WORD *cBuffer; /* Compress buffer (if it exists) */
1044  WORD **Patches; /* Positions of patches in large buffer */
1045  WORD **pStop; /* Ends of patches in the large buffer */
1046  WORD **poina; /* auxiliary during actual sort */
1047  WORD **poin2a; /* auxiliary during actual sort */
1048  WORD *ktoi; /* auxiliary during actual sort */
1049  WORD *tree; /* auxiliary during actual sort */
1050 #ifdef WITHZLIB
1051  WORD *fpcompressed; /* is output filepatch compressed? */
1052  WORD *fpincompressed; /* is input filepatch compressed? */
1053  z_streamp zsparray; /* the array of zstreams for decompression */
1054 #endif
1055  POSITION *fPatches; /* Positions of output file patches */
1056  POSITION *inPatches; /* Positions of input file patches */
1057  POSITION *fPatchesStop; /* Positions of output file patches */
1058  POSITION *iPatches; /* Input file patches, Points to fPatches or inPatches */
1059  FILEHANDLE *f; /* The actual output file */
1060  FILEHANDLE **ff; /* Handles for a staged sort */
1061  LONG sTerms; /* Terms in small buffer */
1062  LONG LargeSize; /* Size of large buffer (in words) */
1063  LONG SmallSize; /* Size of small buffer (in words) */
1064  LONG SmallEsize; /* Size of small + extension (in words) */
1065  LONG TermsInSmall; /* Maximum number of terms in small buffer */
1066  LONG Terms2InSmall; /* with extension for polyfuns etc. */
1067  LONG GenTerms; /* Number of generated terms */
1068  LONG TermsLeft; /* Number of terms still in existence */
1069  LONG GenSpace; /* Amount of space of generated terms */
1070  LONG SpaceLeft; /* Space needed for still existing terms */
1071  LONG putinsize; /* Size of buffer in putin */
1072  LONG ninterms; /* Which input term ? */
1073  int MaxPatches; /* Maximum number of patches in large buffer */
1074  int MaxFpatches; /* Maximum number of patches in one filesort */
1075  int type; /* Main, function or sub(routine) */
1076  int lPatch; /* Number of patches in the large buffer */
1077  int fPatchN1; /* Number of patches in input file */
1078  int PolyWise; /* Is there a polyfun and if so, where? */
1079  int PolyFlag; /* */
1080  int cBufferSize; /* Size of the compress buffer */
1081  int maxtermsize; /* Keeps track for buffer allocations */
1082  int newmaxtermsize; /* Auxiliary for maxtermsize */
1083  int outputmode; /* Tells where the output is going */
1084  int stagelevel; /* In case we have a 'staged' sort */
1085  WORD fPatchN; /* Number of patches on file (output) */
1086  WORD inNum; /* Number of patches on file (input) */
1087  WORD stage4; /* Are we using stage4? */
1088 #ifdef WITHZLIB
1089  PADPOSITION(28,12,12,3,0);
1090 #else
1091  PADPOSITION(25,12,12,3,0);
1092 #endif
1093 } SORTING;
1094 
1095 #ifdef WITHPTHREADS
1096 
1102 typedef struct SoRtBlOcK {
1103  pthread_mutex_t *MasterBlockLock;
1104  WORD **MasterStart;
1105  WORD **MasterFill;
1106  WORD **MasterStop;
1107  int MasterNumBlocks;
1108  int MasterBlock;
1109  int FillBlock;
1110  PADPOINTER(0,3,0,0);
1111 } SORTBLOCK;
1112 #endif
1113 
1114 #ifdef DEBUGGER
1115 typedef struct DeBuGgInG {
1116  int eflag;
1117  int printflag;
1118  int logfileflag;
1119  int stdoutflag;
1120 } DEBUGSTR;
1121 #endif
1122 
1123 #ifdef WITHPTHREADS
1124 
1130 typedef struct ThReAdBuCkEt {
1131  POSITION *deferbuffer; /* For Keep Brackets: remember position */
1132  WORD *threadbuffer; /* Here are the (primary) terms */
1133  WORD *compressbuffer; /* For keep brackets we need the compressbuffer */
1134  LONG threadbuffersize; /* Number of words in threadbuffer */
1135  LONG ddterms; /* Number of primary+secondary terms represented */
1136  LONG firstterm; /* The number of the first term in the bucket */
1137  LONG firstbracket; /* When doing complete brackets */
1138  LONG lastbracket; /* When doing complete brackets */
1139  pthread_mutex_t lock; /* For the load balancing phase */
1140  int free; /* Status of the bucket */
1141  int totnum; /* Total number of primary terms */
1142  int usenum; /* Which is the term being used at the moment */
1143  int busy; /* */
1144  int type; /* Doing brackets? */
1145  PADPOINTER(5,5,0,sizeof(pthread_mutex_t));
1146 } THREADBUCKET;
1147 
1148 #endif
1149 
1157 typedef struct {
1158  WORD *coefs; /* The array of coefficients */
1159  WORD numsym; /* The number of the symbol in the polynomial */
1160  WORD arraysize; /* The size of the allocation of coefs */
1161  WORD polysize; /* The maximum power in the polynomial */
1162  WORD modnum; /* The prime number of the modulus */
1163 } POLYMOD;
1164 
1165 typedef struct {
1166  WORD *outterm; /* Used in DoShuffle/Merge/FinishShuffle system */
1167  WORD *outfun;
1168  WORD *incoef;
1169  WORD *stop1;
1170  WORD *stop2;
1171  WORD *ststop1;
1172  WORD *ststop2;
1173  void *finishuf;
1174  void *do_uffle;
1175  LONG combilast;
1176  WORD nincoef;
1177  WORD level;
1178  WORD thefunction;
1179  WORD option;
1180  PADPOINTER(1,0,4,0);
1181 } SHvariables;
1182 
1183 typedef struct { /* Used for computing calculational cost in optim.c */
1184  LONG add;
1185  LONG mul;
1186  LONG div;
1187  LONG pow;
1188 } COST;
1189 
1190 typedef struct {
1191  UWORD *a; /* The number array */
1192  UWORD *m; /* The modulus array */
1193  WORD na; /* Size of the number */
1194  WORD nm; /* size of the number in the modulus array */
1195 } MODNUM;
1196 
1197 /*
1198  Struct for optimizing outputs. If changed, do not forget to change
1199  the padding information in the AO struct.
1200 */
1201 typedef struct {
1202  union { /* we do this to allow padding */
1203  float fval;
1204  int ival[2]; /* This should be enough */
1205  } mctsconstant;
1206  int horner;
1207  int hornerdirection;
1208  int method;
1209  int mctstimelimit;
1210  int mctsnumexpand;
1211  int mctsnumkeep;
1212  int mctsnumrepeat;
1213  int greedytimelimit;
1214  int greedyminnum;
1215  int greedymaxperc;
1216  int printstats;
1217  int debugflags;
1218  int schemeflags;
1219 } OPTIMIZE;
1220 
1221 typedef struct {
1222  WORD *code;
1223  UBYTE *nameofexpr; /* It is easier to remember an expression by name */
1224  LONG codesize; /* We need this for the checkpoints */
1225  WORD exprnr; /* Problem here is: we renumber them in execute.c */
1226  WORD minvar;
1227  WORD maxvar;
1228 
1229  PADPOSITION(2,1,0,3,0);
1230 } OPTIMIZERESULT;
1231 
1232 /*
1233  #] Varia :
1234  #[ A :
1235  #[ M : The M struct is for global settings at startup or .clear
1236 */
1237 
1245 struct M_const {
1246  POSITION zeropos; /* (M) is zero */
1248  UWORD *gcmod;
1249  UWORD *gpowmod;
1250  UBYTE *TempDir; /* (M) Path with where the temporary files go */
1251  UBYTE *TempSortDir; /* (M) Path with where the sort files go */
1252  UBYTE *IncDir; /* (M) Directory path for include files */
1253  UBYTE *InputFileName; /* (M) */
1254  UBYTE *LogFileName; /* (M) */
1255  UBYTE *OutBuffer; /* (M) Output buffer in pre.c */
1256  UBYTE *Path; /* (M) */
1257  UBYTE *SetupDir; /* (M) Directory with setup file */
1258  UBYTE *SetupFile; /* (M) Name of setup file */
1259  UBYTE *gFortran90Kind;
1260  UBYTE *gextrasym;
1261  UBYTE *ggextrasym;
1262  UBYTE *oldnumextrasymbols;
1263 #ifdef WITHPTHREADS
1264  pthread_rwlock_t handlelock; /* (M) */
1265  pthread_mutex_t storefilelock; /* (M) */
1266  pthread_mutex_t sbuflock; /* (M) Lock for writing in the AM.sbuffer */
1267  LONG ThreadScratSize; /* (M) Size of Fscr[0/2] buffers of the workers */
1268  LONG ThreadScratOutSize; /* (M) Size of Fscr[1] buffers of the workers */
1269 #endif
1270  LONG MaxTer; /* (M) Maximum term size. Fixed at setup. In Bytes!!!*/
1271  LONG CompressSize; /* (M) Size of Compress buffer */
1272  LONG ScratSize; /* (M) Size of Fscr[] buffers */
1273  LONG HideSize; /* (M) Size of Fscr[2] buffer */
1274  LONG SizeStoreCache; /* (M) Size of the chaches for reading global expr. */
1275  LONG MaxStreamSize; /* (M) Maximum buffer size in reading streams */
1276  LONG SIOsize; /* (M) Sort InputOutput buffer size */
1277  LONG SLargeSize; /* (M) */
1278  LONG SSmallEsize; /* (M) */
1279  LONG SSmallSize; /* (M) */
1280  LONG STermsInSmall; /* (M) */
1281  LONG MaxBracketBufferSize; /* (M) Max Size for B+ or AB+ per expression */
1282  LONG hProcessBucketSize; /* (M) */
1283  LONG gProcessBucketSize; /* (M) */
1284  LONG shmWinSize; /* (M) size for shared memory window used in communications */
1285  LONG OldChildTime; /* (M) Zero time. Needed in timer. */
1286  LONG OldSecTime; /* (M) Zero time for measuring wall clock time */
1287  LONG OldMilliTime; /* (M) Same, but milli seconds */
1288  LONG WorkSize; /* (M) Size of WorkSpace */
1289  LONG gThreadBucketSize; /* (C) */
1290  LONG ggThreadBucketSize; /* (C) */
1291  LONG SumTime; /* Used in .clear */
1292  int FileOnlyFlag; /* (M) Writing only to file */
1293  int Interact; /* (M) Interactive mode flag */
1294  int MaxParLevel; /* (M) Maximum nesting of parantheses */
1295  int OutBufSize; /* (M) size of OutBuffer */
1296  int SMaxFpatches; /* (M) */
1297  int SMaxPatches; /* (M) */
1298  int StdOut; /* (M) Regular output channel */
1299  int ginsidefirst; /* (M) Not used yet */
1300  int gDefDim; /* (M) */
1301  int gDefDim4; /* (M) */
1302  int NumFixedSets; /* (M) Number of the predefined sets */
1303  int NumFixedFunctions; /* (M) Number of built in functions */
1304  int rbufnum; /* (M) startup compiler buffer */
1305  int dbufnum; /* (M) dollar variables */
1306  int sbufnum; /* (M) subterm variables */
1307  int zbufnum; /* (M) special values */
1308  int SkipClears; /* (M) Number of .clear to skip at start */
1309  int gTokensWriteFlag; /* (M) */
1310  int gfunpowers; /* (M) */
1311  int gStatsFlag; /* (M) */
1312  int gNamesFlag; /* (M) */
1313  int gCodesFlag; /* (M) */
1314  int gSortType; /* (M) */
1315  int gproperorderflag; /* (M) */
1316  int hparallelflag; /* (M) */
1317  int gparallelflag; /* (M) */
1318  int totalnumberofthreads; /* (M) */
1319  int gThreadStats;
1320  int ggThreadStats;
1321  int gFinalStats;
1322  int ggFinalStats;
1323  int gThreadsFlag;
1324  int ggThreadsFlag;
1325  int gThreadBalancing;
1326  int ggThreadBalancing;
1327  int gThreadSortFileSynch;
1328  int ggThreadSortFileSynch;
1329  int gProcessStats;
1330  int ggProcessStats;
1331  int gOldParallelStats;
1332  int ggOldParallelStats;
1333  int maxFlevels; /* () maximum function levels */
1334  int resetTimeOnClear; /* (M) */
1335  int gcNumDollars; /* () number of dollars for .clear */
1336  int MultiRun;
1337  int gNoSpacesInNumbers; /* For very long numbers */
1338  int ggNoSpacesInNumbers; /* For very long numbers */
1339  int gIsFortran90;
1340  int PrintTotalSize;
1341  int fbuffersize; /* Size for the AT.fbufnum factorization caches */
1342  int gOldFactArgFlag;
1343  int ggOldFactArgFlag;
1344  WORD MaxTal; /* (M) Maximum number of words in a number */
1345  WORD IndDum; /* (M) Basis value for dummy indices */
1346  WORD DumInd; /* (M) */
1347  WORD WilInd; /* (M) Offset for wildcard indices */
1348  WORD gncmod; /* (M) Global setting of modulus. size of gcmod */
1349  WORD gnpowmod; /* (M) Global printing as powers. size gpowmod */
1350  WORD gmodmode; /* (M) Global mode for modulus */
1351  WORD gUnitTrace; /* (M) Global value of Tr[1] */
1352  WORD gOutputMode; /* (M) */
1353  WORD gOutputSpaces; /* (M) */
1354  WORD gOutNumberType; /* (M) */
1355  WORD gCnumpows; /* (M) */
1356  WORD gUniTrace[4]; /* (M) */
1357  WORD MaxWildcards; /* (M) Maximum number of wildcards */
1358  WORD mTraceDum; /* (M) Position/Offset for generated dummies */
1359  WORD OffsetIndex; /* (M) */
1360  WORD OffsetVector; /* (M) */
1361  WORD RepMax; /* (M) Max repeat levels */
1362  WORD LogType; /* (M) Type of writing to log file */
1363  WORD ggStatsFlag; /* (M) */
1364  WORD gLineLength; /* (M) */
1365  WORD qError; /* (M) Only error checking {-c option} */
1366  WORD FortranCont; /* (M) Fortran Continuation character */
1367  WORD HoldFlag; /* (M) Exit on termination? */
1368  WORD Ordering[15]; /* (M) Auxiliary for ordering wildcards */
1369  WORD silent; /* (M) Silent flag. Only results in output. */
1370  WORD tracebackflag; /* (M) For tracing errors */
1371  WORD expnum; /* (M) internal number of ^ function */
1372  WORD denomnum; /* (M) internal number of / function */
1373  WORD facnum; /* (M) internal number of fac_ function */
1374  WORD invfacnum; /* (M) internal number of invfac_ function */
1375  WORD sumnum; /* (M) internal number of sum_ function */
1376  WORD sumpnum; /* (M) internal number of sump_ function */
1377  WORD OldOrderFlag; /* (M) Flag for allowing old statement order */
1378  WORD termfunnum; /* (M) internal number of term_ function */
1379  WORD matchfunnum; /* (M) internal number of match_ function */
1380  WORD countfunnum; /* (M) internal number of count_ function */
1381  WORD gPolyFun; /* (M) global value of PolyFun */
1382  WORD gPolyFunType; /* (M) global value of PolyFun */
1383  WORD dollarzero; /* (M) for dollars with zero value */
1384  WORD atstartup; /* To protect against DATE_ ending in \n */
1385  WORD exitflag; /* (R) For the exit statement */
1386  WORD NumStoreCaches; /* () Number of storage caches per processor */
1387  WORD gIndentSpace; /* For indentation in output */
1388  WORD ggIndentSpace;
1391  WORD gextrasymbols;
1392  WORD ggextrasymbols;
1393  WORD zerorhs;
1394  WORD BracketFactors[8];
1395 #ifdef WITHPTHREADS
1396  PADPOSITION(15,24,52,75,sizeof(pthread_rwlock_t)+sizeof(pthread_mutex_t)*2);
1397 #else
1398  PADPOSITION(15,22,52,75,0);
1399 #endif
1400 };
1401 /*
1402  #] M :
1403  #[ P : The P struct defines objects set by the preprocessor
1404 */
1412 struct P_const {
1413  LIST DollarList; /* (R) Dollar variables. Contains pointers
1414  to contents of the variables.*/
1415  LIST PreVarList; /* (R) List of preprocessor variables
1416  Points to contents. Can be changed */
1417  LIST LoopList; /* (P) List of do loops */
1418  LIST ProcList; /* (P) List of procedures */
1419  INSIDEINFO inside; /* Information during #inside/#endinside */
1420  UBYTE **PreSwitchStrings; /* (P) The string in a switch */
1421  UBYTE *preStart; /* (P) Preprocessor instruction buffer */
1422  UBYTE *preStop; /* (P) end of preStart */
1423  UBYTE *preFill; /* (P) Filling point in preStart */
1424  UBYTE *procedureExtension; /* (P) Extension for procedure files (prc) */
1425  UBYTE *cprocedureExtension; /* (P) Extension after .clear */
1426  int *PreIfStack; /* (P) Tracks nesting of #if */
1427  int *PreSwitchModes; /* (P) Stack of switch status */
1428  int *PreTypes; /* (P) stack of #call, #do etc nesting */
1429 #ifdef WITHPTHREADS
1430  pthread_mutex_t PreVarLock; /* (P) */
1431 #endif
1432  LONG InOutBuf; /* (P) Characters in the output buf in pre.c */
1433  LONG pSize; /* (P) size of preStart */
1434  int PreAssignFlag; /* (C) Indicates #assign -> catch dollar */
1435  int PreContinuation; /* (C) Indicates whether the statement is new */
1436  int PreproFlag; /* (P) Internal use to mark work on prepro instr. */
1437  int iBufError; /* (P) Flag for errors with input buffer */
1438  int PreOut; /* (P) Flag for #+ #- */
1439  int PreSwitchLevel; /* (P) Nesting of #switch */
1440  int NumPreSwitchStrings; /* (P) Size of PreSwitchStrings */
1441  int MaxPreTypes; /* (P) Size of PreTypes */
1442  int NumPreTypes; /* (P) Number of nesting objects in PreTypes */
1443  int MaxPreIfLevel; /* (C) Maximum number of nested #if. Dynamic */
1444  int PreIfLevel; /* (C) Current position if PreIfStack */
1445  int PreInsideLevel; /* (C) #inside active? */
1446  int DelayPrevar; /* (P) Delaying prevar substitution */
1447  int AllowDelay; /* (P) Allow delayed prevar substitution */
1448  int lhdollarerror; /* (R) */
1449  int eat; /* () */
1450  int gNumPre; /* (P) Number of preprocessor variables for .clear */
1451  int PreDebug; /* (C) */
1452  WORD DebugFlag; /* (P) For debugging purposes */
1453  WORD preError; /* (P) Blocks certain types of execution */
1454  UBYTE ComChar; /* (P) Commentary character */
1455  UBYTE cComChar; /* (P) Old commentary character for .clear */
1456  PADPOINTER(2,18,2,2);
1457 };
1458 
1459 /*
1460  #] P :
1461  #[ C : The C struct defines objects changed by the compiler
1462 */
1463 
1472 struct C_const {
1474  POSITION StoreFileSize; /* () Size of store file */
1479  /* Later also for write? */
1492 /*
1493  Compile buffer variables
1494 */
1496 /*
1497  Objects for auto declarations
1498 */
1499  LIST AutoSymbolList; /* (C) */
1500  LIST AutoIndexList; /* (C) */
1501  LIST AutoVectorList; /* (C) */
1502  LIST AutoFunctionList; /* (C) */
1505  LIST *Symbols; /* (C) Pointer for autodeclare. Which list is
1506  it searching. Later also for subroutines */
1507  LIST *Indices; /* (C) id. */
1508  LIST *Vectors; /* (C) id. */
1509  LIST *Functions; /* (C) id. */
1510  NAMETREE **activenames;
1515  LONG *termstack;
1517  UWORD *cmod;
1518  UWORD *powmod;
1519  UWORD *modpowers;
1520  UWORD *halfmod; /* (C) half the modulus when not zero */
1521  WORD *ProtoType; /* (C) The subexpression prototype {wildcards} */
1522  WORD *WildC; /* (C) Filling point for wildcards. */
1523  LONG *IfHeap;
1524  LONG *IfCount;
1525  LONG *IfStack;
1526  UBYTE *iBuffer;
1527  UBYTE *iPointer;
1528  UBYTE *iStop;
1529  UBYTE **LabelNames;
1530  WORD *FixIndices;
1532  UBYTE *WildcardNames;
1533  int *Labels;
1534  SBYTE *tokens;
1535  SBYTE *toptokens;
1536  SBYTE *endoftokens;
1538  UWORD *modinverses; /* Table for inverses of primes */
1539  UBYTE *Fortran90Kind; /* The kind of number in Fortran 90 as in _ki */
1540  WORD **MultiBracketBuf; /* Array of buffers for multi-level brackets */
1541  UBYTE *extrasym; /* Array with the name for extra symbols in ToPolynomial */
1542  WORD *doloopstack; /* To keep track of begin and end of doloops */
1543  WORD *doloopnest; /* To keep track of nesting of doloops etc */
1548  WORD *IfSumCheck;
1549 #ifdef PARALLELCODE
1550  LONG *inputnumbers;
1551  WORD *pfirstnum;
1552 #endif
1553 #ifdef WITHPTHREADS
1554  pthread_mutex_t halfmodlock; /* () Lock for adding buffer for halfmod */
1555 #endif
1556  LONG argstack[MAXNEST]; /* (C) {contents} Stack for nesting of Argument */
1557  LONG insidestack[MAXNEST]; /* (C) {contents} Stack for Argument or Inside. */
1558  LONG inexprstack[MAXNEST]; /* (C) {contents} Stack for Argument or Inside. */
1559  LONG iBufferSize; /* (C) Size of the input buffer */
1560  LONG TransEname; /* (C) Used when a new definition overwrites
1561  an old expression. */
1562  LONG ProcessBucketSize; /* (C) */
1563  LONG mProcessBucketSize; /* (C) */
1564  LONG CModule; /* (C) Counter of current module */
1565  LONG ThreadBucketSize; /* (C) Roughly the maximum number of input terms */
1569  int cbufnum;
1570  int AutoDeclareFlag;
1572  int NoShowInput; /* (C) No listing of input as in .prc, #do */
1573  int ShortStats; /* (C) */
1574  int compiletype; /* (C) type of statement {DECLARATION etc} */
1575  int firstconstindex; /* (C) flag for giving first error message */
1576  int insidefirst; /* (C) Not used yet */
1577  int minsidefirst; /* (?) Not used yet */
1578  int wildflag; /* (C) Flag for marking use of wildcards */
1579  int NumLabels; /* (C) Number of labels {in Labels} */
1580  int MaxLabels; /* (C) Size of Labels array */
1581  int lDefDim; /* (C) */
1582  int lDefDim4; /* (C) */
1583  int NumWildcardNames; /* (C) Number of ?a variables */
1584  int WildcardBufferSize; /* (C) size of WildcardNames buffer */
1585  int MaxIf; /* (C) size of IfHeap, IfSumCheck, IfCount */
1586  int NumStreams; /* (C) */
1587  int MaxNumStreams; /* (C) */
1588  int firstctypemessage; /* (C) Flag for giving first st order error */
1589  int tablecheck; /* (C) For table checking */
1590  int idoption; /* (C) */
1591  int BottomLevel; /* (C) For propercount. Not used!!! */
1592  int CompileLevel; /* (C) Subexpression level */
1593  int TokensWriteFlag; /* (C) */
1594  int UnsureDollarMode; /* (C)?Controls error messages undefined $'s */
1595  int outsidefun; /* (C) Used for writing Tables to file */
1596  int funpowers; /* (C) */
1597  int WarnFlag; /* (C) */
1598  int StatsFlag; /* (C) */
1599  int NamesFlag; /* (C) */
1600  int CodesFlag; /* (C) */
1601  int SetupFlag; /* (C) */
1602  int SortType; /* (C) */
1603  int lSortType; /* (C) */
1604  int ThreadStats; /* (C) */
1605  int FinalStats; /* (C) */
1606  int OldParallelStats; /* (C) */
1607  int ThreadsFlag;
1608  int ThreadBalancing;
1609  int ThreadSortFileSynch;
1610  int ProcessStats; /* (C) */
1611  int BracketNormalize; /* (C) Indicates whether the bracket st is normalized */
1612  int maxtermlevel; /* (C) Size of termstack */
1613  int dumnumflag; /* (C) Where there dummy indices in tokenizer? */
1614  int bracketindexflag; /* (C) Are brackets going to be indexed? */
1615  int parallelflag; /* (C) parallel allowed? */
1616  int mparallelflag; /* (C) parallel allowed in this module? */
1617  int inparallelflag; /* (C) inparallel allowed? */
1618  int partodoflag; /* (C) parallel allowed? */
1619  int properorderflag; /* (C) clean normalizing. */
1620  int vetofilling; /* (C) vetoes overwriting in tablebase stubs */
1621  int tablefilling; /* (C) to notify AddRHS we are filling a table */
1622  int vetotablebasefill; /* (C) For the load in tablebase */
1623  int exprfillwarning; /* (C) Warning has been printed for expressions in fill statements */
1624  int lhdollarflag; /* (R) left hand dollar present */
1625  int NoCompress; /* (R) Controls native compression */
1626  int IsFortran90; /* Tells whether the Fortran is Fortran90 */
1627  int MultiBracketLevels; /* Number of elements in MultiBracketBuf */
1628  int topolynomialflag; /* To avoid ToPolynomial and FactArg together */
1629  int ffbufnum; /* Buffer number for user defined factorizations */
1630  int OldFactArgFlag;
1631  int MemDebugFlag; /* Only used when MALLOCDEBUG in tools.c */
1632  int doloopstacksize;
1633  int dolooplevel;
1638 #ifdef PARALLELCODE
1639  int numpfirstnum; /* For redefine */
1640  int sizepfirstnum; /* For redefine */
1641 #endif
1642  int origin; /* Determines whether .sort or ModuleOption */
1643  WORD argsumcheck[MAXNEST]; /* (C) Checking of nesting */
1644  WORD insidesumcheck[MAXNEST];/* (C) Checking of nesting */
1645  WORD inexprsumcheck[MAXNEST];/* (C) Checking of nesting */
1646  WORD RepSumCheck[MAXREPEAT];/* (C) Checks nesting of repeat, if, argument */
1647  WORD lUniTrace[4]; /* (C) */
1648  WORD RepLevel; /* (C) Tracks nesting of repeat. */
1649  WORD arglevel; /* (C) level of nested argument statements */
1650  WORD insidelevel; /* (C) level of nested inside statements */
1651  WORD inexprlevel; /* (C) level of nested inexpr statements */
1652  WORD termlevel; /* (C) level of nested term statements */
1653  WORD MustTestTable; /* (C) Indicates whether tables have been changed */
1654  WORD DumNum; /* (C) */
1655  WORD ncmod; /* (C) Local setting of modulus. size of cmod */
1656  WORD npowmod; /* (C) Local printing as powers. size powmod */
1657  WORD modmode; /* (C) Mode for modulus calculus */
1658  WORD nhalfmod; /* relevant word size of halfmod when defined */
1659  WORD DirtPow; /* (C) Flag for changes in printing mod powers */
1660  WORD lUnitTrace; /* (C) Local value of Tr[1] */
1661  WORD NwildC; /* (C) Wildcard counter */
1662  WORD ComDefer; /* (C) defer brackets */
1663  WORD CollectFun; /* (C) Collect function number */
1664  WORD AltCollectFun; /* (C) Alternate Collect function number */
1665  WORD OutputMode; /* (C) */
1666  WORD Cnumpows;
1667  WORD OutputSpaces; /* (C) */
1668  WORD OutNumberType; /* (C) Controls RATIONAL/FLOAT output */
1669  WORD DidClean; /* (C) Test whether nametree needs cleaning */
1670  WORD IfLevel; /* (C) */
1671  WORD WhileLevel; /* (C) */
1672  WORD LogHandle; /* (C) The Log File */
1673  WORD LineLength; /* (C) */
1674  WORD StoreHandle; /* (C) Handle of .str file */
1675  WORD HideLevel; /* (C) Hiding indicator */
1676  WORD lPolyFun; /* (C) local value of PolyFun */
1677  WORD lPolyFunType; /* (C) local value of PolyFunType */
1678  WORD SymChangeFlag; /* (C) */
1679  WORD CollectPercentage; /* (C) Collect function percentage */
1680  WORD ShortStatsMax; /* For On FewerStatistics 10; */
1681  WORD extrasymbols; /* Flag for the extra symbsols output mode */
1682  WORD PolyRatFunChanged; /* Keeps track whether we changed in the compiler */
1683  WORD ToBeInFactors;
1684 #ifdef WITHMPI
1685  WORD RhsExprInModuleFlag; /* (C) Set by the compiler if RHS expressions exists. */
1686 #endif
1687  UBYTE Commercial[COMMERCIALSIZE+2]; /* (C) Message to be printed in statistics */
1688  UBYTE debugFlags[MAXFLAGS+2]; /* On/Off Flag number(s) */
1689 #if defined(WITHPTHREADS)
1690  PADPOSITION(45,8+3*MAXNEST,68,40+3*MAXNEST+MAXREPEAT,COMMERCIALSIZE+MAXFLAGS+4+sizeof(LIST)*17+sizeof(pthread_mutex_t));
1691 #elif defined(WITHMPI)
1692  PADPOSITION(45,8+3*MAXNEST,68,41+3*MAXNEST+MAXREPEAT,COMMERCIALSIZE+MAXFLAGS+4+sizeof(LIST)*17);
1693 #else
1694  PADPOSITION(43,8+3*MAXNEST,66,40+3*MAXNEST+MAXREPEAT,COMMERCIALSIZE+MAXFLAGS+4+sizeof(LIST)*17);
1695 #endif
1696 };
1697 /*
1698  #] C :
1699  #[ S : The S struct defines objects changed at the start of the run (Processor)
1700  Basically only set by the master.
1701 */
1709 struct S_const {
1710  POSITION MaxExprSize; /* ( ) Maximum size of in/out/sort */
1711 #ifdef WITHPTHREADS
1712  pthread_mutex_t inputslock;
1713  pthread_mutex_t outputslock;
1714  pthread_mutex_t MaxExprSizeLock;
1715 #endif
1716  POSITION *OldOnFile; /* (S) File positions of expressions */
1717  WORD *OldNumFactors; /* ( ) NumFactors in (old) expression */
1718  WORD *Oldvflags; /* ( ) vflags in (old) expression */
1719  int NumOldOnFile; /* (S) Number of expressions in OldOnFile */
1720  int NumOldNumFactors; /* (S) Number of expressions in OldNumFactors */
1721  int MultiThreaded; /* (S) Are we running multi-threaded? */
1722 #ifdef WITHPTHREADS
1723  int MasterSort; /* Final stage of sorting to the master */
1724 #endif
1725 #ifdef WITHMPI
1726  int printflag; /* controls MesPrint() on each slave */
1727 #endif
1728  int Balancing; /* For second stage loadbalancing */
1729  WORD ExecMode; /* (S) */
1730 
1731  WORD CollectOverFlag; /* (R) Indicates overflow at Collect */
1732 #ifdef WITHPTHREADS
1733  WORD sLevel; /* Copy of AR0.sLevel because it can get messy */
1734 #endif
1735 #if defined(WITHPTHREADS)
1736  PADPOSITION(3,0,5,3,sizeof(pthread_mutex_t)*3);
1737 #elif defined(WITHMPI)
1738  PADPOSITION(3,0,5,2,0);
1739 #else
1740  PADPOSITION(3,0,4,2,0);
1741 #endif
1742 };
1743 /*
1744  #] S :
1745  #[ R : The R struct defines objects changed at run time.
1746  They determine the environment that has to be transfered
1747  together with a term during multithreaded execution.
1748 */
1757 struct R_const {
1758  FILEDATA StoreData; /* (O) */
1759  FILEHANDLE Fscr[3]; /* (R) Dollars etc play with it too */
1760  FILEHANDLE FoStage4[2]; /* (R) In Sort. Stage 4. */
1761  POSITION DefPosition; /* (R) Deferred position of keep brackets. */
1762  FILEHANDLE *infile; /* (R) Points alternatingly to Fscr[0] or Fscr[1] */
1763  FILEHANDLE *outfile; /* (R) Points alternatingly to Fscr[1] or Fscr[0] */
1764  FILEHANDLE *hidefile; /* (R) Points to Fscr[2] */
1765 
1766  WORD *CompressBuffer; /* (M) */
1767  WORD *ComprTop; /* (M) */
1768  WORD *CompressPointer; /* (R) */
1769  VOID *CompareRoutine;
1770  ULONG *wranfia;
1771 
1772  LONG OldTime; /* (R) Zero time. Needed in timer. */
1773  LONG InInBuf; /* (R) Characters in input buffer. Scratch files. */
1774  LONG InHiBuf; /* (R) Characters in hide buffer. Scratch file. */
1775  LONG pWorkSize; /* (R) Size of pWorkSpace */
1776  LONG lWorkSize; /* (R) Size of lWorkSpace */
1777  LONG posWorkSize; /* (R) Size of posWorkSpace */
1778  ULONG wranfseed;
1779  int NoCompress; /* (R) Controls native compression */
1780  int gzipCompress; /* (R) Controls gzip compression */
1781  int Cnumlhs; /* Local copy of cbuf[rbufnum].numlhs */
1782  int outtohide; /* Indicates that output is directly to hide */
1783 #ifdef WITHPTHREADS
1784  int exprtodo; /* The expression to do in parallel mode */
1785 #endif
1786  int wranfcall;
1787  int wranfnpair1;
1788  int wranfnpair2;
1789 #if ( BITSINWORD == 32 )
1790  WORD PrimeList[5000];
1791  WORD numinprimelist;
1792  WORD notfirstprime;
1793 #endif
1794  WORD GetFile; /* (R) Where to get the terms {like Hide} */
1795  WORD KeptInHold; /* (R) */
1796  WORD BracketOn; /* (R) Intensly used in poly_ */
1797  WORD MaxBracket; /* (R) Size of BrackBuf. Changed by poly_ */
1798  WORD CurDum; /* (R) Current maximum dummy number */
1799  WORD DeferFlag; /* (R) For defered brackets */
1800  WORD TePos; /* (R) */
1801  WORD sLevel; /* (R) Sorting level */
1802  WORD Stage4Name; /* (R) Sorting only */
1803  WORD GetOneFile; /* (R) Getting from hide or regular */
1804  WORD PolyFun; /* (C) Number of the PolyFun function */
1805  WORD PolyFunType; /* () value of PolyFunType */
1806  WORD Eside; /* () Tells which side of = sign */
1807  WORD MaxDum; /* Maximum dummy value in an expression */
1808  WORD level; /* Running level in Generator */
1809  WORD expchanged; /* (R) Info about expression */
1810  WORD expflags; /* (R) Info about expression */
1811  WORD CurExpr; /* (S) Number of current expression */
1812  WORD SortType; /* A copy of AC.SortType to play with */
1813  WORD ShortSortCount; /* For On FewerStatistics 10; */
1814 #if ( BITSINWORD == 32 )
1815 #ifdef WITHPTHREADS
1816  PADPOSITION(8,7,8,5022,0);
1817 #else
1818  PADPOSITION(8,7,7,5022,0);
1819 #endif
1820 #else
1821 #ifdef WITHPTHREADS
1822  PADPOSITION(8,7,8,20,0);
1823 #else
1824  PADPOSITION(8,7,7,20,0);
1825 #endif
1826 #endif
1827 };
1828 
1829 /*
1830  #] R :
1831  #[ T : These are variables that stay in each thread during multi threaded execution.
1832 */
1841 struct T_const {
1842 #ifdef WITHPTHREADS
1843  SORTBLOCK SB;
1844 #endif
1845  SORTING *S0; /* (-) The thread specific sort buffer */
1846  SORTING *SS; /* (R) Current sort buffer */
1847  NESTING Nest; /* (R) Nesting of function levels etc. */
1848  NESTING NestStop; /* (R) */
1849  NESTING NestPoin; /* (R) */
1850  WORD *BrackBuf; /* (R) Bracket buffer. Used by poly_ at runtime. */
1851  STORECACHE StoreCache; /* (R) Cache for picking up stored expr. */
1852  STORECACHE StoreCacheAlloc; /* (R) Permanent address of StoreCache to keep valgrind happy */
1853  WORD **pWorkSpace; /* (R) Workspace for pointers. Dynamic. */
1854  LONG *lWorkSpace; /* (R) WorkSpace for LONG. Dynamic. */
1855  POSITION *posWorkSpace; /* (R) WorkSpace for file positions */
1856  WORD *WorkSpace; /* (M) */
1857  WORD *WorkTop; /* (M) */
1858  WORD *WorkPointer; /* (R) Pointer in the WorkSpace heap. */
1859  int *RepCount; /* (M) Buffer for repeat nesting */
1860  int *RepTop; /* (M) Top of RepCount buffer */
1861  WORD *WildArgTaken; /* (N) Stack for wildcard pattern matching */
1862  WORD *n_coef; /* (M) Used by normal. local. */
1863  WORD *n_llnum; /* (M) Used by normal. local. */
1864  UWORD *factorials; /* (T) buffer of factorials. Dynamic. */
1865  WORD *small_power_n; /* length of the number */
1866  UWORD **small_power; /* the number*/
1867  UWORD *bernoullis; /* (T) The buffer with bernoulli numbers. Dynamic. */
1868  WORD *primelist;
1869  LONG *pfac; /* (T) array of positions of factorials. Dynamic. */
1870  LONG *pBer; /* (T) array of positions of Bernoulli's. Dynamic. */
1871  WORD *TMaddr; /* (R) buffer for TestSub */
1872  WORD *WildMask; /* (N) Wildcard info during pattern matching */
1873  WORD *previousEfactor; /* () Cache for factors in expressions */
1874  WORD **TermMemHeap; /* For TermMalloc. Set zero in Checkpoint */
1875  UWORD **NumberMemHeap; /* For NumberMalloc. Set zero in Checkpoint */
1876  BRACKETINFO *bracketinfo;
1877  LONG sBer; /* (T) Size of the bernoullis buffer */
1878  LONG pWorkPointer; /* (R) Offset-pointer in pWorkSpace */
1879  LONG lWorkPointer; /* (R) Offset-pointer in lWorkSpace */
1880  LONG posWorkPointer; /* (R) Offset-pointer in posWorkSpace */
1881  int sfact; /* (T) size of the factorials buffer */
1882  int mfac; /* (T) size of the pfac array. */
1883  int ebufnum; /* (R) extra compiler buffer */
1884  int fbufnum; /* extra compiler buffer for factorization cache */
1885  int WildcardBufferSize; /* () local copy for updates */
1886 #ifdef WITHPTHREADS
1887  int identity; /* () When we work with B->T */
1888  int LoadBalancing; /* Needed for synchronization */
1889 #ifdef WITHSORTBOTS
1890  int SortBotIn1; /* Input stream 1 for a SortBot */
1891  int SortBotIn2; /* Input stream 2 for a SortBot */
1892 #endif
1893 #endif
1894  int TermMemMax; /* For TermMalloc. Set zero in Checkpoint */
1895  int TermMemTop; /* For TermMalloc. Set zero in Checkpoint */
1896  int NumberMemMax; /* For NumberMalloc. Set zero in Checkpoint */
1897  int NumberMemTop; /* For NumberMalloc. Set zero in Checkpoint */
1898  int bracketindexflag; /* Are brackets going to be indexed? */
1899  WORD small_power_maxx; /* size of the cache for small powers */
1900  WORD small_power_maxn; /* size of the cache for small powers */
1901  WORD dummysubexp[SUBEXPSIZE+4]; /* () used in normal.c */
1902  WORD comsym[8]; /* () Used in tools.c = {8,SYMBOL,4,0,1,1,1,3} */
1903  WORD comnum[4]; /* () Used in tools.c = { 4,1,1,3 } */
1904  WORD comfun[FUNHEAD+4]; /* () Used in tools.c = {7,FUNCTION,3,0,1,1,3} */
1905  /* or { 8,FUNCTION,4,0,0,1,1,3 } */
1906  WORD comind[7]; /* () Used in tools.c = {7,INDEX,3,0,1,1,3} */
1907  WORD MinVecArg[7+ARGHEAD]; /* (N) but should be more local */
1908  WORD FunArg[4+ARGHEAD+FUNHEAD]; /* (N) but can be more local */
1909  WORD locwildvalue[SUBEXPSIZE]; /* () Used in argument.c = {SUBEXPRESSION,SUBEXPSIZE,0,0,0} */
1910  WORD mulpat[SUBEXPSIZE+5]; /* () Used in argument.c = {TYPEMULT, SUBEXPSIZE+3, 0, */
1911  /* SUBEXPRESSION, SUBEXPSIZE, 0, 1, 0, 0, 0 } */
1912  WORD proexp[SUBEXPSIZE+5]; /* () Used in poly.c */
1913  WORD TMout[40]; /* (R) Passing info */
1914  WORD TMbuff; /* (R) Communication between TestSub and Genera */
1915  WORD TMdolfac; /* factor number for dollar */
1916  WORD nfac; /* (T) Number of highest stored factorial */
1917  WORD nBer; /* (T) Number of highest bernoulli number. */
1918  WORD mBer; /* (T) Size of buffer pBer. */
1919  WORD PolyAct; /* (R) Used for putting the PolyFun at end. ini at 0 */
1920  WORD RecFlag; /* (R) Used in TestSub. ini at zero. */
1921  WORD inprimelist;
1922  WORD sizeprimelist;
1923  WORD fromindex; /* Tells the compare routine whether call from index */
1924 #ifdef WITHPTHREADS
1925 #ifdef WITHSORTBOTS
1926  PADPOINTER(4,14,100+SUBEXPSIZE*4+FUNHEAD*2+ARGHEAD*2,0);
1927 #else
1928  PADPOINTER(4,12,100+SUBEXPSIZE*4+FUNHEAD*2+ARGHEAD*2,0);
1929 #endif
1930 #else
1931  PADPOINTER(4,10,100+SUBEXPSIZE*4+FUNHEAD*2+ARGHEAD*2,0);
1932 #endif
1933 };
1934 /*
1935  #] T :
1936  #[ N : The N struct contains variables used in running information
1937  that is inside blocks that should not be split, like pattern
1938  matching, traces etc. They are local for each thread.
1939  They don't need initializations.
1940 */
1949 struct N_const {
1950  POSITION OldPosIn; /* (R) Used in sort. */
1951  POSITION OldPosOut; /* (R) Used in sort */
1952  POSITION theposition; /* () Used in index.c */
1953  WORD *EndNest; /* (R) Nesting of function levels etc. */
1954  WORD *Frozen; /* (R) Bracket info */
1955  WORD *FullProto; /* (R) Prototype of a subexpression or table */
1956  WORD *cTerm; /* (R) Current term for coef_ and term_ */
1957  int *RepPoint; /* (R) Pointer in RepCount buffer. Tracks repeat */
1958  WORD *WildValue; /* (N) Wildcard info during pattern matching */
1959  WORD *WildStop; /* (N) Wildcard info during pattern matching */
1960  WORD *argaddress; /* (N) Used in pattern matching of arguments */
1961  WORD *RepFunList; /* (N) For pattern matching */
1962  WORD *patstop; /* (N) Used in pattern matching */
1963  WORD *terstop; /* (N) Used in pattern matching */
1964  WORD *terstart; /* (N) Used in pattern matching */
1965  WORD *terfirstcomm; /* (N) Used in pattern matching */
1966  WORD *DumFound; /* (N) For renumbering indices {make local?} */
1967  WORD **DumPlace; /* (N) For renumbering indices {make local?} */
1968  WORD **DumFunPlace; /* (N) For renumbering indices {make local?} */
1969  WORD *UsedSymbol; /* (N) When storing terms of a global expr. */
1970  WORD *UsedVector; /* (N) When storing terms of a global expr. */
1971  WORD *UsedIndex; /* (N) When storing terms of a global expr. */
1972  WORD *UsedFunction; /* (N) When storing terms of a global expr. */
1973  WORD *MaskPointer; /* (N) For wildcard pattern matching */
1974  WORD *ForFindOnly; /* (N) For wildcard pattern matching */
1975  WORD *findTerm; /* (N) For wildcard pattern matching */
1976  WORD *findPattern; /* (N) For wildcard pattern matching */
1977 #ifdef WITHZLIB
1978  Bytef **ziobufnum; /* () Used in compress.c */
1979  Bytef *ziobuffers; /* () Used in compress.c */
1980 #endif
1981  WORD *dummyrenumlist; /* () Used in execute.c and store.c */
1982  int *funargs; /* () Used in lus.c */
1983  WORD **funlocs; /* () Used in lus.c */
1984  int *funinds; /* () Used in lus.c */
1985  UWORD *NoScrat2; /* () Used in normal.c */
1986  WORD *ReplaceScrat; /* () Used in normal.c */
1987  TRACES *tracestack; /* () used in opera.c */
1988  WORD *selecttermundo; /* () Used in pattern.c */
1989  WORD *patternbuffer; /* () Used in pattern.c */
1990  WORD **PoinScratch; /* () used in reshuf.c */
1991  WORD **FunScratch; /* () used in reshuf.c */
1992  WORD *RenumScratch; /* () used in reshuf.c */
1993  FUN_INFO *FunInfo; /* () Used in smart.c */
1994  WORD **SplitScratch; /* () Used in sort.c */
1995  WORD **SplitScratch1; /* () Used in sort.c */
1996  SORTING **FunSorts; /* () Used in sort.c */
1997  UWORD *SoScratC; /* () Used in sort.c */
1998  WORD *listinprint; /* () Used in proces.c and message.c */
1999  WORD *currentTerm; /* () Used in proces.c and message.c */
2000  WORD **arglist; /* () Used in function.c */
2001  int *tlistbuf; /* () used in lus.c */
2002 #ifdef WHICHSUBEXPRESSION
2003  UWORD *BinoScrat; /* () Used in proces.c */
2004 #endif
2005  WORD *compressSpace; /* () Used in sort.c */
2006 #ifdef WITHPTHREADS
2007  THREADBUCKET *threadbuck;
2008  EXPRESSIONS expr;
2009 #endif
2010  UWORD *SHcombi;
2011  WORD *poly_vars;
2012  UWORD *cmod; /* Local setting of modulus. Pointer to value. */
2013  SHvariables SHvar;
2014  LONG deferskipped; /* () Used in proces.c store.c and parallel.c */
2015  LONG InScratch; /* () Used in sort.c */
2016  LONG SplitScratchSize; /* () Used in sort.c */
2017  LONG InScratch1; /* () Used in sort.c */
2018  LONG SplitScratchSize1; /* () Used in sort.c */
2019  LONG ninterms; /* () Used in proces.c and sort.c */
2020 #ifdef WITHPTHREADS
2021  LONG inputnumber; /* () For use in redefine */
2022  LONG lastinindex;
2023 #endif
2024 #ifdef WHICHSUBEXPRESSION
2025  LONG last2; /* () Used in proces.c */
2026  LONG last3; /* () Used in proces.c */
2027 #endif
2028  LONG SHcombisize;
2029  int NumTotWildArgs; /* (N) Used in pattern matching */
2030  int UseFindOnly; /* (N) Controls pattern routines */
2031  int UsedOtherFind; /* (N) Controls pattern routines */
2032  int ErrorInDollar; /* (R) */
2033  int numfargs; /* () Used in lus.c */
2034  int numflocs; /* () Used in lus.c */
2035  int nargs; /* () Used in lus.c */
2036  int tohunt; /* () Used in lus.c */
2037  int numoffuns; /* () Used in lus.c */
2038  int funisize; /* () Used in lus.c */
2039  int RSsize; /* () Used in normal.c */
2040  int numtracesctack; /* () used in opera.c */
2041  int intracestack; /* () used in opera.c */
2042  int numfuninfo; /* () Used in smart.c */
2043  int NumFunSorts; /* () Used in sort.c */
2044  int MaxFunSorts; /* () Used in sort.c */
2045  int arglistsize; /* () Used in function.c */
2046  int tlistsize; /* () used in lus.c */
2047  int filenum; /* () used in setfile.c */
2048  int compressSize; /* () Used in sort.c */
2049  int polysortflag;
2050  int nogroundlevel; /* () Used to see whether pattern matching at groundlevel */
2051  int subsubveto; /* () Sabotage combining subexpressions in TestSub */
2052  WORD MaxRenumScratch; /* () used in reshuf.c */
2053  WORD oldtype; /* (N) WildCard info at pattern matching */
2054  WORD oldvalue; /* (N) WildCard info at pattern matching */
2055  WORD NumWild; /* (N) Used in Wildcard */
2056  WORD RepFunNum; /* (N) Used in pattern matching */
2057  WORD DisOrderFlag; /* (N) Disorder option? Used in pattern matching */
2058  WORD WildDirt; /* (N) dirty in wldcard substitution. */
2059  WORD NumFound; /* (N) in reshuf only. Local? */
2060  WORD WildReserve; /* (N) Used in the wildcards */
2061  WORD TeInFun; /* (R) Passing type of action */
2062  WORD TeSuOut; /* (R) Passing info. Local? */
2063  WORD WildArgs; /* (R) */
2064  WORD WildEat; /* (R) */
2065  WORD PolyNormFlag; /* (R) For polynomial arithmetic */
2066  WORD sizeselecttermundo; /* () Used in pattern.c */
2067  WORD patternbuffersize; /* () Used in pattern.c */
2068  WORD numlistinprint; /* () Used in process.c */
2069  WORD ncmod; /* () used as some type of flag to disable */
2070  WORD ExpectedSign;
2071  WORD SignCheck;
2072  WORD IndDum; /* Active dummy indices */
2073  WORD poly_num_vars;
2074 #ifdef WHICHSUBEXPRESSION
2075  WORD nbino; /* () Used in proces.c */
2076  WORD last1; /* () Used in proces.c */
2077 #endif
2078 #ifdef WITHPTHREADS
2079 #ifdef WHICHSUBEXPRESSION
2080 #ifdef WITHZLIB
2081  PADPOSITION(54,11,23,24,sizeof(SHvariables));
2082 #else
2083  PADPOSITION(52,11,23,24,sizeof(SHvariables));
2084 #endif
2085 #else
2086 #ifdef WITHZLIB
2087  PADPOSITION(53,9,23,22,sizeof(SHvariables));
2088 #else
2089  PADPOSITION(51,9,23,22,sizeof(SHvariables));
2090 #endif
2091 #endif
2092 #else
2093 #ifdef WHICHSUBEXPRESSION
2094 #ifdef WITHZLIB
2095  PADPOSITION(52,9,23,24,sizeof(SHvariables));
2096 #else
2097  PADPOSITION(50,9,23,24,sizeof(SHvariables));
2098 #endif
2099 #else
2100 #ifdef WITHZLIB
2101  PADPOSITION(51,7,23,22,sizeof(SHvariables));
2102 #else
2103  PADPOSITION(49,7,23,22,sizeof(SHvariables));
2104 #endif
2105 #endif
2106 #endif
2107 };
2108 
2109 /*
2110  #] N :
2111  #[ O : The O struct concerns output variables
2112 */
2121 struct O_const {
2122  FILEDATA SaveData; /* (O) */
2123  STOREHEADER SaveHeader; /* () System Independent save-Files */
2124  OPTIMIZERESULT OptimizeResult;
2125  UBYTE *OutputLine; /* (O) Sits also in debug statements */
2126  UBYTE *OutStop; /* (O) Top of OutputLine buffer */
2127  UBYTE *OutFill; /* (O) Filling point in OutputLine buffer */
2128  WORD *bracket; /* (O) For writing brackets */
2129  WORD *termbuf; /* (O) For writing terms */
2130  WORD *tabstring;
2131  UBYTE *wpos; /* (O) Only when storing file {local?} */
2132  UBYTE *wpoin; /* (O) Only when storing file {local?} */
2133  UBYTE *DollarOutBuffer; /* (O) Outputbuffer for Dollars */
2134  UBYTE *CurBufWrt; /* (O) Name of currently written expr. */
2135  VOID (*FlipWORD)(UBYTE *); /* () Function pointers for translations. Initialized by ReadSaveHeader() */
2136  VOID (*FlipLONG)(UBYTE *);
2137  VOID (*FlipPOS)(UBYTE *);
2138  VOID (*FlipPOINTER)(UBYTE *);
2139  VOID (*ResizeData)(UBYTE *,int,UBYTE *,int);
2140  VOID (*ResizeWORD)(UBYTE *,UBYTE *);
2141  VOID (*ResizeNCWORD)(UBYTE *,UBYTE *);
2142  VOID (*ResizeLONG)(UBYTE *,UBYTE *);
2143  VOID (*ResizePOS)(UBYTE *,UBYTE *);
2144  VOID (*ResizePOINTER)(UBYTE *,UBYTE *);
2145  VOID (*CheckPower)(UBYTE *);
2146  VOID (*RenumberVec)(UBYTE *);
2147  UBYTE *tensorList; /* Dynamically allocated list with functions that are tensorial. */
2148  WORD *inscheme; /* for feeding a Horner scheme to Optimize */
2149 /*----Leave NumInBrack as first non-pointer. This is used by the checkpoints--*/
2150  LONG NumInBrack; /* (O) For typing [] option in print */
2151  LONG wlen; /* (O) Used to store files. */
2152  LONG DollarOutSizeBuffer; /* (O) Size of DollarOutBuffer */
2153  LONG DollarInOutBuffer; /* (O) Characters in DollarOutBuffer */
2154 #if defined(mBSD) && defined(MICROTIME)
2155  LONG wrap; /* (O) For statistics time. wrap around */
2156  LONG wrapnum; /* (O) For statistics time. wrap around */
2157 #endif
2158  OPTIMIZE Optimize;
2159  int OutInBuffer; /* (O) Which routine does the writing */
2160  int NoSpacesInNumbers; /* For very long numbers */
2161  int BlockSpaces; /* For very long numbers */
2162  WORD schemenum; /* for feeding a Horner scheme to Optimize */
2163  WORD transFlag; /* () >0 indicades that translations have to be done */
2164  WORD powerFlag; /* () >0 indicades that some exponents/powers had to be adjusted */
2165  WORD mpower; /* For maxpower adjustment to larger value */
2166  WORD resizeFlag; /* () >0 indicades that something went wrong when resizing words */
2167  WORD bufferedInd; /* () Contains extra INDEXENTRIES, see ReadSaveIndex() for an explanation */
2168  WORD OutSkip; /* (O) How many chars to skip in output line */
2169  WORD IsBracket; /* (O) Controls brackets */
2170  WORD InFbrack; /* (O) For writing only */
2171  WORD PrintType; /* (O) */
2172  WORD FortFirst; /* (O) Only in sch.c */
2173  WORD DoubleFlag; /* (O) Output in double precision */
2174  WORD IndentSpace; /* For indentation in output */
2175  WORD FactorMode; /* When the output should be written as factors */
2176  WORD FactorNum; /* Number of factor currently treated */
2177  WORD ErrorBlock;
2178  WORD OptimizationLevel; /* Level of optimization in the output */
2179  UBYTE FortDotChar; /* (O) */
2180 #if defined(mBSD) && defined(MICROTIME)
2181  PADPOSITION(24,6,18,17,1);
2182 #else
2183  PADPOSITION(24,4,18,17,1);
2184 #endif
2185 };
2186 /*
2187  #] O :
2188  #[ X : The X struct contains variables that deal with the external channel
2189 */
2197 struct X_const {
2198  UBYTE *currentPrompt;
2199  UBYTE *shellname; /* if !=NULL (default is "/bin/sh -c"), start in
2200  the specified subshell*/
2201  UBYTE *stderrname; /* If !=NULL (default if "/dev/null"), stderr is
2202  redirected to the specified file*/
2203  int timeout; /* timeout to initialize preset channels.
2204  If timeout<0, the preset channels are
2205  already initialized*/
2206  int killSignal; /* signal number, SIGKILL by default*/
2207  int killWholeGroup; /* if 0, the signal is sent only to a process,
2208  if !=0 (default) is sent to a whole process group*/
2209  int daemonize; /* if !=0 (default), start in a daemon mode */
2210  int currentExternalChannel;
2211  PADPOINTER(0,5,0,0);
2212 };
2213 /*
2214  #] X :
2215  #[ Definitions :
2216 */
2217 
2218 #ifdef WITHPTHREADS
2219 
2225 typedef struct AllGlobals {
2226  struct M_const M;
2227  struct C_const C;
2228  struct S_const S;
2229  struct O_const O;
2230  struct P_const P;
2231  struct X_const X;
2232  PADPOSITION(0,0,0,0,sizeof(struct P_const)+sizeof(struct X_const));
2233 } ALLGLOBALS;
2234 
2240 typedef struct AllPrivates {
2241  struct R_const R;
2242  struct N_const N;
2243  struct T_const T;
2244  PADPOSITION(0,0,0,0,sizeof(struct T_const));
2245 } ALLPRIVATES;
2246 
2247 #else
2248 
2253 typedef struct AllGlobals {
2254  struct M_const M;
2255  struct C_const C;
2256  struct S_const S;
2257  struct R_const R;
2258  struct N_const N;
2259  struct O_const O;
2260  struct P_const P;
2261  struct T_const T;
2262  struct X_const X;
2263  PADPOSITION(0,0,0,0,sizeof(struct P_const)+sizeof(struct T_const)+sizeof(struct X_const));
2264 } ALLGLOBALS;
2265 
2266 #endif
2267 
2268 /*
2269  #] Definitions :
2270  #] A :
2271  #[ FG :
2272 */
2273 
2274 #ifdef ANSI
2275 typedef WORD (*WCN)(PHEAD WORD *,WORD *,WORD,WORD);
2276 typedef WORD (*WCN2)(PHEAD WORD *,WORD *);
2277 #else
2278 typedef WORD (*WCN)();
2279 typedef WORD (*WCN2)();
2280 #endif
2281 
2293 typedef struct FixedGlobals {
2294  WCN Operation[8];
2295  WCN2 OperaFind[6];
2296  char *VarType[10];
2297  char *ExprStat[17];
2298  char *FunNam[2];
2299  char *swmes[3];
2300  char *fname;
2301  UBYTE *s_one;
2302  UINT cTable[256];
2303 } FIXEDGLOBALS;
2304 
2305 /*
2306  #] FG :
2307 */
2308 
2309 #endif
UBYTE * pointer
Definition: structs.h:677
WORD * tokenarglevel
Definition: structs.h:1537
WORD bufferssize
Definition: structs.h:366
struct VaRrEnUm VARRENUM
struct sOrT SORTING
int CheckpointFlag
Definition: structs.h:1634
LONG * NumTerms
Definition: structs.h:915
UBYTE revision
Definition: structs.h:88
WORD * buffers
Definition: structs.h:352
int value
Definition: structs.h:285
WORD number
Definition: structs.h:467
UBYTE sFun
Definition: structs.h:85
char * name
Definition: structs.h:940
LONG reserved
Definition: structs.h:354
NAMETREE * autonames
Definition: structs.h:1503
UBYTE * name
Definition: structs.h:768
struct ChAnNeL CHANNEL
LONG totind
Definition: structs.h:353
#define INFILEINDEX
Definition: structs.h:118
int numclear
Definition: structs.h:212
int numtree
Definition: structs.h:362
NAMETREE * exprnames
Definition: structs.h:1476
WORD left
Definition: structs.h:237
LONG clearnamefill
Definition: structs.h:267
struct CbUf CBUF
int parent
Definition: structs.h:282
LIST IndexList
Definition: structs.h:1484
LIST DubiousList
Definition: structs.h:1480
UBYTE * dollarname
Definition: structs.h:827
Definition: structs.h:429
WORD flags
Definition: structs.h:468
int prototypeSize
Definition: structs.h:357
UBYTE * buffer
Definition: structs.h:676
int right
Definition: structs.h:284
WORD size
Definition: structs.h:297
WORD * FixIndices
Definition: structs.h:1530
LONG namefill
Definition: structs.h:261
WORD SignCheck
Definition: structs.h:2071
WORD type
Definition: structs.h:240
Definition: structs.h:483
NAMENODE * namenode
Definition: structs.h:253
WORD * pattern
Definition: structs.h:344
struct AllGlobals ALLGLOBALS
WORD * bracketbuffer
Definition: structs.h:318
int left
Definition: structs.h:283
WORD nsymbols
Definition: structs.h:104
UBYTE * name
Definition: structs.h:824
Definition: structs.h:618
WORD nvectors
Definition: structs.h:106
LONG CheckpointStamp
Definition: structs.h:1566
POSITION position
Definition: structs.h:100
NAMETREE * dollarnames
Definition: structs.h:1475
#define PHEAD
Definition: ftypes.h:56
VARRENUM indi
Definition: structs.h:181
int sparse
Definition: structs.h:361
LONG * termsortstack
Definition: structs.h:1516
LIST cbufList
Definition: structs.h:1495
UBYTE * iBuffer
Definition: structs.h:1526
LONG CompressSize
Definition: structs.h:103
struct TaBlEs * spare
Definition: structs.h:351
int NoShowInput
Definition: structs.h:1572
VARRENUM vect
Definition: structs.h:182
POSITION next
Definition: structs.h:138
LIST ModOptDolList
Definition: structs.h:1490
UWORD * cmod
Definition: structs.h:1517
int size
Definition: structs.h:209
int strict
Definition: structs.h:360
UBYTE * top
Definition: structs.h:678
LONG symminfo
Definition: structs.h:463
WORD number
Definition: structs.h:241
Definition: structs.h:1183
STREAM * Streams
Definition: structs.h:1512
WORD mode
Definition: structs.h:369
int cbufnum
Definition: structs.h:1569
LONG nodefill
Definition: structs.h:259
LONG nodesize
Definition: structs.h:258
Definition: minos.h:94
struct pReVaR PREVAR
WORD node
Definition: structs.h:471
WORD ** lhs
Definition: structs.h:912
SBYTE * toptokens
Definition: structs.h:1535
UBYTE lenPOINTER
Definition: structs.h:80
int numind
Definition: structs.h:358
UBYTE sVec
Definition: structs.h:84
int numglobal
Definition: structs.h:210
LONG globalnodefill
Definition: structs.h:266
UBYTE sInd
Definition: structs.h:83
POSITION variables
Definition: structs.h:102
WORD mini
Definition: structs.h:295
LONG globalnamefill
Definition: structs.h:264
WORD * termsumcheck
Definition: structs.h:1531
UBYTE lenPOS
Definition: structs.h:79
int num
Definition: structs.h:207
Definition: structs.h:908
LIST PotModDolList
Definition: structs.h:1489
struct ReNuMbEr * RENUMBER
WORD parent
Definition: structs.h:236
UWORD * gpowmod
Definition: structs.h:1249
Definition: structs.h:281
WORD * Pointer
Definition: structs.h:911
WORD * IfSumCheck
Definition: structs.h:1548
struct FiLe FILEHANDLE
WORD * vecnum
Definition: structs.h:187
set_of_char separators
Definition: structs.h:1473
UBYTE * FoldName
Definition: structs.h:679
UWORD * gcmod
Definition: structs.h:1248
WORD * dimension
Definition: structs.h:917
TABLES tabl
Definition: structs.h:462
LONG name
Definition: structs.h:235
LIST SymbolList
Definition: structs.h:1487
WORD symmetric
Definition: structs.h:470
WORD * symnum
Definition: structs.h:185
WORD SortType
Definition: structs.h:323
int usage
Definition: structs.h:287
UBYTE sSym
Definition: structs.h:82
UBYTE lenWORD
Definition: structs.h:77
WORD * renumlists
Definition: structs.h:384
WORD ggShortStatsMax
Definition: structs.h:1390
int blnce
Definition: structs.h:286
WORD maxi
Definition: structs.h:296
int wildarg
Definition: structs.h:772
WORD * tablepointers
Definition: structs.h:338
LIST FunctionList
Definition: structs.h:1482
LIST TableBaseList
Definition: structs.h:1491
void * lijst
Definition: structs.h:205
UBYTE * iStop
Definition: structs.h:1528
UBYTE * argtail
Definition: structs.h:349
UBYTE * name
Definition: structs.h:680
WORD balance
Definition: structs.h:239
UBYTE lenLONG
Definition: structs.h:78
WORD tablenum
Definition: structs.h:368
UBYTE * iPointer
Definition: structs.h:1527
SORTING * S0
Definition: structs.h:1247
WORD ** rhs
Definition: structs.h:913
POSITION length
Definition: structs.h:101
char * message
Definition: structs.h:206
WORD * hi
Definition: structs.h:168
POSITION number
Definition: structs.h:139
int MaxTreeSize
Definition: structs.h:364
LONG * IfHeap
Definition: structs.h:1523
struct InDeXeNtRy INDEXENTRY
WORD bufnum
Definition: structs.h:365
struct TrAcEn * TRACEN
STREAM * CurrentStream
Definition: structs.h:1513
WORD buffersfill
Definition: structs.h:367
Definition: structs.h:1028
struct NeStInG * NESTING
WORD nindices
Definition: structs.h:105
WORD * numdum
Definition: structs.h:916
LIST SetElementList
Definition: structs.h:1485
WORD complex
Definition: structs.h:466
int numtemp
Definition: structs.h:211
int maxnum
Definition: structs.h:208
LONG * termstack
Definition: structs.h:1515
COMPTREE * boomlijst
Definition: structs.h:918
LONG defined
Definition: structs.h:355
struct StOrEcAcHe * STORECACHE
MINMAX * mm
Definition: structs.h:346
WORD size
Definition: structs.h:108
struct NaMeNode NAMENODE
BRACKETINDEX * indexbuffer
Definition: structs.h:317
COMPTREE * boomlijst
Definition: structs.h:348
WORD IndDum
Definition: structs.h:2072
LONG CheckpointInterval
Definition: structs.h:1567
WORD * prototype
Definition: structs.h:343
LONG name
Definition: structs.h:464
SBYTE * tokens
Definition: structs.h:1534
LONG namesize
Definition: structs.h:260
int bounds
Definition: structs.h:359
char * CheckpointRunBefore
Definition: structs.h:1546
LONG oldnamefill
Definition: structs.h:262
SBYTE * endoftokens
Definition: structs.h:1536
struct DoLoOp DOLOOP
LONG oldnodefill
Definition: structs.h:263
#define EMPTYININDEX
Definition: structs.h:123
WORD spec
Definition: structs.h:469
UWORD * powmod
Definition: structs.h:1518
WORD * Buffer
Definition: structs.h:909
WORD * start
Definition: structs.h:166
LONG BufferSize
Definition: structs.h:919
Definition: structs.h:204
UBYTE * WildcardNames
Definition: structs.h:1532
struct bit_field * one_byte
Definition: structs.h:883
WORD * indnum
Definition: structs.h:186
struct StreaM STREAM
WORD * Top
Definition: structs.h:910
struct tree COMPTREE
struct DiStRiBuTe DISTRIBUTE
NAMETREE * varnames
Definition: structs.h:1477
int nargs
Definition: structs.h:771
struct NaMeTree NAMETREE
UBYTE * namebuffer
Definition: structs.h:255
LONG * IfStack
Definition: structs.h:1525
struct TrAcEs TRACES
UBYTE * pname
Definition: structs.h:681
LIST VectorList
Definition: structs.h:1488
WORD right
Definition: structs.h:238
PRELOAD p
Definition: structs.h:823
LIST SetList
Definition: structs.h:1486
LIST ExpressionList
Definition: structs.h:1483
WORD namesize
Definition: structs.h:472
LONG mdefined
Definition: structs.h:356
LIST ChannelList
Definition: structs.h:1478
WORD headnode
Definition: structs.h:269
VARRENUM func
Definition: structs.h:183
int rootnum
Definition: structs.h:363
UBYTE * value
Definition: structs.h:769
struct FuNcTiOn * FUNCTIONS
LONG * IfCount
Definition: structs.h:1524
struct bit_field set_of_char[32]
Definition: structs.h:877
struct FiLeInDeX FILEINDEX
UBYTE * argnames
Definition: structs.h:770
struct PeRmUtE PERM
WORD * flags
Definition: structs.h:347
WORD nfunctions
Definition: structs.h:107
LONG clearnodefill
Definition: structs.h:268
int handle
Definition: structs.h:646
int handle
Definition: structs.h:941
UBYTE ** LabelNames
Definition: structs.h:1529
VARRENUM symb
Definition: structs.h:180
LONG * CanCommu
Definition: structs.h:914
char * CheckpointRunAfter
Definition: structs.h:1544
struct TaBlEs * TABLES
WORD commute
Definition: structs.h:465
struct FixedGlobals FIXEDGLOBALS
int * Labels
Definition: structs.h:1533
UWORD * modpowers
Definition: structs.h:1519
WORD * funnum
Definition: structs.h:188
WORD * lo
Definition: structs.h:167
WORD gShortStatsMax
Definition: structs.h:1389