Commit d0165e57 authored by OPNA2608's avatar OPNA2608
Browse files

{pmars,pmars-x11}: 0.9.4 -> 0.9.5

parent 5dd35d62
Loading
Loading
Loading
Loading
+0 −92
Original line number Diff line number Diff line
diff '--color=auto' -ruN a/src/cdb.c b/src/cdb.c
--- a/src/cdb.c	1970-01-01 01:00:01.000000000 +0100
+++ b/src/cdb.c	2024-10-08 11:28:57.892951658 +0200
@@ -1564,7 +1564,7 @@
             (warriorsLeft ? warriorsLeft : 1));
     substitute(buf[bi1], "CYCLE", outs, buf[bi2]);
     SWITCHBI;
-    sprintf(outs, "%d", round);
+    sprintf(outs, "%d", roundCounter);
     substitute(buf[bi1], "ROUND", outs, buf[bi2]);
 
     SWITCHBI;
@@ -1875,7 +1875,7 @@
 #endif
   int     nFuture, nPast, count, taskHalf = (coreSize <= 10000 ? 7 : 5);
 
-  sprintf(outs, roundOfCycle, round, rounds,
+  sprintf(outs, roundOfCycle, roundCounter, rounds,
           (cycle + (warriorsLeft ? warriorsLeft : 1) - 1) /
           (warriorsLeft ? warriorsLeft : 1));
   cdb_fputs(outs, COND);
diff '--color=auto' -ruN a/src/curdisp.c b/src/curdisp.c
--- a/src/curdisp.c	1970-01-01 01:00:01.000000000 +0100
+++ b/src/curdisp.c	2024-10-08 11:29:52.129955266 +0200
@@ -156,7 +156,7 @@
       wstandend(corewin);
       if (!--refreshCounter) {
         refreshCounter = refreshInterval;
-        update_statusline(round);
+        update_statusline(roundCounter);
         wrefresh(corewin);
       }
     }
@@ -542,7 +542,7 @@
 text_display_close()
 {
   if (displayLevel) {
-    update_statusline(round - 1);
+    update_statusline(roundCounter - 1);
     wstandout(corewin);
     mvwaddstr(corewin, 0, 0, pressAnyKey);
     wrefresh(corewin);
diff '--color=auto' -ruN a/src/sim.c b/src/sim.c
--- a/src/sim.c	1970-01-01 01:00:01.000000000 +0100
+++ b/src/sim.c	2024-10-08 11:28:21.848284678 +0200
@@ -173,7 +173,7 @@
 mem_struct FAR *memory;
 
 long    cycle;
-int     round;
+int     roundCounter;
 
 char    alloc_p = 0;                /* indicate whether memory has been allocated */
 int     warriorsLeft;                /* number of warriors still left in core */
@@ -328,7 +328,7 @@
 #endif
 
   display_init();
-  round = 1;
+  roundCounter = 1;
   do {                                /* each round */
 #if defined(DOS16) && !defined(SERVER) && !defined(DOSTXTGRAPHX) && !defined(DOSGRXGRAPHX) && !defined(DJGPP)
     fputc('\r', stdout);        /* enable interruption by Ctrl-C */
@@ -1421,13 +1421,13 @@
 #ifndef SERVER
     if (debugState == BREAK) {
       if (warriorsLeft == 1 && warriors != 1)
-	sprintf(outs, warriorTerminatedEndOfRound, W - warrior, W->name, round);
+	sprintf(outs, warriorTerminatedEndOfRound, W - warrior, W->name, roundCounter);
       else
-	sprintf(outs, endOfRound, round);
+	sprintf(outs, endOfRound, roundCounter);
       debugState = cdb(outs);
     }
 #endif
-  } while (++round <= rounds);
+  } while (++roundCounter <= rounds);
 
   display_close();
 #ifdef PERMUTATE
diff '--color=auto' -ruN a/src/sim.h b/src/sim.h
--- a/src/sim.h	1970-01-01 01:00:01.000000000 +0100
+++ b/src/sim.h	2024-10-08 11:27:46.730634854 +0200
@@ -89,7 +89,7 @@
 #define FAR
 #endif
 
-extern int round;
+extern int roundCounter;
 extern long cycle;
 extern ADDR_T progCnt;                /* program counter */
 extern warrior_struct *W;        /* indicate which warrior is running */
+0 −52
Original line number Diff line number Diff line
diff '--color=auto' -ruN a/src/pmars.c b/src/pmars.c
--- a/src/pmars.c	2024-11-12 20:36:28.142766807 +0100
+++ b/src/pmars.c	2024-11-12 20:39:48.096710063 +0100
@@ -72,7 +72,7 @@
 #ifdef PSPACE
 void    pspace_init(void);
 #endif
-#if defined(unix) || defined(__MSDOS__) || defined(VMS)
+#if defined(unix) || defined(__MSDOS__) || defined(VMS) || defined(__MACH__)
 void    sighandler(int dummy);
 #endif
 #if defined(CURSESGRAPHX)
@@ -87,7 +87,7 @@
 #ifdef PSPACE
 void    pspace_init();
 #endif
-#if defined(unix) || defined(__MSDOS__)
+#if defined(unix) || defined(__MSDOS__) || defined(__MACH__)
 void    sighandler();
 #endif
 #if defined(CURSESGRAPHX)
@@ -224,7 +224,7 @@
 }
 
 /* called when ctrl-c is pressed; prepares for debugger entry */
-#if defined(unix) || defined(__MSDOS__) || defined (__OS2__)
+#if defined(unix) || defined(__MSDOS__) || defined (__OS2__) || defined(__MACH__)
 void
 #ifdef __OS2__
         _cdecl
