lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev dev.15 patch 4


From: Leonid Pauzner
Subject: lynx-dev dev.15 patch 4
Date: Sun, 28 Nov 1999 00:21:32 +0300 (MSK)

This patch undo some of my dev.15 changes
and made things in slightly other fashion as
we agree with Klaus.
No functionality is changed here. See explanation below.



diff -u old/changes ./changes
--- old/changes Thu Nov 18 14:14:54 1999
+++ ./changes   Sun Nov 28 00:05:54 1999
@@ -1,6 +1,12 @@
 Changes since Lynx 2.8 release
 ===============================================================================

+* 'prev_target' now PRIVATE to LYMainLoop.c [defined outside of mainloop()],
+  this undo some dev.15 changes. -LP, KW
+* replace HText_pageDisplay() calls from partial mode (LYUtils.c
+  and HTFormat.c) with LYMainLoop_pageDisplay() function implemented
+  in LYMainLoop.c, it simply call HText_pageDisplay() but has access
+  to LYMainLoop.c PRIVATE variables. -LP, KW
 1999-11-17 (2.8.3dev.15)
 * add popup in options menu to control alternate organizations of the
   visited links page (Ilya Zakharevich)
@@ -18,11 +24,6 @@
 * undo recent no_color_video check for A_BOLD, A_UNDERLINE since this did not
   have the intended effect (reported by KW) -TD
 * add note to lynx_url_support.html about lynxcgi -PW
-* reorganize the code:  'search_target' now became global, so display_page()
-  and highlight() could be called from any place easily.  This was a mainloop
-  local variable (name changed from 'prev_target' to avoid conflict elsewhere),
-  the value currently changed in mainloop(), handle_LYK_WHEREIS() and
-  textsearch() -LP
 * add user search in partial mode (while loading of the document is in
   progress).  Scrolling to the string in question is not working properly yet
   if you repeat 'n' next time.  More work required -LP
diff -u old/htformat.c ./htformat.c
--- old/htformat.c      Thu Nov 18 14:14:14 1999
+++ ./htformat.c        Sun Nov 28 00:05:20 1999
@@ -49,6 +49,11 @@
 #include <LYGlobalDefs.h>
 #include <LYLeaks.h>

+#ifdef DISP_PARTIAL
+#include LYMainLoop.h
+#endif
+
+
 PUBLIC BOOL HTOutputSource = NO;       /* Flag: shortcut parser to stdout */
 /* extern  BOOL interactive; LJM */

@@ -541,7 +546,7 @@
                 */
        ) {
            NumOfLines_partial = HText_getNumOfLines();
-           HText_pageDisplay(Newline_partial);
+           LYMainLoop_pageDisplay(Newline_partial);
        }
     }
 #else /* nothing */
diff -u old/gridtext.c ./gridtext.c
--- old/gridtext.c      Thu Nov 18 14:20:04 1999
+++ ./gridtext.c        Sun Nov 28 00:05:16 1999
@@ -1671,9 +1671,10 @@
 /*     Output a page
 **     -------------
 */
