bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DJGPP support for bison


From: Juan Manuel Guerrero
Subject: DJGPP support for bison
Date: Wed, 30 Jan 2002 15:22:00 +0100

I would like to present a patch for DJGPP support for bison.
I do not know which actual CVS branch is the appropiate to base the
patch on, so I have based it on stock bison-1.32.tar.gz
The MSDOS/DJGPP specific issue is the correct handling of output file
name extensions and the fixing at least one DJGPP specific bug in function
skeleton_find() in src/files.c.
DJGPP detects at runtime if a LFN-API is available or not. A DJGPP port
of bison shall use the standard POSIX extensions if it is running in a
DOS session on Win9X or successors where LFN support is available. If no
LFN support is available, like under plain DOS, then the MSDOS specific
extensions, like _tab.c, etc must be used. To achieve this goal minor
modifications to system.h, files.c and getargs.c are needed. The DJGPP
port uses pathconf() to detect at runtime the file system in use. Also
Win9X is case sensitive, so a DJGPP port of bison should not allow
inconditional downcasing of file names.
The patch will modify the files doc/bison.texinfo, src/files.c, src/getargs.c,
and src/system.h and it will create a couple of new DJGPP specific files
needed to configure and compile the sources on plain DOS and Windows. The patch
will create a new directory tree called arch/djgpp and place all djgpp specific
files in the djgpp subdir. configure.in must be changed so the files contained
in this subdir are updated when the sources are released. I am handling this
issue here in the same way this is handled in other gnu packages like texinfo,
sed or grep that come with build-in DJGPP support. The files created are:
  arch/djgpp/config.bat
  arch/djgpp/config.in
  arch/djgpp/config.site
  arch/djgpp/readme.in
  arch/djgpp/Makefile.am
Makefile.am will create updated config.sed from config.in and readme from 
readme.in.
All the other files are DJGPP specific, invisible to other OS and not worth to
be explained here.


Changes to the sources.
1) getargs.c
This file converts inconditionally all files names given at the command line
to lower case if the macro MSDOS is defined. This is not ok for DJGPP.
I have changed the original code from:

  #ifdef MSDOS
  # define AS_FILE_NAME(File) (strlwr (File), (File))
  #else
  # define AS_FILE_NAME(File) (File)
  #endif

to:

  #if defined (MSDOS)
  # if defined (__DJGPP__)
  /* Win9X and successors are case sensitive. */
  #  define AS_FILE_NAME(File) ((pathconf ((File), _PC_NAME_MAX) > 12) ? (File) 
: (strlwr (File), (File)))
  # else
  #  define AS_FILE_NAME(File) (strlwr (File), (File))
  # endif
  #else
  # define AS_FILE_NAME(File) (File)
  #endif

Now, the DJGPP port of bison will detect at run time, using pathconf(), if a 
LFN-API
is available or not. Only if LFN support is _not_ available for that particular 
file,
the file name will be converted to lower case.

2) files.c
2.1) skeleton_find()
Some aclarations first. DJGPP uses the same installation tree than gnu except
for the fact that the prefix /usr/local is replaced by a DJGPP specific prefix.
Let's call this prefix $DJDIR. $DJDIR is an environment variable set by the user
to point to the root of the DJGPP installation. This implies that if the bison
package install the parser files in /usr/local/share, these files will go into
$DJDIR/share in a DJGPP installation.
The path where bison.simple and bison.hairy will go is stipulated by the value 
of
the macros BISON_SIMPLE and BISON_HAIRY defined during configuration by the
configure script. In DJGPP case this will be 
BISON_SIMPLE="$DJDIR/share/bison.simple".
Unfortunately, skeleton_find() never honoures this setting at all for compilers
that define the MSDOS macro. The implication of this is that a bison binary
compiled with DJGPP always looks in the non standard place $DJDIR/bin for the
parser files and never in the standard place $DJDIR/share. The only way to get
bison working is to explicitely set BISON_SIMPLE in the environment pointing to
$DJDIR/share/bison.simple or to disable the DOSish code in skeleton_find() at 
all
To solve this difficulty I have changed the code from:

  #if defined (MSDOS) || defined (_WIN32)
    const char *cp = getenv ("INIT");
    if (!res)
      {
        /* Skeleton file name without path */
        const char *skel_name = strrchr (skeleton_name, '/');
        if (!skel_name)
          skel_name = strrchr (skeleton_name, '\\');
        if (!skel_name)
          skel_name = skeleton_name;
        else
          ++skel_name;
  
        /* File doesn't exist in current directory; try in INIT directory.  */
        if (cp)
        {
          res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
          sprintf (res, "%s%c%s", cp, '\\', skel_name);
        }
        else if (access (skel_name, 4) == 0) /* Look in current dir. */
          res = skel_name;
        else
        {
          /* Look in program locations dir. */
          extern char *program_name;
          cp = strrchr(program_name, '\\');
          if (!cp)
            return skeleton_name;
          else
            ++cp;
          res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
          strncpy (res, program_name, cp - program_name);
          strcpy (res + (cp - program_name), skel_name);
        }
      }
  #endif /* defined (MSDOS) || defined (_WIN32) */

