[Pkg-nethack-devel] Bug#215899: nethack-lisp: LISP Windowing patch update

Mario Lang Mario Lang <mlang@debian.org>, 215899@bugs.debian.org
Wed, 15 Oct 2003 12:36:10 +0200


Package: nethack-lisp
Version: 3.4.2-1
Severity: critical
Tags: patch

The following patch makes the nethack-lisp binary package work again.

It was generated based on the enh-342.patch from nethack-el-0.9.2.

I can do an NMU for nethack to integrate this if you prefer that.

--- /tmp/nethack-3.4.2/debian/patches/12_lisp_windowing.dpatch	2003-10-15 11:48:38.000000000 +0200
+++ 12_lisp_windowing.dpatch	2003-09-14 22:24:57.000000000 +0200
@@ -110,7 +126,7 @@
 +E void FDECL(lisp_outrip, (winid,int));
 +
 +#endif /* WINLISP_H */
---- nethack-3.4.1/src/windows.c	2003-02-23 06:43:31.000000000 -0800
+--- nethack-3.4.2/src/windows.c	2003-08-29 17:07:43.000000000 -0700
 +++ nethack/src/windows.c	2002-04-23 17:44:58.000000000 -0700
 @@ -40,6 +40,10 @@
  #ifdef MSWIN_GRAPHICS
@@ -133,8 +149,69 @@
      { 0, 0 }		/* must be last */
  };
  
---- nethack-3.4.1/win/tty/termcap.c	2003-02-23 06:43:46.000000000 -0800
-+++ nethack/win/tty/termcap.c	2003-03-09 13:49:04.000000000 -0800
+--- nethack-3.4.2/sys/unix/Makefile.src	2003-08-29 17:08:04.000000000 -0700
++++ nethack/sys/unix/Makefile.src	2003-09-13 12:35:00.000000000 -0700
+@@ -213,9 +213,14 @@
+ #WINBEOBJ = winbe.o NHWindow.o NHMenuWindow.o NHMapWindow.o tile.o
+ 
+ #
++# Files for the lisp port
++WINLISPSRC = ../win/lisp/winlisp.c tile.c
++WINLISPOBJ = winlisp.o tile.o
++
++#
+ #
+-WINSRC = $(WINTTYSRC)
+-WINOBJ = $(WINTTYOBJ)
++WINSRC = $(WINLISPSRC)
++WINOBJ = $(WINLISPOBJ)
+ 
+ # on some systems the termcap library is in -ltermcap or -lcurses
+ # on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
+@@ -254,8 +259,11 @@
+ #
+ # libraries for BeOS 
+ WINBELIB = -lbe
++#
++# libraries for lisp port
++WINLISPLIB =
+ 
+-WINLIB = $(WINTTYLIB)
++WINLIB = $(WINLISPLIB)
+ 
+ # any other strange libraries your system needs (for Sysunix only -- the more
+ # specialized targets should already be right)
+@@ -338,7 +346,7 @@
+ GENCSRC = monstr.c vis_tab.c	#tile.c
+ 
+ # all windowing-system-dependent .c (for dependencies and such)
+-WINCSRC = $(WINTTYSRC) $(WINX11SRC) $(WINGNOMESRC) $(WINGEMSRC)
++WINCSRC = $(WINTTYSRC) $(WINX11SRC) $(WINGNOMESRC) $(WINGEMSRC) $(WINLISPSRC)
+ # all windowing-system-dependent .cpp (for dependencies and such)
+ WINCXXSRC = $(WINQTSRC) $(WINBESRC)
+ 
+@@ -682,6 +690,9 @@
+ 	$(CC) $(CFLAGS) -c ../win/gem/load_img.c
+ gr_rect.o: ../win/gem/gr_rect.c ../include/gr_rect.h
+ 	$(CC) $(CFLAGS) -c ../win/gem/gr_rect.c
++winlisp.o: ../win/lisp/winlisp.c $(HACK_H) ../include/winlisp.h \
++		../include/func_tab.h ../include/dlb.h ../include/patchlevel.h
++	$(CC) $(CFLAGS) -c ../win/lisp/winlisp.c
+ tile.o: tile.c $(HACK_H)
+ qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../include/func_tab.h \
+ 		../include/dlb.h ../include/patchlevel.h ../include/tile2x11.h \
+@@ -802,7 +813,8 @@
+ weapon.o: weapon.c $(HACK_H)
+ were.o: were.c $(HACK_H)
+ wield.o: wield.c $(HACK_H)
+-windows.o: windows.c $(HACK_H) ../include/wingem.h ../include/winGnome.h
++windows.o: windows.c $(HACK_H) ../include/wingem.h ../include/winGnome.h \
++	../include/winlisp.h
+ wizard.o: wizard.c $(HACK_H) ../include/qtext.h ../include/epri.h
+ worm.o: worm.c $(HACK_H) ../include/lev.h
+ worn.o: worn.c $(HACK_H)
+--- nethack-3.4.2/win/tty/termcap.c	2003-08-29 17:08:25.000000000 -0700
++++ nethack/win/tty/termcap.c	2003-03-09 13:50:46.000000000 -0800
 @@ -1161,6 +1161,11 @@
  	if (windowprocs.name != NULL &&
  	    !strcmpi(windowprocs.name, "Gem")) return TRUE;