-PRIVATE void display_page ARGS2(
+PRIVATE void display_page ARGS3(
        HText *,        text,
-       int,            line_number)
+       int,            line_number,
+       char *,         target)
 {
     HTLine * line = NULL;
     int i;
@@ -1693,7 +1694,6 @@
 #ifdef DISP_PARTIAL
     int last_disp_partial = -1;
 #endif
-    CONST char *target = search_target;  /* search_target is global */

     lynx_mode = NORMAL_LYNX_MODE;

@@ -1723,6 +1723,7 @@
 #endif /* DISP_PARTIAL */

     tmp[0] = tmp[1] = tmp[2] = '\0';
+    if (target && *target == '\0') target = NULL;
     text->page_has_target = NO;
     if (display_lines <= 0) {
        /*  No screen space to display anything!
@@ -2166,7 +2167,7 @@
                /*
                 *  Bold the link after incrementing nlinks.
                 */
-               highlight(OFF, (nlinks - 1));
+               highlight(OFF, (nlinks - 1), target);

                display_flag = TRUE;

@@ -6628,8 +6629,9 @@
  *  starting from the line 'line_num'-1.
  *  This is the primary call for lynx.
  */
-PUBLIC void HText_pageDisplay ARGS1(
-       int,            line_num)
+PUBLIC void HText_pageDisplay ARGS2(
+       int,            line_num,
+       char *,         target)
 {
 #ifdef DISP_PARTIAL
     if (debug_display_partial || (LYTraceLogFP != NULL)) {
@@ -6653,7 +6655,7 @@
     }
 #endif

-    display_page(HTMainText, line_num-1);
+    display_page(HTMainText, line_num-1, target);

 #ifdef DISP_PARTIAL
     if (display_partial && debug_display_partial)
@@ -6724,7 +6726,7 @@
        HText *,        text)
 {
     if (text->stale)
-       display_page(text, text->top_of_screen);
+       display_page(text, text->top_of_screen, "");
 }

 PUBLIC int HText_sourceAnchors ARGS1(
@@ -6752,25 +6754,25 @@
 PUBLIC void HText_scrollTop ARGS1(
        HText *,        text)
 {
-    display_page(text, 0);
+    display_page(text, 0, "");
 }

 PUBLIC void HText_scrollDown ARGS1(
        HText *,        text)
 {
-    display_page(text, text->top_of_screen + display_lines);
+    display_page(text, text->top_of_screen + display_lines, "");
 }

 PUBLIC void HText_scrollUp ARGS1(
        HText *,        text)
 {
-    display_page(text, text->top_of_screen - display_lines);
+    display_page(text, text->top_of_screen - display_lines, "");
 }

 PUBLIC void HText_scrollBottom ARGS1(
        HText *,        text)
 {
-    display_page(text, text->Lines - display_lines);
+    display_page(text, text->Lines - display_lines, "");
 }


@@ -6838,7 +6840,7 @@
        if (loaded_texts && HTList_removeObject(loaded_texts, text))
            HTList_addObject(loaded_texts, text);
          /* let lynx do it */
-       /* display_page(text, text->top_of_screen); */
+       /* display_page(text, text->top_of_screen, ""); */
     }
     return YES;
 }
diff -u old/gridtext.h ./gridtext.h
--- old/gridtext.h      Thu Nov 18 14:20:04 1999
+++ ./gridtext.h        Sun Nov 28 00:05:18 1999
@@ -108,7 +108,7 @@
 extern void HText_scrollDown PARAMS((HText * text));   /* One page */
 extern void HText_scrollTop PARAMS((HText * text));
 extern void HText_scrollBottom PARAMS((HText * text));
-extern void HText_pageDisplay PARAMS((int line_num));
+extern void HText_pageDisplay PARAMS((int line_num, char *target));
 extern BOOL HText_pageHasPrevTarget NOPARAMS;

 extern int HText_LinksInLines PARAMS((HText *text, int line_num, int Lines));
diff -u old/lyglobal.h ./lyglobal.h
--- old/lyglobal.h      Thu Nov 18 14:20:12 1999
+++ ./lyglobal.h        Sun Nov 28 00:05:26 1999
@@ -292,10 +292,6 @@
 extern BOOLEAN display_partial_flag; /* permanent flag, not mutable */
 extern int Newline; /* original newline position, from mainloop() */
 #endif
-
-extern char search_target[512];             /* user search string:             
      *
-                                     * used by highlight() and display_page(),*
-                                     * changed in LYMainLoop.c only          */
 extern char *form_post_data;         /* User data for post form */
 extern char *form_get_data;          /* User data for get form */
 extern char *http_error_file;        /* Place HTTP status code in this file */
diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Thu Nov 18 14:20:20 1999
+++ ./lymainlo.c        Sun Nov 28 00:05:30 1999
@@ -197,7 +197,7 @@
 PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */
 PUBLIC char * LYRequestReferer = NULL; /* Referer, may be set in getfile() */

-PUBLIC char search_target[512];      /* now global */
+PRIVATE char prev_target[512];

 #ifdef DISP_PARTIAL
 PUBLIC int Newline_partial = 0;     /* required for display_partial mode */
@@ -359,6 +359,18 @@
     return TRUE;
 }

