1. the file name lists ought to be restricted to "*.h" anyway 2. C++ files may be named .../[a-z]++/...

1.  the file name lists ought to be restricted to "*.h" anyway
2.  C++ files may be named .../[a-z]++/... also
3.  the original egrep pattern was not finding "__MIPSEL".
    I am not enough of a regexp person to know why.
4.  Adding copyright year and attribution to output
5.  Add copyright date and attribution
6.  Clarify a bunch of comments
7.  Remove dead template text
8.  Correct the counting of regular expressions

From-SVN: r26363
This commit is contained in:
Bruce Korb 1999-04-12 07:11:20 +00:00
parent 96043e7e1c
commit 7db774d2f1
3 changed files with 70 additions and 48 deletions

View File

@ -7,13 +7,15 @@ x =]
* files which are fixed to work correctly with ANSI C and placed in a
* directory that GNU C will search.
*
* This script contains [=_eval fix _count =] fixup scripts.
* This file contains [=_eval fix _count =] fixup descriptions.
*
* See README-fixinc for more information.
*
* inclhack copyright (c) [=_eval "date +%Y" _shell
=] The Free Software Foundation, Inc.
*
[=_eval inclhack "# * " _gpl=]
*[=
*[=_EVAL "re_ct=0" _shell=][=
_FOR fix =]
*
@ -52,7 +54,9 @@ tSCC* apz[=hackname _cap=]Machs[] = {[=
_IF exesel _exist=]
/*
* content selection pattern
* content selection pattern - do fix if pattern found
* This is a special pattern that not all egrep commands
* are capable of coping with. We use the GNU library, tho :)
*/[=
_FOR exesel =]
tSCC z[=hackname _cap=]Select[=_eval _index=][] =
@ -62,7 +66,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] =
_ELIF select _exist=]
/*
* content selection pattern
* content selection pattern - do fix if pattern found
*/[=
_FOR select =]
tSCC z[=hackname _cap=]Select[=_eval _index=][] =
@ -73,7 +77,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] =
_IF bypass _exist=]
/*
* content bypass pattern
* content bypass pattern - skip fix if pattern found
*/[=
_FOR bypass =]
tSCC z[=hackname _cap=]Bypass[=_eval _index=][] =
@ -84,7 +88,7 @@ tSCC z[=hackname _cap=]Bypass[=_eval _index=][] =
_IF test _exist=]
/*
* content test pattern. A shell will deal with it later.
* perform the 'test' shell command - do fix on success
*/[=
_FOR test =]
tSCC z[=hackname _cap=]Test[=_eval _index=][] =
@ -92,41 +96,61 @@ tSCC z[=hackname _cap=]Test[=_eval _index=][] =
/test =][=
_ENDIF =][=
_IF exesel _exist select _exist bypass _exist test _exist | | |
# Build the array of test descriptions for this fix: =][=
_IF exesel _exist
select _exist |
bypass _exist |
test _exist |
=]
#define [=hackname _up =]_TEST_CT [=
_IF exesel _exist =][=
_eval test _count bypass _count exesel _count + + =][=
_eval exesel _count
bypass _count +
test _count + =][=
_ELSE =][=
_eval test _count bypass _count select _count + + =][=
_eval select _count
bypass _count +
test _count + =][=
_ENDIF =]
#define [=hackname _up =]_RE_CT [=
_IF exesel _exist =][=
_eval exesel _count bypass _count
"#2$ct=`expr %d + %d` ; re_ct=`expr $ct + $re_ct` ; echo $ct"
_printf _shell =][=
_ELSE =][=
_eval select _count bypass _count
"#2$ct=`expr %d + %d` ; re_ct=`expr $ct + $re_ct` ; echo $ct"
_printf _shell =][=
_ENDIF =]
tTestDesc a[=hackname _cap=]Tests[] = {[=
_IF test _exist =][=
_FOR test=]
{ TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
/test =][=
_ENDIF =][=
_FOR test =]
{ TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
/test =][=
_IF bypass _exist =][=
_FOR bypass=]
{ TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
/bypass =][=
_ENDIF =][=
_FOR bypass =]
{ TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
/bypass =][=
# IF there is an exesel, then use that (those) selection
expressions, instead of the regular select expressions
=][=
_IF exesel _exist =][=
_FOR exesel ,=]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL }[=
_FOR exesel =]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/exesel =][=
_ELIF select _exist =][=
_FOR select ,=]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL }[=
_ELSE =][=
_FOR select =]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/select =][=
_ENDIF =] };[=
_ELSE =]
#define [=hackname _up=]_TEST_CT 0
#define [=hackname _up=]_RE_CT 0
#define a[=hackname _cap=]Tests (tTestDesc*)NULL[=
_ENDIF =]
@ -136,12 +160,8 @@ tTestDesc a[=hackname _cap=]Tests[] = {[=
const char* apz[=hackname _cap=]Patch[] = {[=
_IF sed _exist =] "sed"[=_FOR sed=],
"-e", [=sed _str=][=/sed=][=
_ELIF replacement _exist =] "sed",
"s@[=select[]=]@[=replacement=]@"[=
_ELIF shell _exist =] "sh", "-c",
[=shell _str=][=
_ELSE =][=_ERROR hackname _get "Error: %s has two fixup specifications"
_printf =][=
_ENDIF=],
(char*)NULL };
@ -150,10 +170,9 @@ const char* apz[=hackname _cap=]Patch[] = {[=
*
* List of all fixes
*/
#define REGEX_COUNT [=_eval fix.select _count
fix.bypass _count + =]
#define REGEX_COUNT [=_eval "echo $re_ct" _shell =]
#define FIX_COUNT [=_eval fix _count =]
tFixDesc fixDescList[ [=_eval fix _count =] ] = {[=
tFixDesc fixDescList[ FIX_COUNT ] = {[=
_FOR fix ",\n" =]

View File

@ -328,11 +328,13 @@ fix = {
fix = {
hackname = no_double_slash;
/*
* Test that the file-to-fix does not look like a C++ file
* Test that the file-to-fix does not from a C++ directory
* Also, only accept double slashes that are not part of URL's
* and are not the end of a quoted string.
*/
test = '-z "`echo ${file}|egrep \'(cxx/|\+\+$|\.hh$|\.H$|\.hxx$)\'`"';
select = '//[^"*]';
sed = '/\/\/[^"*]/' "s|//.*$||g";
test = '-z `echo ${file} | egrep \'(cxx|\+\+)/\' `';
select = '(^|[^:])//[^"*]';
sed = '/\(^|[^:]\)\/\/[^"*]/' "s|//.*$||g";
};
@ -827,14 +829,12 @@ fix = {
exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]"
"("
"M32"
"|_*("
"MIPSE[LB]"
"|SYSTYPE_[A-Z0-9]"
"|[Rr][34]000"
"|host_mips"
"|i386"
"|mips"
")($|[^a-zA-Z0-9_])"
"|_*MIPSE[LB]"
"|_*SYSTYPE_[A-Z0-9]"
"|_*[Rr][34]000"
"|_*host_mips"
"|_*i386"
"|_*mips"
"|bsd4"
"|is68k"
"|m[68]8k"

View File

@ -15,6 +15,9 @@ sh
#
# See README-fixinc for more information.
#
# fixincludes copyright (c) [=_eval "date +%Y" _shell
=] The Free Software Foundation, Inc.
#
[=_eval fixincludes "## " _gpl=]
#
# # # # # # # # # # # # # # # # # # # # #
@ -334,9 +337,9 @@ while [ $# != 0 ]; do
cd ${INPUT}[=
_IF PROGRAM _env ! =]
files=`if $LINKS; then
find ${FIND_BASE}/. \( -type f -o \( -type l -exec test ! -d {} \; \) \) -print
find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
else
find ${FIND_BASE}/. -type f -print
find ${FIND_BASE}/. -name '*.h' -type f -print
fi | \
sed -e 's;/\./;/;g' -e 's;//*;/;g' `
[=
@ -347,9 +350,9 @@ _IF PROGRAM _env ! =]
=]
required="$required `if $LINKS; then
find ${FIND_BASE}/. \( -type f -o -type l \) -print
find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
else
find ${FIND_BASE}/. -type f -print
find ${FIND_BASE}/. -name '*.h' -type f -print
fi | \
sed -e 's;/\./;/;g' -e 's;//*;/;g' | \
${FIXINCL}`"[=