[Top][All Lists]
[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: |
Thu, 7 Feb 2002 21:47:48 +0100 |
This patch contains the _absolute minimum changes_ needed
to compile a working bison binary using the DJGPP toolchain.
A working bison binary does not imply an out-of-the DJGPP port.
I have omited the arch/djgpp stuff. I will add this always when
a DJGPP port of bison is uploaded to simtel.net.
The patch is based on BISON-1_33 branch.
Regards,
Guerrero, Juan Manuel
2002-02-07 Guerrero, Juan Manuel <address@hidden>
* 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) [__DJGPP__]: __DJGPP__ conditional added.
Inhibit the use of DOSish code. POSIXy like behaviour.
* 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 src file and header file extension string to be used. If LFN-API
is available, the src 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 src 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 src file and header file
extensions will always be added to the output file name.
diff -acprNC3 bison-1.33.orig/doc/bison.texinfo
bison-1.33.djgpp/doc/bison.texinfo
*** bison-1.33.orig/doc/bison.texinfo Sat Jan 5 02:18:26 2002
--- bison-1.33.djgpp/doc/bison.texinfo Thu Feb 7 20:24:50 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.33.orig/src/files.c bison-1.33.djgpp/src/files.c
*** bison-1.33.orig/src/files.c Mon Jan 21 16:48:26 2002
--- bison-1.33.djgpp/src/files.c Thu Feb 7 20:29:08 2002
*************** skeleton_find (const char *envvar, const
*** 214,220 ****
{
const char *res = getenv (envvar);
! #if defined (MSDOS) || defined (_WIN32)
const char *cp = getenv ("INIT");
if (!res)
{
--- 214,220 ----
{
const char *res = getenv (envvar);
! #if (defined (MSDOS) && !defined(__DJGPP__)) || defined (_WIN32)
const char *cp = getenv ("INIT");
if (!res)
{
*************** skeleton_find (const char *envvar, const
*** 249,255 ****
strcpy (res + (cp - program_name), skel_name);
}
}
! #endif /* defined (MSDOS) || defined (_WIN32) */
if (!res)
res = skeleton_name;
--- 249,255 ----
strcpy (res + (cp - program_name), skel_name);
}
}
! #endif /* (defined (MSDOS) && !defined (__DJGPP__)) || defined (_WIN32) */
if (!res)
res = skeleton_name;
*************** 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 */
}
--- 452,458 ----
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);
}
--- 521,527 ----
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.33.orig/src/getargs.c bison-1.33.djgpp/src/getargs.c
*** bison-1.33.orig/src/getargs.c Wed Jan 23 14:14:56 2002
--- bison-1.33.djgpp/src/getargs.c Thu Feb 7 20:31:40 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. */
#ifdef 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.33.orig/src/system.h bison-1.33.djgpp/src/system.h
*** bison-1.33.orig/src/system.h Sun Jan 20 11:59:44 2002
--- bison-1.33.djgpp/src/system.h Thu Feb 7 20:35:36 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
! # if defined (__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 */
- Re: DJGPP support for bison, Akim Demaille, 2002/02/07
- DJGPP support for bison,
Juan Manuel Guerrero <=
- Re: DJGPP support for bison, akim, 2002/02/07
- Re: DJGPP support for bison, Juan Manuel Guerrero, 2002/02/07
- Re: DJGPP support for bison, Akim Demaille, 2002/02/11
- Re: DJGPP support for bison, Juan Manuel Guerrero, 2002/02/13
- Re: DJGPP support for bison, Tim Van Holder, 2002/02/13
- Re: DJGPP support for bison, Juan Manuel Guerrero, 2002/02/15