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