1 [= AutoGen5 Template -*- Mode: C -*-
4 (if (version-compare >= autogen-version "5.18.1")
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 "")
13 * You must regenerate it. Use the ./genfixes script.
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.
20 * This file contains [=(count "fix")=] fixup descriptions.
22 * See README for more information.
24 * inclhack copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
26 * The Free Software Foundation, Inc.
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.
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.
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/>.
42 #define SED_PROGRAM "/usr/bin/sed"
44 static char const sed_cmd_z[] = SED_PROGRAM;
48 /* * * * * * * * * * * * * * * * * * * * * * * * * *
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 )) )
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.
62 tSCC z[=(. Hack)=]Name[] =
66 * File name selection pattern
69 IF (exist? "files") =]
70 tSCC z[=(. Hack)=]List[] =
71 "[= (join "\\0" (stack "files")) =]\0";[=
74 #define z[=(. Hack)=]List (char*)NULL[=
75 ENDIF (exist? "files") =]
77 * Machine/OS name selection pattern
81 tSCC* apz[=(. Hack)=]Machs[] = {[=
86 (set! tmp (get "mach"))
87 (set! ct (+ ct (string-length tmp) 5))
90 (const char*)NULL };[=
92 (if (> ct max-mach) (set! max-mach ct)) =][=
95 #define apz[=(. Hack)=]Machs (const char**)NULL[=
96 ENDIF (exist? "mach") =][=
98 IF (exist? "select")=]
101 * content selection pattern - do fix if pattern found
104 tSCC z[=(. Hack)=]Select[=(for-index)=][] =
105 [=(kr-string (get "select"))=];[=
109 IF (exist? "bypass") =]
112 * content bypass pattern - skip fix if pattern found
115 tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
116 [=(kr-string (get "bypass"))=];[=
120 IF (exist? "sum")=][=
121 (if (not (exist? "files"))
122 (error "specifying a 'sum' requires specifying 'files'"))
126 * file selection - do fix if checksum matches
129 tSCC z[=(. Hack)=]Sum[=(for-index)=][] =
130 [=(kr-string (get "sum"))=];[=
134 IF (exist? "test") =]
137 * perform the 'test' shell command - do fix on success
140 tSCC z[=(. Hack)=]Test[=(for-index)=][] =
141 [=(kr-string (get "test"))=];[=
145 IF (exist? "c_test") =]
148 * perform the C function call test
151 tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
155 IF (set! ct (+ (count "select") (count "bypass")
156 (count "test") (count "c_test")))
160 #define [=(. HACK)=]_TEST_CT 0
161 #define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
164 #define [=(. HACK)=]_TEST_CT [=(. ct)=][=
165 (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
166 static tTestDesc a[=(. Hack)=]Tests[] = {[=
169 { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
173 { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
177 { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
181 { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
185 { TT_CKSUM, z[=(. Hack)=]Sum[=(for-index)=], 0 /* unused */ },[=
190 * Fix Command Arguments for [=(. Hack)=]
192 static const char* apz[=(. Hack)=]Patch[] = {[=
193 IF (exist? "sed")=] sed_cmd_z[=
195 "-e", [=(kr-string (get "sed"))=][=
198 ELIF (exist? "shell")=] "sh", "-c",
199 [=(kr-string (get "shell"))=],[=
201 ELIF (exist? "c_fix")=]
202 [=(kr-string (get "c_fix"))=],[=
205 [=(kr-string (get "c_fix_arg"))=],[=
206 ENDFOR c_fix_arg =][=
208 ELIF (> (len "replace") 0) =]
209 [=(kr-string (get "replace"))=],[=
215 /* * * * * * * * * * * * * * * * * * * * * * * * * *
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.
223 #define REGEX_COUNT [= (. re-ct) =]
224 #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
225 #define FIX_COUNT [= (count "fix") =]
228 * Enumerate the fixes[= # in a way that minimizes diffs :-) =]
233 [=(string-upcase! (get "hackname"))=]_FIXIDX[=
239 tFixDesc fixDescList[ FIX_COUNT ] = {[=
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[=
251 IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
252 ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
253 ELIF (exist? "replace") =] | FD_REPLACEMENT[=
255 a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=