Debian Codegraph @

texk/web2c/cwebdir/ctang-bs.ch

raw
1 Changes for CTANGLE for MSDOS and Borland C++ 3.1 using the following
2 options (and perhaps others):
3
4 -mc -w-pro -Ff=5000 -Z- -O-p
5
6 The options -Z- and -O-p explicitly turn off optimizations that break
7 the code. (See makefile.bs.)
8
9 The main purpose of these changes is to support MSDOS with full-size arrays
10 by using "huge" pointers.
11
12 (This file contributed by Barry Schwartz, [email protected], 28 Jun 94;
13 revised 24 Jul 94.)
14
15
16 @x Section 1.
17 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
18 is modified.
19
20 @d banner "This is CTANGLE (Version 4.12.2)"
21 @y
22 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
23 is modified.
24
25 @d banner "This is CTANGLE (Version 4.12.2pc/big)"
26 @z
27
28
29 @x Section 11.
30 @d ilk dummy.Ilk /* used by \.{CWEAVE} only */
31
32 @<Common code...@>=
33 typedef struct name_info {
34 char *byte_start; /* beginning of the name in |byte_mem| */
35 struct name_info *link;
36 union {
37 struct name_info *Rlink; /* right link in binary search tree for section
38 names */
39 eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */
40 } dummy;
41 void *equiv_or_xref; /* info corresponding to names */
42 } name_info; /* contains information about an identifier or section name */
43 typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
44 typedef name_pointer *hash_pointer;
45 extern char byte_mem[]; /* characters of names */
46 extern char *byte_mem_end; /* end of |byte_mem| */
47 extern char *byte_ptr; /* first unused position in |byte_mem| */
48 extern name_info name_dir[]; /* information about names */
49 extern name_pointer name_dir_end; /* end of |name_dir| */
50 extern name_pointer name_ptr; /* first unused position in |name_dir| */
51 @y
52 @d ilk dummy.Ilk /* used by \.{CWEAVE} only */
53
54 @f huge extern
55
56 @<Common code...@>=
57 typedef struct name_info {
58 char huge* byte_start; /* beginning of the name in |byte_mem| */
59 struct name_info *link;
60 union {
61 struct name_info *Rlink; /* right link in binary search tree for section
62 names */
63 eight_bits Ilk; /* used by identifiers in \.{CWEAVE} only */
64 } dummy;
65 union {
66 char *equiv_member;
67 char huge* xref_member;
68 } ptr_union; /* info corresponding to names */
69 } name_info; /* contains information about an identifier or section name */
70 typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
71 typedef name_pointer *hash_pointer;
72 extern char huge byte_mem[]; /* characters of names */
73 extern char huge* byte_mem_end; /* end of |byte_mem| */
74 extern name_info name_dir[]; /* information about names */
75 extern name_pointer name_dir_end; /* end of |name_dir| */
76 extern name_pointer name_ptr; /* first unused position in |name_dir| */
77 extern char huge* byte_ptr; /* first unused position in |byte_mem| */
78 @z
79
80
81 @x Section 19.
82 eight_bits *tok_start; /* pointer into |tok_mem| */
83 sixteen_bits text_link; /* relates replacement texts */
84 } text;
85 typedef text *text_pointer;
86 @y
87 eight_bits huge* tok_start; /* pointer into |tok_mem| */
88 sixteen_bits text_link; /* relates replacement texts */
89 } text;
90 typedef text *text_pointer;
91 @z
92
93
94 @x Section 20.
95 @ @d max_texts 4000 /* number of replacement texts, must be less than 10240 */
96 @d max_toks 270000 /* number of bytes in compressed \CEE/ code */
97 @y
98 @ (This is a modified version of \.{CTANGLE}, and in fact one of the parameters
99 has been reduced in value. The parameter |max_toks|
100 has been reduced from 270000 [which
101 was sufficient to handle \TEX/] to
102 170000, so that \.{CTANGLE}
103 may be run on {\mc MSDOS}
104 systems that are tight on memory. Consider, for
105 instance, an 80286-based machine with several TSRs and drivers, trying
106 to run \.{CTANGLE} from a makefile.)
107 @d max_texts 2500 /* number of replacement texts, must be less than 10240 */
108 @d max_toks 170000 /* number of bytes in compressed \CEE/ code */
109 @z
110 @x
111 static eight_bits tok_mem[max_toks];
112 static eight_bits *tok_mem_end=tok_mem+max_toks-1;
113 static eight_bits *tok_ptr; /* first unused position in |tok_mem| */
114 @y
115 static eight_bits huge tok_mem[max_toks];
116 static eight_bits huge* tok_mem_end;
117 static eight_bits huge* tok_ptr; /* first unused position in |tok_mem| */
118 @z
119
120
121 @x Section 21.
122 text_info->tok_start=tok_ptr=tok_mem;
123 text_ptr=text_info+1; text_ptr->tok_start=tok_mem;
124 /* this makes replacement text 0 of length zero */
125 @y
126 tok_mem_end=tok_mem+max_toks-1;
127 text_info->tok_start=tok_ptr=tok_mem;
128 text_ptr=text_info+1; text_ptr->tok_start=tok_mem;
129 /* this makes replacement text 0 of length zero */
130 @z
131
132
133 @x Section 22.
134 @d equiv equiv_or_xref /* info corresponding to names */
135 @y
136 @d equiv ptr_union.equiv_member /* info corresponding to names */
137 @z
138
139
140 @x Section 31.
141 eight_bits *byte_field; /* present location within replacement text */
142 @y
143 eight_bits huge* byte_field; /* present location within replacement text */
144 @z
145
146
147 @x Section 55.
148 out_char(
149 eight_bits cur_char)
150 {
151 char *j; /* pointer into |byte_mem| */
152 @y
153 out_char(cur_char)
154 eight_bits cur_char;
155 {
156 char huge* j; /* pointer into |byte_mem| */
157 @z