]>
Commit | Line | Data |
---|---|---|
98c197fe | 1 | [= AutoGen5 Template -*- Mode: C -*- |
88acf854 | 2 | x=fixincl.x =] |
11c3a68e | 3 | [= |
ef19a444 | 4 | (if (version-compare >= autogen-version "5.18.1") |
11c3a68e BK |
5 | (dne "-D" " * " "/* ") |
6 | (dne " * " "/* ") ) =] | |
8882ac3a | 7 | */ |
0fc38aaa BK |
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") =] | |
0083c904 | 12 | * |
8882ac3a BK |
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. | |
0083c904 | 19 | * |
98c197fe | 20 | * This file contains [=(count "fix")=] fixup descriptions. |
0083c904 | 21 | * |
8d8d5752 | 22 | * See README for more information. |
0083c904 | 23 | * |
0fc38aaa BK |
24 | * inclhack copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
25 | * 2006, 2007, 2008 | |
3be1fb72 | 26 | * The Free Software Foundation, Inc. |
7db774d2 | 27 | * |
0fc38aaa BK |
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/>. | |
3be1fb72 | 40 | */ |
6aa1f8c1 BK |
41 | #ifndef SED_PROGRAM |
42 | #define SED_PROGRAM "/usr/bin/sed" | |
43 | #endif | |
44 | static char const sed_cmd_z[] = SED_PROGRAM; | |
98c197fe | 45 | [= |
0083c904 | 46 | |
98c197fe | 47 | FOR fix =] |
3be1fb72 | 48 | /* * * * * * * * * * * * * * * * * * * * * * * * * * |
0083c904 | 49 | * |
98c197fe BK |
50 | * Description of [= |
51 | (set! Hack (string-capitalize! (get "hackname"))) | |
52 | (set! HACK (string-upcase! (get "hackname"))) | |
7b78a14a BK |
53 | (if (and (not (exist? "test_text")) (not (exist? "replace"))) |
54 | (error (sprintf "include fix '%s' has no test text" Hack )) ) | |
98c197fe | 55 | (. Hack)=] fix |
3be1fb72 ZW |
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 | =] | |
98c197fe BK |
62 | tSCC z[=(. Hack)=]Name[] = |
63 | "[=hackname=]"; | |
3be1fb72 | 64 | |
0083c904 BK |
65 | /* |
66 | * File name selection pattern | |
67 | */[= | |
68 | ||
11c3a68e | 69 | IF (exist? "files") =] |
98c197fe | 70 | tSCC z[=(. Hack)=]List[] = |
401be4b6 | 71 | "[= (join "\\0" (stack "files")) =]\0";[= |
0083c904 | 72 | |
11c3a68e | 73 | ELSE =] |
98c197fe BK |
74 | #define z[=(. Hack)=]List (char*)NULL[= |
75 | ENDIF (exist? "files") =] | |
0083c904 BK |
76 | /* |
77 | * Machine/OS name selection pattern | |
78 | */[= | |
79 | ||
11c3a68e | 80 | IF (exist? "mach") =] |
98c197fe BK |
81 | tSCC* apz[=(. Hack)=]Machs[] = {[= |
82 | (set! ct 0) =][= | |
5abc1f74 | 83 | |
11c3a68e | 84 | FOR mach =] |
98c197fe BK |
85 | [= |
86 | (set! tmp (get "mach")) | |
87 | (set! ct (+ ct (string-length tmp) 5)) | |
88 | (kr-string tmp)=],[= | |
11c3a68e | 89 | ENDFOR =] |
0083c904 BK |
90 | (const char*)NULL };[= |
91 | ||
98c197fe | 92 | (if (> ct max-mach) (set! max-mach ct)) =][= |
5abc1f74 | 93 | |
11c3a68e | 94 | ELSE =] |
98c197fe | 95 | #define apz[=(. Hack)=]Machs (const char**)NULL[= |
401be4b6 | 96 | ENDIF (exist? "mach") =][= |
0083c904 | 97 | |
98c197fe | 98 | IF (exist? "select")=] |
0083c904 BK |
99 | |
100 | /* | |
7db774d2 | 101 | * content selection pattern - do fix if pattern found |
0083c904 | 102 | */[= |
11c3a68e | 103 | FOR select =] |
98c197fe BK |
104 | tSCC z[=(. Hack)=]Select[=(for-index)=][] = |
105 | [=(kr-string (get "select"))=];[= | |
11c3a68e BK |
106 | ENDFOR select =][= |
107 | ENDIF =][= | |
0083c904 | 108 | |
11c3a68e | 109 | IF (exist? "bypass") =] |
0083c904 BK |
110 | |
111 | /* | |
7db774d2 | 112 | * content bypass pattern - skip fix if pattern found |
0083c904 | 113 | */[= |
11c3a68e | 114 | FOR bypass =] |
98c197fe BK |
115 | tSCC z[=(. Hack)=]Bypass[=(for-index)=][] = |
116 | [=(kr-string (get "bypass"))=];[= | |
11c3a68e BK |
117 | ENDFOR bypass =][= |
118 | ENDIF =][= | |
119 | ||
120 | IF (exist? "sum")=][= | |
121 | (if (not (exist? "files")) | |
122 | (error "specifying a 'sum' requires specifying 'files'")) | |
123 | =] | |
0083c904 | 124 | |
11c3a68e BK |
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") =] | |
0083c904 BK |
135 | |
136 | /* | |
7db774d2 | 137 | * perform the 'test' shell command - do fix on success |
0083c904 | 138 | */[= |
11c3a68e | 139 | FOR test =] |
98c197fe BK |
140 | tSCC z[=(. Hack)=]Test[=(for-index)=][] = |
141 | [=(kr-string (get "test"))=];[= | |
11c3a68e BK |
142 | ENDFOR =][= |
143 | ENDIF =][= | |
0083c904 | 144 | |
11c3a68e | 145 | IF (exist? "c_test") =] |
5abc1f74 BK |
146 | |
147 | /* | |
148 | * perform the C function call test | |
149 | */[= | |
11c3a68e | 150 | FOR c_test =] |
98c197fe | 151 | tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[= |
11c3a68e BK |
152 | ENDFOR c_test =][= |
153 | ENDIF =][= | |
5abc1f74 | 154 | |
98c197fe BK |
155 | IF (set! ct (+ (count "select") (count "bypass") |
156 | (count "test") (count "c_test"))) | |
7db774d2 | 157 | |
98c197fe | 158 | (= ct 0) |
0083c904 | 159 | =] |
98c197fe BK |
160 | #define [=(. HACK)=]_TEST_CT 0 |
161 | #define a[=(. Hack)=]Tests (tTestDesc*)NULL[= | |
162 | ELSE =] | |
163 | ||
164 | #define [=(. HACK)=]_TEST_CT [=(. ct)=][= | |
11c3a68e | 165 | (set! re-ct (+ re-ct (count "select") (count "bypass"))) =] |
98c197fe BK |
166 | static tTestDesc a[=(. Hack)=]Tests[] = {[= |
167 | ||
11c3a68e | 168 | FOR test =] |
98c197fe | 169 | { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[= |
11c3a68e | 170 | ENDFOR test =][= |
98c197fe | 171 | |
11c3a68e | 172 | FOR c_test =] |
98c197fe | 173 | { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[= |
11c3a68e | 174 | ENDFOR c_test =][= |
98c197fe | 175 | |
11c3a68e | 176 | FOR bypass =] |
98c197fe | 177 | { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[= |
11c3a68e | 178 | ENDFOR bypass =][= |
0083c904 | 179 | |
11c3a68e | 180 | FOR select =] |
98c197fe | 181 | { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[= |
11c3a68e BK |
182 | ENDFOR select =][= |
183 | ||
184 | FOR sum =] | |
185 | { TT_CKSUM, z[=(. Hack)=]Sum[=(for-index)=], 0 /* unused */ },[= | |
186 | ENDFOR sum =] };[= | |
98c197fe | 187 | ENDIF =] |
0083c904 BK |
188 | |
189 | /* | |
98c197fe | 190 | * Fix Command Arguments for [=(. Hack)=] |
0083c904 | 191 | */ |
98c197fe | 192 | static const char* apz[=(. Hack)=]Patch[] = {[= |
6aa1f8c1 | 193 | IF (exist? "sed")=] sed_cmd_z[= |
98c197fe BK |
194 | FOR sed=], |
195 | "-e", [=(kr-string (get "sed"))=][= | |
196 | ENDFOR sed=],[= | |
5abc1f74 | 197 | |
98c197fe BK |
198 | ELIF (exist? "shell")=] "sh", "-c", |
199 | [=(kr-string (get "shell"))=],[= | |
5abc1f74 | 200 | |
98c197fe BK |
201 | ELIF (exist? "c_fix")=] |
202 | [=(kr-string (get "c_fix"))=],[= | |
35dfe415 | 203 | |
98c197fe BK |
204 | FOR c_fix_arg =] |
205 | [=(kr-string (get "c_fix_arg"))=],[= | |
206 | ENDFOR c_fix_arg =][= | |
5abc1f74 | 207 | |
98c197fe BK |
208 | ELIF (> (len "replace") 0) =] |
209 | [=(kr-string (get "replace"))=],[= | |
5abc1f74 | 210 | |
98c197fe | 211 | ENDIF=] |
0083c904 | 212 | (char*)NULL }; |
98c197fe | 213 | [=ENDFOR fix=] |
0083c904 | 214 | |
3be1fb72 | 215 | /* * * * * * * * * * * * * * * * * * * * * * * * * * |
0083c904 BK |
216 | * |
217 | * List of all fixes | |
3be1fb72 | 218 | */[= |
5abc1f74 BK |
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 | =] | |
98c197fe BK |
223 | #define REGEX_COUNT [= (. re-ct) =] |
224 | #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =] | |
225 | #define FIX_COUNT [= (count "fix") =] | |
5abc1f74 | 226 | |
7b78a14a BK |
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 | ||
7db774d2 | 239 | tFixDesc fixDescList[ FIX_COUNT ] = {[= |
0083c904 BK |
240 | |
241 | ||
98c197fe BK |
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 =] | |
0083c904 | 258 | }; |