FORM  4.1
Macros | Typedefs | Functions
declare.h File Reference

Go to the source code of this file.

Macros

#define MaX(x, y)   ((x) > (y) ? (x): (y))
 
#define MiN(x, y)   ((x) < (y) ? (x): (y))
 
#define ABS(x)   ( (x) < 0 ? -(x): (x) )
 
#define SGN(x)   ( (x) > 0 ? 1 : (x) < 0 ? -1 : 0 )
 
#define REDLENG(x)   ((((x)<0)?((x)+1):((x)-1))>>1)
 
#define INCLENG(x)   (((x)<0)?(((x)<<1)-1):(((x)<<1)+1))
 
#define GETCOEF(x, y)   x += *x;y = x[-1];x -= ABS(y);y=REDLENG(y)
 
#define GETSTOP(x, y)   y=x+(*x)-1;y -= ABS(*y)-1
 
#define StuffAdd(x, y)   (((x)<0?-1:1)*(y)+((y)<0?-1:1)*(x))
 
#define TOKENTOLINE(x, y)
 
#define UngetFromStream(stream, c)   ((stream)->nextchar[(stream)->isnextchar++]=c)
 
#define AddLineFeed(s, n)   { (s)[(n)++] = LINEFEED; }
 
#define TryRecover(x)   Terminate(-1)
 
#define UngetChar(c)   { pushbackchar = c; }
 
#define ParseNumber(x, s)   {(x)=0;while(*(s)>='0'&&*(s)<='9')(x)=10*(x)+*(s)++ -'0';}
 
#define ParseSign(sgn, s)
 
#define ParseSignedNumber(x, s)
 
#define NCOPY(s, t, n)   while ( --n >= 0 ) *s++ = *t++;
 
#define NCOPYI(s, t, n)   while ( --n >= 0 ) *s++ = *t++;
 
#define NCOPYB(s, t, n)   while ( --n >= 0 ) *s++ = *t++;
 
#define NCOPYI32(s, t, n)   while ( --n >= 0 ) *s++ = *t++;
 
#define WCOPY(s, t, n)   { int nn=n; WORD *ss=(WORD *)s, *tt=(WORD *)t; while ( --nn >= 0 ) *ss++=*tt++; }
 
#define NeedNumber(x, s, err)
 
#define SKIPBLANKS(s)   { while ( *(s) == ' ' || *(s) == '\t' ) (s)++; }
 
#define FLUSHCONSOLE   if ( AP.InOutBuf > 0 ) CharOut(LINEFEED)
 
#define SKIPBRA1(s)
 
#define SKIPBRA2(s)
 
#define SKIPBRA3(s)
 
#define SKIPBRA4(s)
 
#define SKIPBRA5(s)
 
#define CYCLE1(t, a, i)   {t iX=*a; WORD jX; for(jX=1;jX<i;jX++)a[jX-1]=a[jX]; a[i-1]=iX;}
 
#define AddToCB(c, wx)
 
#define EXCHINOUT
 
#define BACKINOUT
 
#define CopyArg(to, from)
 
#define FILLARG(w)
 
#define COPYARG(w, t)
 
#define ZEROARG(w)
 
#define FILLFUN(w)
 
#define COPYFUN(w, t)
 
#define COPYFUN3(w, t)
 
#define FILLFUN3(w)
 
#define FILLSUB(w)
 
#define COPYSUB(w, ww)
 
#define FILLEXPR(w)
 
#define NEXTARG(x)   if(*x>0) x += *x; else if(*x <= -FUNCTION)x++; else x += 2;
 
#define COPY1ARG(s1, t1)
 
#define TABLESIZE(a, b)   (((WORD)sizeof(a))/((WORD)sizeof(b)))
 
#define WORDDIF(x, y)   (WORD)(x-y)
 
#define wsizeof(a)   ((WORD)sizeof(a))
 
#define VARNAME(type, num)   (AC.varnames->namebuffer+type[num].name)
 
#define DOLLARNAME(type, num)   (AC.dollarnames->namebuffer+type[num].name)
 
#define EXPRNAME(num)   (AC.exprnames->namebuffer+Expressions[num].name)
 
#define PREV(x)   prevorder?prevorder:x
 
#define SETERROR(x)   { Terminate(-1); return(-1); }
 
#define DUMMYUSE(x)   (void)(x);
 
#define ADDPOS(pp, x)   (pp).p1 = ((pp).p1+(LONG)(x))
 
#define SETBASELENGTH(ss, x)   (ss).p1 = (LONG)(x)
 
#define SETBASEPOSITION(pp, x)   (pp).p1 = (LONG)(x)
 
#define ISEQUALPOSINC(pp1, pp2, x)   ( (pp1).p1 == ((pp2).p1+(LONG)(x)) )
 
#define ISGEPOSINC(pp1, pp2, x)   ( (pp1).p1 >= ((pp2).p1+(LONG)(x)) )
 
#define DIVPOS(pp, n)   ( (pp).p1/(LONG)(n) )
 
#define MULPOS(pp, n)   (pp).p1 *= (LONG)(n)
 
#define DIFPOS(ss, pp1, pp2)   (ss).p1 = ((pp1).p1-(pp2).p1)
 
#define DIFBASE(pp1, pp2)   ((pp1).p1-(pp2).p1)
 
#define ADD2POS(pp1, pp2)   (pp1).p1 += (pp2).p1
 
#define PUTZERO(pp)   (pp).p1 = 0
 
#define BASEPOSITION(pp)   ((pp).p1)
 
#define SETSTARTPOS(pp)   (pp).p1 = -2
 
#define NOTSTARTPOS(pp)   ( (pp).p1 > -2 )
 
#define ISMINPOS(pp)   ( (pp).p1 == -1 )
 
#define ISEQUALPOS(pp1, pp2)   ( (pp1).p1 == (pp2).p1 )
 
#define ISNOTEQUALPOS(pp1, pp2)   ( (pp1).p1 != (pp2).p1 )
 
#define ISLESSPOS(pp1, pp2)   ( (pp1).p1 < (pp2).p1 )
 
#define ISGEPOS(pp1, pp2)   ( (pp1).p1 >= (pp2).p1 )
 
#define ISNOTZEROPOS(pp)   ( (pp).p1 != 0 )
 
#define ISPOSPOS(pp)   ( (pp).p1 > 0 )
 
#define ISNEGPOS(pp)   ( (pp).p1 < 0 )
 
#define TOLONG(x)   ((LONG)(x))
 
#define Add2Com(x)   { WORD cod[2]; cod[0] = x; cod[1] = 2; AddNtoL(2,cod); }
 
#define Add3Com(x1, x2)   { WORD cod[3]; cod[0] = x1; cod[1] = 3; cod[2] = x2; AddNtoL(3,cod); }
 
#define Add4Com(x1, x2, x3)
 
#define Add5Com(x1, x2, x3, x4)
 
#define WantAddPointers(x)
 
#define WantAddLongs(x)
 
#define WantAddPositions(x)
 
#define FORM_INLINE   inline
 
#define MEMORYMACROS
 
#define TermMalloc(x)   ( (AT.TermMemTop <= 0 ) ? TermMallocAddMemory(BHEAD0), AT.TermMemHeap[--AT.TermMemTop]: AT.TermMemHeap[--AT.TermMemTop] )
 
#define NumberMalloc(x)   ( (AT.NumberMemTop <= 0 ) ? NumberMallocAddMemory(BHEAD0), AT.NumberMemHeap[--AT.NumberMemTop]: AT.NumberMemHeap[--AT.NumberMemTop] )
 
#define TermFree(TermMem, x)   AT.TermMemHeap[AT.TermMemTop++] = (WORD *)(TermMem)
 
#define NumberFree(NumberMem, x)   AT.NumberMemHeap[AT.NumberMemTop++] = (UWORD *)(NumberMem)
 
#define NestingChecksum()   (AC.IfLevel + AC.RepLevel + AC.arglevel + AC.insidelevel + AC.termlevel + AC.inexprlevel + AC.dolooplevel)
 
#define MesNesting()   MesPrint("&Illegal nesting of if, repeat, argument, inside, term, inexpression and do")
 
#define EXTERNLOCK(x)
 
#define INILOCK(x)
 
#define LOCK(x)
 
#define UNLOCK(x)
 
#define EXTERNRWLOCK(x)
 
#define INIRWLOCK(x)
 
#define RWLOCKR(x)
 
#define RWLOCKW(x)
 
#define UNRWLOCK(x)
 
#define MLOCK(x)
 
#define MUNLOCK(x)
 
#define GETIDENTITY
 
#define GETBIDENTITY
 
#define M_alloc(x)    malloc((size_t)(x))
 
#define CompareTerms   ((COMPARE)AR.CompareRoutine)
 
#define FiniShuffle   ((FINISHUFFLE)AN.SHvar.finishuf)
 
#define DoShtuffle   ((DO_UFFLE)AN.SHvar.do_uffle)
 

Typedefs

typedef int(* WRITEBUFTOEXTCHANNEL) (char *, size_t)
 
typedef int(* GETCFROMEXTCHANNEL) (VOID)
 
typedef int(* SETTERMINATORFOREXTERNALCHANNEL) (char *)
 
typedef int(* SETKILLMODEFOREXTERNALCHANNEL) (int, int)
 
typedef LONG(* WRITEFILE) (int, UBYTE *, LONG)
 
typedef WORD(* COMPARE) (PHEAD WORD *, WORD *, WORD)
 
typedef WORD(* GETTERM) (PHEAD WORD *)
 
typedef WORD(* FINISHUFFLE) (PHEAD WORD *)
 
typedef WORD(* DO_UFFLE) (PHEAD WORD *, WORD, WORD, WORD)
 

Functions

VOID TELLFILE (int, POSITION *)
 
VOID StartVariables ()
 
VOID setSignalHandlers (VOID)
 
UBYTE * CodeToLine (WORD, UBYTE *)
 
UBYTE * AddArrayIndex (WORD, UBYTE *)
 
INDEXENTRYFindInIndex (WORD, FILEDATA *, WORD, WORD)
 
INDEXENTRYNextFileIndex (POSITION *)
 
WORD * PasteTerm (PHEAD WORD, WORD *, WORD *, WORD, WORD)
 
UBYTE * StrCopy (UBYTE *, UBYTE *)
 
UBYTE * WrtPower (UBYTE *, WORD)
 
WORD AccumGCD (PHEAD UWORD *, WORD *, UWORD *, WORD)
 
VOID AddArgs (PHEAD WORD *, WORD *, WORD *)
 
WORD AddCoef (PHEAD WORD **, WORD **)
 