@@ -147,9 +224,20 @@
  #ifdef QT_GRAPHICS
  	/* XXX has_color() should be added to windowprocs */
  	if (windowprocs.name != NULL &&
---- /dev/null	1969-12-31 16:00:00.000000000 -0800
-+++ nethack/win/lisp/ChangeLog	2002-09-19 21:15:20.000000000 -0700
-@@ -0,0 +1,293 @@
+--- /dev/null	2003-05-01 12:00:27.000000000 -0700
++++ nethack/win/lisp/ChangeLog	2003-06-03 02:04:26.000000000 -0700
+@@ -0,0 +1,304 @@
++2003-06-03  Shawn Betts  <sabetts@sfu.ca>
++
++	* winlisp.c (lisp_print_glyph): Pass special to the print-glyph
++	lisp function as a symbol. delete the MG_PET bit in special if
++	iflags.hilite_pet is not set.
++	(special_glyph_to_string): new function
++
++2003-05-14  Shawn Betts  <sabetts@sfu.ca>
++
++	* winlisp.c (lisp_string): Also escape the backslash character.
++
 +2002-09-19  Ryan Yeske  <rcyeske@vcn.bc.ca>
 +
 +	* winlisp.c (lisp_cmd): nethack-api-* renamed to nhapi-*.
@@ -443,9 +531,9 @@
 +	s/nethack-api-updated-inventory/nethack-api-update-inventory/
 +	(WINLISP_VOID_RETVAL): added macro, called for every void
 +	function.
---- /dev/null	1969-12-31 16:00:00.000000000 -0800
-+++ nethack/win/lisp/winlisp.c	2002-09-19 21:15:20.000000000 -0700
-@@ -0,0 +1,1820 @@
+--- /dev/null	2003-05-01 12:00:27.000000000 -0700
++++ nethack/win/lisp/winlisp.c	2003-09-13 12:38:18.000000000 -0700
+@@ -0,0 +1,1876 @@
 +/* Copyright (c) Shawn Betts, Ryan Yeske, 2001                    */
 +/* NetHack may be freely redistributed.  See license for details. */
 +
@@ -676,6 +764,7 @@
 +struct window_procs lisp_procs = {
 +  "lisp",
 +  WC_COLOR|WC_HILITE_PET,
++  0L,
 +  lisp_init_nhwindows,
 +  lisp_player_selection,
 +  lisp_askname,
@@ -770,19 +859,20 @@
 +    }						\
 +  while (0)
 +#define lisp_int(i) printf("%d ",i)
-+#define lisp_string(s)				\
-+  do 						\
-+     {						\
-+       int nhi;					\
-+       printf ("\"");				\
-+       if (s)					\
-+	 for (nhi=0;nhi<strlen(s);nhi++) 	\
-+	   {					\
-+	     if (s[nhi] == 34) putchar('\\');	\
-+	     putchar(s[nhi]);			\
-+	   }					\
-+       printf("\" ");				\
-+     } 						\
++#define lisp_string(s)					\
++  do							\
++     {							\
++       int nhi;						\
++       printf ("\"");					\
++       if (s)						\
++	 for (nhi=0;nhi<strlen(s);nhi++)		\
++	   {						\
++	     if (s[nhi] == 34 				\
++		 || s[nhi] == 92) putchar('\\');	\
++	     putchar(s[nhi]);				\
++	   }						\
++       printf("\" ");					\
++     }							\
 +  while (0)
 +
 +static const char*
@@ -810,6 +900,31 @@
 +}
 +
 +static const char*
