lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev dev17 - fix SOURCE_CACHE!= NONE (patch)


From: Leonid Pauzner
Subject: lynx-dev dev17 - fix SOURCE_CACHE!= NONE (patch)
Date: Sun, 19 Dec 1999 21:33:06 +0300 (MSK)

diff -u old/changes ./changes
--- old/changes Wed Dec 15 04:03:18 1999
+++ ./changes   Sun Dec 19 21:15:18 1999
@@ -1,6 +1,7 @@
 Changes since Lynx 2.8 release
 ===============================================================================

++ restore 'from_source_cache' PRIVATE to LYMainLoop.c, add comments -LP
 1999-12-15 (2.8.3dev.17)
 + add a caution to jumpsUnix.html -PW
 + ifdef LYEditKeyForAction() to compile when EXP_ALT_BINDINGS is not defined
@@ -45,7 +46,7 @@
 + don't append (HEAD) to title for INFO screen if already present -KW
 + set newdoc.title to curdoc.title in LYMainLoop.c for SOURCE command.
   Otherwise INFO could show the wrong document's title -KW
-+ made global from_source_cache PRIVATE to LYMainLoop.c -KW
++ made global from_source_cache PRIVATE to mainloop -KW
 + reset DIRED_MENU item list when lynx.cfg is reloaded -KW
 + new lynx.cfg option AUTO_UNCACHE_DIRLISTS for Dired mode, see lynx.cfg -KW
 + prevent filedescriptor and inode leak in HTFWriter.c that occurred if
diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Wed Dec 15 04:03:18 1999
+++ ./lymainlo.c        Sun Dec 19 21:08:16 1999
@@ -368,6 +368,34 @@
     return Newline;
 }

+#ifdef SOURCE_CACHE
+       /*
+        * To reparse current html document under the different settings
+        * we call reparse_document() within mainloop refresh cycle,
+        * it relay on 'curdoc'.
+        *
+        * From the other hand, regular request for new document go to getfile()
+        * and relay on 'newdoc'.
+        *
+        * To work around newdoc.line/curdoc.line/www_search_target/Newline mess
+        * the following flag introduced:
+        */
+PRIVATE BOOLEAN from_source_cache = FALSE;
+
+PRIVATE BOOLEAN reparse_document NOARGS
+{
+       BOOLEAN ok;
+       from_source_cache = TRUE;  /* set for LYMainLoop_pageDisplay() */
+       if (ok = HTreparse_document())
+       {
+               from_source_cache = TRUE;  /* set for mainloop refresh */
+               return ok;
+       }
+       from_source_cache = FALSE;
+       return ok;
+}
+#endif /* SOURCE_CACHE */
+
 /*
  * This is for traversal call from within partial mode in LYUtils.c
  * and HTFormat.c  It simply calls HText_pageDisplay() but utilizes
@@ -378,6 +406,15 @@
        int,            line_num)
 {
 #ifdef DISP_PARTIAL
+#ifdef SOURCE_CACHE
+       /*
+        * reparse_document() acts on 'curdoc' which always on top of the
+        * history stack: no need to resolve #fragment position since
+        * we already know it (curdoc.line).
+        * So bypass here. Sorry for possible confusion...
+        */
+       if (!from_source_cache)
+#endif
     /*
      * Disable display_partial if requested URL has #fragment and we are not
      * popped from the history stack so can't calculate correct newline
@@ -3051,7 +3088,7 @@
                HISTORICAL_ON_VALID_OFF : HISTORICAL_OFF_VALID_ON);
     }
 #ifdef SOURCE_CACHE
-    (void) HTreparse_document();
+    (void) reparse_document();
 #endif
     return;
 }
@@ -3114,7 +3151,7 @@
             CLICKABLE_IMAGES_ON : CLICKABLE_IMAGES_OFF);
 #ifdef SOURCE_CACHE
     if (HTcan_reparse_document()) {
-       HTreparse_document();
+       reparse_document();
        return FALSE;
     }
 #endif
@@ -3279,7 +3316,7 @@
              PSEUDO_INLINE_ALTS_ON : PSEUDO_INLINE_ALTS_OFF);
 #ifdef SOURCE_CACHE
     if (HTcan_reparse_document()) {
-       HTreparse_document();
+       reparse_document();
        return FALSE;
     }
 #endif
@@ -3576,7 +3613,7 @@
        HTAlert(minimal_comments ?
                MINIMAL_ON_IN_EFFECT : MINIMAL_OFF_VALID_ON);
 #ifdef SOURCE_CACHE
-       (void)HTreparse_document();
+       (void)reparse_document();
 #endif
     } else {
        HTAlert(minimal_comments ?
@@ -3706,7 +3743,7 @@
 #ifdef SOURCE_CACHE
                if (reloading == FALSE) {
                    /* one more attempt to be smart enough: */
-                   if (HTreparse_document()) {
+                   if (reparse_document()) {
                        FREE(CurrentUserAgent);
                        FREE(CurrentNegoLanguage);
                        FREE(CurrentNegoCharset);
@@ -4111,7 +4148,7 @@
        HTMLSetCharacterHandling(current_char_set);
 #ifdef SOURCE_CACHE
        if (HTcan_reparse_document()) {
-           HTreparse_document();
+           reparse_document();
            return FALSE;
        }
 #endif
@@ -4258,7 +4295,7 @@
     HTUserMsg(soft_dquotes ?
              SOFT_DOUBLE_QUOTE_ON : SOFT_DOUBLE_QUOTE_OFF);
 #ifdef SOURCE_CACHE
-    (void)HTreparse_document();
+    (void)reparse_document();
 #endif
     return;
 }
@@ -4295,7 +4332,7 @@
     }

 #ifdef SOURCE_CACHE
-    if (HTreparse_document()) {
+    if (reparse_document()) {
        /*
         * These normally get cleaned up after getfile() returns;
         * since we're not calling getfile(), we have to clean them
@@ -4377,7 +4414,7 @@
        if (HTisDocumentSource() && LYPreparsedSource) {
            srcmode_for_next_retrieval(1);
        }
-       if (!HTreparse_document()) {
+       if (!reparse_document()) {
            srcmode_for_next_retrieval(0);
        }
     }
@@ -5770,6 +5807,7 @@
                     */
 #ifdef DISP_PARTIAL
                    /* Newline = newdoc.line; */
+                   display_partial = FALSE; /* for sure, LYNXfoo:/ may be a 
problem */
 #else
                    /* Should not be needed either if we remove
                     * "DISP_PARTIAL" from LYHistory.c, but lets leave it
@@ -6045,7 +6083,7 @@
        if (HTdocument_settings_changed()) {
           if (HTcan_reparse_document()) {
               HTInfoMsg(gettext("Reparsing document under current 
settings..."));
-              HTreparse_document(); /* @@@ignores status */
+              reparse_document();
           } else {
                /*
                 * Urk.  I have no idea how to recover from a failure here.
@@ -6058,6 +6096,12 @@
                        */
            }
        }
+
+       if (from_source_cache)
+       {
+               from_source_cache = FALSE; /* reset */
+               curdoc.line = -1 ;  /* so curdoc.line != Newline, see below */
+       }
 #endif


@@ -6065,6 +6109,8 @@
         *  If the curdoc.line is different than Newline then there must
         *  have been a change since last update.  Run HText_pageDisplay()
         *  create a fresh screen of text out.
+        *
+        *  If we got new HTMainText go this way.
         *  All display_partial calls ends here for final redraw.
         */
        if (curdoc.line != Newline) {




reply via email to

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