From 7de3329eea354cc392692ccc47bdddfc2bf82f2d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 19 Dec 2000 12:18:45 +0000 Subject: [PATCH] * src/system.h (EXT_TAB, EXT_OUTPUT, EXT_STYPE_H, EXT_GUARD_C): New macros. * src/files.c (open_files): Less dependency on MSDOS etc. --- ChangeLog | 6 ++++ src/files.c | 36 ++++-------------------- src/system.h | 77 ++++++++++++++++++++++++++++++++++------------------ 3 files changed, 62 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index 928bd6e0..bdfc5ceb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-12-19 Akim Demaille + + * src/system.h (EXT_TAB, EXT_OUTPUT, EXT_STYPE_H, EXT_GUARD_C): + New macros. + * src/files.c (open_files): Less dependency on MSDOS etc. + 2000-12-14 Akim Demaille * src/bison.s1 (YYLLOC_DEFAULT): New macro. diff --git a/src/files.c b/src/files.c index 5282ac0d..5e81ebe8 100644 --- a/src/files.c +++ b/src/files.c @@ -250,11 +250,7 @@ open_files (void) name_base = XMALLOC (char, base_length + 1); /* Append `.tab'. */ strcpy (name_base, spec_file_prefix); -#ifdef VMS - strcat (name_base, "_tab"); -#else - strcat (name_base, ".tab"); -#endif + strcat (name_base, EXT_TAB); #ifdef MSDOS strlwr (name_base); #endif /* MSDOS */ @@ -275,15 +271,7 @@ open_files (void) base_length -= 2; short_base_length = base_length; -#ifdef VMS - name_base = stringappend (name_base, short_base_length, "_tab"); -#else -#ifdef MSDOS - name_base = stringappend (name_base, short_base_length, "_tab"); -#else - name_base = stringappend (name_base, short_base_length, ".tab"); -#endif /* not MSDOS */ -#endif + name_base = stringappend (name_base, short_base_length, EXT_TAB); base_length = short_base_length + 4; } @@ -294,13 +282,9 @@ open_files (void) if (verbose_flag) { -#ifdef MSDOS - outfile = stringappend (name_base, short_base_length, ".out"); -#else /* We used to use just .out if spec_name_prefix (-p) was used, but that conflicts with Posix. */ - outfile = stringappend (name_base, short_base_length, ".output"); -#endif + outfile = stringappend (name_base, short_base_length, EXT_OUTPUT); foutput = xfopen (outfile, "w"); } @@ -321,18 +305,8 @@ open_files (void) else tabfile = stringappend (name_base, base_length, ".c"); -#ifdef VMS - attrsfile = stringappend (name_base, short_base_length, "_stype.h"); - guardfile = stringappend (name_base, short_base_length, "_guard.c"); -#else -#ifdef MSDOS - attrsfile = stringappend (name_base, short_base_length, ".sth"); - guardfile = stringappend (name_base, short_base_length, ".guc"); -#else - attrsfile = stringappend (name_base, short_base_length, ".stype.h"); - guardfile = stringappend (name_base, short_base_length, ".guard.c"); -#endif /* not MSDOS */ -#endif /* not VMS */ + attrsfile = stringappend (name_base, short_base_length, EXT_STYPE_H); + guardfile = stringappend (name_base, short_base_length, EXT_GUARD_C); /* Initialize the obstacks. */ obstack_init (&action_obstack); diff --git a/src/system.h b/src/system.h index 797ae545..437c1f15 100644 --- a/src/system.h +++ b/src/system.h @@ -126,32 +126,6 @@ extern int errno; #endif /* BISON_SYSTEM_H */ -/*---------------------------------. -| Machine-dependencies for Bison. | -`---------------------------------*/ - -#ifdef eta10 -# define MAXSHORT 2147483647 -# define MINSHORT -2147483648 -#else -# define MAXSHORT 32767 -# define MINSHORT -32768 -#endif - -#if defined (MSDOS) && !defined (__GO32__) -# define BITS_PER_WORD 16 -# define MAXTABLE 16383 -#else -# define BITS_PER_WORD 32 -# define MAXTABLE 32767 -#endif - -#define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD) -#define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD))) -#define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD))) -#define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0) - - /*-----------. | Booleans. | `-----------*/ @@ -194,3 +168,54 @@ do { \ sprintf (buf, Format, Arg1, Arg2, Arg3); \ obstack_grow (Obs, buf, strlen (buf)); \ } while (0) + + +/*---------------------------------. +| Machine-dependencies for Bison. | +`---------------------------------*/ + +#ifdef eta10 +# define MAXSHORT 2147483647 +# define MINSHORT -2147483648 +#else +# define MAXSHORT 32767 +# define MINSHORT -32768 +#endif + +#if defined (MSDOS) && !defined (__GO32__) +# define BITS_PER_WORD 16 +# define MAXTABLE 16383 +#else +# define BITS_PER_WORD 32 +# define MAXTABLE 32767 +#endif + +#define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD) +#define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD))) +#define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD))) +#define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0) + + +/* Extensions to use for the output files. */ + +#ifdef VMS + /* VMS. */ +# define EXT_TAB "_tab" +# define EXT_OUTPUT ".output" +# define EXT_STYPE_H "_stype.h" +# define EXT_GUARD_C "_guard.c" +#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.h" +# define EXT_GUARD_C ".guard.c" +# endif /* ! MSDOS */ +#endif /* ! VMS */ -- 2.47.2