to:

  #if defined (MSDOS) || defined (_WIN32)
    if (skeleton_name && *skeleton_name && (access (skeleton_name, 4) == 0))
      res = skeleton_name;
    else
      {
         const char *cp = getenv ("INIT");
         if (!res)
           {
             /* Skeleton file name without path.
                Allow for mixed slash and backslash in path.
                Check for absolute paths like c:/foo and
                for relative paths like c:foo. */
             const char *skel_name = strrchr (skeleton_name, '/');
             const char *backslash = strrchr (skeleton_name, '\\');
             if (backslash > skel_name)
               skel_name = backslash;
             if (!skel_name && !backslash)
               skel_name = strrchr (skeleton_name, ':');
             if (!skel_name)
               skel_name = skeleton_name;
             else
               ++skel_name;
  
           /* File doesn't exist in current directory; try in INIT directory.  
*/
           if (cp)
           {
             res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
             sprintf (res, "%s%c%s", cp, '\\', skel_name);
           }
           else if (access (skel_name, 4) == 0) /* Look in current dir. */
             res = skel_name;
           else
           {
             /* Look in program locations dir. */
             extern char *program_name;
             cp = strrchr (program_name, '/');
             backslash = strrchr (program_name, '\\');
             if (backslash > cp)
               cp = backslash;
             if (!cp)
               return skeleton_name;
             else
               ++cp;
             res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
             strncpy (res, program_name, cp - program_name);
             strcpy (res + (cp - program_name), skel_name);
           }
         }
      }
  #endif /* defined (MSDOS) || defined (_WIN32) */

As it can be seen an new if-clause has been added to check if skelteon_name
points to a valid file. sleleton_name contains the value of the macro 
BISON_SIMPLE
set during the configuration process. IMHO, skeleton_find() should always
honor the value of skeleton_name _before_ starting to search for the parser file
in non standard places like the /bin directory or the cwd-directory. It should
also be noticed that DOS paths may have mixed slash and backslash as directory
separators. It should also be noticed that the path given may be a relative
path and not an absolute one. This means d:/bin is _not_ the same than d:bin.
First one is absolute, second one is relative. Of course, it is very unlikely
that an user will give a relative path to the parser file, netherless the actual
code is not able to handle this case. The code has been modified to account for
these two different cases:

             /* Skeleton file name without path.
                Allow for mixed slash and backslash in path.
                Check for absolute paths like c:/foo and
                for relative paths like c:foo. */
             const char *skel_name = strrchr (skeleton_name, '/');
             const char *backslash = strrchr (skeleton_name, '\\');
             if (backslash > skel_name)
               skel_name = backslash;
             if (!skel_name && !backslash)
               skel_name = strrchr (skeleton_name, ':');
             if (!skel_name)
               skel_name = skeleton_name;
             else
               ++skel_name;

2.2) compute_output_file_names() and output_files()
I have replaced code from:

  #ifndef MSDOS
    attrsfile = stringappend (attrsfile, header_extension);
  #endif /* MSDOS */

to:

    attrsfile = stringappend (attrsfile, EXT_TYPE (header_extension));

EXT_TYPE is a macro defined in system.h that will expand to the appropiate
value.

