lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev New patch for DJGPP and SLANG


From: Doug Kaufman
Subject: lynx-dev New patch for DJGPP and SLANG
Date: Wed, 13 May 1998 07:43:03 -0700 (PDT)

I cleaned up my original patch to use the DJGPP keyhandler with
SLANG and have integrated it with Bill's patch, so that this will be
controlled by the new define "DJGPP_KEYHANDLER". As far as I can tell,
the SLANG keyhandler doesn't work with the ALT keys (or at least I
haven't been able to find how to do it in the documentation). With the
DJGPP_KEYHANDLER, remapping of ALT keys should be possible under SLANG.
Since the version 2.8.1dev.10 had some problems, this is a resubmission
of a patch against 2.8.1dev.9. I also noted that I accidentally included
some features in the makefile that were specific to my system, so two
makefiles are appended. Makefile.wsl is for Bill's version with the
SLkp_getkey function as keyhandler, and makefile.dsl has the DJGPP
function getxkey as the keyhandler.

Bill's patch also had a change that I didn't understand to LYUtils.c,
where the SLtt_get_screen_size was ifdef'd for UNIX or VMS only. At
least with the version 1.2.2 of SLANG that I used, this didn't seem
necessary. I couldn't see any difference compiling with or without this.
If we do need to exclude it for DJGPP, should we really do it as 
"#ifdef UNIX || VMS", or would it be better to do "#ifndef __DJGPP__"? 
I don't know how many systems are excluded by the first method.

The patch follows. The two makefiles are attached.
                                  Doug

*** lynx2-8/src/LYCurses.c      Sat May  2 16:39:12 1998
--- lynx2-8/src/LYCurses.c.new  Wed May 13 05:56:58 1998
***************
*** 157,163 ****
      SLang_init_tty(3, 0, 1);
  #endif /* SLANG_VERSION > 9929 */
      signal(SIGTSTP, sl_suspend);
! #ifndef _WINDOWS
      SLtty_set_suspend_state(1);
  #endif
      if (sig == SIGTSTP)
--- 157,163 ----
      SLang_init_tty(3, 0, 1);
  #endif /* SLANG_VERSION > 9929 */
      signal(SIGTSTP, sl_suspend);
! #if !defined (_WINDOWS) && !defined(__DJGPP__)
      SLtty_set_suspend_state(1);
  #endif
      if (sig == SIGTSTP)
***************
*** 655,660 ****
--- 655,664 ----
  
      if (slinit == 0) {
        SLtt_get_terminfo();
+ #if defined(__DJGPP__) && !defined(DJGPP_KEYHANDLER)
+       SLkp_init ();
+ #endif /* __DJGPP__ && !DJGPP_KEYHANDLER */
+ 
  #ifdef UNIX
  #if SLANG_VERSION >= 9935
        SLang_TT_Read_FD = fileno(stdin);
***************
*** 691,696 ****
--- 695,702 ----
        }
        size_change(0);
  
+ #ifndef __DJGPP__
+ #if defined(VMS) || defined(UNIX)
        SLtt_add_color_attribute(4, SLTT_ULINE_MASK);
        SLtt_add_color_attribute(5, SLTT_ULINE_MASK);
        /*
***************
*** 702,709 ****
--- 708,722 ----
        } else {
            SLtt_Blink_Mode = 0;
        }
+ #endif /* VMS || UNIX */
+ #endif /* __DJGPP__ */
      }
+ #ifdef __DJGPP__
+     else sock_init();
+ #endif /* __DJGPP__ */
+ 
      slinit = 1;
+ 
      Current_Attr = 0;
  #ifndef VMS
  #if SLANG_VERSION > 9929
***************
*** 719,725 ****
      scrollok(0,0);
      SLsmg_Backspace_Moves = 1;
  #ifndef VMS
! #ifndef _WINDOWS
     SLtty_set_suspend_state(1);
  #endif /* !_WINDOWS */
  #ifdef SIGTSTP
