]> git.saurik.com Git - bison.git/commitdiff
* src/system.h (EXT_TAB, EXT_OUTPUT, EXT_STYPE_H, EXT_GUARD_C):
authorAkim Demaille <akim@epita.fr>
Tue, 19 Dec 2000 12:18:45 +0000 (12:18 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 19 Dec 2000 12:18:45 +0000 (12:18 +0000)
New macros.
* src/files.c (open_files): Less dependency on MSDOS etc.

ChangeLog
src/files.c
src/system.h

index 928bd6e01596ddcedfe4266d0da3fcc9ed0397db..bdfc5ceb88412541c84806556ba2784b6d386912 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-12-19  Akim Demaille  <akim@epita.fr>
+
+       * 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  <akim@epita.fr>
 
        * src/bison.s1 (YYLLOC_DEFAULT): New macro.
index 5282ac0d199271ea0edd214773de077b7afdb5d0..5e81ebe8ae136cdfc7bd6af5192904b17b2ed04d 100644 (file)
@@ -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);
index 797ae545becc73eadda568bbc92f4f963706a192..437c1f15920ad1e3a6e9a0555a6dc1e97c017c73 100644 (file)
@@ -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 */