3) system.h
All the macros needed to handle file name extensions are defined here.
I have changed the code from:

  # ifdef MSDOS
     /* MS DOS. */
  #  define EXT_TAB     "_tab"
  #  define EXT_OUTPUT  ".out"
  #  define EXT_STYPE_H ".sth"
  #  define EXT_GUARD_C ".guc"
  # else /* ! MSDOS */

to:

  # ifdef MSDOS
  #  ifdef __DJGPP__
      /* DJGPP */
  #   define EXT_TAB            ((pathconf (NULL, _PC_NAME_MAX) > 12) ? ".tab" 
: "_tab")
  #   define EXT_OUTPUT         ((pathconf (NULL, _PC_NAME_MAX) > 12) ? 
".output" : ".out")
  #   define EXT_STYPE_H        ((pathconf (NULL, _PC_NAME_MAX) > 12) ? 
".stype" : ".sth")
  #   define EXT_GUARD_C        ((pathconf (NULL, _PC_NAME_MAX) > 12) ? 
".guard" : ".guc")
  #   define EXT_TYPE(ext)      ((pathconf (NULL, _PC_NAME_MAX) > 12) ? (ext) : 
"")
  #  else /* ! DJGPP */
      /* MS DOS. */
  #   define EXT_TAB            "_tab"
  #   define EXT_OUTPUT         ".out"
  #   define EXT_STYPE_H                ".sth"
  #   define EXT_GUARD_C                ".guc"
  #   define EXT_TYPE(ext)      ""
  #  endif
  # else /* ! MSDOS */


As can be seen, pathconf() is used to detect at run time the file system type
in use. Macros like EXT_TAB will expand to their appropiate values depending
if LFN support is available or not. The same applies to the new macro EXT_TYPE.
For POSIX and VMS, this macros symply expands like:
  #  define EXT_TYPE(ext)       (ext)
and for plain DOS (MSDOS) it expands like:
  #  define EXT_TYPE(ext)       ""


All this has been tested on linux and diferent DOS versions to work properly.
This patch is similar to the one I have submitted in September 2001 to 
bug-bison.
I hope it is still of some interest.
Comments, objections, suggestions, etc. are welcome.
The patch has been splitted in three parts and can be applied in any order.

Regards,
Guerrero, Juan Manuel


DJGPP support for bison 1.32.
Patch 1/3

2002-01-27  Guerrero, Juan Manuel  <address@hidden>

        * configure.bat: Obsolete. Removed

        * configure.in (AC_OUTPUT): Entry for arch/djgpp/Makefile.am added.

        * Makefile.am (SUBDIRS): Entry for arch/djgpp/Makefile.am added.

        * arch/djgpp/config.bat: New file. DJGPP specific.

        * arch/djgpp/config.in: New file. DJGPP specific.

        * arch/djgpp/config.site: New file. DJGPP specific.

        * arch/djgpp/README.in: New file. DJGPP specific.

        * arch/djgpp/Makefile.am: New file. DJGPP specific.

        * doc/bison.texinfo: Add DJGPP specific information about
          file name extensions used on different file systems.

        * src/files.c (output_files): MSDOS conditional removed. New macro
          EXT_TYPE will provide at runtime the appropiate output file extension.
          (skeleton_find): access to parser file pointed by skeleton_name will 
be
          checked before checking for parser file in no standard directories.
          Path name code improved to allow for mixed slash and backslash in 
pathname
          and to handle absolute and relative paths.

        * src/getargs.c [AS_FILE_NAME]: __DJGPP__ conditional added.
          Check at runtime if LFN-API (case preserving) is available or not.
          Do not unconditionly convert upper case strings in lower case strings.

        * src/system.h [MSDOS] [__DJGPP__]: Use pathconf to choose POSIX or
          DOS file extensions at run time.
          [MSDOS] [__GO32__]: Macro __DJGPP__ added.  __GO32__ is obsolete
          and its use is deprecated.
          [MSDOS] [__DJGPP__]: New macro EXT_TYPE. Determinates at runtime
          the suorce and header file extension string to be used. If LFN-API
          is available, the suorce and header file extension (.c and .h) will
          be added to the output file name. If no LFN-API is available no
          extension at all will be added to the output file name.
          [MSDOS] [!__DJGPP__]: New macro EXT_TYPE. The suorce file and header
          file extension strings default to empty. No extension will be added
          to the output file name at all.
          [!MSDOS]: New macro EXT_TYPE. The suorce file and header file
          extensions will always be added to the output file name.