--- 732,738 ----
      scrollok(0,0);
      SLsmg_Backspace_Moves = 1;
  #ifndef VMS
! #if !defined(_WINDOWS) && !defined(__DJGPP__)
     SLtty_set_suspend_state(1);
  #endif /* !_WINDOWS */
  #ifdef SIGTSTP
*** lynx2-8/src/LYMain.c        Sat May  2 16:39:12 1998
--- lynx2-8/src/LYMain.c.new    Sun May 10 13:14:46 1998
***************
*** 34,39 ****
--- 34,43 ----
  #include <HTDOS.h>
  #endif
  
+ #ifdef __DJGPP__
+ #include <dos.h>
+ #endif /* __DJGPP__ */
+ 
  #ifndef VMS
  #ifdef SYSLOG_REQUESTED_URLS
  #include <syslog.h>
***************
*** 400,408 ****
  #endif
  
  #ifdef __DJGPP__
  void  reset_break()
  {
!     PDC_set_ctrl_break(init_ctrl_break[0]);
  }
  #endif /* __DJGPP__ */
  
--- 404,428 ----
  #endif
  
  #ifdef __DJGPP__
+ int LY_set_ctrl_break(int setting)
+ {
+       (void*)signal(SIGINT,(setting ? SIG_DFL : SIG_IGN));
+       setcbrk(setting);
+ }
+ 
+ int   LY_get_ctrl_break()
+ {
+       typedef union REGS Regs;
+       extern Regs regs;
+       regs.h.ah = 0x33;
+       regs.h.al = 0x00;
+       int86(0x21, &regs, &regs);
+       return ((int) regs.h.dl);
+ }
+ 
  void  reset_break()
  {
!     LY_set_ctrl_break(init_ctrl_break[0]);
  }
  #endif /* __DJGPP__ */
  
***************
*** 555,562 ****
  #endif /* _WINDOWS */
  
  #ifdef __DJGPP__
! if (PDC_get_ctrl_break() == 0) {
!     PDC_set_ctrl_break(TRUE);
      init_ctrl_break[0] = 0;}
  else {init_ctrl_break[0] = 1;}
      atexit(reset_break);
--- 575,582 ----
  #endif /* _WINDOWS */
  
  #ifdef __DJGPP__
! if (LY_get_ctrl_break() == 0) {
!     LY_set_ctrl_break(TRUE);
      init_ctrl_break[0] = 0;}
  else {init_ctrl_break[0] = 1;}
      atexit(reset_break);
*** lynx2-8/src/LYStrings.c     Sat May  2 16:39:12 1998
--- lynx2-8/src/LYStrings.c.new Tue May 12 00:10:38 1998
***************
*** 15,20 ****
--- 15,25 ----
  #include <LYCharSets.h>
  #include <HTString.h>
  
+ #ifdef DJGPP_KEYHANDLER
+ #include <pc.h>
+ #include <keys.h>
+ #endif /* DJGPP_KEYHANDLER */
+ 
  #include <ctype.h>
  
  #include <LYLeaks.h>
***************
*** 232,238 ****
--- 237,251 ----
  #ifdef VMS
  #define GetChar() ttgetc()
  #else
+ #ifdef __DJGPP__
+ #ifdef DJGPP_KEYHANDLER
+ #define GetChar getxkey
+ #else
+ #define GetChar SLkp_getkey
+ #endif /* DJGPP_KEYHANDLER */
+ #else
  #define GetChar (int)SLang_getkey
+ #endif /* __DJGPP__ */
  #endif /* VMS */
  #endif /* USE_SLANG */
  
***************
*** 554,559 ****
--- 567,640 ----
        if (isdigit(a) && (b == '[' || c == 155) && d != -1 && d != '~')
            d = GetChar();
      }
