Sindbad~EG File Manager
/* M. Beeson for Windows Mathpert */
/* located terms, and prototypes and specifications
of functions for managing them */
/*
1.28.95 Original date
1.30.95 last modified
5.8.13 made cons an exported function
*/
/*_________________________________________________________________*/
typedef struct il
{ int data; /* can be negative, but must have enough room to
store an arbitrary arity; this would only cause
trouble on arities over 32K */
unsigned short functor;
struct il *next;
} pathlist;
pathlist * cons(int x, unsigned short y, pathlist *tail);
/* stick one item on the front of a list */
pathlist * copy_pathlist(pathlist *);
/*__________________________________________________________________*/
/* Linked lists of rectangles: */
/* We don't use the Windows RECT structure because we want the
components to be longs, even under Win16. When a large term is
displayed, it is first computed how to display it without
line-breaking, on an infinitely wide screen; and for this longs
are needed, as otherwise we get overflow e.g. on (2x+3)^99
The structure BIGRECT is defined in bigrect.h
*/
typedef struct rl { BIGRECT rect;
struct rl *next;
struct rl *prev;
int wl; /* y-coord of the line's water level, in pixel coords */
} rectlist; /* doubly linked list of rectangles with waterlevels */
/* The following typedef for 'located term' will be used for
terms whose location on the screen is tracked for hit-testing,
to support selection of a formula from the screen.
*/
typedef union largtag larg;
/* using larg * below instead of void * makes it possible to
inspect lterms in the Borland debugger.
*/
typedef struct lt
{ BIGRECT r; /* screen rectangle in window pixel coordinates */
/* coordinates can be negative or off-screen */
/* This is the smallest rectangle enclosing the
WHOLE term, even for broken terms */
unsigned short symbol;
unsigned short arity;
unsigned short info;
block block; /* original papyrus-coordinate height, width, water level, and bra */
larg *args; /* pointer to array of children (lterms except in atomic case) */
pathlist *path; /* path to this term from some term of which it is a subterm.
Just which term depends on the use at hand */
rectlist *linelist; /* in the case of a broken term, points to
a linked list of rectangles for the different lines,
including the first line. Must be NULL for an
unbroken term. */
} lterm;
union largtag
{ lterm t;
long i;
double d;
bignum b;
};
/* Macros for accessing the parts of an lterm: */
#define LARG(N,F) (((lterm *)(F).args)[N])
#define LARGPTR(t) ((lterm *) ((t).args))
#define LINES(F) ((BIGRECT *)(LARGPTR(F) + F.arity))
#define LARGREP(t,n,newarg) ((lterm *) ((t).args))[n] = newarg
/*_________________________________________________________________*/
/* linked lists of lterms: */
typedef struct ll { lterm data;
struct ll *next;
} ltermlist;
/* stick one item on the head of a list */
/*_________________________________________________________________*/
void locate_term(term bt, BIGRECT *r, lterm *ans);
/* convert a bblocked term bt into a located term that
fits in rectangle r, if possible. Break lines to
the width of r (except matrices) and if the result is
too long, the rectangles in *ans will not all be
contained in r; too bad. */
/*_________________________________________________________________*/
int lbreak(lterm *t);
/* Redefine the rectangles in t so it fits on the papyrus */
/*_________________________________________________________________*/
void set_paper(BIGRECT *r);
/* tell lbreak what the window rectangle is, so it knows where
to start a new line when a line must be broken */
void get_paper(BIGRECT *r);
/* retrieve a copy of the rectangle set in set_paper */
term extract_bterm(lterm t);
/* extract a bblocked term from an lterm */
void wdisplay_lterm(unsigned long hdc, lterm, unsigned long);
/* display an lterm on the given hdc, writing each
subterm in its own rectangle. Use a static global
in the file for the hdc and don't pass it to each
recursive call. Use the specified color. */
void ldisplay(lterm);
/* using the colors set up by wdisplay_lterm */
void shift(lterm *, long, long);
/* Move the rectangles by the specified amounts in x and y directions */
int paren_displacement(lterm t);
void lastrow(lterm, BIGRECT *, int*);
/* in bdisplay.c, but also used in printdlg.c */
term abstract(lterm);
/* discard display info to produce an ordinary term */
int lcontainseq(lterm);
int linterval_as_and(lterm);
int lequals(lterm,lterm);
void strip_parens(lterm *);
void move_lterm_up(lterm *, int);
lterm located_subrange(lterm t, int j, int m);
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists