0
|
1 [= AutoGen5 Template -*- Mode: C -*-
|
|
2 x=fixincl.x =]
|
111
|
3 [=
|
|
4 (if (version-compare >= autogen-version "5.18.1")
|
|
5 (dne "-D" " * " "/* ")
|
|
6 (dne " * " "/* ") ) =]
|
0
|
7 */
|
|
8 /* DO NOT SVN-MERGE THIS FILE, EITHER [=
|
|
9 (define re-ct 0) (define max-mach 0) (define ct 0)
|
|
10 (define HACK "") (define Hack "") (define tmp "")
|
|
11 (shell "date") =]
|
|
12 *
|
|
13 * You must regenerate it. Use the ./genfixes script.
|
|
14 *
|
|
15 *
|
|
16 * This is part of the fixincl program used to install modified versions of
|
|
17 * certain ANSI-incompatible system header files which are fixed to work
|
|
18 * correctly with ANSI C and placed in a directory that GNU C will search.
|
|
19 *
|
|
20 * This file contains [=(count "fix")=] fixup descriptions.
|
|
21 *
|
|
22 * See README for more information.
|
|
23 *
|
|
24 * inclhack copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
|
25 * 2006, 2007, 2008
|
|
26 * The Free Software Foundation, Inc.
|
|
27 *
|
|
28 * inclhack is free software: you can redistribute it and/or modify it
|
|
29 * under the terms of the GNU General Public License as published by the
|
|
30 * Free Software Foundation, either version 3 of the License, or
|
|
31 * (at your option) any later version.
|
|
32 *
|
|
33 * inclhack is distributed in the hope that it will be useful, but
|
|
34 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
36 * See the GNU General Public License for more details.
|
|
37 *
|
|
38 * You should have received a copy of the GNU General Public License along
|
|
39 * with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
40 */
|
|
41 #ifndef SED_PROGRAM
|
|
42 #define SED_PROGRAM "/usr/bin/sed"
|
|
43 #endif
|
|
44 static char const sed_cmd_z[] = SED_PROGRAM;
|
|
45 [=
|
|
46
|
|
47 FOR fix =]
|
|
48 /* * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
49 *
|
|
50 * Description of [=
|
|
51 (set! Hack (string-capitalize! (get "hackname")))
|
|
52 (set! HACK (string-upcase! (get "hackname")))
|
|
53 (if (and (not (exist? "test_text")) (not (exist? "replace")))
|
|
54 (error (sprintf "include fix '%s' has no test text" Hack )) )
|
|
55 (. Hack)=] fix
|
|
56 */[=
|
|
57
|
|
58 # Note that this is not just for debugging purposes, but in case
|
|
59 some C fix wishes to refer to the regexps it is paired with.
|
|
60 See commentary at the top of fixfixes.c.
|
|
61 =]
|
|
62 tSCC z[=(. Hack)=]Name[] =
|
|
63 "[=hackname=]";
|
|
64
|
|
65 /*
|
|
66 * File name selection pattern
|
|
67 */[=
|
|
68
|
111
|
69 IF (exist? "files") =]
|
0
|
70 tSCC z[=(. Hack)=]List[] =
|
|
71 "[= (join "\\0" (stack "files")) =]\0";[=
|
|
72
|
111
|
73 ELSE =]
|
0
|
74 #define z[=(. Hack)=]List (char*)NULL[=
|
|
75 ENDIF (exist? "files") =]
|
|
76 /*
|
|
77 * Machine/OS name selection pattern
|
|
78 */[=
|
|
79
|
111
|
80 IF (exist? "mach") =]
|
0
|
81 tSCC* apz[=(. Hack)=]Machs[] = {[=
|
|
82 (set! ct 0) =][=
|
|
83
|
111
|
84 FOR mach =]
|
0
|
85 [=
|
|
86 (set! tmp (get "mach"))
|
|
87 (set! ct (+ ct (string-length tmp) 5))
|
|
88 (kr-string tmp)=],[=
|
111
|
89 ENDFOR =]
|
0
|
90 (const char*)NULL };[=
|
|
91
|
|
92 (if (> ct max-mach) (set! max-mach ct)) =][=
|
|
93
|
111
|
94 ELSE =]
|
0
|
95 #define apz[=(. Hack)=]Machs (const char**)NULL[=
|
|
96 ENDIF (exist? "mach") =][=
|
|
97
|
|
98 IF (exist? "select")=]
|
|
99
|
|
100 /*
|
|
101 * content selection pattern - do fix if pattern found
|
|
102 */[=
|
111
|
103 FOR select =]
|
0
|
104 tSCC z[=(. Hack)=]Select[=(for-index)=][] =
|
|
105 [=(kr-string (get "select"))=];[=
|
111
|
106 ENDFOR select =][=
|
|
107 ENDIF =][=
|
0
|
108
|
111
|
109 IF (exist? "bypass") =]
|
0
|
110
|
|
111 /*
|
|
112 * content bypass pattern - skip fix if pattern found
|
|
113 */[=
|
111
|
114 FOR bypass =]
|
0
|
115 tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
|
|
116 [=(kr-string (get "bypass"))=];[=
|
111
|
117 ENDFOR bypass =][=
|
|
118 ENDIF =][=
|
|
119
|
|
120 IF (exist? "sum")=][=
|
|
121 (if (not (exist? "files"))
|
|
122 (error "specifying a 'sum' requires specifying 'files'"))
|
|
123 =]
|
0
|
124
|
111
|
125 /*
|
|
126 * file selection - do fix if checksum matches
|
|
127 */[=
|
|
128 FOR sum =]
|
|
129 tSCC z[=(. Hack)=]Sum[=(for-index)=][] =
|
|
130 [=(kr-string (get "sum"))=];[=
|
|
131 ENDFOR sum =][=
|
|
132 ENDIF =][=
|
|
133
|
|
134 IF (exist? "test") =]
|
0
|
135
|
|
136 /*
|
|
137 * perform the 'test' shell command - do fix on success
|
|
138 */[=
|
111
|
139 FOR test =]
|
0
|
140 tSCC z[=(. Hack)=]Test[=(for-index)=][] =
|
|
141 [=(kr-string (get "test"))=];[=
|
111
|
142 ENDFOR =][=
|
|
143 ENDIF =][=
|
0
|
144
|
111
|
145 IF (exist? "c_test") =]
|
0
|
146
|
|
147 /*
|
|
148 * perform the C function call test
|
|
149 */[=
|
111
|
150 FOR c_test =]
|
0
|
151 tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
|
111
|
152 ENDFOR c_test =][=
|
|
153 ENDIF =][=
|
0
|
154
|
|
155 IF (set! ct (+ (count "select") (count "bypass")
|
|
156 (count "test") (count "c_test")))
|
|
157
|
|
158 (= ct 0)
|
|
159 =]
|
|
160 #define [=(. HACK)=]_TEST_CT 0
|
|
161 #define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
|
|
162 ELSE =]
|
|
163
|
|
164 #define [=(. HACK)=]_TEST_CT [=(. ct)=][=
|
111
|
165 (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
|
0
|
166 static tTestDesc a[=(. Hack)=]Tests[] = {[=
|
|
167
|
111
|
168 FOR test =]
|
0
|
169 { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
|
111
|
170 ENDFOR test =][=
|
0
|
171
|
111
|
172 FOR c_test =]
|
0
|
173 { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
|
111
|
174 ENDFOR c_test =][=
|
0
|
175
|
111
|
176 FOR bypass =]
|
0
|
177 { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
|
111
|
178 ENDFOR bypass =][=
|
0
|
179
|
111
|
180 FOR select =]
|
0
|
181 { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
|
111
|
182 ENDFOR select =][=
|
|
183
|
|
184 FOR sum =]
|
|
185 { TT_CKSUM, z[=(. Hack)=]Sum[=(for-index)=], 0 /* unused */ },[=
|
|
186 ENDFOR sum =] };[=
|
0
|
187 ENDIF =]
|
|
188
|
|
189 /*
|
|
190 * Fix Command Arguments for [=(. Hack)=]
|
|
191 */
|
|
192 static const char* apz[=(. Hack)=]Patch[] = {[=
|
|
193 IF (exist? "sed")=] sed_cmd_z[=
|
|
194 FOR sed=],
|
|
195 "-e", [=(kr-string (get "sed"))=][=
|
|
196 ENDFOR sed=],[=
|
|
197
|
|
198 ELIF (exist? "shell")=] "sh", "-c",
|
|
199 [=(kr-string (get "shell"))=],[=
|
|
200
|
|
201 ELIF (exist? "c_fix")=]
|
|
202 [=(kr-string (get "c_fix"))=],[=
|
|
203
|
|
204 FOR c_fix_arg =]
|
|
205 [=(kr-string (get "c_fix_arg"))=],[=
|
|
206 ENDFOR c_fix_arg =][=
|
|
207
|
|
208 ELIF (> (len "replace") 0) =]
|
|
209 [=(kr-string (get "replace"))=],[=
|
|
210
|
|
211 ENDIF=]
|
|
212 (char*)NULL };
|
|
213 [=ENDFOR fix=]
|
|
214
|
|
215 /* * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
216 *
|
|
217 * List of all fixes
|
|
218 */[=
|
|
219 # as of this writing, 49 bytes are needed by the case statement format.
|
|
220 We also must allow for the size of the target machine machine name.
|
|
221 This allows for a 79 byte machine name. Better be enough.
|
|
222 =]
|
|
223 #define REGEX_COUNT [= (. re-ct) =]
|
|
224 #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
|
|
225 #define FIX_COUNT [= (count "fix") =]
|
|
226
|
|
227 /*
|
|
228 * Enumerate the fixes[= # in a way that minimizes diffs :-) =]
|
|
229 */
|
|
230 typedef enum {[=
|
|
231
|
|
232 FOR fix "," =]
|
|
233 [=(string-upcase! (get "hackname"))=]_FIXIDX[=
|
|
234 ENDFOR
|
|
235
|
|
236 =]
|
|
237 } t_fixinc_idx;
|
|
238
|
|
239 tFixDesc fixDescList[ FIX_COUNT ] = {[=
|
|
240
|
|
241
|
|
242 FOR fix ",\n" =][=
|
|
243 (set! Hack (string-capitalize! (get "hackname")))
|
|
244 (set! HACK (string-upcase! (get "hackname"))) =]
|
|
245 { z[=(. Hack)=]Name, z[=(. Hack)=]List,
|
|
246 apz[=(. Hack)=]Machs,
|
|
247 [=(. HACK)=]_TEST_CT, [=
|
|
248 IF (exist? "not_machine") =]FD_MACH_IFNOT[=
|
|
249 ELSE =]FD_MACH_ONLY[=
|
|
250 ENDIF =][=
|
|
251 IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
|
|
252 ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
|
|
253 ELIF (exist? "replace") =] | FD_REPLACEMENT[=
|
|
254 ENDIF =],
|
|
255 a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=
|
|
256
|
|
257 ENDFOR =]
|
|
258 };
|