]> granicus.if.org Git - nethack/commitdiff
Macintosh util update
authorkmhugo <kmhugo>
Thu, 10 Jan 2002 06:55:12 +0000 (06:55 +0000)
committerkmhugo <kmhugo>
Thu, 10 Jan 2002 06:55:12 +0000 (06:55 +0000)
* Updated preprocessor conditionals for the MPW compilers.
* Remove obsolete Mac code in util/*_comp.l.

util/dgn_comp.l
util/dgn_main.c
util/lev_comp.l
util/lev_main.c
util/makedefs.c

index 6cefdd2f40a87be7a24b9a11d285eedd741c8eda..e7bcfa5ad2d8c3cf1ba851f3e941bc6a126e88af 100644 (file)
@@ -74,33 +74,6 @@ void FDECL(init_yyout, (FILE *));
 extern YYSTYPE yylval;
 
 int line_number = 1;
-/*
- *     This is a hack required by Michael Hamel to get things
- *     working on the Mac.
- */
-#if defined(applec) && !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
-#undef input
-#undef unput
-#define unput(c) { yytchar = (c); if (yytchar == 10) yylineno--; *yysptr++ = yytchar; }                                
-# ifndef YYNEWLINE
-# define YYNEWLINE 10
-# endif
-
-char
-input()                /* Under MPW \n is chr(13)! Compensate for this. */
-{
-       if (yysptr > yysbuf) return(*--yysptr);
-       else {
-               yytchar = getc(yyin);
-               if (yytchar == '\n') {
-                   yylineno++;
-                   return(YYNEWLINE);
-               }
-               if (yytchar == EOF) return(0);
-               else                return(yytchar);
-       }
-}
-#endif /* applec && !FLEX_SCANNER && !FLEXHACK_SCANNER */
 
 %}
 %%
index da867223a309e027a0e43be47884352dbe296467..a69f776fabbb5b9ee5bdf98c5555f4f50809030b 100644 (file)
@@ -12,7 +12,7 @@
 #include "dlb.h"
 
 #ifdef MAC
-# ifdef applec
+# if defined(__SC__) || defined(__MRC__)
 #  define MPWTOOL
 #include <CursorCtl.h>
 # else
index 9448d1858074ed76303aa7e4c6e2a4d3f6737a06..9cbf927fff0eb7df03b81abbe136ec9452b3173c 100644 (file)
@@ -74,34 +74,6 @@ int line_number = 1, colon_line_number = 1;
 static char map[4096];
 static int map_cnt = 0;
 
-/*
- *     This is a hack required by Michael Hamel to get things
- *     working on the Mac.
- */
-#if defined(applec) && !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
-#undef input
-#undef unput
-#define unput(c) { yytchar = (c); if (yytchar == 10) yylineno--; *yysptr++ = yytchar; }
-# ifndef YYNEWLINE
-# define YYNEWLINE 10
-# endif
-
-char
-input()                /* Under MPW \n is chr(13)! Compensate for this. */
-{
-       if (yysptr > yysbuf) return(*--yysptr);
-       else {
-               yytchar = getc(yyin);
-               if (yytchar == '\n') {
-                   yylineno++;
-                   return(YYNEWLINE);
-               }
-               if (yytchar == EOF) return(0);
-               else                return(yytchar);
-       }
-}
-#endif /* applec && !FLEX_SCANNER && !FLEXHACK_SCANNER */
-
 %}
 %e 1500
 %p 5000
index 8c9ee01fe4bdd3df6716221a4e111d91ac49b369..ea2ffc2587d523b86ccc1acd279b6c44458c87a7 100644 (file)
@@ -6,6 +6,8 @@
  * This file contains the main function for the parser
  * and some useful functions needed by yacc
  */
+#define SPEC_LEV       /* for MPW */
+/* although, why don't we move those special defined here.. and in dgn_main? */
 
 #include "hack.h"
 #include "date.h"
@@ -15,7 +17,7 @@
 #endif
 
 #ifdef MAC
-# ifdef applec
+# if defined(__SC__) || defined(__MRC__)
 #  define MPWTOOL
 #include <CursorCtl.h>
 # else
@@ -47,7 +49,7 @@
 # define OMASK 0644
 #endif
 
-#define NEWLINE        10      /* under Mac MPW C '\n' is 13 so don't use it. */
+#define NEWLINE        '\n'    /* changes to 13 for MPW */
 
 #define ERR            (-1)
 
@@ -1108,7 +1110,11 @@ specialmaze *maze_level;
        Strcat(lbuf, filename);
        Strcat(lbuf, LEV_EXT);
 
+#if defined(MAC) && (defined(__SC__) || defined(__MRC__))
+       fout = open(lbuf, O_WRONLY|O_CREAT|O_BINARY);
+#else
        fout = open(lbuf, O_WRONLY|O_CREAT|O_BINARY, OMASK);
+#endif
        if (fout < 0) return FALSE;
 
        if (room_level) {
index bd0e14b32ea35e9e46c09d14e2cf5b67484c8dd6..3e2361c571f0c297d480385c0b1d873aca233f3d 100644 (file)
@@ -27,7 +27,7 @@
 #endif
 
 #ifdef MAC
-# ifdef applec /* Means the MPW compiler, I hope */
+# if defined(__SC__) || defined(__MRC__)       /* MPW compilers */
 #  define MPWTOOL
 #include <CursorCtl.h>
 #include <string.h>
@@ -87,7 +87,11 @@ static       const char      SCCS_Id[] = "@(#)makedefs.c\t3.3\t1999/08/16";
 #   define INCLUDE_TEMPLATE    "..\\include\\%s"
 #   define SOURCE_TEMPLATE     "..\\src\\%s"
 #   define DGN_TEMPLATE                "..\\dat\\%s"  /* where dungeon.pdf file goes */
-#   define DATA_TEMPLATE       "..\\dat\\%s"
+#  if __SC__ || __MRC__
+#   define DATA_TEMPLATE       ":Dungeon:%s"
+#  else
+#   define DATA_TEMPLATE       ":lib:%s"
+#  endif /* __SC__ || __MRC__ */
 #   define DATA_IN_TEMPLATE    "..\\dat\\%s"
 #  else /* OS2 */
 #   define INCLUDE_TEMPLATE    "../include/%s"