WORD AddLong (UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
WORD AddPLon (UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
WORD AddPoly (PHEAD WORD **, WORD **)
 
WORD AddRat (PHEAD UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
VOID AddToLine (UBYTE *)
 
WORD AddWild (PHEAD WORD, WORD, WORD)
 
WORD BigLong (UWORD *, WORD, UWORD *, WORD)
 
WORD BinomGen (PHEAD WORD *, WORD, WORD **, WORD, WORD, WORD, WORD, WORD, UWORD *, WORD)
 
WORD CheckWild (PHEAD WORD, WORD, WORD, WORD *)
 
WORD Chisholm (PHEAD WORD *, WORD)
 
WORD CleanExpr (WORD)
 
VOID CleanUp (WORD)
 
VOID ClearWild (PHEAD0)
 
WORD Commute (WORD *, WORD *)
 
WORD DetCommu (WORD *)
 
WORD DoesCommu (WORD *)
 
int CompArg (WORD *, WORD *)
 
WORD CompCoef (WORD *, WORD *)
 
WORD CompGroup (PHEAD WORD, WORD **, WORD *, WORD *, WORD)
 
WORD Compare1 (PHEAD WORD *, WORD *, WORD)
 
WORD CountDo (WORD *, WORD *)
 
WORD CountFun (WORD *, WORD *)
 
WORD DimensionSubterm (WORD *)
 
WORD DimensionTerm (WORD *)
 
WORD DimensionExpression (PHEAD WORD *)
 
WORD Deferred (PHEAD WORD *, WORD)
 
WORD DeleteStore (WORD)
 
WORD DetCurDum (PHEAD WORD *)
 
VOID DetVars (WORD *, WORD)
 
WORD Distribute (DISTRIBUTE *, WORD)
 
WORD DivLong (UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *, UWORD *, WORD *)
 
WORD DivRat (PHEAD UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
WORD Divvy (PHEAD UWORD *, WORD *, UWORD *, WORD)
 
WORD DoDelta (WORD *)
 
WORD DoDelta3 (PHEAD WORD *, WORD)
 
WORD DoTableExpansion (WORD *, WORD)
 
WORD DoDistrib (PHEAD WORD *, WORD)
 
WORD DoShuffle (PHEAD WORD *, WORD, WORD, WORD)
 
int Shuffle (PHEAD WORD *, WORD *, WORD *)
 
int FinishShuffle (PHEAD WORD *)
 
WORD DoStuffle (PHEAD WORD *, WORD, WORD, WORD)
 
int Stuffle (PHEAD WORD *, WORD *, WORD *)
 
int FinishStuffle (PHEAD WORD *)
 
WORD * StuffRootAdd (WORD *, WORD *, WORD *)
 
WORD TestUse (WORD *, WORD)
 
DBASEFindTB (UBYTE *)
 
int CheckTableDeclarations (DBASE *)
 
WORD Apply (WORD *, WORD)
 
int ApplyExec (WORD *, int, WORD)
 
WORD ApplyReset (WORD)
 
WORD TableReset (VOID)
 
VOID ReWorkT (WORD *, WORD *, WORD)
 
WORD GetIfDollarNum (WORD *, WORD *)
 
WORD DoIfStatement (PHEAD WORD *, WORD *)
 
WORD DoOnePow (PHEAD WORD *, WORD, WORD, WORD *, WORD *, WORD, WORD *)
 
void DoRevert (WORD *, WORD *)
 
WORD DoSumF1 (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD DoSumF2 (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD DoTheta (PHEAD WORD *)
 
LONG EndSort (PHEAD WORD *, int)
 
WORD EntVar (WORD, UBYTE *, WORD, WORD, WORD, WORD)
 
WORD EpfCon (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD EpfFind (PHEAD WORD *, WORD *)
 
WORD EpfGen (WORD, WORD *, WORD *, WORD *, WORD)
 
WORD EqualArg (WORD *, WORD, WORD)
 
WORD Evaluate (UBYTE **)
 
int Factorial (PHEAD WORD, UWORD *, WORD *)
 
int Bernoulli (WORD, UWORD *, WORD *)
 
int FactorIn (PHEAD WORD *, WORD)
 
int FactorInExpr (PHEAD WORD *, WORD)
 
WORD FindAll (PHEAD WORD *, WORD *, WORD, WORD *)
 
WORD FindMulti (PHEAD WORD *, WORD *)
 
WORD FindOnce (PHEAD WORD *, WORD *)
 
WORD FindOnly (PHEAD WORD *, WORD *)
 
WORD FindRest (PHEAD WORD *, WORD *)
 
WORD FindSpecial (WORD *)
 
WORD FindrNumber (WORD, VARRENUM *)
 
VOID FiniLine (VOID)
 
WORD FiniTerm (PHEAD WORD *, WORD *, WORD *, WORD, WORD)
 
WORD FlushOut (POSITION *, FILEHANDLE *, int)
 
VOID FunLevel (PHEAD WORD *)
 
VOID AdjustRenumScratch (PHEAD0)
 
VOID GarbHand (VOID)
 
WORD GcdLong (PHEAD UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
WORD LcmLong (PHEAD UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
VOID GCD (UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
ULONG GCD2 (ULONG, ULONG)
 
WORD Generator (PHEAD WORD *, WORD)
 
WORD GetBinom (UWORD *, WORD *, WORD, WORD)
 
WORD GetFromStore (WORD *, POSITION *, RENUMBER, WORD *, WORD)
 
WORD GetLong (UBYTE *, UWORD *, WORD *)
 
WORD GetMoreTerms (WORD *)
 
WORD GetMoreFromMem (WORD *, WORD **)
 
WORD GetOneTerm (PHEAD WORD *, FILEHANDLE *, POSITION *, int)
 
RENUMBER GetTable (WORD, POSITION *, WORD)
 
WORD GetTerm (PHEAD WORD *)
 
WORD Glue (PHEAD WORD *, WORD *, WORD *, WORD)
 
WORD InFunction (PHEAD WORD *, WORD *)
 
VOID IniLine (WORD)
 
WORD IniVars (VOID)
 
VOID Initialize (VOID)
 
WORD InsertTerm (PHEAD WORD *, WORD, WORD, WORD *, WORD *, WORD)
 
VOID LongToLine (UWORD *, WORD)
 
WORD MakeDirty (WORD *, WORD *, WORD)
 
VOID MarkDirty (WORD *, WORD)
 
VOID PolyFunDirty (PHEAD WORD *)
 
VOID PolyFunClean (PHEAD WORD *)
 
WORD MakeModTable (VOID)
 
WORD MatchE (PHEAD WORD *, WORD *, WORD *, WORD)
 
int MatchCy (PHEAD WORD *, WORD *, WORD *, WORD)
 
int FunMatchCy (PHEAD WORD *, WORD *, WORD *, WORD)
 
int FunMatchSy (PHEAD WORD *, WORD *, WORD *, WORD)
 
int MatchArgument (PHEAD WORD *, WORD *)
 
WORD MatchFunction (PHEAD WORD *, WORD *, WORD *)
 
WORD MergePatches (WORD)
 
WORD MesCerr (char *, UBYTE *)
 
WORD MesComp (char *, UBYTE *, UBYTE *)
 
WORD Modulus (WORD *)
 
VOID MoveDummies (PHEAD WORD *, WORD)
 
WORD MulLong (UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
WORD MulRat (PHEAD UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
WORD Mully (PHEAD UWORD *, WORD *, UWORD *, WORD)
 
WORD MultDo (PHEAD WORD *, WORD *)
 
WORD NewSort (PHEAD0)
 
WORD ExtraSymbol (WORD, WORD, WORD, WORD *, WORD *)
 
WORD Normalize (PHEAD WORD *)
 
VOID DropCoefficient (PHEAD WORD *)
 
VOID DropSymbols (PHEAD WORD *)
 
int PutInside (PHEAD WORD *, WORD *)
 
WORD OpenTemp (VOID)
 
VOID Pack (UWORD *, WORD *, UWORD *, WORD)
 
LONG PasteFile (PHEAD WORD, WORD *, POSITION *, WORD **, RENUMBER, WORD *, WORD)
 
WORD Permute (PERM *, WORD)
 
WORD PolyFunMul (PHEAD WORD *)
 
WORD PopVariables (VOID)
 
WORD PrepPoly (PHEAD WORD *)
 
WORD Processor (VOID)
 
WORD Product (UWORD *, WORD *, WORD)
 
VOID PrtLong (UWORD *, WORD, UBYTE *)
 
VOID PrtTerms (VOID)
 
VOID PrintRunningTime (VOID)
 
LONG GetRunningTime (VOID)
 
WORD PutBracket (PHEAD WORD *)
 
LONG PutIn (FILEHANDLE *, POSITION *, WORD *, WORD **, int)
 
WORD PutInStore (INDEXENTRY *, WORD)
 
WORD PutOut (PHEAD WORD *, POSITION *, FILEHANDLE *, WORD)
 
UWORD Quotient (UWORD *, WORD *, WORD)
 
WORD RaisPow (PHEAD UWORD *, WORD *, UWORD)
 
VOID RaisPowCached (PHEAD WORD, WORD, UWORD **, WORD *)
 
WORD RaisPowMod (WORD, WORD, WORD)
 
int NormalModulus (UWORD *, WORD *)
 
int MakeInverses (VOID)
 
int GetModInverses (WORD, WORD, WORD *, WORD *)
 
int GetLongModInverses (PHEAD UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *, UWORD *, WORD *)
 
VOID RatToLine (UWORD *, WORD)
 
WORD RatioFind (PHEAD WORD *, WORD *)
 
WORD RatioGen (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD ReNumber (PHEAD WORD *)
 
WORD ReadSnum (UBYTE **)
 
WORD Remain10 (UWORD *, WORD *)
 
WORD Remain4 (UWORD *, WORD *)
 
WORD ResetScratch (VOID)
 
WORD ResolveSet (PHEAD WORD *, WORD *, WORD *)
 
WORD RevertScratch (VOID)
 
WORD ScanFunctions (PHEAD WORD *, WORD *, WORD)
 
VOID SeekScratch (FILEHANDLE *, POSITION *)
 
VOID SetEndScratch (FILEHANDLE *, POSITION *)
 
VOID SetEndHScratch (FILEHANDLE *, POSITION *)
 
WORD SetFileIndex (VOID)
 
WORD Sflush (FILEHANDLE *)
 
WORD Simplify (PHEAD UWORD *, WORD *, UWORD *, WORD *)
 
WORD SortWild (WORD *, WORD)
 
FILE * LocateBase (char **, char **)
 
VOID SplitMerge (PHEAD WORD **, LONG)
 
WORD StoreTerm (PHEAD WORD *)
 
VOID SubPLon (UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
VOID Substitute (PHEAD WORD *, WORD *, WORD)
 
WORD SymFind (PHEAD WORD *, WORD *)
 
WORD SymGen (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD Symmetrize (PHEAD WORD *, WORD *, WORD, WORD, WORD)
 
int FullSymmetrize (PHEAD WORD *, int)
 
WORD TakeModulus (UWORD *, WORD *, UWORD *, WORD, WORD)
 
WORD TakeNormalModulus (UWORD *, WORD *, UWORD *, WORD, WORD)
 
VOID TalToLine (UWORD)
 
WORD TenVec (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD TenVecFind (PHEAD WORD *, WORD *)
 
WORD TermRenumber (WORD *, RENUMBER, WORD)
 
VOID TestDrop (VOID)
 
VOID PutInVflags (WORD)
 
WORD TestMatch (PHEAD WORD *, WORD *)
 
WORD TestSub (PHEAD WORD *, WORD)
 
LONG TimeCPU (WORD)
 
LONG TimeChildren (WORD)
 
LONG TimeWallClock (WORD)
 
LONG Timer (int)
 
int GetTimerInfo (LONG **, LONG **)
 
void WriteTimerInfo (LONG *, LONG *)
 
LONG GetWorkerTimes (VOID)
 
WORD ToStorage (EXPRESSIONS, POSITION *)
 
VOID TokenToLine (UBYTE *)
 
WORD Trace4 (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD Trace4Gen (PHEAD TRACES *, WORD)
 
WORD Trace4no (WORD, WORD *, TRACES *)
 
WORD TraceFind (PHEAD WORD *, WORD *)
 
WORD TraceN (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD TraceNgen (PHEAD TRACES *, WORD)
 
WORD TraceNno (WORD, WORD *, TRACES *)
 
WORD Traces (PHEAD WORD *, WORD *, WORD, WORD)
 
WORD Trick (WORD *, TRACES *)
 
WORD TryDo (PHEAD WORD *, WORD *, WORD)
 
VOID UnPack (UWORD *, WORD, WORD *, WORD *)
 
WORD VarStore (UBYTE *, WORD, WORD, WORD)
 
WORD WildFill (PHEAD WORD *, WORD *, WORD *)
 
WORD WriteAll (VOID)
 
WORD WriteOne (UBYTE *, int, int)
 
VOID WriteArgument (WORD *)
 
WORD WriteExpression (WORD *, LONG)
 
WORD WriteInnerTerm (WORD *, WORD)
 
VOID WriteLists (VOID)
 
VOID WriteSetup (VOID)
 
VOID WriteStats (POSITION *, WORD)
 
WORD WriteSubTerm (WORD *, WORD)
 
WORD WriteTerm (WORD *, WORD *, WORD, WORD, WORD)
 
WORD execarg (PHEAD WORD *, WORD)
 
WORD execterm (PHEAD WORD *, WORD)
 
VOID SpecialCleanup (PHEAD0)
 
void SetMods ()
 
void UnSetMods ()
 
WORD DoExecute (WORD, WORD)
 
VOID SetScratch (FILEHANDLE *, POSITION *)
 
VOID Warning (char *)
 
VOID HighWarning (char *)
 
int SpareTable (TABLES)
 
UBYTE * strDup1 (UBYTE *, char *)
 
VOID * Malloc (LONG)
 
VOID * Malloc1 (LONG, const char *)
 
int DoTail (int, UBYTE **)
 
int OpenInput (VOID)
 
int PutPreVar (UBYTE *, UBYTE *, UBYTE *, int)
 
VOID Error0 (char *)
 
VOID Error1 (char *, UBYTE *)
 
VOID Error2 (char *, char *, UBYTE *)
 
UBYTE ReadFromStream (STREAM *)
 
UBYTE GetFromStream (STREAM *)
 
UBYTE LookInStream (STREAM *)
 
STREAMOpenStream (UBYTE *, int, int, int)
 
int LocateFile (UBYTE **, int)
 
STREAMCloseStream (STREAM *)
 
VOID PositionStream (STREAM *, LONG)
 
int ProcessOption (UBYTE *, UBYTE *, int)
 
int DoSetups (VOID)
 
VOID Terminate (int)
 
NAMENODEGetNode (NAMETREE *, UBYTE *)
 
int AddName (NAMETREE *, UBYTE *, WORD, WORD, int *)
 
int GetName (NAMETREE *, UBYTE *, WORD *, int)
 
int GetLastExprName (UBYTE *, WORD *)
 
int GetAutoName (UBYTE *, WORD *)
 
int GetVar (UBYTE *, WORD *, WORD *, int, int)
 
int MakeDubious (NAMETREE *, UBYTE *, WORD *)
 
int GetOName (NAMETREE *, UBYTE *, WORD *, int)
 
VOID DumpTree (NAMETREE *)
 
VOID DumpNode (NAMETREE *, WORD, WORD)
 
VOID LinkTree (NAMETREE *, WORD, WORD)
 
VOID CopyTree (NAMETREE *, NAMETREE *, WORD, WORD)
 
int CompactifyTree (NAMETREE *, WORD)
 
NAMETREEMakeNameTree (VOID)
 
VOID FreeNameTree (NAMETREE *)
 
int AddExpression (UBYTE *, int, int)
 
int AddSymbol (UBYTE *, int, int, int, int)
 
int AddDollar (UBYTE *, WORD, WORD *, LONG)
 
int ReplaceDollar (WORD, WORD, WORD *, LONG)
 
int DollarRaiseLow (UBYTE *, LONG)
 
int AddVector (UBYTE *, int, int)
 
int AddDubious (UBYTE *)
 
int AddIndex (UBYTE *, int, int)
 
UBYTE * DoDimension (UBYTE *, int *, int *)
 
int AddFunction (UBYTE *, int, int, int, int, int, int, int)
 
int CoFunction (UBYTE *, int, int)
 
int TestName (UBYTE *)
 
int AddSet (UBYTE *, WORD)
 
int DoElements (UBYTE *, SETS, UBYTE *)
 
int DoTempSet (UBYTE *, UBYTE *)
 
int NameConflict (int, UBYTE *)
 
int OpenFile (char *)
 
int OpenAddFile (char *)
 
int ReOpenFile (char *)
 
int CreateFile (char *)
 
int CreateLogFile (char *)
 
VOID CloseFile (int)
 
int CopyFile (char *, char *)
 
int CreateHandle (VOID)
 
LONG ReadFile (int, UBYTE *, LONG)
 
LONG ReadPosFile (PHEAD FILEHANDLE *, UBYTE *, LONG, POSITION *)
 
LONG WriteFileToFile (int, UBYTE *, LONG)
 
VOID SeekFile (int, POSITION *, int)
 
LONG TellFile (int)
 
void FlushFile (int)
 
int GetPosFile (int, fpos_t *)
 
int SetPosFile (int, fpos_t *)
 
VOID SynchFile (int)
 
VOID TruncateFile (int)
 
int GetChannel (char *)
 
int GetAppendChannel (char *)
 
int CloseChannel (char *)
 
VOID inictable (VOID)
 
KEYWORDfindcommand (UBYTE *)
 
int inicbufs (VOID)
 
VOID StartFiles (VOID)
 
UBYTE * MakeDate (VOID)
 
VOID PreProcessor (VOID)
 
VOID * FromList (LIST *)
 
VOID * From0List (LIST *)
 
VOID * FromVarList (LIST *)
 
int DoubleList (VOID ***, int *, int, char *)
 
int DoubleLList (VOID ***, LONG *, int, char *)
 
void DoubleBuffer (void **, void **, int, char *)
 
void ExpandBuffer (void **, LONG *, int)
 
LONG iexp (LONG, int)
 
int IsLikeVector (WORD *)
 
int AreArgsEqual (WORD *, WORD *)
 
int CompareArgs (WORD *, WORD *)
 
UBYTE * SkipField (UBYTE *, int)
 
int StrCmp (UBYTE *, UBYTE *)
 
int StrICmp (UBYTE *, UBYTE *)
 
int StrHICmp (UBYTE *, UBYTE *)
 
int StrICont (UBYTE *, UBYTE *)
 
int ConWord (UBYTE *, UBYTE *)
 
int StrLen (UBYTE *)
 
UBYTE * GetPreVar (UBYTE *, int)
 
void ToGeneral (WORD *, WORD *, WORD)
 
int ToFast (WORD *, WORD *)
 
SETUPPARAMETERSGetSetupPar (UBYTE *)
 
int RecalcSetups (VOID)
 
int AllocSetups (VOID)
 
SORTINGAllocSort (LONG, LONG, LONG, LONG, int, int, LONG)
 
VOID AllocSortFileName (SORTING *)
 
UBYTE * LoadInputFile (UBYTE *, int)
 
UBYTE GetInput (VOID)
 
VOID ClearPushback (VOID)
 
UBYTE GetChar (int)
 
VOID CharOut (UBYTE)
 
VOID UnsetAllowDelay (VOID)
 
VOID PopPreVars (int)
 
VOID IniModule (int)
 
VOID IniSpecialModule (int)
 
int ModuleInstruction (int *, int *)
 
int PreProInstruction (VOID)
 
int LoadInstruction (int)
 
int LoadStatement (int)
 
KEYWORDFindKeyWord (UBYTE *, KEYWORD *, int)
 
KEYWORDFindInKeyWord (UBYTE *, KEYWORD *, int)
 
int DoDefine (UBYTE *)
 
int DoRedefine (UBYTE *)
 
int TheDefine (UBYTE *, int)
 
int TheUndefine (UBYTE *)
 
int ClearMacro (UBYTE *)
 
int DoUndefine (UBYTE *)
 
int DoInclude (UBYTE *)
 
int DoExternal (UBYTE *)
 
int DoToExternal (UBYTE *)
 
int DoFromExternal (UBYTE *)
 
int DoPrompt (UBYTE *)
 
int DoSetExternal (UBYTE *)
 
int DoSetExternalAttr (UBYTE *)
 
int DoRmExternal (UBYTE *)
 
int DoFactDollar (UBYTE *)
 
WORD GetDollarNumber (UBYTE **, DOLLARS)
 
int DoSetRandom (UBYTE *)
 
int DoOptimize (UBYTE *)
 
int DoClearOptimize (UBYTE *)
 
int DoMessage (UBYTE *)
 
int DoPreOut (UBYTE *)
 
int DoPreAppend (UBYTE *)
 
int DoPreCreate (UBYTE *)
 
int DoPreAssign (UBYTE *)
 
int DoPreBreak (UBYTE *)
 
int DoPreDefault (UBYTE *)
 
int DoPreSwitch (UBYTE *)
 
int DoPreEndSwitch (UBYTE *)
 
int DoPreCase (UBYTE *)
 
int DoPreShow (UBYTE *)
 
int DoPreExchange (UBYTE *)
 
int DoSystem (UBYTE *)
 
int DoPipe (UBYTE *)
 
VOID StartPrepro (VOID)
 
int DoIfdef (UBYTE *, int)
 
int DoElse (UBYTE *)
 
int DoElseif (UBYTE *)
 
int DoEndif (UBYTE *)
 
int DoTerminate (UBYTE *)
 
int DoIf (UBYTE *)
 
int DoCall (UBYTE *)
 
int DoDebug (UBYTE *)
 
int DoDo (UBYTE *)
 
int DoBreakDo (UBYTE *)
 
int DoEnddo (UBYTE *)
 
int DoEndprocedure (UBYTE *)
 
int DoInside (UBYTE *)
 
int DoEndInside (UBYTE *)
 
int DoProcedure (UBYTE *)
 
int DoPrePrintTimes (UBYTE *)
 
int DoPreWrite (UBYTE *)
 
int DoPreClose (UBYTE *)
 
int DoPreRemove (UBYTE *)
 
int DoCommentChar (UBYTE *)
 
int DoPrcExtension (UBYTE *)
 
VOID WriteString (int, UBYTE *, int)
 
VOID WriteUnfinString (int, UBYTE *, int)
 
UBYTE * PreCalc (VOID)
 
UBYTE * PreEval (UBYTE *, LONG *)
 
VOID NumToStr (UBYTE *, LONG)
 
int PreCmp (int, int, UBYTE *, int, int, UBYTE *, int)
 
int PreEq (int, int, UBYTE *, int, int, UBYTE *, int)
 
UBYTE * pParseObject (UBYTE *, int *, LONG *)
 
UBYTE * PreIfEval (UBYTE *, int *)
 
int EvalPreIf (UBYTE *)
 
int PreLoad (PRELOAD *, UBYTE *, UBYTE *, int, char *)
 
int PreSkip (UBYTE *, UBYTE *, int)
 
UBYTE * EndOfToken (UBYTE *)
 
VOID SetSpecialMode (int, int)
 
VOID MakeGlobal (VOID)
 
int ExecModule (int)
 
int ExecStore (VOID)
 
VOID FullCleanUp (VOID)
 
int DoExecStatement (VOID)
 
int DoPipeStatement (VOID)
 
int DoPolyfun (UBYTE *)
 
int DoPolyratfun (UBYTE *)
 
int CompileStatement (UBYTE *)
 
UBYTE * ToToken (UBYTE *)
 
int GetDollar (UBYTE *)
 
int MesWork (VOID)
 
int MesPrint (const char *,...)
 
int MesCall (char *)
 
UBYTE * NumCopy (WORD, UBYTE *)
 
char * LongCopy (LONG, char *)
 
char * LongLongCopy (off_t *, char *)
 
VOID ReserveTempFiles (int)
 
VOID PrintTerm (WORD *, char *)
 
VOID PrintTermC (WORD *, char *)
 
VOID PrintSubTerm (WORD *, char *)
 
VOID PrintWords (WORD *, LONG)
 
int ExpandTripleDots (int)
 
LONG ComPress (WORD **, LONG *)
 
VOID StageSort (FILEHANDLE *)
 
void M_free (VOID *, const char *)
 
void ClearWildcardNames (VOID)
 
int AddWildcardName (UBYTE *)
 
int GetWildcardName (UBYTE *)
 
void Globalize (int)
 
void ResetVariables (int)
 
void AddToPreTypes (int)
 
void MessPreNesting (int)
 
LONG GetStreamPosition (STREAM *)
 
WORD * DoubleCbuffer (int, WORD *)
 
WORD * AddLHS (int)
 
WORD * AddRHS (int, int)
 
int AddNtoL (int, WORD *)
 
int AddNtoC (int, int, WORD *)
 
VOID DoubleIfBuffers (VOID)
 
STREAMCreateStream (UBYTE *)
 
int setonoff (UBYTE *, int *, int, int)
 
int DoPrint (UBYTE *, int)
 
int SetExpr (UBYTE *, int, int)
 
void AddToCom (int, WORD *)
 
int Add2ComStrings (int, WORD *, UBYTE *, UBYTE *)
 
int DoSymmetrize (UBYTE *, int)
 
int DoArgument (UBYTE *, int)
 
int ArgFactorize (PHEAD WORD *, WORD *)
 
WORD * TakeArgContent (PHEAD WORD *, WORD *)
 
WORD * MakeInteger (PHEAD WORD *, WORD *, WORD *)
 
WORD * MakeMod (PHEAD WORD *, WORD *, WORD *)
 
WORD FindArg (PHEAD WORD *)
 
WORD InsertArg (PHEAD WORD *, WORD *, int)
 
int CleanupArgCache (PHEAD WORD)
 
int ArgSymbolMerge (WORD *, WORD *)
 
int ArgDotproductMerge (WORD *, WORD *)
 
void SortWeights (LONG *, LONG *, WORD)
 
int DoBrackets (UBYTE *, int)
 
int DoPutInside (UBYTE *, int)
 
WORD * CountComp (UBYTE *, WORD *)
 
int CoAntiBracket (UBYTE *)
 
int CoAntiSymmetrize (UBYTE *)
 
int DoArgPlode (UBYTE *, int)
 
int CoArgExplode (UBYTE *)
 
int CoArgImplode (UBYTE *)
 
int CoArgument (UBYTE *)
 
int CoInside (UBYTE *)
 
int ExecInside (UBYTE *)
 
int CoInExpression (UBYTE *)
 
int CoInParallel (UBYTE *)
 
int CoNotInParallel (UBYTE *)
 
int DoInParallel (UBYTE *, int)
 
int CoEndInExpression (UBYTE *)
 
int CoBracket (UBYTE *)
 
int CoPutInside (UBYTE *)
 
int CoAntiPutInside (UBYTE *)
 
int CoMultiBracket (UBYTE *)
 
int CoCFunction (UBYTE *)
 
int CoCTensor (UBYTE *)
 
int CoCollect (UBYTE *)
 
int CoCompress (UBYTE *)
 
int CoContract (UBYTE *)
 
int CoCycleSymmetrize (UBYTE *)
 
int CoDelete (UBYTE *)
 
int CoTableBase (UBYTE *)
 
int CoApply (UBYTE *)
 
int CoDenominators (UBYTE *)
 
int CoDimension (UBYTE *)
 
int CoDiscard (UBYTE *)
 
int CoDisorder (UBYTE *)
 
int CoDrop (UBYTE *)
 
int CoDropCoefficient (UBYTE *)
 
int CoDropSymbols (UBYTE *)
 
int CoElse (UBYTE *)
 
int CoElseIf (UBYTE *)
 
int CoEndArgument (UBYTE *)
 
int CoEndInside (UBYTE *)
 
int CoEndIf (UBYTE *)
 
int CoEndRepeat (UBYTE *)
 
int CoEndTerm (UBYTE *)
 
int CoEndWhile (UBYTE *)
 
int CoExit (UBYTE *)
 
int CoFactArg (UBYTE *)
 
int CoFactDollar (UBYTE *)
 
int CoFactorize (UBYTE *)
 
int CoNFactorize (UBYTE *)
 
int CoUnFactorize (UBYTE *)
 
int CoNUnFactorize (UBYTE *)
 
int DoFactorize (UBYTE *, int)
 
int CoFill (UBYTE *)
 
int CoFillExpression (UBYTE *)
 
int CoFixIndex (UBYTE *)
 
int CoFormat (UBYTE *)
 
int CoGlobal (UBYTE *)
 
int CoGlobalFactorized (UBYTE *)
 
int CoGoTo (UBYTE *)
 
int CoId (UBYTE *)
 
int CoIdNew (UBYTE *)
 
int CoIdOld (UBYTE *)
 
int CoIf (UBYTE *)
 
int CoIfMatch (UBYTE *)
 
int CoIfNoMatch (UBYTE *)
 
int CoIndex (UBYTE *)
 
int CoInsideFirst (UBYTE *)
 
int CoKeep (UBYTE *)
 
int CoLabel (UBYTE *)
 
int CoLoad (UBYTE *)
 
int CoLocal (UBYTE *)
 
int CoLocalFactorized (UBYTE *)
 
int CoMany (UBYTE *)
 
int CoMerge (UBYTE *)
 
int CoStuffle (UBYTE *)
 
int CoMetric (UBYTE *)
 
int CoModOption (UBYTE *)
 
int CoModuleOption (UBYTE *)
 
int CoModulus (UBYTE *)
 
int CoMulti (UBYTE *)
 
int CoMultiply (UBYTE *)
 
int CoNFunction (UBYTE *)
 
int CoNPrint (UBYTE *)
 
int CoNTensor (UBYTE *)
 
int CoNWrite (UBYTE *)
 
int CoNoDrop (UBYTE *)
 
int CoNoSkip (UBYTE *)
 
int CoNormalize (UBYTE *)
 
int CoMakeInteger (UBYTE *)
 
int CoFlags (UBYTE *, int)
 
int CoOff (UBYTE *)
 
int CoOn (UBYTE *)
 
int CoOnce (UBYTE *)
 
int CoOnly (UBYTE *)
 
int CoOptimizeOption (UBYTE *)
 
int CoOptimize (UBYTE *)
 
int CoPolyFun (UBYTE *)
 
int CoPolyRatFun (UBYTE *)
 
int CoPrint (UBYTE *)
 
int CoPrintB (UBYTE *)
 
int CoProperCount (UBYTE *)
 
int CoUnitTrace (UBYTE *)
 
int CoRCycleSymmetrize (UBYTE *)
 
int CoRatio (UBYTE *)
 
int CoRedefine (UBYTE *)
 
int CoRenumber (UBYTE *)
 
int CoRepeat (UBYTE *)
 
int CoSave (UBYTE *)
 
int CoSelect (UBYTE *)
 
int CoSet (UBYTE *)
 
int CoSetExitFlag (UBYTE *)
 
int CoSkip (UBYTE *)
 
int CoProcessBucket (UBYTE *)
 
int CoPushHide (UBYTE *)
 
int CoPopHide (UBYTE *)
 
int CoHide (UBYTE *)
 
int CoIntoHide (UBYTE *)
 
int CoNoHide (UBYTE *)
 
int CoUnHide (UBYTE *)
 
int CoNoUnHide (UBYTE *)
 
int CoSort (UBYTE *)
 
int CoSplitArg (UBYTE *)
 
int CoSplitFirstArg (UBYTE *)
 
int CoSplitLastArg (UBYTE *)
 
int CoSum (UBYTE *)
 
int CoSymbol (UBYTE *)
 
int CoSymmetrize (UBYTE *)
 
int DoTable (UBYTE *, int)
 
int CoTable (UBYTE *)
 
int CoTerm (UBYTE *)
 
int CoNTable (UBYTE *)
 
int CoCTable (UBYTE *)
 
int CoToTensor (UBYTE *)
 
int CoToVector (UBYTE *)
 
int CoTrace4 (UBYTE *)
 
int CoTraceN (UBYTE *)
 
int CoChisholm (UBYTE *)
 
int CoTransform (UBYTE *)
 
int CoClearTable (UBYTE *)
 
int DoChain (UBYTE *, int)
 
int CoChainin (UBYTE *)
 
int CoChainout (UBYTE *)
 
int CoTryReplace (UBYTE *)
 
int CoVector (UBYTE *)
 
int CoWhile (UBYTE *)
 
int CoWrite (UBYTE *)
 
int CoAuto (UBYTE *)
 
int CoTBaddto (UBYTE *)
 
int CoTBaudit (UBYTE *)
 
int CoTBcleanup (UBYTE *)
 
int CoTBcreate (UBYTE *)
 
int CoTBenter (UBYTE *)
 
int CoTBhelp (UBYTE *)
 
int CoTBload (UBYTE *)
 
int CoTBoff (UBYTE *)
 
int CoTBon (UBYTE *)
 
int CoTBopen (UBYTE *)
 
int CoTBreplace (UBYTE *)
 
int CoTBuse (UBYTE *)
 
int CoTestUse (UBYTE *)
 
int CoThreadBucket (UBYTE *)
 
int AddComString (int, WORD *, UBYTE *, int)
 
int CompileAlgebra (UBYTE *, int, WORD *)
 
int IsIdStatement (UBYTE *)
 
UBYTE * IsRHS (UBYTE *, UBYTE)
 
int ParenthesesTest (UBYTE *)
 
int tokenize (UBYTE *, WORD)
 
void WriteTokens (SBYTE *)
 
int simp1token (SBYTE *)
 
int simpwtoken (SBYTE *)
 
int simp2token (SBYTE *)
 
int simp3atoken (SBYTE *, int)
 
int simp3btoken (SBYTE *, int)
 
int simp4token (SBYTE *)
 
int simp5token (SBYTE *, int)
 
int simp6token (SBYTE *, int)
 
UBYTE * SkipAName (UBYTE *)
 
int TestTables (VOID)
 
int GetLabel (UBYTE *)
 
int CoIdExpression (UBYTE *, int)
 
int CoAssign (UBYTE *)
 
int DoExpr (UBYTE *, int, int)
 
int CompileSubExpressions (SBYTE *)
 
int CodeGenerator (SBYTE *)
 
int CompleteTerm (WORD *, UWORD *, UWORD *, WORD, WORD, int)
 
int CodeFactors (SBYTE *s)
 
WORD GenerateFactors (WORD, WORD)
 
int InsTree (int, int)
 
int FindTree (int, WORD *)
 
void RedoTree (CBUF *, int)
 
void ClearTree (int)
 
int CatchDollar (int)
 
int AssignDollar (PHEAD WORD *, WORD)
 
UBYTE * WriteDollarToBuffer (WORD, WORD)
 
UBYTE * WriteDollarFactorToBuffer (WORD, WORD, WORD)
 
void AddToDollarBuffer (UBYTE *)
 
void TermAssign (WORD *)
 
void WildDollars (PHEAD0)
 
LONG numcommute (WORD *, LONG *)
 
int FullRenumber (PHEAD WORD *, WORD)
 
int Lus (WORD *, WORD, WORD, WORD, WORD, WORD)
 
int FindLus (int, int, int)
 
int CoReplaceLoop (UBYTE *)
 
int CoFindLoop (UBYTE *)
 
int DoFindLoop (UBYTE *, int)
 
int CoFunPowers (UBYTE *)
 
int SortTheList (int *, int)
 
int MatchIsPossible (WORD *, WORD *)
 
int StudyPattern (WORD *)
 
WORD DolToTensor (PHEAD WORD)
 
WORD DolToFunction (PHEAD WORD)
 
WORD DolToVector (PHEAD WORD)
 
WORD DolToNumber (PHEAD WORD)
 
WORD DolToSymbol (PHEAD WORD)
 
WORD DolToIndex (PHEAD WORD)
 
LONG DolToLong (PHEAD WORD)
 
int DollarFactorize (PHEAD WORD)
 
int CoPrintTable (UBYTE *)
 
int CoDeallocateTable (UBYTE *)
 
void CleanDollarFactors (DOLLARS)
 
WORD * TakeDollarContent (PHEAD WORD *, WORD **)
 
WORD * MakeDollarInteger (PHEAD WORD *, WORD **)
 
WORD * MakeDollarMod (PHEAD WORD *, WORD **)
 
int GetDolNum (PHEAD WORD *, WORD *)
 
void AddPotModdollar (WORD)
 
int Optimize (WORD, int)
 
int ClearOptimize (VOID)
 
int LoadOpti (WORD)
 
int PutObject (WORD *, int)
 
void CleanOptiBuffer (VOID)
 
int PrintOptima (WORD)
 
int FindScratchName (VOID)
 
WORD MaxPowerOpti (LONG)
 
WORD HuntNumFactor (LONG, WORD *, int)
 
WORD HuntFactor (LONG, WORD *, int)
 
void HuntPairs (LONG, WORD)
 
void HuntBrackets (LONG)
 
int AddToOpti (WORD *, int)
 
LONG TestNewSca (LONG, WORD *, WORD *)
 
void NormOpti (WORD *)
 
void SortOpti (LONG)
 
void SplitOpti (WORD **, LONG)
 
void CombiOpti (VOID)
 
int TakeLongRoot (UWORD *, WORD *, WORD)
 
int TakeRatRoot (UWORD *, WORD *, WORD)
 
int MakeRational (WORD, WORD, WORD *, WORD *)
 
int MakeLongRational (PHEAD UWORD *, WORD, UWORD *, WORD, UWORD *, WORD *)
 
void HuntPowers (LONG, WORD)
 
void HuntNumBrackets (LONG)
 
void ClearTableTree (TABLES)
 
int InsTableTree (TABLES, WORD *)
 
void RedoTableTree (TABLES, int)
 
int FindTableTree (TABLES, WORD *, int)
 
void finishcbuf (WORD)
 
void clearcbuf (WORD)
 
void CleanUpSort (int)
 
FILEHANDLEAllocFileHandle (VOID)
 
VOID DeAllocFileHandle (FILEHANDLE *)
 
VOID LowerSortLevel (VOID)
 
int InsideDollar (PHEAD WORD *, WORD)
 
DOLLARS DolToTerms (PHEAD WORD)
 
WORD EvalDoLoopArg (PHEAD WORD *, WORD)
 
int SetExprCases (int, int, int)
 
int TestSelect (WORD *, WORD *)
 
int MakeSetupAllocs (VOID)
 
int TryFileSetups (VOID)
 
void ExchangeExpressions (int, int)
 
void ExchangeDollars (int, int)
 
int GetFirstBracket (WORD *, int)
 
int GetFirstTerm (WORD *, int)
 
int GetContent (WORD *, int)
 
int CleanupTerm (WORD *)
 
WORD ContentMerge (PHEAD WORD *, WORD *)
 
UBYTE * PreIfDollarEval (UBYTE *, int *)
 
LONG TermsInDollar (WORD)
 
LONG TermsInExpression (WORD)
 
WORD * TranslateExpression (UBYTE *)
 
int IsSetMember (WORD *, WORD)
 
int IsMultipleOf (WORD *, WORD *)
 
int TwoExprCompare (WORD *, WORD *, int)
 
void UpdatePositions (VOID)
 
void M_check (VOID)
 
void M_print (VOID)
 
void M_check1 (VOID)
 
void PrintTime (VOID)
 
POSITIONFindBracket (WORD, WORD *)
 
VOID PutBracketInIndex (PHEAD WORD *, POSITION *)
 
void ClearBracketIndex (WORD)
 
VOID OpenBracketIndex (WORD)
 
int DoNoParallel (UBYTE *)
 
int DoParallel (UBYTE *)
 
int DoModSum (UBYTE *)
 
int DoModMax (UBYTE *)
 
int DoModMin (UBYTE *)
 
int DoModLocal (UBYTE *)
 
UBYTE * DoModDollar (UBYTE *, int)
 
int DoProcessBucket (UBYTE *)
 
int DoinParallel (UBYTE *)
 
int DonotinParallel (UBYTE *)
 
int FlipTable (FUNCTIONS, int)
 
int ChainIn (PHEAD WORD *, WORD)
 
int ChainOut (PHEAD WORD *, WORD)
 
int ArgumentImplode (PHEAD WORD *, WORD *)
 
int ArgumentExplode (PHEAD WORD *, WORD *)
 
int DenToFunction (WORD *, WORD)
 
WORD HowMany (PHEAD WORD *, WORD *)
 
VOID RemoveDollars (VOID)
 
LONG CountTerms1 (PHEAD0)
 
LONG TermsInBracket (PHEAD WORD *, WORD)
 
int Crash (VOID)
 
char * str_dup (char *)
 
void convertblock (INDEXBLOCK *, INDEXBLOCK *, int)
 
void convertnamesblock (NAMESBLOCK *, NAMESBLOCK *, int)
 
void convertiniinfo (INIINFO *, INIINFO *, int)
 
int ReadIndex (DBASE *)
 
int WriteIndexBlock (DBASE *, MLONG)
 
int WriteNamesBlock (DBASE *, MLONG)
 
int WriteIndex (DBASE *)
 
int WriteIniInfo (DBASE *)
 
int ReadIniInfo (DBASE *)
 
int AddToIndex (DBASE *, MLONG)
 
DBASEGetDbase (char *)
 
DBASEOpenDbase (char *)
 
char * ReadObject (DBASE *, MLONG, char *)
 
char * ReadijObject (DBASE *, MLONG, MLONG, char *)
 
int ExistsObject (DBASE *, MLONG, char *)
 
int DeleteObject (DBASE *, MLONG, char *)
 
int WriteObject (DBASE *, MLONG, char *, char *, MLONG)
 
MLONG AddObject (DBASE *, MLONG, char *, char *)
 
int Cleanup (DBASE *)
 
DBASENewDbase (char *, MLONG)
 
void FreeTableBase (DBASE *)
 
int ComposeTableNames (DBASE *)
 
int PutTableNames (DBASE *)
 
MLONG AddTableName (DBASE *, char *, TABLES)
 
MLONG GetTableName (DBASE *, char *)
 
MLONG FindTableNumber (DBASE *, char *)
 
int TryEnvironment (VOID)
 
int CopyExpression (FILEHANDLE *, FILEHANDLE *)
 
int set_in (UBYTE, set_of_char)
 
one_byte set_set (UBYTE, set_of_char)
 
one_byte set_del (UBYTE, set_of_char)
 
one_byte set_sub (set_of_char, set_of_char, set_of_char)
 
int DoPreAddSeparator (UBYTE *)
 
int DoPreRmSeparator (UBYTE *)
 
int openExternalChannel (UBYTE *, int, UBYTE *, UBYTE *)
 
int initPresetExternalChannels (UBYTE *, int)
 
int closeExternalChannel (int)
 
int selectExternalChannel (int)
 
int getCurrentExternalChannel (VOID)
 
VOID closeAllExternalChannels (VOID)
 
UBYTE * defineChannel (UBYTE *, HANDLERS *)
 
int writeToChannel (int, UBYTE *, HANDLERS *)
 
int writeBufToExtChannelOk (char *, size_t)
 
int getcFromExtChannelOk (VOID)
 
int setKillModeForExternalChannelOk (int, int)
 
int setTerminatorForExternalChannelOk (char *)
 
int getcFromExtChannelFailure (VOID)
 
int setKillModeForExternalChannelFailure (int, int)
 
int setTerminatorForExternalChannelFailure (char *)
 
int writeBufToExtChannelFailure (char *, size_t)
 
int ReleaseTB (VOID)
 
int SymbolNormalize (WORD *)
 
int CompareSymbols (PHEAD WORD *, WORD *, WORD)
 
WORD NextPrime (PHEAD WORD)
 
UWORD wranf (PHEAD0)
 
UWORD iranf (PHEAD UWORD)
 
void iniwranf (PHEAD0)
 
UBYTE * PreRandom (UBYTE *)
 
WORD * PolyNormPoly (PHEAD WORD)
 
WORD * EvaluateGcd (PHEAD WORD *)
 
WORD ReadSaveHeader (VOID)
 
WORD ReadSaveIndex (FILEINDEX *)
 
WORD ReadSaveExpression (UBYTE *, UBYTE *, LONG *, LONG *)
 
UBYTE * ReadSaveTerm32 (UBYTE *, UBYTE *, UBYTE **, UBYTE *, UBYTE *, int)
 
WORD ReadSaveVariables (UBYTE *, UBYTE *, LONG *, LONG *, INDEXENTRY *, LONG *)
 
WORD WriteStoreHeader (WORD)
 
void InitRecovery (VOID)
 
int CheckRecoveryFile (VOID)
 
void DeleteRecoveryFile (VOID)
 
char * RecoveryFilename (VOID)
 
int DoRecovery (int *)
 
void DoCheckpoint (int)
 
VOID NumberMallocAddMemory (PHEAD0)
 
VOID TermMallocAddMemory (PHEAD0)
 
void ExprStatus (EXPRESSIONS)
 
VOID iniTools (VOID)
 
int TestTerm (WORD *)
 
WORD RunTransform (PHEAD WORD *term, WORD *params)
 
WORD RunEncode (PHEAD WORD *fun, WORD *args, WORD *info)
 
WORD RunDecode (PHEAD WORD *fun, WORD *args, WORD *info)
 
WORD RunReplace (PHEAD WORD *fun, WORD *args, WORD *info)
 
WORD RunImplode (WORD *fun, WORD *args)
 
WORD RunExplode (PHEAD WORD *fun, WORD *args)
 
int TestArgNum (int n, int totarg, WORD *args)
 
WORD PutArgInScratch (WORD *arg, UWORD *scrat)
 
UBYTE * ReadRange (UBYTE *s, WORD *out, int par)
 
WORD RunPermute (PHEAD WORD *fun, WORD *args, WORD *info)
 
WORD RunReverse (PHEAD WORD *fun, WORD *args)
 
WORD RunCycle (PHEAD WORD *fun, WORD *args, WORD *info)
 
WORD RunIsLyndon (PHEAD WORD *fun, WORD *args, int par)
 
WORD RunToLyndon (PHEAD WORD *fun, WORD *args, int par)
 
int NormPolyTerm (PHEAD WORD *)
 
WORD ComparePoly (WORD *, WORD *, WORD)
 
int ConvertToPoly (PHEAD WORD *, WORD *, WORD *, WORD)
 
int LocalConvertToPoly (PHEAD WORD *, WORD *, WORD, WORD)
 
int ConvertFromPoly (PHEAD WORD *, WORD *, WORD, WORD, WORD, WORD)
 
WORD FindSubterm (WORD *)
 
WORD FindLocalSubterm (PHEAD WORD *, WORD)
 
void PrintSubtermList (int, int)
 
void PrintExtraSymbol (int, WORD *, int)
 
WORD FindSubexpression (WORD *)
 
void UpdateMaxSize (VOID)
 
int CoToPolynomial (UBYTE *)
 
int CoFromPolynomial (UBYTE *)
 
int CoExtraSymbols (UBYTE *)
 
UBYTE * GetDoParam (UBYTE *, WORD **, int)
 
WORD * GetIfDollarFactor (UBYTE **, WORD *)
 
int CoDo (UBYTE *)
 
int CoEndDo (UBYTE *)
 
int ExtraSymFun (PHEAD WORD *, WORD)
 
int IniFbuffer (WORD)
 
void IniFbufs (VOID)
 
int GCDfunction (PHEAD WORD *, WORD)
 
WORD * GCDfunction3 (PHEAD WORD *, WORD *)
 
int GCDterms (PHEAD WORD *, WORD *, WORD *)
 
WORD * PutExtraSymbols (PHEAD WORD *, WORD, int *)
 
WORD * TakeExtraSymbols (PHEAD WORD *, WORD)
 
WORD * MultiplyWithTerm (PHEAD WORD *, WORD *)
 
WORD * TakeContent (PHEAD WORD *, WORD *)
 
int MergeSymbolLists (PHEAD WORD *, WORD *, int)
 
int MergeDotproductLists (PHEAD WORD *, WORD *, int)
 
WORD * CreateExpression (PHEAD WORD)
 
int DIVfunction (PHEAD WORD *, WORD, int)
 
WORD * ConvertArgument (PHEAD WORD *, int *)
 
WORD TestDoLoop (PHEAD WORD *, WORD)
 
WORD TestEndDoLoop (PHEAD WORD *, WORD)
 
WORD * poly_gcd (PHEAD WORD *, WORD *)
 
WORD * poly_div (PHEAD WORD *, WORD *)
 
WORD * poly_rem (PHEAD WORD *, WORD *)
 
WORD * poly_inverse (PHEAD WORD *, WORD *)
 
WORD * poly_ratfun_add (PHEAD WORD *, WORD *)
 
int poly_ratfun_normalize (PHEAD WORD *)
 
int poly_factorize_argument (PHEAD WORD *, WORD *)
 
WORD * poly_factorize_dollar (PHEAD WORD *)
 
int poly_factorize_expression (EXPRESSIONS)
 
int poly_unfactorize_expression (EXPRESSIONS)
 
VOID optimize_print_code (int)
 

Detailed Description

Contains macros and function declarations.

Definition in file declare.h.

Macro Definition Documentation

#define TOKENTOLINE (   x,
 
)
Value:
if ( AC.OutputSpaces == NOSPACEFORMAT ) { \
TokenToLine((UBYTE *)(y)); } else { TokenToLine((UBYTE *)(x)); }

Definition at line 51 of file declare.h.

#define ParseSign (   sgn,
 
)
Value:
{(sgn)=0;while(*(s)=='-'||*(s)=='+'){\
if ( *(s)++ == '-' ) sgn ^= 1;}}

Definition at line 63 of file declare.h.

#define ParseSignedNumber (   x,
 
)
Value:
{ int sgn; ParseSign(sgn,s)\
ParseNumber(x,s) if ( sgn ) x = -x; }

Definition at line 65 of file declare.h.

#define NeedNumber (   x,
  s,
  err 
)
Value:
{ int sgn = 1; \
while ( *s == ' ' || *s == '\t' || *s == '-' || *s == '+' ) { \
if ( *s == '-' ) sgn = -sgn; s++; } \
if ( chartype[*s] != 1 ) goto err; \
ParseNumber(x,s) \
if ( sgn < 0 ) (x) = -(x); while ( *s == ' ' || *s == '\t' ) s++;\
}

Definition at line 75 of file declare.h.

#define SKIPBRA1 (   s)
Value:
{ int lev1=0; s++; while(*s) { if(*s=='[')lev1++; \
else if(*s==']'&&--lev1<0)break; s++;} }

Definition at line 85 of file declare.h.

#define SKIPBRA2 (   s)
Value:
{ int lev2=0; s++; while(*s) { if(*s=='{')lev2++; \
else if(*s=='}'&&--lev2<0)break; \
else if(*s=='[')SKIPBRA1(s) s++;} }

Definition at line 87 of file declare.h.

#define SKIPBRA3 (   s)
Value:
{ int lev3=0; s++; while(*s) { if(*s=='(')lev3++; \
else if(*s==')'&&--lev3<0)break; \
else if(*s=='{')SKIPBRA2(s) \
else if(*s=='[')SKIPBRA1(s) s++;} }

Definition at line 90 of file declare.h.

#define SKIPBRA4 (   s)
Value:
{ int lev4=0; s++; while(*s) { if(*s=='(')lev4++; \
else if(*s==')'&&--lev4<0)break; \
else if(*s=='[')SKIPBRA1(s) s++;} }

Definition at line 94 of file declare.h.

#define SKIPBRA5 (   s)
Value:
{ int lev5=0; s++; while(*s) { if(*s=='{')lev5++; \
else if(*s=='}'&&--lev5<0)break; \
else if(*s=='(')SKIPBRA4(s) \
else if(*s=='[')SKIPBRA1(s) s++;} }

Definition at line 97 of file declare.h.

#define AddToCB (   c,
  wx 
)
Value:
if(c->Pointer>=c->Top) \
DoubleCbuffer(c-cbuf,c->Pointer); \
*(c->Pointer)++ = wx;

Definition at line 107 of file declare.h.

#define EXCHINOUT
Value:
{ FILEHANDLE *ffFi = AR.outfile; \
AR.outfile = AR.infile; AR.infile = ffFi; }
Definition: structs.h:618

Definition at line 111 of file declare.h.

#define BACKINOUT
Value:
{ FILEHANDLE *ffFi = AR.outfile; POSITION posi; \
AR.outfile = AR.infile; AR.infile = ffFi; \
SetEndScratch(AR.infile,&posi); }
Definition: structs.h:618

Definition at line 113 of file declare.h.

#define CopyArg (   to,
  from 
)
Value:
{ if ( *from > 0 ) { int ica = *from; NCOPY(to,from,ica) } \
else if ( *from <= -FUNCTION ) *to++ = *from++; \
else { *to++ = *from++; *to++ = *from++; } }

Definition at line 117 of file declare.h.

#define COPY1ARG (   s1,
  t1 
)
Value:
{ int ica; if ( (ica=*t1) > 0 ) { NCOPY(s1,t1,ica) } \
else if(*t1<=-FUNCTION){*s1++=*t1++;} else{*s1++=*t1++;*s1++=*t1++;} }

Definition at line 162 of file declare.h.

#define Add4Com (   x1,
  x2,
  x3 
)
Value:
{ WORD cod[4]; cod[0] = x1; cod[1] = 4; \
cod[2] = x2; cod[3] = x3; AddNtoL(4,cod); }

Definition at line 233 of file declare.h.

#define Add5Com (   x1,
  x2,
  x3,
  x4 
)
Value:
{ WORD cod[5]; cod[0] = x1; cod[1] = 5; \
cod[2] = x2; cod[3] = x3; cod[4] = x4; AddNtoL(5,cod); }

Definition at line 235 of file declare.h.

#define WantAddPointers (   x)
Value:
while((AT.pWorkPointer+(x))>AR.pWorkSize){WORD ***ppp=&AT.pWorkSpace;\
ExpandBuffer((void **)ppp,&AR.pWorkSize,(int)(sizeof(WORD *)));}

Definition at line 241 of file declare.h.

#define WantAddLongs (   x)
Value:
while((AT.lWorkPointer+(x))>AR.lWorkSize){LONG **ppp=&AT.lWorkSpace;\
ExpandBuffer((void **)ppp,&AR.lWorkSize,sizeof(LONG));}

Definition at line 243 of file declare.h.

#define WantAddPositions (   x)
Value:
while((AT.posWorkPointer+(x))>AR.posWorkSize){POSITION **ppp=&AT.posWorkSpace;\
ExpandBuffer((void **)ppp,&AR.posWorkSize,sizeof(POSITION));}

Definition at line 245 of file declare.h.

#define EXTERNLOCK (   x)

NOTE: We have replaced LOCK(ErrorMessageLock) and UNLOCK(ErrorMessageLock) by MLOCK(ErrorMessageLock) and MUNLOCK(ErrorMessageLock). They are used for the synchronised output in ParFORM. (TU 28 May 2011)

Definition at line 329 of file declare.h.

Function Documentation

VOID StartVariables ( )
WORD* PasteTerm ( PHEAD WORD  number,
WORD *  accum,
WORD *  position,
WORD  times,
WORD  divby 
)

Puts the term at position in the accumulator accum at position 'number+1'. if times > 0 the coefficient of this term is multiplied by times/divby.

Parameters
numberThe number of term fragments in accum that should be skipped
accumThe accumulator of term fragments
positionA position in (typically) a compiler buffer from where a (piece of a) term comes.
timesMultiply the result by this
divbyDivide the result by this.

This routine is typically used when we have to replace a (sub)expression pointer by a power of a (sub)expression. This uses mostly a binomial expansion and the new term is the old term multiplied one by one by terms of the new expression. The factors times and divby keep track of the binomial coefficient. Once this is complete, the routine FiniTerm will make the contents of the accumulator into a proper term that still needs to be normalized.

Definition at line 2603 of file proces.c.

Referenced by Generator().

VOID AddArgs ( PHEAD WORD *  s1,
WORD *  s2,
WORD *  m 
)

Adds the arguments of two occurrences of the PolyFun.

Parameters
s1Pointer to the first occurrence.
s2Pointer to the second occurrence.
mPointer to where the answer should be.

Definition at line 2115 of file sort.c.

Referenced by AddPoly(), and MergePatches().

WORD AddCoef ( PHEAD WORD **  ps1,
WORD **  ps2 
)

Adds the coefficients of the terms *ps1 and *ps2. The problem comes when there is not enough space for a new longer coefficient. First a local solution is tried. If this is not succesfull we need to move terms around. The possibility of a garbage collection should not be ignored, as avoiding this costs very much extra space which is nearly wasted otherwise.

If the return value is zero the terms cancelled.

The resulting term is left in *ps1.

Definition at line 1829 of file sort.c.

References GarbHand(), and NormalModulus().

Referenced by SplitMerge().

WORD AddPoly ( PHEAD WORD **  ps1,
WORD **  ps2 
)

Routine should be called when S->PolyWise != 0. It points then to the position of AR.PolyFun in both terms.

We add the contents of the arguments of the two polynomials. Special attention has to be given to special arguments. We have to reserve a space equal to the size of one term + the size of the argument of the other. The addition has to be done in this routine because not all objects are reentrant.

Newer addition (12-nov-2007). The PolyFun can have two arguments. In that case S->PolyFlag is 2 and we have to call the routine for adding rational polynomials. We have to be rather careful what happens with: The location of the output The order of the terms in the arguments At first we allow only univariate polynomials in the PolyFun. This restriction will be lifted a.s.a.p.

Parameters
ps1A pointer to the postion of the first term
ps2A pointer to the postion of the second term
Returns
If zero the terms cancel. Otherwise the new term is in *ps1.

Definition at line 1956 of file sort.c.

References AddArgs(), and GarbHand().

Referenced by SplitMerge().

WORD CompCoef ( WORD *  term1,
WORD *  term2 
)

Routine takes a1 mod m1 and a2 mod m2 and returns a mod m1*m2 with a mod m1 = a1 and a mod m2 = a2 Chinese remainder: a%(m1*m2) = q1*m1+a1 a%(m1*m2) = q2*m2+a2 Compute n1 such that (n1*m1)m2 is one Compute n2 such that (n2*m2)m1 is one Then (a1*n2*m2+a2*n1*m1)%(m1*m2) is a%(m1*m2)

Definition at line 3012 of file reken.c.

References GetModInverses(), NormalModulus(), and PHEAD.

Referenced by Compare1(), and PF_BroadcastPreDollar().

WORD Compare1 ( PHEAD WORD *  term1,
WORD *  term2,
WORD  level 
)

Compares two terms. The answer is: 0 equal ( with exception of the coefficient if level == 0. ) >0 term1 comes first. <0 term2 comes first. Some special precautions may be needed to keep the CompCoef routine from generating overflows, although this is very unlikely in subterms. This routine should not return an error condition.

Originally this routine was called Compare. With the treatment of special polynomials with terms that contain only symbols and the need for extreme speed for the polynomial routines we made a special compare routine and now we store the address of the current compare routine in AR.CompareRoutine and have a macro Compare which makes all existing code work properly and we can just replace the routine on a thread by thread basis (each thread has its own AR struct).

Parameters
term1First input term
term2Second input term
levelThe sorting level (may influence on the result)
Returns
0 equal ( with exception of the coefficient if level == 0. ) >0 term1 comes first. <0 term2 comes first.

Definition at line 2397 of file sort.c.

References CompCoef().

Referenced by InFunction(), and StartVariables().

WORD Deferred ( PHEAD WORD *  term,
WORD  level 
)

Picks up the deferred brackets. These are the bracket contents of which we postpone the reading when we use the 'Keep Brackets' statement. These contents are multiplying the terms just before they are sent to the sorting system. Special attention goes to having it thread-safe We have to lock positioning the file and reading it in a thread specific buffer.

Parameters
termThe term that must be multiplied by the contents of the current bracket
levelThe compiler level. This is needed because after multiplying term by term we call Generator again.

Definition at line 4275 of file proces.c.

References Generator(), and InsertTerm().

Referenced by Generator().

WORD DoOnePow ( PHEAD WORD *  term,
WORD  power,
WORD  nexp,
WORD *  accum,
WORD *  aa,
WORD  level,
WORD *  freeze 
)

Routine gets one power of an expression in the scratch system. If there are more powers needed there will be a recursion.

No attempt is made to use binomials because we have no information about commutating properties.

There is a searching for the contents of brackets if needed. This searching may be rather slow because of the single links.

Parameters
termis the term we are adding to.
poweris the power of the expression that we need.
nexpis the number of the expression.
accumis the accumulator of terms. It accepts the termfragments that are made into a proper term in FiniTerm
aapoints to the start of the entire accumulator. In *aa we store the number of term fragments that are in the accumulator.
levelis the current depth in the tree of statements. It is needed to continue to the next operation/substitution with each generated term
freezeis the pointer to the bracket information that should be matched.

Definition at line 4056 of file proces.c.

References FiniTerm(), Generator(), and FiLe::handle.

Referenced by Generator().

LONG EndSort ( PHEAD WORD *  buffer,
int  par 
)

Finishes a sort. At AR.sLevel == 0 the output is to the regular output stream. When AR.sLevel > 0, the parameter par determines the actual output. The AR.sLevel will be popped. All ongoing stages are finished and if the sortfile is open it is closed. The statistics are printed when AR.sLevel == 0 par == 0 Output to the buffer. par == 1 Sort for function arguments. The output will be copied into the buffer. It is assumed that this is in the WorkSpace. par == 2 Sort for $-variable. We return the address of the buffer that contains the output in buffer (treated like WORD **). We first catch the output in a file (unless we can intercept things after the small buffer has been sorted) Then we read from the file into a buffer. Only when par == 0 data compression can be attempted at AT.SS==AT.S0.

Parameters
bufferbuffer for output when needed
parSee above
Returns
If negative: error. If positive: number of words in output.

Definition at line 632 of file sort.c.

References ComPress(), FlushOut(), MergePatches(), PF_EndSort(), PutOut(), SplitMerge(), StageSort(), and WriteStats().

Referenced by DollarFactorize(), InFunction(), MakeDollarInteger(), MakeDollarMod(), PF_CollectModifiedDollars(), PF_InParallelProcessor(), PF_Processor(), PolyFunMul(), Processor(), TakeArgContent(), TakeContent(), TestMatch(), TestSub(), and TheDefine().

WORD FiniTerm ( PHEAD WORD *  term,
WORD *  accum,
WORD *  termout,
WORD  number,
WORD  tepos 
)

Concatenates the contents of the accumulator into a single legal term, which replaces the subexpression pointer

Parameters
termthe input term with the (sub)expression subterm
accumthe accumulator with the term fragments
termoutthe location where the output should be written
numberthe number of term fragments in the accumulator
teposthe position of the subterm in term to be replaced

Definition at line 2668 of file proces.c.

Referenced by DoOnePow(), and Generator().

WORD FlushOut ( POSITION position,
FILEHANDLE fi,
int  compr 
)

Completes output to an output file and writes the trailing zero.

Parameters
positionThe position in the file after writing
fiThe file (or its cache)
comprIndicates whether there should be compression with gzip.
Returns
Regular conventions (OK -> 0).

Definition at line 1621 of file sort.c.

References FiLe::handle, BrAcKeTiNfO::indexbuffer, and PF_ISendSbuf().

Referenced by EndSort(), MergePatches(), PF_EndSort(), Processor(), and TheDefine().

WORD Generator ( PHEAD WORD *  term,
WORD  level 
)

The heart of the program. Here the expansion tree is set up in one giant recursion

Parameters
termthe input term. may be overwritten
levelthe level in the compiler buffer (number of statement)
Returns
Normal conventions (OK = 0).

The routine looks first whether there are unsubstituted (sub)expressions. If so, one of them gets inserted term by term and the new term is used in a renewed call to Generator. If there are no (sub)expressions, the term is normalized, the compiler level is raised (next statement) and the program looks what type of statement this is. If this is a special statement it is either treated on the spot or the appropriate routine is called. If it is a substitution, the pattern matcher is called (TestMatch) which tells whether there was a match. If so we need to call TestSub again to test for (sub)expressions. If we run out of levels, the term receives a final treatment for modulus calculus and/or brackets and is then sent off to the sorting routines.

Definition at line 2865 of file proces.c.

References Deferred(), DollarFactorize(), DoOnePow(), FiniTerm(), InFunction(), InsertTerm(), CbUf::lhs, VaRrEnUm::lo, PasteFile(), PasteTerm(), PF_Deferred(), PolyFunMul(), PrepPoly(), PutPreVar(), StoreTerm(), ReNuMbEr::symb, TestMatch(), and TestSub().

Referenced by Deferred(), DollarFactorize(), DoOnePow(), InFunction(), LocalConvertToPoly(), MakeDollarInteger(), MakeDollarMod(), PF_CollectModifiedDollars(), PF_Deferred(), PF_InParallelProcessor(), PF_Processor(), Processor(), TakeContent(), TestMatch(), TestSub(), and TheDefine().

WORD InFunction ( PHEAD WORD *  term,
WORD *  termout 
)

Makes the replacement of the subexpression with the number 'replac' in a function argument. Additional information is passed in some of the AR, AN, AT variables.

Parameters
termThe input term
termoutThe output term
Returns
0: everything is fine, Negative: fatal, Positive: error.

Special attention should be given to nested functions!

Definition at line 1809 of file proces.c.

References Compare1(), CompareSymbols(), EndSort(), Generator(), LowerSortLevel(), NewSort(), StoreTerm(), and SymbolNormalize().

Referenced by Generator().

WORD InsertTerm ( PHEAD WORD *  term,
WORD  replac,
WORD  extractbuff,
WORD *  position,
WORD *  termout,
WORD  tepos 
)

Puts the terms 'term' and 'position' together into a single legal term in termout. replac is the number of the subexpression that should be replaced. It must be a positive term. When action is needed in the argument of a function all terms in that argument are dealt with recursively. The subexpression is sorted. Only one subexpression is done at a time this way.

Parameters
termthe input term
replacnumber of the subexpression pointer to replace
extractbuffnumber of the compiler buffer replac refers to
positionposition from where to take the term in the compiler buffer
termoutthe output term
teposoffset in term where the subexpression is.
Returns
Normal conventions (OK = 0).

Definition at line 2350 of file proces.c.

Referenced by Deferred(), Generator(), and PF_Deferred().

WORD MergePatches ( WORD  par)

The general merge routine. Can be used for the large buffer and the file merging. The array S->Patches tells where the patches start S->pStop tells where they end (has to be computed first). The end of a 'line to be merged' is indicated by a zero. If the end is reached without running into a zero or a term runs over the boundary of a patch it is a file merging operation and a new piece from the file is read in.

Parameters
parIf par == 0 the sort is for file -> outputfile. If par == 1 the sort is for large buffer -> sortfile. If par == 2 the sort is for large buffer -> outputfile.

Definition at line 3324 of file sort.c.

References AddArgs(), FlushOut(), FiLe::handle, NormalModulus(), PutIn(), PutOut(), Sflush(), and StageSort().

Referenced by EndSort(), and StoreTerm().

WORD NewSort ( PHEAD0  )

Starts a new sort. At the lowest level this is a 'main sort' with the struct according to the parameters in S0. At higher levels this is a sort for functions, subroutines or dollars. We prepare the arrays and structs.

Returns
Regular convention (OK -> 0)

Definition at line 553 of file sort.c.

Referenced by DollarFactorize(), InFunction(), MakeDollarInteger(), MakeDollarMod(), PF_CollectModifiedDollars(), PF_InParallelProcessor(), PF_Processor(), PolyFunMul(), Processor(), TakeArgContent(), TakeContent(), TestMatch(), TestSub(), and TheDefine().

LONG PasteFile ( PHEAD WORD  number,
WORD *  accum,
POSITION position,
WORD **  accfill,
RENUMBER  renumber,
WORD *  freeze,
WORD  nexpr 
)

Gets a term from stored expression expr and puts it in the accumulator at position number. It returns the length of the term that came from file.

Parameters
numbernumber of partial terms to skip in accum
accumthe accumulator
positionfile position from where to get the stored term
accfillreturns tail position in accum
renumberthe renumber struct for the variables in the stored expression
freezeinformation about if we need only the contents of a bracket
nexprthe number of the stored expression
Returns
Normal conventions (OK = 0).

Definition at line 2481 of file proces.c.

Referenced by Generator().

WORD PolyFunMul ( PHEAD WORD *  term)

Multiplies the arguments of multiple occurrences of the polyfun. In this routine we do the original PolyFun with one argument only. The PolyRatFun (PolyFunType = 2) is done in a dedicated routine in the file polynito.c The new result is written over the old result.

Parameters
termIt contains the input term and later the output.
Returns
Normal conventions (OK = 0).

Definition at line 4746 of file proces.c.

References EndSort(), LowerSortLevel(), NewSort(), and StoreTerm().

Referenced by Generator().

WORD PrepPoly ( PHEAD WORD *  term)

Routine checks whether the count of function AR.PolyFun is zero or one. If it is one and it has one scalarlike argument the coefficient of the term is pulled inside the argument. If the count is zero a new function is made with the coefficient as its only argument. The function should be placed at its proper position.

When this function is active it places the PolyFun as last object before the coefficient. This is needed because otherwise the compress algorithm has problems in MergePatches.

The bracket routine should also place the PolyFun at a comparable spot. The compression should then stop at the PolyFun. It doesn't really have to stop when writing the final result but this may be too complicated.

Definition at line 4402 of file proces.c.

Referenced by Generator().

LONG PutIn ( FILEHANDLE file,
POSITION position,
WORD *  buffer,
WORD **  take,
int  npat 
)

Reads a new patch from position in file handle. It is put at buffer, anything after take is moved forward. This would be part of a term that hasn't been used yet. Because of this there should be some space before the start of the buffer

Parameters
fileThe file system from which to read
positionThe position from which to read
bufferThe buffer into which to read
takeThe unused tail should be moved before the buffer
npatThe number of the patch. Is needed if the information was compressed with gzip, because each patch has its own independent gzip encoding.

Definition at line 1154 of file sort.c.

References FiLe::handle.

Referenced by MergePatches().

WORD PutOut ( PHEAD WORD *  term,
POSITION position,
FILEHANDLE fi,
WORD  ncomp 
)

Routine writes one term to file handle at position. It returns the new value of the position.

NOTE: For 'final output' we may have to index the brackets. See the struct BRACKETINDEX. We should maintain: 1: a list with brackets array with the brackets 2: a list of objects of type BRACKETINDEX. It contains array with either pointers or offsets to the list of brackets. starting positions in the file. The index may be tied to a maximum size. In that case we may have to prune the list occasionally.

Parameters
termThe term to be written
positionThe position in the file. Afterwards it is updated
fiThe file (or its cache) to which should be written
ncompInformation about what type of compression should be used

Definition at line 1300 of file sort.c.

References FiLe::handle, and PF_ISendSbuf().

Referenced by EndSort(), MergePatches(), PF_EndSort(), PF_InParallelProcessor(), PF_Processor(), Processor(), and TheDefine().

VOID RaisPowCached ( PHEAD WORD  x,
WORD  n,
UWORD **  c,
WORD *  nc 
)

Computes power x^n and caches the value

Description

Calculates the power x^n and stores the results for caching purposes. The pointer c (i.e., the pointer, and not what it points to) is overwritten. What it points to should not be overwritten in the calling function.

Notes

  • Caching is done in AT.small_power[]. This array is extended if necessary.

Definition at line 1286 of file reken.c.

int NormalModulus ( UWORD *  a,
WORD *  na 
)

Brings a modular representation in the range -p/2 to +p/2 The return value tells whether anything was done. Routine made in the general modulus revamp of July 2008 (JV).

Definition at line 1370 of file reken.c.

Referenced by AddCoef(), CompCoef(), and MergePatches().

int GetModInverses ( WORD  m1,
WORD  m2,
WORD *  im1,
WORD *  im2 
)

Input m1 and m2, which are relative prime. determines a*m1+b*m2 = 1 (and 1 is the gcd of m1 and m2) then a*m1 = 1 mod m2 and hence im1 = a. and b*m2 = 1 mod m1 and hence im2 = b. Set m1 = 0*m1+1*m2 = a1*m1+b1*m2 m2 = 1*m1+0*m2 = a2*m1+b2*m2 If everything is OK, the return value is zero

Definition at line 1443 of file reken.c.

References PHEAD.

Referenced by CompCoef(), MakeDollarMod(), MakeInverses(), MakeMod(), and TakeContent().

WORD Sflush ( FILEHANDLE fi)

Puts the contents of a buffer to output Only to be used when there is a single patch in the large buffer.

Parameters
fiThe filesystem (or its cache) to which the patch should be written

Definition at line 1214 of file sort.c.

References FiLe::handle.

Referenced by MergePatches().

WORD SortWild ( WORD *  w,
WORD  nw 
)

Sorts the wildcard entries in the parameter w. Double entries are removed. Full space taken is nw words. Routine serves for the reading of wildcards in the compiler. The entries come in the format: (type,4,number,0) in which the zero is reserved for the future replacement of 'number'.

Parameters
wbuffer with wildcard entries.
nwnumber of wildcard entries.
Returns
Normal conventions (OK -> 0)

Definition at line 4269 of file sort.c.

VOID SplitMerge ( PHEAD WORD **  Pointer,
LONG  number 
)

Algorithm by J.A.M.Vermaseren (31-7-1988)

Note that AN.SplitScratch and AN.InScratch are used also in GarbHand

Merge sort in memory. The input is an array of pointers. Sorting is done recursively by dividing the array in two equal parts and calling SplitMerge for each. When the parts are small enough we can do the compare and take the appropriate action. An addition is that we look for 'runs'. Sequences that are already ordered. This happens a lot when there is very little action in a module. This made FORM faster by a few percent.

Parameters
PointerThe array of pointers to the terms to be sorted.
numberThe number of pointers in Pointer.

The terms are supposed to be sitting in the small buffer and there is supposed to be an extension to this buffer for when there are two terms that should be added and the result takes more space than each of the original terms. The notation guarantees that the result never needs more space than the sum of the spaces of the original terms.

Definition at line 3033 of file sort.c.

References AddCoef(), AddPoly(), and PHEAD.

Referenced by EndSort(), and StoreTerm().

WORD StoreTerm ( PHEAD WORD *  term)

The central routine to accept terms, store them and keep things at least partially sorted. A call to EndSort will then complete storing and sorting.

Parameters
termThe term to be stored
Returns
Regular return conventions (OK -> 0)

Definition at line 4070 of file sort.c.

References ComPress(), MergePatches(), SplitMerge(), and WriteStats().

Referenced by DollarFactorize(), Generator(), InFunction(), PF_InParallelProcessor(), PF_Processor(), PolyFunMul(), Processor(), TakeArgContent(), and TestSub().

WORD TermRenumber ( WORD *  ,
RENUMBER  ,
WORD   
)
WORD TestMatch ( PHEAD WORD *  term,
WORD *  level 
)

This routine governs the pattern matching. If it decides that a substitution should be made, this can be either the insertion of a right hand side (C->rhs) or the automatic generation of terms as a result of an operation (like trace). The object to be replaced is removed from term and a subexpression pointer is inserted. If the substitution is made more than once there can be more subexpression pointers. Its number is positive as it corresponds to the level at which the C->rhs can be found in the compiler output. The subexpression pointer contains the wildcard substitution information. The power is found in *AT.TMout. For operations the subexpression pointer is negative and corresponds to an address in the array AT.TMout. In this array are then the instructions for the routine to be called and its number in the array 'Operations' The format is here: length,functionnumber,length-2 parameters

There is a certain complexity wrt repeat levels. Another complication is the poking of the wildcard values in the subexpression prototype in the compiler buffer. This was how things were done in the past with sequential FORM, but with the advent of TFORM this cannot be maintained. Now, for TFORM we make a copy of it. 7-may-2008 (JV): We cannot yet guarantee that this has been done 100% correctly. There are errors that occur in TFORM only and that may indicate problems.

Definition at line 97 of file pattern.c.

References EndSort(), Generator(), CbUf::lhs, LowerSortLevel(), NewSort(), and PHEAD.

Referenced by Generator().

WORD TestSub ( PHEAD WORD *  term,
WORD  level 
)

TestSub hunts for subexpression pointers. If one is found its power is given in AN.TeSuOut. and the returnvalue is 'expressionnumber'. If the expression number is negative it is an expression on disk.

In addition this routine tries to locate subexpression pointers in functions. It also notices that action must be taken with any of the special functions.

Parameters
termThe term in which TestSub hunts for potential action
levelThe number of the 'level' in the compiler buffer.
Returns
The number of the (sub)expression that was encountered.

Other values that are returned are in AN.TeSuOut, AR.TePos, AT.TMbuff, AN.TeInFun, AN.Frozen, AT.TMaddr

The level in the compiler buffer is more or less the number of the statement in the module. Hence it refers to the element in the lhs array.

This routine is one of the most important routines in FORM.

Definition at line 655 of file proces.c.

References TaBlEs::bounds, TaBlEs::bufnum, CbUf::CanCommu, CompareSymbols(), EndSort(), Generator(), LowerSortLevel(), MiNmAx::maxi, MiNmAx::mini, TaBlEs::mm, NewSort(), TaBlEs::numind, TaBlEs::pattern, CbUf::Pointer, TaBlEs::prototype, CbUf::rhs, MiNmAx::size, TaBlEs::sparse, StoreTerm(), TaBlEs::strict, TaBlEs::tablepointers, and CbUf::Top.

Referenced by Generator().

VOID WriteStats ( POSITION plspace,
WORD  par 
)

Writes the statistics.

Parameters
plspaceThe size in bytes currently occupied
parpar = 0 after a splitmerge. par = 1 after merge to sortfile. par = 2 after the sort

current expression is to be found in AR.CurExpr. terms are in S->TermsLeft. S->GenTerms.

Definition at line 91 of file sort.c.

Referenced by EndSort(), PF_Processor(), and StoreTerm().

int PutPreVar ( UBYTE *  name,
UBYTE *  value,
UBYTE *  args,
int  mode 
)

Inserts/Updates a preprocessor variable in the name administration.

Parameters
nameCharacter string with the variable name.
valueCharacter string with a possible value. Special case: if this argument is zero, then we have no value. Note: This is different from having an empty argument! This should only occur when the name starts with a ?
argsCharacter string with possible arguments.
mode=0: always create a new name entry, =1: try to do a redefinition if possible.
Returns
Index of used entry in name list.

Definition at line 549 of file pre.c.

References pReVaR::argnames, CbUf::Buffer, DoCheckpoint(), DoRecovery(), CbUf::lhs, pReVaR::name, pReVaR::nargs, CbUf::Pointer, CbUf::rhs, pReVaR::value, and pReVaR::wildarg.

Referenced by Generator(), PF_BroadcastModifiedDollars(), PF_BroadcastRedefinedPreVars(), StartVariables(), and TheDefine().

int CopyFile ( char *  source,
char *  dest 
)

Copies a file with name *source to a file named *dest. The involved files must not be open. Returns non-zero if an error occurred. Uses if possible the combined large and small sorting buffers as cache.

Definition at line 894 of file tools.c.

References ChAnNeL::handle, ChAnNeL::name, PF_WriteFileToFile(), and PHEAD.

Referenced by DoRecovery().

int TheDefine ( UBYTE *  s,
int  mode 
)

Preprocessor assignment. Possible arguments and values are treated and the new preprocessor variable is put into the name administration.

Parameters
sPointer to the character string following the preprocessor command.
modeBitmask. 0-bit clear: always create a new name entry, 0-bit set: try to redefine an existing name, 1-bit set: ignore preprocessor if/switch status.
Returns
zero: no errors, negative number: errors.

Definition at line 1798 of file pre.c.

References AddPotModdollar(), pReVaR::argnames, DollarFactorize(), DoLoOp::dollarname, EndSort(), FlushOut(), Generator(), CbUf::lhs, LowerSortLevel(), pReVaR::name, DoLoOp::name, pReVaR::nargs, NewSort(), DoLoOp::p, PF_BroadcastModifiedDollars(), PF_BroadcastRedefinedPreVars(), PutOut(), PutPreVar(), and pReVaR::value.

LONG ComPress ( WORD **  ss,
LONG *  n 
)

Gets a list of pointers to terms and compresses the terms. In n it collects the number of terms and the return value of the function is the space that is occupied.

We have to pay some special attention to the compression of terms with a PolyFun. This PolyFun should occur only straight before the coefficient, so we can use the same trick as for the coefficient to sabotage compression of this object (Replace in the history the function pointer by zero. This is safe, because terms that would be identical otherwise would have been added).

Parameters
ssArray of pointers to terms to be compressed.
nNumber of pointers in ss.
Returns
Total number of words needed for the compressed result.

Definition at line 2867 of file sort.c.

Referenced by EndSort(), and StoreTerm().

VOID StageSort ( FILEHANDLE fout)

Prepares a stage 4 or higher sort. Stage 4 sorts occur when the sort file contains more patches than can be merged in one pass.

Definition at line 4189 of file sort.c.

References FiLe::handle.

Referenced by EndSort(), and MergePatches().

WORD* TakeArgContent ( PHEAD WORD *  argin,
WORD *  argout 
)

Implements part of the old ExecArg in which we take common factors from arguments with more than one term. The common pieces are put in argout as a sequence of arguments. The part with the multiple terms that are now relative prime is put in argfree which is allocated via TermMalloc and is given as the return value. The difference with the old code is that negative powers are always removed. Hence it is as in MakeInteger in which only numerators will be left: now only zero or positive powers will be remaining.

Definition at line 2598 of file argument.c.

References EndSort(), MakeInteger(), MakeMod(), NewSort(), and StoreTerm().

WORD* MakeInteger ( PHEAD WORD *  argin,
WORD *  argout,
WORD *  argfree 
)

For normalizing everything to integers we have to determine for all elements of this argument the LCM of the denominators and the GCD of the numerators. The input argument is in argin. The number that comes out should go to argout. The new pointer in the argout buffer is the return value. The normalized argument is in argfree.

Definition at line 3144 of file argument.c.

Referenced by TakeArgContent().

WORD* MakeMod ( PHEAD WORD *  argin,
WORD *  argout,
WORD *  argfree 
)

Similar to MakeInteger but now with modulus arithmetic using only a one WORD 'prime'. We make the coefficient of the first term in the argument equal to one. Already the coefficients are taken modulus AN.cmod and AN.ncmod == 1

Definition at line 3315 of file argument.c.

References GetModInverses().

Referenced by TakeArgContent().

WORD FindArg ( PHEAD WORD *  a)

Looks the argument up in the (workers) table. If it is found the number in the table is returned (plus one to make it positive). If it is not found we look in the compiler provided table. If it is found - the number in the table is returned (minus one to make it negative). If in neither table we return zero.

Definition at line 2345 of file argument.c.

WORD InsertArg ( PHEAD WORD *  argin,
WORD *  argout,
int  par 
)

Inserts the argument into the (workers) table. If the table is too full we eliminate half of it. The eliminated elements are the ones that have not been used most recently, weighted by their total use and age(?). If par == 0 it inserts in the regular factorization cache If par == 1 it inserts in the cache defined with the FactorCache statement

Definition at line 2369 of file argument.c.

References CleanupArgCache().

int CleanupArgCache ( PHEAD WORD  bufnum)

Cleans up the argument factorization cache. We throw half the elements. For a weight of what we want to keep we use the product of usage and the number in the buffer.

Definition at line 2404 of file argument.c.

References CbUf::boomlijst, CbUf::Buffer, CbUf::Pointer, CbUf::rhs, SortWeights(), and tree::usage.

Referenced by InsertArg().

void SortWeights ( LONG *  weights,
LONG *  extraspace,
WORD  number 
)

Sorts an array of LONGS in the same way SplitMerge (in sort.c) works We use gradual division in two.

Definition at line 3360 of file argument.c.

References SortWeights().

Referenced by CleanupArgCache(), and SortWeights().

int DollarFactorize ( PHEAD WORD  numdollar)

Factors a dollar expression. Notation: d->nfactors becomes nonzero. if the number of factors is one, we leave d->factors zero. Otherwise factors is an array of pointers to the factors. These are pointers of the type FACDOLLAR. fd->where pointer to contents in term notation fd->size size of the buffer fd->where points to fd->type DOLNUMBER or DOLTERMS fd->value value if type is DOLNUMBER and it fits in a WORD.

Definition at line 2794 of file dollar.c.

References EndSort(), Generator(), LocalConvertToPoly(), LowerSortLevel(), MakeDollarInteger(), MakeDollarMod(), NewSort(), PHEAD, and StoreTerm().

Referenced by Generator(), and TheDefine().

WORD* MakeDollarInteger ( PHEAD WORD *  bufin,
WORD **  bufout 
)

For normalizing everything to integers we have to determine for all elements of this argument the LCM of the denominators and the GCD of the numerators. The input argument is in bufin. The number that comes out is the return value. The normalized argument is in bufout.

Definition at line 3441 of file dollar.c.

References EndSort(), Generator(), and NewSort().

Referenced by DollarFactorize().

WORD* MakeDollarMod ( PHEAD WORD *  buffer,
WORD **  bufout 
)

Similar to MakeDollarInteger but now with modulus arithmetic using only a one WORD 'prime'. We make the coefficient of the first term in the argument equal to one. Already the coefficients are taken modulus AN.cmod and AN.ncmod == 1

Definition at line 3614 of file dollar.c.

References EndSort(), Generator(), GetModInverses(), NewSort(), and PHEAD.

Referenced by DollarFactorize().

void AddPotModdollar ( WORD  numdollar)

Adds a $-variable specified by numdollar to the list of potentially modified $-variables unless it has already been included in the list.

Parameters
numdollarThe index of the $-variable to be added.

Definition at line 3771 of file dollar.c.

Referenced by TheDefine().

void CleanUpSort ( int  num)

Partially or completely frees function sort buffers.

Definition at line 4361 of file sort.c.

Referenced by StartVariables().

WORD EvalDoLoopArg ( PHEAD WORD *  arg,
WORD  par 
)

Evaluates one argument of a do loop. Such an argument is constructed from SNUMBERs DOLLAREXPRESSIONs and possibly DOLLAREXPR2s which indicate factors of the preceeding dollar. Hence we have SNUMBER,num DOLLAREXPRESSION,numdollar DOLLAREXPRESSION,numdollar,DOLLAREXPR2,numfactor DOLLAREXPRESSION,numdollar,DOLLAREXPR2,numfactor,DOLLAREXPR2,numfactor etc. Because we have a do-loop at every stage we should have a number. The notation in DOLLAREXPR2 is that >= 0 is number of yet another dollar and < 0 is -n-1 with n the array element or zero. The return value is the (short) number. The routine works its way through the list in a recursive manner.

Definition at line 2491 of file dollar.c.

References PHEAD.

int SymbolNormalize ( WORD *  term)

Routine normalizes terms that contain only symbols. Regular minimum and maximum properties are ignored.

We check whether there are negative powers in the output. This is not allowed.

Definition at line 4676 of file normal.c.

Referenced by InFunction().

int CompareSymbols ( PHEAD WORD *  term1,
WORD *  term2,
WORD  par 
)

Compares the terms, based on the value of AN.polysortflag. If term1 < term2 the return value is -1 If term1 > term2 the return value is 1 If term1 = term2 the return value is 0 The coefficients may differ. The terms contain only a single subterm of type SYMBOL. If AN.polysortflag = 0 it is a 'regular' compare. If AN.polysortflag = 1 the sum of the powers is more important par is a dummy parameter to make the parameter field identical to that of Compare1 which is the regular compare routine in sort.c

Definition at line 2818 of file sort.c.

Referenced by InFunction(), and TestSub().

WORD NextPrime ( PHEAD WORD  num)

Gives the next prime number in the list of prime numbers.

If the list isn't long enough we expand it. For ease in ParForm and because these lists shouldn't be very big we let each worker keep its own list.

The list is cut off at MAXPOWER, because we don't want to get into trouble that the power of a variable gets larger than the prime number.

Definition at line 3629 of file reken.c.

References PF_BroadcastNumber(), and PHEAD.

WORD ReadSaveIndex ( FILEINDEX fileind)

Reads a FILEINDEX from the open save file specified by AO.SaveData.Handle. Translations for adjusting endianness and data sizes are done if necessary.

Depends on the assumption that sizeof(FILEINDEX) is the same everywhere. If FILEINDEX or INDEXENTRY change, then this functions has to be adjusted.

Called by CoLoad() and FindInIndex().

Parameters
fileindcontains the read FILEINDEX after succesful return. must point to allocated, big enough memory.
Returns
= 0 everything okay, != 0 an error occurred

Definition at line 4024 of file store.c.

References INFILEINDEX, FiLeInDeX::next, FiLeInDeX::number, and FuNcTiOn::number.

Referenced by TermRenumber().

WORD ReadSaveExpression ( UBYTE *  buffer,
UBYTE *  top,
LONG *  size,
LONG *  outsize 
)

Reads an expression from the open file specified by AO.SaveData.Handle. The endianness flip and a resizing without renumbering is done in this function. Thereafter the buffer consists of chunks with a uniform maximal word size (32bit at the moment). The actual renumbering is then done by calling the function ReadSaveTerm32(). The result is returned in buffer.

If the translation at some point doesn't fit into the buffer anymore, the function returns and must be called again. In any case size returns the number of successfully read bytes, outsize returns the number of successfully written bytes, and the file will be positioned at the next byte after the successfully read data.

It is called by PutInStore().

Parameters
bufferoutput buffer, holds the (translated) expression
topend of buffer
sizenumber of read bytes
outsizenumber of written bytes
Returns
= 0 everything okay, != 0 an error occurred

Definition at line 4979 of file store.c.

References ReadSaveTerm32().

UBYTE* ReadSaveTerm32 ( UBYTE *  bin,
UBYTE *  binend,
UBYTE **  bout,
UBYTE *  boutend,
UBYTE *  top,
int  terminbuf 
)

Reads a single term from the given buffer at bin and write the translated term back to this buffer at bout.

ReadSaveTerm32() is currently the only instantiation of a ReadSaveTerm-function. It only deals with data that already has the correct endianness and that is resized to 32bit words but without being renumbered or translated in any other way. It uses the compress buffer AR.CompressBuffer.

The function is reentrant in order to cope with nested function arguments. It is called by ReadSaveExpression() and itself.

The return value indicates the position in the input buffer up to which the data has already been successfully processed. The parameter bout returns the corresponding position in the output buffer.

Parameters
binstart of the input buffer
binendend of the input buffer
boutas input points to the beginning of the output buffer, as output points behind the already translated data in the output buffer
boutendend of already decompressed data in output buffer
topend of output buffer
terminbufflag whether decompressed data is already in the output buffer. used in recursive calls
Returns
pointer to the next unprocessed data in the input buffer

Definition at line 4570 of file store.c.

Referenced by ReadSaveExpression().

WORD ReadSaveVariables ( UBYTE *  buffer,
UBYTE *  top,
LONG *  size,
LONG *  outsize,
INDEXENTRY ind,
LONG *  stage 
)

Reads the variables from the open file specified by AO.SaveData.Handle. It reads the *size bytes and writes them to the *buffer. It is called by PutInStore().

If translation is necessary, the data might shrink or grow in size, then *size is adjusted so that the reading and writing fits into the memory from the buffer to the top. The actual number of read bytes is returned in *size, the number of written bytes is returned in *outsize.

If the *size is smaller than the actual size of the variables, this function will be called several times and needs to remember the current position in the variable structure. The parameter stage does this job. When ReadSaveVariables() is called for the first time, this parameter should have the value -1.

The parameter ind is used to get the number of variables.

Parameters
bufferread variables are written into this allocated memory
topupper end of allocated memory
sizenumber of bytes to read. might return a smaller number of read bytes if translation was necessary
outsizeif translation has be done, outsize contains the number of written bytes
indpointer of INDEXENTRY for the current expression. read-only
stageshould be -1 for the first call, will be increased by ReadSaveVariables to memorize the position in the variable structure
Returns
= 0 everything okay, != 0 an error occurred

Definition at line 4210 of file store.c.

References InDeXeNtRy::nfunctions, InDeXeNtRy::nindices, InDeXeNtRy::nsymbols, InDeXeNtRy::nvectors, and FuNcTiOn::spec.

WORD WriteStoreHeader ( WORD  handle)

Writes header with information about system architecture and FORM revision to an open store file.

Called by SetFileIndex().

Parameters
handlespecifies open file to which header will be written
Returns
= 0 everything okay, != 0 an error occurred

Definition at line 3813 of file store.c.

References STOREHEADER::endianness, STOREHEADER::lenLONG, STOREHEADER::lenPOINTER, STOREHEADER::lenPOS, STOREHEADER::lenWORD, STOREHEADER::maxpower, STOREHEADER::sFun, STOREHEADER::sInd, STOREHEADER::sSym, STOREHEADER::sVec, and STOREHEADER::wildoffset.

Referenced by SetFileIndex().

int DoRecovery ( int *  moduletype)

Reads from the recovery file and restores all necessary variables and states in FORM, so that the execution can recommence in preprocessor() as if no restart of FORM had occurred.

The recovery file is read into memory as a whole. The pointer p then points into this memory at the next non-processed data. The macros by which variables are restored, like R_SET, automatically increase p appropriately.

If something goes wrong, the function returns with a non-zero value.

Allocated memory that would be lost when overwriting the global structs with data from the file is freed first. A major part of the code deals with the restoration of pointers. The idiom we use is to memorize the original pointer value (org), allocate new memory and copy the data from the file into this memory, calculate the offset between the old pointer value and the new allocated memory position (ofs), and then correct all affected pointers (+=ofs).

We rely on the fact that several variables (especially in AM) are already assigned the correct values by the startup functions. That means, in principle, that a change in the setup files between snapshot creation and recovery will be noticed.

Definition at line 1383 of file checkpoint.c.

References TaBlEs::argtail, TaBlEs::boomlijst, BrAcKeTiNfO::bracketbuffer, TaBlEs::buffers, TaBlEs::bufferssize, CopyFile(), TaBlEs::flags, ReNuMbEr::func, ReNuMbEr::funnum, VaRrEnUm::hi, BrAcKeTiNfO::indexbuffer, ReNuMbEr::indi, ReNuMbEr::indnum, VaRrEnUm::lo, TaBlEs::MaxTreeSize, TaBlEs::mm, TaBlEs::numind, TaBlEs::pattern, TaBlEs::prototype, TaBlEs::prototypeSize, RecoveryFilename(), ExPrEsSiOn::renumlists, TaBlEs::reserved, TaBlEs::spare, TaBlEs::sparse, VaRrEnUm::start, ReNuMbEr::symb, ReNuMbEr::symnum, TaBlEs::tablepointers, TaBlEs::totind, ReNuMbEr::vecnum, and ReNuMbEr::vect.

Referenced by PutPreVar().

void DoCheckpoint ( int  moduletype)

Checks whether a snapshot should be done. Calls DoSnapshot() to create the snapshot.

Definition at line 3014 of file checkpoint.c.

References PF_BroadcastNumber(), PF_RecvFile(), and PF_SendFile().

Referenced by PutPreVar().

int TestTerm ( WORD *  term)

Tests the consistency of the term. Returns 0 when the term is OK. Any nonzero value is trouble. In the current version the testing isn't 100% complete. For instance, we don't check the validity of the symbols nor do we check the range of their powers. Etc. This should be extended when the need is there.

Parameters
termthe term to be tested

Definition at line 3331 of file tools.c.

int LocalConvertToPoly ( PHEAD WORD *  term,
WORD *  outterm,
WORD  startebuf,
WORD  par 
)

Converts a generic term to polynomial notation in which there are only symbols and brackets. During conversion there will be only symbols. Brackets are stripped. Objects that need 'translation' are put inside a special compiler buffer and represented by a symbol. The numbering of the extra symbols is down from the maximum. In principle there can be a problem when running into the already assigned ones. This uses the FindTree for searching in the global tree and then looks further in the AT.ebufnum. This allows fully parallel processing. Hence we need no locks. Cannot be used in the same module as ConvertToPoly.

Definition at line 508 of file notation.c.

References CbUf::Buffer, CbUf::dimension, Generator(), PHEAD, CbUf::Pointer, and CbUf::rhs.

Referenced by DollarFactorize().

int IniFbuffer ( WORD  bufnum)

Initialize a factorization cache buffer. We set the size of the rhs and boomlijst buffers immediately to their final values.

Definition at line 558 of file comtool.c.

References tree::blnce, CbUf::boomlijst, CbUf::CanCommu, CbUf::dimension, tree::left, CbUf::numdum, CbUf::NumTerms, tree::parent, CbUf::rhs, tree::right, tree::usage, and tree::value.

Referenced by StartVariables().

WORD* TakeContent ( PHEAD WORD *  in,
WORD *  term 
)

Implements part of the old ExecArg in which we take common factors from arguments with more than one term. The common pieces are put in argout as a sequence of arguments. The part with the multiple terms that are now relative prime is put in argfree which is allocated via TermMalloc and is given as the return value. The difference with the old code is that negative powers are always removed. Hence it is as in MakeInteger in which only numerators will be left: now only zero or positive powers will be remaining.

Definition at line 1316 of file ratio.c.

References EndSort(), Generator(), GetModInverses(), LowerSortLevel(), NewSort(), and PHEAD.