Commit 5c0d5b94 by Zack Weinberg Committed by Zack Weinberg

Makefile.in: Correct dependencies of fixincl and fixincl.o.

	* fixinc/Makefile.in: Correct dependencies of fixincl and fixincl.o.
	* fixinc/fixfixes.c (IO_use, CTRL_use, IO_defn, CTRL_defn): New fixes.
	(fix_char_macro_defines, fix_char_macro_uses): New functions.

	* fixinc/fixlib.c (is_cxx_header): Do the text scan with a regexp.
	Recognize Emacs mode markers also.
	* fixinc/fixtests.c (else_endif_label): Fix bug in recognition of
	C++ comments in C++ headers.  Call is_cxx_header only if
	necessary.

	* fixinc/inclhack.def (avoid_bool): Add select for the problem and
	bypass for ncurses.
	(bsd43_io_macros, io_def_quotes, ioctl_fix_ctrl): Replace with...
	(io_def_quotes, io_use_quotes, ctrl_def_quotes, ctrl_use_quotes):
	... these, which use the new C fixes.
	(math_exception): Escape literal '+' in bypass expression.

	* fixinc/fixincl.x, fixinc/fixincl.sh, fixinc/inclhack.sh:
	Regenerate.

From-SVN: r31512
parent 5170877a
2000-01-19 Zack Weinberg <zack@wolery.cumb.org>
* fixinc/Makefile.in: Correct dependencies of fixincl and fixincl.o.
* fixinc/fixfixes.c (IO_use, CTRL_use, IO_defn, CTRL_defn): New fixes.
(fix_char_macro_defines, fix_char_macro_uses): New functions.
* fixinc/fixlib.c (is_cxx_header): Do the text scan with a regexp.
Recognize Emacs mode markers also.
* fixinc/fixtests.c (else_endif_label): Fix bug in recognition of
C++ comments in C++ headers. Call is_cxx_header only if
necessary.
* fixinc/inclhack.def (avoid_bool): Add select for the problem and
bypass for ncurses.
(bsd43_io_macros, io_def_quotes, ioctl_fix_ctrl): Replace with...
(io_def_quotes, io_use_quotes, ctrl_def_quotes, ctrl_use_quotes):
... these, which use the new C fixes.
(math_exception): Escape literal '+' in bypass expression.
* fixinc/fixincl.x, fixinc/fixincl.sh, fixinc/inclhack.sh:
Regenerate.
2000-01-19 Geoff Keating <geoffk@cygnus.com> 2000-01-19 Geoff Keating <geoffk@cygnus.com>
* rtlanal.c (reg_referenced_p): A CLOBBER of a MEM uses any REGs * rtlanal.c (reg_referenced_p): A CLOBBER of a MEM uses any REGs
......
...@@ -76,7 +76,7 @@ gen : $(SH_TARGET) fixincl.x ...@@ -76,7 +76,7 @@ gen : $(SH_TARGET) fixincl.x
$(FIOBJ): $(HDR) $(FIOBJ): $(HDR)
fixincl: $(FIOBJ) fixfixes fixtests fixincl: $(FIOBJ)
@echo $(CC) -o $@ $(FIOBJ) $(LIBERTY) $(LIB) ; \ @echo $(CC) -o $@ $(FIOBJ) $(LIBERTY) $(LIB) ; \
if $(CC) -o $@ $(FIOBJ) $(LIBERTY) $(LIB) ; then : ; else \ if $(CC) -o $@ $(FIOBJ) $(LIBERTY) $(LIB) ; then : ; else \
rm -f $@ ; (echo "#! /bin/sh" ; echo exit 1 ) > $@ ; \ rm -f $@ ; (echo "#! /bin/sh" ; echo exit 1 ) > $@ ; \
...@@ -94,7 +94,7 @@ gnu-regex.o: gnu-regex.c ...@@ -94,7 +94,7 @@ gnu-regex.o: gnu-regex.c
-$(CC) $(CFLAGS) $(FIXINC_DEFS) $(INCLUDES) -DREGEX_MALLOC \ -$(CC) $(CFLAGS) $(FIXINC_DEFS) $(INCLUDES) -DREGEX_MALLOC \
-c $(srcdir)/gnu-regex.c -c $(srcdir)/gnu-regex.c
fixincl.o : fixincl.x fixincl.c fixincl.o : fixincl.x fixincl.c fixfixes.c fixtests.c
server.o : server.c server.h server.o : server.c server.h
procopen.o : procopen.c server.h procopen.o : procopen.c server.h
......
...@@ -73,7 +73,11 @@ typedef struct { ...@@ -73,7 +73,11 @@ typedef struct {
#define FIXUP_TABLE \ #define FIXUP_TABLE \
_FT_( "no_double_slash", double_slash_fix ) \ _FT_( "no_double_slash", double_slash_fix ) \
_FT_( "else_endif_label", else_endif_label_fix ) _FT_( "else_endif_label", else_endif_label_fix ) \
_FT_( "IO_use", IO_use_fix ) \
_FT_( "CTRL_use", CTRL_use_fix) \
_FT_( "IO_defn", IO_defn_fix ) \
_FT_( "CTRL_defn", CTRL_defn_fix )
#define FIX_PROC_HEAD( fix ) \ #define FIX_PROC_HEAD( fix ) \
...@@ -354,6 +358,196 @@ FIX_PROC_HEAD( else_endif_label_fix ) ...@@ -354,6 +358,196 @@ FIX_PROC_HEAD( else_endif_label_fix )
return; return;
} }
/* Scan the input file for all occurrences of text like this:
#define TIOCCONS _IO(T, 12)
and change them to read like this:
#define TIOCCONS _IO('T', 12)
which is the required syntax per the C standard. (The definition of
_IO also has to be tweaked - see below.) 'IO' is actually whatever you
provide in the STR argument. */
void
fix_char_macro_uses (text, str)
const char *text;
const char *str;
{
/* This regexp looks for a traditional-syntax #define (# in column 1)
of an object-like macro. */
static const char pat[] =
"^#[ \t]*define[ \t]+[A-Za-z][A-Za-z0-9]*[ \t]+";
static regex_t re;
regmatch_t rm[1];
const char *p, *limit;
size_t len = strlen (str);
compile_re (pat, &re, 1, "macro pattern", "fix_char_macro_uses");
for (p = text;
regexec (&re, p, 1, rm, 0) == 0;
p = limit + 1)
{
/* p + rm[0].rm_eo is the first character of the macro replacement.
Find the end of the macro replacement, and the STR we were
sent to look for within the replacement. */
p += rm[0].rm_eo;
limit = p - 1;
do
{
limit = strchr (limit + 1, '\n');
if (!limit)
goto done;
}
while (limit[-1] == '\\');
do
{
if (*p == str[0] && !strncmp (p+1, str+1, len-1))
goto found;
}
while (++p < limit - len);
/* Hit end of line. */
continue;
found:
/* Found STR on this line. If the macro needs fixing,
the next few chars will be whitespace or uppercase,
then an open paren, then a single letter. */
while ((isspace (*p) || isupper (*p)) && p < limit) p++;
if (*p++ != '(')
continue;
if (!isalpha (*p))
continue;
if (isalnum (p[1]) || p[1] == '_')
continue;
/* Splat all preceding text into the output buffer,
quote the character at p, then proceed. */
fwrite (text, 1, p - text, stdout);
putchar ('\'');
putchar (*p);
putchar ('\'');
text = p + 1;
}
done:
fputs (text, stdout);
}
/* Scan the input file for all occurrences of text like this:
#define _IO(x, y) ('x'<<16+y)
and change them to read like this:
#define _IO(x, y) (x<<16+y)
which is the required syntax per the C standard. (The uses of _IO
also have to be tweaked - see above.) 'IO' is actually whatever
you provide in the STR argument. */
void
fix_char_macro_defines (text, str)
const char *text;
const char *str;
{
/* This regexp looks for any traditional-syntax #define (# in column 1). */
static const char pat[] =
"^#[ \t]*define[ \t]+";
static regex_t re;
regmatch_t rm[1];
const char *p, *limit;
size_t len = strlen (str);
char arg;
compile_re (pat, &re, 1, "macro pattern", "fix_char_macro_defines");
for (p = text;
regexec (&re, p, 1, rm, 0) == 0;
p = limit + 1)
{
/* p + rm[0].rm_eo is the first character of the macro name.
Find the end of the macro replacement, and the STR we were
sent to look for within the name. */
p += rm[0].rm_eo;
limit = p - 1;
do
{
limit = strchr (limit + 1, '\n');
if (!limit)
goto done;
}
while (limit[-1] == '\\');
do
{
if (*p == str[0] && !strncmp (p+1, str+1, len-1))
goto found;
}
while (isalpha (*p) || isalnum (*p) || *p == '_');
/* Hit end of macro name without finding the string. */
continue;
found:
/* Found STR in this macro name. If the macro needs fixing,
there may be a few uppercase letters, then there will be an
open paren with _no_ intervening whitespace, and then a
single letter. */
while (isupper (*p) && p < limit) p++;
if (*p++ != '(')
continue;
if (!isalpha (*p))
continue;
if (isalnum (p[1]) || p[1] == '_')
continue;
/* The character at P is the one to look for in the following
text. */
arg = *p;
p += 2;
while (p < limit)
{
if (p[-1] == '\'' && p[0] == arg && p[1] == '\'')
{
/* Remove the quotes from this use of ARG. */
p--;
fwrite (text, 1, p - text, stdout);
putchar (arg);
p += 3;
text = p;
}
else
p++;
}
}
done:
fputs (text, stdout);
}
/* The various prefixes on these macros are handled automatically
because the fixers don't care where they start matching. */
FIX_PROC_HEAD( IO_use_fix )
{
fix_char_macro_uses (text, "IO");
}
FIX_PROC_HEAD( CTRL_use_fix )
{
fix_char_macro_uses (text, "CTRL");
}
FIX_PROC_HEAD( IO_defn_fix )
{
fix_char_macro_defines (text, "IO");
}
FIX_PROC_HEAD( CTRL_defn_fix )
{
fix_char_macro_defines (text, "CTRL");
}
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
test for fix selector test for fix selector
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# files which are fixed to work correctly with ANSI C and placed in a # files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search. # directory that GNU C will search.
# #
# This script contains 112 fixup scripts. # This script contains 113 fixup scripts.
# #
# See README-fixinc for more information. # See README-fixinc for more information.
# #
......
...@@ -112,43 +112,27 @@ is_cxx_header (fname, text) ...@@ -112,43 +112,27 @@ is_cxx_header (fname, text)
} }
} not_cxx_name:; } not_cxx_name:;
/* Or it might contain the phrase 'extern "C++"' */ /* Or it might contain one of several phrases which indicate C++ code.
for (;;) Currently recognized are:
extern "C++"
-*- (Mode: )? C++ -*- (emacs mode marker)
template <
*/
{ {
tSCC zExtern[] = "extern"; tSCC cxxpat[] = "\
tSCC zExtCxx[] = "\"C++\""; extern[ \t]*\"C\\+\\+\"|\
tSCC zTemplate[] = "template"; -\\*-[ \t]*([mM]ode:[ \t]*)?[cC]\\+\\+[; \t]*-\\*-|\
template[ \t]*<";
switch (*(text++)) static regex_t cxxre;
{ static int compiled;
case 'e':
/* Check for "extern \"C++\"" */ if (!compiled)
if (strncmp (text, zExtern+1, sizeof( zExtern )-2) != 0) compile_re (cxxpat, &cxxre, 0, "contents check", "is_cxx_header");
break;
text += sizeof( zExtern )-2; if (regexec (&cxxre, text, 0, 0, 0) == 0)
if (! isspace( *(text++)) ) return BOOL_TRUE;
break; }
while (isspace( *text )) text++;
if (strncmp (text, zExtCxx, sizeof (zExtCxx) -1) == 0)
return BOOL_TRUE;
break;
case 't':
/* Check for "template<" */
if (strncmp (text, zTemplate+1, sizeof( zTemplate )-2) != 0)
break;
text += sizeof( zTemplate )-2;
while (isspace( *text )) text++;
if (*text == '<')
return BOOL_TRUE;
break;
case NUL:
goto text_done;
break;
}
} text_done:;
return BOOL_FALSE; return BOOL_FALSE;
} }
......
...@@ -153,9 +153,9 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test ) ...@@ -153,9 +153,9 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
static regex_t label_re; static regex_t label_re;
char ch; char ch;
tCC* pz_next = (char*)NULL; tCC* pz_next;
tCC* all_text = text;
regmatch_t match[2]; regmatch_t match[2];
t_bool file_is_cxx = is_cxx_header( fname, text );
/* /*
This routine may be run many times within a single execution. This routine may be run many times within a single execution.
...@@ -170,20 +170,14 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test ) ...@@ -170,20 +170,14 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
for (;;) /* entire file */ for (;;) /* entire file */
{ {
/* /* Find the next else or endif in the file. */
See if we need to advance to the next candidate directive if (regexec (&label_re, text, 2, match, 0) != 0)
If the scanning pointer passes over the end of the directive, break;
then the directive is inside a comment */ pz_next = text + match[0].rm_eo;
if (pz_next < text)
{ /* Scan from where we are up to that position, to make sure
if (regexec (&label_re, text, 2, match, 0) != 0) we didn't find something in a string or comment. */
break; while (pz_next > text)
pz_next = text + match[0].rm_eo;
}
/*
IF the scan pointer has not reached the directive end, ... */
if (pz_next > text)
{ {
/* /*
Advance the scanning pointer. If we are at the start Advance the scanning pointer. If we are at the start
...@@ -209,34 +203,23 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test ) ...@@ -209,34 +203,23 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
case '\'': case '\'':
text = skip_quote( ch, text ); text = skip_quote( ch, text );
break; break;
} /* switch (ch) */ }
continue; }
} /* if (still shy of directive end) */ if (pz_next < text)
continue;
/* /* We're at the end of a real directive. Check for bogons here. */
The scanning pointer (text) has reached the end of the current for (;;)
directive under test, then check for bogons here */
for (;;) /* bogon check */
{ {
char ch = *(pz_next++); char ch = *(pz_next++);
if (isspace (ch)) switch (ch)
{ {
if (ch == '\n') case '\n':
{ /* It is clean. No bogons on this directive. */
/* goto next_directive;
It is clean. No bogons on this directive */
text = pz_next;
pz_next = (char*)NULL; /* force a new regex search */
break;
}
continue;
}
switch (ch)
{
case '\\': case '\\':
/* /* Skip escaped newlines. Otherwise, we have a bogon. */
Skip escaped newlines. Otherwise, we have a bogon */
if (*pz_next != '\n') if (*pz_next != '\n')
return APPLY_FIX; return APPLY_FIX;
...@@ -244,47 +227,48 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test ) ...@@ -244,47 +227,48 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
break; break;
case '/': case '/':
/* /* Skip comments. Otherwise, we have a bogon */
Skip comments. Otherwise, we have a bogon */ switch (*pz_next)
switch (*pz_next) {
{ case '/':
case '/': /* // in a C header is a bogon. */
/* IF we found a "//" in a C header, THEN fix it. */ if (! is_cxx_header( fname, all_text ))
if (! file_is_cxx)
return APPLY_FIX; return APPLY_FIX;
/* C++ header. Skip to newline and continue. */ /* C++ comment is allowed in a C++ header.
Skip to newline and continue. */
pz_next = strchr( pz_next+1, '\n' ); pz_next = strchr( pz_next+1, '\n' );
if (pz_next == (char*)NULL) if (pz_next == (char*)NULL)
return SKIP_FIX; return SKIP_FIX;
pz_next++; pz_next++;
break; goto next_directive;
case '*': case '*':
/* A comment for either C++ or C. Skip over it. */ /* A comment for either C++ or C. Skip over it. */
pz_next = strstr( pz_next+1, "*/" ); pz_next = strstr( pz_next+1, "*/" );
if (pz_next == (char*)NULL) if (pz_next == (char*)NULL)
return SKIP_FIX; return SKIP_FIX;
pz_next += 2; pz_next += 2;
break; break;
default: default:
/* a '/' followed by other junk. */ return APPLY_FIX;
return APPLY_FIX; }
} break;
break; /* a C or C++ comment */
default: default:
/* if (!isspace (ch))
GOTTA BE A BOGON */ return APPLY_FIX;
return APPLY_FIX;
} /* switch (ch) */ } /* switch (ch) */
} /* for (bogon check loop) */ } /* for (bogon check loop) */
next_directive:;
text = pz_next;
} /* for (entire file) loop */ } /* for (entire file) loop */
return SKIP_FIX; return SKIP_FIX;
} }
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
test for fix selector test for fix selector
......
...@@ -631,6 +631,9 @@ fix = { ...@@ -631,6 +631,9 @@ fix = {
files = term.h; files = term.h;
files = tinfo.h; files = tinfo.h;
select = "char[ \t]+bool|bool[ \t]+char";
bypass = "we must use the C\\+\\+ compiler's type";
sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n" sed = "/^#[ \t]*define[ \t][ \t]*bool[ \t][ \t]*char[ \t]*$/i\\\n"
"#ifndef __cplusplus\n"; "#ifndef __cplusplus\n";
...@@ -749,21 +752,6 @@ fix = { ...@@ -749,21 +752,6 @@ fix = {
/* /*
* Note that BSD43_* are used on recent MIPS systems.
*/
fix = {
hackname = bsd43_io_macros;
select = "BSD43__IO";
/*
* Put single quotes aroung the character that appears after '('
* and before ',', UNLESS it is a 'c' or 'g' or 'x'.
*/
sed = "/[ \t]BSD43__IO[A-Z]*[ \t]*(/" 's/(\(.\),/(\'\1\',/';
sed = "/#[ \t]*define[ \t]*[ \t]BSD43__IO/" 's/\'\([cgx]\)\'/\1/g';
};
/*
* Fix <c_asm.h> on Digital UNIX V4.0: * Fix <c_asm.h> on Digital UNIX V4.0:
* It contains a prototype for a DEC C internal asm() function, * It contains a prototype for a DEC C internal asm() function,
* clashing with gcc's asm keyword. So protect this with __DECC. * clashing with gcc's asm keyword. So protect this with __DECC.
...@@ -970,52 +958,45 @@ fix = { ...@@ -970,52 +958,45 @@ fix = {
}; };
/* /*
* Fix various _IO* defines, but do *not* quote the characters cgxtf. * Fix various macros used to define ioctl numbers. The traditional
* syntax was
* #define _IO(n, x) (('n'<<8)+x)
* #define TIOCFOO _IO(T, 1)
* but this does not work with the C standard, which disallows macro
* expansion inside strings. We have to rewrite it thus:
* #define _IO(n, x) ((n<<8)+x)
* #define TIOCFOO _IO('T', 1)
* The select expressions match too much, but the c_fix code is cautious.
*
* _IO might be: _IO DESIO BSD43__IO with W, R, WR, C, ... suffixes.
*/ */
fix = { fix = {
hackname = io_def_quotes; hackname = io_use_quotes;
select = "[ \t]*[ \t](_|DES)IO[A-Z]*[ \t]*\\( *[^,']"; select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*\\( *[^,']";
sed = "s/\\([ \t]*[ \t]_IO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/"; c_fix = IO_use;
sed = "s/\\([ \t]*[ \t]DESIO[A-Z]*[ \t]*(\\)\\([^,']\\),/\\1'\\2',/";
sed = "/#[ \t]*define[ \t]*[ \t]_IO/" "s/'\\([cgxtf]\\)'/\\1/g";
sed = "/#[ \t]*define[ \t]*[ \t]DESIOC/" 's/\'\([cdgx]\)\'/\1/g';
}; };
fix = {
hackname = io_def_quotes;
select = "define[ \t]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\1'";
c_fix = IO_defn;
};
/* /*
* Fix CTRL macros * Same deal for CTRL() macros.
* * CTRL might be: CTRL _CTRL ISCTRL BSD43_CTRL ...
* Basically, what is supposed to be happening is that every
* _invocation_ of the "_CTRL()" or "CTRL()" macros is supposed to have
* its argument inserted into single quotes. We _must_ do this because
* ANSI macro substitution rules prohibit looking inside quoted strings
* for the substitution names. A side effect is that the quotes are
* inserted in the definitions of those macros as well. So, the last
* several sed expressions are supposed to clean up the definitions, as
* long as those definitions are using "c", "g" or "x" as the macro
* argument :). Yuck.
*/ */
fix = { fix = {
hackname = ioctl_fix_ctrl; hackname = ctrl_use_quotes;
select = "CTRL[ \t]*\\("; select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
c_fix = CTRL_use;
sed = "/[^A-Z0-9_]CTRL[ \t]*(/" };
"s/\\([^']\\))/'\\1')/";
fix = {
sed = "/[^A-Z0-9]_CTRL[ \t]*(/" hackname = ctrl_def_quotes;
"s/\\([^']\\))/'\\1')/"; select = "define[ \t]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\1'";
c_fix = CTRL_defn;
sed = "/#[ \t]*define[ \t]*[ \t]CTRL/"
"s/'\\([cgx]\\)'/\\1/g";
sed = "/#[ \t]*define[ \t]*[ \t]_CTRL/"
"s/'\\([cgx]\\)'/\\1/g";
sed = "/#[ \t]*define[ \t]*[ \t]BSD43_CTRL/"
"s/'\\([cgx]\\)'/\\1/g";
sed = "/#[ \t]*define[ \t]*[ \t][_]*ISCTRL/"
"s/'\\([cgx]\\)'/\\1/g";
}; };
...@@ -1372,7 +1353,7 @@ fix = { ...@@ -1372,7 +1353,7 @@ fix = {
hackname = math_exception; hackname = math_exception;
files = math.h; files = math.h;
select = "struct exception"; select = "struct exception";
bypass = "We have a problem when using C++"; bypass = "We have a problem when using C\\+\\+";
sed = "/struct exception/i\\\n" sed = "/struct exception/i\\\n"
"#ifdef __cplusplus\\\n" "#ifdef __cplusplus\\\n"
"#define exception __math_exception\\\n" "#define exception __math_exception\\\n"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# files which are fixed to work correctly with ANSI C and placed in a # files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search. # directory that GNU C will search.
# #
# This script contains 112 fixup scripts. # This script contains 113 fixup scripts.
# #
# See README-fixinc for more information. # See README-fixinc for more information.
# #
...@@ -1056,6 +1056,10 @@ struct rusage; ...@@ -1056,6 +1056,10 @@ struct rusage;
./curses_colr/curses.h | \ ./curses_colr/curses.h | \
./term.h | \ ./term.h | \
./tinfo.h ) ./tinfo.h )
if ( test -n "`egrep 'char[ ]+bool|bool[ ]+char' ${file}`"
) > /dev/null 2>&1 ; then
if ( test -z "`egrep 'we must use the C\\+\\+ compiler'\\''s type' ${file}`"
) > /dev/null 2>&1 ; then
fixlist="${fixlist} fixlist="${fixlist}
avoid_bool" avoid_bool"
if [ ! -r ${DESTFILE} ] if [ ! -r ${DESTFILE} ]
...@@ -1095,6 +1099,8 @@ struct rusage; ...@@ -1095,6 +1099,8 @@ struct rusage;
< $infile > ${DESTDIR}/fixinc.tmp < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE} rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of bypass 'if'
fi # end of select 'if'
;; # case end for file name test ;; # case end for file name test
esac esac
...@@ -1227,25 +1233,6 @@ struct rusage; ...@@ -1227,25 +1233,6 @@ struct rusage;
# #
# Fix Bsd43_Io_Macros
#
if ( test -n "`egrep 'BSD43__IO' ${file}`"
) > /dev/null 2>&1 ; then
fixlist="${fixlist}
bsd43_io_macros"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi
sed -e '/[ ]BSD43__IO[A-Z]*[ ]*(/s/(\(.\),/('\''\1'\'',/' \
-e '/#[ ]*define[ ]*[ ]BSD43__IO/s/'\''\([cgx]\)'\''/\1/g' \
< $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of select 'if'
#
# Fix Dec_Intern_Asm # Fix Dec_Intern_Asm
# #
case "${file}" in ./c_asm.h ) case "${file}" in ./c_asm.h )
...@@ -1541,44 +1528,64 @@ extern "C" {\ ...@@ -1541,44 +1528,64 @@ extern "C" {\
# #
# Fix Io_Use_Quotes
#
if ( test -n "`egrep 'define[ ]+[A-Z0-9_]+[ ]+[A-Z0-9_]+IO[A-Z]*[ ]*\\( *[^,'\\'']' ${file}`"
) > /dev/null 2>&1 ; then
fixlist="${fixlist}
io_use_quotes"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} IO_use < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of select 'if'
#
# Fix Io_Def_Quotes # Fix Io_Def_Quotes
# #
if ( test -n "`egrep '[ ]*[ ](_|DES)IO[A-Z]*[ ]*\\( *[^,'\\'']' ${file}`" if ( test -n "`egrep 'define[ ]+[A-Z0-9_]+IO[A-Z]*\\(([a-zA-Z]).*'\\''\\1'\\''' ${file}`"
) > /dev/null 2>&1 ; then ) > /dev/null 2>&1 ; then
fixlist="${fixlist} fixlist="${fixlist}
io_def_quotes" io_def_quotes"
if [ ! -r ${DESTFILE} ] if [ ! -r ${DESTFILE} ]
then infile=${file} then infile=${file}
else infile=${DESTFILE} ; fi else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} IO_defn < $infile > ${DESTDIR}/fixinc.tmp
sed -e 's/\([ ]*[ ]_IO[A-Z]*[ ]*(\)\([^,'\'']\),/\1'\''\2'\'',/' \
-e 's/\([ ]*[ ]DESIO[A-Z]*[ ]*(\)\([^,'\'']\),/\1'\''\2'\'',/' \
-e '/#[ ]*define[ ]*[ ]_IO/s/'\''\([cgxtf]\)'\''/\1/g' \
-e '/#[ ]*define[ ]*[ ]DESIOC/s/'\''\([cdgx]\)'\''/\1/g' \
< $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE} rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of select 'if' fi # end of select 'if'
# #
# Fix Ioctl_Fix_Ctrl # Fix Ctrl_Use_Quotes
# #
if ( test -n "`egrep 'CTRL[ ]*\\(' ${file}`" if ( test -n "`egrep 'define[ ]+[A-Z0-9_]+[ ]+[A-Z0-9_]+CTRL[ ]*\\( *[^,'\\'']' ${file}`"
) > /dev/null 2>&1 ; then ) > /dev/null 2>&1 ; then
fixlist="${fixlist} fixlist="${fixlist}
ioctl_fix_ctrl" ctrl_use_quotes"
if [ ! -r ${DESTFILE} ] if [ ! -r ${DESTFILE} ]
then infile=${file} then infile=${file}
else infile=${DESTFILE} ; fi else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} CTRL_use < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of select 'if'
sed -e '/[^A-Z0-9_]CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \
-e '/[^A-Z0-9]_CTRL[ ]*(/s/\([^'\'']\))/'\''\1'\'')/' \ #
-e '/#[ ]*define[ ]*[ ]CTRL/s/'\''\([cgx]\)'\''/\1/g' \ # Fix Ctrl_Def_Quotes
-e '/#[ ]*define[ ]*[ ]_CTRL/s/'\''\([cgx]\)'\''/\1/g' \ #
-e '/#[ ]*define[ ]*[ ]BSD43_CTRL/s/'\''\([cgx]\)'\''/\1/g' \ if ( test -n "`egrep 'define[ ]+[A-Z0-9_]+CTRL\\(([a-zA-Z]).*'\\''\\1'\\''' ${file}`"
-e '/#[ ]*define[ ]*[ ][_]*ISCTRL/s/'\''\([cgx]\)'\''/\1/g' \ ) > /dev/null 2>&1 ; then
< $infile > ${DESTDIR}/fixinc.tmp fixlist="${fixlist}
ctrl_def_quotes"
if [ ! -r ${DESTFILE} ]
then infile=${file}
else infile=${DESTFILE} ; fi
${FIXFIXES} ${file} CTRL_defn < $infile > ${DESTDIR}/fixinc.tmp
rm -f ${DESTFILE} rm -f ${DESTFILE}
mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}
fi # end of select 'if' fi # end of select 'if'
...@@ -2043,7 +2050,7 @@ s/\\+++fixinc_eol+++/\\/g ...@@ -2043,7 +2050,7 @@ s/\\+++fixinc_eol+++/\\/g
case "${file}" in ./math.h ) case "${file}" in ./math.h )
if ( test -n "`egrep 'struct exception' ${file}`" if ( test -n "`egrep 'struct exception' ${file}`"
) > /dev/null 2>&1 ; then ) > /dev/null 2>&1 ; then
if ( test -z "`egrep 'We have a problem when using C++' ${file}`" if ( test -z "`egrep 'We have a problem when using C\\+\\+' ${file}`"
) > /dev/null 2>&1 ; then ) > /dev/null 2>&1 ; then
fixlist="${fixlist} fixlist="${fixlist}
math_exception" math_exception"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment