summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/twinx.ch
blob: 00513c0c2c671f2e68a61535bb6d1ec6f8bc7cd4 (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
Changes for the TWINX utility from the CTWILL tarball.

This minimal set of changes tries to satisfy the GCC compiler
and it fixes a few minor issues. See the comments after '@x'.

This file is not copyrighted and can be used freely.

Limbo.

@x l.1
\datethis
@y
\datethis
\let\maybe=\iffalse % print only sections that change
@z

Section 1.

@x l.10 Standard C interface.
#include <stdio.h>
@y
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@z

@x l.15
main(argc,argv)
  int argc;
  char *argv[];
@y
int main(
  int argc,
  char *argv[])
@z

@x l.21
    f=fopen(*++argv,"r");
    if (!f)
@y
    if((f=fopen(*++argv,"r"))==NULL)
@z

@x l.28
      f=fopen(*argv,"r");
      if (!f)
@y
      if((f=fopen(*argv,"r"))==NULL)
@z

Section 3.

@x l.49 Document minor change in behavior.
@ @<Scan file |f|...@>=
@y
@ For your convenience, \.{TWINX} grabs the first ``word'' in \.{\\title} and
turns it into uppercase form.

@<Scan file |f|...@>=
@z

@x l.57 FIX: Fetch only the first word from the '\title'.
    for (p=buf+11,q=title;*p && *p!='}';p++) *q++=*p;
@y
    for (p=buf+11,q=title;*p&&*p!=' '&&*p!='}';p++) *q++=toupper(*p);
@z

Section 4.

@x l.96
@<Type...@>=
@y
@s node_struct int

@<Type...@>=
@z

@x l.102 Compiler warning.
  char *id;
@y
  const char *id;
@z

Section 5.

@x l.115
char *save_string(s)
  char *s;
@y
char *save_string(
  char *s)
@z

Section 6.

@x l.145
node *new_node()
@y
node *new_node(void)
@z

Section 11.

@x l.216 FIX: Don't count masked braces.
    if (*p=='{') bal++;
    else if (*p=='}') bal--;
@y
    switch (*p) {
    case '\\': *q++=*p++; break;
    case '{': bal++; break;
    case '}': bal--; break;
    }
@z

Section 17.

@x l.347
int compare(p,q)
  node *p,*q;
@y
int compare(
  node *p, node *q)
@z

Section 19.

@x l.379 Compiler warning.
  for (j=1;collate[j];j++) ord[collate[j]]=j;
@y
  for (j=1;collate[j];j++) ord[(int)collate[j]]=j;
@z

Section 20.

@x l.390
collapse(p,q)
  node *p,*q;
@y
void collapse(
  node *p, node *q)
@z

Section 22.

@x l.414 Compiler warning.
{@+register char *p=x->id;
@y
{@+register const char *p=x->id;
@z

@x l.434 FIX: Don't mask already masked underscore.
    if (*p=='_') putchar('\\');
@y
    if (*p=='_'&&*(p-1)!='\\') putchar('\\');
@z