diff -acprNC3 bison-1.32.orig/configure.bat bison-1.32.djgpp/configure.bat
*** bison-1.32.orig/configure.bat       Fri Sep 25 22:06:24 1992
--- bison-1.32.djgpp/configure.bat      Thu Jan  1 00:00:00 1970
***************
*** 1,28 ****
- @echo off
- echo Configuring bison for go32
- rem This batch file assumes a unix-type "sed" program
- 
- echo # Makefile generated by "configure.bat"> Makefile
- echo all.dos : bison >> Makefile
- 
- if exist config.sed del config.sed
- 
- echo "s/@srcdir@/./g                                  ">> config.sed
- echo "s/@CC@/gcc/g                                    ">> config.sed
- echo "s/@INSTALL@//g                                  ">> config.sed
- echo "s/@INSTALL_PROGRAM@//g                          ">> config.sed
- echo "s/@INSTALL_DATA@//g                             ">> config.sed
- echo "s/@DEFS@/-DHAVE_STRERROR/g                      ">> config.sed
- echo "s/@LIBS@//g                                     ">> config.sed
- echo "s/@ALLOCA@//g                                   ">> config.sed
- 
- echo "/^bison[        ]*:/,/-o/ {                             ">> config.sed
- echo "  s/    \$(CC)/ >bison.rf/                      ">> config.sed
- echo "  /-o/ a\                                               ">> config.sed
- echo "        $(CC) @bison.rf                                 ">> config.sed
- echo "}                                                       ">> config.sed
- 
- sed -e "s/^\"//" -e "s/\"$//" -e "s/[         ]*$//" config.sed > config2.sed
- sed -f config2.sed Makefile.in >> Makefile
- del config.sed
- del config2.sed
--- 0 ----
diff -acprNC3 bison-1.32.orig/configure.in bison-1.32.djgpp/configure.in
*** bison-1.32.orig/configure.in        Wed Jan 23 13:29:46 2002
--- bison-1.32.djgpp/configure.in       Wed Jan 30 02:16:36 2002
*************** AC_OUTPUT([Makefile
*** 108,111 ****
             config/Makefile
             intl/Makefile po/Makefile.in
             lib/Makefile src/Makefile doc/Makefile
!            m4/Makefile])
--- 108,111 ----
             config/Makefile
             intl/Makefile po/Makefile.in
             lib/Makefile src/Makefile doc/Makefile
!            m4/Makefile arch/djgpp/Makefile])
diff -acprNC3 bison-1.32.orig/doc/bison.texinfo 
bison-1.32.djgpp/doc/bison.texinfo
*** bison-1.32.orig/doc/bison.texinfo   Sat Jan  5 13:21:48 2002
--- bison-1.32.djgpp/doc/bison.texinfo  Fri Jan 25 20:05:38 2002
*************** Invoking Bison
*** 304,309 ****
--- 304,311 ----
  * Bison Options::     All the options described in detail,
                        in alphabetical order by short options.
  * Option Cross Key::  Alphabetical list of long options.
+ * Extension Limitations Under DOS::  Bison output files extension differences
+                                       depending on the DOS/Windows file 
system flavour used.
  * VMS Invocation::    Bison command syntax on VMS.
  
  Copying This Manual
*************** will produce @file{output.c++} and @file
*** 5047,5052 ****
--- 5049,5056 ----
                        in alphabetical order by short options.
  * Environment Variables::  Variables which affect Bison execution.
  * Option Cross Key::  Alphabetical list of long options.
+ * Extension Limitations Under DOS::  Bison output files extension differences
+                                       depending on the DOS/Windows file 
system flavour used.
  * VMS Invocation::    Bison command syntax on VMS.
  @end menu
  
*************** the corresponding short option.
*** 5244,5249 ****
--- 5248,5283 ----
  @end example
  @end ifinfo
  