@@ -290,7 +290,7 @@
   int     argc;
   char  **argv;
 {
-#if defined(unix) && !defined(DJGPP)
+#if (defined(unix) && !defined(DJGPP)) || defined(__MACH__)
 #ifdef SIGINT
   signal(SIGINT, sighandler);
 #endif
diff '--color=auto' -ruN a/src/xwindisp.c b/src/xwindisp.c
--- a/src/xwindisp.c	2024-11-12 20:36:28.143766827 +0100
+++ b/src/xwindisp.c	2024-11-12 20:37:39.708178145 +0100
@@ -61,6 +61,9 @@
 #define YELLOW                        14
 #define WHITE                         15
 
+/* defined in pmars.c */
+extern void sighandler(int dummy);
+
  /* X names of the colors we allocate */
 static char *xColorNames[MAXXCOLOR] = {
   "black", "blue3", "green3", "cyan3",
+15 −31
Original line number Diff line number Diff line
diff '--color=auto' -ruN a/src/curdisp.c b/src/curdisp.c
--- a/src/curdisp.c	2025-05-08 23:23:48.070346219 +0200
+++ b/src/curdisp.c	2025-05-08 23:29:33.851400436 +0200
@@ -28,12 +28,6 @@
 #include "sim.h"
 #endif
--- a/src/curdisp.c	2026-01-03 04:22:43.000000000 +0100
+++ b/src/curdisp.c	2026-01-11 20:40:22.526484970 +0100
@@ -33,12 +33,6 @@
 extern unsigned long loopDelayAr[SPEEDLEVELS];
 static int use_color;
 
-/* For window structure in BSD 4.4/Curses 8.x library */
-#ifdef BSD44
@@ -14,44 +14,28 @@ diff '--color=auto' -ruN a/src/curdisp.c b/src/curdisp.c
 typedef struct win_st {
   WINDOW *win;
   int     page;
@@ -428,18 +422,18 @@
@@ -461,11 +455,11 @@
           str--;
           maxchar++;
           leaveok(curwin, TRUE);
-          if (ox = curwin->_curx) {
+          if (ox = getcurx(curwin)) {
 #if 0
 #ifdef ATTRIBUTE
-            mvwaddch(curwin, curwin->_cury, --ox, ' ' | attr);
+            mvwaddch(curwin, getcury(curwin), --ox, ' ' | attr);
 #else
-            mvwaddch(curwin, curwin->_cury, --ox, ' ');
+            mvwaddch(curwin, getcury(curwin), --ox, ' ');
 #endif
 #endif                                /* 0 */
-            mvwaddch(curwin, curwin->_cury, --ox, ' ');
-            wmove(curwin, curwin->_cury, ox);
+          if (ox = getcurx(curwin)) {
+            mvwaddch(curwin, getcury(curwin), --ox, ' ');
+            wmove(curwin, getcury(curwin), ox);
           } else {
-            oy = curwin->_cury - 1;
+            oy = getcury(curwin) - 1;
 #if 0
 #ifdef ATTRIBUTE
             mvwaddch(curwin, oy, COLS - 1, ' ' | attr);
@@ -470,12 +464,12 @@
             mvwaddch(curwin, oy, COLS - 1, ' ');
             wmove(curwin, oy, COLS - 1);
           }
@@ -477,7 +471,7 @@
         leaveok(curwin, TRUE);
         for (getyx(curwin, oy, ox); str > ostr; str--, maxchar++) {
           if (ox--)
 #if 0
 #ifdef ATTRIBUTE
-            mvwaddch(curwin, curwin->_cury, ox, ' ' | attr);
+            mvwaddch(curwin, getcury(curwin), ox, ' ' | attr);
 #else
-            mvwaddch(curwin, curwin->_cury, ox, ' ');
+            mvwaddch(curwin, getcury(curwin), ox, ' ');
 #endif
 #endif                                /* 0 */
-            mvwaddch(curwin, curwin->_cury, ox, ' ');
+            mvwaddch(curwin, getcury(curwin), ox, ' ');
           else
 #if 0
 #ifdef ATTRIBUTE
           mvwaddch(curwin, oy, ox = COLS, ' ');
         }
+4 −9
Original line number Diff line number Diff line
@@ -21,20 +21,15 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "pmars";
  version = "0.9.4";
  version = "0.9.5";

  src = fetchzip {
    url = "http://www.koth.org/pmars/pmars-${finalAttrs.version}.zip";
    hash = "sha256-68zsH9HWWp13pozjMajayS/VhY8iTosUp1CvcAmj/dE=";
    stripRoot = false;
    hash = "sha256-p6iZkb0Nrcj7LtAxtS6Ics5CS9taPHbsoIdE5C1QYnI=";
  };

  patches = [
    # Error under Clang due to global "round" variable: redefinition of 'round' as different kind of symbol
    ./0001-fix-round-redefinition.patch

    # call to undeclared function 'sighandler' & undefined sighandler on Darwin
    ./0002-fix-sighandler.patch

    # ncurses' WINDOW struct was turned opaque for outside code, use functions for accessing values instead
    ./0003-fix-ncurses-opaque-WINDOW.patch
  ];
@@ -43,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: {
    substituteInPlace src/Makefile \
      --replace-fail 'CC = gcc' "CC = $CC" \
      --replace-fail '@strip' "@$STRIP" \
      --replace-fail 'CFLAGS = -O -DEXT94 -DXWINGRAPHX -DPERMUTATE -DRWLIMIT' "CFLAGS = ${
      --replace-fail 'CFLAGS += -O -DEXT94 -DXWINGRAPHX -DPERMUTATE -DRWLIMIT' "CFLAGS += ${
        lib.concatMapStringsSep " " (opt: "-D${opt}") options
      } ${
        lib.optionalString (