home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 304_01 / roff5.fnc < prev    next >
Text File  |  1990-02-14  |  9KB  |  180 lines

  1. /********************************************************/
  2. /*         ROFF5, Version 2.00            */
  3. /*    (c) 1983,4,8,9 by Ernest E. Bergmann        */
  4. /*    730 Seneca Street, Bethlehem, Pa. 18015        */
  5. /*                            */
  6. /* Permission is hereby granted for all commercial and    */
  7. /* non-commercial reproduction and distribution of this    */
  8. /* material provided this notice is included.        */
  9. /********************************************************/
  10. #if (VERSION!=2) || (subVERSION!=00)
  11. #error ***************This is version 2.00******************
  12. #endif
  13.  
  14. /*  found in ROFF5.C : ****/
  15. void main(int argc, char **argv);
  16. void init_defaults(); /*initializes global variables*/
  17. void range(char *s);/*sets FIRSTPAGE,LASTPAGE*/
  18. void redoRR();/*initialize RULER string*/
  19. int verifyRR(char *rr);/*checks legality of string as RULER and updates*/
  20. /*********end of ROFF5.C*********/
  21.  
  22. /*found in ROFF51.C : */
  23. void skip_blanks(); /*advances LIN in LINE over white space*/
  24. CMD comtyp1(char *line);/*returns command value of command,IGNORE,UNKNOWN*/
  25. void set(int *param,int val,char arg_typ,int defval,int minval,int maxval);
  26. void Brk(); /*end current filled line*/
  27. void initxu();/*init underline,overstrike variables*/
  28. void need(int n); /*tests for space before footer*/
  29. int min(int i, int j); /*returns min of 2 args*/
  30. int max(int i, int j); /*returns max of 2 args*/
  31. int process(ARGs *a); /*parses args from LIN in LINE; returns # args*/
  32. void pbmac(char *m, ARGs a); /*generalized pbstr() for macro with args*/
  33. int get_val2(char *l,char *typ,char **end);/*generalized get_val with arith*/
  34. void setnxtval(char **line,int *param,int deflt,int minparam, int maxparam);
  35. int expr(); /* returns value of arithmentic expression; error handling */
  36. int expr0();/* returns value of arithmetic expresion; handles logicals*/
  37. int expr1();/* handles combination of arithmetic terms */
  38. int expr2();/* handles combination of arithmetic factors*/
  39. int expr3();/* handles numbers, tokens, and (expresions) */
  40. void amat();/* diagnostic showing where arithmetic parsing has reached */
  41. /************end of ROFF51.C**********/
  42.  
  43. /*found in ROFF52.C : */
  44. void insert(); /* from .DS LINE into an ENTRY of SLINK */
  45. void showit(); /*string substitution table*/
  46. void putback(char c); /*cf K & P, p256*/
  47. int ngetc(FILE *iobuf);/*cf K & P, p256;filters \rfollowed by \n,msb*/
  48. int kgetc();/*like getc(),from keyboard,line buffered*/
  49. void pbstr(char s[LSZ]); /*putback string on input*/
  50. void apatch(char *s); /*appends PatchName to s*/
  51. void showm(int mode); /*lists macro definitions*/
  52. char *macq1(char *line); /*looks up line in macro table;returns replacement
  53.                                        or FALSE*/
  54. char *find2(char *s, ENTRY *LINK);/*finds s in table; returns replacement
  55.                        or FALSE*/
  56. ENTRY *find(char *s, ENTRY *LINK);
  57. ENTRY *mpatch(char *name,ENTRY *LINK); /*returns FALSE or &PatchName*/
  58. void mappend(CMD cmd); /*does .de, .am */
  59. ENTRY *findany(char *name);
  60. void rndef(); /*does .rn */
  61. ENTRY *find0(char *s,ENTRY *LINK); /*returns NULL or link->entry */
  62. ENTRY *find0any(char *s);
  63. int rm1(char *id); /*if entry id found, removes it and continuations*/
  64. void rmdef(); /* does .rm */
  65. void dappend(CMD cmd); /*does start of .di and .da*/
  66. void divert(char *line); /*places line into diversion*/
  67. void enddiv(); /*finishes (closes) diversion entry*/
  68. void dtset(); /*similar to itset()*/
  69. /*********** end of ROFF52.C ******/
  70.  
  71. /* found in ROFF53.C : */
  72. void exitm(char *msg);/*prints msg to stderr; exit(1);*/
  73. int *regist(char *s);/*checks RLIST makes new entry if necssary;
  74.                        returns pointer to integer variable*/
  75. void dovar(); /*process .RG request*/
  76. void source();/*process .SO request*/
  77. void showr();/*lists register names and contents*/
  78. void assignfmt(); /*process .AF request*/
  79. FORMAT *picfmt(char *string, FORMAT *pf); /*for assignfmt, sets <- pf*/
  80. void endso(); /*used by source to return to previous input upon EOF*/
  81. void dashes();/*prints -------- to stderr*/
  82. void ignore(); /*does .ig*/
  83. void detab(); /*expands tabs and soh in OUTBUF2*/
  84. int readonly(char *name); /*handles predefined regs for fgets2()*/
  85. /********** end of ROFF53.C ***/
  86.  
  87. /* found in ROFF54.C : */
  88. void doTI(char *line); /*removes leading space; updates TIVAL*/
  89. void leadbl(char *line); /*handles leading blanks, tabs, empty lines*/
  90. void phead(); /*puts out page header*/
  91. void pfoot(); /*puts out page footer*/
  92. void pbcmd(char *xx,int num); /* pbstr(".xx <num>\n") */
  93. void retract();/*backs out of stuff in progress during page trap*/
  94. void space(int n); /*puts out n lines or to bottom of page*/
  95. void text();
  96. void put(char *line); /*output text line with correct indent, underline*/
  97. void putwrd();/*concatenates GPWBUF to OUTBUF for filling*/
  98. void offset(char *s,int i); /*prepends to s i spaces*/
  99. void putline(char *line); /*sends line to OUTPUT2*/
  100. void OUTcat(char *str); /*appends string to OUTBUF*/
  101. void OUTSP(); /*appends blank to OUTBUF*/
  102. void gloss(); /*prints on STDOUT glossary of .tr characters*/
  103. void chgenv(int old,int new); /*change environments for headrs,foots*/
  104. void putlinout(int txtline);    /* redirects output printer/diversion */
  105. /*********** end of ROFF54.C ******/
  106.  
  107. /* found in ROFF55.C : */
  108. void puttl3(char *s1,char *s2, char *s3, int pageno, FORMAT fmt);
  109.            /* put out three part title */
  110. void blankb(int i); /*sends i blanks to OUTBUF2; handles negative i*/
  111. void gettl3(char *sourceline,char ttl1[MAXLINE],char **ttl2,char **ttl3);
  112.       /* gets three part title from source line; no strings have \n */
  113. void title3(char *sl,int pageno,FORMAT fmt); /*for .tl*/
  114. void transfer(char **s,char **d,char c); /*specialied to use terminal char*/
  115. void center(char *line); /*sets variables such as TIVAL*/
  116. int getwrd(char *in,char *out);/*returns WE_HAVE_A_WORD*/
  117. int gwLIN(char *out); /*equivalent to getwrd(LIN,out) */
  118. void trunc_bl(char *string); /*truncates white space characters at EOS*/
  119. void spread(char *line, int nextra,int no_words); /*"adjusts" line*/
  120. void adjust();    /*handles .ad request*/
  121. void puttl(char *str, int num, FORMAT fmt);
  122.         /* place portion of title with opt page # in OUTBUF2 */
  123. void putnum(int num, FORMAT fmt); /*put out num to OUTBUF2 (conversion) */
  124. int itoC(int num,char buff[],FORMAT fmt);/*converts num to representation*/
  125. char *itoR(int val,char *string);/*Roman numeral format*/
  126. char *itoA(int val,char *string);/*conversion ->letters of alphabet*/
  127. void putout(char c);/*places c in OUTBUF2[]*/
  128. /***************** end of ROFF55.C *******/
  129.  
  130. /* found in ROFF56.C : */
  131. int value(int base, char *string);/*unsigned conv; -1 error return*/
  132. int digit(char d);/*for any radix; error return -1*/
  133. int strln4(char *s, int word, int num,FORMAT fmt);
  134.     /*checks legality, size of glob; use negative num to disable # */
  135. void setS(int param[STKSIZ+1],int val,char arg_typ,int defval,int minval,
  136.           int maxval);/*similar to set(), but for stacked variable*/
  137. void initsk(int *stack,int v);/*init stacked var with v*/
  138. void setchar(int *param,int stack,int defval,int minval,int maxval);
  139. void getot();/*process .ot */
  140. char getcode(char buff[128]);/*used by gettr(),getpc()...*/
  141. void ocode(); /*process .ou */
  142. void outstr(char *p); /*print string whose byte count is *p*/
  143. void getfr(); /*process .FR; cf. ocode()*/
  144. void when(); /*places a page trap for .wh*/
  145. void changetrap(); /* changes page trap for .ch*/
  146. void itset(); /*used to process .it */
  147. void EMset(); /*used to process .em */
  148. int dotT(int ln); /*returns distance to next trap from ln ".t" */
  149. void setTRAP(); /*recalculates FOOTLOC,TRAPLOC*/
  150. /********* end of ROFF56.C ****/
  151.  
  152. /* found in ROFF57.C : */
  153. void printout(int txtlin);    /*outputs contents of OUTBUF2,
  154.     including super and subs; txtlin=FALSE for titles*/
  155. void padv();/*moves printer vertically speced by VLINENO,FVLINENO*/
  156. void backup(int i);/*not yet implemented*/
  157. void excurs(char *str, int *t, int *b);/*finds topmost and bottom pos of str*/
  158. void flp(int level,int updat);/*fancy line print
  159.                            at given vertical level of OUTBUF2[]*/
  160. int retype();/*returns boolean;restores OUTBUF2 from DBUF*/
  161. int lbc(int lev, char *str);/*counts printable chars at level and above*/
  162. void prpass(int lev,int updat);/*printer pass initial cr; np lf anywhere*/
  163. int class(char c);/*recognize which type char is*/
  164. void fraction(); /*put printer in fractional spacing mode*/
  165. void whole(); /*place printer in whole line spacing*/
  166. void trch(char c);/*output string translation of c*/
  167. void pcont(char c);/*output printer control string for c*/
  168. void cputc(char c, FILE *fp); /* putc if !SUPPRESS */
  169. /********* end of ROFF57.C **/
  170.  
  171. /* found in ROFF58.C */
  172. char *fgets3(); /*fills LINE[] from ifp; returns &LINE[0] or NULL on EOF*/
  173. void comand(); /*hugh switch; performs formatting commands*/
  174. void dolns(); /*do processing of lines*/
  175. void action(); /*processes true conditional grammar of dolns()*/
  176. void inaction(); /*processed false conditional part of dolns()*/
  177. int act2(int act); /*handles .el part; act T/F uses action/inaction*/
  178. void conderr(char *err); /*non-fatal error reporting for cond grammar*/
  179. /*******end of ROFF58.C ******/
  180.