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/>.
39 #define SED_PROGRAM "/usr/bin/sed"
41 static char const sed_cmd_z[] = SED_PROGRAM;
45 /* * * * * * * * * * * * * * * * * * * * * * * * * *
48 (set! Hack (string-capitalize! (get "hackname")))
49 (set! HACK (string-upcase! (get "hackname")))
50 (if (and (not (exist? "test_text")) (not (exist? "replace")))
51 (error (sprintf "include fix '%s' has no test text" Hack )) )
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.
59 tSCC z[=(. Hack)=]Name[] =
63 * File name selection pattern
67 tSCC z[=(. Hack)=]List[] =
68 "[= (join "\\0" (stack "files")) =]\0";[=
71 #define z[=(. Hack)=]List (char*)NULL[=
72 ENDIF (exist? "files") =]
74 * Machine/OS name selection pattern
78 tSCC* apz[=(. Hack)=]Machs[] = {[=
83 (set! tmp (get "mach"))
84 (set! ct (+ ct (string-length tmp) 5))
87 (const char*)NULL };[=
89 (if (> ct max-mach) (set! max-mach ct)) =][=
92 #define apz[=(. Hack)=]Machs (const char**)NULL[=
93 ENDIF (exist? "mach") =][=
95 IF (exist? "select")=]
98 * content selection pattern - do fix if pattern found
101 tSCC z[=(. Hack)=]Select[=(for-index)=][] =
102 [=(kr-string (get "select"))=];[=
106 IF (exist? "bypass")=]
109 * content bypass pattern - skip fix if pattern found
112 tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
113 [=(kr-string (get "bypass"))=];[=
120 * perform the 'test' shell command - do fix on success
123 tSCC z[=(. Hack)=]Test[=(for-index)=][] =
124 [=(kr-string (get "test"))=];[=
128 IF (exist? "c_test")=]
131 * perform the C function call test
134 tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
138 IF (set! ct (+ (count "select") (count "bypass")
139 (count "test") (count "c_test")))
143 #define [=(. HACK)=]_TEST_CT 0
144 #define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
147 #define [=(. HACK)=]_TEST_CT [=(. ct)=][=
148 (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
149 static tTestDesc a[=(. Hack)=]Tests[] = {[=
152 { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
156 { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
160 { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
164 { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
165 ENDFOR select =] };[=
169 * Fix Command Arguments for [=(. Hack)=]
171 static const char* apz[=(. Hack)=]Patch[] = {[=
172 IF (exist? "sed")=] sed_cmd_z[=
174 "-e", [=(kr-string (get "sed"))=][=
177 ELIF (exist? "shell")=] "sh", "-c",
178 [=(kr-string (get "shell"))=],[=
180 ELIF (exist? "c_fix")=]
181 [=(kr-string (get "c_fix"))=],[=
184 [=(kr-string (get "c_fix_arg"))=],[=
185 ENDFOR c_fix_arg =][=
187 ELIF (> (len "replace") 0) =]
188 [=(kr-string (get "replace"))=],[=
194 /* * * * * * * * * * * * * * * * * * * * * * * * * *
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.
202 #define REGEX_COUNT [= (. re-ct) =]
203 #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
204 #define FIX_COUNT [= (count "fix") =]
207 * Enumerate the fixes[= # in a way that minimizes diffs :-) =]
212 [=(string-upcase! (get "hackname"))=]_FIXIDX[=
218 tFixDesc fixDescList[ FIX_COUNT ] = {[=
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[=
230 IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
231 ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
232 ELIF (exist? "replace") =] | FD_REPLACEMENT[=
234 a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=