++special_glyph_to_string(special)
++     unsigned special;
++{
++  switch (special)
++    {
++    case MG_CORPSE:
++      return "corpse";
++    case MG_INVIS:
++      return "invis";
++    case MG_DETECT:
++      return "detect";
++    case MG_PET:
++      return "pet";
++    case MG_RIDDEN:
++      return "ridden";
++    }
++  
++  /* If it's a combination, just return special. */
++  if (special)
++    return "special";
++  else
++    return "none";
++}
++
++static const char*
 +wintype_to_string(type)
 +     int type;
 +{
@@ -2217,14 +2332,43 @@
 +    /* map glyph to character and color */
 +    mapglyph(glyph, &ch, &color, &special, x, y);
 +
++    /* If the user doesn't want to highlight the pet, then we erase
++       the PET bit from special. In the lisp code the special argument
++       will be 'pet if the glyph is a pet and will be printed in the
++       color of the pet highlight face. But we don't want this if the
++       user hasn't turned on hilite_pet. */
++    if (!iflags.hilite_pet)
++      {
++	special &= ~MG_PET;
++      }
++
 +    if (window == WIN_MAP)
-+      lisp_cmd ("print-glyph",
-+		lisp_int (x);
-+		lisp_int (y);
-+		lisp_int (color);
-+		lisp_int (glyph);
-+		lisp_int (glyph2tile[glyph]);
-+		lisp_int (ch););
++      {
++	/* The last parameter, special, is optional. It is only
++	   present when the tile is special in some way. FIXME: This
++	   duplicate code is a bit gross. */
++	if (special)
++	  {
++	    lisp_cmd ("print-glyph",
++		      lisp_int (x);
++		      lisp_int (y);
++		      lisp_int (color);
++		      lisp_int (glyph);
++		      lisp_int (glyph2tile[glyph]);
++		      lisp_int (ch);
++		      lisp_literal (special_glyph_to_string (special)););
++	  }
++	else
++	  {
++	    lisp_cmd ("print-glyph",
++		      lisp_int (x);
++		      lisp_int (y);
++		      lisp_int (color);
++		      lisp_int (glyph);
++		      lisp_int (glyph2tile[glyph]);
++		      lisp_int (ch););
++	  }
++      }
 +    else
 +      lisp_cmd ("error",
 +		lisp_string ("lisp_print_glyph bad window");



-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux lexx 2.4.22-speakup #1 Sun Oct 12 18:38:48 CEST 2003 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages nethack-lisp depends on:
ii  libc6                         2.3.2-8    GNU C Library: Shared libraries an
ii  nethack-common                3.4.2-1    Common files for Nethack dungeon c

-- no debconf information


-- 
CYa,
  Mario | Debian Developer <URL:http://debian.org/>
        | Get my public key via finger mlang@db.debian.org
        | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44