Sindbad~EG File Manager
/* M. Beeson, for Mathpert */
/* include file private to the display.dll library
and, at least for now, break.c */
/* Exported functions are prototyped in display.h */
/* The typographical info (the extra arg of a bblocked term) is
sizeof(term) big. That is, two shorts and a pointer = 8 bytes.
*/
/*______________________________________________________________*/
/* For the Windows version, 'display' is private to display.dll,
and 'wdisplay' is exported. */
#ifndef COORD
typedef int coord; // duplicate definitions in document.h and display.h , watch out.
#define COORD
#endif
void display(term t,coord x,coord y,char attr);
/*______________________________________________________________*/
/* Fonts */
#define ROMAN 0 /* This MUST stay 0 */
#define ITALIC 1
#define SYMBOLFONT 2 /* Don't change! */
#define ROMFONT 3
#define SUPERSCRIPTROMAN 4 /* used to print ^2 in DOS */
#define SUPERSCRIPTITALIC 5 /* used to print ^n in DOS */
#define TENPOINT 0 /* normal size */
#define EIGHTPOINT 1 /* superscript size */
extern int bigparens;
extern int font; /* EIGHTPOINT or TENPOINT */
extern int textstyle; /* ROMAN or ITALIC */
#define EIGHTPOINTHEIGHT 11 /* height of eightpoint type in coord units */
#define TENPOINTHEIGHT 16
/*_______________________________________________________________*/
#define PARENS 0 /* eight possible kinds of brackets (thru TALLBARS) */
#define BRACKETS 1 /* don't change PARENS and BRACKETS --see display_bra in screen.c */
#define BRACES 2
#define BARS 3
#define TALLPARENS 4
#define TALLBRACKETS 5
#define TALLBRACES 6
#define TALLBARS 7
/*_______________________________________________________________*/
/* if you change this definition, change MAXWIDTH and MAXHEIGHT below too. */
/* sizeof(block) must be <= sizeof(term), which in Win32 is 12 bytes (strangely, not 10) */
typedef struct { unsigned long w; /* width */
unsigned short wl; /* water level */
unsigned short h; /* height */
unsigned extra: 1; /* to signal infix exponent */
/* also, to signal not to display
'dx' in an integral term */
unsigned size:1;
unsigned leftbra: 5; /* bracket on left? */
unsigned rightbra: 6; /* bracket on right? */
unsigned bra: 3; /* bracket type, see below */
} block;
/*
leftbra and rightbra tell whether there are left (resp. right)
brackets. For terms produced by bblock, one bit would suffice,
but terms produced by 'split' in breaking lines need bigger
values for nested parentheses (but 64 is more than can be
nested on a line anyway as space occurs between them).
3 bits for the bracket type
The bracket type bits are interpreted as follows:
two bits for the KIND of brackets: round, square, bar, or brace;
one bit for extra-tall brackets (charspace above and below the expression)
(taken together these three bits are the 'bra' field)
1 bit for the type size (standard or superscript);
*/
/*_____________________________________________________________________*/
/* given a newly-constructed term, whose 0-th arg is supposed to be
interpreted as bblock info, the following macro sets the height, width,
waterlevel, size, and brackets to specified values. First you
make an object of type bblock out of all that information. Then
you use this macro. */
#define SETBLOCK(t,b) *((block *) ((t).args)) = b
/* set the block of a bblocked term */
#define GETBLOCK(t) (* (block *)((t).args))
/* get the block of a bblocked term */
/*__________________________________________________________________*/
coord get_productspace(int);
coord get_parenspace(int);
coord get_parenwidth(int);
coord get_charspace(void);
coord get_matrixspace(void);
coord get_sumspace(int);
coord get_minusspace(int);
coord get_unaryminusspace(int);
coord get_minuswidth(int);
coord get_pluswidth(int size);
coord get_powerspace(void);
coord get_anddisplay(void);
coord get_ordisplay(void);
void set_ordisplay(coord t);
void set_anddisplay(coord t);
coord get_upperlimx(void);
coord get_lowerlimx(void);
coord get_upperlimy(void);
coord get_lowerlimy(void);
coord get_dotspace(void);
coord get_eightpointheight(void);
coord get_maxfract(void);
coord get_prefixspace(void);
coord get_falsedisplay(void);
int get_precision(void);
int get_separator(void);
coord get_abovefractionspace(void);
coord get_belowfractionspace(void);
coord get_undersqrtshift(void);
coord get_indexspace(void);
coord get_belowrootbar(void);
coord get_rootspace(void);
coord get_subscriptspace(void);
coord get_sqrtspace(void);
coord get_integralsignwidth(void);
coord get_floorwidth(void);
coord get_underfloor(void);
coord get_infixspace(void);
coord get_signoffset(int,char);
coord get_ineqspace(void);
/*___________________________________________________________________*/
int bblock( term, term *);
/* given expr, return the corresponding bblocked term in newexpr */
/* the top-level call. Nonzero return means out of space; this is
the case with all these functions, as out of space is the only possible
error */
int write2d(term t, char attr);
/* write t introducing good line breaks, at the global
coordinates x,y, using other global variables startcol, breakcol,
tab, and lastcol, which are explained in break.c */
/*___________________________________________________________*/
#define LEVEL(t) (((block *)(t).args)->wl)
#define MAXWIDTH 0xffffffffL
#define MAXHEIGHT 0xffff
#define BRACKET(t) (((block *)(t).args)->bra)
#define SIZE(t) (((block *)(t).args)->size)
#define NODIR 3
#define HI 4
#define LO 5
#define END 0
#define ATOM 125
#define NUMBR 126 /* NUMBER is a macro so have to spell it differently */
#define ORCHAR ';' /* single character to use for disjunction */
/* at least at line breaks can't print "or" */
#define WWRITE(s,x,y,a) wwrite(s,x,y,a)
#define WPUTCH(s,x,y,a) wputch(s,x,y,a)
void wputch( unsigned char c, coord x, coord y, char a);
void wwrite( char *s, coord x, coord y, char attr);
#define ENTRY(i,j,t) (ARG((j),ARG((i),(t))))
#define ENTRYPTR(i,j,t) (ARGPTR(ARG((i),(t))) + (j))
#define ROWS(t) ARITY((t))
#define COLUMNS(t) ARITY(ARG(0,(t))) /* number of columns of a (non-bblocked) term */
#define COLUMNWIDTHS(t,rows) (*(coord **) (ARGPTR(t) + (rows) + 1))
/* dynamic array of columnwidths of a bblocked term */
/* here 'rows' is the number of rows of the matrix */
#define US unsigned short
int bb(term,term *, short,short,short);
int bblock_atom(term,term *,US);
/* private function, called in break.c: */
int bblock_power_aux(term,term,term*,unsigned short, unsigned short);
/* private functions, called in bblock but declared in bblock2: */
int bblock_matrix(int,term,term *,US,US,US);
int bblock_list(int,term,term *,US,US,US);
int bblock_as_matrix(term, term *,US, US, US);
int bblock_linear_system(term,term *, US, US, US);
int bblock_subscripted_function(term,term *,US,US,US);
int bblock_subscripted_variable(term,term *,US,US,US);
int bblock_indexed_sum(term,term *, US,US,US);
int bblock_series(term,term *, US,US,US);
int bblock_cases(term,term *,US,US,US);
int bblock_logb1(term,term *, US,US,US);
int bblock_prime(term,term *,US,US,US);
int bblock_limit(term,term *,US,US,US);
int bblock_type(term,term *, US,US,US);
int bblock_sqrt(term,term *,US,US,US);
int bblock_root(term,term *,US,US,US);
int bblock_integral(term,term *,US,US,US);
int bblock_def_integral(term,term *,US,US,US);
int bblock_abs(term,term *, US);
int bblock_diff(term,term *,US,US,US);
int bblock_hi_diff(term,term *,US,US,US);
/* declared in bblock.c and private to display module, but called
in both bblock and display */
/*______________________________________________________________________*/
extern int reason_overflow; /* needed by write2d and show2d */
/*_______________________________________________________________________*/
void change_font(int);
void draw_vert(unsigned short, coord,coord,char);
/* draw vertical line of specified height at specified place */
void draw_horz(unsigned short, coord,coord,char);
/* draw horizontal line of specified height at specified place */
void draw_integral(unsigned short, coord,coord,char);
/* draw integral sign of specified height at specified place */
void display_bra(unsigned short,unsigned short,coord,coord,char,unsigned short);
/* draw big (or little) brackets or parentheses */
void draw_sqrt(coord,coord,coord,coord,int);
unsigned short atom_width(unsigned short,short);
unsigned short atom_height(unsigned short,short);
unsigned short functor_width(unsigned short,short);
long measure_text_width(char *x, short pointsize); // this is interface-dependent
coord product_spacing(term,term);
int text_style(unsigned);
#define TALL(f) ( f=='k' || f=='f' || f=='b' || f=='d' || f=='h' || f=='l' || f=='t')
/*_____________________________________________________________*/
#define BB_OBJECT(u) (FUNCTOR(u)==0 && ARITY(u)==3 )
/* bblocked_object */
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists