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