+/*
+ * This is for traversal call from within partial mode in LYUtils.c
+ * and HTFormat. It simply calls HText_pageDisplay()
+ * but utilizes LYMainLoop.c PRIVATE variables (currently 'prev_target').
+ * Perhaps, this could adhere more logic from mainloop(), in the future.
+ */
+PUBLIC void LYMainLoop_pageDisplay ARG1 (
+   int,   line_num)
+{
+           HText_pageDisplay(line_num, prev_target);
+}
+
 PRIVATE int do_change_link NOARGS
 {
     /* Is there a mouse-clicked link waiting? */
@@ -367,7 +379,7 @@
     if (mouse_tmp != -1) {
        if (curdoc.link >= 0 && curdoc.link < nlinks
         && curdoc.link != mouse_tmp) {
-           highlight(OFF, curdoc.link);
+           highlight(OFF, curdoc.link, prev_target);
        }
        if (mouse_tmp < 0 || mouse_tmp >= nlinks) {
            char *msgtmp = NULL;
@@ -2135,7 +2147,7 @@

        newlink = find_link_near_col(*follow_col, 1);
        if (newlink > -1) {
-           highlight(OFF, curdoc.link);
+           highlight(OFF, curdoc.link, prev_target);
            curdoc.link = newlink;
        } else if (more) {  /* next page */
                Newline += (display_lines);
@@ -2654,7 +2666,7 @@
                    nextlink--;
                }
        }
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link = nextlink;
        return FALSE;           /* and we are done. */

@@ -2724,7 +2736,7 @@
        }
     }
     if (samepage) {
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link = nextlink;
        return;         /* and we are done. */

@@ -2733,7 +2745,7 @@
      * Move to the top link on the page.
      */
     } else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link = 0;

     } else if (more && /* need a later page */
@@ -3422,7 +3434,7 @@
 {
     if (curdoc.link>0 &&
                links[curdoc.link].ly == links[curdoc.link-1].ly) {
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link--;
     }
 }
@@ -3480,7 +3492,7 @@
            newdoc.isHEAD = FALSE;
            newdoc.safe = FALSE;
            newdoc.internal_link = FALSE;
-           highlight(OFF, curdoc.link);
+           highlight(OFF, curdoc.link, prev_target);
 #ifdef DIRED_SUPPORT
            if (lynx_edit_mode)
                HTuncache_current_document();
@@ -3737,7 +3749,7 @@
     int,       real_c)
 {
     if (curdoc.link < nlinks-1) {      /* next link */
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
 #ifdef FASTTAB
        /*
         *  Move to different textarea if TAB in textarea.
@@ -3765,7 +3777,7 @@
      * Move to the top link on the page.
      */
     } else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link = 0;

     } else if (more) { /* next page */
@@ -3784,7 +3796,7 @@
     if (more) {
        Newline += display_lines;
     } else if (curdoc.link < nlinks-1) {
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link = nlinks-1;  /* put on last link */
     } else if (*old_c != real_c) {
        *old_c = real_c;
@@ -3823,7 +3835,7 @@
        /*
         *  Unhighlight current link.
         */
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link--;

     } else if (!more &&
@@ -3834,7 +3846,7 @@
         *  link and just move the cursor to last link on
         *  the page.
         */
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link = nlinks-1;  /* the last link */

     } else if (curdoc.line > 1) {      /* previous page */
@@ -3977,7 +3989,7 @@
     if (Newline > 1) {
        Newline -= display_lines;
     } else if (curdoc.link > 0) {
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link = 0;  /* put on first link */
     } else if (*old_c != real_c) {
        *old_c = real_c;
@@ -4140,7 +4152,7 @@
 {
     if (curdoc.link<nlinks-1 &&
                links[curdoc.link].ly == links[curdoc.link+1].ly) {
-       highlight(OFF, curdoc.link);
+       highlight(OFF, curdoc.link, prev_target);
        curdoc.link++;
     }
 }
@@ -4368,10 +4380,10 @@
            }
        }
        if (curdoc.link < nlinks-1) {
-           highlight(OFF, curdoc.link);
+           highlight(OFF, curdoc.link, prev_target);
            curdoc.link++;
        } else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-           highlight(OFF, curdoc.link);
+           highlight(OFF, curdoc.link, prev_target);
            curdoc.link = 0;
        } else if (more) {  /* next page */
            Newline += (display_lines);
@@ -4554,7 +4566,7 @@

        newlink = find_link_near_col(*follow_col, -1);
        if (newlink > -1) {
-           highlight(OFF, curdoc.link);
+           highlight(OFF, curdoc.link, prev_target);
            curdoc.link = newlink;
        } else if (*old_c != real_c) {
            *old_c = real_c;
@@ -4701,37 +4713,37 @@
     int,       cmd,
     BOOLEAN *, refresh_screen)
 {
-    BOOLEAN have_target_onscreen = (*search_target != '\0' &&
+    BOOLEAN have_target_onscreen = (*prev_target != '\0' &&
                                    HText_pageHasPrevTarget());
     BOOL found;
     int oldcur = curdoc.link; /* temporarily remember */
     char *remember_old_target = NULL;
     if (have_target_onscreen)
-       StrAllocCopy(remember_old_target, search_target);
+       StrAllocCopy(remember_old_target, prev_target);
     else
        StrAllocCopy(remember_old_target, "");

     if (cmd != LYK_NEXT) {
        /*
-        *  Reset search_target to force prompting
+        *  Reset prev_target to force prompting
         *  for a new search string and to turn
         *  off highlighting if no search string
         *  is entered by the user.
         */
-       *search_target = '\0';
-       found = textsearch(&curdoc, search_target, FALSE);
+       *prev_target = '\0';
+       found = textsearch(&curdoc, prev_target, FALSE);
     } else {
        /*
         *  When the third argument is TRUE, the previous
         *  search string, if any, will be recalled from
-        *  a buffer, loaded into search_target, and used
+        *  a buffer, loaded into prev_target, and used
         *  for the search without prompting for a new
         *  search string.  This allows the LYK_NEXT
         *  command to repeat a search in a new document,
-        *  after search_target was reset on fetch of that
+        *  after prev_target was reset on fetch of that
         *  document.
         */
-       found = textsearch(&curdoc, search_target, TRUE);
+       found = textsearch(&curdoc, prev_target, TRUE);
     }

     /*
@@ -4755,9 +4767,9 @@
               curdoc.link >= 0 && nlinks > 0 &&
               links[curdoc.link].ly >= (display_lines/3)) {
        *refresh_screen = TRUE;
-    } else if ((case_sensitive && 0!=strcmp(search_target,
+    } else if ((case_sensitive && 0!=strcmp(prev_target,
                                            remember_old_target)) ||
-             (!case_sensitive && 0!=strcasecomp8(search_target,
+             (!case_sensitive && 0!=strcasecomp8(prev_target,
                                            remember_old_target))) {
        *refresh_screen = TRUE;
     }
@@ -4823,7 +4835,7 @@
                            newdoc.internal_link = curdoc.internal_link;
                            HTInfoMsg(CANCELLED);
                            if (nlinks > 0)
-                               HText_pageDisplay(curdoc.line);
+                               HText_pageDisplay(curdoc.line, prev_target);
                            break;
                        } else if (LYresubmit_posts) {
                            /* If LYresubmit_posts is set, and the
@@ -4909,7 +4921,7 @@
                     *  follow_link_number(), and re-initialize
                     *  the new link value. - FM
                     */
-                   highlight(OFF, curdoc.link);
+                   highlight(OFF, curdoc.link, prev_target);
                    curdoc.link = newdoc.link;
                    newdoc.link = 0;
                }
@@ -5006,7 +5018,7 @@
  *  curdoc.address contains the name of the file that is currently open.
  *  newdoc.address contains the name of the file that will soon be
  *                  opened if it exits.
- *  search_target  contains the last search string the user searched for.
+ *  prev_target    contains the last search string the user searched for.
  *  newdoc.title   contains the link name that the user last chose to get
  *                  into the current link (file).
  */
@@ -5029,7 +5041,7 @@
 #endif
     nhist = 0;
     user_input_buffer[(sizeof(user_input_buffer) - 1)] = '\0';
-    *search_target = '\0';
+    *prev_target = '\0';
     *user_input_buffer = '\0';
 #ifdef LY_FIND_LEAKS
     atexit(free_mainloop_variables);
@@ -5247,7 +5259,7 @@
                    LYPermitURL = TRUE;
                }

-               *search_target = '\0';  /* Reset for new coming document */
+               *prev_target = '\0';    /* Reset for new coming document */
                Newline = newdoc.line; /* bypass for partial mode */
 #ifdef DISP_PARTIAL
                display_partial = display_partial_flag; /* restore */
@@ -5729,7 +5741,7 @@
                    }
 #else
                    Newline = newdoc.line; /* now here, no partial mode */
