1 Changes for CTANGLE for MSDOS and Borland C++ 3.1 using the following
2 options (and perhaps others):
4 -mc -w-pro -Ff=5000 -Z- -O-p
6 The options -Z- and -O-p explicitly turn off optimizations that break
7 the code. (See makefile.bs.)
9 The main purpose of these changes is to support MSDOS with full-size arrays
10 by using "huge" pointers.
12 (This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94;
17 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
20 @d banner "This is CTANGLE (Version 3.64)\n"
22 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
25 @d banner "This is CTANGLE (Version 3.64pc/big)\n"
30 @ The following parameters were sufficient in the original \.{TANGLE} to
32 so they should be sufficient for most applications of \.{CTANGLE}.
33 If you change |max_bytes|, |max_names| or |hash_size| you should also
34 change them in the file |"common.w"|.
36 @d max_bytes 90000 /* the number of bytes in identifiers,
37 index entries, and section names; used in |"common.w"| */
38 @d max_toks 270000 /* number of bytes in compressed \CEE/ code */
39 @d max_names 4000 /* number of identifiers, strings, section names;
40 must be less than 10240; used in |"common.w"| */
41 @d max_texts 2500 /* number of replacement texts, must be less than 10240 */
42 @d hash_size 353 /* should be prime; used in |"common.w"| */
43 @d longest_name 10000 /* section names shouldn't be longer than this */
44 @d stack_size 50 /* number of simultaneous levels of macro expansion */
45 @d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
47 @ The following parameters were sufficient in the original \.{TANGLE} to
49 so they should be sufficient for most applications of \.{CTANGLE}.
50 If you change |max_bytes|, |max_names| or |hash_size| you should also
51 change them in the file |"common.w"|.
53 (This is a modified version of \.{CTANGLE}, and in fact one of the parameters
54 has been reduced in value. The parameter |max_toks|
55 has been reduced from 270000 [which
56 was sufficient to handle \TEX/] to
57 170000, so that \.{CTANGLE}
58 may be run on {\mc MSDOS}
59 systems that are tight on memory. Consider, for
60 instance, an 80286-based machine with several TSRs and drivers, trying
61 to run \.{CTANGLE} from a makefile.)
63 @d max_bytes 90000 /* the number of bytes in identifiers,
64 index entries, and section names; used in |"common.w"| */
65 @d max_toks 170000 /* number of bytes in compressed \CEE/ code */
66 @d max_names 4000 /* number of identifiers, strings, section names;
67 must be less than 10240; used in |"common.w"| */
68 @d max_texts 2500 /* number of replacement texts, must be less than 10240 */
69 @d hash_size 353 /* should be prime; used in |"common.w"| */
70 @d longest_name 10000 /* section names shouldn't be longer than this */
71 @d stack_size 50 /* number of simultaneous levels of macro expansion */
72 @d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
80 typedef struct name_info {
81 char *byte_start; /* beginning of the name in |byte_mem| */
82 struct name_info *link;
84 struct name_info *Rlink; /* right link in binary search tree for section
86 char Ilk; /* used by identifiers in \.{CWEAVE} only */
88 char *equiv_or_xref; /* info corresponding to names */
89 } name_info; /* contains information about an identifier or section name */
90 typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
91 typedef name_pointer *hash_pointer;
92 extern char byte_mem[]; /* characters of names */
93 extern char *byte_mem_end; /* end of |byte_mem| */
94 extern name_info name_dir[]; /* information about names */
95 extern name_pointer name_dir_end; /* end of |name_dir| */
96 extern name_pointer name_ptr; /* first unused position in |name_dir| */
97 extern char *byte_ptr; /* first unused position in |byte_mem| */
98 extern name_pointer hash[]; /* heads of hash lists */
99 extern hash_pointer hash_end; /* end of |hash| */
100 extern hash_pointer h; /* index into hash-head array */
101 extern name_pointer id_lookup(); /* looks up a string in the identifier table */
102 extern name_pointer section_lookup(); /* finds section name */
103 extern void print_section_name(), sprint_section_name();
110 typedef struct name_info {
111 char huge* byte_start; /* beginning of the name in |byte_mem| */
112 struct name_info *link;
114 struct name_info *Rlink; /* right link in binary search tree for section
116 char Ilk; /* used by identifiers in \.{CWEAVE} only */
120 char huge* xref_member;
121 } ptr_union; /* info corresponding to names */
122 } name_info; /* contains information about an identifier or section name */
123 typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
124 typedef name_pointer *hash_pointer;
125 extern char huge byte_mem[]; /* characters of names */
126 extern char huge* byte_mem_end; /* end of |byte_mem| */
127 extern name_info name_dir[]; /* information about names */
128 extern name_pointer name_dir_end; /* end of |name_dir| */
129 extern name_pointer name_ptr; /* first unused position in |name_dir| */
130 extern char huge* byte_ptr; /* first unused position in |byte_mem| */
131 extern name_pointer hash[]; /* heads of hash lists */
132 extern hash_pointer hash_end; /* end of |hash| */
133 extern hash_pointer h; /* index into hash-head array */
134 extern name_pointer id_lookup(); /* looks up a string in the identifier table */
135 extern name_pointer section_lookup(); /* finds section name */
136 extern void print_section_name(), sprint_section_name();
141 eight_bits *tok_start; /* pointer into |tok_mem| */
142 sixteen_bits text_link; /* relates replacement texts */
144 typedef text *text_pointer;
146 eight_bits huge* tok_start; /* pointer into |tok_mem| */
147 sixteen_bits text_link; /* relates replacement texts */
149 typedef text *text_pointer;
154 eight_bits tok_mem[max_toks];
155 eight_bits *tok_mem_end=tok_mem+max_toks-1;
156 eight_bits *tok_ptr; /* first unused position in |tok_mem| */
158 eight_bits huge tok_mem[max_toks];
159 eight_bits huge* tok_mem_end;
160 eight_bits huge* tok_ptr; /* first unused position in |tok_mem| */
165 text_info->tok_start=tok_ptr=tok_mem;
166 text_ptr=text_info+1; text_ptr->tok_start=tok_mem;
167 /* this makes replacement text 0 of length zero */
169 tok_mem_end=tok_mem+max_toks-1;
170 text_info->tok_start=tok_ptr=tok_mem;
171 text_ptr=text_info+1; text_ptr->tok_start=tok_mem;
172 /* this makes replacement text 0 of length zero */
177 @d equiv equiv_or_xref /* info corresponding to names */
179 @d equiv ptr_union.equiv_member /* info corresponding to names */
184 eight_bits *end_field; /* ending location of replacement text */
185 eight_bits *byte_field; /* present location within replacement text */
187 eight_bits huge* end_field; /* ending location of replacement text */
188 eight_bits huge* byte_field; /* present location within replacement text */
196 char *j, *k; /* pointer into |byte_mem| */
201 char huge* j, huge* k; /* pointer into |byte_mem| */