From: kmhugo Date: Thu, 10 Jan 2002 06:55:12 +0000 (+0000) Subject: Macintosh util update X-Git-Tag: MOVE2GIT~3512 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95143950a9f73bfe77f1ae228f363f62c9201ea8;p=nethack Macintosh util update * Updated preprocessor conditionals for the MPW compilers. * Remove obsolete Mac code in util/*_comp.l. --- diff --git a/util/dgn_comp.l b/util/dgn_comp.l index 6cefdd2f4..e7bcfa5ad 100644 --- a/util/dgn_comp.l +++ b/util/dgn_comp.l @@ -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 */ %} %% diff --git a/util/dgn_main.c b/util/dgn_main.c index da867223a..a69f776fa 100644 --- a/util/dgn_main.c +++ b/util/dgn_main.c @@ -12,7 +12,7 @@ #include "dlb.h" #ifdef MAC -# ifdef applec +# if defined(__SC__) || defined(__MRC__) # define MPWTOOL #include # else diff --git a/util/lev_comp.l b/util/lev_comp.l index 9448d1858..9cbf927ff 100644 --- a/util/lev_comp.l +++ b/util/lev_comp.l @@ -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 diff --git a/util/lev_main.c b/util/lev_main.c index 8c9ee01fe..ea2ffc258 100644 --- a/util/lev_main.c +++ b/util/lev_main.c @@ -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 # 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) { diff --git a/util/makedefs.c b/util/makedefs.c index bd0e14b32..3e2361c57 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -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 #include @@ -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"