+ @node Extension Limitations Under DOS
+ @section Extension Limitations under DOS
+ @cindex extension limitations under DOS
+ @cindex DOS
+ 
+ On DOS/Windows 9X systems, the file name extensions, like @file{.tab.c},
+ that may be used depend on the file system in use.  The plain DOS file system
+ has limited file name length and does not allow more than a single dot
+ in the file name.
+ 
+ The DJGPP port of @code{bison} will detect at runtime if (LFN) long file name
+ support is available or not.  LFN support will be available in a DOS session
+ under Windows 9X and successors.  If LFN support is available the DJGPP port
+ of @code{bison} will use the standard POSIX file name extensions.  If LFN
+ support is not available, then the DJGPP port of @code{bison} will use
+ DOS specific file name extensions.
+ 
+ @noindent This table summarizes the used extensions:
+ 
+ @multitable @columnfractions 0.1 0.45 0.45
+ @item @tab LFN extension (Win9X) @tab SFN extension (plain DOS)
+ @item @tab @file{.tab.c} @tab @file{_tab.c}
+ @item @tab @file{.tab.h} @tab @file{_tab.h}
+ @item @tab @file{.tab.cpp} @tab @file{_tab.cpp}
+ @item @tab @file{.tab.hpp} @tab @file{_tab.hpp}
+ @item @tab @file{.output} @tab @file{.out}
+ @item @tab @file{.stype.h} @tab @file{.sth}
+ @item @tab @file{.guard.c} @tab @file{.guc}
+ @end multitable
+ 
  @node VMS Invocation
  @section Invoking Bison under VMS
  @cindex invoking Bison under VMS
diff -acprNC3 bison-1.32.orig/Makefile.am bison-1.32.djgpp/Makefile.am
*** bison-1.32.orig/Makefile.am Fri Nov 30 14:18:26 2001
--- bison-1.32.djgpp/Makefile.am        Wed Jan 30 02:23:40 2002
*************** AUTOMAKE_OPTIONS = 1.5 check-news readme
*** 18,26 ****
  
  ACLOCAL_AMFLAGS = -I m4
  
! SUBDIRS = config intl po lib src doc m4 tests
  
! EXTRA_DIST = REFERENCES configure.bat OChangeLog Makefile.maint GNUmakefile
  
  DISTCLEANFILES = intl/libintl.h
  
--- 18,26 ----
  
  ACLOCAL_AMFLAGS = -I m4
  
! SUBDIRS = config intl po lib src doc m4 tests arch/djgpp
  
! EXTRA_DIST = REFERENCES OChangeLog Makefile.maint GNUmakefile
  
  DISTCLEANFILES = intl/libintl.h
  
