summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/tiedir/tie-w2c.ch
blob: 1374d8d648b8aa474773d0a7e5d868a612b2945a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
% Changes to adapt tie to web2c.
% Copyright 2001 by Olaf Weber
% This file is in the Public Domain.

@x Already in cpascal.h.
@d incr(v) v+=1 /* increase a variable by unity */
@d decr(v) v-=1 /* decrease a variable by unity */
@y
@z

@x
@ Furthermore we include the additional types |boolean| and |string|.
@d false 0
@d true 1
@<Global types@>=
typedef int boolean;
typedef char* string;
@y
@ Furthermore we include the additional types |boolean| and |string|.
/* |boolean|, |false|, |true|; |string|; all from \.{<kpathsea/simpletypes.h>} */
@s boolean int
@s string int
@z

@x -- we need more input files.
#define max_file_index 9
/* we don't think that anyone needs more than 9 change files,
@y
#define max_file_index 32
/* we don't think that anyone needs more than 32 change files,
@z

@x
@d print(a)  fprintf(term_out,a) /* `|print|' means write on the terminal */
@y
@d print(a)  fprintf(term_out,"%s",a) /* `|print|' means write on the terminal */
@z

@x
@d print_ln(v)  {fprintf(term_out,v);term_new_line;}
@y
@d print_ln(v)  {fprintf(term_out,"%s",v);term_new_line;}
@z

@x -- add to global includes.
#include <stdio.h>
@y
#include "cpascal.h" /* |decr| and |incr| */
#include <kpathsea/kpathsea.h>
#define usage tieusage /* Also redefine |usage| to avoid clash with function from lib. */
@z

Section 16: Remove redundant #include directives.

@x l.483
This should cause no trouble in any \Cl\ program.
@^system dependencies@>

@<Global |#include|s@>=
#ifdef __STDC__
#include <stdlib.h>
#else
#include <malloc.h>
#endif
@y
This should cause no trouble in any \Cl\ program.
The \.{kpathsea} include files handle the definition of |malloc()|,
too.
@^system dependencies@>
@z

Sections 18 and 19: use enum as requested in tie.w

@x l.530
#define search 0
#define test 1
#define reading 2
#define ignore 3
typedef int in_file_modes; /* should be |enum(search,test,reading,ignore)| */
#define unknown 0
#define master 1
#define chf 2
typedef int file_types; /* should be |enum(unknown,master,chf)| */
@y
typedef enum {
    search,
    test,
    reading,
    ignore } in_file_modes;
typedef enum {
    unknown,
    master,
    chf } file_types;
@z

@x l.548
#define normal 0
#define pre 1
#define post 2
typedef int out_md_type; /* should be |enum(normal,pre,post)| */
@y
typedef enum {
    normal,
    pre,
    post } out_md_type;
@z

@x l.617
void get_line(i)
	file_index i;
@y
static void
get_line (file_index i)
@z

@x l.650
replacement part of a change file, or in an incomplerte check if the
@y
replacement part of a change file, or in an incomplete check if the
@z

@x l.667
   if (c!=@' ' && c!=tab_mark)
@y
   if (c!=@' ' && c!=tab_mark && c!=@'\r')
@z

@x l.745
void err_loc(i) /* prints location of error */
        int i;
@y
static void
err_loc (int i) /* prints location of error */
@z

@x l.790 Use binary mode for output files
    out_file=fopen(out_name,"w");
@y
    out_file=fopen(out_name,"wb");
@z

@x l.811
	  fopen(input_organization[0]->name_of_file,"r");
@y
	  kpse_open_file(input_organization[0]->name_of_file, kpse_web_format);
@z

@x l.830
	fopen(input_organization[i]->name_of_file,"r");
@y
	kpse_open_file(input_organization[i]->name_of_file, kpse_web_format);
@z

@x
boolean lines_dont_match(i,j)
	file_index i,j;
@y
static boolean
lines_dont_match (file_index i, file_index j)
@z

@x
void init_change_file(i,b)
	file_index i; boolean b;
@y
static void
init_change_file (file_index i, boolean b)
@z

@x
void put_line(j)
	file_index j;
@y
static void
put_line (file_index j)
@z

@x
boolean e_of_ch_module(i)
	file_index i;
@y
static boolean
e_of_ch_module (file_index i)
@z

@x
boolean e_of_ch_preamble(i)
	file_index i;
@y
static boolean
e_of_ch_preamble (file_index i)
@z

@x l.1005
a line to write and |test_input| ist set to |none|.
@y
a line to write and |test_input| is set to |none|.
@z

Section 48: fix indentation of nested loop.

@x l.1044
if (prod_chf==chf) {
  loop @+ {
    @<Test for normal, |break| when done@>@;
    @<Test for pre, |break| when done@>@;
    @<Test for post, |break| when done@>@;
  }
} else
@y
if (prod_chf==chf)
  loop @+ {
    @<Test for normal, |break| when done@>@;
    @<Test for pre, |break| when done@>@;
    @<Test for post, |break| when done@>@;
  }
else
@z

@x
void usage()
{
   print("Usage: tie -[mc] outfile master changefile(s)");
@y
static
void usage (void)
{
   print("Usage: tie -m|-c outfile master changefile(s)");
@z

@x l.1169
change files.  The names fo the file parameters will be inserted into
@y
change files.  The names of the file parameters will be inserted into
@z

@x
main(argc,argv)
        int argc; string *argv;
@y
int main (int argc, string *argv)
@z

@x
  print_ln(banner); /* print a ``banner line'' */
  print_ln(copyright); /* include the copyright notice */
@y
  kpse_set_program_name(argv[0], "tie");
  print(banner); /* print a ``banner line'' */
  print_ln(versionstring);  /* Web2C version */
  print_ln(copyright); /* include the copyright notice */
@z

@x l.1256
Additionaly we report the history to the user, although this may not
@y
Additionally we report the history to the user, although this may not
@z

@x
@<Print the job |history|@>=
{string msg;
@y
@s const_string int

@<Print the job |history|@>=
{const_string msg;
@z

@x -- silence unitialized warning
      case fatal: msg="That was a fatal error, my friend";  break;
@y
      default: /* Anything except spotless, troublesome, or fatal is a bug. */
      case fatal: msg="That was a fatal error, my friend";  break;
@z