OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [fixincludes/] [fixincl.tpl] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 724 jeremybenn
[= AutoGen5 Template -*- Mode: C -*-
2
x=fixincl.x =]
3
[= (dne " * " "/* ")=]
4
 */
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 "")
8
   (shell "date") =]
9
 *
10
 * You must regenerate it.  Use the ./genfixes script.
11
 *
12
 *
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.
16
 *
17
 * This file contains [=(count "fix")=] fixup descriptions.
18
 *
19
 * See README for more information.
20
 *
21
 *  inclhack copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
22
 *                         2006, 2007, 2008
23
 *  The Free Software Foundation, Inc.
24
 *
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.
29
 *
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.
34
 *
35
 *  You should have received a copy of the GNU General Public License along
36
 *  with this program.  If not, see .
37
 */
38
#ifndef SED_PROGRAM
39
#define SED_PROGRAM "/usr/bin/sed"
40
#endif
41
static char const sed_cmd_z[] = SED_PROGRAM;
42
[=
43
 
44
FOR fix =]
45
/* * * * * * * * * * * * * * * * * * * * * * * * * *
46
 *
47
 *  Description of [=
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 )) )
52
    (. Hack)=] fix
53
 */[=
54
 
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.
58
=]
59
tSCC z[=(. Hack)=]Name[] =
60
     "[=hackname=]";
61
 
62
/*
63
 *  File name selection pattern
64
 */[=
65
 
66
  IF (exist? "files")=]
67
tSCC z[=(. Hack)=]List[] =
68
  "[=  (join "\\0" (stack "files")) =]\0";[=
69
 
70
  ELSE =]
71
#define z[=(. Hack)=]List (char*)NULL[=
72
  ENDIF (exist? "files") =]
73
/*
74
 *  Machine/OS name selection pattern
75
 */[=
76
 
77
  IF (exist? "mach")=]
78
tSCC* apz[=(. Hack)=]Machs[] = {[=
79
    (set! ct 0) =][=
80
 
81
    FOR mach =]
82
        [=
83
      (set! tmp (get "mach"))
84
      (set! ct (+ ct (string-length tmp) 5))
85
      (kr-string tmp)=],[=
86
    ENDFOR=]
87
        (const char*)NULL };[=
88
 
89
    (if (> ct max-mach) (set! max-mach ct)) =][=
90
 
91
  ELSE =]
92
#define apz[=(. Hack)=]Machs (const char**)NULL[=
93
  ENDIF (exist? "mach") =][=
94
 
95
  IF (exist? "select")=]
96
 
97
/*
98
 *  content selection pattern - do fix if pattern found
99
 */[=
100
    FOR select =]
101
tSCC z[=(. Hack)=]Select[=(for-index)=][] =
102
       [=(kr-string (get "select"))=];[=
103
    ENDFOR select =][=
104
  ENDIF =][=
105
 
106
  IF (exist? "bypass")=]
107
 
108
/*
109
 *  content bypass pattern - skip fix if pattern found
110
 */[=
111
    FOR bypass =]
112
tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
113
       [=(kr-string (get "bypass"))=];[=
114
    ENDFOR bypass =][=
115
  ENDIF =][=
116
 
117
  IF (exist? "test")=]
118
 
119
/*
120
 *  perform the 'test' shell command - do fix on success
121
 */[=
122
    FOR test =]
123
tSCC z[=(. Hack)=]Test[=(for-index)=][] =
124
       [=(kr-string (get "test"))=];[=
125
    ENDFOR  =][=
126
  ENDIF     =][=
127
 
128
  IF (exist? "c_test")=]
129
 
130
/*
131
 *  perform the C function call test
132
 */[=
133
    FOR c_test =]
134
tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
135
    ENDFOR c_test =][=
136
  ENDIF =][=
137
 
138
  IF (set! ct (+ (count "select") (count "bypass")
139
              (count "test") (count "c_test")))
140
 
141
     (= ct 0)
142
=]
143
#define [=(. HACK)=]_TEST_CT  0
144
#define a[=(. Hack)=]Tests   (tTestDesc*)NULL[=
145
  ELSE =]
146
 
147
#define    [=(. HACK)=]_TEST_CT  [=(. ct)=][=
148
        (set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
149
static tTestDesc a[=(. Hack)=]Tests[] = {[=
150
 
151
    FOR test =]
152
  { TT_TEST,     z[=(. Hack)=]Test[=(for-index)=],   0 /* unused */ },[=
153
    ENDFOR test =][=
154
 
155
    FOR c_test =]
156
  { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=],   0 /* unused */ },[=
157
    ENDFOR c_test =][=
158
 
159
    FOR bypass =]
160
  { TT_NEGREP,   z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
161
    ENDFOR bypass =][=
162
 
163
    FOR select =]
164
  { TT_EGREP,    z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
165
    ENDFOR select =] };[=
166
  ENDIF =]
167
 
168
/*
169
 *  Fix Command Arguments for [=(. Hack)=]
170
 */
171
static const char* apz[=(. Hack)=]Patch[] = {[=
172
    IF   (exist? "sed")=] sed_cmd_z[=
173
      FOR sed=],
174
    "-e", [=(kr-string (get "sed"))=][=
175
      ENDFOR sed=],[=
176
 
177
    ELIF (exist? "shell")=] "sh", "-c",
178
    [=(kr-string (get "shell"))=],[=
179
 
180
    ELIF (exist? "c_fix")=]
181
    [=(kr-string (get "c_fix"))=],[=
182
 
183
      FOR c_fix_arg =]
184
    [=(kr-string (get "c_fix_arg"))=],[=
185
      ENDFOR c_fix_arg =][=
186
 
187
    ELIF (> (len "replace") 0) =]
188
[=(kr-string (get "replace"))=],[=
189
 
190
    ENDIF=]
191
    (char*)NULL };
192
[=ENDFOR fix=]
193
 
194
/* * * * * * * * * * * * * * * * * * * * * * * * * *
195
 *
196
 *  List of all fixes
197
 */[=
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.
201
=]
202
#define REGEX_COUNT          [= (. re-ct) =]
203
#define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
204
#define FIX_COUNT            [= (count "fix") =]
205
 
206
/*
207
 *  Enumerate the fixes[= # in a way that minimizes diffs :-) =]
208
 */
209
typedef enum {[=
210
 
211
FOR fix "," =]
212
    [=(string-upcase! (get "hackname"))=]_FIXIDX[=
213
ENDFOR
214
 
215
=]
216
} t_fixinc_idx;
217
 
218
tFixDesc fixDescList[ FIX_COUNT ] = {[=
219
 
220
 
221
FOR fix ",\n" =][=
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[=
229
       ENDIF =][=
230
       IF    (exist? "shell")    =] | FD_SHELL_SCRIPT[=
231
       ELIF  (exist? "c_fix")    =] | FD_SUBROUTINE[=
232
       ELIF  (exist? "replace")  =] | FD_REPLACEMENT[=
233
       ENDIF =],
234
     a[=(. Hack)=]Tests,   apz[=(. Hack)=]Patch, 0 }[=
235
 
236
ENDFOR =]
237
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.