FORM  4.2.1
Macros | Functions
argument.c File Reference
#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)
 

Detailed Description

Contains the routines that deal with the execution phase of the argument and related statements (like term)

Definition in file argument.c.

Macro Definition Documentation

#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 2013 of file argument.c.

Function Documentation

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 2463 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 2487 of file argument.c.

References AddNtoC(), AddRHS(), and 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 2522 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 2716 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 3262 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 3433 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 3478 of file argument.c.

References SortWeights().

Referenced by CleanupArgCache(), and SortWeights().