FORM v5.0.0-35-g6318119
structs.h
Go to the documentation of this file.
1
17/* #[ License : */
18/*
19 * Copyright (C) 1984-2026 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/*
52 #[ sav&store :
53*/
54
59typedef struct PoSiTiOn {
60 off_t p1;
61} POSITION;
62
63/* Next are the index structs for stored and saved expressions */
64
75typedef struct {
76 UBYTE headermark[8];
78 UBYTE lenWORD;
79 UBYTE lenLONG;
80 UBYTE lenPOS;
81 UBYTE lenPOINTER;
82 UBYTE endianness[16];
83 UBYTE sSym;
84 UBYTE sInd;
85 UBYTE sVec;
86 UBYTE sFun;
87 UBYTE maxpower[16];
88 UBYTE wildoffset[16];
89 UBYTE revision;
90 UBYTE reserved[512-8-4-16-4-16-16-1];
92
93STATIC_ASSERT(sizeof(STOREHEADER) == 512);
94
112
118#define INFILEINDEX ((512-2*sizeof(POSITION))/sizeof(INDEXENTRY))
123#define EMPTYININDEX (512-2*sizeof(POSITION)-INFILEINDEX*sizeof(INDEXENTRY))
124
143
144STATIC_ASSERT(sizeof(FILEINDEX) == 512);
145
150typedef struct FiLeDaTa {
151 FILEINDEX Index;
152 POSITION Fill;
153 POSITION Position;
154 WORD Handle;
155 WORD dirtyflag;
156} FILEDATA;
157
164typedef struct VaRrEnUm {
165 WORD *start;
166 WORD *lo;
167 WORD *hi;
169
176typedef struct ReNuMbEr {
177 POSITION startposition;
178 /* First stage renumbering */
183 /* Second stage renumbering */
184 WORD *symnum;
185 WORD *indnum;
186 WORD *vecnum;
187 WORD *funnum;
189
190/*
191 #] sav&store :
192 #[ Variables :
193*/
194
202typedef struct {
203 void *lijst;
204 char *message;
205 int num;
206 int maxnum;
207 int size;
211} LIST;
212
218typedef struct {
219 char *name;
220 TFUN func;
221 int type;
222 int flags;
223} KEYWORD;
224
230typedef struct {
231 char *name;
232 int *var;
233 int type;
234 int flags;
235} KEYWORDV;
236
243typedef struct NaMeNode {
244 LONG name;
245 WORD parent;
246 WORD left;
247 WORD right;
248 WORD balance;
249 WORD type;
250 WORD number;
252
279
288typedef struct tree {
289 int parent;
290 int left;
291 int right;
292 int value;
293 int blnce;
294 int usage;
296
301typedef struct MiNmAx {
302 WORD mini;
303 WORD maxi;
304 WORD size;
305} MINMAX;
306
311typedef struct BrAcKeTiNdEx { /* For indexing brackets in local expressions */
312 POSITION start; /* Place where bracket starts - start of expr */
313 POSITION next; /* Place of next indexed bracket in expr */
314 LONG bracket; /* Offset of position in bracketbuffer */
315 LONG termsinbracket;
317
322typedef struct BrAcKeTiNfO {
325 LONG bracketbuffersize;
326 LONG indexbuffersize;
327 LONG bracketfill;
328 LONG indexfill;
329 WORD SortType;
331
342typedef struct TaBlEs {
344#ifdef WITHPTHREADS
345 WORD **prototype;
346 WORD **pattern;
347#else
348 WORD *prototype;
349 WORD *pattern;
350#endif
352 WORD *flags;
354 UBYTE *argtail;
356 struct TaBlEs *spare;
357 WORD *buffers;
358 LONG totind;
359 LONG reserved;
360 LONG defined;
361 LONG mdefined;
363 int numind;
364 int bounds;
365 int strict;
366 int sparse;
370 WORD bufnum;
373 WORD tablenum;
374 WORD mode;
375 WORD numdummies;
377
382typedef struct ExPrEsSiOn {
383 POSITION onfile;
384 POSITION prototype;
385 POSITION size;
386 RENUMBER renum; /* For Renumbering of global stored expressions */
387 BRACKETINFO *bracketinfo;
388 BRACKETINFO *newbracketinfo;
391 WORD *inmem; /* If in memory like e.g. a polynomial */
392 LONG counter;
393 LONG name;
394 WORD hidelevel;
395 WORD vflags; /* Various flags */
396 WORD printflag;
397 WORD status;
398 WORD replace;
399 WORD node;
400 WORD whichbuffer;
401 WORD namesize;
402 WORD compression;
403 WORD numdummies;
404 WORD numfactors;
405 WORD sizeprototype;
406 WORD uflags; /* User flags */
407#ifdef PARALLELCODE
408 WORD partodo; /* Whether to be done in parallel mode */
409#endif
410} *EXPRESSIONS;
411
416typedef struct SyMbOl { /* Don't change unless altering .sav too */
417 LONG name; /* Location in names buffer */
418 WORD minpower; /* Minimum power admissible */
419 WORD maxpower; /* Maximum power admissible */
420 WORD complex; /* Properties wrt complex conjugation */
421 WORD number; /* Number when stored in file */
422 WORD flags; /* Used to indicate usage when storing */
423 WORD node;
424 WORD namesize;
425 WORD dimension; /* For dimensionality checks */
426#if BITSINWORD == 32
427 UBYTE d_u_m_m_y[8]; /* Padding for sav compatibility */
428#elif BITSINWORD == 16
429 UBYTE d_u_m_m_y[4]; /* Padding for sav compatibility */
430#endif
431} *SYMBOLS;
432#if BITSINWORD == 32
433STATIC_ASSERT(sizeof(struct SyMbOl) == 48);
434#elif BITSINWORD == 16
435STATIC_ASSERT(sizeof(struct SyMbOl) == 24);
436#endif
437
442typedef struct InDeX { /* Don't change unless altering .sav too */
443 LONG name; /* Location in names buffer */
444 WORD type; /* Regular or dummy */
445 WORD dimension; /* Value of d_(n,n) or -number of symbol */
446 WORD number; /* Number when stored in file */
447 WORD flags; /* Used to indicate usage when storing */
448 WORD nmin4; /* Used for n-4 if dimension < 0 */
449 WORD node;
450 WORD namesize;
451} *INDICES;
452#if BITSINWORD == 32
453STATIC_ASSERT(sizeof(struct InDeX) == 40);
454#elif BITSINWORD == 16
455STATIC_ASSERT(sizeof(struct InDeX) == 20);
456#endif
457
462typedef struct VeCtOr { /* Don't change unless altering .sav too */
463 LONG name; /* Location in names buffer */
464 WORD complex; /* Properties under complex conjugation */
465 WORD number; /* Number when stored in file */
466 WORD flags; /* Used to indicate usage when storing */
467 WORD node;
468 WORD namesize;
469 WORD dimension; /* For dimensionality checks */
470#if BITSINWORD == 32
471 UBYTE d_u_m_m_y[8]; /* Padding for sav compatibility */
472#elif BITSINWORD == 16
473 UBYTE d_u_m_m_y[4]; /* Padding for sav compatibility */
474#endif
475} *VECTORS;
476#if BITSINWORD == 32
477STATIC_ASSERT(sizeof(struct VeCtOr) == 40);
478#elif BITSINWORD == 16
479STATIC_ASSERT(sizeof(struct VeCtOr) == 20);
480#endif
481
487typedef struct FuNcTiOn { /* Don't change unless altering .sav too */
489 LONG symminfo;
490 LONG name;
491 WORD commute;
492 WORD complex;
493 WORD number;
494 WORD flags;
495 WORD spec;
497 WORD node;
498 WORD namesize;
499 WORD dimension; /* For dimensionality checks */
500 WORD maxnumargs;
501 WORD minnumargs;
503#if BITSINWORD == 32
504STATIC_ASSERT(sizeof(struct FuNcTiOn) == 72);
505#elif BITSINWORD == 16
506STATIC_ASSERT(sizeof(struct FuNcTiOn) == 36);
507#endif
508
513typedef struct SeTs {
514 LONG name; /* Location in names buffer */
515 WORD type; /* Symbol, vector, index or function */
516 WORD first; /* First element in setstore */
517 WORD last; /* Last element in setstore (excluding) */
518 WORD node;
519 WORD namesize;
520 WORD dimension; /* For dimensionality checks */
521 WORD flags; /* Like: ordered */
522} *SETS;
523
528typedef struct DuBiOuS { /* Undeclared objects. Just for compiler. */
529 LONG name; /* Location in names buffer */
530 WORD node;
531 WORD dummy;
532} *DUBIOUSV;
533
534typedef struct FaCdOlLaR {
535 WORD *where; /* A pointer(!) to the content */
536 LONG size;
537 WORD type; /* Type can be DOLNUMBER or DOLTERMS */
538 WORD value; /* in case it is a (short) number */
539} FACDOLLAR;
540
541typedef struct DoLlArS {
542 WORD *where; /* A pointer(!) to the object */
543 FACDOLLAR *factors; /* an array of factors. nfactors elements */
544#ifdef WITHPTHREADS
545 pthread_mutex_t pthreadslock;
546#endif
547 LONG size; /* The number of words */
548 LONG name;
549 WORD type;
550 WORD node;
551 WORD index;
552 WORD zero;
553 WORD numdummies;
554 WORD nfactors;
555} *DOLLARS;
556
561typedef struct MoDoPtDoLlArS {
562#ifdef WITHPTHREADS
563 DOLLARS dstruct; /* If local dollar: list of DOLLARS for each thread */
564#endif
565 WORD number;
566 WORD type;
568
573typedef struct fixedset {
574 char *name;
575 char *description;
576 int type;
577 int dimension;
578} FIXEDSET;
579
584typedef struct TaBlEbAsEsUbInDeX {
585 POSITION where;
586 LONG size;
588
593typedef struct TaBlEbAsE {
594 POSITION fillpoint;
595 POSITION current;
596 UBYTE *name;
597 int *tablenumbers; /* Number of each table */
598 TABLEBASESUBINDEX *subindex; /* For each table */
599 int numtables;
600} TABLEBASE;
601
608typedef struct {
609 WORD *location;
610 int numargs;
611 int numfunnies;
612 int numwildcards;
613 int symmet;
614 int tensor;
615 int commute;
616} FUN_INFO;
617
618typedef struct PaRtIcLe {
619 WORD number; /* Number of the function */
620 WORD spin; /* +/- dimension of SU(2) representation */
621 WORD mass; /* Number of symbol or 0 */
622 WORD type; /* -1: anti particle, 1: particle, 0: own antiparticle */
623} PARTICLE;
624
625typedef struct VeRtEx {
626 PARTICLE particles[MAXPARTICLES];
627 WORD couplings[2*MAXCOUPLINGS];
628 WORD nparticles;
629 WORD ncouplings;
630 WORD type;
631 WORD error;
632 WORD externonly;
633 WORD spare;
634} VERTEX;
635
636typedef struct MoDeL {
637 VERTEX **vertices;
638 WORD *couplings;
639 UBYTE *name;
640 void *grccmodel;
641 WORD legcouple[MAXLEGS+2];
642 WORD nparticles;
643 WORD nvertices;
644 WORD invertices;
645 WORD sizevertices;
646 WORD sizecouplings;
647 WORD ncouplings;
648 WORD error;
649 WORD dummy;
650} MODEL;
651
652/*
653 * The struct NAMESPACE is used for the namespace info. It is a
654 * doubly linked list of nested namespaces.
655 */
656
657typedef struct NaMeSpAcE {
658 struct NaMeSpAcE *previous;
659 struct NaMeSpAcE *next;
660 NAMETREE *usenames;
661 UBYTE *name;
662} NAMESPACE;
663
664
665/*
666 #] Variables :
667 #[ Files :
668*/
669
681typedef struct FiLe {
682 POSITION POposition; /* File position */
683 POSITION filesize; /* Because SEEK_END is unsafe on IBM */
684 WORD *PObuffer; /* Address of the intermediate buffer */
685 WORD *POstop; /* End of the buffer */
686 WORD *POfill; /* Fill position of the buffer */
687 WORD *POfull; /* Full buffer when only cached */
688#ifdef WITHPTHREADS
689 WORD *wPObuffer; /* Address of the intermediate worker buffer */
690 WORD *wPOstop; /* End of the worker buffer */
691 WORD *wPOfill; /* Fill position of the worker buffer */
692 WORD *wPOfull; /* Full buffer when only worker cached */
693#endif
694 char *name; /* name of the file */
695#ifdef WITHZLIB
696 z_streamp zsp; /* The pointer to the stream struct for gzip */
697 Bytef *ziobuffer; /* The output buffer for compression */
698#endif
699 ULONG numblocks; /* Number of blocks in file */
700 ULONG inbuffer; /* Block in the buffer */
701 LONG POsize; /* size of the buffer */
702#ifdef WITHZLIB
703 LONG ziosize; /* size of the zoutbuffer */
704#endif
705#ifdef WITHPTHREADS
706 LONG wPOsize; /* size of the worker buffer */
707 pthread_mutex_t pthreadslock;
708#endif
709 int handle;
710 int active; /* File is open or closed. Not used. */
712
722typedef struct StreaM {
723 off_t fileposition;
724 off_t linenumber;
725 off_t prevline;
726 UBYTE *buffer;
727 UBYTE *pointer;
728 UBYTE *top;
729 UBYTE *FoldName;
730 UBYTE *name;
731 UBYTE *pname;
733 LONG buffersize;
734 LONG bufferposition;
735 LONG inbuffer;
736 int previous;
737 int handle;
738 int type;
739 int prevars;
740 int previousNoShowInput;
741 int eqnum;
742 int afterwards;
743 int olddelay;
744 int oldnoshowinput;
745 UBYTE isnextchar;
746 UBYTE nextchar[2];
747 UBYTE reserved;
749
750typedef struct SpecTatoR {
751 POSITION position; /* The place where we will be writing */
752 POSITION readpos; /* The place from which we read */
753 FILEHANDLE *fh;
754 char *name; /* We identify the spectator by the name of the expression */
755 WORD exprnumber; /* During running we use the number. */
756 WORD flags; /* local, global? */
757} SPECTATOR;
758
759/*
760 #] Files :
761 #[ Traces :
762*/
763
773typedef struct TrAcEs { /* For computing 4 dimensional traces */
774 WORD *accu; /* NUMBER * 2 */
775 WORD *accup;
776 WORD *termp;
777 WORD *perm; /* number */
778 WORD *inlist; /* number */
779 WORD *nt3; /* number/2 */
780 WORD *nt4; /* number/2 */
781 WORD *j3; /* number*2 */
782 WORD *j4; /* number*2 */
783 WORD *e3; /* number*2 */
784 WORD *e4; /* number */
785 WORD *eers; /* number/2 */
786 WORD *mepf; /* number/2 */
787 WORD *mdel; /* number/2 */
788 WORD *pepf; /* number*2 */
789 WORD *pdel; /* number*3/2 */
790 WORD sgn;
791 WORD stap;
792 WORD step1,kstep,mdum;
793 WORD gamm,ad,a3,a4,lc3,lc4;
794 WORD sign1,sign2,gamma5,num,level,factor,allsign;
795 WORD finalstep;
797
805typedef struct TrAcEn { /* For computing n dimensional traces */
806 WORD *accu; /* NUMBER */
807 WORD *accup;
808 WORD *termp;
809 WORD *perm; /* number */
810 WORD *inlist; /* number */
811 WORD sgn,num,level,factor,allsign;
813
814/*
815 #] Traces :
816 #[ Preprocessor :
817*/
818
823typedef struct pReVaR {
824 UBYTE *name;
825 UBYTE *value;
826 UBYTE *argnames;
827 int nargs;
830
835typedef struct {
836 WORD *buffer;
837 int oldcompiletype;
838 int oldparallelflag;
839 int oldnumpotmoddollars;
840 WORD size;
841 WORD numdollars;
842 WORD oldcbuf;
843 WORD oldrbuf;
844 WORD inscbuf;
845 WORD oldcnumlhs;
846} INSIDEINFO;
847
853typedef struct {
854 UBYTE *buffer;
855 LONG size;
856} PRELOAD;
857
862typedef struct {
863 PRELOAD p;
864 UBYTE *name;
865 int loadmode;
866 int mustfree;
867} PROCEDURE;
868
876typedef struct DoLoOp {
878 UBYTE *name;
879 UBYTE *vars; /* for {} or name of expression */
880 UBYTE *contents;
881 UBYTE *dollarname;
882 LONG startlinenumber;
883 LONG firstnum;
884 LONG lastnum;
885 LONG incnum;
886 int type;
887 int NoShowInput;
888 int errorsinloop;
889 int firstloopcall;
890 WORD firstdollar; /* When >= 0 we have to get the value from a dollar */
891 WORD lastdollar; /* When >= 0 we have to get the value from a dollar */
892 WORD incdollar; /* When >= 0 we have to get the value from a dollar */
893 WORD NumPreTypes;
894 WORD PreIfLevel;
895 WORD PreSwitchLevel;
897
905struct bit_field { /* Assume 8 bits per byte */
906 UBYTE bit_0 : 1;
907 UBYTE bit_1 : 1;
908 UBYTE bit_2 : 1;
909 UBYTE bit_3 : 1;
910 UBYTE bit_4 : 1;
911 UBYTE bit_5 : 1;
912 UBYTE bit_6 : 1;
913 UBYTE bit_7 : 1;
914/*
915 UINT bit_0 : 1;
916 UINT bit_1 : 1;
917 UINT bit_2 : 1;
918 UINT bit_3 : 1;
919 UINT bit_4 : 1;
920 UINT bit_5 : 1;
921 UINT bit_6 : 1;
922 UINT bit_7 : 1;
923*/
924};
925
930typedef struct bit_field set_of_char[32];
931
936typedef struct bit_field *one_byte;
937
942typedef struct {
943 WORD newlogonly;
944 WORD newhandle;
945 WORD oldhandle;
946 WORD oldlogonly;
947 WORD oldprinttype;
948 WORD oldsilent;
949} HANDLERS;
950
951/*
952 #] Preprocessor :
953 #[ Varia :
954*/
955
956typedef int (*FINISHUFFLE)(WORD *);
957typedef int (*DO_UFFLE)(WORD *,WORD,WORD,WORD);
958
959#ifdef WITHPTHREADS
960typedef WORD (*COMPAREDUMMY)(void *,WORD *,WORD *,WORD);
961#else
962typedef WORD (*COMPAREDUMMY)(WORD *,WORD *,WORD);
963#endif
964
970typedef struct CbUf {
971 WORD *Buffer;
972 WORD *Top;
973 WORD *Pointer;
974 WORD **lhs;
975 WORD **rhs;
976 LONG *CanCommu;
977 LONG *NumTerms;
978 WORD *numdum;
979 WORD *dimension;
982 int numlhs;
983 int numrhs;
984 int maxlhs;
985 int maxrhs;
986 int mnumlhs;
987 int mnumrhs;
988 int numtree;
989 int rootnum;
990 int MaxTreeSize;
992
1000typedef struct ChAnNeL {
1001 char *name;
1004
1014typedef struct {
1015 UBYTE *parameter;
1016 int type;
1017 int flags;
1018 // This ordering is assumed by initializer lists in many places. In this
1019 // case the struct should anyway not have additional padding between the
1020 // two int and the LONG members.
1021 LONG value;
1023
1032typedef struct NeStInG {
1033 WORD *termsize;
1034 WORD *funsize;
1035 WORD *argsize;
1037
1044typedef struct StOrEcAcHe {
1045 POSITION position;
1046 POSITION toppos;
1047 struct StOrEcAcHe *next;
1048 WORD buffer[2];
1050
1056typedef struct PeRmUtE {
1057 WORD *objects;
1058 WORD sign;
1059 WORD n;
1060 WORD cycle[MAXMATCH];
1062
1067typedef struct PeRmUtEp {
1068 WORD **objects;
1069 WORD sign;
1070 WORD n;
1071 WORD cycle[MAXMATCH];
1073
1079typedef struct DiStRiBuTe {
1080 WORD *obj1;
1081 WORD *obj2;
1082 WORD *out;
1083 WORD sign;
1084 WORD n1;
1085 WORD n2;
1086 WORD n;
1087 WORD cycle[MAXMATCH];
1089
1095typedef struct PaRtI {
1096 WORD *psize; /* the sizes of the partitions */
1097 WORD *args; /* the offsets of the arguments to be partitioned */
1098 WORD *nargs; /* argument numbers (different number = different argument) */
1099 WORD *nfun; /* the functions into which the partitions go */
1100 WORD numargs; /* the number of arguments to be partitioned */
1101 WORD numpart; /* the number of partitions */
1102 WORD where; /* offset of the function in the term */
1104
1114typedef struct sOrT {
1115 FILEHANDLE file; /* The own sort file */
1116 POSITION SizeInFile[3]; /* Sizes in the various files */
1117 WORD *lBuffer; /* The large buffer */
1118 WORD *lTop; /* End of the large buffer */
1119 WORD *lFill; /* The filling point of the large buffer */
1120 WORD *used; /* auxiliary during actual sort */
1121 WORD *sBuffer; /* The small buffer */
1122 WORD *sTop; /* End of the small buffer */
1123 WORD *sTop2; /* End of the extension of the small buffer */
1124 WORD *sHalf; /* Halfway point in the extension */
1125 WORD *sFill; /* Filling point in the small buffer */
1126 WORD **sPointer; /* Pointers to terms in the small buffer */
1127 WORD **PoinFill; /* Filling point for pointers to the sm.buf */
1128 WORD *cBuffer; /* Compress buffer (if it exists) */
1129 WORD **Patches; /* Positions of patches in large buffer */
1130 WORD **pStop; /* Ends of patches in the large buffer */
1131 WORD **poina; /* auxiliary during actual sort */
1132 WORD **poin2a; /* auxiliary during actual sort */
1133 WORD *ktoi; /* auxiliary during actual sort */
1134 WORD *tree; /* auxiliary during actual sort */
1135#ifdef WITHZLIB
1136 WORD *fpcompressed; /* is output filepatch compressed? */
1137 WORD *fpincompressed; /* is input filepatch compressed? */
1138 z_streamp zsparray; /* the array of zstreams for decompression */
1139#endif
1140 POSITION *fPatches; /* Positions of output file patches */
1141 POSITION *inPatches; /* Positions of input file patches */
1142 POSITION *fPatchesStop; /* Positions of output file patches */
1143 POSITION *iPatches; /* Input file patches, Points to fPatches or inPatches */
1144 FILEHANDLE *f; /* The actual output file */
1145 FILEHANDLE **ff; /* Handles for a staged sort */
1146 LONG sTerms; /* Terms in small buffer */
1147 LONG LargeSize; /* Size of large buffer (in words) */
1148 LONG SmallSize; /* Size of small buffer (in words) */
1149 LONG SmallEsize; /* Size of small + extension (in words) */
1150 LONG TermsInSmall; /* Maximum number of terms in small buffer */
1151 LONG Terms2InSmall; /* with extension for polyfuns etc. */
1152 LONG GenTerms; /* Number of generated terms */
1153 LONG TermsLeft; /* Number of terms still in existence */
1154 LONG GenSpace; /* Amount of space of generated terms */
1155 LONG SpaceLeft; /* Space needed for still existing terms */
1156 LONG putinsize; /* Size of buffer in putin */
1157 LONG ninterms; /* Which input term ? */
1158 LONG verbComparisons; /* Counters for "On SortVerbose;" statistics */
1159 LONG verbSBsortTerms;
1160 LONG verbSBsortCap;
1161 LONG verbLBsortPatches;
1162 LONG verbLBsortCap;
1163 LONG verbUnsortedSize;
1164 int MaxPatches; /* Maximum number of patches in large buffer */
1165 int MaxFpatches; /* Maximum number of patches in one filesort */
1166 int type; /* Main, function or sub(routine) */
1167 int lPatch; /* Number of patches in the large buffer */
1168 int fPatchN1; /* Number of patches in input file */
1169 int PolyWise; /* Is there a polyfun and if so, where? */
1170 int PolyFlag; /* */
1171 int cBufferSize; /* Size of the compress buffer */
1172 int maxtermsize; /* Keeps track for buffer allocations */
1173 int newmaxtermsize; /* Auxiliary for maxtermsize */
1174 int outputmode; /* Tells where the output is going */
1175 int stagelevel; /* In case we have a 'staged' sort */
1176 WORD fPatchN; /* Number of patches on file (output) */
1177 WORD inNum; /* Number of patches on file (input) */
1178 WORD stage4; /* Are we using stage4? */
1180
1181#ifdef WITHPTHREADS
1182
1188typedef struct SoRtBlOcK {
1189 pthread_mutex_t *MasterBlockLock;
1190 WORD **MasterStart;
1191 WORD **MasterFill;
1192 WORD **MasterStop;
1193 LONG *BlockTerms;
1194 int MasterNumBlocks;
1195 int MasterBlock;
1196 int FillBlock;
1197} SORTBLOCK;
1198#endif
1199
1200#ifdef DEBUGGER
1201typedef struct DeBuGgInG {
1202 int eflag;
1203 int printflag;
1204 int logfileflag;
1205 int stdoutflag;
1206} DEBUGSTR;
1207#endif
1208
1209#ifdef WITHPTHREADS
1210
1216typedef struct ThReAdBuCkEt {
1217 POSITION *deferbuffer; /* For Keep Brackets: remember position */
1218 WORD *threadbuffer; /* Here are the (primary) terms */
1219 WORD *compressbuffer; /* For keep brackets we need the compressbuffer */
1220 LONG threadbuffersize; /* Number of words in threadbuffer */
1221 LONG ddterms; /* Number of primary+secondary terms represented */
1222 LONG firstterm; /* The number of the first term in the bucket */
1223 LONG firstbracket; /* When doing complete brackets */
1224 LONG lastbracket; /* When doing complete brackets */
1225 pthread_mutex_t lock; /* For the load balancing phase */
1226 int free; /* Status of the bucket */
1227 int totnum; /* Total number of primary terms */
1228 int usenum; /* Which is the term being used at the moment */
1229 int busy; /* */
1230 int type; /* Doing brackets? */
1231} THREADBUCKET;
1232
1233#endif
1234
1242typedef struct {
1243 WORD *coefs; /* The array of coefficients */
1244 WORD numsym; /* The number of the symbol in the polynomial */
1245 WORD arraysize; /* The size of the allocation of coefs */
1246 WORD polysize; /* The maximum power in the polynomial */
1247 WORD modnum; /* The prime number of the modulus */
1248} POLYMOD;
1249
1250typedef struct {
1251 WORD *outterm; /* Used in DoShuffle/Merge/FinishShuffle system */
1252 WORD *outfun;
1253 WORD *incoef;
1254 WORD *stop1;
1255 WORD *stop2;
1256 WORD *ststop1;
1257 WORD *ststop2;
1258 FINISHUFFLE finishuf;
1259 DO_UFFLE do_uffle;
1260 LONG combilast;
1261 WORD nincoef;
1262 WORD level;
1263 WORD thefunction;
1264 WORD option;
1265} SHvariables;
1266
1267typedef struct { /* Used for computing calculational cost in optim.c */
1268 LONG add;
1269 LONG mul;
1270 LONG div;
1271 LONG pow;
1272} COST;
1273
1274typedef struct {
1275 UWORD *a; /* The number array */
1276 UWORD *m; /* The modulus array */
1277 WORD na; /* Size of the number */
1278 WORD nm; /* size of the number in the modulus array */
1279} MODNUM;
1280
1281/*
1282 Struct for optimizing outputs. If changed, do not forget to change
1283 the padding information in the AO struct.
1284*/
1285typedef struct {
1286 union { /* we do this to allow padding */
1287 float fval;
1288 int ival[2]; /* This should be enough */
1289 } mctsconstant;
1290 int horner;
1291 int hornerdirection;
1292 int method;
1293 int mctstimelimit;
1294 int mctsnumexpand;
1295 int mctsnumkeep;
1296 int mctsnumrepeat;
1297 int greedytimelimit;
1298 int greedyminnum;
1299 int greedymaxperc;
1300 int printstats;
1301 int debugflags;
1302 int schemeflags;
1303 int mctsdecaymode;
1304 int saIter; /* Simulated annealing updates */
1305 union {
1306 float fval;
1307 int ival[2];
1308 } saMaxT; /* Maximum temperature of SA */
1309 union {
1310 float fval;
1311 int ival[2];
1312 } saMinT; /* Minimum temperature of SA */
1313 int spare;
1314} OPTIMIZE;
1315
1316typedef struct {
1317 WORD *code;
1318 UBYTE *nameofexpr; /* It is easier to remember an expression by name */
1319 LONG codesize; /* We need this for the checkpoints */
1320 WORD exprnr; /* Problem here is: we renumber them in execute.c */
1321 WORD minvar;
1322 WORD maxvar;
1324
1325typedef struct {
1326 WORD *lhs; /* Object to be replaced */
1327 WORD *rhs; /* Depending on the type it will be UBYTE* or WORD* */
1328 int type;
1329 int size; /* Size of the lhs */
1331
1332typedef struct {
1333 DICTIONARY_ELEMENT **elements;
1334 UBYTE *name;
1335 int sizeelements;
1336 int numelements;
1337 int numbers; /* deal with numbers */
1338 int variables; /* deal with single variables */
1339 int characters; /* deal with special characters */
1340 int funwith; /* deal with functions with arguments */
1341 int gnumelements; /* if .global shrinks the dictionary */
1342 int ranges;
1343} DICTIONARY;
1344
1345typedef struct {
1346 WORD ncase;
1347 WORD value;
1348 WORD compbuffer;
1349} SWITCHTABLE;
1350
1351typedef struct {
1352 SWITCHTABLE *table;
1353 SWITCHTABLE defaultcase;
1354 SWITCHTABLE endswitch;
1355 WORD typetable;
1356 WORD maxcase;
1357 WORD mincase;
1358 WORD numcases;
1359 WORD tablesize;
1360 WORD caseoffset;
1361 WORD iflevel;
1362 WORD whilelevel;
1363 WORD nestingsum;
1364 WORD padding;
1365} SWITCH;
1366
1367typedef struct {
1368 WORD *term;
1369 void *currentModel;
1370 void *currentMODEL;
1371 WORD *legcouple[MAXLEGS+1];
1372 LONG numtopo;
1373 LONG numdia;
1374 WORD diaoffset;
1375 WORD level;
1376 WORD externalset;
1377 WORD internalset;
1378 WORD numextern;
1379 WORD flags;
1380} TERMINFO;
1381
1382/*
1383 Struct to hold temporary data in Normalize, so that it is not allocated
1384 on the stack each function call. The sizes of these arrays introduces a
1385 maximum complexity of terms which can be normalized. Each array is
1386 allocated dynamically, by AllocNormData, such that valgrind can detect
1387 errors if they are over-run.
1388*/
1389typedef struct NoRmDaTa {
1390 WORD *psym;
1391 WORD *pvec;
1392 WORD *pdot;
1393 WORD *pdel;
1394 WORD *pind;
1395 WORD **peps;
1396 WORD **pden;
1397 WORD **pcom;
1398 WORD **pnco;
1399 WORD **pcon;
1400} NORMDATA;
1401
1402/*
1403 #] Varia :
1404 #[ A :
1405 #[ M : The M struct is for global settings at startup or .clear
1406*/
1407
1415struct M_const {
1416 POSITION zeropos; /* (M) is zero */
1418 UWORD *gcmod;
1419 UWORD *gpowmod;
1420 UBYTE *TempDir; /* (M) Path with where the temporary files go */
1421 UBYTE *TempSortDir; /* (M) Path with where the sort files go */
1422 UBYTE *IncDir; /* (M) Directory path for include files */
1423 UBYTE *InputFileName; /* (M) */
1424 UBYTE *LogFileName; /* (M) */
1425 UBYTE *OutBuffer; /* (M) Output buffer in pre.c */
1426 UBYTE *Path; /* (M) */
1427 UBYTE *SetupDir; /* (M) Directory with setup file */
1428 UBYTE *SetupFile; /* (M) Name of setup file */
1429 UBYTE *gFortran90Kind;
1430 UBYTE *gextrasym;
1431 UBYTE *ggextrasym;
1432 UBYTE *oldnumextrasymbols;
1433 SPECTATOR *SpectatorFiles;
1434#ifdef WITHPTHREADS
1435 pthread_rwlock_t handlelock; /* (M) */
1436 pthread_mutex_t storefilelock; /* (M) */
1437 pthread_mutex_t sbuflock; /* (M) Lock for writing in the AM.sbuffer */
1438 LONG ThreadScratSize; /* (M) Size of Fscr[0/2] buffers of the workers */
1439 LONG ThreadScratOutSize; /* (M) Size of Fscr[1] buffers of the workers */
1440#endif
1441 LONG MaxTer; /* (M) Maximum term size. Fixed at setup. In Bytes!!!*/
1442 LONG CompressSize; /* (M) Size of Compress buffer */
1443 LONG ScratSize; /* (M) Size of Fscr[] buffers */
1444 LONG HideSize; /* (M) Size of Fscr[2] buffer */
1445 LONG SizeStoreCache; /* (M) Size of the caches for reading global expr. */
1446 LONG MaxStreamSize; /* (M) Maximum buffer size in reading streams */
1447 LONG SIOsize; /* (M) Sort InputOutput buffer size */
1448 LONG SLargeSize; /* (M) */
1449 LONG SSmallEsize; /* (M) */
1450 LONG SSmallSize; /* (M) */
1451 LONG STermsInSmall; /* (M) */
1452 LONG MaxBracketBufferSize; /* (M) Max Size for B+ or AB+ per expression */
1453 LONG hProcessBucketSize; /* (M) */
1454 LONG gProcessBucketSize; /* (M) */
1455 LONG shmWinSize; /* (M) size for shared memory window used in communications */
1456 LONG OldChildTime; /* (M) Zero time. Needed in timer. */
1457 LONG OldSecTime; /* (M) Zero time for measuring wall clock time */
1458 LONG OldMilliTime; /* (M) Same, but milli seconds */
1459 LONG WorkSize; /* (M) Size of WorkSpace */
1460 LONG gThreadBucketSize; /* (C) */
1461 LONG ggThreadBucketSize; /* (C) */
1462 LONG SumTime; /* Used in .clear */
1463 LONG SpectatorSize; /* Size of the buffer in bytes */
1464 LONG TimeLimit; /* Limit in sec to the total real time */
1465#ifdef WITHFLOAT
1466 LONG gDefaultPrecision; /* (M) Default precision in bits for float_ */
1467 LONG gMaxWeight; /* (M) Maximum weight for MZV or Euler */
1468 LONG ggDefaultPrecision; /* (M) Default precision in bits for float_ */
1469 LONG ggMaxWeight; /* (M) Maximum weight for MZV or Euler */
1470#endif
1471 int FileOnlyFlag; /* (M) Writing only to file */
1472 int Interact; /* (M) Interactive mode flag */
1473 int MaxParLevel; /* (M) Maximum nesting of parentheses */
1474 int OutBufSize; /* (M) size of OutBuffer */
1475 int SMaxFpatches; /* (M) */
1476 int SMaxPatches; /* (M) */
1477 int StdOut; /* (M) Regular output channel */
1478 int ginsidefirst; /* (M) Not used yet */
1479 int gDefDim; /* (M) */
1480 int gDefDim4; /* (M) */
1481 int NumFixedSets; /* (M) Number of the predefined sets */
1482 int NumFixedFunctions; /* (M) Number of built in functions */
1483 int rbufnum; /* (M) startup compiler buffer */
1484 int dbufnum; /* (M) dollar variables */
1485 int sbufnum; /* (M) subterm variables */
1486 int zbufnum; /* (M) special values */
1487 int SkipClears; /* (M) Number of .clear to skip at start */
1488 int gTokensWriteFlag; /* (M) */
1489 int gfunpowers; /* (M) */
1490 int gStatsFlag; /* (M) */
1491 int gNamesFlag; /* (M) */
1492 int gCodesFlag; /* (M) */
1493 int gSortType; /* (M) */
1494 int gproperorderflag; /* (M) */
1495 int hparallelflag; /* (M) */
1496 int gparallelflag; /* (M) */
1497 int totalnumberofthreads; /* (M) */
1498 int gSizeCommuteInSet;
1499 int gThreadStats;
1500 int ggThreadStats;
1501 int gFinalStats;
1502 int ggFinalStats;
1503 int gThreadsFlag;
1504 int ggThreadsFlag;
1505 int gThreadBalancing;
1506 int ggThreadBalancing;
1507 int gThreadSortFileSynch;
1508 int ggThreadSortFileSynch;
1509 int gProcessStats;
1510 int ggProcessStats;
1511 int gOldParallelStats;
1512 int ggOldParallelStats;
1513 int maxFlevels; /* () maximum function levels */
1514 int resetTimeOnClear; /* (M) */
1515 int gcNumDollars; /* () number of dollars for .clear */
1516 int MultiRun;
1517 int gNoSpacesInNumbers; /* For very long numbers */
1518 int ggNoSpacesInNumbers; /* For very long numbers */
1519 int gIsFortran90;
1520 int PrintTotalSize;
1521 int fbuffersize; /* Size for the AT.fbufnum factorization caches */
1522 int gOldFactArgFlag;
1523 int ggOldFactArgFlag;
1524 int gnumextrasym;
1525 int ggnumextrasym;
1526 int NumSpectatorFiles; /* Elements used in AM.spectatorfiles; */
1527 int SizeForSpectatorFiles; /* Size in AM.spectatorfiles; */
1528 int gOldGCDflag;
1529 int ggOldGCDflag;
1530 int gWTimeStatsFlag;
1531 int ggWTimeStatsFlag;
1532 int jumpratio;
1533 WORD MaxTal; /* (M) Maximum number of words in a number */
1534 WORD IndDum; /* (M) Basis value for dummy indices */
1535 WORD DumInd; /* (M) */
1536 WORD WilInd; /* (M) Offset for wildcard indices */
1537 WORD gncmod; /* (M) Global setting of modulus. size of gcmod */
1538 WORD gnpowmod; /* (M) Global printing as powers. size gpowmod */
1539 WORD gmodmode; /* (M) Global mode for modulus */
1540 WORD gUnitTrace; /* (M) Global value of Tr[1] */
1541 WORD gOutputMode; /* (M) */
1542 WORD gOutputSpaces; /* (M) */
1543 WORD gOutNumberType; /* (M) */
1544 WORD gCnumpows; /* (M) */
1545 WORD gUniTrace[4]; /* (M) */
1546 WORD MaxWildcards; /* (M) Maximum number of wildcards */
1547 WORD mTraceDum; /* (M) Position/Offset for generated dummies */
1548 WORD OffsetIndex; /* (M) */
1549 WORD OffsetVector; /* (M) */
1550 WORD RepMax; /* (M) Max repeat levels */
1551 WORD LogType; /* (M) Type of writing to log file */
1552 WORD ggStatsFlag; /* (M) */
1553 WORD gLineLength; /* (M) */
1554 WORD qError; /* (M) Only error checking {-c option} */
1555 WORD FortranCont; /* (M) Fortran Continuation character */
1556 WORD HoldFlag; /* (M) Exit on termination? */
1557 WORD Ordering[15]; /* (M) Auxiliary for ordering wildcards */
1558 WORD silent; /* (M) Silent flag. Only results in output. */
1559 WORD tracebackflag; /* (M) For tracing errors */
1560 WORD expnum; /* (M) internal number of ^ function */
1561 WORD denomnum; /* (M) internal number of / function */
1562 WORD facnum; /* (M) internal number of fac_ function */
1563 WORD invfacnum; /* (M) internal number of invfac_ function */
1564 WORD sumnum; /* (M) internal number of sum_ function */
1565 WORD sumpnum; /* (M) internal number of sump_ function */
1566 WORD OldOrderFlag; /* (M) Flag for allowing old statement order */
1567 WORD termfunnum; /* (M) internal number of term_ function */
1568 WORD matchfunnum; /* (M) internal number of match_ function */
1569 WORD countfunnum; /* (M) internal number of count_ function */
1570 WORD gPolyFun; /* (M) global value of PolyFun */
1571 WORD gPolyFunInv; /* (M) global value of Inverse of PolyFun */
1572 WORD gPolyFunType; /* (M) global value of PolyFun */
1573 WORD gPolyFunExp;
1574 WORD gPolyFunVar;
1575 WORD gPolyFunPow;
1576 WORD dollarzero; /* (M) for dollars with zero value */
1577 WORD atstartup; /* To protect against DATE_ ending in \n */
1578 WORD exitflag; /* (R) For the exit statement */
1579 WORD NumStoreCaches; /* () Number of storage caches per processor */
1580 WORD gIndentSpace; /* For indentation in output */
1581 WORD ggIndentSpace;
1584 WORD gextrasymbols;
1585 WORD ggextrasymbols;
1586 WORD zerorhs;
1587 WORD onerhs;
1588 WORD havesortdir;
1589 WORD vectorzero; /* p0_ */
1590 WORD ClearStore;
1591 WORD BracketFactors[8];
1592 BOOL FromStdin; /* read the input from STDIN */
1593 BOOL IgnoreDeprecation; /* ignore deprecation warning */
1594};
1595/*
1596 #] M :
1597 #[ P : The P struct defines objects set by the preprocessor
1598*/
1606struct P_const {
1607 LIST DollarList; /* (R) Dollar variables. Contains pointers
1608 to contents of the variables.*/
1609 LIST PreVarList; /* (R) List of preprocessor variables
1610 Points to contents. Can be changed */
1611 LIST LoopList; /* (P) List of do loops */
1612 LIST ProcList; /* (P) List of procedures */
1613 INSIDEINFO inside; /* Information during #inside/#endinside */
1614 NAMESPACE *firstnamespace; /* is zero when no namespace specified */
1615 NAMESPACE *lastnamespace; /* is zero when no namespace specified */
1616 UBYTE *fullname; /* buffer for namespace expanded names */
1617 UBYTE **PreSwitchStrings; /* (P) The string in a switch */
1618 UBYTE *preStart; /* (P) Preprocessor instruction buffer */
1619 UBYTE *preStop; /* (P) end of preStart */
1620 UBYTE *preFill; /* (P) Filling point in preStart */
1621 UBYTE *procedureExtension; /* (P) Extension for procedure files (prc) */
1622 UBYTE *cprocedureExtension; /* (P) Extension after .clear */
1623 LONG *PreAssignStack; /* For nesting #$name assignments */
1624 int *PreIfStack; /* (P) Tracks nesting of #if */
1625 int *PreSwitchModes; /* (P) Stack of switch status */
1626 int *PreTypes; /* (P) stack of #call, #do etc nesting */
1627#ifdef WITHPTHREADS
1628 pthread_mutex_t PreVarLock; /* (P) */
1629#endif
1630 LONG StopWatchZero; /* For `timer_' and #reset timer */
1631 LONG InOutBuf; /* (P) Characters in the output buf in pre.c */
1632 LONG pSize; /* (P) size of preStart */
1633 int PreAssignFlag; /* (C) Indicates #assign -> catch dollar */
1634 int PreContinuation; /* (C) Indicates whether the statement is new */
1635 int PreproFlag; /* (P) Internal use to mark work on prepro instr. */
1636 int iBufError; /* (P) Flag for errors with input buffer */
1637 int PreOut; /* (P) Flag for #+ #- */
1638 int PreSwitchLevel; /* (P) Nesting of #switch */
1639 int NumPreSwitchStrings; /* (P) Size of PreSwitchStrings */
1640 int MaxPreTypes; /* (P) Size of PreTypes */
1641 int NumPreTypes; /* (P) Number of nesting objects in PreTypes */
1642 int MaxPreIfLevel; /* (C) Maximum number of nested #if. Dynamic */
1643 int PreIfLevel; /* (C) Current position if PreIfStack */
1644 int PreInsideLevel; /* (C) #inside active? */
1645 int DelayPrevar; /* (P) Delaying prevar substitution */
1646 int AllowDelay; /* (P) Allow delayed prevar substitution */
1647 int lhdollarerror; /* (R) */
1648 int eat; /* () */
1649 int gNumPre; /* (P) Number of preprocessor variables for .clear */
1650 int PreDebug; /* (C) */
1651 int OpenDictionary;
1652 int PreAssignLevel; /* For nesting #$name = ...; assignments */
1653 int MaxPreAssignLevel; /* For nesting #$name = ...; assignments */
1654 int fullnamesize; /* size of the fullname buffer */
1655 WORD DebugFlag; /* (P) For debugging purposes */
1656 WORD preError; /* (P) Blocks certain types of execution */
1657 UBYTE ComChar; /* (P) Commentary character */
1658 UBYTE cComChar; /* (P) Old commentary character for .clear */
1659};
1660
1661/*
1662 #] P :
1663 #[ C : The C struct defines objects changed by the compiler
1664*/
1665
1674struct C_const {
1676 POSITION StoreFileSize; /* () Size of store file */
1681 /* Later also for write? */
1694/*
1695 Compile buffer variables
1696*/
1698/*
1699 Objects for auto declarations
1700*/
1701 LIST AutoSymbolList; /* (C) */
1702 LIST AutoIndexList; /* (C) */
1703 LIST AutoVectorList; /* (C) */
1704 LIST AutoFunctionList; /* (C) */
1707 LIST *Symbols; /* (C) Pointer for autodeclare. Which list is
1708 it searching. Later also for subroutines */
1709 LIST *Indices; /* (C) id. */
1710 LIST *Vectors; /* (C) id. */
1711 LIST *Functions; /* (C) id. */
1712 NAMETREE **activenames;
1717 SWITCH *SwitchArray;
1718 MODEL **models;
1719 WORD *SwitchHeap;
1722 UWORD *cmod;
1723 UWORD *powmod;
1724 UWORD *modpowers;
1725 UWORD *halfmod; /* (C) half the modulus when not zero */
1726 WORD *ProtoType; /* (C) The subexpression prototype {wildcards} */
1727 WORD *WildC; /* (C) Filling point for wildcards. */
1728 LONG *IfHeap;
1729 LONG *IfCount;
1730 LONG *IfStack;
1731 UBYTE *iBuffer;
1732 UBYTE *iPointer;
1733 UBYTE *iStop;
1734 UBYTE **LabelNames;
1738 int *Labels;
1739 SBYTE *tokens;
1740 SBYTE *toptokens;
1743 UWORD *modinverses; /* Table for inverses of primes */
1744 UBYTE *Fortran90Kind; /* The kind of number in Fortran 90 as in _ki */
1745 WORD **MultiBracketBuf; /* Array of buffers for multi-level brackets */
1746 UBYTE *extrasym; /* Array with the name for extra symbols in ToPolynomial */
1747 WORD *doloopstack; /* To keep track of begin and end of doloops */
1748 WORD *doloopnest; /* To keep track of nesting of doloops etc */
1754 WORD *CommuteInSet; /* groups of noncommuting functions that can commute */
1755 UBYTE *TestValue; /* For debugging */
1756#ifdef PARALLELCODE
1757 LONG *inputnumbers;
1758 WORD *pfirstnum;
1759#endif
1760#ifdef WITHPTHREADS
1761 pthread_mutex_t halfmodlock; /* () Lock for adding buffer for halfmod */
1762#endif
1763 LONG argstack[MAXNEST]; /* (C) {contents} Stack for nesting of Argument */
1764 LONG insidestack[MAXNEST]; /* (C) {contents} Stack for Argument or Inside. */
1765 LONG inexprstack[MAXNEST]; /* (C) {contents} Stack for Argument or Inside. */
1766 LONG iBufferSize; /* (C) Size of the input buffer */
1767 LONG TransEname; /* (C) Used when a new definition overwrites
1768 an old expression. */
1769 LONG ProcessBucketSize; /* (C) */
1770 LONG mProcessBucketSize; /* (C) */
1771 LONG CModule; /* (C) Counter of current module */
1772 LONG ThreadBucketSize; /* (C) Roughly the maximum number of input terms */
1776#ifdef WITHFLOAT
1777 LONG DefaultPrecision; /* (C) Default precision in bits for float_ */
1778 LONG MaxWeight; /* (C) Maximum weight for MZV or Euler */
1779 LONG tDefaultPrecision; /* (C) Default precision in bits for float_ */
1780 LONG tMaxWeight; /* (C) Maximum weight for MZV or Euler */
1781#endif
1783 int AutoDeclareFlag;
1785 int NoShowInput; /* (C) No listing of input as in .prc, #do */
1786 int ShortStats; /* (C) */
1787 int compiletype; /* (C) type of statement {DECLARATION etc} */
1788 int firstconstindex; /* (C) flag for giving first error message */
1789 int insidefirst; /* (C) Not used yet */
1790 int minsidefirst; /* (?) Not used yet */
1791 int wildflag; /* (C) Flag for marking use of wildcards */
1792 int NumLabels; /* (C) Number of labels {in Labels} */
1793 int MaxLabels; /* (C) Size of Labels array */
1794 int lDefDim; /* (C) */
1795 int lDefDim4; /* (C) */
1796 int NumWildcardNames; /* (C) Number of ?a variables */
1797 int WildcardBufferSize; /* (C) size of WildcardNames buffer */
1798 int MaxIf; /* (C) size of IfHeap, IfSumCheck, IfCount */
1799 int NumStreams; /* (C) */
1800 int MaxNumStreams; /* (C) */
1801 int firstctypemessage; /* (C) Flag for giving first st order error */
1802 int tablecheck; /* (C) For table checking */
1803 int idoption; /* (C) */
1804 int BottomLevel; /* (C) For propercount. Not used!!! */
1805 int CompileLevel; /* (C) Subexpression level */
1806 int TokensWriteFlag; /* (C) */
1807 int UnsureDollarMode; /* (C)?Controls error messages undefined $'s */
1808 int outsidefun; /* (C) Used for writing Tables to file */
1809 int funpowers; /* (C) */
1810 int WarnFlag; /* (C) */
1811 int StatsFlag; /* (C) */
1812 int NamesFlag; /* (C) */
1813 int CodesFlag; /* (C) */
1814 int SetupFlag; /* (C) */
1815 int SortType; /* (C) */
1816 int lSortType; /* (C) */
1817 int ThreadStats; /* (C) */
1818 int FinalStats; /* (C) */
1819 int OldParallelStats; /* (C) */
1820 int ThreadsFlag;
1821 int ThreadBalancing;
1822 int ThreadSortFileSynch;
1823 int ProcessStats; /* (C) */
1824 int BracketNormalize; /* (C) Indicates whether the bracket st is normalized */
1825 int maxtermlevel; /* (C) Size of termstack */
1826 int dumnumflag; /* (C) Where there dummy indices in tokenizer? */
1827 int bracketindexflag; /* (C) Are brackets going to be indexed? */
1828 int parallelflag; /* (C) parallel allowed? */
1829 int mparallelflag; /* (C) parallel allowed in this module? */
1830 int inparallelflag; /* (C) inparallel allowed? */
1831 int partodoflag; /* (C) parallel allowed? */
1832 int properorderflag; /* (C) clean normalizing. */
1833 int vetofilling; /* (C) vetoes overwriting in tablebase stubs */
1834 int tablefilling; /* (C) to notify AddRHS we are filling a table */
1835 int vetotablebasefill; /* (C) For the load in tablebase */
1836 int exprfillwarning; /* (C) Warning has been printed for expressions in fill statements */
1837 int lhdollarflag; /* (R) left hand dollar present */
1838 int NoCompress; /* (R) Controls native compression */
1839 int IsFortran90; /* Tells whether the Fortran is Fortran90 */
1840 int MultiBracketLevels; /* Number of elements in MultiBracketBuf */
1841 int topolynomialflag; /* To avoid ToPolynomial and FactArg together */
1842 int ffbufnum; /* Buffer number for user defined factorizations */
1843 int OldFactArgFlag;
1844 int MemDebugFlag; /* Only used when MALLOCDEBUG in tools.c */
1845 int OldGCDflag;
1846 int WTimeStatsFlag;
1847 int SortReallocateFlag; /* Controls reallocation of large+small buffer at module end.
1848 0 : Off
1849 1 : On, every module (set by On sortreallocate;)
1850 2 : On, single module (set by #sortreallocate) */
1851 int PrintBacktraceFlag; /* Print backtrace on terminate? */
1852 int FlintPolyFlag; /* Use Flint for polynomial arithmetic */
1853 int HumanStatsFlag; /* Print human-readable stats in the stats print? */
1854 int GrccVerbose; /* Enable extra print statements in grcc? */
1855 int SortVerbose; /* Enable extra sort stats information? */
1856 int doloopstacksize;
1857 int dolooplevel;
1862 int SizeCommuteInSet; /* Size of the CommuteInSet buffer */
1863#ifdef PARALLELCODE
1864 int numpfirstnum; /* For redefine */
1865 int sizepfirstnum; /* For redefine */
1866#endif
1867 int origin; /* Determines whether .sort or ModuleOption */
1868 int vectorlikeLHS;
1869 int nummodels;
1870 int modelspace;
1871 int ModelLevel;
1872 int ShortStatsMax; /* For On FewerStatistics 10; */
1873 int InnerTest; /* For debugging */
1874 WORD argsumcheck[MAXNEST]; /* (C) Checking of nesting */
1875 WORD insidesumcheck[MAXNEST];/* (C) Checking of nesting */
1876 WORD inexprsumcheck[MAXNEST];/* (C) Checking of nesting */
1877 WORD RepSumCheck[MAXREPEAT];/* (C) Checks nesting of repeat, if, argument */
1878 WORD lUniTrace[4]; /* (C) */
1879 WORD RepLevel; /* (C) Tracks nesting of repeat. */
1880 WORD arglevel; /* (C) level of nested argument statements */
1881 WORD insidelevel; /* (C) level of nested inside statements */
1882 WORD inexprlevel; /* (C) level of nested inexpr statements */
1883 WORD termlevel; /* (C) level of nested term statements */
1884 WORD MustTestTable; /* (C) Indicates whether tables have been changed */
1885 WORD DumNum; /* (C) */
1886 WORD ncmod; /* (C) Local setting of modulus. size of cmod */
1887 WORD npowmod; /* (C) Local printing as powers. size powmod */
1888 WORD modmode; /* (C) Mode for modulus calculus */
1889 WORD nhalfmod; /* relevant word size of halfmod when defined */
1890 WORD DirtPow; /* (C) Flag for changes in printing mod powers */
1891 WORD lUnitTrace; /* (C) Local value of Tr[1] */
1892 WORD NwildC; /* (C) Wildcard counter */
1893 WORD ComDefer; /* (C) defer brackets */
1894 WORD CollectFun; /* (C) Collect function number */
1895 WORD AltCollectFun; /* (C) Alternate Collect function number */
1896 WORD OutputMode; /* (C) */
1897 WORD Cnumpows;
1898 WORD OutputSpaces; /* (C) */
1899 WORD OutNumberType; /* (C) Controls RATIONAL/FLOAT output */
1900 WORD DidClean; /* (C) Test whether nametree needs cleaning */
1901 WORD IfLevel; /* (C) */
1902 WORD WhileLevel; /* (C) */
1903 WORD SwitchLevel;
1904 WORD SwitchInArray;
1905 WORD MaxSwitch;
1906 WORD LogHandle; /* (C) The Log File */
1907 WORD LineLength; /* (C) */
1908 WORD StoreHandle; /* (C) Handle of .str file */
1909 WORD HideLevel; /* (C) Hiding indicator */
1910 WORD lPolyFun; /* (C) local value of PolyFun */
1911 WORD lPolyFunInv; /* (C) local value of Inverse of PolyFun */
1912 WORD lPolyFunType; /* (C) local value of PolyFunType */
1913 WORD lPolyFunExp;
1914 WORD lPolyFunVar;
1915 WORD lPolyFunPow;
1916 WORD SymChangeFlag; /* (C) */
1917 WORD CollectPercentage; /* (C) Collect function percentage */
1918 WORD extrasymbols; /* Flag for the extra symbols output mode */
1919 WORD PolyRatFunChanged; /* Keeps track whether we changed in the compiler */
1920 WORD ToBeInFactors;
1921#ifdef WITHMPI
1922 WORD RhsExprInModuleFlag; /* (C) Set by the compiler if RHS expressions exists. */
1923#endif
1924 UBYTE Commercial[COMMERCIALSIZE+2]; /* (C) Message to be printed in statistics */
1925 UBYTE debugFlags[MAXFLAGS+2]; /* On/Off Flag number(s) */
1926};
1927/*
1928 #] C :
1929 #[ S : The S struct defines objects changed at the start of the run (Processor)
1930 Basically only set by the master.
1931*/
1939struct S_const {
1940 POSITION MaxExprSize; /* ( ) Maximum size of in/out/sort */
1941#ifdef WITHPTHREADS
1942 pthread_mutex_t inputslock;
1943 pthread_mutex_t outputslock;
1944 pthread_mutex_t MaxExprSizeLock;
1945#endif
1946 POSITION *OldOnFile; /* (S) File positions of expressions */
1947 WORD *OldNumFactors; /* ( ) NumFactors in (old) expression */
1948 WORD *Oldvflags; /* ( ) vflags in (old) expression */
1949 WORD *Olduflags; /* ( ) uflags in (old) expression */
1950#ifdef WITHFLOAT
1951 void *delta_1;
1952#endif
1953 int NumOldOnFile; /* (S) Number of expressions in OldOnFile */
1954 int NumOldNumFactors; /* (S) Number of expressions in OldNumFactors */
1955 int MultiThreaded; /* (S) Are we running multi-threaded? */
1956#ifdef WITHPTHREADS
1957 int MasterSort; /* Final stage of sorting to the master */
1958#endif
1959#ifdef WITHMPI
1960 int printflag; /* controls MesPrint() on each slave */
1961#endif
1962 int Balancing; /* For second stage loadbalancing */
1963 WORD ExecMode; /* (S) */
1964
1965 WORD CollectOverFlag; /* (R) Indicates overflow at Collect */
1966#ifdef WITHPTHREADS
1967 WORD sLevel; /* Copy of AR0.sLevel because it can get messy */
1968#endif
1969};
1970/*
1971 #] S :
1972 #[ R : The R struct defines objects changed at run time.
1973 They determine the environment that has to be transferred
1974 together with a term during multithreaded execution.
1975*/
1984struct R_const {
1985 FILEDATA StoreData; /* (O) */
1986 FILEHANDLE Fscr[3]; /* (R) Dollars etc play with it too */
1987 FILEHANDLE FoStage4[2]; /* (R) In Sort. Stage 4. */
1988 POSITION DefPosition; /* (R) Deferred position of keep brackets. */
1989 FILEHANDLE *infile; /* (R) Points alternatingly to Fscr[0] or Fscr[1] */
1990 FILEHANDLE *outfile; /* (R) Points alternatingly to Fscr[1] or Fscr[0] */
1991 FILEHANDLE *hidefile; /* (R) Points to Fscr[2] */
1992
1993 WORD *CompressBuffer; /* (M) */
1994 WORD *ComprTop; /* (M) */
1995 WORD *CompressPointer; /* (R) */
1996 COMPAREDUMMY CompareRoutine;
1997 ULONG *wranfia;
1998 SBYTE *moebiustable;
1999
2000 LONG OldTime; /* (R) Zero time. Needed in timer. */
2001 LONG InInBuf; /* (R) Characters in input buffer. Scratch files. */
2002 LONG InHiBuf; /* (R) Characters in hide buffer. Scratch file. */
2003 LONG pWorkSize; /* (R) Size of pWorkSpace */
2004 LONG lWorkSize; /* (R) Size of lWorkSpace */
2005 LONG posWorkSize; /* (R) Size of posWorkSpace */
2006 ULONG wranfseed;
2007 int NoCompress; /* (R) Controls native compression */
2008 int gzipCompress; /* (R) Controls gzip compression */
2009 int Cnumlhs; /* Local copy of cbuf[rbufnum].numlhs */
2010 int outtohide; /* Indicates that output is directly to hide */
2011#ifdef WITHPTHREADS
2012 int exprtodo; /* The expression to do in parallel mode */
2013#endif
2014 int wranfcall;
2015 int wranfnpair1;
2016 int wranfnpair2;
2017#if ( BITSINWORD == 32 )
2018 WORD PrimeList[5000];
2019 WORD numinprimelist;
2020 WORD notfirstprime;
2021#endif
2022 WORD GetFile; /* (R) Where to get the terms {like Hide} */
2023 WORD KeptInHold; /* (R) */
2024 WORD BracketOn; /* (R) Intensely used in poly_ */
2025 WORD MaxBracket; /* (R) Size of BrackBuf. Changed by poly_ */
2026 WORD CurDum; /* (R) Current maximum dummy number */
2027 WORD DeferFlag; /* (R) For deferred brackets */
2028 WORD TePos; /* (R) */
2029 WORD sLevel; /* (R) Sorting level */
2030 WORD Stage4Name; /* (R) Sorting only */
2031 WORD GetOneFile; /* (R) Getting from hide or regular */
2032 WORD PolyFun; /* (C) Number of the PolyFun function */
2033 WORD PolyFunInv; /* (C) Number of the Inverse of the PolyFun function */
2034 WORD PolyFunType; /* () value of PolyFunType */
2035 WORD PolyFunExp;
2036 WORD PolyFunVar;
2037 WORD PolyFunPow;
2038 WORD Eside; /* () Tells which side of = sign */
2039 WORD MaxDum; /* Maximum dummy value in an expression */
2040 WORD level; /* Running level in Generator */
2041 WORD expchanged; /* (R) Info about expression */
2042 WORD expflags; /* (R) Info about expression */
2043 WORD CurExpr; /* (S) Number of current expression */
2044 WORD SortType; /* A copy of AC.SortType to play with */
2045 WORD ShortSortCount; /* For On FewerStatistics 10; */
2046 WORD modeloptions;
2047 WORD funoffset;
2048 WORD moebiustablesize;
2049};
2050
2051/*
2052 #] R :
2053 #[ T : These are variables that stay in each thread during multi threaded execution.
2054*/
2063struct T_const {
2064#ifdef WITHPTHREADS
2065 SORTBLOCK SB;
2066#endif
2067 SORTING *S0; /* (-) The thread specific sort buffer */
2068 SORTING *SS; /* (R) Current sort buffer */
2069 NESTING Nest; /* (R) Nesting of function levels etc. */
2070 NESTING NestStop; /* (R) */
2071 NESTING NestPoin; /* (R) */
2072 WORD *BrackBuf; /* (R) Bracket buffer. Used by poly_ at runtime. */
2073 STORECACHE StoreCache; /* (R) Cache for picking up stored expr. */
2074 STORECACHE StoreCacheAlloc; /* (R) Permanent address of StoreCache to keep valgrind happy */
2075 WORD **pWorkSpace; /* (R) Workspace for pointers. Dynamic. */
2076 LONG *lWorkSpace; /* (R) WorkSpace for LONG. Dynamic. */
2077 POSITION *posWorkSpace; /* (R) WorkSpace for file positions */
2078 WORD *WorkSpace; /* (M) */
2079 WORD *WorkTop; /* (M) */
2080 WORD *WorkPointer; /* (R) Pointer in the WorkSpace heap. */
2081 int *RepCount; /* (M) Buffer for repeat nesting */
2082 int *RepTop; /* (M) Top of RepCount buffer */
2083 WORD *WildArgTaken; /* (N) Stack for wildcard pattern matching */
2084 UWORD *factorials; /* (T) buffer of factorials. Dynamic. */
2085 WORD *small_power_n; /* length of the number */
2086 UWORD **small_power; /* the number*/
2087 UWORD *bernoullis; /* (T) The buffer with Bernoulli numbers. Dynamic. */
2088 WORD *primelist;
2089 LONG *pfac; /* (T) array of positions of factorials. Dynamic. */
2090 LONG *pBer; /* (T) array of positions of Bernoulli's. Dynamic. */
2091 WORD *TMaddr; /* (R) buffer for TestSub */
2092 WORD *WildMask; /* (N) Wildcard info during pattern matching */
2093 WORD *previousEfactor; /* () Cache for factors in expressions */
2094 WORD **TermMemHeap; /* For TermMalloc. Set zero in Checkpoint */
2095 UWORD **NumberMemHeap; /* For NumberMalloc. Set zero in Checkpoint */
2096 UWORD **CacheNumberMemHeap; /* For CacheNumberMalloc. Set zero in Checkpoint */
2097 BRACKETINFO *bracketinfo;
2098 WORD **ListPoly;
2099 WORD *ListSymbols;
2100 UWORD *NumMem;
2101 WORD *TopologiesTerm;
2102 WORD *TopologiesStart;
2103#ifdef WITHFLOAT
2104 WORD *indi1;
2105 WORD *indi2;
2106 void *mpf_tab1;
2107 void *mpf_tab2;
2108 void *aux_;
2109 void *auxr_;
2110#endif
2111 NORMDATA **NormData;
2112 LONG NormDataSize;
2113 LONG NormDepth;
2114 PARTI partitions;
2115 LONG sBer; /* (T) Size of the Bernoullis buffer */
2116 LONG pWorkPointer; /* (R) Offset-pointer in pWorkSpace */
2117 LONG lWorkPointer; /* (R) Offset-pointer in lWorkSpace */
2118 LONG posWorkPointer; /* (R) Offset-pointer in posWorkSpace */
2119 LONG InNumMem;
2120 int sfact; /* (T) size of the factorials buffer */
2121 int mfac; /* (T) size of the pfac array. */
2122 int ebufnum; /* (R) extra compiler buffer */
2123 int fbufnum; /* extra compiler buffer for factorization cache */
2124 int allbufnum; /* extra compiler buffer for id,all */
2125 int aebufnum; /* extra compiler buffer for id,all */
2126 int idallflag; /* indicates use of id,all buffers */
2127 int idallnum;
2128 int idallmaxnum;
2129 int WildcardBufferSize; /* () local copy for updates */
2130#ifdef WITHPTHREADS
2131 int identity; /* () When we work with B->T */
2132 int LoadBalancing; /* Needed for synchronization */
2133#ifdef WITHSORTBOTS
2134 int SortBotIn1; /* Input stream 1 for a SortBot */
2135 int SortBotIn2; /* Input stream 2 for a SortBot */
2136#endif
2137#endif
2138 int TermMemMax; /* For TermMalloc. Set zero in Checkpoint */
2139 int TermMemTop; /* For TermMalloc. Set zero in Checkpoint */
2140 int NumberMemMax; /* For NumberMalloc. Set zero in Checkpoint */
2141 int NumberMemTop; /* For NumberMalloc. Set zero in Checkpoint */
2142 int CacheNumberMemMax; /* For CacheNumberMalloc. Set zero in Checkpoint */
2143 int CacheNumberMemTop; /* For CacheNumberMalloc. Set zero in Checkpoint */
2144 int bracketindexflag; /* Are brackets going to be indexed? */
2145 int optimtimes; /* Number of the evaluation of the MCTS tree */
2146 int ListSymbolsSize;
2147 int NumListSymbols;
2148 int numpoly;
2149 int LeaveNegative;
2150 int TrimPower; /* Indicates trimming in polyratfun expansion */
2151 WORD small_power_maxx; /* size of the cache for small powers */
2152 WORD small_power_maxn; /* size of the cache for small powers */
2153 WORD dummysubexp[SUBEXPSIZE+4]; /* () used in normal.c */
2154 WORD comsym[8]; /* () Used in tools.c = {8,SYMBOL,4,0,1,1,1,3} */
2155 WORD comnum[4]; /* () Used in tools.c = { 4,1,1,3 } */
2156 WORD comfun[FUNHEAD+4]; /* () Used in tools.c = {7,FUNCTION,3,0,1,1,3} */
2157 /* or { 8,FUNCTION,4,0,0,1,1,3 } */
2158 WORD comind[7]; /* () Used in tools.c = {7,INDEX,3,0,1,1,3} */
2159 WORD MinVecArg[7+ARGHEAD]; /* (N) but should be more local */
2160 WORD FunArg[4+ARGHEAD+FUNHEAD]; /* (N) but can be more local */
2161 WORD locwildvalue[SUBEXPSIZE]; /* () Used in argument.c = {SUBEXPRESSION,SUBEXPSIZE,0,0,0} */
2162 WORD mulpat[SUBEXPSIZE+5]; /* () Used in argument.c = {TYPEMULT, SUBEXPSIZE+3, 0, */
2163 /* SUBEXPRESSION, SUBEXPSIZE, 0, 1, 0, 0, 0 } */
2164 WORD proexp[SUBEXPSIZE+5]; /* () Used in poly.c */
2165 WORD TMout[40]; /* (R) Passing info */
2166 WORD TMbuff; /* (R) Communication between TestSub and Genera */
2167 WORD TMdolfac; /* factor number for dollar */
2168 WORD nfac; /* (T) Number of highest stored factorial */
2169 WORD nBer; /* (T) Number of highest Bernoulli number. */
2170 WORD mBer; /* (T) Size of buffer pBer. */
2171 WORD PolyAct; /* (R) Used for putting the PolyFun at end. ini at 0 */
2172 WORD RecFlag; /* (R) Used in TestSub. ini at zero. */
2173 WORD inprimelist;
2174 WORD sizeprimelist;
2175 WORD fromindex; /* Tells the compare routine whether call from index */
2176 WORD setinterntopo; /* Set of internal momenta for topogen */
2177 WORD setexterntopo; /* Set of external momenta for topogen */
2178 WORD TopologiesLevel;
2179 WORD TopologiesOptions[2];
2180#ifdef WITHFLOAT
2181 WORD FloatPos;
2182 WORD SortFloatMode;
2183#endif
2184};
2185/*
2186 #] T :
2187 #[ N : The N struct contains variables used in running information
2188 that is inside blocks that should not be split, like pattern
2189 matching, traces etc. They are local for each thread.
2190 They don't need initializations.
2191*/
2200struct N_const {
2201 POSITION OldPosIn; /* (R) Used in sort. */
2202 POSITION OldPosOut; /* (R) Used in sort */
2203 POSITION theposition; /* () Used in index.c */
2204 WORD *EndNest; /* (R) Nesting of function levels etc. */
2205 WORD *Frozen; /* (R) Bracket info */
2206 WORD *FullProto; /* (R) Prototype of a subexpression or table */
2207 WORD *cTerm; /* (R) Current term for coef_ and term_ */
2208 int *RepPoint; /* (R) Pointer in RepCount buffer. Tracks repeat */
2209 WORD *WildValue; /* (N) Wildcard info during pattern matching */
2210 WORD *WildStop; /* (N) Wildcard info during pattern matching */
2211 WORD *argaddress; /* (N) Used in pattern matching of arguments */
2212 WORD *RepFunList; /* (N) For pattern matching */
2213 WORD *patstop; /* (N) Used in pattern matching */
2214 WORD *terstop; /* (N) Used in pattern matching */
2215 WORD *terstart; /* (N) Used in pattern matching */
2216 WORD *terfirstcomm; /* (N) Used in pattern matching */
2217 WORD *DumFound; /* (N) For renumbering indices {make local?} */
2218 WORD **DumPlace; /* (N) For renumbering indices {make local?} */
2219 WORD **DumFunPlace; /* (N) For renumbering indices {make local?} */
2220 WORD *UsedSymbol; /* (N) When storing terms of a global expr. */
2221 WORD *UsedVector; /* (N) When storing terms of a global expr. */
2222 WORD *UsedIndex; /* (N) When storing terms of a global expr. */
2223 WORD *UsedFunction; /* (N) When storing terms of a global expr. */
2224 WORD *MaskPointer; /* (N) For wildcard pattern matching */
2225 WORD *ForFindOnly; /* (N) For wildcard pattern matching */
2226 WORD *findTerm; /* (N) For wildcard pattern matching */
2227 WORD *findPattern; /* (N) For wildcard pattern matching */
2228#ifdef WITHZLIB
2229 Bytef **ziobufnum; /* () Used in compress.c */
2230 Bytef *ziobuffers; /* () Used in compress.c */
2231#endif
2232 WORD *dummyrenumlist; /* () Used in execute.c and store.c */
2233 int *funargs; /* () Used in lus.c */
2234 WORD **funlocs; /* () Used in lus.c */
2235 int *funinds; /* () Used in lus.c */
2236 UWORD *NoScrat2; /* () Used in normal.c */
2237 WORD *ReplaceScrat; /* () Used in normal.c */
2238 TRACES *tracestack; /* () used in opera.c */
2239 WORD *selecttermundo; /* () Used in pattern.c */
2240 WORD *patternbuffer; /* () Used in pattern.c */
2241 WORD *termbuffer; /* () Used in pattern.c */
2242 WORD **PoinScratch; /* () used in reshuf.c */
2243 WORD **FunScratch; /* () used in reshuf.c */
2244 WORD *RenumScratch; /* () used in reshuf.c */
2245 FUN_INFO *FunInfo; /* () Used in smart.c */
2246 WORD **SplitScratch; /* () Used in sort.c */
2247 WORD **SplitScratch1; /* () Used in sort.c */
2248 SORTING **FunSorts; /* () Used in sort.c */
2249 UWORD *SoScratC; /* () Used in sort.c */
2250 WORD *listinprint; /* () Used in proces.c and message.c */
2251 WORD *currentTerm; /* () Used in proces.c and message.c */
2252 WORD **arglist; /* () Used in function.c */
2253 int *tlistbuf; /* () used in lus.c */
2254#ifdef WHICHSUBEXPRESSION
2255 UWORD *BinoScrat; /* () Used in proces.c */
2256#endif
2257 WORD *compressSpace; /* () Used in sort.c */
2258#ifdef WITHPTHREADS
2259 THREADBUCKET *threadbuck;
2260 EXPRESSIONS expr;
2261#endif
2262 UWORD *SHcombi;
2263 WORD *poly_vars;
2264 UWORD *cmod; /* Local setting of modulus. Pointer to value. */
2265 SHvariables SHvar;
2266 LONG deferskipped; /* () Used in proces.c store.c and parallel.c */
2267 LONG InScratch; /* () Used in sort.c */
2268 LONG SplitScratchSize; /* () Used in sort.c */
2269 LONG InScratch1; /* () Used in sort.c */
2270 LONG SplitScratchSize1; /* () Used in sort.c */
2271 LONG ninterms; /* () Used in proces.c and sort.c */
2272#ifdef WITHPTHREADS
2273 LONG inputnumber; /* () For use in redefine */
2274 LONG lastinindex;
2275#endif
2276#ifdef WHICHSUBEXPRESSION
2277 LONG last2; /* () Used in proces.c */
2278 LONG last3; /* () Used in proces.c */
2279#endif
2280 LONG SHcombisize;
2281 int NumTotWildArgs; /* (N) Used in pattern matching */
2282 int UseFindOnly; /* (N) Controls pattern routines */
2283 int UsedOtherFind; /* (N) Controls pattern routines */
2284 int ErrorInDollar; /* (R) */
2285 int numfargs; /* () Used in lus.c */
2286 int numflocs; /* () Used in lus.c */
2287 int nargs; /* () Used in lus.c */
2288 int tohunt; /* () Used in lus.c */
2289 int numoffuns; /* () Used in lus.c */
2290 int funisize; /* () Used in lus.c */
2291 int RSsize; /* () Used in normal.c */
2292 int numtracesctack; /* () used in opera.c */
2293 int intracestack; /* () used in opera.c */
2294 int numfuninfo; /* () Used in smart.c */
2295 int NumFunSorts; /* () Used in sort.c */
2296 int MaxFunSorts; /* () Used in sort.c */
2297 int arglistsize; /* () Used in function.c */
2298 int tlistsize; /* () used in lus.c */
2299 int filenum; /* () used in setfile.c */
2300 int compressSize; /* () Used in sort.c */
2301 int polysortflag;
2302 int nogroundlevel; /* () Used to see whether pattern matching at groundlevel */
2303 int subsubveto; /* () Sabotage combining subexpressions in TestSub */
2304 WORD MaxRenumScratch; /* () used in reshuf.c */
2305 WORD oldtype; /* (N) WildCard info at pattern matching */
2306 WORD oldvalue; /* (N) WildCard info at pattern matching */
2307 WORD NumWild; /* (N) Used in Wildcard */
2308 WORD RepFunNum; /* (N) Used in pattern matching */
2309 WORD DisOrderFlag; /* (N) Disorder option? Used in pattern matching */
2310 WORD WildDirt; /* (N) dirty in wildcard substitution. */
2311 WORD NumFound; /* (N) in reshuf only. Local? */
2312 WORD WildReserve; /* (N) Used in the wildcards */
2313 WORD TeInFun; /* (R) Passing type of action */
2314 WORD TeSuOut; /* (R) Passing info. Local? */
2315 WORD WildArgs; /* (R) */
2316 WORD WildEat; /* (R) */
2317 WORD PolyNormFlag; /* (R) For polynomial arithmetic */
2318 WORD PolyFunTodo; /* deals with expansions and multiplications */
2319 WORD sizeselecttermundo; /* () Used in pattern.c */
2320 WORD patternbuffersize; /* () Used in pattern.c */
2321 WORD numlistinprint; /* () Used in process.c */
2322 WORD ncmod; /* () used as some type of flag to disable */
2323 WORD ExpectedSign;
2325 WORD IndDum; /* Active dummy indices */
2326 WORD poly_num_vars;
2327 WORD idfunctionflag;
2328 WORD poly_vars_type; /* type of allocation. For free. */
2329 WORD tryterm; /* For EndSort(...,2) */
2330#ifdef WHICHSUBEXPRESSION
2331 WORD nbino; /* () Used in proces.c */
2332 WORD last1; /* () Used in proces.c */
2333#endif
2334};
2335
2336/*
2337 #] N :
2338 #[ O : The O struct concerns output variables
2339*/
2348struct O_const {
2349 FILEDATA SaveData; /* (O) */
2350 STOREHEADER SaveHeader; /* () System Independent save-Files */
2351 OPTIMIZERESULT OptimizeResult;
2352 UBYTE *OutputLine; /* (O) Sits also in debug statements */
2353 UBYTE *OutStop; /* (O) Top of OutputLine buffer */
2354 UBYTE *OutFill; /* (O) Filling point in OutputLine buffer */
2355 WORD *bracket; /* (O) For writing brackets */
2356 WORD *termbuf; /* (O) For writing terms */
2357 WORD *tabstring;
2358 UBYTE *wpos; /* (O) Only when storing file {local?} */
2359 UBYTE *wpoin; /* (O) Only when storing file {local?} */
2360 UBYTE *DollarOutBuffer; /* (O) Outputbuffer for Dollars */
2361 UBYTE *CurBufWrt; /* (O) Name of currently written expr. */
2362 void (*FlipWORD)(UBYTE *); /* () Function pointers for translations. Initialized by ReadSaveHeader() */
2363 void (*FlipLONG)(UBYTE *);
2364 void (*FlipPOS)(UBYTE *);
2365 void (*FlipPOINTER)(UBYTE *);
2366 void (*ResizeData)(UBYTE *,int,UBYTE *,int);
2367 void (*ResizeWORD)(UBYTE *,UBYTE *);
2368 void (*ResizeNCWORD)(UBYTE *,UBYTE *);
2369 void (*ResizeLONG)(UBYTE *,UBYTE *);
2370 void (*ResizePOS)(UBYTE *,UBYTE *);
2371 void (*ResizePOINTER)(UBYTE *,UBYTE *);
2372 void (*CheckPower)(UBYTE *);
2373 void (*RenumberVec)(UBYTE *);
2374 DICTIONARY **Dictionaries;
2375 UBYTE *tensorList; /* Dynamically allocated list with functions that are tensorial. */
2376 WORD *inscheme; /* for feeding a Horner scheme to Optimize */
2377#ifdef WITHFLOAT
2378 UBYTE *floatspace;
2379 LONG floatsize;
2380#endif
2381/*----Leave NumInBrack as first non-pointer. This is used by the checkpoints--*/
2382 LONG NumInBrack; /* (O) For typing [] option in print */
2383 LONG wlen; /* (O) Used to store files. */
2384 LONG DollarOutSizeBuffer; /* (O) Size of DollarOutBuffer */
2385 LONG DollarInOutBuffer; /* (O) Characters in DollarOutBuffer */
2386#if defined(mBSD) && defined(MICROTIME)
2387 LONG wrap; /* (O) For statistics time. wrap around */
2388 LONG wrapnum; /* (O) For statistics time. wrap around */
2389#endif
2390 OPTIMIZE Optimize;
2391 int OutInBuffer; /* (O) Which routine does the writing */
2392 int NoSpacesInNumbers; /* For very long numbers */
2393 int BlockSpaces; /* For very long numbers */
2394 int CurrentDictionary;
2395 int SizeDictionaries;
2396 int NumDictionaries;
2397 int CurDictNumbers;
2398 int CurDictVariables;
2399 int CurDictSpecials;
2400 int CurDictFunWithArgs;
2401 int CurDictNumberWarning;
2402 int CurDictNotInFunctions;
2403 int CurDictInDollars;
2404 int gNumDictionaries;
2405 int IndentSpace; /* For indentation in output */
2406#ifdef WITHFLOAT
2407 int FloatPrec;
2408#endif
2409 WORD schemenum; /* for feeding a Horner scheme to Optimize */
2410 WORD transFlag; /* () >0 indicates that translations have to be done */
2411 WORD powerFlag; /* () >0 indicates that some exponents/powers had to be adjusted */
2412 WORD mpower; /* For maxpower adjustment to larger value */
2413 WORD resizeFlag; /* () >0 indicates that something went wrong when resizing words */
2414 WORD bufferedInd; /* () Contains extra INDEXENTRIES, see ReadSaveIndex() for an explanation */
2415 WORD OutSkip; /* (O) How many chars to skip in output line */
2416 WORD IsBracket; /* (O) Controls brackets */
2417 WORD InFbrack; /* (O) For writing only */
2418 WORD PrintType; /* (O) */
2419 WORD FortFirst; /* (O) Only in sch.c */
2420 WORD DoubleFlag; /* (O) Output in double precision */
2421 WORD FactorMode; /* When the output should be written as factors */
2422 WORD FactorNum; /* Number of factor currently treated */
2423 WORD ErrorBlock;
2424 WORD OptimizationLevel; /* Level of optimization in the output */
2425 UBYTE FortDotChar; /* (O) */
2426/*
2427 For the padding, please count also the number of int's in the OPTIMIZE struct.
2428*/
2429};
2430/*
2431 #] O :
2432 #[ X : The X struct contains variables that deal with the external channel
2433*/
2441struct X_const {
2442 UBYTE *currentPrompt;
2443 UBYTE *shellname; /* if !=NULL (default is "/bin/sh -c"), start in
2444 the specified subshell*/
2445 UBYTE *stderrname; /* If !=NULL (default if "/dev/null"), stderr is
2446 redirected to the specified file*/
2447 int timeout; /* timeout to initialize preset channels.
2448 If timeout<0, the preset channels are
2449 already initialized*/
2450 int killSignal; /* signal number, SIGKILL by default*/
2451 int killWholeGroup; /* if 0, the signal is sent only to a process,
2452 if !=0 (default) is sent to a whole process group*/
2453 int daemonize; /* if !=0 (default), start in a daemon mode */
2454 int currentExternalChannel;
2455};
2456/*
2457 #] X :
2458 #[ Definitions :
2459
2460 Note: we changed the definition from C to Cc in version 5.
2461 The reason is that everywhere the pointer to the compiler
2462 buffer was called C as well. Somehow that gave no problems but
2463 who knows what the future might bring.
2464*/
2465
2466#ifdef WITHPTHREADS
2467
2473typedef struct AllGlobals {
2474 struct M_const M;
2475 struct C_const Cc;
2476 struct S_const S;
2477 struct O_const O;
2478 struct P_const P;
2479 struct X_const X;
2480} ALLGLOBALS;
2481
2487typedef struct AllPrivates {
2488 struct R_const R;
2489 struct N_const N;
2490 struct T_const T;
2491} ALLPRIVATES;
2492
2493#else
2494
2499typedef struct AllGlobals {
2500 struct M_const M;
2501 struct C_const Cc;
2502 struct S_const S;
2503 struct R_const R;
2504 struct N_const N;
2505 struct O_const O;
2506 struct P_const P;
2507 struct T_const T;
2508 struct X_const X;
2510
2511#endif
2512
2513/*
2514 #] Definitions :
2515 #] A :
2516 #[ FG :
2517*/
2518
2519#ifdef WITHPTHREADS
2520#define PHEAD ALLPRIVATES *B,
2521#define PHEAD0 ALLPRIVATES *B
2522#define BHEAD B,
2523#define BHEAD0 B
2524#else
2525#define PHEAD
2526#define PHEAD0 void
2527#define BHEAD
2528#define BHEAD0
2529#endif
2530
2531typedef int (*WCN)(PHEAD WORD *,WORD *,WORD,WORD);
2532typedef int (*WCN2)(PHEAD WORD *,WORD *);
2533
2534typedef WORD (*COMPARE)(PHEAD WORD *,WORD *,WORD);
2535
2547typedef struct FixedGlobals {
2548 WCN Operation[8];
2549 WCN2 OperaFind[6];
2550 char *VarType[10];
2551 char *ExprStat[21];
2552 char *FunNam[2];
2553 char *swmes[3];
2554 char *fname;
2555 char *fname2;
2556 UBYTE *s_one;
2557 WORD fnamebase;
2558 WORD fname2base;
2559 WORD fnamesize;
2560 WORD fname2size;
2561 UINT cTable[256];
2563
2564/*
2565 #] FG :
2566*/
2567
2568#endif
BRACKETINDEX * indexbuffer
Definition structs.h:323
WORD * bracketbuffer
Definition structs.h:324
WORD SortType
Definition structs.h:329
LIST cbufList
Definition structs.h:1697
WORD * FixIndices
Definition structs.h:1735
LONG CheckpointStamp
Definition structs.h:1773
NAMETREE * dollarnames
Definition structs.h:1677
STREAM * Streams
Definition structs.h:1714
int NoShowInput
Definition structs.h:1785
int cbufnum
Definition structs.h:1782
LONG * termstack
Definition structs.h:1720
char * CheckpointRunBefore
Definition structs.h:1751
LIST SetList
Definition structs.h:1688
LONG * IfStack
Definition structs.h:1730
LIST SetElementList
Definition structs.h:1687
NAMETREE * autonames
Definition structs.h:1705
STREAM * CurrentStream
Definition structs.h:1715
UBYTE * iStop
Definition structs.h:1733
LIST DubiousList
Definition structs.h:1682
SBYTE * tokens
Definition structs.h:1739
LONG * IfHeap
Definition structs.h:1728
UWORD * powmod
Definition structs.h:1723
SBYTE * toptokens
Definition structs.h:1740
NAMETREE * varnames
Definition structs.h:1679
set_of_char separators
Definition structs.h:1675
LIST ModOptDolList
Definition structs.h:1692
UBYTE * WildcardNames
Definition structs.h:1737
char * CheckpointRunAfter
Definition structs.h:1749
UBYTE ** LabelNames
Definition structs.h:1734
LIST ExpressionList
Definition structs.h:1685
LIST PotModDolList
Definition structs.h:1691
UWORD * cmod
Definition structs.h:1722
LIST SymbolList
Definition structs.h:1689
LONG * IfCount
Definition structs.h:1729
WORD * tokenarglevel
Definition structs.h:1742
int * Labels
Definition structs.h:1738
WORD * IfSumCheck
Definition structs.h:1753
LONG * termsortstack
Definition structs.h:1721
int CheckpointFlag
Definition structs.h:1858
UBYTE * iBuffer
Definition structs.h:1731
NAMETREE * exprnames
Definition structs.h:1678
UBYTE * iPointer
Definition structs.h:1732
SBYTE * endoftokens
Definition structs.h:1741
LIST TableBaseList
Definition structs.h:1693
LIST ChannelList
Definition structs.h:1680
LIST VectorList
Definition structs.h:1690
LONG CheckpointInterval
Definition structs.h:1774
WORD * termsumcheck
Definition structs.h:1736
LIST FunctionList
Definition structs.h:1684
UWORD * modpowers
Definition structs.h:1724
LIST IndexList
Definition structs.h:1686
LONG BufferSize
Definition structs.h:981
WORD * numdum
Definition structs.h:978
LONG * NumTerms
Definition structs.h:977
WORD * Top
Definition structs.h:972
COMPTREE * boomlijst
Definition structs.h:980
WORD * dimension
Definition structs.h:979
WORD ** rhs
Definition structs.h:975
WORD ** lhs
Definition structs.h:974
WORD * Buffer
Definition structs.h:971
WORD * Pointer
Definition structs.h:973
LONG * CanCommu
Definition structs.h:976
int handle
Definition structs.h:1002
char * name
Definition structs.h:1001
UBYTE * dollarname
Definition structs.h:881
PRELOAD p
Definition structs.h:877
UBYTE * name
Definition structs.h:878
WORD * renumlists
Definition structs.h:389
int handle
Definition structs.h:709
POSITION number
Definition structs.h:139
POSITION next
Definition structs.h:138
INDEXENTRY expression[INFILEINDEX]
Definition structs.h:140
SBYTE empty[EMPTYININDEX]
Definition structs.h:141
WORD node
Definition structs.h:497
WORD complex
Definition structs.h:492
LONG symminfo
Definition structs.h:489
WORD namesize
Definition structs.h:498
WORD commute
Definition structs.h:491
TABLES tabl
Definition structs.h:488
WORD number
Definition structs.h:493
WORD symmetric
Definition structs.h:496
WORD flags
Definition structs.h:494
LONG name
Definition structs.h:490
WORD spec
Definition structs.h:495
POSITION variables
Definition structs.h:103
POSITION length
Definition structs.h:102
WORD nvectors
Definition structs.h:107
WORD nindices
Definition structs.h:106
LONG CompressSize
Definition structs.h:104
WORD size
Definition structs.h:109
WORD nfunctions
Definition structs.h:108
WORD nsymbols
Definition structs.h:105
POSITION position
Definition structs.h:101
SBYTE name[MAXENAME+1]
Definition structs.h:110
char * message
Definition structs.h:204
int numclear
Definition structs.h:210
int size
Definition structs.h:207
int numglobal
Definition structs.h:208
int maxnum
Definition structs.h:206
int num
Definition structs.h:205
void * lijst
Definition structs.h:203
int numtemp
Definition structs.h:209
UWORD * gcmod
Definition structs.h:1418
UWORD * gpowmod
Definition structs.h:1419
SORTING * S0
Definition structs.h:1417
WORD gShortStatsMax
Definition structs.h:1582
WORD ggShortStatsMax
Definition structs.h:1583
WORD mini
Definition structs.h:302
WORD size
Definition structs.h:304
WORD maxi
Definition structs.h:303
WORD IndDum
Definition structs.h:2325
WORD SignCheck
Definition structs.h:2324
WORD type
Definition structs.h:249
WORD balance
Definition structs.h:248
WORD left
Definition structs.h:246
WORD number
Definition structs.h:250
LONG name
Definition structs.h:244
WORD parent
Definition structs.h:245
WORD right
Definition structs.h:247
LONG clearnodefill
Definition structs.h:276
LONG namefill
Definition structs.h:269
LONG nodesize
Definition structs.h:266
LONG oldnamefill
Definition structs.h:270
LONG namesize
Definition structs.h:268
WORD headnode
Definition structs.h:277
LONG nodefill
Definition structs.h:267
UBYTE * namebuffer
Definition structs.h:263
NAMENODE * namenode
Definition structs.h:261
LONG clearnamefill
Definition structs.h:275
LONG globalnamefill
Definition structs.h:272
LONG oldnodefill
Definition structs.h:271
LONG globalnodefill
Definition structs.h:274
VARRENUM indi
Definition structs.h:180
WORD * symnum
Definition structs.h:184
WORD * funnum
Definition structs.h:187
WORD * vecnum
Definition structs.h:186
VARRENUM func
Definition structs.h:182
WORD * indnum
Definition structs.h:185
VARRENUM symb
Definition structs.h:179
VARRENUM vect
Definition structs.h:181
UBYTE sFun
Definition structs.h:86
UBYTE lenPOS
Definition structs.h:80
UBYTE sVec
Definition structs.h:85
UBYTE revision
Definition structs.h:89
UBYTE sInd
Definition structs.h:84
UBYTE sSym
Definition structs.h:83
UBYTE lenWORD
Definition structs.h:78
UBYTE lenLONG
Definition structs.h:79
UBYTE lenPOINTER
Definition structs.h:81
UBYTE * top
Definition structs.h:728
UBYTE * pointer
Definition structs.h:727
UBYTE * pname
Definition structs.h:731
UBYTE * FoldName
Definition structs.h:729
UBYTE * buffer
Definition structs.h:726
UBYTE * name
Definition structs.h:730
WORD * pattern
Definition structs.h:349
WORD * buffers
Definition structs.h:357
struct TaBlEs * spare
Definition structs.h:356
WORD * tablepointers
Definition structs.h:343
int prototypeSize
Definition structs.h:362
UBYTE * argtail
Definition structs.h:354
int numtree
Definition structs.h:367
COMPTREE * boomlijst
Definition structs.h:353
LONG reserved
Definition structs.h:359
WORD buffersfill
Definition structs.h:372
int MaxTreeSize
Definition structs.h:369
int strict
Definition structs.h:365
WORD bufferssize
Definition structs.h:371
WORD * flags
Definition structs.h:352
WORD * prototype
Definition structs.h:348
WORD mode
Definition structs.h:374
LONG mdefined
Definition structs.h:361
MINMAX * mm
Definition structs.h:351
int rootnum
Definition structs.h:368
WORD bufnum
Definition structs.h:370
int bounds
Definition structs.h:364
int numind
Definition structs.h:363
LONG totind
Definition structs.h:358
int sparse
Definition structs.h:366
LONG defined
Definition structs.h:360
WORD tablenum
Definition structs.h:373
WORD * hi
Definition structs.h:167
WORD * lo
Definition structs.h:166
WORD * start
Definition structs.h:165
int nargs
Definition structs.h:827
int wildarg
Definition structs.h:828
UBYTE * argnames
Definition structs.h:826
UBYTE * value
Definition structs.h:825
UBYTE * name
Definition structs.h:824
struct NeStInG * NESTING
struct TrAcEs TRACES
struct FixedGlobals FIXEDGLOBALS
struct InDeXeNtRy INDEXENTRY
struct FuNcTiOn * FUNCTIONS
struct CbUf CBUF
struct PaRtI PARTI
struct PeRmUtEp PERMP
struct TrAcEn * TRACEN
struct DoLoOp DOLOOP
#define INFILEINDEX
Definition structs.h:118
struct NaMeTree NAMETREE
struct ReNuMbEr * RENUMBER
struct DiStRiBuTe DISTRIBUTE
struct FiLe FILEHANDLE
struct VaRrEnUm VARRENUM
struct TaBlEs * TABLES
struct bit_field * one_byte
Definition structs.h:936
struct StreaM STREAM
struct ChAnNeL CHANNEL
struct FiLeInDeX FILEINDEX
#define EMPTYININDEX
Definition structs.h:123
struct PeRmUtE PERM
struct sOrT SORTING
struct StOrEcAcHe * STORECACHE
struct bit_field set_of_char[32]
Definition structs.h:930
struct NaMeNode NAMENODE
struct AllGlobals ALLGLOBALS
struct pReVaR PREVAR
struct tree COMPTREE
int blnce
Definition structs.h:293
int right
Definition structs.h:291
int parent
Definition structs.h:289
int value
Definition structs.h:292
int left
Definition structs.h:290
int usage
Definition structs.h:294