+ #if defined(__DJGPP__) && defined(USE_SLANG)
+ #ifdef DJGPP_KEYHANDLER
+     else { /* DJGPP keypad interface (see file "keys.h" for definitions) */
+       switch (c) {
+               case K_Up: c = UPARROW;         break; /* up arrow */     
+               case K_EUp: c = UPARROW;        break; /* up arrow */     
+               case K_Down: c = DNARROW;       break; /* down arrow */   
+               case K_EDown: c = DNARROW;      break; /* down arrow */   
+               case K_Right: c = RTARROW;      break; /* right arrow */  
+               case K_ERight: c = RTARROW;     break; /* right arrow */  
+               case K_Left: c = LTARROW;       break; /* left arrow */   
+               case K_ELeft: c = LTARROW;      break; /* left arrow */   
+               case K_PageDown: c = PGDOWN;    break; /* page down */  
+               case K_EPageDown: c = PGDOWN;   break; /* page down */  
+               case K_PageUp: c = PGUP;        break; /* page up */  
+               case K_EPageUp: c = PGUP;       break; /* page up */  
+               case K_Home: c = HOME;          break; /* HOME */  
+               case K_EHome: c = HOME;         break; /* HOME */  
+               case K_End: c = END_KEY;        break; /* END */          
+               case K_EEnd: c = END_KEY;       break; /* END */          
+               case K_F1: c = F1;              break; /* F1 */   
+               case K_Alt_X: c = 4;            break;  /* alt x */
+       }
+     }
+ #else
+     else { /* SLang keypad interface (see file "slang.h" for definitions) */
+       switch (c) {
+         case SL_KEY_UP:
+           c = UPARROW;
+           break;
+         case SL_KEY_DOWN:
+           c = DNARROW;
+           break;
+         case SL_KEY_RIGHT:
+           c = RTARROW;
+           break;
+         case SL_KEY_B2:
+           c = DO_NOTHING;
+           break;
+         case SL_KEY_LEFT:
+           c = LTARROW;
+           break;
+         case SL_KEY_PPAGE:
+         case SL_KEY_A3:
+           c = PGUP;
+           break;
+         case SL_KEY_NPAGE:
+         case SL_KEY_C3:
+           c = PGDOWN;
+           break;
+         case SL_KEY_HOME:
+         case SL_KEY_A1:
+           c = HOME;
+           break;
+         case SL_KEY_END:
+         case SL_KEY_C1:
+           c = END_KEY;
+           break;
+         case SL_KEY_F(1):
+           c = F1;
+           break;
+         case SL_KEY_BACKSPACE:
+           c = 127;
+           break;
+       }
+     }
+ #endif /* DJGPP_KEYHANDLER */
+ #endif /* __DJGPP__ && USE_SLANG */
  #if HAVE_KEYPAD
      else {
        /*

__
Doug Kaufman
Internet: address@hidden (preferred)
          address@hidden
OBJS= UCdomap.o UCAux.o UCAuto.o \
LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
LYMail.o HTAlert.o GridText.o LYGetFile.o \
LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \
LYStyle.o LYHash.o

CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)

CC = gcc
MCFLAGS = -O3 -DUSE_ZLIB -DUSE_EXTERNALS \
-DUSE_SLANG -DDJGPP_KEYHANDLER -DACCESS_AUTH -DNO_CUSERID \
-DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implement 
-I../djgpp/tcplib/include \
-I./chrtrans -I../djgpp/tcplib/include/tcp
WWWLIB = ../WWW/library/djgpp/libwww.a ../djgpp/tcplib/obj/libtcp.a
LIBS= -lslang -lz
CHRTR= ./chrtrans/

all: lynx.exe

lynx.exe:   message $(OBJS) $(WWWLIB)
        @echo "Linking and creating Lynx executable"
        $(CC) $(CFLAGS) -o lynx.exe  $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
        @echo "Welcome to Lynx!"

message:
        @echo "Compiling Lynx sources"

dbg:    $(OBJS) $(WWWLIB)
        @echo "Making Lynx code"
        $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)

lint:
        lint *.c  > ../lint.out

clean:
        rm -f lynx.exe core *.[ob]

LYMain.o: ../userdefs.h
LYMainLoop.o: LYMainLoop.c ../userdefs.h
LYReadCFG.o: LYReadCFG.c ../userdefs.h
HTFWriter.o: HTFWriter.c ../userdefs.h
LYGetFile.o: LYGetFile.c ../userdefs.h
LYOptions.o: LYOptions.c ../userdefs.h
LYReadCFG.o: LYReadCFG.c ../userdefs.h
LYTraversal.o: LYTraversal.c ../userdefs.h
LYCharSets.o: LYCharSets.c ../userdefs.h
LYShowInfo.o: LYShowInfo.c ../userdefs.h
LYStrings.o: LYStrings.c ../userdefs.h
LYBookmark.o: LYBookmark.c ../userdefs.h
LYHistory.o: LYHistory.c ../userdefs.h
LYDownload.o: LYDownload.c ../userdefs.h
DefaultStyle.o: DefaultStyle.c ../userdefs.h
LYEditmap.o: LYEditmap.c ../userdefs.h
LYCharUtils.o: LYCharUtils.c ../userdefs.h
LYExtern.o: LYExtern.c ../userdefs.h
LyUtils.o: LYUtils.c ../userdefs.h
LYCookie.o: ../userdefs.h
OBJS= UCdomap.o UCAux.o UCAuto.o \
LYClean.o LYShowInfo.o LYEdit.o LYStrings.o \
LYMail.o HTAlert.o GridText.o LYGetFile.o \
LYMain.o LYMainLoop.o LYCurses.o LYBookmark.o LYUtils.o \
LYOptions.o LYReadCFG.o LYSearch.o LYHistory.o \
LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \
HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \
LYStyle.o LYHash.o

CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)

CC = gcc
MCFLAGS = -O3 -DUSE_ZLIB -DUSE_EXTERNALS \
-DUSE_SLANG -DACCESS_AUTH -DNO_CUSERID \
-DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/library/implement 
-I../djgpp/tcplib/include \
-I./chrtrans -I../djgpp/tcplib/include/tcp
WWWLIB = ../WWW/library/djgpp/libwww.a ../djgpp/tcplib/obj/libtcp.a
LIBS= -lslang -lz
CHRTR= ./chrtrans/

all: lynx.exe

lynx.exe:   message $(OBJS) $(WWWLIB)
        @echo "Linking and creating Lynx executable"
        $(CC) $(CFLAGS) -o lynx.exe  $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)
        @echo "Welcome to Lynx!"

message:
        @echo "Compiling Lynx sources"

dbg:    $(OBJS) $(WWWLIB)
        @echo "Making Lynx code"
        $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS)

lint:
        lint *.c  > ../lint.out

clean:
        rm -f lynx.exe core *.[ob]

LYMain.o: ../userdefs.h
LYMainLoop.o: LYMainLoop.c ../userdefs.h
LYReadCFG.o: LYReadCFG.c ../userdefs.h
HTFWriter.o: HTFWriter.c ../userdefs.h
LYGetFile.o: LYGetFile.c ../userdefs.h
LYOptions.o: LYOptions.c ../userdefs.h
LYReadCFG.o: LYReadCFG.c ../userdefs.h
LYTraversal.o: LYTraversal.c ../userdefs.h
LYCharSets.o: LYCharSets.c ../userdefs.h
LYShowInfo.o: LYShowInfo.c ../userdefs.h
LYStrings.o: LYStrings.c ../userdefs.h
LYBookmark.o: LYBookmark.c ../userdefs.h
LYHistory.o: LYHistory.c ../userdefs.h
LYDownload.o: LYDownload.c ../userdefs.h
DefaultStyle.o: DefaultStyle.c ../userdefs.h
LYEditmap.o: LYEditmap.c ../userdefs.h
LYCharUtils.o: LYCharUtils.c ../userdefs.h
LYExtern.o: LYExtern.c ../userdefs.h
LyUtils.o: LYUtils.c ../userdefs.h
LYCookie.o: ../userdefs.h

reply via email to

[Prev in Thread] Current Thread [Next in Thread]