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
|
[= AutoGen5 Template -*- Mode: C -*-
x=fixincl.x =]
[= (dne " * " "/* ")=]
*/
/* DO NOT SVN-MERGE THIS FILE, EITHER [=
(define re-ct 0) (define max-mach 0) (define ct 0)
(define HACK "") (define Hack "") (define tmp "")
(shell "date") =]
*
* You must regenerate it. Use the ./genfixes script.
*
*
* This is part of the fixincl program used to install modified versions of
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
* This file contains [=(count "fix")=] fixup descriptions.
*
* See README for more information.
*
* inclhack copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* 2006, 2007, 2008
* The Free Software Foundation, Inc.
*
* inclhack is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* inclhack is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SED_PROGRAM
#define SED_PROGRAM "/usr/bin/sed"
#endif
static char const sed_cmd_z[] = SED_PROGRAM;
[=
FOR fix =]
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of [=
(set! Hack (string-capitalize! (get "hackname")))
(set! HACK (string-upcase! (get "hackname")))
(if (and (not (exist? "test_text")) (not (exist? "replace")))
(error (sprintf "include fix '%s' has no test text" Hack )) )
(. Hack)=] fix
*/[=
# Note that this is not just for debugging purposes, but in case
some C fix wishes to refer to the regexps it is paired with.
See commentary at the top of fixfixes.c.
=]
tSCC z[=(. Hack)=]Name[] =
"[=hackname=]";
/*
* File name selection pattern
*/[=
IF (exist? "files")=]
tSCC z[=(. Hack)=]List[] =
"[= (join "\\0" (stack "files")) =]\0";[=
ELSE =]
#define z[=(. Hack)=]List (char*)NULL[=
ENDIF (exist? "files") =]
/*
* Machine/OS name selection pattern
*/[=
IF (exist? "mach")=]
tSCC* apz[=(. Hack)=]Machs[] = {[=
(set! ct 0) =][=
FOR mach =]
[=
(set! tmp (get "mach"))
(set! ct (+ ct (string-length tmp) 5))
(kr-string tmp)=],[=
ENDFOR=]
(const char*)NULL };[=
(if (> ct max-mach) (set! max-mach ct)) =][=
ELSE =]
#define apz[=(. Hack)=]Machs (const char**)NULL[=
ENDIF (exist? "mach") =][=
IF (exist? "select")=]
/*
* content selection pattern - do fix if pattern found
*/[=
FOR select =]
tSCC z[=(. Hack)=]Select[=(for-index)=][] =
[=(kr-string (get "select"))=];[=
ENDFOR select =][=
ENDIF =][=
IF (exist? "bypass")=]
/*
* content bypass pattern - skip fix if pattern found
*/[=
FOR bypass =]
tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
[=(kr-string (get "bypass"))=];[=
ENDFOR bypass =][=
ENDIF =][=
IF (exist? "test")=]
/*
* perform the 'test' shell command - do fix on success
*/[=
FOR test =]
tSCC z[=(. Hack)=]Test[=(for-index)=][] =
[=(kr-string (get "test"))=];[=
ENDFOR =][=
ENDIF =][=
IF (exist? "c_test")=]
/*
* perform the C function call test
*/[=
FOR c_test =]
tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
ENDFOR c_test =][=
ENDIF =][=
IF (set! ct (+ (count "select") (count "bypass")
(count "test") (count "c_test")))
(= ct 0)
=]
#define [=(. HACK)=]_TEST_CT 0
#define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
ELSE =]
#define [=(. HACK)=]_TEST_CT [=(. ct)=][=
(set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
static tTestDesc a[=(. Hack)=]Tests[] = {[=
FOR test =]
{ TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
ENDFOR test =][=
FOR c_test =]
{ TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
ENDFOR c_test =][=
FOR bypass =]
{ TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
ENDFOR bypass =][=
FOR select =]
{ TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
ENDFOR select =] };[=
ENDIF =]
/*
* Fix Command Arguments for [=(. Hack)=]
*/
static const char* apz[=(. Hack)=]Patch[] = {[=
IF (exist? "sed")=] sed_cmd_z[=
FOR sed=],
"-e", [=(kr-string (get "sed"))=][=
ENDFOR sed=],[=
ELIF (exist? "shell")=] "sh", "-c",
[=(kr-string (get "shell"))=],[=
ELIF (exist? "c_fix")=]
[=(kr-string (get "c_fix"))=],[=
FOR c_fix_arg =]
[=(kr-string (get "c_fix_arg"))=],[=
ENDFOR c_fix_arg =][=
ELIF (> (len "replace") 0) =]
[=(kr-string (get "replace"))=],[=
ENDIF=]
(char*)NULL };
[=ENDFOR fix=]
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* List of all fixes
*/[=
# as of this writing, 49 bytes are needed by the case statement format.
We also must allow for the size of the target machine machine name.
This allows for a 79 byte machine name. Better be enough.
=]
#define REGEX_COUNT [= (. re-ct) =]
#define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
#define FIX_COUNT [= (count "fix") =]
/*
* Enumerate the fixes[= # in a way that minimizes diffs :-) =]
*/
typedef enum {[=
FOR fix "," =]
[=(string-upcase! (get "hackname"))=]_FIXIDX[=
ENDFOR
=]
} t_fixinc_idx;
tFixDesc fixDescList[ FIX_COUNT ] = {[=
FOR fix ",\n" =][=
(set! Hack (string-capitalize! (get "hackname")))
(set! HACK (string-upcase! (get "hackname"))) =]
{ z[=(. Hack)=]Name, z[=(. Hack)=]List,
apz[=(. Hack)=]Machs,
[=(. HACK)=]_TEST_CT, [=
IF (exist? "not_machine") =]FD_MACH_IFNOT[=
ELSE =]FD_MACH_ONLY[=
ENDIF =][=
IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
ELIF (exist? "replace") =] | FD_REPLACEMENT[=
ENDIF =],
a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=
ENDFOR =]
};
|