-                   /* *search_target = '\0'; */ /* Reset for this document. - 
FM */
+                   /* *prev_target = '\0'; */ /* Reset for this document. - FM 
*/
 #endif

                    /*
@@ -6044,7 +6056,7 @@

            refresh_screen = FALSE;

-           HText_pageDisplay(Newline);
+           HText_pageDisplay(Newline, prev_target);

 #ifdef DIRED_SUPPORT
            if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
@@ -6123,7 +6135,7 @@
 #else
            clear();
 #endif /* FANCY_CURSES || USE_SLANG */
-           HText_pageDisplay(Newline);
+           HText_pageDisplay(Newline, prev_target);

 #ifdef DIRED_SUPPORT
            if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
@@ -6253,7 +6265,7 @@
             /*
              *  Highlight current link.
              */
-           highlight(ON, curdoc.link);
+           highlight(ON, curdoc.link, prev_target);
        }

        if (traversal) {
diff -u old/lymainlo.h ./lymainlo.h
--- old/lymainlo.h      Wed Nov 17 21:08:08 1999
+++ ./lymainlo.h        Sun Nov 28 00:05:32 1999
@@ -12,6 +12,7 @@
 extern void repaint_main_statusline PARAMS((int for_what));

 /* made them available in partial mode */
+extern void LYMainLoop_pageDisplay  PARAMS((int line_num));
 extern void handle_LYK_TRACE_TOGGLE  NOPARAMS;
 extern void handle_LYK_WHEREIS  PARAMS((int cmd, BOOLEAN *refresh_screen));

diff -u old/lysearch.c ./lysearch.c
--- old/lysearch.c      Thu Nov 18 14:20:24 1999
+++ ./lysearch.c        Sun Nov 28 00:05:36 1999
@@ -351,7 +351,7 @@
        /*
         *  Found in link, changed cur, we're done.
         */
-       highlight(OFF, oldcur);
+       highlight(OFF, oldcur, prev_target);
        return(TRUE);
     }