diff -acprNC3 bison-1.32.orig/src/files.c bison-1.32.djgpp/src/files.c
*** bison-1.32.orig/src/files.c Mon Jan 21 15:41:46 2002
--- bison-1.32.djgpp/src/files.c        Wed Jan 30 01:28:22 2002
*************** skeleton_find (const char *envvar, const
*** 215,253 ****
    const char *res = getenv (envvar);
  
  #if defined (MSDOS) || defined (_WIN32)
!   const char *cp = getenv ("INIT");
!   if (!res)
      {
!       /* Skeleton file name without path */
!       const char *skel_name = strrchr (skeleton_name, '/');
!       if (!skel_name)
!         skel_name = strrchr (skeleton_name, '\\');
!       if (!skel_name)
!         skel_name = skeleton_name;
!       else
!         ++skel_name;
! 
!       /* File doesn't exist in current directory; try in INIT directory.  */
!       if (cp)
!       {
!         res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
!         sprintf (res, "%s%c%s", cp, '\\', skel_name);
!       }
!       else if (access (skel_name, 4) == 0) /* Look in current dir. */
!         res = skel_name;
!       else
!       {
!         /* Look in program locations dir. */
!         extern char *program_name;
!         cp = strrchr(program_name, '\\');
!         if (!cp)
!           return skeleton_name;
!         else
!           ++cp;
!         res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
!         strncpy (res, program_name, cp - program_name);
!         strcpy (res + (cp - program_name), skel_name);
!       }
      }
  #endif /* defined (MSDOS) || defined (_WIN32) */
    if (!res)
--- 215,267 ----
    const char *res = getenv (envvar);
  
  #if defined (MSDOS) || defined (_WIN32)
!   if (skeleton_name && *skeleton_name && (access (skeleton_name, 4) == 0))
!     res = skeleton_name;
!   else
      {
!        const char *cp = getenv ("INIT");
!        if (!res)
!          {
!            /* Skeleton file name without path.
!               Allow for mixed slash and backslash in path.
!               Check for absolute paths like c:/foo and
!               for relative paths like c:foo. */
!            const char *skel_name = strrchr (skeleton_name, '/');
!            const char *backslash = strrchr (skeleton_name, '\\');
!            if (backslash > skel_name)
!              skel_name = backslash;
!            if (!skel_name && !backslash)
!              skel_name = strrchr (skeleton_name, ':');
!            if (!skel_name)
!              skel_name = skeleton_name;
!            else
!              ++skel_name;
! 
!          /* File doesn't exist in current directory; try in INIT directory.  
*/
!          if (cp)
!          {
!            res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
!            sprintf (res, "%s%c%s", cp, '\\', skel_name);
!          }
!          else if (access (skel_name, 4) == 0) /* Look in current dir. */
!            res = skel_name;
!          else
!          {
!            /* Look in program locations dir. */
!            extern char *program_name;
!            cp = strrchr (program_name, '/');
!            backslash = strrchr (program_name, '\\');
!            if (backslash > cp)
!              cp = backslash;
!            if (!cp)
!              return skeleton_name;
!            else
!              ++cp;
!            res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
!            strncpy (res, program_name, cp - program_name);
!            strcpy (res + (cp - program_name), skel_name);
!          }
!        }
      }
  #endif /* defined (MSDOS) || defined (_WIN32) */
    if (!res)
*************** compute_output_file_names (void)
*** 452,460 ****
    spec_verbose_file = stringappend (short_base_name, EXT_OUTPUT);
  
    attrsfile = stringappend (short_base_name, EXT_STYPE_H);
! #ifndef MSDOS
!   attrsfile = stringappend (attrsfile, header_extension);
! #endif /* MSDOS */
  
  }
  
--- 466,472 ----
    spec_verbose_file = stringappend (short_base_name, EXT_OUTPUT);
  
    attrsfile = stringappend (short_base_name, EXT_STYPE_H);
!   attrsfile = stringappend (attrsfile, EXT_TYPE (header_extension));
  
  }
  
*************** output_files (void)
*** 523,531 ****
        obstack_save (&attrs_obstack, attrsfile);
        obstack_free (&attrs_obstack, NULL);
        temp_name = stringappend (short_base_name, EXT_GUARD_C);
! #ifndef MSDOS
!       temp_name = stringappend (temp_name, src_extension);
! #endif /* MSDOS */
        obstack_save (&guard_obstack, temp_name);
        obstack_free (&guard_obstack, NULL);
      }
--- 535,541 ----
        obstack_save (&attrs_obstack, attrsfile);
        obstack_free (&attrs_obstack, NULL);
        temp_name = stringappend (short_base_name, EXT_GUARD_C);
!       temp_name = stringappend (temp_name, EXT_TYPE (src_extension));
        obstack_save (&guard_obstack, temp_name);
        obstack_free (&guard_obstack, NULL);
      }
diff -acprNC3 bison-1.32.orig/src/getargs.c bison-1.32.djgpp/src/getargs.c
*** bison-1.32.orig/src/getargs.c       Wed Jan 23 13:12:16 2002
--- bison-1.32.djgpp/src/getargs.c      Tue Jan 29 22:54:52 2002
*************** warranty; not even for MERCHANTABILITY o
*** 160,169 ****
  | Process the options.  |
  `----------------------*/
  
! /* Under DOS, there is no difference on the case.  This can be
     troublesome when looking for `.tab' etc.  */
! #ifdef MSDOS
! # define AS_FILE_NAME(File) (strlwr (File), (File))
  #else
  # define AS_FILE_NAME(File) (File)
  #endif
--- 160,174 ----
  | Process the options.  |
  `----------------------*/
  
! /* Under plain DOS, there is no difference on the case.  This can be
     troublesome when looking for `.tab' etc.  */
! #if defined (MSDOS)
! # if defined (__DJGPP__)
! /* Win9X and successors are case sensitive. */
! #  define AS_FILE_NAME(File) ((pathconf ((File), _PC_NAME_MAX) > 12) ? (File) 
: (strlwr (File), (File)))
! # else
! #  define AS_FILE_NAME(File) (strlwr (File), (File))
! # endif
  #else
  # define AS_FILE_NAME(File) (File)
  #endif
