diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/umddvi/h |
Initial commit
Diffstat (limited to 'dviware/umddvi/h')
-rw-r--r-- | dviware/umddvi/h/arith.h | 56 | ||||
-rw-r--r-- | dviware/umddvi/h/binding.h | 194 | ||||
-rw-r--r-- | dviware/umddvi/h/box.h | 395 | ||||
-rw-r--r-- | dviware/umddvi/h/conv.h | 82 | ||||
-rw-r--r-- | dviware/umddvi/h/dmddev.h | 19 | ||||
-rw-r--r-- | dviware/umddvi/h/dvi.h | 33 | ||||
-rw-r--r-- | dviware/umddvi/h/dviclass.h | 70 | ||||
-rw-r--r-- | dviware/umddvi/h/dvicodes.h | 72 | ||||
-rw-r--r-- | dviware/umddvi/h/error.h | 28 | ||||
-rw-r--r-- | dviware/umddvi/h/fio.h | 48 | ||||
-rw-r--r-- | dviware/umddvi/h/font.h | 223 | ||||
-rw-r--r-- | dviware/umddvi/h/gfclass.h | 57 | ||||
-rw-r--r-- | dviware/umddvi/h/gfcodes.h | 43 | ||||
-rw-r--r-- | dviware/umddvi/h/imagen.h | 24 | ||||
-rw-r--r-- | dviware/umddvi/h/impcodes.h | 41 | ||||
-rw-r--r-- | dviware/umddvi/h/io.h | 84 | ||||
-rw-r--r-- | dviware/umddvi/h/num.h | 38 | ||||
-rw-r--r-- | dviware/umddvi/h/postamble.h | 45 | ||||
-rw-r--r-- | dviware/umddvi/h/readme | 1 | ||||
-rw-r--r-- | dviware/umddvi/h/search.h | 31 | ||||
-rw-r--r-- | dviware/umddvi/h/str.h | 34 | ||||
-rw-r--r-- | dviware/umddvi/h/tfm.h | 83 | ||||
-rw-r--r-- | dviware/umddvi/h/types.h | 43 | ||||
-rw-r--r-- | dviware/umddvi/h/verser.h | 68 |
24 files changed, 1812 insertions, 0 deletions
diff --git a/dviware/umddvi/h/arith.h b/dviware/umddvi/h/arith.h new file mode 100644 index 0000000000..bcb8267342 --- /dev/null +++ b/dviware/umddvi/h/arith.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Arithmetic with scaled dimensions + * + * From `TEX.WEB' by D. E. Knuth: + * + * `The principal computations performed by TeX are done entirely in terms + * of integers less than 2^31 in magnitude; and divisions are done only when + * both divident and divisor are nonnegative. Thus, the arithemtic specified + * in this program can be carried out in exactly the same way on a wide + * variety of computers, including some small ones. Why? Because the + * arithmetic calculations need to be spelled out precisely in order to + * guarantee that TeX will produce identical output on different machines. + * If some quantities were rounded differently in different implementations, + * we would find that line breaks and even page breaks might occur in + * different places. Hence the arithmetic of TeX has been designed with + * care, and systems that claim be be implementations of TeX82 should follow + * precisely the calculations as they appear in the present program.' + * + * Thus, this follows the given implementation with few (no) optimizations. + */ + +/* + * We do fixed-point arithmetic on `scaled integers'. These should + * be (at least) 32 bits. Note also that it is assumed that certain + * `int' values may be stored in these (usually small, or else one + * of the magic 1<<n values). + */ +typedef i32 scaled; + +#define UNITY (1<<16) /* 2^{16}, or 1.00000 */ +#define TWO (1<<17) /* 2^{17}, or 2.00000 */ +#define MAXSCALED ((1<<30)-1) /* maximum scaled value, 2^{30}-1 */ + +/* + * This works on two's complement machines. If you are not on one of those, + * you will need something different here. + */ +#define odd(n) ((n) & 1) + +/* half of an integer, unambiguous with respect to signed odd numbers */ +#define half(x) (odd (x) ? ((x) + 1) / 2 : (x) / 2) + +int ArithError; /* set true whenever an arithmetic overflow + occurs */ + +char *UnScale (); /* return a pointer to the external + representation of a `scaled'. + (Alas, since I am returning it in + static storage, you can only use + it once without copying.) */ diff --git a/dviware/umddvi/h/binding.h b/dviware/umddvi/h/binding.h new file mode 100644 index 0000000000..330ff2c170 --- /dev/null +++ b/dviware/umddvi/h/binding.h @@ -0,0 +1,194 @@ +/* C-TeX function and variable bindings */ + +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +#ifdef StringSizeof +/* + * If StringSizeof is defined, we assume that (sizeof "string_const") is + * equal to (strlen("string_const") + 1); see the DefXXX macros below. + */ +#endif + +/* + * Here are the various flags that can be in the b_flags field of a struct + * BoundName. + */ +#define BIsSpecial 1 /* a special int or dimen, or a font; + assignments to these are always + global */ +#define BIsOuter 2 /* \outer, may not appear in macro def'n */ +#define BIsLong 4 /* \long, may contain \outer s anyway */ +#define BIsUndef 8 /* not defined anymore - used when a def'n + local to a group is destroyed by exiting + the group */ + +/* + * SPECIAL + * 1. Integers: + * \spacefactor \prevgraf \deadcycles \insertpenalties + * 2. Dimens: + * \prevdepth \pagegoal \pagetotal \pagestretch \pagefilstretch + * \pagefillstretch \pagefilllstretch \pageshrink \pagedepth + */ + +enum BindingKind { + ProcBound, VarBound, IntBound, DimenBound, CodeBound, + FontBound +}; + +union BindUnion { + int (*b_proc)(); /* iff ProcBound */ + struct node *b_var; /* iff VarBound */ + i32 *b_int; /* iff IntBound */ + scaled *b_dimen; /* iff DimenBound */ + i32 b_code; /* iff CodeBound */ + struct FontInfo *b_font; /* iff FontBound */ +}; + +/* + * The basic entity of C-TeX is the `BoundName'. It is either a wired-in + * procedure (e.g. \let, \def, \vskip) or variable (\hsize, \parskip), or a + * user-defined macro/variable/whatnot. These are indistinguishable from + * one another (except that only wired procedures are ProcBound). + * + * There are also `CodeBound' things, which have no b_name and no b_flags. + * In fact, they are really BoundNameCodes, but they need similar treatment, + * so they get a similar structure. + */ +struct BoundName { + enum BindingKind b_binding; /* the kind of thing it is */ + union BindUnion b_bound; /* the current binding */ + struct SavedVal *b_AfterGroupRst; + /* The saved value for restoration + after the current group. This + is a pointer into the current + AfterGroupRst list. */ + struct string b_name; /* the name of this thing */ + int b_flags; /* various flags */ +}; + +/* + * \catcodes, \lccodes, etc are CodeBound, and are really arrays of these: + */ +struct BoundNameCode { + enum BindingKind b_binding; + union BindUnion b_bound; + struct SavedVal *b_AfterGroupRst; +}; + +/* + * Saved values (changes that are local to a group) are stored in a doubly + * linked list; this is so that constructs like + * {\advance\count0 by1 \global\advance\count0 by1} + * can easily delete restorations that are no longer needed (having been + * overridden by a \global operation). In other words, we never have + * any `save stack buildup'. This requires the `spaghetti' below: a + * current group level (so if b_AfterGroupRst is set, we can tell whether + * the saved val is for this level) and moreover any inner saves for this + * BoundName. + * + * To illustrate what is going on, suppose that we have count1==0. Now we + * begin group number 1, then 2. Now we set count1 to 5, and since it has + * no AfterGroupRst we save the 0 at level 2. Now we increment count1, and + * since it has an AfterGroupRst, we check the level. It is 2; everything + * is fine, and count1 is set to 6. Now we begin group 3, and again increment + * count1. The level is 2, so we make a new SavedVal and set its level to + * 3. (We now have count1==7, save==6 when exiting level 3, save==0 when + * exiting 2.) Now the user does a \global\count1=42, so alas!, all those + * saved values are useless. To get rid of them, we delete the current + * SavedVal, and its inner, and its inner's inner, and so forth, then clear + * the AfterGroupRst pointer. Voila! A global \count1, set to 42. + * + * Note that we save CodeBound changes here too. Since CodeBound objects + * have no flags, some care is needed during restoration. + */ +struct SavedVal { + int sv_level; /* the level to which this belongs */ + struct SavedVal *sv_next; /* linked list */ + struct SavedVal *sv_prev; /* or more precisely, queue */ + struct SavedVal *sv_inner; /* the inner saved value (from the + previous group that saved this) */ + union BindUnion sv_val; /* the saved value (note that saved + values are always the same type + as current values---i.e., types + are fixed) */ + struct BoundName *sv_b; /* the BoundName to which it belongs */ + int sv_flags; /* the saved b_flags (if applicable) */ +}; + +struct BoundName **NewNames; /* during initialization, each internal + BoundName is stashed in the table to + which this points */ + +int CurrentGroup; /* the group level number of the current + group; incremented for { and decremented + for }, etc */ + +struct SavedVal *AfterGroupRst;/* the current list for restoring locally + modified BoundNames */ + +/* + * The following hackery will make the compiler complain in the event + * of a dropped semicolon, without making lint complain. + */ +#ifdef lint +#define do_nothing (void) rand() +#else +#define do_nothing 0 +#endif + +/* + * Save a binding. + */ +#define SaveB(b) \ + if ((b)->b_AfterGroupRst == NULL || \ + (b)->b_AfterGroupRst->sv_level != CurrentGroup) \ + DoSave(b); \ + else \ + do_nothing + +/* + * Undo a save. + */ +#define UnSaveB(b) \ + if ((b)->b_AfterGroupRst) \ + DoUnsave(b); \ + else \ + do_nothing + +#ifdef StringSizeof +#define InitStrAndLen(str,cstr) (str.s_len = sizeof cstr-1, str.s_str = cstr) +#else +#define InitStrAndLen(str,cstr) (str.s_len = strlen(str.s_str = cstr)) +#endif + +#define SetBFlags(f) NewNames[-1].b_flags |= (f) + +#define DefIntVar(addr, name) { \ + static struct BoundName _b; \ + InitStrAndLen(_b.b_name, name); \ + _b.b_binding = IntBound; \ + _b.b_bound.b_int = addr; \ + *NewNames++ = &_b; \ +} + +#define DefDimenVar(addr, name) { \ + static struct BoundName _b; \ + InitStrAndLen(_b.b_name, name); \ + _b.b_binding = DimenBound; \ + _b.b_bound.b_dimen = addr; \ + *NewNames++ = &_b; \ +} + +#define DefProc(name, proc, flags) { \ + static struct BoundName _b; \ + InitStrAndLen(_b.b_name, name); \ + _b.b_binding = ProcBound; \ + _b.b_bound.b_proc = proc; \ + _b.b_bound.b_flags = flags; \ + *NewNames++ = &_b; \ +} diff --git a/dviware/umddvi/h/box.h b/dviware/umddvi/h/box.h new file mode 100644 index 0000000000..05314900ac --- /dev/null +++ b/dviware/umddvi/h/box.h @@ -0,0 +1,395 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* Box structures */ + +/* Magic constants. Note that these are stored into `scaled' types. */ +#define RunningRule (-(1 << 30)) +#define MFracDefaultThickness (1 << 31) /* => default rule thickness */ + +/* Magic penalty values */ +#define InfPenalty 10000 /* infinity---no break at all */ +#define EjectPenalty (-10000) /* negative infinity---forced break */ + +/* Ordinary list types */ +#define CharNode 0 /* character; also math char */ +#define HListNode 1 /* a horizontal list */ +#define VListNode 2 /* a vertical list */ +#define RuleNode 3 /* a rule */ +#define InsertNode 4 /* an insertion */ +#define MarkNode 5 /* a mark */ +#define AdjustNode 6 /* a \vadjust */ +#define LigatureNode 7 /* a ligature */ +#define DiscretionaryNode 8 /* a discretionary break */ +#define WhatsitNode 9 /* a "whatsit" */ +#define BeginMathNode 10 /* a begin-math */ +#define EndMathNode 11 /* an end-math */ +#define GlueNode 12 /* link to glue */ +#define KernNode 13 /* kerning */ +#define PenaltyNode 14 /* penalty */ +#define UnsetAlignNode 15 /* \halign or \valign that is incomplete */ + +/* Types arising only in math lists */ +#define MathAtom 16 /* math atom */ +#define MathStyle 17 /* math style change */ +#define MathFraction 18 /* math fraction */ +#define MathLeft 19 /* math left delimiter \left */ +#define MathRight 20 /* math right delimiter \right */ +#define MathChoice 21 /* math 4-way choice */ +#define MathSubList 22 /* math list, possibly empty */ +#define MathSubBox 23 /* math box (\hlist or \vlist) */ + +/* Kinds of math atoms */ +enum MKind { + MKindOrd, MKindOp, MKindOpLimits, MKindOpNoLimits, MKindBin, MKindRel, + MKindOpen, MKindClose, MKindPunct, MKindInner, MKindOver, MKindUnder, + MKindAcc, MKindRad, MKindVCent +}; + +/* Math text styles */ +#define MStyleCramped 1 /* added to others to get cramped style */ +#define MStyleDisplay 0 /* display style */ +#define MStyleText 2 /* text style */ +#define MStyleScript 4 /* script style */ +#define MStyleSScript 6 /* scriptscript style */ + +/* + * A font and character. Note that these limit the number of fonts and + * characters/font to 256. + */ +struct fontchar { + char fc_font; /* font index */ + char fc_char; /* character index within the font */ +}; + +/* a box */ +struct box { + scaled bx_width; /* width of the box */ + scaled bx_depth; /* depth of the box */ + scaled bx_height; /* height of the box */ + scaled bx_offset; /* offset (lower if h, right if v) */ + struct node *bx_contents; /* contents of the box */ + int bx_glueorder; /* -3=>minus hfilll; 3=>plus hfilll */ + float bx_glueset; /* glue setting ratio */ +}; + +/* a rule */ +struct rule { + scaled ru_width; /* width of the rule */ + scaled ru_depth; /* depth of the rule */ + scaled ru_height; /* height of the rule */ +}; + +/* an insert */ +struct insert { + int ins_number; /* 0..254 (I hope) */ + i32 ins_floatingpenalty; /* \floatingpenalty for this insert */ + scaled ins_naturalheightplusdepth; /* what more can I say? */ + scaled ins_splitmaxdepth; /* \splitmaxdepth for this insert */ + struct node *ins_splittopskip; /* \splittopskip for this insert */ + struct node *ins_contents; /* insertion contents */ +}; + +/* a ligature */ +struct ligature { + struct fontchar lig_fc; /* the ligature character */ + struct node *lig_orig; /* the original set of characters */ +}; + +/* a discretionary break */ +struct discret { + struct node *disc_prebrk; /* characters to precede break */ + struct node *disc_postbrk; /* characters to follow break */ + int disc_replaces; /* replaces this many nodes */ +}; + +/* a whatsit */ +struct whatsit { + int wh_type; /* type of whatsit */ + char *wh_other; /* other stuff */ +}; + +/* + * A glue specification. There may be multiple pointers to this glue spec, + * so we have a reference count attached. + */ +struct gluespec { + int gl_refcount; /* # pointers to here */ + scaled gl_width; /* normal width */ + scaled gl_stretch; /* strechability */ + scaled gl_shrink; /* shrinkability */ + short gl_stretchorder; /* 0..3 for <>, fil, fill, filll */ + short gl_shrinkorder; /* same */ +}; + +/* a link-to-glue node */ +#define GlueIsNormal 0 /* ordinary glue */ +#define GlueIsSkip 1 /* \hskip or \vskip */ +#define GlueIsNonScript 2 /* \nonscript */ +#define GlueIsMuGlue 3 /* mu glue */ +#define GlueIsALeaders 4 /* aligned leaders */ +#define GlueIsCLeaders 5 /* centered leaders */ +#define GlueIsXLeaders 6 /* expanded leaders */ +struct gluenode { + int gn_type; /* special glue types */ + struct node *gn_glue; /* the glue itself */ + struct BoundName *gn_skip; /* skip parameter that generated it */ + struct box *gn_leaderbox; /* leader box if leaders */ +}; + +/* a kern */ +#define ImplicitKern 0 /* kerning for things like "AV" */ +#define ExplicitKern 1 /* \kern or italic correction */ +#define MKern 2 /* \mkern */ +struct kern { + int kern_type; /* type of kern */ + scaled kern_width; /* width of kern */ +}; + +/* + * An unset (incomplete) alignment (\halign or \valign). + * This looks to be the largest node type, so I am using 'char' and 'short' + * to try to keep it small... + */ +struct unsetalign { + scaled unset_width; /* width of the unset box */ + scaled unset_depth; /* depth of the unset box */ + scaled unset_height; /* height of the unset box */ + struct node *unset_contents; /* contents of the unset box */ + scaled unset_glueshrink; /* total glue shrink */ + scaled unset_gluestretch; /* total glue stretch */ + char unset_shrinkorder; /* glue shrink order */ + char unset_stretchorder; /* glue stretch order */ + short unset_spancount; /* the number of spanned columns */ +}; + +/* a token list */ +struct toklist { + int tok_refcount; /* the number of references */ + struct node *tok_list; /* the tokens or the macro def'n */ +}; + +/* Math delimiter */ +struct delim { + char smallfam; /* family number for small char */ + char smallchar; /* character in small family */ + char largefam; /* family number for large char */ + char largechar; /* character in large family */ +}; + +/* Math atoms, radicals, \left s, \right s, accents */ +struct matom { + enum MKind kind; /* atom kind (if not \left, \right) */ + struct node *nucleus; /* nucleus */ + struct node *supscr; /* superscript (optional) */ + struct node *subscr; /* subscript (optional) */ + struct delim delimiter; /* delimiter(s) (optional) */ + /* accents are stored in the small delim */ +}; + +/* Math fraction */ +struct mfrac { + struct node *numerator; /* numerator */ + struct node *denominator; /* denominator */ + scaled thickness; /* dividing rule thickness */ + struct delim leftdelim; /* left delimiter (optional) */ + struct delim rightdelim; /* right delimiter (optional) */ +}; + +/* Math choice */ +struct mchoice { + struct node *ifdisplay; + struct node *iftext; + struct node *ifscript; + struct node *ifsscript; +}; + +/* + * This structure exists mainly for `sizeof'. Character nodes are by far the + * most common nodes, so to save memory space, nodes of type CharNode are kept + * in a separate free list and do not get a full size node. This means that + * node lists must be handled carefully, but that is already necessary, so it + * is no loss. + */ +struct charnode { + struct node *next; + short type; + struct fontchar fc; +}; + +/* + * A node in a list. Note that the first part of this structure is shared + * with the struct charnode. + */ +struct node { + struct node *next; /* next in linked list */ + short type; /* type of this node */ + struct fontchar fc; /* value iff char */ + union { + struct box un_box; /* value iff box */ + struct rule un_rule; /* value iff rule */ + struct insert un_ins; /* value iff insert */ + struct toklist *un_mark; /* value iff mark */ + struct ligature un_lig; /* value iff ligature */ + struct discret un_disc; /* value iff discret. brk */ + struct whatsit un_whatsit; /* value iff whatsit */ + struct gluespec un_gluespec; /* value iff glue */ + struct gluenode un_gluenode; /* value iff link to glue */ + struct kern un_kern; /* value iff kern */ + i32 un_integer; /* value if integer */ + struct unsetalign un_unset; /* value iff unset alignment */ + struct matom un_matom; /* value if math atom */ + struct mfrac un_mfrac; /* value iff math fraction */ + struct mchoice un_mchoice; /* value iff math choice */ + struct node *un_node; /* value if node list */ + } node_un; +}; + +/* Shorthand */ +#define FC fc +#define Font fc.fc_font +#define Char fc.fc_char + +#define BoxWidth node_un.un_box.bx_width +#define BoxDepth node_un.un_box.bx_depth +#define BoxHeight node_un.un_box.bx_height +#define BoxOffset node_un.un_box.bx_offset +#define BoxContents node_un.un_box.bx_contents +#define BoxGlueOrder node_un.un_box.bx_glueorder +#define BoxGlueSet node_un.un_box.bx_glueset + +#define RuleWidth node_un.un_rule.ru_width +#define RuleDepth node_un.un_rule.ru_depth +#define RuleHeight node_un.un_rule.ru_height + +#define InsertNumber node_un.un_ins.ins_number +#define InsertFloatingPenalty node_un.un_ins.ins_floatingpenalty +#define InsertNaturalHeightPlusDepth node_un.un_ins.ins_naturalheightplusdepth +#define InsertSplitMaxDepth node_un.un_ins.ins_splitmaxdepth +#define InsertSplitTopSkip node_un.un_ins.ins_splittopskip +#define InsertContents node_un.un_ins.ins_contents + +#define Mark node_un.un_mark + +#define LigatureFC node_un.un_lig.lig_fc +#define LigatureOrig node_un.un_lig.lig_orig + +#define DiscretPreBreak node_un.un_disc.disc_prebrk +#define DiscretPostBreak node_un.un_disc.disc_postbrk +#define DiscretReplaces node_un.un_disc.disc_replaces + +#define WhatsitType node_un.un_whatsit.wh_type +#define WhatsitOther node_un.un_whatsit.wh_other + +#define GlueRefCount node_un.un_gluespec.gl_refcount +#define GlueWidth node_un.un_gluespec.gl_width +#define GlueStretch node_un.un_gluespec.gl_stretch +#define GlueShrink node_un.un_gluespec.gl_shrink +#define GlueStretchOrder node_un.un_gluespec.gl_stretchorder +#define GlueShrinkOrder node_un.un_gluespec.gl_shrinkorder + +#define Glue node_un.un_gluenode.gn_glue +#define GlueSkip node_un.un_gluenode.gn_skip +#define GlueType node_un.un_gluenode.gn_type +#define GlueLeaderBox node_un.un_gluenode.gn_leaderbox + +#define KernWidth node_un.un_kern.kern_width +#define KernType node_un.un_kern.kern_type + +#define Penalty node_un.un_integer + +#define UnsetWidth node_un.un_unset.unset_width +#define UnsetDepth node_un.un_unset.unset_depth +#define UnsetHeight node_un.un_unset.unset_height +#define UnsetContents node_un.un_unset.unset_contents +#define UnsetGlueShrink node_un.un_unset.unset_glueshrink +#define UnsetGlueStretch node_un.un_unset.unset_gluestretch +#define UnsetShrinkOrder node_un.un_unset.unset_shrinkorder +#define UnsetStretchOrder node_un.un_unset.unset_stretchorder +#define UnsetSpanCount node_un.un_unset.unset_spancount + +#define MAtomKind node_un.un_matom.kind +#define MAtomNucleus node_un.un_matom.nucleus +#define MAtomSupscr node_un.un_matom.supscr +#define MAtomSubscr node_un.un_matom.subscr +#define MAtomDelimiter node_un.un_matom.delimiter +#define MAtomAccFam node_un.un_matom.delimiter.smallfam +#define MAtomAccChar node_un.un_matom.delimiter.smallchar + +#define MFracNumerator node_un.un_mfrac.numerator +#define MFracDenominator node_un.un_mfrac.denominator +#define MFracThickness node_un.un_mfrac.thickness +#define MFracLeftDelim node_un.un_mfrac.leftdelim +#define MFracRightDelim node_un.un_mfrac.rightdelim + +#define MChoiceDisplay node_un.un_mchoice.ifdisplay +#define MChoiceText node_un.un_mchoice.iftext +#define MChoiceScript node_un.un_mchoice.ifscript +#define MChoiceSScript node_un.un_mchoice.ifsscript + +#define MStyle node_un.un_integer + +#define MSub node_un.un_node + +struct node *FreeNodes; +struct node *FreeChars; + +struct node *MoreNodes(); +struct node *MoreChars(); + +/* + * These macros quickly allocate and dispose of nodes. Watch out; the + * arguments to NewNode and NewCharNode should be pointers that are to + * be filled in. Moreover, the argument is accessed twice, so beware + * side effects! + */ +#define NewNode(n) \ + if (((n) = FreeNodes) == NULL) \ + (n) = MoreNodes(); \ + else \ + FreeNodes = (n)->next + +#define NewCharNode(n) \ + if (((n) = FreeChars) == NULL) \ + (n) = MoreChars(); \ + else \ + FreeChars = (n)->next + +#define FreeNode(n) ((n)->next = FreeNodes, FreeNodes = (n)) +#define FreeChar(n) ((n)->next = FreeChars, FreeChars = (n)) + +/* To free either a CharNode or a Node, use FreeEither! */ +#define FreeEither(n) ((n)->type ? FreeNode(n) : FreeChar(n)) + +#define DelTokRef(p) (--(p)->tok_refcount < 0 ? FlushList(p) : NULL) +#define DelGlueRef(p) (--(p)->GlueRefCount < 0 ? FreeNode(p) : NULL) + +/* These determine the granularity of node allocation */ +#define NodeAllocSize 300 /* Nodes per MoreNodes() */ +#define CharAllocSize 2500 /* CharNodes per MoreChars() */ + +struct node *CopyGlueSpec(); +struct node *LinkToSkipParam(); +struct node *LinkToGlueSpec(); +struct node *LinkToCopyOfSkipParam(); + +#define NodeListDisplay(p) (s_addc('.'), ShowNodeList(p), s_delc()) + +/* + * The ordering of the types is important here, because it allows simple + * decisions for common operations. + */ +#define CanBreakAtGlue(n) ((n)->type < BeginMathNode) +#define CanDiscardAfterBreak(n) ((n)->type >= BeginMathNode) + +struct node ZeroGlue; /* the zero-amount glue (0pt) */ +struct node FilGlue; /* 0pt plus1fil minus0pt */ +struct node FillGlue; /* 0pt plus1fill minus0pt */ +struct node SSGlue; /* 0pt plus1fil minus1fil */ +struct node FilNegGlue; /* 0pt plus-1fil minus0pt */ +i32 ShowBoxMaxDepth; /* max nesting depth in box displays */ +i32 ShowBoxMaxBreadth; /* max number of items per list level */ +int FontInShortDisplay; /* the "current font" during a ShortDisplay */ diff --git a/dviware/umddvi/h/conv.h b/dviware/umddvi/h/conv.h new file mode 100644 index 0000000000..0f10cf8536 --- /dev/null +++ b/dviware/umddvi/h/conv.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Conversions. Conversion factors convert between values in scaled + * points and values in device-dependenent units. The results of all + * conversions are rounded to the nearest integral value, of type (i32). + */ + +/* + * This is now done using `double' values, but may be changed to + * fixed-point or some other `fast' method, as long as the results + * are consistent and reasonably accurate. The structure `conversion' + * holds the conversion-method-dependent quantities; the macros + * fromSP and toSP apply the conversion to a value. (Note that + * fromSP and toSP need not be macros, but should be fast.) + * + * SetConversion sets the (single, global) conversion factor. + * If a driver needs special conversions, there is another routine, + * CSetConversion that sets a specific conversion, and cfromSP and + * ctoSP to apply these. + * + * IS USING DOTS PER INCH SUFFICIENT? (Pixels per point might be better.) + * + * Note that it is necessary to set the global conversion factor before + * using any fonts. + */ +struct conversion { + double c_fromsp; /* multiplier to convert from scaled points */ + double c_tosp; /* multiplier to convert to scaled points: + could divide by c_fromsp, but this should + be faster and more accurate */ + double c_mag; /* the magnification this conversion + represents; mainly for GetFont() */ + double c_dpi; /* dpi (should be pixels per point?) */ +} Conversion; + +/* + * In order to do this, we need to round properly. The compilers I + * have tend to generate very poor code for this. The following is + * intended to help them out. Smarter compilers can do better, but + * if they are smart enough, they will realise that the variables + * here are not used anywhere else, and discard them. (For a compiler + * to do this given separate compliation, `static' is a must.) + */ +#ifdef lint /* or a smart compiler */ +#define ROUND(f) ((i32) ((f) < 0.0 ? (f) - 0.5 : (f) + 0.5)) +#define CEIL(f) ((double) (i32) (f) < (f) ? (i32) (f) + 1 : (i32) (f)) +#else +static double _half = 0.5; +static double _zero = 0.0; +static double _d; +#define ROUND(f) ((i32) (_d = (f), _d < _zero ? _d - _half : _d + _half)) +#ifdef NEGATIVE_FLOAT_ROUNDS_TO_NEGATIVE_INFINITY +#define CEIL(f) (-(i32) -(f)) +#else /* we will assume that floating to integer truncates */ +static i32 _i; +#define CEIL(f) (_i = _d = (f), _i < _d ? _i + 1 : _i) +#endif /* round towards negative infinity */ +#endif /* lint */ + +#define SetConversion(dpi, usermag, num, denom, dvimag) \ + CSetConversion(&Conversion, dpi, usermag, num, denom, dvimag) + +#define cfromSP(c, v) ROUND((c)->c_fromsp * (v)) +#define ctoSP(c, v) ROUND((c)->c_tosp * (v)) + +#define fromSP(v) cfromSP(&Conversion, v) +#define toSP(v) ctoSP(&Conversion, v) + +/* + * Conversions for rules are a bit different: we must round up, rather + * than off. ConvRule applies the global conversion value for a rule + * value (height or width); CConvRule applies a specific conversion. + */ +#define CConvRule(c, v) CEIL((c)->c_fromsp * (v)) +#define ConvRule(v) CConvRule(&Conversion, v) + +void CSetConversion(); diff --git a/dviware/umddvi/h/dmddev.h b/dviware/umddvi/h/dmddev.h new file mode 100644 index 0000000000..d536ad8169 --- /dev/null +++ b/dviware/umddvi/h/dmddev.h @@ -0,0 +1,19 @@ +/* dmd globals */ + +/* Accounting: */ +#ifndef ACCOUNT_FILE +/* +#define ACCOUNT_FILE "/usr/adm/imagen_acct"/* if defined, the name of the + imagen page accounting file */ +#endif ACCOUNT_FILE + +#define NFONTS 128 /* Max number of fonts. 128 is a hardware + limitation. */ +#define DefaultDPI 118 /* 300 for Imagen 8/300, 240 for Imprint-10 */ + +#define DefaultMaxDrift 3 /* default value for MaxDrift */ + +/* Default margins, in dots */ +/* CRUFT ALERT: depending on DPI variable */ +#define DefaultTopMargin (0) /* 1" margins */ +#define DefaultLeftMargin (0) diff --git a/dviware/umddvi/h/dvi.h b/dviware/umddvi/h/dvi.h new file mode 100644 index 0000000000..94640b0678 --- /dev/null +++ b/dviware/umddvi/h/dvi.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* DVI file info */ + +/* + * Units of distance are stored in scaled points, but we can convert to + * units of 10^-7 meters by multiplying by the numbers in the preamble. + */ + +/* the structure of the stack used to hold the values (h,v,w,x,y,z) */ +struct dvi_stack { + i32 h; /* the saved h */ + i32 v; /* the saved v */ + i32 w; /* etc */ + i32 x; + i32 y; + i32 z; +}; + +struct dvi_stack dvi_current; /* the current values of h, v, etc */ + +int dvi_f; /* the current font */ + +#define dvi_h dvi_current.h +#define dvi_v dvi_current.v +#define dvi_w dvi_current.w +#define dvi_x dvi_current.x +#define dvi_y dvi_current.y +#define dvi_z dvi_current.z diff --git a/dviware/umddvi/h/dviclass.h b/dviware/umddvi/h/dviclass.h new file mode 100644 index 0000000000..0ffef36b81 --- /dev/null +++ b/dviware/umddvi/h/dviclass.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Macros to convert DVI opcodes to (hopefully) simpler values. + */ + +/* + * Large range types. + */ +#define DVI_IsChar(code) ((code) < 128) +#define DVI_IsFont(code) ((code) >= 171 && (code) < 235) + +/* + * Symbolic names for generic types (for things with parameters). + * These are obtained via the macro DVI_DT(int c), where 0 <= c <= 255. + */ +#define DT_CHAR 0 +#define DT_SET 1 +#define DT_SETRULE 2 +#define DT_PUT 3 +#define DT_PUTRULE 4 +#define DT_NOP 5 +#define DT_BOP 6 +#define DT_EOP 7 +#define DT_PUSH 8 +#define DT_POP 9 +#define DT_RIGHT 10 +#define DT_W0 11 +#define DT_W 12 +#define DT_X0 13 +#define DT_X 14 +#define DT_DOWN 15 +#define DT_Y0 16 +#define DT_Y 17 +#define DT_Z0 18 +#define DT_Z 19 +#define DT_FNTNUM 20 +#define DT_FNT 21 +#define DT_XXX 22 +#define DT_FNTDEF 23 +#define DT_PRE 24 +#define DT_POST 25 +#define DT_POSTPOST 26 +#define DT_UNDEF 27 + +/* + * Symbolic names for parameter lengths, obtained via the macro + * DVL_OpLen(int c). + * + * N.B.: older drivers may assume that 0 => none, 1-4 => 1-4 bytes + * and 5-7 => unsigned version of 1-4---so DO NOT change these values! + */ +#define DPL_NONE 0 +#define DPL_SGN1 1 +#define DPL_SGN2 2 +#define DPL_SGN3 3 +#define DPL_SGN4 4 +#define DPL_UNS1 5 +#define DPL_UNS2 6 +#define DPL_UNS3 7 +/* there are no unsigned four byte parameters */ + +#define DVI_OpLen(code) (dvi_oplen[code]) +#define DVI_DT(code) (dvi_dt[code]) +extern char dvi_oplen[]; +extern char dvi_dt[]; diff --git a/dviware/umddvi/h/dvicodes.h b/dviware/umddvi/h/dvicodes.h new file mode 100644 index 0000000000..de5a80b5a8 --- /dev/null +++ b/dviware/umddvi/h/dvicodes.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* DVI opcodes */ + +#define DVI_VERSION 2 /* version number that should appear in + pre- and post-ambles */ + +#define DVI_SET1 128 /* set character, 1 byte param */ +#define DVI_SET2 129 /* set character, 2 byte param */ +#define DVI_SET3 130 /* set character, 3 byte param */ +#define DVI_SET4 131 /* set character, 4 byte param */ +#define DVI_SETRULE 132 /* set a rule */ +#define DVI_PUT1 133 /* put char, don't move right */ +#define DVI_PUT2 134 /* put char, 2 byte */ +#define DVI_PUT3 135 /* etc */ +#define DVI_PUT4 136 +#define DVI_PUTRULE 137 /* put rule, don't move right */ +#define DVI_NOP 138 /* no-op */ +#define DVI_BOP 139 /* begin page */ +#define DVI_EOP 140 /* end page */ +#define DVI_PUSH 141 /* push h,v,w,x,y,z */ +#define DVI_POP 142 /* pop h,v,w,x,y,z */ +#define DVI_RIGHT1 143 /* move right, 1 byte signed param */ +#define DVI_RIGHT2 144 /* move right, 2 byte signed param */ +#define DVI_RIGHT3 145 /* etc */ +#define DVI_RIGHT4 146 +#define DVI_W0 147 /* h += w */ +#define DVI_W1 148 /* w = 1 byte signed param, h += w */ +#define DVI_W2 149 /* w = 2 byte etc, h += w */ +#define DVI_W3 150 +#define DVI_W4 151 +#define DVI_X0 152 /* like DVI_W0 but for x */ +#define DVI_X1 153 /* etc */ +#define DVI_X2 154 +#define DVI_X3 155 +#define DVI_X4 156 +#define DVI_DOWN1 157 /* v += 1 byte signed param */ +#define DVI_DOWN2 158 /* v += 2 byte signed param */ +#define DVI_DOWN3 159 /* etc */ +#define DVI_DOWN4 160 +#define DVI_Y0 161 /* y = 1 byte signed param, v += y */ +#define DVI_Y1 162 /* etc */ +#define DVI_Y2 163 +#define DVI_Y3 164 +#define DVI_Y4 165 +#define DVI_Z0 166 /* z = 1 byte signed param, v += z */ +#define DVI_Z1 167 /* etc */ +#define DVI_Z2 168 +#define DVI_Z3 169 +#define DVI_Z4 170 +#define DVI_FNTNUM0 171 + +#define DVI_FNT1 235 /* select font, 1 byte param */ +#define DVI_FNT2 236 /* etc */ +#define DVI_FNT3 237 +#define DVI_FNT4 238 +#define DVI_XXX1 239 /* for \special: if length < 256 */ +#define DVI_XXX2 240 /* etc */ +#define DVI_XXX3 241 +#define DVI_XXX4 242 +#define DVI_FNTDEF1 243 /* Define font, 1 byte param (0 to 63) */ +#define DVI_FNTDEF2 244 /* etc */ +#define DVI_FNTDEF3 245 +#define DVI_FNTDEF4 246 +#define DVI_PRE 247 /* preamble */ +#define DVI_POST 248 /* postamble */ +#define DVI_POSTPOST 249 /* end of postamble */ +#define DVI_FILLER 223 /* filler bytes at end of dvi file */ diff --git a/dviware/umddvi/h/error.h b/dviware/umddvi/h/error.h new file mode 100644 index 0000000000..49423042db --- /dev/null +++ b/dviware/umddvi/h/error.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +char *HelpMsg; /* the current help message, if any */ +int UseErrHelp; /* true iff HelpMsg makes sense */ +int ErrHistory; /* the error history */ +int Interaction; /* the interaction level */ +int ErrCount; /* total errors since last paragraph */ +int DeletionsAllowed; /* true iff user is allowed to delete tokens + in the error recovery code */ + +/* values for ErrHistory, in increasing order of severity */ +#define EH_Spotless 0 /* no errors */ +#define EH_Warning 1 /* gave a warning (diagnostic) */ +#define EH_ErrMessage 2 /* gave an error message */ +#define EH_FatalErr 3 /* died on a fatal error */ + +/* values for Interaction */ +#define IA_ErrStop 0 /* stop on error */ +#define IA_ErrScroll 1 /* do not stop on error */ +#define IA_NonStop 2 /* do not ever stop */ +#define IA_Batch 3 /* neither stop nor produce tty output */ + +/* pick an output descriptor; there is no log file right now */ +#define NoLogErrFD() (Interaction == IA_Batch ? OutIgnore : OutTerm) diff --git a/dviware/umddvi/h/fio.h b/dviware/umddvi/h/fio.h new file mode 100644 index 0000000000..46b3851fb3 --- /dev/null +++ b/dviware/umddvi/h/fio.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * File I/O: numbers. + * + * We deal in fixed format numbers and (FILE *)s here. + * For pointer I/O, see pio.h. + * + * N.B.: These do the `wrong thing' at EOF. It is imperative + * that the caller add appropriate `if (feof(fp))' statements. + */ + +/* + * Get one unsigned byte. Note that this is a proper expression. + * The reset have more limited contexts, and are therefore OddLy + * CapItaliseD. + */ +#define fgetbyte(fp) (getc(fp)) + +/* + * Get a two-byte unsigned integer, a three-byte unsigned integer, + * or a four-byte signed integer. + */ +#define fGetWord(fp, r) ((r) = getc(fp) << 8, (r) |= getc(fp)) +#define fGet3Byte(fp,r) ((r) = getc(fp) << 16, (r) |= getc(fp) << 8, \ + (r) |= getc(fp)) +#define fGetLong(fp, r) ((r) = getc(fp) << 24, (r) |= getc(fp) << 16, \ + (r) |= getc(fp) << 8, (r) |= getc(fp)) + +/* + * Fast I/O write (and regular write) macros. + */ +#define putbyte(fp, r) (putc((r), fp)) + +#define PutWord(fp, r) (putc((r) >> 8, fp), putc((r), fp)) +#define Put3Byte(fp, r) (putc((r) >> 16, fp), putc((r) >> 8, fp), \ + putc((r), fp)) +#define PutLong(fp, r) (putc((r) >> 24, fp), putc((r) >> 16, fp), \ + putc((r) >> 8, fp), putc((r), fp)) + +/* + * Function types + */ +i32 GetByte(), GetWord(), Get3Byte(), GetLong(); diff --git a/dviware/umddvi/h/font.h b/dviware/umddvi/h/font.h new file mode 100644 index 0000000000..2f1e7e7da2 --- /dev/null +++ b/dviware/umddvi/h/font.h @@ -0,0 +1,223 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Font file information, readers, etc. + */ + +#ifndef _CTEX_TYPES_ +#include "types.h" +#endif + +/* + * First, font independent information: per glyph info, and per font + * info. + */ +struct glyph { + short g_flags; /* see below */ + /* + * The following cannot be used with GetRasterlessFont + */ + short g_rotation; /* see below */ + char *g_raster; /* raster, if known */ + /* + * These, however, do come with rasterless fonts, + * even though they relate only to the raster. + */ + i32 g_height; /* height of bounding box */ + i32 g_width; /* width of bounding box */ + i32 g_yorigin; /* y origin (>= 0 -> within box) */ + i32 g_xorigin; /* x origin (>= 0 -> within box) */ + /* + * This of course comes with every font. + */ + i32 g_tfmwidth; /* width in scaled points (not FIXes!) */ +#ifdef notyet /* THESE NEED MORE THOUGHT */ + i32 g_xescapement; /* x escapement (`chardx') */ + i32 g_yescapement; /* y escapement (`chardy') */ +#endif + /* + * This is provided purely for DVI to device conversion programs. + */ + int g_pixwidth; /* width in pixels */ + /* + * Mainly for internal use, index is the glyph index within the + * font. That is, f->f_gly[i]->g_index == i. + */ + int g_index; /* character index */ + /* + * g_details and g_integer are purely for the font reading + * subroutines to use however they will. g_next makes lists + * of glyphs while the glyphs are free. + */ + union { /* various options */ + char *g_details; /* details: arbitrary */ + i32 g_integer; /* 32 bit integer */ + struct glyph *g_next; /* linked list */ + } g_un; +}; + +/* + * Glyph flags. + */ +#define GF_VALID 0x0001 /* glyph is `real' */ +#define GF_USR0 0x0100 /* reserved to user code */ +#define GF_USR1 0x0200 /* reserved to user code */ +#define GF_USR2 0x0400 /* reserved to user code */ +#define GF_USR3 0x0800 /* reserved to user code */ + +/* + * Rotations are in quarter-pi steps, counterclockwise of course. + * This order must be maintained; see rotate.c. + */ +#define ROT_NORM 0 /* no rotation: `normal' position */ +#define ROT_LEFT 1 /* 1/4 turn counterclockwise */ +#define ROT_DOWN 2 /* 1/2 turn, i.e., upside-down */ +#define ROT_RIGHT 3 /* 3/4 turn ccw, or 1/4 turn cw */ + +struct font { + int f_flags; /* see below */ + struct fontops *f_ops; /* operations */ + /* + * f_details is provided for font reading subroutines. + * It is intended to be cast to a pointer to a structure + * that is allocated by those routines, and used to keep + * track of whatever information those routines need to + * determine glyph boxes and (if asked for) rasters. + */ + char *f_details; /* type dependent stuff */ + /* + * f_path is the full pathname to the font file, filled in + * by GetFont and GetRasterlessFont. Note that since we + * hold on to the path until the font is freed, it should be + * possible to cache glyph accesses on memory-poor machines. + */ + char *f_path; /* font file pathname */ + /* + * f_dvimag and f_dvidsz are the magnification and design size + * values from the DVI file. f_font and f_scaled correspond to + * TeX's idea of the proper name for the font (e.g., `cmr10', + * `cmbx10 scaled 1440'). (Note that f_scaled is just the + * ratio of f_dvimag and f_dvidsz; you could save a bit of memory + * by eliminating it and altering the routine Font_TeXName()). + * f_checksum should be set by the font reading routines to + * the font checksum. If the value is nonzero, it will be + * compared to the checksum in the DVI file. + */ + i32 f_dvimag; /* magnification from DVI file */ + i32 f_dvidsz; /* design size from DVI file */ + char *f_font; /* TeX's name for the font */ + int f_scaled; /* the ratio of dvimag to dvidsz, x1000 */ + i32 f_checksum; /* font checksum, or 0 */ +#ifdef notyet /* THESE NEED MORE THOUGHT */ + i32 f_hppp; /* horizontal pixels per point */ + i32 f_vppp; /* vertical pixels per point */ +#endif + /* + * f_lowch and f_highch bound the region in which f_gly + * indicies are valid. Specificially, f_gly[i] may be + * read or written if and only if i is in the half-open + * interval [f_lowch..f_highch). f_gly is an array of + * pointers to glyph structures. The structures themselves + * are not allocated until requested. + * + * f_glybase is the actual return from malloc(), since it + * is theoretically possible for f_gly-f_lowch to become + * NULL. + */ + int f_lowch; /* first character */ + int f_highch; /* last character, plus 1 */ + struct glyph **f_gly; /* glyphs */ + struct glyph **f_glybase; +}; + +/* + * Font flags. + */ +#define FF_RASTERS 0x0001 /* font has rasters */ +#define FF_USR0 0x0100 /* reserved to user code */ +#define FF_USR1 0x0200 /* reserved to user code */ +#define FF_USR2 0x0400 /* reserved to user code */ +#define FF_USR3 0x0800 /* reserved to user code */ + +/* + * Operations on fonts. + * + * The `fo_dpitomag' field is used as a multiplier for a desired + * resolution in dots per inch. The result of the multiplication + * is converted to a font name by multipying by 1000.0 and rounding. + * The idea is that PXL files will have a multiplier of 5.0, and + * others will have a multiplier of 1.0. This suffices for the + * present, at any rate; in the future, this field may be replaced + * with something more general. + * + * N.B.: more operations may be added as they are discovered to be + * useful. + */ +struct fontops { + char *fo_name; /* name, e.g., "gf" */ + double fo_dpitomag; /* multiplier */ + int (*fo_read)(); /* open and read the font itself */ + int (*fo_getgly)(); /* obtain specified glyphs (range) */ +#ifdef notdef + int (*fo_freegly)(); /* release specified glyphs */ +#endif + int (*fo_rasterise)(); /* rasterise specified glyphs */ + int (*fo_freefont)(); /* discard font (free details) */ + struct fontops *fo_next; /* purely for font.c */ +}; + +/* + * Return a pointer to the glyph information for character `c' in + * font `f'. + */ +#define GLYPH(f, c) \ + ((c) < (f)->f_lowch || (c) >= (f)->f_highch ? (struct glyph *) 0 : \ + ((f)->f_gly[c] ? (f)->f_gly[c] : GetGlyph(f, c))) + +/* + * True iff glyph `g' is valid. Useful for checking return values + * from GLYPH(). + */ +#define GVALID(g) ((g) && ((g)->g_flags & GF_VALID)) + +/* + * True iff glyph g has a raster. + */ +#define HASRASTER(g) ((g)->g_height || (g)->g_width) + +/* + * Return a pointer to the raster information for glyph `g' in font + * `f' at rotation `r'. + */ +#define RASTER(g, f, r) ((g)->g_rotation == (r) && (g)->g_raster ? \ + (g)->g_raster : GetRaster(g, f, r)) + +/* + * Function types. + */ +struct font *GetFont(), *GetRasterlessFont(); +struct glyph *GetGlyph(); +char *GetRaster(); +void FreeFont(); +void FreeGlyph(); +void FreeRaster(); +char *Font_TeXName(); +double DMagFactor(); /* from magfactor.c */ + +/* + * Normally from stdio.h + */ +#ifndef NULL +#define NULL 0 +#endif + +/* + * The following environment variable overrides the default font + * configuration file. That default is used when fontinit() is not + * called, or is passed a null pointer. + */ +#define CONFENV "TEXFONTDESC" diff --git a/dviware/umddvi/h/gfclass.h b/dviware/umddvi/h/gfclass.h new file mode 100644 index 0000000000..cd392ac2bb --- /dev/null +++ b/dviware/umddvi/h/gfclass.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * GF classification codes + */ + +/* + * Predicate for simple paint commands. This is presumably the most + * common GF operation; it may be profitable to check for this before + * switching out on the command type. + */ +#define GF_IsPaint(c) ((c) < 64) + +/* + * Symbolic names for command `types', as returned by the macro + * GT_TYPE(int c). + */ +#define GT_PAINT0 0 /* paint without parameter */ +#define GT_PAINT 1 /* paint with parameter */ +#define GT_BOC 2 /* long BOC */ +#define GT_BOC1 3 /* short BOC */ +#define GT_EOC 4 /* EOC */ +#define GT_SKIP0 5 /* parameterless SKIP */ +#define GT_SKIP 6 /* parmeterised SKIP */ +#define GT_NEW_ROW 7 /* NEW_ROW_n */ +#define GT_XXX 8 /* XXXn */ +#define GT_YYY 9 /* YYY */ +#define GT_NOP 10 /* no op */ +#define GT_CHAR_LOC 11 /* CHAR_LOC */ +#define GT_CHAR_LOC0 12 /* abbreviated CHAR_LOC */ +#define GT_PRE 13 +#define GT_POST 14 +#define GT_POSTPOST 15 +#define GT_UNDEF 16 + +/* + * Symbolic names for parameter lengths, obtained via the macro + * GT_OpLen(int c). + */ +#define GPL_NONE 0 /* no parameter, or too complex */ +#define GPL_UNS1 1 /* one one-byte parameter in 0..255 */ +#define GPL_UNS2 2 /* one two-byte parameter in 0..65535 */ +#define GPL_UNS3 3 /* one three-byte parameter in 0..16777215 */ +#define GPL_SGN4 4 /* one four-byte signed parameter */ +/* + * there are no unsigned four byte parameters, and no shorter signed + * parameters + */ + +#define GF_OpLen(code) (gf_oplen[code]) +#define GF_TYPE(code) (gf_gt[code]) +extern char gf_oplen[]; +extern char gf_gt[]; diff --git a/dviware/umddvi/h/gfcodes.h b/dviware/umddvi/h/gfcodes.h new file mode 100644 index 0000000000..b4d293ee13 --- /dev/null +++ b/dviware/umddvi/h/gfcodes.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * GF (generic font) opcodes. + */ + +#define GF_PAINT_0 0 /* paint with `d' = 0 */ + /* ... through PAINT_63, d = 63 */ +#define GF_PAINT1 64 /* paint, with a one-byte parameter */ +#define GF_PAINT2 65 /* paint, with a two-byte parameter */ +#define GF_PAINT3 66 /* paint, with a three-byte parameter */ +#define GF_BOC 67 /* beginning of character */ +#define GF_BOC1 68 /* compressed form of BOC */ +#define GF_EOC 69 /* end of character */ +#define GF_SKIP0 70 /* finish this row, begin next with white */ +#define GF_SKIP1 71 /* finish row, one byte parameter */ +#define GF_SKIP2 72 +#define GF_SKIP3 73 +#define GF_NEW_ROW_0 74 /* begin a new row, ready to blacken */ +#define GF_NEW_ROW_1 75 /* begin a new row, but one col. from left */ + /* through GF_NEW_ROW_164 */ +#define GF_XXX1 239 /* special (interpreter dependent) command */ +#define GF_XXX2 240 /* like XXX1, but two byte length parameter */ +#define GF_XXX3 241 +#define GF_XXX4 242 +#define GF_YYY 243 /* takes four byte parameter, otherwise nop */ + /* (generated by METAFONT for numspecial) */ +#define GF_NOP 244 /* no op */ +#define GF_CHAR_LOC 245 /* character locator */ +#define GF_CHAR_LOC0 246 /* abbreviated form of CHAR_LOC */ +#define GF_PRE 247 /* introduces preamble */ +#define GF_POST 248 /* introduces postamble */ +#define GF_POSTPOST 249 /* marks end of postamble */ + + /* codes 250 through 255 are undefined */ + +#define GF_ID 131 /* identifies this revision of GF */ + +#define GF_FILLER 223 /* filler bytes at end of GF file */ diff --git a/dviware/umddvi/h/imagen.h b/dviware/umddvi/h/imagen.h new file mode 100644 index 0000000000..fc80350172 --- /dev/null +++ b/dviware/umddvi/h/imagen.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* imagen globals */ + +/* Accounting: */ +#ifndef ACCOUNT_FILE +/* +#define ACCOUNT_FILE "/usr/adm/imagen_acct"/* if defined, the name of the + imagen page accounting file */ +#endif ACCOUNT_FILE + +#define MaxImFamily 128 /* hardware limitation on font family index */ +#define DefaultDPI 300 /* 300 for Imagen 8/300, 240 for Imprint-10 */ + +#define DefaultMaxDrift 3 /* default value for MaxDrift */ + +/* Default margins, in dots */ +/* CRUFT ALERT: depending on DPI variable */ +#define DefaultTopMargin (DPI) /* 1" margins */ +#define DefaultLeftMargin (DPI) diff --git a/dviware/umddvi/h/impcodes.h b/dviware/umddvi/h/impcodes.h new file mode 100644 index 0000000000..1fd946b8ce --- /dev/null +++ b/dviware/umddvi/h/impcodes.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* imPRESS command codes */ + +#define imP_SP 128 /* advance one space */ +#define imP_SP1 129 /* advance one space plus 1 pixel */ + +#define imP_Forw 131 /* one pixel forward */ +#define imP_Backw 132 /* one pixel backward */ +#define imP_MMove 133 /* move in main advance dir. */ +#define imP_SMove 134 /* move in secondary advance dir. */ +#define imP_SetHAbs 135 /* set absolute H pos */ +#define imP_SetHRel 136 /* set relative H pos */ +#define imP_SetVAbs 137 /* set absolute V pos */ +#define imP_SetVRel 138 /* set relative V pos */ + +#define imP_Rule 193 /* print a rule */ + +#define imP_CRLF 197 /* move to begin. of line */ + +#define imP_DefGlyph 199 /* define a glyph */ +#define imP_DelGlyph 200 /* mark a glyph for deletion */ + +#define imP_SetHVSystem 205 /* set the H/V coordinate system */ +#define imP_SetAdvDirs 206 /* set the advance directions */ +#define imP_SetFamily 207 /* use this particular family */ +#define imP_SetILSpace 208 /* set the interline spacing */ +#define imP_SetBOL 209 /* define the beginning of line */ +#define imP_SetSP 210 /* define the space between words */ +#define imP_CreateFam 211 /* define a family table */ + +#define imP_Page 213 /* go to (0,0) */ + +#define imP_EndPage 219 /* print the current page */ + +#define imP_ForceDel 240 /* force glyph deletion */ +#define imP_EOF 255 /* end of document */ diff --git a/dviware/umddvi/h/io.h b/dviware/umddvi/h/io.h new file mode 100644 index 0000000000..ce9bb4029c --- /dev/null +++ b/dviware/umddvi/h/io.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* C-Tex I/O definitions */ + +/* + * For non-ASCII systems, someone would have to do a great deal of work + * in the various I/O routines to use the two translation tables. I have + * not the motivation. + */ +#ifdef notdef +int InX[128]; /* input translation table */ +int OutX[128]; /* output translation table */ +#endif + +/* + * These `magic constants' are really the best we can do. Using termcap + * would not be quite right, because (1) the C-TeX run may not be on a + * terminal at all, and (2) the log file could very likely be viewed from + * a different terminal than was used for the C-TeX run. + */ +#define MaxPrLineLen 72 /* will try to never print lines longer + than this */ +#define MaxErrLineLen 72 /* errors (context actually) will never + be longer than this */ +#define HalfErrLine 42 /* about 1/2 MaxErrLineLen; this will be + the width of first lines of contexts */ + +/* + * Input will be read into lines of InBufLen characters. This limits + * several things, including control sequence name length and length of + * strings read by \read. + */ +#define InBufLen 512 + +/* Output descriptors. Note that 0-15 are indexes into OutF. */ +#define OutIgnore 16 /* nowhere; output is silently discarded */ +#define OutTerm 17 /* to terminal (stdout) */ +#define OutLog 18 /* to log file */ +#define OutTermAndLog 19 /* to terminal & log file both */ +#define OutString 20 /* to PoolString */ +#define OutCircBuf 21 /* to CircBuf */ + +int OutFD; /* the current output descriptor */ +FILE *LogF; /* the log file */ +FILE *InF[16]; /* the 16 \read descriptors */ +FILE *OutF[16]; /* the 16 \write descriptors */ +char CircBuf[MaxErrLineLen]; /* this will be used for showing error + context; its length determines the + maximum amount of context that can + be shown. This is a way of getting + around a possibly massive amount of + stuff leading up to the point of the + error, without using backpointers. + Inefficient perhaps, but it does not + occur often. */ + +/* + * On occasion it is nice to be able to interrupt the current output + * descriptor and switch to a new one. This does not happen often, + * so we just have a small stack of them here. + */ +int OutFDstack[20]; +int *OutFDsp; + +/* macros to switch to a new output, then restore the old */ +#define PushOut(fd) (*OutFDsp++ = OutFD, OutFD = (fd)) +#define PopOut() (OutFD = *--OutFDsp) + +/* + * The following magic variables are used by ShowContext to control the info + * being inserted into the CircBuf. + */ +int OutTally; /* total characters recently printed */ +int OutSC_max; /* max needed by ShowContext */ + +/* + * UpdateTerminal makes sure that all output is visible by the user. + * In this case all we need to do is fflush(stdout). + */ +#define UpdateTerminal() ((void) fflush(stdout)) diff --git a/dviware/umddvi/h/num.h b/dviware/umddvi/h/num.h new file mode 100644 index 0000000000..823bb3f5b5 --- /dev/null +++ b/dviware/umddvi/h/num.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Pointer I/O: numbers. + * + * We deal in fixed format numbers and pointers here. + * For file I/O, see fio.h. + */ + +/* + * Get one unsigned byte. Note that this is a proper expression. + * The rest have more limited contexts, and are therefore OddLy + * CapItaliseD. + */ +#define pgetbyte(p) UnSign8(*(p)++) + +/* + * Get a two-byte unsigned integer, a three-byte unsigned integer, + * or a four-byte signed integer. + */ +#define pGetWord(p, r) ((r) = UnSign8(*(p)++) << 8, \ + (r) |= UnSign8(*(p)++)) +#define pGet3Byte(p,r) ((r) = UnSign8(*(p)++) << 16, \ + (r) |= UnSign8(*(p)++) << 8, \ + (r) |= UnSign8(*(p)++)) +#define pGetLong(p, r) ((r) = UnSign8(*(p)++) << 24, \ + (r) |= UnSign8(*(p)++) << 16, \ + (r) |= UnSign8(*(p)++) << 8, \ + (r) |= UnSign8(*(p)++)) + +/* + * ADD pputbyte, pPutWord, pPut3Byte, pPutLong HERE IF THEY PROVE + * USEFUL. (But then must consider changing PutWord &c in fio.h.) + */ diff --git a/dviware/umddvi/h/postamble.h b/dviware/umddvi/h/postamble.h new file mode 100644 index 0000000000..68f4df8ac2 --- /dev/null +++ b/dviware/umddvi/h/postamble.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* Definitions for ScanPostAmble */ + +/* + * ScanPostAmble reads the postamble of a DVI file from the (stdio) + * file specified in its first argument. It is handed two pointers to + * functions. The first (ScanPostAmble's second argument) is called + * after the header information has been read, and given a pointer to a + * PostAmbleInfo structure. It is the job of this function to extract the + * required information from this structure (which is deallocated when + * ScanPostAmble returns). + * + * The second function is called once for each font definition occurring in + * the postamble, and is given a pointer to a PostAmbleFont structure. This + * function should do whatever the device needs to read the actual font. + * + * If the DVI file appears malformed, ScanPostAmble will print an error + * message and exit. (Drastic, perhaps, but effective.) + */ + +struct PostAmbleInfo { + i32 pai_PrevPagePointer; /* previous page pointer */ + i32 pai_Numerator; /* numerator from dvi file */ + i32 pai_Denominator; /* denominator from dvi file*/ + i32 pai_DVIMag; /* \magnification */ + i32 pai_TallestPageHeight; /* height of tallest page */ + i32 pai_WidestPageWidth; /* width of widest page */ + int pai_DVIStackSize; /* DVI stack size required */ + int pai_NumberOfPages; /* total number of pages in DVI file */ +}; + +struct PostAmbleFont { + char *paf_name; /* name of font (null terminated) */ + int paf_n1; /* length of first part of name */ + int paf_n2; /* length of second part of name */ + i32 paf_DVIFontIndex; /* font index number */ + i32 paf_DVIChecksum; /* checksum from DVI file */ + i32 paf_DVIMag; /* "at size" */ + i32 paf_DVIDesignSize; /* design size of font */ +}; diff --git a/dviware/umddvi/h/readme b/dviware/umddvi/h/readme new file mode 100644 index 0000000000..402aff89d5 --- /dev/null +++ b/dviware/umddvi/h/readme @@ -0,0 +1 @@ +This directory is for header files. diff --git a/dviware/umddvi/h/search.h b/dviware/umddvi/h/search.h new file mode 100644 index 0000000000..1ba492d414 --- /dev/null +++ b/dviware/umddvi/h/search.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* search structures and routines for 32-bit key, arbitrary data */ + +struct search { + unsigned s_dsize; /* data object size (includes key size) */ + unsigned s_space; /* space left (in terms of objects) */ + unsigned s_n; /* number of objects in the table */ + char *s_data; /* data area */ +}; + +/* returns a pointer to the search table (for future search/installs) */ +struct search *SCreate(); /* create a search table */ + +/* returns a pointer to the data object found or created */ +char *SSearch(); /* search for a data object */ + +/* the third argument to SSearch controls operation as follows: */ +#define S_LOOKUP 0x00 /* pseudo flag */ +#define S_CREATE 0x01 /* create object if not found */ +#define S_EXCL 0x02 /* complain if already exists */ + +/* in addition, it is modified before return to hold status: */ +#define S_COLL 0x04 /* collision (occurs iff S_EXCL set) */ +#define S_FOUND 0x08 /* found (occurs iff existed already) */ +#define S_NEW 0x10 /* created (occurs iff S_CREATE && !S_EXCL) */ +#define S_ERROR 0x20 /* problem creating (out of memory) */ diff --git a/dviware/umddvi/h/str.h b/dviware/umddvi/h/str.h new file mode 100644 index 0000000000..8f5dabdfbe --- /dev/null +++ b/dviware/umddvi/h/str.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Internal strings have both a length and a string area, so that they may + * contain nulls. + */ +typedef struct string { + int s_len; + char *s_str; +} String; + +#define s_eq(s1,s2) ((s1)->s_len == (s2)->s_len && _s_eq(s1, s2)) + +/* + * Strings are created by appending characters to the current "string pool". + * Once a string has been completed, it is fixed in place and cannot be + * changed. Until the string is complete, characters may be added to, and + * removed from, the end. + */ +#define PoolExpandSize 1024 /* bytes per ExpandPool */ + +String PoolString; /* the current string */ +char *PoolPtr; /* the current position in the pool */ +int PoolLen; /* amount of space left in the pool */ + +#define s_addc(c) (--PoolLen >= 0 ? *PoolPtr++ = (c), PoolString.s_len++ \ + : ExpandPool(c)) +#define s_delc() (PoolLen++, PoolPtr--, PoolString.s_len--) +#define s_kill() (PoolLen += PoolString.s_len, \ + PoolPtr -= PoolString.s_len, PoolString.s_len = 0) diff --git a/dviware/umddvi/h/tfm.h b/dviware/umddvi/h/tfm.h new file mode 100644 index 0000000000..95ed6eb41c --- /dev/null +++ b/dviware/umddvi/h/tfm.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * TFM file information. + */ + +/* + * TFM files start with a series of unsigned 16 bit integers. We + * read this into the structure `tfm_header'. These are type i32 + * so that they may be used as integer quantities without concern + * as to sign extension. + */ +struct tfmheader { + i32 th_lf; /* length of the file (16 bit words) */ + i32 th_lh; /* length of the header data (words) */ + i32 th_bc; /* beginning character */ + i32 th_ec; /* ending character (inclusive) */ + i32 th_nw; /* number of words in width table */ + i32 th_nh; /* number of words in height table */ + i32 th_nd; /* number of words in depth table */ + i32 th_ni; /* words in italic correction table */ + i32 th_nl; /* words in ligature/kern table */ + i32 th_nk; /* words in kern table */ + i32 th_ne; /* words in extensible character table */ + i32 th_np; /* number of font parameter words */ +}; + +/* + * The remainder of the TFM file comprises the following information, + * all of which are 32 bit quantities: + * + * header: array [0..lh-1] of stuff + * char_info: array [bc..ec] of char_info_word + * width: array [0..nw-1] of fix_word + * height: array [0..nh-1] of fix_word + * depth: array [0..nd-1] of fix_word + * italic: array [0..ni-1] of fix_word + * lig_kern: array [0..nl-1] of lig_kern_command + * kern: array [0..ne-1] of extensible_recipie + * param: array [0..np-1] of fix_word + */ + +/* + * A char_info_word is built of four unsigned eight-bit quantities. The first + * is an index into the width table (this saves 24 bits for every + * character that has the same width as another character). The + * second is a composite height and depth index. The third is a + * composite italic index and tag, and the fourth is a remainder. + * + * XXX needs explaining + */ +struct char_info_word { + char ci_width; /* width index */ + char ci_h_d; /* height and depth index */ + char ci_i_t; /* italic index and tag */ + char ci_remainder; /* ??? */ +}; + +/* + * These macros split up h_and_d and i_and_t values. + */ +#define T_CI_H(ci) (((ci)->ci_h_d >> 4) & 0xf) +#define T_CI_D(ci) ((ci)->ci_h_d & 0xf) +#define T_CI_I(ci) (((ci)->ci_i_t >> 2) & 0x3f) +#define T_CI_T(ci) ((ci)->ci_i_t & 3) + +/* + * This structure contains everything one might need to know about + * a TFM file at run-time. + * + * XXX incomplete, or wrong, as yet + */ +struct tfmdata { + struct tfmheader t_hdr; /* full header */ + struct char_info_word *t_ci; /* char info */ + i32 *t_width; /* widths table */ + i32 *t_height; /* heights */ + i32 *t_depth; /* depths */ +}; diff --git a/dviware/umddvi/h/types.h b/dviware/umddvi/h/types.h new file mode 100644 index 0000000000..bd34bc49e0 --- /dev/null +++ b/dviware/umddvi/h/types.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * C-TeX types (system dependent). + */ + +#ifndef _CTEX_TYPES_ +#define _CTEX_TYPES_ + +/* a 16 bit integer (signed) */ +typedef short i16; + +/* a 32 bit integer (signed) */ +typedef long i32; + +/* macros to sign extend quantities that are less than 32 bits long */ +#if defined(u3b) || defined(u3b2) || defined(u3b5) +#define Sign8(n) ((n) & (1 << 7) ? ((n) | 0xffffff00) : (n)) +#define Sign16(n) ((i32) (short) (n)) +#define Sign24(n) ((n) & (1 << 23) ? ((n) | 0xff000000) : (n)) +#else +#ifdef sun +/* Sun mishandles (int)(char)(constant), but this subterfuge works: */ +#define Sign8(n) ((i32) (char) (int) (n)) +#else +#define Sign8(n) ((i32) (char) (n)) +#endif /* sun */ +#define Sign16(n) ((i32) (short) (n)) +#define Sign24(n) (((n) << 8) >> 8) +#endif /* u3b || u3b2 || u3b5 */ + +/* macros to truncate quantites that are signed but shouldn't be */ +#define UnSign8(n) ((n) & 0xff) +#define UnSign16(n) ((n) & 0xffff) +#define UnSign24(n) ((n) & 0xffffff) + +/* note that we never have unsigned 32 bit integers */ + +#endif /* _CTEX_TYPES_ */ diff --git a/dviware/umddvi/h/verser.h b/dviware/umddvi/h/verser.h new file mode 100644 index 0000000000..a7d0f43594 --- /dev/null +++ b/dviware/umddvi/h/verser.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1987 University of Maryland Department of Computer Science. + * All rights reserved. Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* verser globals */ + +/* + * Verser was rewritten based on another program by the same name. + * The original program was written by Janet Incerpi of Brown University + * and was for the original version of TeX which also used a different kind + * of font file. It was modified at the University of Washington by + * Richard Furuta (bringing it up to TeX82 and PXL files) and Carl Binding + * (adding horizontal printing). I then tore it to shreds and rebuilt + * it; the new one is much faster (though less portable: it has inline + * assembly code in various critical routines). + * + * Chris Torek, 20 May 1984, University of Maryland CS/EE + * + * The program has since gone through much revision. The details are + * rather boring, but there is one important point: The intermediate + * file format has changed. + */ + +/* + * Version number. Increment this iff the intermediate file format + * makes an incompatible change. This number may not be > 127. + */ +#define VERSION 1 /* was version 0 */ + +#ifndef ACCOUNT_FILE +/* +#define ACCOUNT_FILE "/usr/adm/vpacct" /* if defined, the name of + the paper accounting file */ +#endif ACCOUNT_FILE + +#ifndef VERSATEC_FILE +#define VERSATEC_FILE "/dev/vp0"/* the name of the Versatec */ +#endif VERSATEC_FILE + +#define NFONTS 100 /* max number of fonts */ + +#define FONTSHIFT 14 /* font shift in fcp's */ +#define CHARSHIFT 7 /* char shift in fcp's */ +#define CHARMASK 127 /* char mask in fcp's - 128 chars/font */ +#define PARTMASK 127 /* part mask in fcp's */ + +#define ROWS 400 /* lines in buffer (200 lines/inch) */ +#define COLUMNS 264 /* 2112 bits per line / 8 bits per char */ +#define MIN_OUT 30 /* MIN_OUT lines in buffer causes output + to be written right away */ +#define MaxCharHeight (ROWS-1) /* max bit height of a single char or rule */ +#define MaxPageHeight 1685 /* max bit height of a page */ +#define MaxPageWidth 2112 /* max bit width of a page */ +#define FFMargin 39 /* vert. offset after a formfeed (bits) */ + +#define DefaultMaxDrift 2 + +#define DefaultLeftMargin 150 +#define MinimumLeftMargin 10 +#define DefaultTopMargin 200 +#define MinimumTopMargin 10 +#define DefaultBottomMargin 200 + +#ifndef min +#define min(a,b) ((a) < (b) ? (a) : (b)) +#endif min |