@@ -371,7 +371,7 @@
      */
     www_user_search((cur_doc->line + offset), cur_doc, prev_target);
     if (cur_doc->link != oldcur) {
-       highlight(OFF, oldcur);
+       highlight(OFF, oldcur, prev_target);
        return(TRUE);
     }
     return (BOOL) (www_search_result > 0);
diff -u old/lyutils.c ./lyutils.c
--- old/lyutils.c       Thu Nov 18 15:15:38 1999
+++ ./lyutils.c Sun Nov 28 00:05:40 1999
@@ -120,9 +120,10 @@
 /*
  *  Highlight (or unhighlight) a given link.
  */
-PUBLIC void highlight ARGS2(
+PUBLIC void highlight ARGS3(
        int,            flag,
-       int,            cur)
+       int,            cur,
+       char *,         target)
 {
     char buffer[200];
     int i;
@@ -142,7 +143,6 @@
     BOOL hl2_drawn=FALSE;      /* whether links[cur].hightext2 is already drawn
                                   properly */
 #endif
-    CONST char *target = search_target;  /* search_target is global */
     tmp[0] = tmp[1] = tmp[2] = '\0';

     /*
@@ -2331,7 +2331,7 @@
           case LYK_WHEREIS: /* search within the document */
           case LYK_NEXT:        /* search for the next occurrence in the 
document */
               handle_LYK_WHEREIS(cmd, &do_refresh);
-              if (do_refresh && www_search_result != -1) {
+              if (www_search_result != -1) {
                    Newline_partial = www_search_result;
                    www_search_result = -1;     /* reset */
               }
@@ -2405,7 +2405,7 @@
            if (Newline_partial < 1)
                Newline_partial = 1;
            NumOfLines_partial = HText_getNumOfLines();
-           HText_pageDisplay(Newline_partial);
+           LYMainLoop_pageDisplay(Newline_partial);
        }
 #endif /* DISP_PARTIAL */
        break;
diff -u old/lyutils.h ./lyutils.h
--- old/lyutils.h       Thu Nov 18 14:20:30 1999
+++ ./lyutils.h Sun Nov 28 00:05:42 1999
@@ -118,7 +118,7 @@
 extern void change_sug_filename PARAMS((char *fname));
 extern void convert_to_spaces PARAMS((char *string, BOOL condense));
 extern void free_and_clear PARAMS((char **obj));
-extern void highlight PARAMS((int flag, int cur));
+extern void highlight PARAMS((int flag, int cur, char *target));
 extern void noviceline PARAMS((int more_flag));
 extern void parse_restrictions PARAMS((CONST char *s));
 extern void print_restrictions_to_fd PARAMS((FILE *fp));




reply via email to

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