lynx-dev
[Top][All Lists]
Advanced

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

LYNX-DEV Patch for displaying a document while it's being downloaded


From: ganesh
Subject: LYNX-DEV Patch for displaying a document while it's being downloaded
Date: Sat, 19 Oct 1996 18:00:47 +0530 (IST)

Hi,
        This is a little patch I wrote to display documents while they're
being retrieved - you don't have to wait for the entire thing to be 
downloaded in order to see it. This is very useful for people with slow 
links.
        You can use the NEXT_PAGE, PREV_PAGE, UP_TWO, DOWN_TWO,
UP_HALF, DOWN_HALF and REFRESH keys to scroll through the document. Of
course, you can't select any link from this partial document, only
view. The status line indicates the number of bytes transferred so far
(as usual). Whenever more data arrive, the screen is _not_
automatically updated. You need to press one of the above keys,
typically REFRESH (^L) to display the new data. When the entire
document has been retrieved, it automatically goes to the first page,
at which time you can select links, etc.
        This works only on text/html documents. While downloading unprintable/
binary e.g. .tgz, .gif etc., or when downloading anything with the 'd' key,
when the above keys are used, they will scroll the current document - the one
from which the 'd' was hit. This is a side effect which is sometimes useful.
        Technical : This patch only affects URLs using the http method,
although it can be trivially extended for ftp etc. 
Basically it checks for any of the above keys in HTCheckInterrupt(), and
uses HText_pageDisplay to display HTMainText. Two globals are used to activate
this hack from HTLoadHTTP(). It is a dirty hack, similar to "multitasking" 
hacks in DOS. But I personally find it _very_ useful ... it SUCKS to wait
around for the entire doc to arrive before you can read a line of it.
        Patch details : The patch is against the standard 2.6 distribution,
made using diff -c. Those who have already installed some patches may have
trouble, but it's fairly straightforward to do it by hand. The files affected
are : Top level Makefile, WWW/Library/Implementation/HTTP.c and src/LYUtils.c
I've only tested this on Solaris 2, but it should work for all other systems.

        Comments/flames/bugs | mailx address@hidden

Here comes patch ...

*** lynx2-6/Makefile.ORG        Sat Oct 19 14:15:11 1996
--- lynx2-6/Makefile    Sat Oct 19 14:23:23 1996
***************
*** 259,268 ****
  #SITE_LIBS= # Your libraries here (remove the "#")
  
  # Set SITE_LYDEFS to one or more of the defines for the WWW Library:
! SITE_LYDEFS = $(DIR_LYDEFS) # Your defines here (remove the "#")
  
  # Set SITE_DEFS to one or more of the defines for lynx below:
! SITE_DEFS = $(DIR_DEFS) # Your defines here (remove the "#")
  
  # if you are compiling on a previously unsupported system, modify
  # this generic entry!!
--- 259,268 ----
  #SITE_LIBS= # Your libraries here (remove the "#")
  
  # Set SITE_LYDEFS to one or more of the defines for the WWW Library:
! SITE_LYDEFS = -DDISP_PARTIAL $(DIR_LYDEFS) # Your defines here (remove the 
"#")
  
  # Set SITE_DEFS to one or more of the defines for lynx below:
! SITE_DEFS = -DDISP_PARTIAL $(DIR_DEFS) # Your defines here (remove the "#")
  
  # if you are compiling on a previously unsupported system, modify
  # this generic entry!!
*** lynx2-6/WWW/Library/Implementation/HTTP.c.ORG       Sat Oct 19 14:40:45 1996
--- lynx2-6/WWW/Library/Implementation/HTTP.c   Sat Oct 19 16:39:14 1996
***************
*** 38,43 ****
--- 38,49 ----
  
  /* #define TRACE 1 */
  
+ #ifdef DISP_PARTIAL
+ int dp_dl_on = 0 ; /* global which activates the paging in HTCheckForInterrupt
+                     when a file is being downloaded */
+ int dp_newline = 1 ; /* newline for paging during downloads */
+ #endif
+ 
  struct _HTStream 
  {
    HTStreamClass * isa;
***************
*** 1225,1231 ****
--- 1231,1243 ----
    (*target->isa->put_block)(target, start_of_data, length);
  
    /* Go pull the bulk of the data down. */
+ #ifdef DISP_PARTIAL
+   dp_dl_on = dp_newline = 1 ;
+ #endif 
    rv = HTCopy(s, NULL, target);
+ #ifdef DISP_PARTIAL
+   dp_dl_on = 0 ;
+ #endif
  
    if (rv == -1)
      {
*** lynx2-6/src/LYUtils.c.ORG   Sat Oct 19 14:39:43 1996
--- lynx2-6/src/LYUtils.c       Sat Oct 19 14:32:14 1996
***************
*** 10,15 ****
--- 10,19 ----
  #include "LYSignal.h"
  #include "GridText.h"
  
+ #ifdef DISP_PARTIAL
+ #include "LYKeymap.h"
+ #endif
+ 
  #ifdef VMS
  #include <descrip.h>
  #include <libclidef.h>
***************
*** 457,462 ****
--- 461,472 ----
  {
  #ifndef VMS /* UNIX stuff: */
      int c;
+ 
+ #ifdef DISP_PARTIAL
+     extern int dp_dl_on, dp_newline ; /* flag to activate hack,
+                                        position in the document */
+ #endif
+ 
  #ifndef USE_SLANG
      struct timeval socket_timeout;
      int ret = 0;
***************
*** 499,504 ****
--- 509,552 ----
      c = LYgetch();
      if (TOUPPER(c) == 'Z' || c == 7 || c == 3)
        return((int)TRUE);
+ 
+ #ifdef DISP_PARTIAL    /* hack to display partially downloaded doc. - ganesh 
*/
+     else if (dp_dl_on) /* yes, there's a document coming down the line */
+       {
+       switch (keymap[c+1])
+         {
+         case LYK_PREV_PAGE :
+           if (dp_newline > 1)
+             dp_newline -= display_lines ;
+           break ;
+         case LYK_NEXT_PAGE :
+           if (HText_canScrollDown())
+             dp_newline += display_lines ;
+           break ;
+         case LYK_UP_TWO :
+           if (dp_newline > 1)
+             dp_newline -= 2 ;
+           break ;
+         case LYK_DOWN_TWO :
+           if (HText_canScrollDown())
+             dp_newline += 2 ;
+           break ;
+         case LYK_UP_HALF :
+           if (dp_newline > 1)
+             dp_newline -= display_lines / 2 ;
+           break ;
+         case LYK_DOWN_HALF :
+           if (HText_canScrollDown())
+             dp_newline += display_lines / 2 ;
+           break ;
+         case LYK_REFRESH :
+           break ;
+         default :
+           return ((int)FALSE) ;
+         }
+       HText_pageDisplay (dp_newline, "") ;
+       }
+ #endif /* DISP_PARTIAL */
  
      /** Other keystrokes **/
      return((int)FALSE);
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;



reply via email to

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