FORM
4.1
|
#include "form3.h"
Go to the source code of this file.
Macros | |
#define | NEWORDER |
Functions | |
WORD | execarg (PHEAD WORD *term, WORD level) |
WORD | execterm (PHEAD WORD *term, WORD level) |
int | ArgumentImplode (PHEAD WORD *term, WORD *thelist) |
int | ArgumentExplode (PHEAD WORD *term, WORD *thelist) |
int | ArgFactorize (PHEAD WORD *argin, WORD *argout) |
WORD | FindArg (PHEAD WORD *a) |
WORD | InsertArg (PHEAD WORD *argin, WORD *argout, int par) |
int | CleanupArgCache (PHEAD WORD bufnum) |
int | ArgSymbolMerge (WORD *t1, WORD *t2) |
int | ArgDotproductMerge (WORD *t1, WORD *t2) |
WORD * | TakeArgContent (PHEAD WORD *argin, WORD *argout) |
WORD * | MakeInteger (PHEAD WORD *argin, WORD *argout, WORD *argfree) |
WORD * | MakeMod (PHEAD WORD *argin, WORD *argout, WORD *argfree) |
void | SortWeights (LONG *weights, LONG *extraspace, WORD number) |
Contains the routines that deal with the execution phase of the argument and related statements (like term)
Definition in file argument.c.
#define NEWORDER |
Factorizes an argument in general notation (meaning that the first word of the argument is a positive size indicator) Input (argin): pointer to the complete argument Output (argout): Pointer to where the output should be written. This is in the WorkSpace Return value should be negative if anything goes wrong.
The notation of the output should be a string of arguments terminated by the number zero.
Originally we sorted in a way that the constants came last. This gave conflicts with the dollar and expression factorizations (in the expressions we wanted the zero first and then followed by the constants).
Definition at line 1895 of file argument.c.
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().
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().
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().