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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [fixincludes/] [fixincl.tpl] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
[= AutoGen5 Template -*- Mode: C -*-
2
x=fixincl.x =]
3
[= (dne " * " "/* ")=]
4
 */
5
/* DO NOT CVS-MERGE THIS FILE, EITHER [=`date`=]
6
 *
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.
13
 *
14
 * This file contains [=(count "fix")=] fixup descriptions.
15
 *
16
 * See README for more information.
17
 *
18
 *  inclhack copyright (c) 1998, 1999, 2000, 2001
19
 *  The Free Software Foundation, Inc.
20
 *
21
 [=(define re-ct 0) (define max-mach 0) (define ct 0)
22
   (define HACK "") (define Hack "")    (define tmp "")
23
   (gpl "inclhack" " *  ")=]
24
 */
25
[=
26
 
27
FOR fix =]
28
/* * * * * * * * * * * * * * * * * * * * * * * * * *
29
 *
30
 *  Description of [=
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 )) )
35
    (. Hack)=] fix
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
=]
42
tSCC z[=(. Hack)=]Name[] =
43
     "[=hackname=]";
44
 
45
/*
46
 *  File name selection pattern
47
 */[=
48
 
49
  IF (exist? "files")=]
50
tSCC z[=(. Hack)=]List[] =
51
  "[=FOR files =]|[=files=][=ENDFOR=]|";[=
52
 
53
  ELSE =]
54
#define z[=(. Hack)=]List (char*)NULL[=
55
  ENDIF (exist? "files") =]
56
/*
57
 *  Machine/OS name selection pattern
58
 */[=
59
 
60
  IF (exist? "mach")=]
61
tSCC* apz[=(. Hack)=]Machs[] = {[=
62
    (set! ct 0) =][=
63
 
64
    FOR mach =]
65
        [=
66
      (set! tmp (get "mach"))
67
      (set! ct (+ ct (string-length tmp) 5))
68
      (kr-string tmp)=],[=
69
    ENDFOR=]
70
        (const char*)NULL };[=
71
 
72
    (if (> ct max-mach) (set! max-mach ct)) =][=
73
 
74
  ELSE =]
75
#define apz[=(. Hack)=]Machs (const char**)NULL[=
76
  ENDIF (exist? "files") =][=
77
 
78
  IF (exist? "select")=]
79
 
80
/*
81
 *  content selection pattern - do fix if pattern found
82
 */[=
83
    FOR select =]
84
tSCC z[=(. Hack)=]Select[=(for-index)=][] =
85
       [=(kr-string (get "select"))=];[=
86
    ENDFOR select =][=
87
  ENDIF =][=
88
 
89
  IF (exist? "bypass")=]
90
 
91
/*
92
 *  content bypass pattern - skip fix if pattern found
93
 */[=
94
    FOR bypass =]
95
tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
96
       [=(kr-string (get "bypass"))=];[=
97
    ENDFOR bypass =][=
98
  ENDIF =][=
99
 
100
  IF (exist? "test")=]
101
 
102
/*
103
 *  perform the 'test' shell command - do fix on success
104
 */[=
105
    FOR test =]
106
tSCC z[=(. Hack)=]Test[=(for-index)=][] =
107
       [=(kr-string (get "test"))=];[=
108
    ENDFOR  =][=
109
  ENDIF     =][=
110
 
111
  IF (exist? "c_test")=]
112
 
113
/*
114
 *  perform the C function call test
115
 */[=
116
    FOR c_test =]
117
tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
118
    ENDFOR c_test =][=
119
  ENDIF =][=
120
 
121
  IF (set! ct (+ (count "select") (count "bypass")
122
              (count "test") (count "c_test")))
123
 
124
     (= ct 0)
125
=]
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 =][=
145
 
146
    FOR select =]
147
  { TT_EGREP,    z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[=
148
    ENDFOR select =] };[=
149
  ENDIF =]
150
 
151
/*
152
 *  Fix Command Arguments for [=(. Hack)=]
153
 */
154
static const char* apz[=(. Hack)=]Patch[] = {[=
155
    IF   (exist? "sed")=] "sed"[=
156
      FOR sed=],
157
    "-e", [=(kr-string (get "sed"))=][=
158
      ENDFOR sed=],[=
159
 
160
    ELIF (exist? "shell")=] "sh", "-c",
161
    [=(kr-string (get "shell"))=],[=
162
 
163
    ELIF (exist? "c_fix")=]
164
    [=(kr-string (get "c_fix"))=],[=
165
 
166
      FOR c_fix_arg =]
167
    [=(kr-string (get "c_fix_arg"))=],[=
168
      ENDFOR c_fix_arg =][=
169
 
170
    ELIF (> (len "replace") 0) =]
171
[=(kr-string (get "replace"))=],[=
172
 
173
    ENDIF=]
174
    (char*)NULL };
175
[=ENDFOR fix=]
176
 
177
/* * * * * * * * * * * * * * * * * * * * * * * * * *
178
 *
179
 *  List of all fixes
180
 */[=
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
=]
185
#define REGEX_COUNT          [= (. re-ct) =]
186
#define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =]
187
#define FIX_COUNT            [= (count "fix") =]
188
 
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
 
201
tFixDesc fixDescList[ FIX_COUNT ] = {[=
202
 
203
 
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 =]
220
};

powered by: WebSVN 2.1.0

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