FORM  4.2
ftypes.h
Go to the documentation of this file.
1 
9 /* #[ License : */
10 /*
11  * Copyright (C) 1984-2017 J.A.M. Vermaseren
12  * When using this file you are requested to refer to the publication
13  * J.A.M.Vermaseren "New features of FORM" math-ph/0010025
14  * This is considered a matter of courtesy as the development was paid
15  * for by FOM the Dutch physics granting agency and we would like to
16  * be able to track its scientific use to convince FOM of its value
17  * for the community.
18  *
19  * This file is part of FORM.
20  *
21  * FORM is free software: you can redistribute it and/or modify it under the
22  * terms of the GNU General Public License as published by the Free Software
23  * Foundation, either version 3 of the License, or (at your option) any later
24  * version.
25  *
26  * FORM is distributed in the hope that it will be useful, but WITHOUT ANY
27  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
28  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
29  * details.
30  *
31  * You should have received a copy of the GNU General Public License along
32  * with FORM. If not, see <http://www.gnu.org/licenses/>.
33  */
34 /* #] License : */
35 
50 #ifdef WITHPTHREADS
51 #define PHEAD ALLPRIVATES *B,
52 #define PHEAD0 ALLPRIVATES *B
53 #define BHEAD B,
54 #define BHEAD0 B
55 #else
56 #define PHEAD
57 #define PHEAD0 VOID
58 #define BHEAD
59 #define BHEAD0
60 #endif
61 
62 #define WITHOUTERROR 0
63 #define WITHERROR 1
64 
65 /*
66  The various streams. (look also in tools.c)
67 */
68 
69 #define FILESTREAM 0
70 #define PREVARSTREAM 1
71 #define PREREADSTREAM 2
72 #define PIPESTREAM 3
73 #define PRECALCSTREAM 4
74 #define DOLLARSTREAM 5
75 #define PREREADSTREAM2 6
76 #define EXTERNALCHANNELSTREAM 7
77 #define PREREADSTREAM3 8
78 #define REVERSEFILESTREAM 9
79 
80 #define ENDOFSTREAM 0xFF
81 #define ENDOFINPUT 0xFF
82 
83 /*
84  Types of files
85 */
86 
87 #define SUBROUTINEFILE 0
88 #define PROCEDUREFILE 1
89 #define HEADERFILE 2
90 #define SETUPFILE 3
91 #define TABLEBASEFILE 4
92 
93 /*
94  Types of modules
95 */
96 
97 #define FIRSTMODULE -1
98 #define GLOBALMODULE 0
99 #define SORTMODULE 1
100 #define STOREMODULE 2
101 #define CLEARMODULE 3
102 #define ENDMODULE 4
103 
104 #define POLYFUN 0
105 
106 #define NOPARALLEL_DOLLAR 0x0001
107 #define NOPARALLEL_RHS 0x0002
108 #define NOPARALLEL_CONVPOLY 0x0004
109 #define NOPARALLEL_SPECTATOR 0x0008
110 #define NOPARALLEL_USER 0x0010
111 #define NOPARALLEL_TBLDOLLAR 0x0100
112 #define NOPARALLEL_NPROC 0x0200
113 #define PARALLELFLAG 0x0000
114 
115 #define PRENOACTION 0
116 #define PRERAISEAFTER 1
117 #define PRELOWERAFTER 2
118 /*
119 #define ELIUMOD 1
120 #define ELIZMOD 2
121 #define SKIUMOD 3
122 #define SKIZMOD 4
123 */
124 #define WITHSEMICOLON 0
125 #define WITHOUTSEMICOLON 1
126 #define MODULEINSTACK 8
127 #define EXECUTINGIF 0
128 #define LOOKINGFORELSE 1
129 #define LOOKINGFORENDIF 2
130 #define NEWSTATEMENT 1
131 #define OLDSTATEMENT 0
132 
133 #define EXECUTINGPRESWITCH 0
134 #define SEARCHINGPRECASE 1
135 #define SEARCHINGPREENDSWITCH 2
136 
137 #define PREPROONLY 1
138 #define DUMPTOCOMPILER 2
139 #define DUMPOUTTERMS 4
140 #define DUMPINTERMS 8
141 #define DUMPTOSORT 16
142 #define DUMPTOPARALLEL 32
143 #define THREADSDEBUG 64
144 
145 #define ERROROUT 0
146 #define INPUTOUT 1
147 #define STATSOUT 2
148 #define EXPRSOUT 3
149 #define WRITEOUT 4
150 
151 #define EXTERNALCHANNELOUT 5
152 
153 #define NUMERICALLOOP 0
154 #define LISTEDLOOP 1
155 #define ONEEXPRESSION 2
156 
157 #define PRETYPENONE 0
158 #define PRETYPEIF 1
159 #define PRETYPEDO 2
160 #define PRETYPEPROCEDURE 3
161 #define PRETYPESWITCH 4
162 #define PRETYPEINSIDE 5
163 
164 /*
165  Type of statement. Used to make sure that the statements are in proper order
166 */
167 
168 #define DECLARATION 1
169 #define SPECIFICATION 2
170 #define DEFINITION 3
171 #define STATEMENT 4
172 #define TOOUTPUT 5
173 #define ATENDOFMODULE 6
174 #define MIXED 9
175 
176 /*
177  The typedefs are to allow the compilers to do better error checking.
178 */
179 
180 /*
181  icc doesn't like the typedef void VOID; Neither does g++ on the apple
182  Hence we work the old fashioned way:
183 */
184 #define VOID void
185 
186 #ifdef ANSI
187 typedef VOID (*PVFUNWP)(WORD *);
188 #ifdef INTELCOMPILER
189 typedef VOID (*PVFUNV)();
190 typedef int (*CFUN)();
191 #else
192 typedef VOID (*PVFUNV)(VOID);
193 typedef int (*CFUN)(VOID);
194 #endif
195 typedef int (*TFUN)(UBYTE *);
196 typedef int (*TFUN1)(UBYTE *,int);
197 #else
198 typedef VOID (*PVFUNWP)();
199 typedef VOID (*PVFUNV)();
200 typedef int (*CFUN)();
201 typedef int (*TFUN)();
202 typedef int (*TFUN1)();
203 #endif
204 
205 
206 #define NOAUTO 0
207 #define PARTEST 1
208 #define WITHAUTO 2
209 
210 #define ALLVARIABLES -1
211 #define SYMBOLONLY 1
212 #define INDEXONLY 2
213 #define VECTORONLY 4
214 #define FUNCTIONONLY 8
215 #define SETONLY 16
216 #define EXPRESSIONONLY 32
217 
218 
226 
227 #define CDELETE -1
228 #define ANYTYPE -1
229 #define CSYMBOL 0
230 #define CINDEX 1
231 #define CVECTOR 2
232 #define CFUNCTION 3
233 #define CSET 4
234 #define CEXPRESSION 5
235 #define CDOTPRODUCT 6
236 #define CNUMBER 7
237 #define CSUBEXP 8
238 #define CDELTA 9
239 #define CDOLLAR 10
240 #define CDUBIOUS 11
241 #define CRANGE 12
242 #define CVECTOR1 21
243 #define CDOUBLEDOT 22
244 
247 /*
248  Types of tokens in the tokenizer.
249 */
250 
251 #define TSYMBOL -1
252 #define TINDEX -2
253 #define TVECTOR -3
254 #define TFUNCTION -4
255 #define TSET -5
256 #define TEXPRESSION -6
257 #define TDOTPRODUCT -7
258 #define TNUMBER -8
259 #define TSUBEXP -9
260 #define TDELTA -10
261 #define TDOLLAR -11
262 #define TDUBIOUS -12
263 #define LPARENTHESIS -13
264 #define RPARENTHESIS -14
265 #define TWILDCARD -15
266 #define TWILDARG -16
267 #define TDOT -17
268 #define LBRACE -18
269 #define RBRACE -19
270 #define TCOMMA -20
271 #define TFUNOPEN -21
272 #define TFUNCLOSE -22
273 #define TMULTIPLY -23
274 #define TDIVIDE -24
275 #define TPOWER -25
276 #define TPLUS -26
277 #define TMINUS -27
278 #define TNOT -28
279 #define TENDOFIT -29
280 #define TSETOPEN -30
281 #define TSETCLOSE -31
282 #define TGENINDEX -32
283 #define TCONJUGATE -33
284 #define LRPARENTHESES -34
285 #define TNUMBER1 -35
286 #define TPOWER1 -36
287 #define TEMPTY -37
288 #define TSETNUM -38
289 #define TSGAMMA -39
290 #define TSETDOL -40
291 
292 #define TYPEISFUN 0
293 #define TYPEISSUB 1
294 #define TYPEISMYSTERY -1
295 
296 #define LHSIDEX 2
297 #define LHSIDE 1
298 #define RHSIDE 0
299 
300 /*
301  Output modes
302 */
303 
304 #define FORTRANMODE 1
305 #define REDUCEMODE 2
306 #define MAPLEMODE 3
307 #define MATHEMATICAMODE 4
308 #define CMODE 5
309 #define VORTRANMODE 6
310 #define PFORTRANMODE 7
311 #define DOUBLEFORTRANMODE 33
312 #define DOUBLEPRECISIONFLAG 32
313 #define NODOUBLEMASK 31
314 #define QUADRUPLEFORTRANMODE 65
315 #define QUADRUPLEPRECISIONFLAG 64
316 #define NOQUADMASK 63
317 #define NORMALFORMAT 0
318 #define NOSPACEFORMAT 1
319 
320 #define ISNOTFORTRAN90 0
321 #define ISFORTRAN90 1
322 
323 #define ALSOREVERSE 1
324 #define CHISHOLM 2
325 #define NOTRICK 16
326 
327 #define SORTLOWFIRST 0
328 #define SORTHIGHFIRST 1
329 #define SORTPOWERFIRST 2
330 #define SORTANTIPOWER 3
331 
332 #define NMIN4SHIFT 4
333 /*
334  The next are the main codes.
335  Note: SETSET is not allowed to be 4*n+1
336  We use those codes in CoIdExpression for function information
337  after the pattern. Because SETSET also stands there we have to
338  be careful!!
339  Don't forget MAXBUILTINFUNCTION when adding codes!
340  The object FUNCTION is at the start of the functions that are in regular
341  notation. Anything below it is in special notation.
342 
343  Remark: HAAKJE0 is for compression purposes and should only occur
344  at moments that ARGWILD cannot occur.
345 */
346 #define SYMBOL 1
347 #define DOTPRODUCT 2
348 #define VECTOR 3
349 #define INDEX 4
350 #define EXPRESSION 5
351 #define SUBEXPRESSION 6
352 #define DOLLAREXPRESSION 7
353 #define SETSET 8
354 #define ARGWILD 9
355 #define MINVECTOR 10
356 #define SETEXP 11
357 #define DOLLAREXPR2 12
358 #define HAAKJE0 9
359 #define FUNCTION 20
360 
361 #define TMPPOLYFUN 14
362 #define ARGFIELD 15
363 #define SNUMBER 16
364 #define LNUMBER 17
365 #define HAAKJE 18
366 #define DELTA 19
367 #define EXPONENT 20
368 #define DENOMINATOR 21
369 #define SETFUNCTION 22
370 #define GAMMA 23
371 #define GAMMAI 24
372 #define GAMMAFIVE 25
373 #define GAMMASIX 26
374 #define GAMMASEVEN 27
375 #define SUMF1 28
376 #define SUMF2 29
377 #define DUMFUN 30
378 #define REPLACEMENT 31
379 #define REVERSEFUNCTION 32
380 #define DISTRIBUTION 33
381 #define DELTA3 34
382 #define DUMMYFUN 35
383 #define DUMMYTEN 36
384 #define LEVICIVITA 37
385 #define FACTORIAL 38
386 #define INVERSEFACTORIAL 39
387 #define BINOMIAL 40
388 #define NUMARGSFUN 41
389 #define SIGNFUN 42
390 #define MODFUNCTION 43
391 #define MOD2FUNCTION 44
392 #define MINFUNCTION 45
393 #define MAXFUNCTION 46
394 #define ABSFUNCTION 47
395 #define SIGFUNCTION 48
396 #define INTFUNCTION 49
397 #define THETA 50
398 #define THETA2 51
399 #define DELTA2 52
400 #define DELTAP 53
401 #define BERNOULLIFUNCTION 54
402 #define COUNTFUNCTION 55
403 #define MATCHFUNCTION 56
404 #define PATTERNFUNCTION 57
405 #define TERMFUNCTION 58
406 #define CONJUGATION 59
407 #define ROOTFUNCTION 60
408 #define TABLEFUNCTION 61
409 #define FIRSTBRACKET 62
410 #define TERMSINEXPR 63
411 #define NUMTERMSFUN 64
412 #define GCDFUNCTION 65
413 #define DIVFUNCTION 66
414 #define REMFUNCTION 67
415 #define MAXPOWEROF 68
416 #define MINPOWEROF 69
417 #define TABLESTUB 70
418 #define FACTORIN 71
419 #define TERMSINBRACKET 72
420 #define WILDARGFUN 73
421 /*
422  In the past we would add new functions here and raise the numbers
423  on the special reserved names. This is impractical in the light of
424  the .sav files. The .sav files need a mechanism that contains the
425  value of MAXBUILTINFUNCTION at the moment of writing. This allows
426  form corrections if this value has changed in the mean time.
427 */
428 #define SQRTFUNCTION 74
429 #define LNFUNCTION 75
430 #define SINFUNCTION 76
431 #define COSFUNCTION 77
432 #define TANFUNCTION 78
433 #define ASINFUNCTION 79
434 #define ACOSFUNCTION 80
435 #define ATANFUNCTION 81
436 #define ATAN2FUNCTION 82
437 #define SINHFUNCTION 83
438 #define COSHFUNCTION 84
439 #define TANHFUNCTION 85
440 #define ASINHFUNCTION 86
441 #define ACOSHFUNCTION 87
442 #define ATANHFUNCTION 88
443 #define LI2FUNCTION 89
444 #define LINFUNCTION 90
445 
446 #define EXTRASYMFUN 91
447 #define RANDOMFUNCTION 92
448 #define RANPERM 93
449 #define NUMFACTORS 94
450 #define FIRSTTERM 95
451 #define CONTENTTERM 96
452 #define PRIMENUMBER 97
453 #define EXTEUCLIDEAN 98
454 #define MAKERATIONAL 99
455 #define INVERSEFUNCTION 100
456 #define IDFUNCTION 101
457 #define PUTFIRST 102
458 #define PERMUTATIONS 103
459 #define PARTITIONS 104
460 #define MULFUNCTION 105
461 
462 #define MAXBUILTINFUNCTION 105
463 #define FIRSTUSERFUNCTION 150
464 
465 /*
466  Note: if we add a builtin table we have to look also inside names.c
467  in the routine Globalize because there we assume there does not exist
468  such an object
469 */
470 
471 #define ISYMBOL 0
472 #define PISYMBOL 1
473 #define COEFFSYMBOL 2
474 #define NUMERATORSYMBOL 3
475 #define DENOMINATORSYMBOL 4
476 #define WILDARGSYMBOL 5
477 #define DIMENSIONSYMBOL 6
478 #define FACTORSYMBOL 7
479 #define SEPARATESYMBOL 8
480 
481 #define BUILTINSYMBOLS 9
482 #define FIRSTUSERSYMBOL 20
483 
484 #define BUILTININDICES 1
485 #define BUILTINVECTORS 1
486 #define BUILTINDOLLARS 1
487 
488 #define WILDARGVECTOR 0
489 #define WILDARGINDEX 0
490 
491 /*
492  The objects that have a name that starts with TYPE are codes of statements
493  made by the compiler. Each statement starts with such a code, followed by
494  its size. For how most of these statements are used can be seen in the
495  Generator function in the file proces.c
496  TYPEOPERATION is an anachronism that remains used only for the statements
497  that are executed in the file opera.c (like traces and contractions).
498 */
499 
500 #define TYPEEXPRESSION 0
501 #define TYPEIDNEW 1
502 #define TYPEIDOLD 2
503 #define TYPEOPERATION 3
504 #define TYPEREPEAT 4
505 #define TYPEENDREPEAT 5
506 /*
507  The next counts must be higher than the ones before
508 */
509 #define TYPECOUNT 20
510 #define TYPEMULT 21
511 #define TYPEGOTO 22
512 #define TYPEDISCARD 23
513 #define TYPEIF 24
514 #define TYPEELSE 25
515 #define TYPEELIF 26
516 #define TYPEENDIF 27
517 #define TYPESUM 28
518 #define TYPECHISHOLM 29
519 #define TYPEREVERSE 30
520 #define TYPEARG 31
521 #define TYPENORM 32
522 #define TYPENORM2 33
523 #define TYPENORM3 34
524 #define TYPEEXIT 35
525 #define TYPESETEXIT 36
526 #define TYPEPRINT 37
527 #define TYPEFPRINT 38
528 #define TYPEREDEFPRE 39
529 #define TYPESPLITARG 40
530 #define TYPESPLITARG2 41
531 #define TYPEFACTARG 42
532 #define TYPEFACTARG2 43
533 #define TYPETRY 44
534 #define TYPEASSIGN 45
535 #define TYPERENUMBER 46
536 #define TYPESUMFIX 47
537 #define TYPEFINDLOOP 48
538 #define TYPEUNRAVEL 49
539 #define TYPEADJUSTBOUNDS 50
540 #define TYPEINSIDE 51
541 #define TYPETERM 52
542 #define TYPESORT 53
543 #define TYPEDETCURDUM 54
544 #define TYPEINEXPRESSION 55
545 #define TYPESPLITFIRSTARG 56
546 #define TYPESPLITLASTARG 57
547 #define TYPEMERGE 58
548 #define TYPETESTUSE 59
549 #define TYPEAPPLY 60
550 #define TYPEAPPLYRESET 61
551 #define TYPECHAININ 62
552 #define TYPECHAINOUT 63
553 #define TYPENORM4 64
554 #define TYPEFACTOR 65
555 #define TYPEARGIMPLODE 66
556 #define TYPEARGEXPLODE 67
557 #define TYPEDENOMINATORS 68
558 #define TYPESTUFFLE 69
559 #define TYPEDROPCOEFFICIENT 70
560 #define TYPETRANSFORM 71
561 #define TYPETOPOLYNOMIAL 72
562 #define TYPEFROMPOLYNOMIAL 73
563 #define TYPEDOLOOP 74
564 #define TYPEENDDOLOOP 75
565 #define TYPEDROPSYMBOLS 76
566 #define TYPEPUTINSIDE 77
567 #define TYPETOSPECTATOR 78
568 #define TYPEARGTOEXTRASYMBOL 79
569 /*
570  The codes for the 'operations' that are part of TYPEOPERATION.
571 */
572 
573 #define TAKETRACE 1
574 #define CONTRACT 2
575 #define RATIO 3
576 #define SYMMETRIZE 4
577 #define TENVEC 5
578 #define SUMNUM1 6
579 #define SUMNUM2 7
580 
581 /*
582  The various types of wildcards.
583 */
584 
585 #define WILDDUMMY 0
586 #define SYMTONUM 1
587 #define SYMTOSYM 2
588 #define SYMTOSUB 3
589 #define VECTOMIN 4
590 #define VECTOVEC 5
591 #define VECTOSUB 6
592 #define INDTOIND 7
593 #define INDTOSUB 8
594 #define FUNTOFUN 9
595 #define ARGTOARG 10
596 #define ARLTOARL 11
597 #define EXPTOEXP 12
598 #define FROMBRAC 13
599 #define FROMSET 14
600 #define SETTONUM 15
601 #define WILDCARDS 16
602 #define SETNUMBER 17
603 #define LOADDOLLAR 18
604 /*
605  Some new types of wildcards that hold only for function arguments.
606 */
607 #define NUMTONUM 20
608 #define NUMTOSYM 21
609 #define NUMTOIND 22
610 #define NUMTOSUB 23
611 
612 /*
613  Dirty flags (introduced when functions got a field with a dirty flag)
614 */
615 
616 #define CLEANFLAG 0
617 #define DIRTYFLAG 1
618 #define DIRTYSYMFLAG 2
619 #define MUSTCLEANPRF 4
620 #define ALLDIRTY (DIRTYFLAG|DIRTYSYMFLAG)
621 
622 #define ARGHEAD 2
623 #define FUNHEAD 3
624 #define SUBEXPSIZE 5
625 #define EXPRHEAD 5
626 #define TYPEARGHEADSIZE 6
627 
628 /*
629  Actions to be taken with expressions. They are marked with these objects
630  during compilation.
631 */
632 
633 #define SKIP 1
634 #define DROP 2
635 #define HIDE 3
636 #define UNHIDE 4
637 #define INTOHIDE 5
638 
639 /*
640  Types of expressions
641 */
642 
643 #define LOCALEXPRESSION 0
644 #define SKIPLEXPRESSION 1
645 #define DROPLEXPRESSION 2
646 #define DROPPEDEXPRESSION 3
647 #define GLOBALEXPRESSION 4
648 #define SKIPGEXPRESSION 5
649 #define DROPGEXPRESSION 6
650 #define STOREDEXPRESSION 8
651 #define HIDDENLEXPRESSION 9
652 #define HIDDENGEXPRESSION 13
653 #define INCEXPRESSION 9
654 #define HIDELEXPRESSION 10
655 #define HIDEGEXPRESSION 14
656 #define DROPHLEXPRESSION 11
657 #define DROPHGEXPRESSION 15
658 #define UNHIDELEXPRESSION 12
659 #define UNHIDEGEXPRESSION 16
660 #define INTOHIDELEXPRESSION 17
661 #define INTOHIDEGEXPRESSION 18
662 #define SPECTATOREXPRESSION 19
663 #define DROPSPECTATOREXPRESSION 20
664 #define SKIPUNHIDELEXPRESSION 21
665 #define SKIPUNHIDEGEXPRESSION 22
666 
667 #define PRINTOFF 0
668 #define PRINTON 1
669 #define PRINTCONTENTS 2
670 #define PRINTCONTENT 3
671 #define PRINTLFILE 4
672 #define PRINTONETERM 8
673 #define PRINTONEFUNCTION 16
674 #define PRINTALL 32
675 
676 /*
677  Special codes for the replace variable in the EXPRESSIONS struct
678 */
679 
680 #define REGULAREXPRESSION -1
681 #define REDEFINEDEXPRESSION -2
682 #define NEWLYDEFINEDEXPRESSION -3
683 
691 #define GENERALFUNCTION 0
692 #define FASTFUNCTION 1
693 #define TENSORFUNCTION 2
694 #define GAMMAFUNCTION 4
695 
697 /*
698  Special sets
699 */
700 
701 #define POS_ 0 /* integer > 0 */
702 #define POS0_ 1 /* integer >= 0 */
703 #define NEG_ 2 /* integer < 0 */
704 #define NEG0_ 3 /* integer <= 0 */
705 #define EVEN_ 4 /* integer (even) */
706 #define ODD_ 5 /* integer (odd) */
707 #define Z_ 6 /* integer */
708 #define SYMBOL_ 7 /* symbol only */
709 #define FIXED_ 8 /* fixed index */
710 #define INDEX_ 9 /* index only */
711 #define Q_ 10 /* rational */
712 #define DUMMYINDEX_ 11 /* dummy index only */
713 #define VECTOR_ 12 /* vector only */
714 
715 /*
716  Special indices.
717 */
718 
719 #define GAMMA1 0
720 #define GAMMA5 -1
721 #define GAMMA6 -2
722 #define GAMMA7 -3
723 #define FUNNYVEC -4
724 #define FUNNYWILD -5
725 #define SUMMEDIND -6
726 #define NOINDEX -7
727 #define FUNNYDOLLAR -8
728 #define EMPTYINDEX -9
729 
730 /*
731  The next one should be less than all of the above special indices.
732 */
733 
734 #define MINSPEC -10
735 
736 #define USEDFLAG 2
737 #define DUMMYFLAG 1
738 
739 #define MAINSORT 0
740 #define FUNCTIONSORT 1
741 #define SUBSORT 2
742 
743 #define FLOATMODE 1
744 #define RATIONALMODE 0
745 
746 #define NUMSPECSETS 10
747 #define EATTENSOR 0x2000
748 
749 #define ISZERO 1
750 #define ISUNMODIFIED 2
751 #define ISCOMPRESSED 4
752 #define ISINRHS 8
753 #define ISFACTORIZED 16
754 #define TOBEFACTORED 32
755 #define TOBEUNFACTORED 64
756 #define KEEPZERO 128
757 
758 #define VARTYPENONE 0
759 #define VARTYPECOMPLEX 1
760 #define VARTYPEIMAGINARY 2
761 #define VARTYPEROOTOFUNITY 4
762 #define VARTYPEMINUS 8
763 #define CYCLESYMMETRIC 1
764 #define RCYCLESYMMETRIC 2
765 #define SYMMETRIC 3
766 #define ANTISYMMETRIC 4
767 #define REVERSEORDER 256
768 
769 /*
770  Types of id statements (substitutions)
771 */
772 
773 #define SUBMULTI 1
774 #define SUBONCE 2
775 #define SUBONLY 3
776 #define SUBMANY 4
777 #define SUBVECTOR 5
778 #define SUBSELECT 6
779 #define SUBALL 7
780 #define SUBMASK 15
781 #define SUBDISORDER 16
782 #define SUBAFTER 32
783 #define SUBAFTERNOT 64
784 
785 #define IDHEAD 6
786 
787 #define DOLLARFLAG 1
788 #define NORMALIZEFLAG 2
789 
790 #define GIDENT 1
791 #define GFIVE 4
792 #define GPLUS 3
793 #define GMINUS 2
794 
795 /*
796  Types of objects inside an if clause.
797 */
798 
799 #define LONGNUMBER 1
800 #define MATCH 2
801 #define COEFFI 3
802 #define SUBEXPR 4
803 #define MULTIPLEOF 5
804 #define IFDOLLAR 6
805 #define IFEXPRESSION 7
806 #define IFDOLLAREXTRA 8
807 #define IFISFACTORIZED 9
808 #define IFOCCURS 10
809 #define GREATER 0
810 #define GREATEREQUAL 1
811 #define LESS 2
812 #define LESSEQUAL 3
813 #define EQUAL 4
814 #define NOTEQUAL 5
815 #define ORCOND 6
816 #define ANDCOND 7
817 #define DUMMY 1
818 #define SORT 1
819 #define STORE 2
820 #define END 3
821 #define GLOBAL 4
822 #define CLEAR 5
823 
824 #define VECTBIT 1
825 #define DOTPBIT 2
826 #define FUNBIT 4
827 #define SETBIT 8
828 
829 #define EXTRAPARAMETER 0x4000
830 #define GENCOMMUTE 0
831 #define GENNONCOMMUTE 0x2000
832 
833 #define NAMENOTFOUND -9
834 
835 /*
836  Types of dollar expressions.
837 */
838 
839 #define DOLUNDEFINED 0
840 #define DOLNUMBER 1
841 #define DOLARGUMENT 2
842 #define DOLSUBTERM 3
843 #define DOLTERMS 4
844 #define DOLWILDARGS 5
845 #define DOLINDEX 6
846 #define DOLZERO 7
847 
848 #define FINDLOOP 0
849 #define REPLACELOOP 1
850 
851 #define NOFUNPOWERS 0
852 #define COMFUNPOWERS 1
853 #define ALLFUNPOWERS 2
854 
855 #define PROPERORDERFLAG 0
856 
857 #define REGULAR 0
858 #define FINISH 1
859 
860 #define POLYADD 1
861 #define POLYSUB 2
862 #define POLYMUL 3
863 #define POLYDIV 4
864 #define POLYREM 5
865 #define POLYGCD 6
866 #define POLYINTFAC 7
867 #define POLYNORM 8
868 
869 #define MODNONE 0
870 #define MODSUM 1
871 #define MODMAX 2
872 #define MODMIN 3
873 #define MODLOCAL 4
874 
875 #define ELEMENTUSED 1
876 #define ELEMENTLOADED 2
877 /*
878  Variables for the modulus statement, flags in AC.modmode
879  For explanation, see CoModulus
880 */
881 #define POSNEG 0x1
882 #define INVERSETABLE 0x2
883 #define COEFFICIENTSONLY 0x4
884 #define ALSOPOWERS 0x8
885 #define ALSOFUNARGS 0x10
886 #define ALSODOLLARS 0x20
887 #define NOINVERSES 0x40
888 
889 #define POSITIVEONLY 0
890 #define UNPACK 0x80
891 #define NOUNPACK 0
892 #define FROMFUNCTION 0x100
893 
894 #define VARNAMES 0
895 #define AUTONAMES 1
896 #define EXPRNAMES 2
897 #define DOLLARNAMES 3
898 
899 #ifdef WITHPTHREADS
900 /*
901  Signals that the workers have to react to
902 */
903 
904 #define TERMINATETHREAD -1
905 #define STARTNEWEXPRESSION 1
906 #define LOWESTLEVELGENERATION 2
907 #define FINISHEXPRESSION 3
908 #define CLEANUPEXPRESSION 4
909 #define HIGHERLEVELGENERATION 5
910 #define STARTNEWMODULE 6
911 #define CLAIMOUTPUT 7
912 #define FINISHEXPRESSION2 8
913 #define INISORTBOT 7
914 #define RUNSORTBOT 8
915 #define DOONEEXPRESSION 9
916 #define DOBRACKETS 10
917 #define CLEARCLOCK 11
918 #define MCTSEXPANDTREE 12
919 #define OPTIMIZEEXPRESSION 13
920 
921 #define MASTERBUFFERISFULL 1
922 
923 /*
924  Bucket states
925 */
926 
927 #define BUCKETFREE 1
928 #define BUCKETINUSE 0
929 #define BUCKETCOMINGFREE 2
930 #define BUCKETFILLED -1
931 #define BUCKETATEND -2
932 #define BUCKETTERMINATED 3
933 #define BUCKETRELEASED 4
934 
935 #define NUMBEROFBLOCKSINSORT 10
936 #define MINIMUMNUMBEROFTERMS 10
937 
938 #define BUCKETDOINGTERM 1
939 #define BUCKETASSIGNED -1
940 #define BUCKETTOBERELEASED -2
941 #define BUCKETPREPARINGTERM 0
942 
943 #define BUCKETDOINGTERMS 0
944 #define BUCKETDOINGBRACKET 1
945 #endif
946 
947 /*
948  The next variable is because there is some use of cbufnum that is
949  probably irrelevant. We use here DUMMYBUFNUM instead of AC.cbufnum
950  just in case we run into trouble later.
951 */
952 #define DUMMYBUFFER 1
953 
954 #define ALLARGS 1
955 #define NUMARG 2
956 #define ARGRANGE 3
957 #define MAKEARGS 4
958 #define MAXRANGEINDICATOR 4
959 #define REPLACEARG 5
960 #define ENCODEARG 6
961 #define DECODEARG 7
962 #define IMPLODEARG 8
963 #define EXPLODEARG 9
964 #define PERMUTEARG 10
965 #define REVERSEARG 11
966 #define CYCLEARG 12
967 #define ISLYNDON 13
968 #define ISLYNDONR 14
969 #define TOLYNDON 15
970 #define TOLYNDONR 16
971 #define ADDARG 17
972 #define MULTIPLYARG 18
973 #define DROPARG 19
974 #define SELECTARG 20
975 #define DEDUPARG 21
976 
977 #define BASECODE 1
978 #define YESLYNDON 1
979 #define NOLYNDON 2
980 
981 #define TOPOLYNOMIALFLAG 1
982 #define FACTARGFLAG 2
983 
984 #define OLDFACTARG 1
985 #define NEWFACTARG 0
986 
987 #define FROMMODULEOPTION 0
988 #define FROMPOINTINSTRUCTION 1
989 
990 #define EXTRASYMBOL 0
991 #define REGULARSYMBOL 1
992 #define EXPRESSIONNUMBER 2
993 
994 #define O_NONE 0
995 #define O_CSE 1
996 #define O_CSEGREEDY 2
997 #define O_GREEDY 3
998 
999 #define O_OCCURRENCE 0
1000 #define O_MCTS 1
1001 #define O_SIMULATED_ANNEALING 2
1002 
1003 #define O_FORWARD 0
1004 #define O_BACKWARD 1
1005 #define O_FORWARDORBACKWARD 2
1006 #define O_FORWARDANDBACKWARD 3
1007 
1008 #define OPTHEAD 3
1009 #define DOALL 1
1010 #define ONLYFUNCTIONS 2
1011 
1012 #define INUSE 1
1013 #define COULDCOMMUTE 2
1014 #define DOESNOTCOMMUTE 4
1015 
1016 #define DICT_NONUMBERS 0
1017 #define DICT_INTEGERONLY 1
1018 #define DICT_RATIONALONLY 2
1019 #define DICT_ALLNUMBERS 3
1020 #define DICT_NOVARIABLES 0
1021 #define DICT_DOVARIABLES 1
1022 #define DICT_NOSPECIALS 0
1023 #define DICT_DOSPECIALS 1
1024 #define DICT_NOFUNWITHARGS 0
1025 #define DICT_DOFUNWITHARGS 1
1026 #define DICT_NOTINDOLLARS 0
1027 #define DICT_INDOLLARS 1
1028 
1029 #define DICT_INTEGERNUMBER 1
1030 #define DICT_RATIONALNUMBER 2
1031 #define DICT_SYMBOL 3
1032 #define DICT_VECTOR 4
1033 #define DICT_INDEX 5
1034 #define DICT_FUNCTION 6
1035 #define DICT_FUNCTION_WITH_ARGUMENTS 7
1036 #define DICT_SPECIALCHARACTER 8
1037 #define DICT_RANGE 9
1038 
1039 #define READSPECTATORFLAG 3
1040 #define GLOBALSPECTATORFLAG 1