home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 145_01 / roff4.h < prev    next >
Text File  |  1979-12-31  |  11KB  |  322 lines

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