lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev SLANG for DOS port of lynx


From: Doug Kaufman
Subject: lynx-dev SLANG for DOS port of lynx
Date: Mon, 4 May 1998 07:39:04 -0700 (PDT)

For a while the INSTALLATION file has mentioned the possibility of using
SLANG with the DOS port, but I don't know if anyone has actually done
it. This patch is a first attempt at getting SLANG to work with the DOS
port. I wasn't able to get SLang_getkey to work for the extended keys
and instead used the DJGPP funtion getxkeys, which required further
modification of the DOSRAWKEYHACK section. Color seems to be on at all
times with this port, regardless of the color settings in the option
menu.

I took out the PDCurses specific code and replaced it with the
equivalent.

Whoever works on the keymap functions of lynx should take into account,
if possible, that DJGPP gives key values up to 0x293 and PDCurses
gives key values up to 0x212 (of course, these sets of values are
incompatible).

The patch follows. I have attached the file "makefile.dsl", for
compiling the DOS SLANG version.
                             Doug

*** lynx2-8/src/LYCurses.c      Thu Apr 23 05:35:22 1998
--- lynx2-8/src/LYCurses.c.new  Sat May  2 14:57:04 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)
***************
*** 691,696 ****
--- 691,697 ----
        }
        size_change(0);
  
+ #ifndef __DJGPP__
        SLtt_add_color_attribute(4, SLTT_ULINE_MASK);
        SLtt_add_color_attribute(5, SLTT_ULINE_MASK);
        /*
***************
*** 702,707 ****
--- 703,709 ----
        } else {
            SLtt_Blink_Mode = 0;
        }
+ #endif /* __DJGPP__ */
      }
      slinit = 1;
      Current_Attr = 0;
***************
*** 719,725 ****
      scrollok(0,0);
      SLsmg_Backspace_Moves = 1;
  #ifndef VMS
! #ifndef _WINDOWS
     SLtty_set_suspend_state(1);
  #endif /* !_WINDOWS */
  #ifdef SIGTSTP
--- 721,727 ----
      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    Sat May  2 19:36:32 1998
***************
*** 33,38 ****
--- 33,42 ----
  #ifdef DOSPATH
  #include <HTDOS.h>
  #endif
+ #ifdef __DJGPP__
+ #include <dos.h>
+ #endif /* __DJGPP__ */
+ 
  
  #ifndef VMS
  #ifdef SYSLOG_REQUESTED_URLS
***************
*** 400,408 ****
  #endif
  
  #ifdef __DJGPP__
  void  reset_break()
  {
!     PDC_set_ctrl_break(init_ctrl_break[0]);
  }
  #endif /* __DJGPP__ */
  
--- 404,429 ----
  #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);
--- 576,583 ----
  #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 Mon May  4 07:17:00 1998
***************
*** 14,19 ****
--- 14,23 ----
  #include <LYOptions.h>
  #include <LYCharSets.h>
  #include <HTString.h>
+ #ifdef __DJGPP__
+ #include <pc.h>
+ #include <keys.h>
+ #endif /* __DJGPP__ */
  
  #include <ctype.h>
  
***************
*** 232,238 ****
--- 236,246 ----
  #ifdef VMS
  #define GetChar() ttgetc()
  #else
+ #ifdef __DJGPP__
+ #define GetChar getxkey
+ #else
  #define GetChar (int)SLang_getkey
+ #endif /* __DJGPP__ */
  #endif /* VMS */
  #endif /* USE_SLANG */
  
***************
*** 353,370 ****
--- 361,403 ----
     }
  #endif /* !USE_SLANG || VMS */
  
+ /* The RAWDOSKEYHACK takes key definitions from curses.h (when using
+  * PDCURSES) or from the DJGPP file keys.h (when using SLANG) and maps
+  * them to the values used by the lynx file LYKeymap.c. */
+ 
  #ifdef RAWDOSKEYHACK
      if (raw_dos_key_hack) {
        if (c == 0) c = '/';
        if (c > 255) {      /* handle raw dos keys */
            switch (c)
            {
+ #ifdef USE_SLANG
+               case 328: c = 256;      break; /* up arrow */     
+               case 584: c = 256;      break; /* up arrow */     
+               case 336: c = 257;      break; /* down arrow */   
+               case 592: c = 257;      break; /* down arrow */   
+               case 331: c = 259;      break; /* left arrow */   
+               case 587: c = 259;      break; /* left arrow */   
+               case 333: c = 258;      break; /* right arrow */          
+               case 589: c = 258;      break; /* right arrow */          
+               case 337: c = 260;      break; /* page down */    
+               case 593: c = 260;      break; /* page down */    
+               case 329: c = 261;      break; /* page up */      
+               case 585: c = 261;      break; /* page up */      
+               case 327: c = 262;      break; /* HOME */         
+               case 583: c = 262;      break; /* HOME */         
+               case 335: c = 263;      break; /* END */          
+               case 591: c = 263;      break; /* END */          
+               case 315: c = 264;      break; /* F1 */   
+               case 301: c = 4;        break;  /* alt x */
+ #else /* PDCURSES */
                case 464: c = '-';      break;  /* keypad minus*/
                case 465: c = '+';      break;  /* keypad plus*/
                case 459: c = 13;       break;  /* keypad enter*/
                case 463: c = '*';      break;  /* keypad * */
                case 440: c = 'Q';      break;  /* alt x */
                case 265: c = 'H';      break;  /* F1 */
+ #endif /* USE_SLANG */
                default: break;
            }
        }

__
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

SLANGINC = -I/slang/src
SLANGLIB = /slang/src/djgobjs/libslang.a
CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)

CC = gcc
MCFLAGS = -O3 -DRAWDOSKEYHACK -DUSE_ZLIB -DUSE_EXTERNALS -DUSE_SLANG 
-DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP 
-Ichrtrans -I../WWW/library/implementation   -I../djgpp/tcplib/include 
-I../djgpp/tcplib/include/tcp
WWWLIB = ../WWW/library/djgpp/libwww.a  ../djgpp/tcplib/obj/libtcp.a
LIBS=-lz -lwmemu

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) -g $(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
LYCookie.o: ../userdefs.h

#UCdomap.o: UCdomap.c ../userdefs.h lycharsets.h
#UCdomap.o: UCdomap.c chrtrans/UCkd.h chrtrans/makeuctb chrtrans/makeuctb.c \
#                UCdomap.h UCMap.h ../userdefs.h
#UCAux.o : UCAux.c $(CMN)UCAux.h $(CMN)UCDefs.h


reply via email to

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