FORM v5.0.1-23-g7a8f756
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,min,max 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 POSITION OldPosIn; /* Sort file fill positions */
1118 POSITION OldPosOut;
1119 WORD *lBuffer; /* The large buffer */
1120 WORD *lTop; /* End of the large buffer */
1121 WORD *lFill; /* The filling point of the large buffer */
1122 WORD *used; /* auxiliary during actual sort */
1123 WORD *sBuffer; /* The small buffer */
1124 WORD *sTop; /* End of the small buffer */
1125 WORD *sTop2; /* End of the extension of the small buffer */
1126 WORD *sHalf; /* Halfway point in the extension */
1127 WORD *sFill; /* Filling point in the small buffer */
1128 WORD **sPointer; /* Pointers to terms in the small buffer */
1129 WORD **PoinFill; /* Filling point for pointers to the sm.buf */
1130 WORD *cBuffer; /* Compress buffer (if it exists) */
1131 WORD **Patches; /* Positions of patches in large buffer */
1132 WORD **pStop; /* Ends of patches in the large buffer */
1133 WORD **poina; /* auxiliary during actual sort */
1134 WORD **poin2a; /* auxiliary during actual sort */
1135 WORD *ktoi; /* auxiliary during actual sort */
1136 WORD *tree; /* auxiliary during actual sort */
1137#ifdef WITHZLIB
1138 WORD *fpcompressed; /* is output filepatch compressed? */
1139 WORD *fpincompressed; /* is input filepatch compressed? */
1140 z_streamp zsparray; /* the array of zstreams for decompression */
1141#endif
1142 POSITION *fPatches; /* Positions of output file patches */
1143 POSITION *inPatches; /* Positions of input file patches */
1144 POSITION *fPatchesStop; /* Positions of output file patches */
1145 POSITION *iPatches; /* Input file patches, Points to fPatches or inPatches */
1146 FILEHANDLE *f; /* The actual output file */
1147 FILEHANDLE **ff; /* Handles for a staged sort */
1148 LONG sTerms; /* Terms in small buffer */
1149 LONG LargeSize; /* Size of large buffer (in words) */
1150 LONG SmallSize; /* Size of small buffer (in words) */
1151 LONG SmallEsize; /* Size of small + extension (in words) */
1152 LONG TermsInSmall; /* Maximum number of terms in small buffer */
1153 LONG Terms2InSmall; /* with extension for polyfuns etc. */
1154 LONG GenTerms; /* Number of generated terms */
1155 LONG TermsLeft; /* Number of terms still in existence */
1156 LONG GenSpace; /* Amount of space of generated terms */
1157 LONG SpaceLeft; /* Space needed for still existing terms */
1158 LONG putinsize; /* Size of buffer in putin */
1159 LONG ninterms; /* Which input term ? */
1160 LONG verbComparisons; /* Counters for "On SortVerbose;" statistics */
1161 LONG verbSBsortTerms;
1162 LONG verbSBsortCap;
1163 LONG verbLBsortPatches;
1164 LONG verbLBsortCap;
1165 LONG verbUnsortedSize;
1166 LONG verbMaxTermSize;
1167 int MaxPatches; /* Maximum number of patches in large buffer */
1168 int MaxFpatches; /* Maximum number of patches in one filesort */
1169 int type; /* Main, function or sub(routine) */
1170 int lPatch; /* Number of patches in the large buffer */
1171 int fPatchN1; /* Number of patches in input file */
1172 int PolyWise; /* Is there a polyfun and if so, where? */
1173 int PolyFlag; /* */
1174 int cBufferSize; /* Size of the compress buffer */
1175 int maxtermsize; /* Keeps track for buffer allocations */
1176 int newmaxtermsize; /* Auxiliary for maxtermsize */
1177 int outputmode; /* Tells where the output is going */
1178 int stagelevel; /* In case we have a 'staged' sort */
1179 WORD fPatchN; /* Number of patches on file (output) */
1180 WORD inNum; /* Number of patches on file (input) */
1181 WORD stage4; /* Are we using stage4? */
1183
1184#ifdef WITHPTHREADS
1185
1191typedef struct SoRtBlOcK {
1192 pthread_mutex_t *MasterBlockLock;
1193 WORD **MasterStart;
1194 WORD **MasterFill;
1195 WORD **MasterStop;
1196 LONG *BlockTerms;
1197 int MasterNumBlocks;
1198 int MasterBlock;
1199 int FillBlock;
1200} SORTBLOCK;
1201#endif
1202
1203#ifdef DEBUGGER
1204typedef struct DeBuGgInG {
1205 int eflag;
1206 int printflag;
1207 int logfileflag;
1208 int stdoutflag;
1209} DEBUGSTR;
1210#endif
1211
1212#ifdef WITHPTHREADS
1213
1219typedef struct ThReAdBuCkEt {
1220 POSITION *deferbuffer; /* For Keep Brackets: remember position */
1221 WORD *threadbuffer; /* Here are the (primary) terms */
1222 WORD *compressbuffer; /* For keep brackets we need the compressbuffer */
1223 LONG threadbuffersize; /* Number of words in threadbuffer */
1224 LONG compressbuffersize; /* Number of words in compressbuffer */
1225 LONG ddterms; /* Number of primary+secondary terms represented */
1226 LONG firstterm; /* The number of the first term in the bucket */
1227 LONG firstbracket; /* When doing complete brackets */
1228 LONG lastbracket; /* When doing complete brackets */
1229 pthread_mutex_t lock; /* For the load balancing phase */
1230 int free; /* Status of the bucket */
1231 int totnum; /* Total number of primary terms */
1232 int usenum; /* Which is the term being used at the moment */
1233 int busy; /* */
1234 int type; /* Doing brackets? */
1235} THREADBUCKET;
1236
1237#endif
1238
1246typedef struct {
1247 WORD *coefs; /* The array of coefficients */
1248 WORD numsym; /* The number of the symbol in the polynomial */
1249 WORD arraysize; /* The size of the allocation of coefs */
1250 WORD polysize; /* The maximum power in the polynomial */
1251 WORD modnum; /* The prime number of the modulus */
1252} POLYMOD;
1253
1254typedef struct {
1255 WORD *outterm; /* Used in DoShuffle/Merge/FinishShuffle system */
1256 WORD *outfun;
1257 WORD *incoef;
1258 WORD *stop1;
1259 WORD *stop2;
1260 WORD *ststop1;
1261 WORD *ststop2;
1262 FINISHUFFLE finishuf;
1263 DO_UFFLE do_uffle;
1264 LONG combilast;
1265 WORD nincoef;
1266 WORD level;
1267 WORD thefunction;
1268 WORD option;
1269} SHvariables;
1270
1271typedef struct { /* Used for computing calculational cost in optim.c */
1272 LONG add;
1273 LONG mul;
1274 LONG div;
1275 LONG pow;
1276} COST;
1277
1278typedef struct {
1279 UWORD *a; /* The number array */
1280 UWORD *m; /* The modulus array */
1281 WORD na; /* Size of the number */
1282 WORD nm; /* size of the number in the modulus array */
1283} MODNUM;
1284
1285/*
1286 Struct for optimizing outputs. If changed, do not forget to change
1287 the padding information in the AO struct.
1288*/
1289typedef struct {
1290 union { /* we do this to allow padding */
1291 float fval;
1292 int ival[2]; /* This should be enough */
1293 } mctsconstant;
1294 int horner;
1295 int hornerdirection;
1296 int method;
1297 int mctstimelimit;
1298 int mctsnumexpand;
1299 int mctsnumkeep;
1300 int mctsnumrepeat;
1301 int greedytimelimit;
1302 int greedyminnum;
1303 int greedymaxperc;
1304 int printstats;
1305 int debugflags;
1306 int schemeflags;
1307 int mctsdecaymode;
1308 int saIter; /* Simulated annealing updates */
1309 union {
1310 float fval;
1311 int ival[2];
1312 } saMaxT; /* Maximum temperature of SA */
1313 union {
1314 float fval;
1315 int ival[2];
1316 } saMinT; /* Minimum temperature of SA */
1317 int spare;
1318} OPTIMIZE;
1319
1320typedef struct {
1321 WORD *code;
1322 UBYTE *nameofexpr; /* It is easier to remember an expression by name */
1323 LONG codesize; /* We need this for the checkpoints */
1324 WORD exprnr; /* Problem here is: we renumber them in execute.c */
1325 WORD minvar;
1326 WORD maxvar;
1328
1329typedef struct {
1330 WORD *lhs; /* Object to be replaced */
1331 WORD *rhs; /* Depending on the type it will be UBYTE* or WORD* */
1332 int type;
1333 int size; /* Size of the lhs */
1335
1336typedef struct {
1337 DICTIONARY_ELEMENT **elements;
1338 UBYTE *name;
1339 int sizeelements;
1340 int numelements;
1341 int numbers; /* deal with numbers */
1342 int variables; /* deal with single variables */
1343 int characters; /* deal with special characters */
1344 int funwith; /* deal with functions with arguments */
1345 int gnumelements; /* if .global shrinks the dictionary */
1346 int ranges;
1347} DICTIONARY;
1348
1349typedef struct {
1350 WORD ncase;
1351 WORD value;
1352 WORD compbuffer;
1353} SWITCHTABLE;
1354
1355typedef struct {
1356 SWITCHTABLE *table;
1357 SWITCHTABLE defaultcase;
1358 SWITCHTABLE endswitch;
1359 WORD typetable;
1360 WORD maxcase;
1361 WORD mincase;
1362 WORD numcases;
1363 WORD tablesize;
1364 WORD caseoffset;
1365 WORD iflevel;
1366 WORD whilelevel;
1367 WORD nestingsum;
1368 WORD padding;
1369} SWITCH;
1370
1371typedef struct {
1372 WORD *term;
1373 void *currentModel;
1374 void *currentMODEL;
1375 WORD *legcouple[MAXLEGS+1];
1376 LONG numtopo;
1377 LONG numdia;
1378 WORD diaoffset;
1379 WORD level;
1380 WORD externalset;
1381 WORD internalset;
1382 WORD numextern;
1383 WORD flags;
1384} TERMINFO;
1385
1386/*
1387 Struct to hold temporary data in Normalize, so that it is not allocated
1388 on the stack each function call. The sizes of these arrays introduces a
1389 maximum complexity of terms which can be normalized. Each array is
1390 allocated dynamically, by AllocNormData, such that valgrind can detect
1391 errors if they are over-run.
1392*/
1393typedef struct NoRmDaTa {
1394 WORD *psym;
1395 WORD *pvec;
1396 WORD *pdot;
1397 WORD *pdel;
1398 WORD *pind;
1399 WORD **peps;
1400 WORD **pden;
1401 WORD **pcom;
1402 WORD **pnco;
1403 WORD **pcon;
1404} NORMDATA;
1405
1406/*
1407 #] Varia :
1408 #[ A :
1409 #[ M : The M struct is for global settings at startup or .clear
1410*/
1411
1419struct M_const {
1420 POSITION zeropos; /* (M) is zero */
1422 UWORD *gcmod;
1423 UWORD *gpowmod;
1424 UBYTE *TempDir; /* (M) Path with where the temporary files go */
1425 UBYTE *TempSortDir; /* (M) Path with where the sort files go */
1426 UBYTE *IncDir; /* (M) Directory path for include files */
1427 UBYTE *InputFileName; /* (M) */
1428 UBYTE *LogFileName; /* (M) */
1429 UBYTE *OutBuffer; /* (M) Output buffer in pre.c */
1430 UBYTE *Path; /* (M) */
1431 UBYTE *SetupDir; /* (M) Directory with setup file */
1432 UBYTE *SetupFile; /* (M) Name of setup file */
1433 UBYTE *gFortran90Kind;
1434 UBYTE *gextrasym;
1435 UBYTE *ggextrasym;
1436 UBYTE *oldnumextrasymbols;
1437 SPECTATOR *SpectatorFiles;
1438#ifdef WITHPTHREADS
1439 pthread_rwlock_t handlelock; /* (M) */
1440 pthread_mutex_t storefilelock; /* (M) */
1441 pthread_mutex_t sbuflock; /* (M) Lock for writing in the AM.sbuffer */
1442 LONG ThreadScratSize; /* (M) Size of Fscr[0/2] buffers of the workers */
1443 LONG ThreadScratOutSize; /* (M) Size of Fscr[1] buffers of the workers */
1444#endif
1445 LONG MaxTer; /* (M) Maximum term size. Fixed at setup. In Bytes!!!*/
1446 LONG CompressSize; /* (M) Size of Compress buffer */
1447 LONG ScratSize; /* (M) Size of Fscr[] buffers */
1448 LONG HideSize; /* (M) Size of Fscr[2] buffer */
1449 LONG SizeStoreCache; /* (M) Size of the caches for reading global expr. */
1450 LONG MaxStreamSize; /* (M) Maximum buffer size in reading streams */
1451 LONG SIOsize; /* (M) Sort InputOutput buffer size */
1452 LONG SLargeSize; /* (M) */
1453 LONG SSmallEsize; /* (M) */
1454 LONG SSmallSize; /* (M) */
1455 LONG STermsInSmall; /* (M) */
1456 LONG MaxBracketBufferSize; /* (M) Max Size for B+ or AB+ per expression */
1457 LONG hProcessBucketSize; /* (M) */
1458 LONG gProcessBucketSize; /* (M) */
1459 LONG shmWinSize; /* (M) size for shared memory window used in communications */
1460 LONG OldChildTime; /* (M) Zero time. Needed in timer. */
1461 LONG OldSecTime; /* (M) Zero time for measuring wall clock time */
1462 LONG OldMilliTime; /* (M) Same, but milli seconds */
1463 LONG WorkSize; /* (M) Size of WorkSpace */
1464 LONG gThreadBucketSize; /* (C) */
1465 LONG ggThreadBucketSize; /* (C) */
1466 LONG SumTime; /* Used in .clear */
1467 LONG SpectatorSize; /* Size of the buffer in bytes */
1468 LONG TimeLimit; /* Limit in sec to the total real time */
1469#ifdef WITHFLOAT
1470 LONG gDefaultPrecision; /* (M) Default precision in bits for float_ */
1471 LONG gMaxWeight; /* (M) Maximum weight for MZV or Euler */
1472 LONG ggDefaultPrecision; /* (M) Default precision in bits for float_ */
1473 LONG ggMaxWeight; /* (M) Maximum weight for MZV or Euler */
1474#endif
1475 int FileOnlyFlag; /* (M) Writing only to file */
1476 int Interact; /* (M) Interactive mode flag */
1477 int MaxParLevel; /* (M) Maximum nesting of parentheses */
1478 int OutBufSize; /* (M) size of OutBuffer */
1479 int SMaxFpatches; /* (M) */
1480 int SMaxPatches; /* (M) */
1481 int StdOut; /* (M) Regular output channel */
1482 int ginsidefirst; /* (M) Not used yet */
1483 int gDefDim; /* (M) */
1484 int gDefDim4; /* (M) */
1485 int NumFixedSets; /* (M) Number of the predefined sets */
1486 int NumFixedFunctions; /* (M) Number of built in functions */
1487 int rbufnum; /* (M) startup compiler buffer */
1488 int dbufnum; /* (M) dollar variables */
1489 int sbufnum; /* (M) subterm variables */
1490 int zbufnum; /* (M) special values */
1491 int SkipClears; /* (M) Number of .clear to skip at start */
1492 int gTokensWriteFlag; /* (M) */
1493 int gfunpowers; /* (M) */
1494 int gStatsFlag; /* (M) */
1495 int gNamesFlag; /* (M) */
1496 int gCodesFlag; /* (M) */
1497 int gSortType; /* (M) */
1498 int gproperorderflag; /* (M) */
1499 int hparallelflag; /* (M) */
1500 int gparallelflag; /* (M) */
1501 int totalnumberofthreads; /* (M) */
1502 int gSizeCommuteInSet;
1503 int gThreadStats;
1504 int ggThreadStats;
1505 int gFinalStats;
1506 int ggFinalStats;
1507 int gThreadsFlag;
1508 int ggThreadsFlag;
1509 int gThreadBalancing;
1510 int ggThreadBalancing;
1511 int gThreadSortFileSynch;
1512 int ggThreadSortFileSynch;
1513 int gProcessStats;
1514 int ggProcessStats;
1515 int gOldParallelStats;
1516 int ggOldParallelStats;
1517 int maxFlevels; /* () maximum function levels */
1518 int resetTimeOnClear; /* (M) */
1519 int gcNumDollars; /* () number of dollars for .clear */
1520 int MultiRun;
1521 int gNoSpacesInNumbers; /* For very long numbers */
1522 int ggNoSpacesInNumbers; /* For very long numbers */
1523 int gIsFortran90;
1524 int PrintTotalSize;
1525 int fbuffersize; /* Size for the AT.fbufnum factorization caches */
1526 int gOldFactArgFlag;
1527 int ggOldFactArgFlag;
1528 int gnumextrasym;
1529 int ggnumextrasym;
1530 int NumSpectatorFiles; /* Elements used in AM.spectatorfiles; */
1531 int SizeForSpectatorFiles; /* Size in AM.spectatorfiles; */
1532 int gOldGCDflag;
1533 int ggOldGCDflag;
1534 int gWTimeStatsFlag;
1535 int ggWTimeStatsFlag;
1536 int jumpratio;
1537 WORD MaxTal; /* (M) Maximum number of words in a number */
1538 WORD IndDum; /* (M) Basis value for dummy indices */
1539 WORD DumInd; /* (M) */
1540 WORD WilInd; /* (M) Offset for wildcard indices */
1541 WORD gncmod; /* (M) Global setting of modulus. size of gcmod */
1542 WORD gnpowmod; /* (M) Global printing as powers. size gpowmod */
1543 WORD gmodmode; /* (M) Global mode for modulus */
1544 WORD gUnitTrace; /* (M) Global value of Tr[1] */
1545 WORD gOutputMode; /* (M) */
1546 WORD gOutputSpaces; /* (M) */
1547 WORD gOutNumberType; /* (M) */
1548 WORD gCnumpows; /* (M) */
1549 WORD gUniTrace[4]; /* (M) */
1550 WORD MaxWildcards; /* (M) Maximum number of wildcards */
1551 WORD mTraceDum; /* (M) Position/Offset for generated dummies */
1552 WORD OffsetIndex; /* (M) */
1553 WORD OffsetVector; /* (M) */
1554 WORD RepMax; /* (M) Max repeat levels */
1555 WORD LogType; /* (M) Type of writing to log file */
1556 WORD ggStatsFlag; /* (M) */
1557 WORD gLineLength; /* (M) */
1558 WORD qError; /* (M) Only error checking {-c option} */
1559 WORD FortranCont; /* (M) Fortran Continuation character */
1560 WORD HoldFlag; /* (M) Exit on termination? */
1561 WORD Ordering[15]; /* (M) Auxiliary for ordering wildcards */
1562 WORD silent; /* (M) Silent flag. Only results in output. */
1563 WORD tracebackflag; /* (M) For tracing errors */
1564 WORD expnum; /* (M) internal number of ^ function */
1565 WORD denomnum; /* (M) internal number of / function */
1566 WORD facnum; /* (M) internal number of fac_ function */
1567 WORD invfacnum; /* (M) internal number of invfac_ function */
1568 WORD sumnum; /* (M) internal number of sum_ function */
1569 WORD sumpnum; /* (M) internal number of sump_ function */
1570 WORD OldOrderFlag; /* (M) Flag for allowing old statement order */
1571 WORD termfunnum; /* (M) internal number of term_ function */
1572 WORD matchfunnum; /* (M) internal number of match_ function */
1573 WORD countfunnum; /* (M) internal number of count_ function */
1574 WORD gPolyFun; /* (M) global value of PolyFun */
1575 WORD gPolyFunInv; /* (M) global value of Inverse of PolyFun */
1576 WORD gPolyFunType; /* (M) global value of PolyFun */
1577 WORD gPolyFunExp;
1578 WORD gPolyFunVar;
1579 WORD gPolyFunPow;
1580 WORD dollarzero; /* (M) for dollars with zero value */
1581 WORD atstartup; /* To protect against DATE_ ending in \n */
1582 WORD exitflag; /* (R) For the exit statement */
1583 WORD NumStoreCaches; /* () Number of storage caches per processor */
1584 WORD gIndentSpace; /* For indentation in output */
1585 WORD ggIndentSpace;
1588 WORD gextrasymbols;
1589 WORD ggextrasymbols;
1590 WORD zerorhs;
1591 WORD onerhs;
1592 WORD havesortdir;
1593 WORD vectorzero; /* p0_ */
1594 WORD ClearStore;
1595 WORD BracketFactors[8];
1596 BOOL FromStdin; /* read the input from STDIN */
1597 BOOL IgnoreDeprecation; /* ignore deprecation warning */
1598};
1599/*
1600 #] M :
1601 #[ P : The P struct defines objects set by the preprocessor
1602*/
1610struct P_const {
1611 LIST DollarList; /* (R) Dollar variables. Contains pointers
1612 to contents of the variables.*/
1613 LIST PreVarList; /* (R) List of preprocessor variables
1614 Points to contents. Can be changed */
1615 LIST LoopList; /* (P) List of do loops */
1616 LIST ProcList; /* (P) List of procedures */
1617 INSIDEINFO inside; /* Information during #inside/#endinside */
1618 NAMESPACE *firstnamespace; /* is zero when no namespace specified */
1619 NAMESPACE *lastnamespace; /* is zero when no namespace specified */
1620 UBYTE *fullname; /* buffer for namespace expanded names */
1621 UBYTE **PreSwitchStrings; /* (P) The string in a switch */
1622 UBYTE *preStart; /* (P) Preprocessor instruction buffer */
1623 UBYTE *preStop; /* (P) end of preStart */
1624 UBYTE *preFill; /* (P) Filling point in preStart */
1625 UBYTE *procedureExtension; /* (P) Extension for procedure files (prc) */
1626 UBYTE *cprocedureExtension; /* (P) Extension after .clear */
1627 LONG *PreAssignStack; /* For nesting #$name assignments */
1628 int *PreIfStack; /* (P) Tracks nesting of #if */
1629 int *PreSwitchModes; /* (P) Stack of switch status */
1630 int *PreTypes; /* (P) stack of #call, #do etc nesting */
1631#ifdef WITHPTHREADS
1632 pthread_mutex_t PreVarLock; /* (P) */
1633#endif
1634 LONG StopWatchZero; /* For `timer_' and #reset timer */
1635 LONG InOutBuf; /* (P) Characters in the output buf in pre.c */
1636 LONG pSize; /* (P) size of preStart */
1637 int PreAssignFlag; /* (C) Indicates #assign -> catch dollar */
1638 int PreContinuation; /* (C) Indicates whether the statement is new */
1639 int PreproFlag; /* (P) Internal use to mark work on prepro instr. */
1640 int iBufError; /* (P) Flag for errors with input buffer */
1641 int PreOut; /* (P) Flag for #+ #- */
1642 int PreSwitchLevel; /* (P) Nesting of #switch */
1643 int NumPreSwitchStrings; /* (P) Size of PreSwitchStrings */
1644 int MaxPreTypes; /* (P) Size of PreTypes */
1645 int NumPreTypes; /* (P) Number of nesting objects in PreTypes */
1646 int MaxPreIfLevel; /* (C) Maximum number of nested #if. Dynamic */
1647 int PreIfLevel; /* (C) Current position if PreIfStack */
1648 int PreInsideLevel; /* (C) #inside active? */
1649 int DelayPrevar; /* (P) Delaying prevar substitution */
1650 int AllowDelay; /* (P) Allow delayed prevar substitution */
1651 int lhdollarerror; /* (R) */
1652 int eat; /* () */
1653 int gNumPre; /* (P) Number of preprocessor variables for .clear */
1654 int PreDebug; /* (C) */
1655 int OpenDictionary;
1656 int PreAssignLevel; /* For nesting #$name = ...; assignments */
1657 int MaxPreAssignLevel; /* For nesting #$name = ...; assignments */
1658 int fullnamesize; /* size of the fullname buffer */
1659 int FoundFileSetupCount; /* The number of "file setup" (#:) lines */
1660 WORD DebugFlag; /* (P) For debugging purposes */
1661 WORD preError; /* (P) Blocks certain types of execution */
1662 UBYTE ComChar; /* (P) Commentary character */
1663 UBYTE cComChar; /* (P) Old commentary character for .clear */
1664};
1665
1666/*
1667 #] P :
1668 #[ C : The C struct defines objects changed by the compiler
1669*/
1670
1679struct C_const {
1681 POSITION StoreFileSize; /* () Size of store file */
1686 /* Later also for write? */
1699/*
1700 Compile buffer variables
1701*/
1703/*
1704 Objects for auto declarations
1705*/
1706 LIST AutoSymbolList; /* (C) */
1707 LIST AutoIndexList; /* (C) */
1708 LIST AutoVectorList; /* (C) */
1709 LIST AutoFunctionList; /* (C) */
1712 LIST *Symbols; /* (C) Pointer for autodeclare. Which list is
1713 it searching. Later also for subroutines */
1714 LIST *Indices; /* (C) id. */
1715 LIST *Vectors; /* (C) id. */
1716 LIST *Functions; /* (C) id. */
1717 NAMETREE **activenames;
1722 SWITCH *SwitchArray;
1723 MODEL **models;
1724 WORD *SwitchHeap;
1727 UWORD *cmod;
1728 UWORD *powmod;
1729 UWORD *modpowers;
1730 UWORD *halfmod; /* (C) half the modulus when not zero */
1731 WORD *ProtoType; /* (C) The subexpression prototype {wildcards} */
1732 WORD *WildC; /* (C) Filling point for wildcards. */
1733 LONG *IfHeap;
1734 LONG *IfCount;
1735 LONG *IfStack;
1736 UBYTE *iBuffer;
1737 UBYTE *iPointer;
1738 UBYTE *iStop;
1739 UBYTE **LabelNames;
1743 int *Labels;
1744 SBYTE *tokens;
1745 SBYTE *toptokens;
1748 UWORD *modinverses; /* Table for inverses of primes */
1749 UBYTE *Fortran90Kind; /* The kind of number in Fortran 90 as in _ki */
1750 WORD **MultiBracketBuf; /* Array of buffers for multi-level brackets */
1751 UBYTE *extrasym; /* Array with the name for extra symbols in ToPolynomial */
1752 WORD *doloopstack; /* To keep track of begin and end of doloops */
1753 WORD *doloopnest; /* To keep track of nesting of doloops etc */
1759 WORD *CommuteInSet; /* groups of noncommuting functions that can commute */
1760 UBYTE *TestValue; /* For debugging */
1761#ifdef PARALLELCODE
1762 LONG *inputnumbers;
1763 WORD *pfirstnum;
1764#endif
1765#ifdef WITHPTHREADS
1766 pthread_mutex_t halfmodlock; /* () Lock for adding buffer for halfmod */
1767#endif
1768 LONG argstack[MAXNEST]; /* (C) {contents} Stack for nesting of Argument */
1769 LONG insidestack[MAXNEST]; /* (C) {contents} Stack for Argument or Inside. */
1770 LONG inexprstack[MAXNEST]; /* (C) {contents} Stack for Argument or Inside. */
1771 LONG iBufferSize; /* (C) Size of the input buffer */
1772 LONG TransEname; /* (C) Used when a new definition overwrites
1773 an old expression. */
1774 LONG ProcessBucketSize; /* (C) */
1775 LONG mProcessBucketSize; /* (C) */
1776 LONG CModule; /* (C) Counter of current module */
1777 LONG ThreadBucketSize; /* (C) Roughly the maximum number of input terms */
1781#ifdef WITHFLOAT
1782 LONG DefaultPrecision; /* (C) Default precision in bits for float_ */
1783 LONG MaxWeight; /* (C) Maximum weight for MZV or Euler */
1784 LONG tDefaultPrecision; /* (C) Default precision in bits for float_ */
1785 LONG tMaxWeight; /* (C) Maximum weight for MZV or Euler */
1786#endif
1788 int AutoDeclareFlag;
1790 int NoShowInput; /* (C) No listing of input as in .prc, #do */
1791 int ShortStats; /* (C) */
1792 int compiletype; /* (C) type of statement {DECLARATION etc} */
1793 int firstconstindex; /* (C) flag for giving first error message */
1794 int insidefirst; /* (C) Not used yet */
1795 int minsidefirst; /* (?) Not used yet */
1796 int wildflag; /* (C) Flag for marking use of wildcards */
1797 int NumLabels; /* (C) Number of labels {in Labels} */
1798 int MaxLabels; /* (C) Size of Labels array */
1799 int lDefDim; /* (C) */
1800 int lDefDim4; /* (C) */
1801 int NumWildcardNames; /* (C) Number of ?a variables */
1802 int WildcardBufferSize; /* (C) size of WildcardNames buffer */
1803 int MaxIf; /* (C) size of IfHeap, IfSumCheck, IfCount */
1804 int NumStreams; /* (C) */
1805 int MaxNumStreams; /* (C) */
1806 int firstctypemessage; /* (C) Flag for giving first st order error */
1807 int tablecheck; /* (C) For table checking */
1808 int idoption; /* (C) */
1809 int BottomLevel; /* (C) For propercount. Not used!!! */
1810 int CompileLevel; /* (C) Subexpression level */
1811 int TokensWriteFlag; /* (C) */
1812 int UnsureDollarMode; /* (C)?Controls error messages undefined $'s */
1813 int outsidefun; /* (C) Used for writing Tables to file */
1814 int funpowers; /* (C) */
1815 int WarnFlag; /* (C) */
1816 int StatsFlag; /* (C) */
1817 int NamesFlag; /* (C) */
1818 int CodesFlag; /* (C) */
1819 int SetupFlag; /* (C) */
1820 int SortType; /* (C) */
1821 int lSortType; /* (C) */
1822 int ThreadStats; /* (C) */
1823 int FinalStats; /* (C) */
1824 int OldParallelStats; /* (C) */
1825 int ThreadsFlag;
1826 int ThreadBalancing;
1827 int ThreadSortFileSynch;
1828 int ProcessStats; /* (C) */
1829 int BracketNormalize; /* (C) Indicates whether the bracket st is normalized */
1830 int maxtermlevel; /* (C) Size of termstack */
1831 int dumnumflag; /* (C) Where there dummy indices in tokenizer? */
1832 int bracketindexflag; /* (C) Are brackets going to be indexed? */
1833 int parallelflag; /* (C) parallel allowed? */
1834 int mparallelflag; /* (C) parallel allowed in this module? */
1835 int inparallelflag; /* (C) inparallel allowed? */
1836 int partodoflag; /* (C) parallel allowed? */
1837 int properorderflag; /* (C) clean normalizing. */
1838 int vetofilling; /* (C) vetoes overwriting in tablebase stubs */
1839 int tablefilling; /* (C) to notify AddRHS we are filling a table */
1840 int vetotablebasefill; /* (C) For the load in tablebase */
1841 int exprfillwarning; /* (C) Warning has been printed for expressions in fill statements */
1842 int lhdollarflag; /* (R) left hand dollar present */
1843 int NoCompress; /* (R) Controls native compression */
1844 int IsFortran90; /* Tells whether the Fortran is Fortran90 */
1845 int MultiBracketLevels; /* Number of elements in MultiBracketBuf */
1846 int topolynomialflag; /* To avoid ToPolynomial and FactArg together */
1847 int ffbufnum; /* Buffer number for user defined factorizations */
1848 int OldFactArgFlag;
1849 int MemDebugFlag; /* Only used when MALLOCDEBUG in tools.c */
1850 int OldGCDflag;
1851 int OldPRFSignFlag;
1852 int WTimeStatsFlag;
1853 int SortReallocateFlag; /* Controls reallocation of large+small buffer at module end.
1854 0 : Off
1855 1 : On, every module (set by On sortreallocate;)
1856 2 : On, single module (set by #sortreallocate) */
1857 int PrintBacktraceFlag; /* Print backtrace on terminate? */
1858 int FlintPolyFlag; /* Use Flint for polynomial arithmetic */
1859 int HumanStatsFlag; /* Print human-readable stats in the stats print? */
1860 int GrccVerbose; /* Enable extra print statements in grcc? */
1861 int SortVerbose; /* Enable extra sort stats information? */
1862 int doloopstacksize;
1863 int dolooplevel;
1868 int SizeCommuteInSet; /* Size of the CommuteInSet buffer */
1869#ifdef PARALLELCODE
1870 int numpfirstnum; /* For redefine */
1871 int sizepfirstnum; /* For redefine */
1872#endif
1873 int origin; /* Determines whether .sort or ModuleOption */
1874 int vectorlikeLHS;
1875 int nummodels;
1876 int modelspace;
1877 int ModelLevel;
1878 int ShortStatsMax; /* For On FewerStatistics 10; */
1879 int InnerTest; /* For debugging */
1880 WORD argsumcheck[MAXNEST]; /* (C) Checking of nesting */
1881 WORD insidesumcheck[MAXNEST];/* (C) Checking of nesting */
1882 WORD inexprsumcheck[MAXNEST];/* (C) Checking of nesting */
1883 WORD RepSumCheck[MAXREPEAT];/* (C) Checks nesting of repeat, if, argument */
1884 WORD lUniTrace[4]; /* (C) */
1885 WORD RepLevel; /* (C) Tracks nesting of repeat. */
1886 WORD arglevel; /* (C) level of nested argument statements */
1887 WORD insidelevel; /* (C) level of nested inside statements */
1888 WORD inexprlevel; /* (C) level of nested inexpr statements */
1889 WORD termlevel; /* (C) level of nested term statements */
1890 WORD MustTestTable; /* (C) Indicates whether tables have been changed */
1891 WORD DumNum; /* (C) */
1892 WORD ncmod; /* (C) Local setting of modulus. size of cmod */
1893 WORD npowmod; /* (C) Local printing as powers. size powmod */
1894 WORD modmode; /* (C) Mode for modulus calculus */
1895 WORD nhalfmod; /* relevant word size of halfmod when defined */
1896 WORD DirtPow; /* (C) Flag for changes in printing mod powers */
1897 WORD lUnitTrace; /* (C) Local value of Tr[1] */
1898 WORD NwildC; /* (C) Wildcard counter */
1899 WORD ComDefer; /* (C) defer brackets */
1900 WORD CollectFun; /* (C) Collect function number */
1901 WORD AltCollectFun; /* (C) Alternate Collect function number */
1902 WORD OutputMode; /* (C) */
1903 WORD Cnumpows;
1904 WORD OutputSpaces; /* (C) */
1905 WORD OutNumberType; /* (C) Controls RATIONAL/FLOAT output */
1906 WORD DidClean; /* (C) Test whether nametree needs cleaning */
1907 WORD IfLevel; /* (C) */
1908 WORD WhileLevel; /* (C) */
1909 WORD SwitchLevel;
1910 WORD SwitchInArray;
1911 WORD MaxSwitch;
1912 WORD LogHandle; /* (C) The Log File */
1913 WORD LineLength; /* (C) */
1914 WORD StoreHandle; /* (C) Handle of .str file */
1915 WORD HideLevel; /* (C) Hiding indicator */
1916 WORD lPolyFun; /* (C) local value of PolyFun */
1917 WORD lPolyFunInv; /* (C) local value of Inverse of PolyFun */
1918 WORD lPolyFunType; /* (C) local value of PolyFunType */
1919 WORD lPolyFunExp;
1920 WORD lPolyFunVar;
1921 WORD lPolyFunPow;
1922 WORD SymChangeFlag; /* (C) */
1923 WORD CollectPercentage; /* (C) Collect function percentage */
1924 WORD extrasymbols; /* Flag for the extra symbols output mode */
1925 WORD PolyRatFunChanged; /* Keeps track whether we changed in the compiler */
1926 WORD ToBeInFactors;
1927#ifdef WITHMPI
1928 WORD RhsExprInModuleFlag; /* (C) Set by the compiler if RHS expressions exists. */
1929#endif
1930 UBYTE Commercial[COMMERCIALSIZE+2]; /* (C) Message to be printed in statistics */
1931 UBYTE debugFlags[MAXFLAGS+2]; /* On/Off Flag number(s) */
1932};
1933/*
1934 #] C :
1935 #[ S : The S struct defines objects changed at the start of the run (Processor)
1936 Basically only set by the master.
1937*/
1945struct S_const {
1946 POSITION MaxExprSize; /* ( ) Maximum size of in/out/sort */
1947#ifdef WITHPTHREADS
1948 pthread_mutex_t inputslock;
1949 pthread_mutex_t outputslock;
1950 pthread_mutex_t MaxExprSizeLock;
1951#endif
1952 POSITION *OldOnFile; /* (S) File positions of expressions */
1953 WORD *OldNumFactors; /* ( ) NumFactors in (old) expression */
1954 WORD *Oldvflags; /* ( ) vflags in (old) expression */
1955 WORD *Olduflags; /* ( ) uflags in (old) expression */
1956#ifdef WITHFLOAT
1957 void *delta_1;
1958#endif
1959 int NumOldOnFile; /* (S) Number of expressions in OldOnFile */
1960 int NumOldNumFactors; /* (S) Number of expressions in OldNumFactors */
1961 int MultiThreaded; /* (S) Are we running multi-threaded? */
1962#ifdef WITHPTHREADS
1963 int MasterSort; /* Final stage of sorting to the master */
1964#endif
1965#ifdef WITHMPI
1966 int printflag; /* controls MesPrint() on each slave */
1967#endif
1968 int Balancing; /* For second stage loadbalancing */
1969 WORD ExecMode; /* (S) */
1970
1971 WORD CollectOverFlag; /* (R) Indicates overflow at Collect */
1972#ifdef WITHPTHREADS
1973 WORD sLevel; /* Copy of AR0.sLevel because it can get messy */
1974#endif
1975};
1976/*
1977 #] S :
1978 #[ R : The R struct defines objects changed at run time.
1979 They determine the environment that has to be transferred
1980 together with a term during multithreaded execution.
1981*/
1990struct R_const {
1991 FILEDATA StoreData; /* (O) */
1992 FILEHANDLE Fscr[3]; /* (R) Dollars etc play with it too */
1993 FILEHANDLE FoStage4[2]; /* (R) In Sort. Stage 4. */
1994 POSITION DefPosition; /* (R) Deferred position of keep brackets. */
1995 FILEHANDLE *infile; /* (R) Points alternatingly to Fscr[0] or Fscr[1] */
1996 FILEHANDLE *outfile; /* (R) Points alternatingly to Fscr[1] or Fscr[0] */
1997 FILEHANDLE *hidefile; /* (R) Points to Fscr[2] */
1998
1999 WORD *CompressBuffer; /* (M) */
2000 WORD *ComprTop; /* (M) */
2001 WORD *CompressPointer; /* (R) */
2002 COMPAREDUMMY CompareRoutine;
2003 ULONG *wranfia;
2004 SBYTE *moebiustable;
2005
2006 LONG OldTime; /* (R) Zero time. Needed in timer. */
2007 LONG InInBuf; /* (R) Characters in input buffer. Scratch files. */
2008 LONG InHiBuf; /* (R) Characters in hide buffer. Scratch file. */
2009 LONG pWorkSize; /* (R) Size of pWorkSpace */
2010 LONG lWorkSize; /* (R) Size of lWorkSpace */
2011 LONG posWorkSize; /* (R) Size of posWorkSpace */
2012 ULONG wranfseed;
2013 int NoCompress; /* (R) Controls native compression */
2014 int gzipCompress; /* (R) Controls gzip compression */
2015 int Cnumlhs; /* Local copy of cbuf[rbufnum].numlhs */
2016 int outtohide; /* Indicates that output is directly to hide */
2017#ifdef WITHPTHREADS
2018 int exprtodo; /* The expression to do in parallel mode */
2019#endif
2020 int wranfcall;
2021 int wranfnpair1;
2022 int wranfnpair2;
2023#if ( BITSINWORD == 32 )
2024 WORD PrimeList[5000];
2025 WORD numinprimelist;
2026 WORD notfirstprime;
2027#endif
2028 WORD GetFile; /* (R) Where to get the terms {like Hide} */
2029 WORD KeptInHold; /* (R) */
2030 WORD BracketOn; /* (R) Intensely used in poly_ */
2031 WORD MaxBracket; /* (R) Size of BrackBuf. Changed by poly_ */
2032 WORD CurDum; /* (R) Current maximum dummy number */
2033 WORD DeferFlag; /* (R) For deferred brackets */
2034 WORD TePos; /* (R) */
2035 WORD sLevel; /* (R) Sorting level */
2036 WORD Stage4Name; /* (R) Sorting only */
2037 WORD GetOneFile; /* (R) Getting from hide or regular */
2038 WORD PolyFun; /* (C) Number of the PolyFun function */
2039 WORD PolyFunInv; /* (C) Number of the Inverse of the PolyFun function */
2040 WORD PolyFunType; /* () value of PolyFunType */
2041 WORD PolyFunExp;
2042 WORD PolyFunVar;
2043 WORD PolyFunPow;
2044 WORD Eside; /* () Tells which side of = sign */
2045 WORD MaxDum; /* Maximum dummy value in an expression */
2046 WORD level; /* Running level in Generator */
2047 WORD expchanged; /* (R) Info about expression */
2048 WORD expflags; /* (R) Info about expression */
2049 WORD CurExpr; /* (S) Number of current expression */
2050 WORD SortType; /* A copy of AC.SortType to play with */
2051 WORD ShortSortCount; /* For On FewerStatistics 10; */
2052 WORD modeloptions;
2053 WORD funoffset;
2054 WORD moebiustablesize;
2055};
2056
2057/*
2058 #] R :
2059 #[ T : These are variables that stay in each thread during multi threaded execution.
2060*/
2069struct T_const {
2070#ifdef WITHPTHREADS
2071 SORTBLOCK SB;
2072#endif
2073 SORTING *S0; /* (-) The thread specific sort buffer */
2074 SORTING *SS; /* (R) Current sort buffer */
2075 NESTING Nest; /* (R) Nesting of function levels etc. */
2076 NESTING NestStop; /* (R) */
2077 NESTING NestPoin; /* (R) */
2078 WORD *BrackBuf; /* (R) Bracket buffer. Used by poly_ at runtime. */
2079 STORECACHE StoreCache; /* (R) Cache for picking up stored expr. */
2080 STORECACHE StoreCacheAlloc; /* (R) Permanent address of StoreCache to keep valgrind happy */
2081 WORD **pWorkSpace; /* (R) Workspace for pointers. Dynamic. */
2082 LONG *lWorkSpace; /* (R) WorkSpace for LONG. Dynamic. */
2083 POSITION *posWorkSpace; /* (R) WorkSpace for file positions */
2084 WORD *WorkSpace; /* (M) */
2085 WORD *WorkTop; /* (M) */
2086 WORD *WorkPointer; /* (R) Pointer in the WorkSpace heap. */
2087 int *RepCount; /* (M) Buffer for repeat nesting */
2088 int *RepTop; /* (M) Top of RepCount buffer */
2089 WORD *WildArgTaken; /* (N) Stack for wildcard pattern matching */
2090 UWORD *factorials; /* (T) buffer of factorials. Dynamic. */
2091 WORD *small_power_n; /* length of the number */
2092 UWORD **small_power; /* the number*/
2093 UWORD *bernoullis; /* (T) The buffer with Bernoulli numbers. Dynamic. */
2094 WORD *primelist;
2095 LONG *pfac; /* (T) array of positions of factorials. Dynamic. */
2096 LONG *pBer; /* (T) array of positions of Bernoulli's. Dynamic. */
2097 WORD *TMaddr; /* (R) buffer for TestSub */
2098 WORD *WildMask; /* (N) Wildcard info during pattern matching */
2099 WORD *previousEfactor; /* () Cache for factors in expressions */
2100 WORD **TermMemHeap; /* For TermMalloc. Set zero in Checkpoint */
2101 UWORD **NumberMemHeap; /* For NumberMalloc. Set zero in Checkpoint */
2102 UWORD **CacheNumberMemHeap; /* For CacheNumberMalloc. Set zero in Checkpoint */
2103 BRACKETINFO *bracketinfo;
2104 WORD **ListPoly;
2105 WORD *ListSymbols;
2106 UWORD *NumMem;
2107 WORD *TopologiesTerm;
2108 WORD *TopologiesStart;
2109#ifdef WITHFLOAT
2110 WORD *indi1;
2111 WORD *indi2;
2112 void *mpf_tab1;
2113 void *mpf_tab2;
2114 void *aux_;
2115 void *auxr_;
2116#endif
2117 NORMDATA **NormData;
2118 LONG NormDataSize;
2119 LONG NormDepth;
2120 PARTI partitions;
2121 LONG sBer; /* (T) Size of the Bernoullis buffer */
2122 LONG pWorkPointer; /* (R) Offset-pointer in pWorkSpace */
2123 LONG lWorkPointer; /* (R) Offset-pointer in lWorkSpace */
2124 LONG posWorkPointer; /* (R) Offset-pointer in posWorkSpace */
2125 LONG InNumMem;
2126 int sfact; /* (T) size of the factorials buffer */
2127 int mfac; /* (T) size of the pfac array. */
2128 int ebufnum; /* (R) extra compiler buffer */
2129 int fbufnum; /* extra compiler buffer for factorization cache */
2130 int allbufnum; /* extra compiler buffer for id,all */
2131 int aebufnum; /* extra compiler buffer for id,all */
2132 int idallflag; /* indicates use of id,all buffers */
2133 int idallnum;
2134 int idallmaxnum;
2135 int WildcardBufferSize; /* () local copy for updates */
2136#ifdef WITHPTHREADS
2137 int identity; /* () When we work with B->T */
2138 int LoadBalancing; /* Needed for synchronization */
2139#ifdef WITHSORTBOTS
2140 int SortBotIn1; /* Input stream 1 for a SortBot */
2141 int SortBotIn2; /* Input stream 2 for a SortBot */
2142#endif
2143#endif
2144 int TermMemMax; /* For TermMalloc. Set zero in Checkpoint */
2145 int TermMemTop; /* For TermMalloc. Set zero in Checkpoint */
2146 int NumberMemMax; /* For NumberMalloc. Set zero in Checkpoint */
2147 int NumberMemTop; /* For NumberMalloc. Set zero in Checkpoint */
2148 int CacheNumberMemMax; /* For CacheNumberMalloc. Set zero in Checkpoint */
2149 int CacheNumberMemTop; /* For CacheNumberMalloc. Set zero in Checkpoint */
2150 int bracketindexflag; /* Are brackets going to be indexed? */
2151 int optimtimes; /* Number of the evaluation of the MCTS tree */
2152 int ListSymbolsSize;
2153 int NumListSymbols;
2154 int numpoly;
2155 int LeaveNegative;
2156 int TrimPower; /* Indicates trimming in polyratfun expansion */
2157 WORD small_power_maxx; /* size of the cache for small powers */
2158 WORD small_power_maxn; /* size of the cache for small powers */
2159 WORD dummysubexp[SUBEXPSIZE+4]; /* () used in normal.c */
2160 WORD comsym[8]; /* () Used in tools.c = {8,SYMBOL,4,0,1,1,1,3} */
2161 WORD comnum[4]; /* () Used in tools.c = { 4,1,1,3 } */
2162 WORD comfun[FUNHEAD+4]; /* () Used in tools.c = {7,FUNCTION,3,0,1,1,3} */
2163 /* or { 8,FUNCTION,4,0,0,1,1,3 } */
2164 WORD comind[7]; /* () Used in tools.c = {7,INDEX,3,0,1,1,3} */
2165 WORD MinVecArg[7+ARGHEAD]; /* (N) but should be more local */
2166 WORD FunArg[4+ARGHEAD+FUNHEAD]; /* (N) but can be more local */
2167 WORD locwildvalue[SUBEXPSIZE]; /* () Used in argument.c = {SUBEXPRESSION,SUBEXPSIZE,0,0,0} */
2168 WORD mulpat[SUBEXPSIZE+5]; /* () Used in argument.c = {TYPEMULT, SUBEXPSIZE+3, 0, */
2169 /* SUBEXPRESSION, SUBEXPSIZE, 0, 1, 0, 0, 0 } */
2170 WORD proexp[SUBEXPSIZE+5]; /* () Used in poly.c */
2171 WORD TMout[40]; /* (R) Passing info */
2172 WORD TMbuff; /* (R) Communication between TestSub and Genera */
2173 WORD TMdolfac; /* factor number for dollar */
2174 WORD nfac; /* (T) Number of highest stored factorial */
2175 WORD nBer; /* (T) Number of highest Bernoulli number. */
2176 WORD mBer; /* (T) Size of buffer pBer. */
2177 WORD PolyAct; /* (R) Used for putting the PolyFun at end. ini at 0 */
2178 WORD RecFlag; /* (R) Used in TestSub. ini at zero. */
2179 WORD inprimelist;
2180 WORD sizeprimelist;
2181 WORD fromindex; /* Tells the compare routine whether call from index */
2182 WORD setinterntopo; /* Set of internal momenta for topogen */
2183 WORD setexterntopo; /* Set of external momenta for topogen */
2184 WORD TopologiesLevel;
2185 WORD TopologiesOptions[2];
2186#ifdef WITHFLOAT
2187 WORD FloatPos;
2188 WORD SortFloatMode;
2189#endif
2190};
2191/*
2192 #] T :
2193 #[ N : The N struct contains variables used in running information
2194 that is inside blocks that should not be split, like pattern
2195 matching, traces etc. They are local for each thread.
2196 They don't need initializations.
2197*/
2206struct N_const {
2207 POSITION theposition; /* () Used in index.c */
2208 WORD *EndNest; /* (R) Nesting of function levels etc. */
2209 WORD *Frozen; /* (R) Bracket info */
2210 WORD *FullProto; /* (R) Prototype of a subexpression or table */
2211 WORD *cTerm; /* (R) Current term for coef_ and term_ */
2212 int *RepPoint; /* (R) Pointer in RepCount buffer. Tracks repeat */
2213 WORD *WildValue; /* (N) Wildcard info during pattern matching */
2214 WORD *WildStop; /* (N) Wildcard info during pattern matching */
2215 WORD *argaddress; /* (N) Used in pattern matching of arguments */
2216 WORD *RepFunList; /* (N) For pattern matching */
2217 WORD *patstop; /* (N) Used in pattern matching */
2218 WORD *terstop; /* (N) Used in pattern matching */
2219 WORD *terstart; /* (N) Used in pattern matching */
2220 WORD *terfirstcomm; /* (N) Used in pattern matching */
2221 WORD *DumFound; /* (N) For renumbering indices {make local?} */
2222 WORD **DumPlace; /* (N) For renumbering indices {make local?} */
2223 WORD **DumFunPlace; /* (N) For renumbering indices {make local?} */
2224 WORD *UsedSymbol; /* (N) When storing terms of a global expr. */
2225 WORD *UsedVector; /* (N) When storing terms of a global expr. */
2226 WORD *UsedIndex; /* (N) When storing terms of a global expr. */
2227 WORD *UsedFunction; /* (N) When storing terms of a global expr. */
2228 WORD *MaskPointer; /* (N) For wildcard pattern matching */
2229 WORD *ForFindOnly; /* (N) For wildcard pattern matching */
2230 WORD *findTerm; /* (N) For wildcard pattern matching */
2231 WORD *findPattern; /* (N) For wildcard pattern matching */
2232#ifdef WITHZLIB
2233 Bytef **ziobufnum; /* () Used in compress.c */
2234 Bytef *ziobuffers; /* () Used in compress.c */
2235#endif
2236 WORD *dummyrenumlist; /* () Used in execute.c and store.c */
2237 int *funargs; /* () Used in lus.c */
2238 WORD **funlocs; /* () Used in lus.c */
2239 int *funinds; /* () Used in lus.c */
2240 UWORD *NoScrat2; /* () Used in normal.c */
2241 WORD *ReplaceScrat; /* () Used in normal.c */
2242 TRACES *tracestack; /* () used in opera.c */
2243 WORD *selecttermundo; /* () Used in pattern.c */
2244 WORD *patternbuffer; /* () Used in pattern.c */
2245 WORD *termbuffer; /* () Used in pattern.c */
2246 WORD **PoinScratch; /* () used in reshuf.c */
2247 WORD **FunScratch; /* () used in reshuf.c */
2248 WORD *RenumScratch; /* () used in reshuf.c */
2249 FUN_INFO *FunInfo; /* () Used in smart.c */
2250 WORD **SplitScratch; /* () Used in sort.c */
2251 WORD **SplitScratch1; /* () Used in sort.c */
2252 SORTING **FunSorts; /* () Used in sort.c */
2253 UWORD *SoScratC; /* () Used in sort.c */
2254 WORD *listinprint; /* () Used in proces.c and message.c */
2255 WORD *currentTerm; /* () Used in proces.c and message.c */
2256 WORD **arglist; /* () Used in function.c */
2257 int *tlistbuf; /* () used in lus.c */
2258#ifdef WHICHSUBEXPRESSION
2259 UWORD *BinoScrat; /* () Used in proces.c */
2260#endif
2261 WORD *compressSpace; /* () Used in sort.c */
2262#ifdef WITHPTHREADS
2263 THREADBUCKET *threadbuck;
2264 EXPRESSIONS expr;
2265#endif
2266 UWORD *SHcombi;
2267 WORD *poly_vars;
2268 UWORD *cmod; /* Local setting of modulus. Pointer to value. */
2269 SHvariables SHvar;
2270 LONG deferskipped; /* () Used in proces.c store.c and parallel.c */
2271 LONG InScratch; /* () Used in sort.c */
2272 LONG SplitScratchSize; /* () Used in sort.c */
2273 LONG InScratch1; /* () Used in sort.c */
2274 LONG SplitScratchSize1; /* () Used in sort.c */
2275 LONG ninterms; /* () Used in proces.c and sort.c */
2276#ifdef WITHPTHREADS
2277 LONG inputnumber; /* () For use in redefine */
2278 LONG lastinindex;
2279#endif
2280#ifdef WHICHSUBEXPRESSION
2281 LONG last2; /* () Used in proces.c */
2282 LONG last3; /* () Used in proces.c */
2283#endif
2284 LONG SHcombisize;
2285 int NumTotWildArgs; /* (N) Used in pattern matching */
2286 int UseFindOnly; /* (N) Controls pattern routines */
2287 int UsedOtherFind; /* (N) Controls pattern routines */
2288 int ErrorInDollar; /* (R) */
2289 int numfargs; /* () Used in lus.c */
2290 int numflocs; /* () Used in lus.c */
2291 int nargs; /* () Used in lus.c */
2292 int tohunt; /* () Used in lus.c */
2293 int numoffuns; /* () Used in lus.c */
2294 int funisize; /* () Used in lus.c */
2295 int RSsize; /* () Used in normal.c */
2296 int numtracesctack; /* () used in opera.c */
2297 int intracestack; /* () used in opera.c */
2298 int numfuninfo; /* () Used in smart.c */
2299 int NumFunSorts; /* () Used in sort.c */
2300 int MaxFunSorts; /* () Used in sort.c */
2301 int arglistsize; /* () Used in function.c */
2302 int tlistsize; /* () used in lus.c */
2303 int filenum; /* () used in setfile.c */
2304 int compressSize; /* () Used in sort.c */
2305 int polysortflag;
2306 int nogroundlevel; /* () Used to see whether pattern matching at groundlevel */
2307 int subsubveto; /* () Sabotage combining subexpressions in TestSub */
2308 WORD MaxRenumScratch; /* () used in reshuf.c */
2309 WORD oldtype; /* (N) WildCard info at pattern matching */
2310 WORD oldvalue; /* (N) WildCard info at pattern matching */
2311 WORD NumWild; /* (N) Used in Wildcard */
2312 WORD RepFunNum; /* (N) Used in pattern matching */
2313 WORD DisOrderFlag; /* (N) Disorder option? Used in pattern matching */
2314 WORD WildDirt; /* (N) dirty in wildcard substitution. */
2315 WORD NumFound; /* (N) in reshuf only. Local? */
2316 WORD WildReserve; /* (N) Used in the wildcards */
2317 WORD TeInFun; /* (R) Passing type of action */
2318 WORD TeSuOut; /* (R) Passing info. Local? */
2319 WORD WildArgs; /* (R) */
2320 WORD WildEat; /* (R) */
2321 WORD PolyNormFlag; /* (R) For polynomial arithmetic */
2322 WORD PolyFunTodo; /* deals with expansions and multiplications */
2323 WORD sizeselecttermundo; /* () Used in pattern.c */
2324 WORD patternbuffersize; /* () Used in pattern.c */
2325 WORD numlistinprint; /* () Used in process.c */
2326 WORD ncmod; /* () used as some type of flag to disable */
2327 WORD ExpectedSign;
2329 WORD IndDum; /* Active dummy indices */
2330 WORD poly_num_vars;
2331 WORD idfunctionflag;
2332 WORD poly_vars_type; /* type of allocation. For free. */
2333 WORD tryterm; /* For EndSort(...,2) */
2334#ifdef WHICHSUBEXPRESSION
2335 WORD nbino; /* () Used in proces.c */
2336 WORD last1; /* () Used in proces.c */
2337#endif
2338};
2339
2340/*
2341 #] N :
2342 #[ O : The O struct concerns output variables
2343*/
2352struct O_const {
2353 FILEDATA SaveData; /* (O) */
2354 STOREHEADER SaveHeader; /* () System Independent save-Files */
2355 OPTIMIZERESULT OptimizeResult;
2356 UBYTE *OutputLine; /* (O) Sits also in debug statements */
2357 UBYTE *OutStop; /* (O) Top of OutputLine buffer */
2358 UBYTE *OutFill; /* (O) Filling point in OutputLine buffer */
2359 WORD *bracket; /* (O) For writing brackets */
2360 WORD *termbuf; /* (O) For writing terms */
2361 WORD *tabstring;
2362 UBYTE *wpos; /* (O) Only when storing file {local?} */
2363 UBYTE *wpoin; /* (O) Only when storing file {local?} */
2364 UBYTE *DollarOutBuffer; /* (O) Outputbuffer for Dollars */
2365 UBYTE *CurBufWrt; /* (O) Name of currently written expr. */
2366 void (*FlipWORD)(UBYTE *); /* () Function pointers for translations. Initialized by ReadSaveHeader() */
2367 void (*FlipLONG)(UBYTE *);
2368 void (*FlipPOS)(UBYTE *);
2369 void (*FlipPOINTER)(UBYTE *);
2370 void (*ResizeData)(UBYTE *,int,UBYTE *,int);
2371 void (*ResizeWORD)(UBYTE *,UBYTE *);
2372 void (*ResizeNCWORD)(UBYTE *,UBYTE *);
2373 void (*ResizeLONG)(UBYTE *,UBYTE *);
2374 void (*ResizePOS)(UBYTE *,UBYTE *);
2375 void (*ResizePOINTER)(UBYTE *,UBYTE *);
2376 void (*CheckPower)(UBYTE *);
2377 void (*RenumberVec)(UBYTE *);
2378 DICTIONARY **Dictionaries;
2379 UBYTE *tensorList; /* Dynamically allocated list with functions that are tensorial. */
2380 WORD *inscheme; /* for feeding a Horner scheme to Optimize */
2381#ifdef WITHFLOAT
2382 UBYTE *floatspace;
2383 LONG floatsize;
2384#endif
2385/*----Leave NumInBrack as first non-pointer. This is used by the checkpoints--*/
2386 LONG NumInBrack; /* (O) For typing [] option in print */
2387 LONG wlen; /* (O) Used to store files. */
2388 LONG DollarOutSizeBuffer; /* (O) Size of DollarOutBuffer */
2389 LONG DollarInOutBuffer; /* (O) Characters in DollarOutBuffer */
2390#if defined(mBSD) && defined(MICROTIME)
2391 LONG wrap; /* (O) For statistics time. wrap around */
2392 LONG wrapnum; /* (O) For statistics time. wrap around */
2393#endif
2394 OPTIMIZE Optimize;
2395 int OutInBuffer; /* (O) Which routine does the writing */
2396 int NoSpacesInNumbers; /* For very long numbers */
2397 int BlockSpaces; /* For very long numbers */
2398 int CurrentDictionary;
2399 int SizeDictionaries;
2400 int NumDictionaries;
2401 int CurDictNumbers;
2402 int CurDictVariables;
2403 int CurDictSpecials;
2404 int CurDictFunWithArgs;
2405 int CurDictNumberWarning;
2406 int CurDictNotInFunctions;
2407 int CurDictInDollars;
2408 int gNumDictionaries;
2409 int IndentSpace; /* For indentation in output */
2410#ifdef WITHFLOAT
2411 int FloatPrec;
2412#endif
2413 WORD schemenum; /* for feeding a Horner scheme to Optimize */
2414 WORD transFlag; /* () >0 indicates that translations have to be done */
2415 WORD powerFlag; /* () >0 indicates that some exponents/powers had to be adjusted */
2416 WORD mpower; /* For maxpower adjustment to larger value */
2417 WORD resizeFlag; /* () >0 indicates that something went wrong when resizing words */
2418 WORD bufferedInd; /* () Contains extra INDEXENTRIES, see ReadSaveIndex() for an explanation */
2419 WORD OutSkip; /* (O) How many chars to skip in output line */
2420 WORD IsBracket; /* (O) Controls brackets */
2421 WORD InFbrack; /* (O) For writing only */
2422 WORD PrintType; /* (O) */
2423 WORD FortFirst; /* (O) Only in sch.c */
2424 WORD DoubleFlag; /* (O) Output in double precision */
2425 WORD FactorMode; /* When the output should be written as factors */
2426 WORD FactorNum; /* Number of factor currently treated */
2427 WORD ErrorBlock;
2428 WORD OptimizationLevel; /* Level of optimization in the output */
2429 UBYTE FortDotChar; /* (O) */
2430/*
2431 For the padding, please count also the number of int's in the OPTIMIZE struct.
2432*/
2433};
2434/*
2435 #] O :
2436 #[ X : The X struct contains variables that deal with the external channel
2437*/
2445struct X_const {
2446 UBYTE *currentPrompt;
2447 UBYTE *shellname; /* if !=NULL (default is "/bin/sh -c"), start in
2448 the specified subshell*/
2449 UBYTE *stderrname; /* If !=NULL (default if "/dev/null"), stderr is
2450 redirected to the specified file*/
2451 int timeout; /* timeout to initialize preset channels.
2452 If timeout<0, the preset channels are
2453 already initialized*/
2454 int killSignal; /* signal number, SIGKILL by default*/
2455 int killWholeGroup; /* if 0, the signal is sent only to a process,
2456 if !=0 (default) is sent to a whole process group*/
2457 int daemonize; /* if !=0 (default), start in a daemon mode */
2458 int currentExternalChannel;
2459};
2460/*
2461 #] X :
2462 #[ Definitions :
2463
2464 Note: we changed the definition from C to Cc in version 5.
2465 The reason is that everywhere the pointer to the compiler
2466 buffer was called C as well. Somehow that gave no problems but
2467 who knows what the future might bring.
2468*/
2469
2470#ifdef WITHPTHREADS
2471
2477typedef struct AllGlobals {
2478 struct M_const M;
2479 struct C_const Cc;
2480 struct S_const S;
2481 struct O_const O;
2482 struct P_const P;
2483 struct X_const X;
2484} ALLGLOBALS;
2485
2491typedef struct AllPrivates {
2492 struct R_const R;
2493 struct N_const N;
2494 struct T_const T;
2495} ALLPRIVATES;
2496
2497#else
2498
2503typedef struct AllGlobals {
2504 struct M_const M;
2505 struct C_const Cc;
2506 struct S_const S;
2507 struct R_const R;
2508 struct N_const N;
2509 struct O_const O;
2510 struct P_const P;
2511 struct T_const T;
2512 struct X_const X;
2514
2515#endif
2516
2517/*
2518 #] Definitions :
2519 #] A :
2520 #[ FG :
2521*/
2522
2523#ifdef WITHPTHREADS
2524#define PHEAD ALLPRIVATES *B,
2525#define PHEAD0 ALLPRIVATES *B
2526#define BHEAD B,
2527#define BHEAD0 B
2528#else
2529#define PHEAD
2530#define PHEAD0 void
2531#define BHEAD
2532#define BHEAD0
2533#endif
2534
2535typedef int (*WCN)(PHEAD WORD *,WORD *,WORD,WORD);
2536typedef int (*WCN2)(PHEAD WORD *,WORD *);
2537
2538typedef WORD (*COMPARE)(PHEAD WORD *,WORD *,WORD);
2539
2551typedef struct FixedGlobals {
2552 WCN Operation[8];
2553 WCN2 OperaFind[6];
2554 char *VarType[10];
2555 char *ExprStat[21];
2556 char *FunNam[2];
2557 char *swmes[3];
2558 char *fname;
2559 char *fname2;
2560 UBYTE *s_one;
2561 WORD fnamebase;
2562 WORD fname2base;
2563 WORD fnamesize;
2564 WORD fname2size;
2565 UINT cTable[256];
2567
2568/*
2569 #] FG :
2570*/
2571
2572#endif
BRACKETINDEX * indexbuffer
Definition structs.h:323
WORD * bracketbuffer
Definition structs.h:324
WORD SortType
Definition structs.h:329
LIST cbufList
Definition structs.h:1702
WORD * FixIndices
Definition structs.h:1740
LONG CheckpointStamp
Definition structs.h:1778
NAMETREE * dollarnames
Definition structs.h:1682
STREAM * Streams
Definition structs.h:1719
int NoShowInput
Definition structs.h:1790
int cbufnum
Definition structs.h:1787
LONG * termstack
Definition structs.h:1725
char * CheckpointRunBefore
Definition structs.h:1756
LIST SetList
Definition structs.h:1693
LONG * IfStack
Definition structs.h:1735
LIST SetElementList
Definition structs.h:1692
NAMETREE * autonames
Definition structs.h:1710
STREAM * CurrentStream
Definition structs.h:1720
UBYTE * iStop
Definition structs.h:1738
LIST DubiousList
Definition structs.h:1687
SBYTE * tokens
Definition structs.h:1744
LONG * IfHeap
Definition structs.h:1733
UWORD * powmod
Definition structs.h:1728
SBYTE * toptokens
Definition structs.h:1745
NAMETREE * varnames
Definition structs.h:1684
set_of_char separators
Definition structs.h:1680
LIST ModOptDolList
Definition structs.h:1697
UBYTE * WildcardNames
Definition structs.h:1742
char * CheckpointRunAfter
Definition structs.h:1754
UBYTE ** LabelNames
Definition structs.h:1739
LIST ExpressionList
Definition structs.h:1690
LIST PotModDolList
Definition structs.h:1696
UWORD * cmod
Definition structs.h:1727
LIST SymbolList
Definition structs.h:1694
LONG * IfCount
Definition structs.h:1734
WORD * tokenarglevel
Definition structs.h:1747
int * Labels
Definition structs.h:1743
WORD * IfSumCheck
Definition structs.h:1758
LONG * termsortstack
Definition structs.h:1726
int CheckpointFlag
Definition structs.h:1864
UBYTE * iBuffer
Definition structs.h:1736
NAMETREE * exprnames
Definition structs.h:1683
UBYTE * iPointer
Definition structs.h:1737
SBYTE * endoftokens
Definition structs.h:1746
LIST TableBaseList
Definition structs.h:1698
LIST ChannelList
Definition structs.h:1685
LIST VectorList
Definition structs.h:1695
LONG CheckpointInterval
Definition structs.h:1779
WORD * termsumcheck
Definition structs.h:1741
LIST FunctionList
Definition structs.h:1689
UWORD * modpowers
Definition structs.h:1729
LIST IndexList
Definition structs.h:1691
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:1422
UWORD * gpowmod
Definition structs.h:1423
SORTING * S0
Definition structs.h:1421
WORD gShortStatsMax
Definition structs.h:1586
WORD ggShortStatsMax
Definition structs.h:1587
WORD mini
Definition structs.h:302
WORD size
Definition structs.h:304
WORD maxi
Definition structs.h:303
WORD IndDum
Definition structs.h:2329
WORD SignCheck
Definition structs.h:2328
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