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