New fixinc template

Bruce Korb bkorb@pacbell.net
Sat Apr 28 16:41:00 GMT 2001


Per RMS, attached is a new version of fixincl.tpl that will
require AutoGen version 5.  I plan to install it in a week
or two.  AutoGen is not yet installed in the gnu.org ftp
directories yet, so in the interim, please use SourceForge:

  http://autogen.sourceforge.net/autogen/autogen-5.1.5.tar.gz
[= autogen5 template -*- Mode: text -*-
x=fixincl.x =]
/*
 *  DO NOT EDIT THIS FILE - it has been generated
 *
 * Install modified versions of certain ANSI-incompatible system header
 * files which are fixed to work correctly with ANSI C and placed in a
 * directory that GNU C will search.
 *
 * This file contains [=(count "fix")=] fixup descriptions.
 *
 * See README for more information.
 *
 *  inclhack copyright (c) 1998, 1999, 2000, 2001
 *  The Free Software Foundation, Inc.
 *
[=
 (define re-ct 0)
 (define max-mach 0)
 (define ct 0)
 (define Hack-Name "")
 (define HACK-NAME "")
 (gpl "inclhack" " *  ")=]
 */[=

FOR fix =][=
  (set! Hack-Name (string-capitalize! (get "hackname")))
  (set! HACK-NAME (string-upcase!     (get "hackname")))  =]
/* * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  Description of [=(. Hack-Name)=] fix
 */[=

# Note that this is not just for debugging purposes, but in case
  some C fix wishes to refer to the regexps it is paired with.
  See commentary at the top of fixfixes.c.
=]
#define [=(sprintf "%-32s" (string-append HACK-NAME "_FIXIDX"))
        =] [=(for-index)=]
tSCC z[=(. Hack-Name)=]Name[] =
     [=(kr-string (get "hackname"))=];

/*
 *  File name selection pattern
 */[=

  IF (exist? "files")=]
tSCC z[=(. Hack-Name)=]List[] =
  "[=FOR files =]|[=files=][=ENDFOR=]|";[=

  ELSE =]
#define z[=(. Hack-Name)=]List (char*)NULL[=
  ENDIF "files _exist" =]
/*
 *  Machine/OS name selection pattern
 */[=

  IF (exist? "mach")=]
tSCC* apz[=(. Hack-Name)=]Machs[] = {[=
    (set! ct 0) =][=

    FOR mach =]
        [=(kr-string (get "mach"))=],[=
        (set! ct (+ ct (len "mach") 5)) =][=
    ENDFOR=]
        (const char*)NULL };[=

    (set! max-mach (max ct max-mach)) =][=
  ELSE =]
#define apz[=(. Hack-Name)=]Machs (const char**)NULL[=
  ENDIF "files _exist" =][=

  IF (exist? "select")=]

/*
 *  content selection pattern - do fix if pattern found
 */[=
    FOR select =]
tSCC z[=(. Hack-Name)=]Select[=(for-index)=][] =
       [=(kr-string (get "select"))=];[=
    ENDFOR =][=
  ENDIF =][=

  IF (exist? "bypass")=]

/*
 *  content bypass pattern - skip fix if pattern found
 */[=
    FOR bypass =]
tSCC z[=(. Hack-Name)=]Bypass[=(for-index)=][] =
       [=(kr-string (get "bypass"))=];[=
    ENDFOR =][=
  ENDIF =][=

  IF (exist? "test")=]

/*
 *  perform the 'test' shell command - do fix on success
 */[=
    FOR test =]
tSCC z[=(. Hack-Name)=]Test[=(for-index)=][] =
       [=(kr-string (get "test"))=];[=
    ENDFOR =][=
  ENDIF =][=

  IF (exist? "c_test") =]

/*
 *  perform the C function call test
 */[=
    FOR c_test =]
