1 [= AutoGen5 Template -*- Mode: C -*-
4 * DO NOT EDIT THIS FILE - it has been generated
6 * Install modified versions of certain ANSI-incompatible system header
7 * files which are fixed to work correctly with ANSI C and placed in a
8 * directory that GNU C will search.
10 * This file contains [=(count "fix")=] fixup descriptions.
12 * See README for more information.
14 * inclhack copyright (c) 1998, 1999, 2000, 2001
15 * The Free Software Foundation, Inc.
17 [=(define re-ct 0) (define max-mach 0) (define ct 0)
18 (define HACK "") (define Hack "") (define tmp "")
19 (gpl "inclhack" " * ")=]
24 /* * * * * * * * * * * * * * * * * * * * * * * * * *
27 (set! Hack (string-capitalize! (get "hackname")))
28 (set! HACK (string-upcase! (get "hackname")))
29 (if (and (not (exist? "test_text")) (not (exist? "replace")))
30 (error (sprintf "include fix '%s' has no test text" Hack )) )
34 # Note that this is not just for debugging purposes, but in case
35 some C fix wishes to refer to the regexps it is paired with.
36 See commentary at the top of fixfixes.c.
38 tSCC z[=(. Hack)=]Name[] =
42 * File name selection pattern
46 tSCC z[=(. Hack)=]List[] =
47 "[=FOR files =]|[=files=][=ENDFOR=]|";[=
50 #define z[=(. Hack)=]List (char*)NULL[=
51 ENDIF (exist? "files") =]
53 * Machine/OS name selection pattern
57 tSCC* apz[=(. Hack)=]Machs[] = {[=
62 (set! tmp (get "mach"))
63 (set! ct (+ ct (string-length tmp) 5))
66 (const char*)NULL };[=
68 (if (> ct max-mach) (set! max-mach ct)) =][=
71 #define apz[=(. Hack)=]Machs (const char**)NULL[=
72 ENDIF (exist? "files") =][=
74 IF (exist? "select")=]
77 * content selection pattern - do fix if pattern found
80 tSCC z[=(. Hack)=]Select[=(for-index)=][] =
81 [=(kr-string (get "select"))=];[=
85 IF (exist? "bypass")=]
88 * content bypass pattern - skip fix if pattern found
91 tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
92 [=(kr-string (get "bypass"))=];[=
99 * perform the 'test' shell command - do fix on success
102 tSCC z[=(. Hack)=]Test[=(for-index)=][] =
103 [=(kr-string (get "test"))=];[=
107 IF (exist? "c_test")=]
110 * perform the C function call test
113 tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
117 IF (set! ct (+ (count "select") (count "bypass")
118 (count "test") (count "c_test")))
122 #define [=(. HACK)=]_TEST_CT 0
123 #define a[=(. Hack)=]Tests (tTestDesc*)NULL[=
126 #define [=(. HACK)=]_TEST_CT [=(. ct)=][=
127 (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
128 static tTestDesc a[=(. Hack)=]Tests[] = {[=
131 { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[=
135 { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[=
139 { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
143 { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
144 ENDFOR select =] };[=
148 * Fix Command Arguments for [=(. Hack)=]
150 static const char* apz[=(. Hack)=]Patch[] = {[=
151 IF (exist? "sed")=] "sed"[=
153 "-e", [=(kr-string (get "sed"))=][=
156 ELIF (exist? "shell")=] "sh", "-c",
157 [=(kr-string (get "shell"))=],[=
159 ELIF (exist? "c_fix")=]
160 [=(kr-string (get "c_fix"))=],[=
163 [=(kr-string (get "c_fix_arg"))=],[=
164 ENDFOR c_fix_arg =][=
166 ELIF (> (len "replace") 0) =]
167 [=(kr-string (get "replace"))=],[=
173 /* * * * * * * * * * * * * * * * * * * * * * * * * *
177 # as of this writing, 49 bytes are needed by the case statement format.
178 We also must allow for the size of the target machine machine name.
179 This allows for a 79 byte machine name. Better be enough.
181 #define REGEX_COUNT [= (. re-ct) =]
182 #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
183 #define FIX_COUNT [= (count "fix") =]
186 * Enumerate the fixes[= # in a way that minimizes diffs :-) =]
191 [=(string-upcase! (get "hackname"))=]_FIXIDX[=
197 tFixDesc fixDescList[ FIX_COUNT ] = {[=
201 (set! Hack (string-capitalize! (get "hackname")))
202 (set! HACK (string-upcase! (get "hackname"))) =]
203 { z[=(. Hack)=]Name, z[=(. Hack)=]List,
204 apz[=(. Hack)=]Machs,
205 [=(. HACK)=]_TEST_CT, [=
206 IF (exist? "not_machine") =]FD_MACH_IFNOT[=
207 ELSE =]FD_MACH_ONLY[=
209 IF (exist? "shell") =] | FD_SHELL_SCRIPT[=
210 ELIF (exist? "c_fix") =] | FD_SUBROUTINE[=
211 ELIF (exist? "replace") =] | FD_REPLACEMENT[=
213 a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[=