home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 128_01 / roff4.h < prev    next >
Text File  |  1985-03-10  |  9KB  |  260 lines

  1. /********************************************************/
  2. /*                            */
  3. /*            ROFF4, Version 1.60            */
  4. /*                            */
  5. /*(C) 1983,4 by Ernest E. Bergmann            */
  6. /*        Physics, Building #16            */
  7. /*        Lehigh Univerisity            */
  8. /*        Bethlehem, Pa. 18015            */
  9. /*                            */
  10. /* Permission is hereby granted for all commercial and    */
  11. /* non-commercial reproduction and distribution of this    */
  12. /* material provided this notice is included.        */
  13. /*                            */
  14. /********************************************************/
  15. /*FEB 19, 1984*/
  16. /*Jan 15, 1984*/
  17. #include "bdscio.h"
  18. /*June 27, 1983 eliminate directed input*/
  19. char _doflag;    /* flag if directed /O being used */
  20. char  **_nullpos; /*???*/
  21. char _dobuf[BUFSIZ];    /* /O buffer used for direction  */
  22. char sav_out_file[20];    /*??? added to work with dioinit
  23.                 and dioflush() ???*/
  24. int     debug;
  25. int PAGESTOP;
  26. int JUSTIFY;
  27. int FFEED;
  28. int FIRSTPAGE,LASTPAGE;/*for selectively printing output*/
  29. int SUPPRESS;/*if true,no output is passed by putchar()*/
  30.  
  31. #define STDERR        4
  32. /* send error messages to console while in DIO */
  33. #define STKSIZ        3
  34. #define DEBUG        ( debug != 0 )
  35. #define HUGE        135    /* generally large number */
  36. #define LSZ        255    /* line buffer size*/
  37. #define    COMMAND        '.'    /* all commands starts with this */
  38. #define    CONSOLE        -5    /* one of output options */
  39. #define PRINTER     -4    /* another */
  40. #define FILE        -3    /* another */
  41. #define    UNKNOWN        -1    /* returned if doesn't recg. command */
  42. #define    NO_VAL        -32760    /* returned when no argument w/commad */
  43. #define WE_HAVE_A_WORD   1       /* returned by getwrd func. */
  44. #define    NO        0
  45. #define    YES        1
  46. #define UNDERLINE    '\137'
  47. #define    CR        0x0D
  48. #define BACKSPACE    '\b'
  49. #define NUMSIGN        '#'    /* for title strings */
  50. #define NEWLINE        '\n'
  51. #define TAB        '\t'
  52. #define BLANK        ' '
  53. #define FORMF        0x0C    /* formfeed for printer */
  54. #define SQUOTE        0x27    /* single quote */
  55. #define DQUOTE        0x22    /* double quote */
  56. #define TRSIZ        2000    /*size of TRTBL*/
  57.  
  58. #define TRANSLATE 2    /* May 23, 1983*/
  59. #define BLACK 1
  60. #define WHITE 0
  61. #define CONTROL -1
  62. #define SENTINEL -2
  63. #define HTAB    -3
  64. #define OTHERS -4
  65. #define XCHAR '-'
  66. #define UCHAR '_'
  67.  
  68. #define FI        1    /* fill lines */
  69. #define TI        2    /* temporary indent */
  70. #define BP        3    /* begin page  */
  71. #define BR        4    /* causes break */
  72. #define CE        5    /* center line(s) */
  73. #define IN        7    /* left indent */
  74. #define LS        8    /* line spacing */
  75. #define NF        9    /* no fill */
  76. #define PL        10    /* set page length */
  77. #define RM        11    /* set right margin */
  78. #define SP        12    /* add blank line(s) */
  79. #define ST        13    /* stop(pause) at page start?*/
  80. #define FO        14    /* footer title */
  81. #define HE        15    /* header title */
  82. #define M1        16    /* top margin */
  83. #define M2        17    /* second top margin */
  84. #define M3        18    /* first bottom margin */
  85. #define M4        19    /* bottom-most margin       */
  86. #define IG        20    /* "ignore";comments,Nov 6,82*/
  87. #define NE        21    /* "need";Nov 7,82*/
  88. #define FF        22    /* "formfeed";Nov 10*/
  89. #define SC        23    /* "space character";Nov13*/
  90. #define OW        24    /* "output width";Nov 13*/
  91. #define TS        25    /* "tabsize";Nov 13*/
  92. #define EH        26    /* "even headers";Nov 14*/
  93. #define OH        27    /* "odd headers"*/
  94. #define EF        28    /* "even footers"*/
  95. #define OF        29    /* "odd footers"*/
  96. #define AB        30    /* "abort";Nov 15*/
  97. #define DB        31    /* "debug"*/
  98. #define TC        32    /* "translation flag char"*/
  99. #define TR        33    /* "def translation string"*/
  100. #define CF        34    /* Dec 4:control flag char*/
  101. #define IC        35    /* insert character */
  102. #define OU        36    /* output */
  103. #define JU        37    /* right justify?*/
  104. #define NJ        38    /* don't right justify*/
  105. #define WH        39    /* whole line spacing code*/
  106. #define FR        40    /* fractional spacing,code*/
  107. #define DS        41    /*define string*/
  108. #define DM        42    /*define macro*/
  109. #define EM        43    /*end macro*/
  110. #define RG        44    /*register variable*/
  111. #define DI        45    /*diversion*/
  112. #define ED        46    /*end diversion*/
  113. #define SO        47    /*"source", include*/
  114. #define PC        48    /*printer control definition*/
  115. #define SA        49    /*"say" inline msg to console*/
  116. #define BJ        50    /*break with rightjustification
  117.                 of current line*/
  118. int FILL;    /* set to YES or NO */
  119. int _FILL[STKSIZ];    /*convert global value to a stack*/
  120. int LSVAL;    /* line spacing value -> default will be 1 */
  121. int _LSVAL[STKSIZ];
  122. int TIVAL;    /* temporary indent -> default  0 */
  123. int INVAL;    /* left indent -> default  0 */
  124. int _INVAL[STKSIZ];
  125. int RMVAL;    /* right margin -> default  PAGEWIDTH */
  126. int _RMVAL[STKSIZ];
  127. int CEVAL;    /* set equal to number of lines to be centered    */
  128. int TCVAL;    /*translation flag char*/
  129. int _TCVAL[STKSIZ];
  130.         /* default is 0                                   */
  131. int SPVAL;    /* blank lines to be spaced down */
  132.  
  133. int CURPAG;    /* current output page number; init = 0 */
  134. int NEWPAG;    /* next output page number; init = 1 */
  135. int VLINENO;    /* virtual (intended) line advances on page,
  136.             see vadv()*/
  137. int FVLINENO;    /* + line fraction */
  138. int PLINENO;    /* printer's actual line advances on page,
  139.             see padv()*/
  140. int FPLINENO;    /* + line fraction */
  141. int PLVAL;    /* page length in lines */
  142. int _PLVAL[STKSIZ];
  143. int M1VAL;    /* margin before& including header in lines*/
  144. int _M1VAL[STKSIZ];
  145. int M2VAL;    /* margin after header in lines*/
  146. int _M2VAL[STKSIZ];
  147. int M3VAL;    /* margin after last text line in lines*/
  148. int _M3VAL[STKSIZ];
  149. int M4VAL;    /* bottom margin, including footer in lines*/
  150. int _M4VAL[STKSIZ];
  151. int BOTTOM;    /* end of text area in lines;start of M3+M4 */
  152. int SCVAL;    /* space character*/
  153. int _SCVAL[STKSIZ];
  154. int OWVAL;    /* output device width*/
  155. int _OWVAL[STKSIZ];
  156. int TABSIZ;    /* spacing of tabstops*/
  157. int _TABSIZ[STKSIZ];
  158. int SENTENCE;    /* Nov 20*/
  159. int CFVAL;    /*Dec 4:control flag character value*/
  160. int _CFVAL[STKSIZ];
  161. int ICVAL;    /*insert character*/
  162. int _ICVAL[STKSIZ];
  163.  
  164. char LINE[ LSZ ];    /*input line buffer, Nov 26*/
  165. char EHEAD[ LSZ ],*EH2,*EH3;    /* even header title */
  166. char OHEAD[ LSZ ],*OH2,*OH3;    /* odd header title */
  167. char EFOOT[ LSZ ],*EF2,*EF3;    /* even footer title */
  168. char OFOOT[ LSZ ],*OF2,*OF3;    /* even footer title */
  169.  
  170.  
  171. /* defaults for global parameters */
  172.  
  173. #define FI_DEF        1
  174. #define    LS_DEF        1
  175. #define    IN_DEF        0
  176. #define    RM_DEF        60
  177. #define    TI_DEF        0
  178. #define    CE_DEF        1
  179. #define    UL_DEF        -1
  180. #define M1_DEF        2
  181. #define M2_DEF        2
  182. #define M3_DEF        2
  183. #define M4_DEF        2
  184. #define PL_DEF        66
  185. #define FF_DEF        YES    /* .ff defaults to "on" */
  186. #define FF_INI        NO    /* initial setting*/
  187. #define SC_INI        BLANK
  188. #define OW_INI        60    /*initial output width*/
  189. #define TS_DEF        8    /*standard tabsize*/
  190. #define TC_DEF        '~'    /*translation flag default*/
  191. #define CF_DEF        '^'    /*Dec 4*/
  192. #define IC_DEF        '\\'
  193. #define CW_DEF        12    /* 12/120" */
  194. #define JU_INI        YES    /*right justification*/
  195. #define REGDEF         1    /*default for register var.*/
  196.                 /*when .rg has no numeric arg*/
  197.  
  198. int DIR;    /* for "spreading" of lines    */
  199. int OUTWRDS;    /* no. words in OUTBUF; init = 0 */
  200. char OUTBUF[ LSZ ];    /*lines to be filled collected here */
  201. int OUTW;    /*current display width of OUTBUF*/
  202. int OUTPOS;    /* =strlen(OUTBUF) */
  203. int WTOP,LTOP,OUTTOP;    /*zero|negative;levels of subscripts*/
  204. int WBOT,LBOT,OUTBOT;    /*zero|positive;levels of subscripts*/
  205. INT OLDLN;        /*position of previous main line*/
  206. int OLDBOT;        /*OUTBOT for previous line;reset
  207.             each page*/
  208. int FRQ,FRVAL;    /* fractional line?, what fraction size*/
  209. char *FRSTRING; /* ^ to code for fractional spacing*/
  210. char *WHSTRING;    /* ^ to code for whole line spacing*/
  211. char *CPTR[128-' '];    /*pointer table for print control*/
  212. char *TPTR[128-' '];    /*pointer table for translation strings
  213.               for char; initialize to null */
  214. char TRTBL[TRSIZ];    /*holds translation strings*/
  215. char *TREND;        /*^to end of above;init = TRTBL*/
  216. int DLINK;        /*^ head of diversion list*/
  217. int *RLINK;        /*^ head of register variable list*/
  218. int *SLINK,*MLINK;    /*points to head of linked
  219.             string, macro lists*/
  220. struct _buf *IOBUF;
  221. /*following added for buffered and formatted output:  */
  222. char OUTBUF2[LSZ];    /*for line to be output in fancy fmt*/
  223. int BPOS,CP,PP;        /*buffer,column,printer positions*/
  224. char XBUF[LSZ];        /*strikout buffer*/
  225. int XF,XCOL;        /* " flag and column */
  226. char UBUF[LSZ];        /*underline buffer*/
  227. int UF,UCOL;        /* " flag and column */
  228. int FIRST;        /*flag for first pass*/
  229. char DBUF[LSZ];        /*double strike buffer*/
  230. int DPOS;
  231. int OCNT;
  232. int MCNT;
  233. int BLKCNT;
  234.  
  235. #define    REVSCROLL    FALSE
  236. #define CANBS        FALSE
  237.  
  238. #define BACKSIZE    LSZ
  239. char BACKBUF[BACKSIZE];
  240. int BINP;    /*position in above;init to 0*/
  241. #define BELL    '\007'
  242. char KEYBD;        /*boolean & prompt for keyboard input*/
  243. char KLINE[MAXLINE];    /*keyboard line input buffer*/
  244. char *KPTR;        /*pointer for above*/
  245.  
  246. struct divfd
  247.     {char *nm;    /*name*/
  248.     int cs;        /*character count*/
  249.     int ls;        /*line count*/
  250.     struct _buf *bf; /*to iobuf if open, FALSE otherwise*/
  251. };
  252.  
  253. #define FMAX        4    /* # of additional files open*/
  254. int    FPTR;
  255. struct _buf *FSTACK[FMAX];
  256. int    TFLAG;/*added for start(), complete()*/
  257. int XF2,UF2,MCNT2;
  258. output:  */
  259. char OUTBUF2[LSZ];    /*for line to be output in fancy fmt*/
  260. int BPOS,CP,PP;