FORM
4.2.1
|
Go to the source code of this file.
Macros | |
#define | FILLVALUE 0 |
#define | COPYFILEBUFSIZE 40960L |
#define | TERMMEMSTARTNUM 16 |
#define | TERMEXTRAWORDS 10 |
#define | NUMBERMEMSTARTNUM 16 |
#define | NUMBEREXTRAWORDS 10L |
#define | DODOUBLE(x) |
#define | DOEXPAND(x) |
Functions | |
UBYTE * | LoadInputFile (UBYTE *filename, int type) |
UBYTE | ReadFromStream (STREAM *stream) |
UBYTE | GetFromStream (STREAM *stream) |
UBYTE | LookInStream (STREAM *stream) |
STREAM * | OpenStream (UBYTE *name, int type, int prevarmode, int raiselow) |
int | LocateFile (UBYTE **name, int type) |
STREAM * | CloseStream (STREAM *stream) |
STREAM * | CreateStream (UBYTE *where) |
LONG | GetStreamPosition (STREAM *stream) |
VOID | PositionStream (STREAM *stream, LONG position) |
int | ReverseStatements (STREAM *stream) |
VOID | StartFiles () |
int | OpenFile (char *name) |
int | OpenAddFile (char *name) |
int | ReOpenFile (char *name) |
int | CreateFile (char *name) |
int | CreateLogFile (char *name) |
VOID | CloseFile (int handle) |
int | CopyFile (char *source, char *dest) |
int | CreateHandle () |
LONG | ReadFile (int handle, UBYTE *buffer, LONG size) |
LONG | ReadPosFile (PHEAD FILEHANDLE *fi, UBYTE *buffer, LONG size, POSITION *pos) |
LONG | WriteFileToFile (int handle, UBYTE *buffer, LONG size) |
VOID | SeekFile (int handle, POSITION *offset, int origin) |
LONG | TellFile (int handle) |
VOID | TELLFILE (int handle, POSITION *position) |
void | FlushFile (int handle) |
int | GetPosFile (int handle, fpos_t *pospointer) |
int | SetPosFile (int handle, fpos_t *pospointer) |
VOID | SynchFile (int handle) |
VOID | TruncateFile (int handle) |
int | GetChannel (char *name, int mode) |
int | GetAppendChannel (char *name) |
int | CloseChannel (char *name) |
void | UpdateMaxSize () |
int | StrCmp (UBYTE *s1, UBYTE *s2) |
int | StrICmp (UBYTE *s1, UBYTE *s2) |
int | StrHICmp (UBYTE *s1, UBYTE *s2) |
int | StrICont (UBYTE *s1, UBYTE *s2) |
int | CmpArray (WORD *t1, WORD *t2, WORD n) |
int | ConWord (UBYTE *s1, UBYTE *s2) |
int | StrLen (UBYTE *s) |
VOID | NumToStr (UBYTE *s, LONG x) |
VOID | WriteString (int type, UBYTE *str, int num) |
VOID | WriteUnfinString (int type, UBYTE *str, int num) |
UBYTE * | AddToString (UBYTE *outstring, UBYTE *extrastring, int par) |
UBYTE * | strDup1 (UBYTE *instring, char *ifwrong) |
UBYTE * | EndOfToken (UBYTE *s) |
UBYTE * | ToToken (UBYTE *s) |
UBYTE * | SkipField (UBYTE *s, int level) |
WORD | ReadSnum (UBYTE **p) |
UBYTE * | NumCopy (WORD y, UBYTE *to) |
char * | LongCopy (LONG y, char *to) |
char * | LongLongCopy (off_t *y, char *to) |
UBYTE * | MakeDate () |
int | set_in (UBYTE ch, set_of_char set) |
one_byte | set_set (UBYTE ch, set_of_char set) |
one_byte | set_del (UBYTE ch, set_of_char set) |
one_byte | set_sub (set_of_char set, set_of_char set1, set_of_char set2) |
VOID | iniTools (VOID) |
VOID * | Malloc (LONG size) |
VOID * | Malloc1 (LONG size, const char *messageifwrong) |
void | M_free (VOID *x, const char *where) |
void | M_check1 () |
void | M_print () |
VOID | TermMallocAddMemory (PHEAD0) |
VOID | NumberMallocAddMemory (PHEAD0) |
VOID | CacheNumberMallocAddMemory (PHEAD0) |
VOID * | FromList (LIST *L) |
VOID * | From0List (LIST *L) |
VOID * | FromVarList (LIST *L) |
int | DoubleList (VOID ***lijst, int *oldsize, int objectsize, char *nameoftype) |
int | DoubleLList (VOID ***lijst, LONG *oldsize, int objectsize, char *nameoftype) |
void | DoubleBuffer (void **start, void **stop, int size, char *text) |
void | ExpandBuffer (void **buffer, LONG *oldsize, int type) |
LONG | iexp (LONG x, int p) |
void | ToGeneral (WORD *r, WORD *m, WORD par) |
int | ToFast (WORD *r, WORD *m) |
WORD | ToPolyFunGeneral (PHEAD WORD *term) |
int | IsLikeVector (WORD *arg) |
int | AreArgsEqual (WORD *arg1, WORD *arg2) |
int | CompareArgs (WORD *arg1, WORD *arg2) |
int | CompArg (WORD *s1, WORD *s2) |
LONG | TimeWallClock (WORD par) |
LONG | TimeChildren (WORD par) |
LONG | TimeCPU (WORD par) |
int | Crash () |
int | TestTerm (WORD *term) |
Variables | |
FILES ** | filelist |
int | numinfilelist = 0 |
int | filelistsize = 0 |
WRITEFILE | WriteFile = &WriteFileToFile |
Low level routines for many types of task. There are routines for manipulating the input system (streams and files) routines for string manipulation, the memory allocation interface, and the clock. The last is the most sensitive to ports. In the past nearly every port to another OS or computer gave trouble. Nowadays it is slightly better but the poor POSIX compliance of LINUX again gave problems for the multithreaded version.
Definition in file tools.c.
#define TERMMEMSTARTNUM 16 |
Provides memory for one term (or one small polynomial) This means that the memory is limited to a buffer of size AM.MaxTer plus a few extra words. In parallel versions, each worker has its own memory pool.
The way we use the memory is by: term = TermMalloc(BHEAD0); and later we free it by TermFree(BHEAD term);
Layout: We have a list of available pointers to buffers: AT.TermMemHeap Its size is AT.TermMemMax We take from the top (indicated by AT.TermMemTop). When we run out of buffers we assign new ones (doubling the amount) and we have to extend the AT.TermMemHeap array. Important: There is no checking that the returned memory is legal, ie is memory that was handed out earlier.
#define NUMBERMEMSTARTNUM 16 |
Provides memory for one Long number This means that the memory is limited to a buffer of size AM.MaxTal In parallel versions, each worker has its own memory pool.
The way we use the memory is by: num = NumberMalloc(BHEAD0); Number = AT.NumberMemHeap[num]; and later we free it by NumberFree(BHEAD num);
Layout: We have a list of available pointers to buffers: AT.NumberMemHeap Its size is AT.NumberMemMax We take from the top (indicated by AT.NumberMemTop). When we run out of buffers we assign new ones (doubling the amount) and we have to extend the AT.NumberMemHeap array. Important: There is no checking on the returned memory!!!!
#define DODOUBLE | ( | x | ) |
#define DOEXPAND | ( | x | ) |
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 1029 of file tools.c.
Referenced by DoRecovery().
LONG TimeWallClock | ( | WORD | par | ) |
Returns the wall-clock time.
par | If zero, the wall-clock time will be reset to 0. |
Definition at line 3404 of file tools.c.
Referenced by DoCheckpoint(), DoRecovery(), and WriteStats().
LONG TimeCPU | ( | WORD | par | ) |
Returns the CPU time.
par | If zero, the CPU time will be reset to 0. |
Definition at line 3478 of file tools.c.
Referenced by PF_GetSlaveTimes(), PF_Processor(), and WriteStats().
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.
term,: | the term to be tested |
Definition at line 3789 of file tools.c.
References TestTerm().
Referenced by TestTerm().