diff -acprNC3 bison-1.32.orig/src/system.h bison-1.32.djgpp/src/system.h
*** bison-1.32.orig/src/system.h        Mon Jan 21 12:12:28 2002
--- bison-1.32.djgpp/src/system.h       Wed Jan 30 01:39:10 2002
*************** do {                                                            
\
*** 239,245 ****
  # define      MINSHORT        -32768
  #endif
  
! #if defined (MSDOS) && !defined (__GO32__)
  # define      BITS_PER_WORD   16
  # define MAXTABLE     16383
  #else
--- 239,245 ----
  # define      MINSHORT        -32768
  #endif
  
! #if defined (MSDOS) && !defined (__GO32__) && !defined (__DJGPP__)
  # define      BITS_PER_WORD   16
  # define MAXTABLE     16383
  #else
*************** do {                                                            
\
*** 261,279 ****
  # define EXT_OUTPUT   ".output"
  # define EXT_STYPE_H  "_stype"
  # define EXT_GUARD_C  "_guard"
  #else /* ! VMS */
  # ifdef MSDOS
!    /* MS DOS. */
! #  define EXT_TAB     "_tab"
! #  define EXT_OUTPUT  ".out"
! #  define EXT_STYPE_H ".sth"
! #  define EXT_GUARD_C ".guc"
  # else /* ! MSDOS */
    /* Standard. */
  #  define EXT_TAB     ".tab"
  #  define EXT_OUTPUT  ".output"
  #  define EXT_STYPE_H ".stype"
  #  define EXT_GUARD_C ".guard"
  # endif /* ! MSDOS */
  #endif /* ! VMS */
  
--- 261,291 ----
  # define EXT_OUTPUT   ".output"
  # define EXT_STYPE_H  "_stype"
  # define EXT_GUARD_C  "_guard"
+ # define EXT_TYPE(ext)        (ext)
  #else /* ! VMS */
  # ifdef MSDOS
! #  ifdef __DJGPP__
!     /* DJGPP */
! #   define EXT_TAB            ((pathconf (NULL, _PC_NAME_MAX) > 12) ? ".tab" 
: "_tab")
! #   define EXT_OUTPUT         ((pathconf (NULL, _PC_NAME_MAX) > 12) ? 
".output" : ".out")
! #   define EXT_STYPE_H        ((pathconf (NULL, _PC_NAME_MAX) > 12) ? 
".stype" : ".sth")
! #   define EXT_GUARD_C        ((pathconf (NULL, _PC_NAME_MAX) > 12) ? 
".guard" : ".guc")
! #   define EXT_TYPE(ext)      ((pathconf (NULL, _PC_NAME_MAX) > 12) ? (ext) : 
"")
! #  else /* ! DJGPP */
!     /* MS DOS. */
! #   define EXT_TAB            "_tab"
! #   define EXT_OUTPUT         ".out"
! #   define EXT_STYPE_H                ".sth"
! #   define EXT_GUARD_C                ".guc"
! #   define EXT_TYPE(ext)      ""
! #  endif
  # else /* ! MSDOS */
    /* Standard. */
  #  define EXT_TAB     ".tab"
  #  define EXT_OUTPUT  ".output"
  #  define EXT_STYPE_H ".stype"
  #  define EXT_GUARD_C ".guard"
+ #  define EXT_TYPE(ext)       (ext)
  # endif /* ! MSDOS */
  #endif /* ! VMS */
  
*************** do {                                                            
\
*** 295,300 ****
--- 307,321 ----
  # endif
  #endif
  
+ #if defined (__DJGPP__)
+ # ifndef BISON_SIMPLE
+ #  define BISON_SIMPLE "/dev/env/DJDIR/share/bison.simple"
+ # endif
+ # ifndef BISON_HAIRY
+ #  define BISON_HAIRY "/dev/env/DJDIR/share/bison.hairy"
+ # endif
+ #endif
+ 
  
  /* As memcpy, but for shorts.  */
  #define shortcpy(Dest, Src, Num) \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]