1 [= AutoGen5 Template -*- Mode: C -*-
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 "")
10 * You must regenerate it. Use the ./genfixes script.
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.
17 * This file contains [=(count "fix")=] fixup descriptions.
19 * See README for more information.
21 * inclhack copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
23 * The Free Software Foundation, Inc.
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.
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.
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/>.
41 /* * * * * * * * * * * * * * * * * * * * * * * * * *
44 (set! Hack (string-capitalize! (get "hackname")))
45 (set! HACK (string-upcase! (get "hackname")))
46 (if (and (not (exist? "test_text")) (not (exist? "replace")))
47 (error (sprintf "include fix '%s' has no test text" Hack )) )
51 # Note that this is not just for debugging purposes, but in case
52 some C fix wishes to refer to the regexps it is paired with.
53 See commentary at the top of fixfixes.c.
55 tSCC z[=(. Hack)=]Name[] =
59 * File name selection pattern
63 tSCC z[=(. Hack)=]List[] =
64 "[= (join "\\0" (stack "files")) =]\0";[=
67 #define z[=(. Hack)=]List (char*)NULL[=
68 ENDIF (exist? "files") =]
70 * Machine/OS name selection pattern
74 tSCC* apz[=(. Hack)=]Machs[] = {[=
79 (set! tmp (get "mach"))
80 (set! ct (+ ct (string-length tmp) 5))
83 (const char*)NULL };[=
85 (if (> ct max-mach) (set! max-mach ct)) =][=
88 #define apz[=(. Hack)=]Machs (const char**)NULL[=
89 ENDIF (exist? "mach") =][=
91 IF (exist? "select")=]
94 * content selection pattern - do fix if pattern found
97 tSCC z[=(. Hack)=]Select[=(for-index)=][] =
98 [=(kr-string (get "select"))=];[=
102 IF (exist? "bypass")=]
105 * content bypass pattern - skip fix if pattern found
108 tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
109 [=(kr-string (get "bypass"))=];[=
116 * perform the 'test' shell command - do fix on success
119 tSCC z[=(. Hack)=]Test[=(for-index)=][] =
120 [=(kr-string (get "test"))=];[=
124 IF (exist? "c_test")=]
127 * perform the C function call test
130 tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
134 IF (set! ct (+ (count "select") (count "bypass")
135 (count "test") (count "c_test")))
139 #define [=(. HACK)=]_TEST_CT 0
140 #define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
143 #define [=(. HACK)=]_TEST_CT [=(. ct)=][=
144 (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
145 static tTestDesc a[=(. Hack)=]Tests[] = {[=
148 { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
152 { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
156 { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
160 { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
161 ENDFOR select =] };[=
165 * Fix Command Arguments for [=(. Hack)=]
167 static const char* apz[=(. Hack)=]Patch[] = {[=
168 IF (exist? "sed")=] "sed"[=
170 "-e", [=(kr-string (get "sed"))=][=
173 ELIF (exist? "shell")=] "sh", "-c",
174 [=(kr-string (get "shell"))=],[=
176 ELIF (exist? "c_fix")=]
177 [=(kr-string (get "c_fix"))=],[=
180 [=(kr-string (get "c_fix_arg"))=],[=
181 ENDFOR c_fix_arg =][=
183 ELIF (> (len "replace") 0) =]
184 [=(kr-string (get "replace"))=],[=
190 /* * * * * * * * * * * * * * * * * * * * * * * * * *
194 # as of this writing, 49 bytes are needed by the case statement format.
195 We also must allow for the size of the target machine machine name.
196 This allows for a 79 byte machine name. Better be enough.
198 #define REGEX_COUNT [= (. re-ct) =]
199 #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
200 #define FIX_COUNT [= (count "fix") =]
203 * Enumerate the fixes[= # in a way that minimizes diffs :-) =]
208 [=(string-upcase! (get "hackname"))=]_FIXIDX[=
214 tFixDesc fixDescList[ FIX_COUNT ] = {[=
218 (set! Hack (string-capitalize! (get "hackname")))
219 (set! HACK (string-upcase! (get "hackname"))) =]
220 { z[=(. Hack)=]Name, z[=(. Hack)=]List,
221 apz[=(. Hack)=]Machs,
222 [=(. HACK)=]_TEST_CT, [=
223 IF (exist? "not_machine") =]FD_MACH_IFNOT[=
224 ELSE =]FD_MACH_ONLY[=
226 IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
227 ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
228 ELIF (exist? "replace") =] | FD_REPLACEMENT[=
230 a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=