1 [= AutoGen5 Template -*- Mode: C -*-
5 /* DO NOT SVN-MERGE THIS FILE, EITHER [=`date`=]
7 * You must regenerate it. Use the ./genfixes script.
10 * This is part of the fixincl program used to install modified versions of
11 * certain ANSI-incompatible system header files which are fixed to work
12 * correctly with ANSI C and placed in a directory that GNU C will search.
14 * This file contains [=(count "fix")=] fixup descriptions.
16 * See README for more information.
18 * inclhack copyright (c) 1998, 1999, 2000, 2001
19 * The Free Software Foundation, Inc.
21 [=(define re-ct 0) (define max-mach 0) (define ct 0)
22 (define HACK "") (define Hack "") (define tmp "")
23 (gpl "inclhack" " * ")=]
28 /* * * * * * * * * * * * * * * * * * * * * * * * * *
31 (set! Hack (string-capitalize! (get "hackname")))
32 (set! HACK (string-upcase! (get "hackname")))
33 (if (and (not (exist? "test_text")) (not (exist? "replace")))
34 (error (sprintf "include fix '%s' has no test text" Hack )) )
38 # Note that this is not just for debugging purposes, but in case
39 some C fix wishes to refer to the regexps it is paired with.
40 See commentary at the top of fixfixes.c.
42 tSCC z[=(. Hack)=]Name[] =
46 * File name selection pattern
50 tSCC z[=(. Hack)=]List[] =
51 "[= (join "\\0" (stack "files")) =]\0";[=
54 #define z[=(. Hack)=]List (char*)NULL[=
55 ENDIF (exist? "files") =]
57 * Machine/OS name selection pattern
61 tSCC* apz[=(. Hack)=]Machs[] = {[=
66 (set! tmp (get "mach"))
67 (set! ct (+ ct (string-length tmp) 5))
70 (const char*)NULL };[=
72 (if (> ct max-mach) (set! max-mach ct)) =][=
75 #define apz[=(. Hack)=]Machs (const char**)NULL[=
76 ENDIF (exist? "mach") =][=
78 IF (exist? "select")=]
81 * content selection pattern - do fix if pattern found
84 tSCC z[=(. Hack)=]Select[=(for-index)=][] =
85 [=(kr-string (get "select"))=];[=
89 IF (exist? "bypass")=]
92 * content bypass pattern - skip fix if pattern found
95 tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
96 [=(kr-string (get "bypass"))=];[=
103 * perform the 'test' shell command - do fix on success
106 tSCC z[=(. Hack)=]Test[=(for-index)=][] =
107 [=(kr-string (get "test"))=];[=
111 IF (exist? "c_test")=]
114 * perform the C function call test
117 tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
121 IF (set! ct (+ (count "select") (count "bypass")
122 (count "test") (count "c_test")))
126 #define [=(. HACK)=]_TEST_CT 0
127 #define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
130 #define [=(. HACK)=]_TEST_CT [=(. ct)=][=
131 (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
132 static tTestDesc a[=(. Hack)=]Tests[] = {[=
135 { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
139 { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
143 { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
147 { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
148 ENDFOR select =] };[=
152 * Fix Command Arguments for [=(. Hack)=]
154 static const char* apz[=(. Hack)=]Patch[] = {[=
155 IF (exist? "sed")=] "sed"[=
157 "-e", [=(kr-string (get "sed"))=][=
160 ELIF (exist? "shell")=] "sh", "-c",
161 [=(kr-string (get "shell"))=],[=
163 ELIF (exist? "c_fix")=]
164 [=(kr-string (get "c_fix"))=],[=
167 [=(kr-string (get "c_fix_arg"))=],[=
168 ENDFOR c_fix_arg =][=
170 ELIF (> (len "replace") 0) =]
171 [=(kr-string (get "replace"))=],[=
177 /* * * * * * * * * * * * * * * * * * * * * * * * * *
181 # as of this writing, 49 bytes are needed by the case statement format.
182 We also must allow for the size of the target machine machine name.
183 This allows for a 79 byte machine name. Better be enough.
185 #define REGEX_COUNT [= (. re-ct) =]
186 #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
187 #define FIX_COUNT [= (count "fix") =]
190 * Enumerate the fixes[= # in a way that minimizes diffs :-) =]
195 [=(string-upcase! (get "hackname"))=]_FIXIDX[=
201 tFixDesc fixDescList[ FIX_COUNT ] = {[=
205 (set! Hack (string-capitalize! (get "hackname")))
206 (set! HACK (string-upcase! (get "hackname"))) =]
207 { z[=(. Hack)=]Name, z[=(. Hack)=]List,
208 apz[=(. Hack)=]Machs,
209 [=(. HACK)=]_TEST_CT, [=
210 IF (exist? "not_machine") =]FD_MACH_IFNOT[=
211 ELSE =]FD_MACH_ONLY[=
213 IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
214 ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
215 ELIF (exist? "replace") =] | FD_REPLACEMENT[=
217 a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=