1 /*- 2 * %sccs.include.proprietary.c% 3 */ 4 5 #ifndef lint 6 static char sccsid[] = "@(#)4.form.c 4.2 (Berkeley) 04/16/91"; 7 #endif /* not lint */ 8 9 #include <stdio.h> 10 # 11 #include "def.h" 12 #include "4.def.h" 13 extern int linechars; 14 extern int rdfree(), comfree(), labfree(), contfree(); 15 extern int rdstand(), comstand(), labstand(), contstand(); 16 extern int (*rline[])(); 17 extern int (*comment[])(); 18 extern int (*getlabel[])(); 19 extern int (*chkcont[])(); 20 null(c) 21 char c; 22 {return;} 23 24 25 26 comprint() 27 { 28 int c, blank, first,count; 29 blank = 1; 30 first = 1; 31 count = 0; 32 while ((c = (*comment[inputform])(0) ) || blankline() ) 33 { 34 ++count; 35 if (c) 36 { 37 (*comment[inputform])(1); /* move head past comment signifier */ 38 blank = blankline(); 39 /* if (first && !blank) 40 OUTSTR("#\n");*/ 41 prline("#"); 42 first = 0; 43 } 44 else 45 (*rline[inputform])(null); 46 } 47 /* if (!blank) 48 OUTSTR("#\n"); */ 49 return(count); 50 } 51 52 53 54 prcode(linecount,tab) 55 int linecount, tab; 56 { 57 int someout; 58 someout = FALSE; 59 while (linecount) 60 { 61 if ( (*comment[inputform])(0) ) 62 { 63 linecount -= comprint(); 64 someout = TRUE; 65 continue; 66 } 67 else if (blankline() ) 68 (*rline[inputform])(null); 69 else if ((*chkcont[inputform])() ) 70 { 71 TABOVER(tab); 72 prline("&"); 73 someout = TRUE; 74 } 75 else 76 {if (someout) TABOVER(tab); 77 (*getlabel[inputform])(null); 78 prline(""); 79 someout=TRUE; 80 } 81 --linecount; 82 } 83 } 84 85 86 charout(c) 87 char c; 88 { 89 putc(c,outfd); 90 } 91 92 93 94 prline(str) 95 char *str; 96 { 97 fprintf(outfd,"%s",str); 98 (*rline[inputform]) (charout); 99 putc('\n',outfd); 100 } 101 102 103 input2() 104 { 105 static int c; 106 c = inchar(); 107 if (c == '\n') 108 linechars = 0; 109 else 110 ++linechars; 111 return(c); 112 } 113 114 115 unput2(c) 116 int c; 117 { 118 unchar(c); 119 --linechars; 120 return(c); 121 } 122