Sindbad~EG File Manager

Current Path : /usr/home/beeson/Otter-Lambda/yyy/
Upload File :
Current File : /usr/home/beeson/Otter-Lambda/yyy/display1.h

/* 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.  */

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 � in DOS */
#define SUPERSCRIPTITALIC 5  /* used to print � 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 13   /* height of eightpoint type in coord units */

/*_______________________________________________________________*/
#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
           /* on the IBM only brackets and bars can be displayed, not
              braces and parens, except of course parens one row high */

/*_______________________________________________________________*/
/* if you change this definition, change MAXWIDTH and MAXHEIGHT below too. */
/*  sizeof(block) must be <= sizeof(term), which in Win16 is 10 bytes */

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 */

/*___________________________________________________________________*/
/* global variables defined in display.c */
/* In the Windows version, these variables belong to display.dll
   and are not accessible in Mathpert proper.  */

extern coord parenspace ; /* space after open paren and before close paren */
extern coord parenwidth;  /* space occupied by parenthesis */
extern coord charspace ;   /* space occupied by one 'en' space */
                           /* This should not be changed, as the
                              whole system of allocating bits in a
                             'block' depends on this value */
extern coord eightpointheight;  /* height of eightpoint type in coord units */
extern coord sumspace;
    /* space between summands and '+' as in a-b+c */
extern coord minusspace;  /* space following minus sign before the arg */
extern coord productspace;  /* space between factors */
extern coord prefixspace;   /* space between sin and x in 'sin x' */
extern coord subscriptspace;  /* subscripts stick out this much */
extern coord dotspace;   /* space required by multiplication dot */
extern coord powerspace; /*horizontal space between base and exponent */
extern coord abovefractionspace, belowfractionspace;
extern coord belowrootbar;  /* space below root bar above argument */
extern coord undersqrtshift,rootspace,indexspace;
extern int precision;
extern int separator;
extern int bigparens;
extern int font;
extern coord linebreakspace;   /* defined in break.c */
extern coord startcol,breakcol,lastcol,tab;
extern coord matrixspace;
extern coord upperlimx, upperlimy, lowerlimx , lowerlimy;


MEXPORT_SYMSOUT 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
/* private functions, called in bblock2 but declared in bblock: */

MEXPORT_SYMSOUT 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_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_constant_of_integration(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);

coord product_spacing(term,term);
int text_style(unsigned);
coord sign_offset(void);
#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