home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol126 / roff4.h < prev    next >
Encoding:
C/C++ Source or Header  |  1984-04-29  |  8.3 KB  |  254 lines

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