FORM 4.3
Functions
comtool.c File Reference
#include "form3.h"

Go to the source code of this file.

Functions

int inicbufs (VOID)
 
void finishcbuf (WORD num)
 
void clearcbuf (WORD num)
 
WORD * DoubleCbuffer (int num, WORD *w, int par)
 
WORD * AddLHS (int num)
 
WORD * AddRHS (int num, int type)
 
int AddNtoL (int n, WORD *array)
 
int AddNtoC (int bufnum, int n, WORD *array, int par)
 
int InsTree (int bufnum, int h)
 
int FindTree (int bufnum, WORD *subexpr)
 
void RedoTree (CBUF *C, int size)
 
void ClearTree (int i)
 
int IniFbuffer (WORD bufnum)
 
LONG numcommute (WORD *terms, LONG *numterms)
 

Detailed Description

Utility routines for the compiler.

Definition in file comtool.c.

Function Documentation

◆ inicbufs()

int inicbufs ( VOID  )

Creates a new compiler buffer and returns its ID number.

Returns
The ID number for the new compiler buffer.

Definition at line 47 of file comtool.c.

References CbUf::boomlijst, CbUf::Buffer, CbUf::BufferSize, CbUf::CanCommu, CbUf::dimension, CbUf::lhs, CbUf::numdum, CbUf::NumTerms, CbUf::Pointer, CbUf::rhs, and CbUf::Top.

Referenced by AddRHS(), and StartVariables().

◆ finishcbuf()

void finishcbuf ( WORD  num)

Frees a compiler buffer.

Parameters
numThe ID number for the buffer to be freed.

Definition at line 89 of file comtool.c.

References CbUf::boomlijst, CbUf::Buffer, CbUf::BufferSize, CbUf::CanCommu, CbUf::lhs, CbUf::NumTerms, CbUf::Pointer, CbUf::rhs, and CbUf::Top.

Referenced by PF_BroadcastCBuf().

◆ clearcbuf()

void clearcbuf ( WORD  num)

Clears contents in a compiler buffer.

Parameters
numThe ID number for the buffer to be cleared.

Definition at line 116 of file comtool.c.

References CbUf::boomlijst, CbUf::Buffer, CbUf::Pointer, and CbUf::rhs.

◆ DoubleCbuffer()

WORD * DoubleCbuffer ( int  num,
WORD *  w,
int  par 
)

Doubles a compiler buffer.

Parameters
numThe ID number for the buffer to be doubled.
wThe pointer to the end (exclusive) of the current buffer. The contents in the range of [cbuf[num].Buffer,w) will be kept.

Definition at line 143 of file comtool.c.

References CbUf::Buffer, CbUf::BufferSize, CbUf::lhs, CbUf::Pointer, CbUf::rhs, and CbUf::Top.

Referenced by AddNtoC(), AddNtoL(), and TestSub().

◆ AddLHS()

WORD * AddLHS ( int  num)

Adds an LHS to a compiler buffer and returns the pointer to a buffer for the new LHS.

Parameters
numThe ID number for the buffer to get another LHS.

Definition at line 188 of file comtool.c.

References CbUf::lhs, and CbUf::Pointer.

Referenced by AddNtoL().

◆ AddRHS()

WORD * AddRHS ( int  num,
int  type 
)

Adds an RHS to a compiler buffer and returns the pointer to a buffer for the new RHS.

Parameters
numThe ID number for the buffer to get another RHS.
typeIf 0, the subexpression tree will be reallocated.

Definition at line 214 of file comtool.c.

References TaBlEs::buffers, TaBlEs::buffersfill, TaBlEs::bufferssize, TaBlEs::bufnum, CbUf::CanCommu, CbUf::dimension, inicbufs(), CbUf::numdum, CbUf::NumTerms, CbUf::Pointer, and CbUf::rhs.

Referenced by InsertArg(), StartVariables(), TestMatch(), and TestSub().

◆ AddNtoL()

int AddNtoL ( int  n,
WORD *  array 
)

Adds an LHS with the given data to the current compiler buffer.

Parameters
nThe length of the data.
arrayThe data to be added.
Returns
0 if succeeds.

Definition at line 288 of file comtool.c.

References AddLHS(), DoubleCbuffer(), CbUf::Pointer, and CbUf::Top.

◆ AddNtoC()

int AddNtoC ( int  bufnum,
int  n,
WORD *  array,
int  par 
)

Adds the given data to the last LHS/RHS in a compiler buffer.

Parameters
bufnumThe ID number for the buffer where the data will be added.
nThe length of the data.
arrayThe data to be added.
Returns
0 if succeeds.

Definition at line 317 of file comtool.c.

References DoubleCbuffer(), CbUf::Pointer, and CbUf::Top.

Referenced by InsertArg(), and StartVariables().

◆ InsTree()

int InsTree ( int  bufnum,
int  h 
)

Definition at line 355 of file comtool.c.

◆ FindTree()

int FindTree ( int  bufnum,
WORD *  subexpr 
)

Definition at line 533 of file comtool.c.

◆ RedoTree()

void RedoTree ( CBUF C,
int  size 
)

Definition at line 569 of file comtool.c.

◆ ClearTree()

void ClearTree ( int  i)

Definition at line 588 of file comtool.c.

◆ IniFbuffer()

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 614 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.

◆ numcommute()

LONG numcommute ( WORD *  terms,
LONG *  numterms 
)

Definition at line 659 of file comtool.c.