]>
Commit | Line | Data |
---|---|---|
98c197fe | 1 | [= AutoGen5 Template -*- Mode: C -*- |
88acf854 | 2 | x=fixincl.x =] |
8882ac3a BK |
3 | [= (dne " * " "/* ")=] |
4 | */ | |
5 | /* DO NOT CVS-MERGE THIS FILE, EITHER [=`date`=] | |
0083c904 | 6 | * |
8882ac3a BK |
7 | * You must regenerate it. Use the ./genfixes script. |
8 | * | |
9 | * | |
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. | |
0083c904 | 13 | * |
98c197fe | 14 | * This file contains [=(count "fix")=] fixup descriptions. |
0083c904 | 15 | * |
8d8d5752 | 16 | * See README for more information. |
0083c904 | 17 | * |
8d8d5752 | 18 | * inclhack copyright (c) 1998, 1999, 2000, 2001 |
3be1fb72 | 19 | * The Free Software Foundation, Inc. |
7db774d2 | 20 | * |
98c197fe BK |
21 | [=(define re-ct 0) (define max-mach 0) (define ct 0) |
22 | (define HACK "") (define Hack "") (define tmp "") | |
23 | (gpl "inclhack" " * ")=] | |
3be1fb72 | 24 | */ |
98c197fe | 25 | [= |
0083c904 | 26 | |
98c197fe | 27 | FOR fix =] |
3be1fb72 | 28 | /* * * * * * * * * * * * * * * * * * * * * * * * * * |
0083c904 | 29 | * |
98c197fe BK |
30 | * Description of [= |
31 | (set! Hack (string-capitalize! (get "hackname"))) | |
32 | (set! HACK (string-upcase! (get "hackname"))) | |
7b78a14a BK |
33 | (if (and (not (exist? "test_text")) (not (exist? "replace"))) |
34 | (error (sprintf "include fix '%s' has no test text" Hack )) ) | |
98c197fe | 35 | (. Hack)=] fix |
3be1fb72 ZW |
36 | */[= |
37 | ||
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. | |
41 | =] | |
98c197fe BK |
42 | tSCC z[=(. Hack)=]Name[] = |
43 | "[=hackname=]"; | |
3be1fb72 | 44 | |
0083c904 BK |
45 | /* |
46 | * File name selection pattern | |
47 | */[= | |
48 | ||
98c197fe BK |
49 | IF (exist? "files")=] |
50 | tSCC z[=(. Hack)=]List[] = | |
51 | "[=FOR files =]|[=files=][=ENDFOR=]|";[= | |
0083c904 | 52 | |
98c197fe BK |
53 | ELSE =] |
54 | #define z[=(. Hack)=]List (char*)NULL[= | |
55 | ENDIF (exist? "files") =] | |
0083c904 BK |
56 | /* |
57 | * Machine/OS name selection pattern | |
58 | */[= | |
59 | ||
98c197fe BK |
60 | IF (exist? "mach")=] |
61 | tSCC* apz[=(. Hack)=]Machs[] = {[= | |
62 | (set! ct 0) =][= | |
5abc1f74 | 63 | |
98c197fe BK |
64 | FOR mach =] |
65 | [= | |
66 | (set! tmp (get "mach")) | |
67 | (set! ct (+ ct (string-length tmp) 5)) | |
68 | (kr-string tmp)=],[= | |
69 | ENDFOR=] | |
0083c904 BK |
70 | (const char*)NULL };[= |
71 | ||
98c197fe | 72 | (if (> ct max-mach) (set! max-mach ct)) =][= |
5abc1f74 | 73 | |
98c197fe BK |
74 | ELSE =] |
75 | #define apz[=(. Hack)=]Machs (const char**)NULL[= | |
76 | ENDIF (exist? "files") =][= | |
0083c904 | 77 | |
98c197fe | 78 | IF (exist? "select")=] |
0083c904 BK |
79 | |
80 | /* | |
7db774d2 | 81 | * content selection pattern - do fix if pattern found |
0083c904 | 82 | */[= |
98c197fe BK |
83 | FOR select =] |
84 | tSCC z[=(. Hack)=]Select[=(for-index)=][] = | |
85 | [=(kr-string (get "select"))=];[= | |
86 | ENDFOR select =][= | |
87 | ENDIF =][= | |
0083c904 | 88 | |
98c197fe | 89 | IF (exist? "bypass")=] |
0083c904 BK |
90 | |
91 | /* | |
7db774d2 | 92 | * content bypass pattern - skip fix if pattern found |
0083c904 | 93 | */[= |
98c197fe BK |
94 | FOR bypass =] |
95 | tSCC z[=(. Hack)=]Bypass[=(for-index)=][] = | |
96 | [=(kr-string (get "bypass"))=];[= | |
97 | ENDFOR bypass =][= | |
98 | ENDIF =][= | |
0083c904 | 99 | |
98c197fe | 100 | IF (exist? "test")=] |
0083c904 BK |
101 | |
102 | /* | |
7db774d2 | 103 | * perform the 'test' shell command - do fix on success |
0083c904 | 104 | */[= |
98c197fe BK |
105 | FOR test =] |
106 | tSCC z[=(. Hack)=]Test[=(for-index)=][] = | |
107 | [=(kr-string (get "test"))=];[= | |
108 | ENDFOR =][= | |
109 | ENDIF =][= | |
0083c904 | 110 | |
98c197fe | 111 | IF (exist? "c_test")=] |
5abc1f74 BK |
112 | |
113 | /* | |
114 | * perform the C function call test | |
115 | */[= | |
98c197fe BK |
116 | FOR c_test =] |
117 | tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[= | |
118 | ENDFOR c_test =][= | |
119 | ENDIF =][= | |
5abc1f74 | 120 | |
98c197fe BK |
121 | IF (set! ct (+ (count "select") (count "bypass") |
122 | (count "test") (count "c_test"))) | |
7db774d2 | 123 | |
98c197fe | 124 | (= ct 0) |
0083c904 | 125 | =] |
98c197fe BK |
126 | #define [=(. HACK)=]_TEST_CT 0 |
127 | #define a[=(. Hack)=]Tests (tTestDesc*)NULL[= | |
128 | ELSE =] | |
129 | ||
130 | #define [=(. HACK)=]_TEST_CT [=(. ct)=][= | |
131 | (set! re-ct (+ re-ct (count "select") (count "bypass"))) =] | |
132 | static tTestDesc a[=(. Hack)=]Tests[] = {[= | |
133 | ||
134 | FOR test =] | |
135 | { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[= | |
136 | ENDFOR test =][= | |
137 | ||
138 | FOR c_test =] | |
139 | { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[= | |
140 | ENDFOR c_test =][= | |
141 | ||
142 | FOR bypass =] | |
143 | { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[= | |
144 | ENDFOR bypass =][= | |
0083c904 | 145 | |
98c197fe BK |
146 | FOR select =] |
147 | { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[= | |
148 | ENDFOR select =] };[= | |
149 | ENDIF =] | |
0083c904 BK |
150 | |
151 | /* | |
98c197fe | 152 | * Fix Command Arguments for [=(. Hack)=] |
0083c904 | 153 | */ |
98c197fe BK |
154 | static const char* apz[=(. Hack)=]Patch[] = {[= |
155 | IF (exist? "sed")=] "sed"[= | |
156 | FOR sed=], | |
157 | "-e", [=(kr-string (get "sed"))=][= | |
158 | ENDFOR sed=],[= | |
5abc1f74 | 159 | |
98c197fe BK |
160 | ELIF (exist? "shell")=] "sh", "-c", |
161 | [=(kr-string (get "shell"))=],[= | |
5abc1f74 | 162 | |
98c197fe BK |
163 | ELIF (exist? "c_fix")=] |
164 | [=(kr-string (get "c_fix"))=],[= | |
35dfe415 | 165 | |
98c197fe BK |
166 | FOR c_fix_arg =] |
167 | [=(kr-string (get "c_fix_arg"))=],[= | |
168 | ENDFOR c_fix_arg =][= | |
5abc1f74 | 169 | |
98c197fe BK |
170 | ELIF (> (len "replace") 0) =] |
171 | [=(kr-string (get "replace"))=],[= | |
5abc1f74 | 172 | |
98c197fe | 173 | ENDIF=] |
0083c904 | 174 | (char*)NULL }; |
98c197fe | 175 | [=ENDFOR fix=] |
0083c904 | 176 | |
3be1fb72 | 177 | /* * * * * * * * * * * * * * * * * * * * * * * * * * |
0083c904 BK |
178 | * |
179 | * List of all fixes | |
3be1fb72 | 180 | */[= |
5abc1f74 BK |
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. | |
184 | =] | |
98c197fe BK |
185 | #define REGEX_COUNT [= (. re-ct) =] |
186 | #define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =] | |
187 | #define FIX_COUNT [= (count "fix") =] | |
5abc1f74 | 188 | |
7b78a14a BK |
189 | /* |
190 | * Enumerate the fixes[= # in a way that minimizes diffs :-) =] | |
191 | */ | |
192 | typedef enum {[= | |
193 | ||
194 | FOR fix "," =] | |
195 | [=(string-upcase! (get "hackname"))=]_FIXIDX[= | |
196 | ENDFOR | |
197 | ||
198 | =] | |
199 | } t_fixinc_idx; | |
200 | ||
7db774d2 | 201 | tFixDesc fixDescList[ FIX_COUNT ] = {[= |
0083c904 BK |
202 | |
203 | ||
98c197fe BK |
204 | FOR fix ",\n" =][= |
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[= | |
212 | ENDIF =][= | |
213 | IF (exist? "shell") =] | FD_SHELL_SCRIPT[= | |
214 | ELIF (exist? "c_fix") =] | FD_SUBROUTINE[= | |
215 | ELIF (exist? "replace") =] | FD_REPLACEMENT[= | |
216 | ENDIF =], | |
217 | a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[= | |
218 | ||
219 | ENDFOR =] | |
0083c904 | 220 | }; |