tSCC z[=(. Hack-Name)=]FTst[=(for-index)=][] = "[=c_test=]";[=
    ENDFOR =][=
  ENDIF =][=


#  Build the array of test descriptions for this fix: =][=

  IF (or (exist? "select")
         (exist? "bypass")
         (exist? "test")
         (exist? "c_test"))
=]

#define    [=(. HACK-NAME) =]_TEST_CT  [=
           (+ (count "select") (count "bypass")
              (count "test") (count "c_test")) =][=
(set! re-ct (+ re-ct (count "select") (count "bypass"))) =]
static tTestDesc a[=(. Hack-Name)=]Tests[] = {[=

    FOR test =]
  { TT_TEST,     z[=(. Hack-Name)=]Test[=(for-index)=],   0 /* unused */ },[=
    ENDFOR =][=

    FOR c_test =]
  { TT_FUNCTION, z[=(. Hack-Name)=]FTst[=(for-index)=],   0 /* unused */ },[=
    ENDFOR =][=

    FOR bypass =]
  { TT_NEGREP,   z[=(. Hack-Name)=]Bypass[=(for-index)=], (regex_t*)NULL },[=
    ENDFOR =][=

    FOR select =]
  { TT_EGREP,    z[=(. Hack-Name)=]Select[=(for-index)=], (regex_t*)NULL },[=
    ENDFOR =] };[=
  ELSE =]
#define [=(. HACK-NAME)=]_TEST_CT  0
#define a[=(. Hack-Name)=]Tests   (tTestDesc*)NULL[=
  ENDIF =]

/*
 *  Fix Command Arguments for [=(. Hack-Name)=]
 */
static const char* apz[=(. Hack-Name)=]Patch[] = {[=
    IF  (exist? "sed") =] "sed"[=
      FOR sed=],
    "-e", [=(kr-string (get "sed"))=][=
      ENDFOR=],[=

    ELIF (exist? "shell") =] "sh", "-c",
    [=(kr-string (get "shell"))=],[=

    ELIF (exist? "c_fix") =]
    [=(kr-string (get "c_fix"))=],[=

      FOR c_fix_arg =]
    [=(kr-string (get "c_fix_arg"))=],[=
      ENDFOR =][=

    ELIF (> (len "replace") 0) =]
[=(kr-string (get "replace"))=],[=

    ENDIF=]
    (char*)NULL };
[=

ENDFOR -- fix

=]

/* * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  List of all fixes
 */[=
#  MACH_LIST_SIZE_LIMIT is the size of the buffer used to format the
   command for determining whether or not the machine type matches
   the machine types for a particular fix.  We allow for whatever
   is needed by the largest list of machine types, plus some spare.
   As of this writing, 49 bytes are needed by the case statement format.
   We also must allow for the size of the target machine machine name.
   This allows for a 79 byte machine name.  Better be enough.
=]
#define REGEX_COUNT          [=(. re-ct)=]
#define MACH_LIST_SIZE_LIMIT [=(+ max-mach 128)=]
#define FIX_COUNT            [=(count "fix")=]

tFixDesc fixDescList[ FIX_COUNT ] = {[=


FOR fix ",\n" =][=
  (set! Hack-Name (string-capitalize! (get "hackname")))
  (set! HACK-NAME (string-upcase!     (get "hackname")))  =]
  {  z[=(. Hack-Name)=]Name,    z[=(. Hack-Name)=]List,
     apz[=(. Hack-Name)=]Machs,
     [=(. HACK-NAME)=]_TEST_CT, [=
       IF (exist? "not_machine")   =]FD_MACH_IFNOT[=
       ELSE                        =]FD_MACH_ONLY[=
       ENDIF =][=
       IF    (exist? "shell")   =] | FD_SHELL_SCRIPT[=
       ELIF  (exist? "c_fix")   =] | FD_SUBROUTINE[=
       ELIF  (exist? "replace") =] | FD_REPLACEMENT[=
       ENDIF =],
     a[=(. Hack-Name)=]Tests,   apz[=(. Hack-Name)=]Patch, 0 }[=

ENDFOR fix=]
};


More information about the Gcc-patches mailing list