lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev PATCH [dev21]: source caching ("raw_mode" patch)


From: Leonid Pauzner
Subject: lynx-dev PATCH [dev21]: source caching ("raw_mode" patch)
Date: Mon, 12 Apr 1999 17:28:23 +0400 (MSD)

10-Apr-99 23:59 Scott Bigham wrote:

> In this implementation, each document kept in cache has associated with it
> a temporary file containing the HTML source for the document (well, not all
> of them -- only those using the HTTP protocol, on the premise that file://
> documents are probably local and ftp:// documents are probably not HTML).
> The temporary file is deleted when the document is uncached.  For certain
> operations, instead of reloading the document via HTLoad<mumble>(), the
> source file is reparsed with HTParseFile().  The cached document also
> remembers certain parser settings (screen size, historical vs. minimal vs.
> valid comment parsing, and the like), and is regenerated from source if it


Accidentally, I found a longstanding bug with LYRawMode handling in lynx:
HTMLSetCharacterHandling() from LYCharSets.c called a lot in getfile() cyrcle,
it can change LYRawMode for its internal needs without any invention
from user, probably due to a bug.
It was not bothering us before but arise unexpectedly in SOURCE_CACHE mode.
>From trace:

HTAccess: Document already in memory.
HTdocument_settings_changed: RAW_MODE setting has changed (was OFF, now ON)
User message: Reparsing document under current settings...
Reparsing from source memory cache 208974
HTFormat: Constructing stream stack for text/html to www/present

So this is a chartrans problem (LYOptions.c and LYCharSets.c).

In fact, LYRawMode is a very internal parameter (probably not used now)
and out of our hands.  LYUseDefaultRawMode can be changed by user instead.
So immediate patch applyed
(affects LYMainLoop.c and recent SOURCE_CACHE code in GridText.c,
also add some traces for LYCharSets.c):


diff -u old/gridtext.c ./gridtext.c
--- old/gridtext.c      Mon Apr 12 10:39:10 1999
+++ ./gridtext.c        Mon Apr 12 16:32:38 1999
@@ -191,7 +191,7 @@
         */
        BOOLEAN                 clickable_images;
        BOOLEAN                 pseudo_inline_alts;
-       BOOLEAN                 raw_mode;
+       BOOLEAN                 use_default_raw_mode;
        BOOLEAN                 historical_comments;
        BOOLEAN                 minimal_comments;
        BOOLEAN                 soft_dquotes;
@@ -529,7 +529,7 @@
      */
     self->clickable_images = clickable_images;
     self->pseudo_inline_alts = pseudo_inline_alts;
-    self->raw_mode = LYRawMode;
+    self->use_default_raw_mode = LYUseDefaultRawMode;
     self->historical_comments = historical_comments;
     self->minimal_comments = minimal_comments;
     self->soft_dquotes = soft_dquotes;
@@ -6407,7 +6407,9 @@
        trace_setting_change("PSEUDO_INLINE_ALTS",
                             HTMainText->pseudo_inline_alts,
                             pseudo_inline_alts);
-       trace_setting_change("RAW_MODE", HTMainText->raw_mode, LYRawMode);
+       trace_setting_change("RAW_MODE",
+                            HTMainText->use_default_raw_mode,
+                            LYUseDefaultRawMode);
        trace_setting_change("HISTORICAL_COMMENTS",
                             HTMainText->historical_comments,
                             historical_comments);
@@ -6424,7 +6426,7 @@

     return (HTMainText->clickable_images != clickable_images ||
            HTMainText->pseudo_inline_alts != pseudo_inline_alts ||
-           HTMainText->raw_mode != LYRawMode ||
+           HTMainText->use_default_raw_mode != LYUseDefaultRawMode ||
            HTMainText->historical_comments != historical_comments ||
            HTMainText->minimal_comments != minimal_comments ||
            HTMainText->soft_dquotes != soft_dquotes ||

diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Mon Apr 12 10:39:14 1999
+++ ./lymainlo.c        Mon Apr 12 16:29:34 1999
@@ -248,7 +248,7 @@
     BOOLEAN rlink_allowed;
     BOOLEAN vi_keys_flag = vi_keys;
     BOOLEAN emacs_keys_flag = emacs_keys;
-    BOOLEAN LYRawMode_flag = LYRawMode;
+    BOOLEAN LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
 #ifndef NO_OPTION_MENU
     BOOLEAN LYSelectPopups_flag = LYSelectPopups;
     BOOLEAN verbose_img_flag = verbose_img;
@@ -3975,7 +3975,7 @@
                CurrentCharSet_flag != current_char_set ||
                CurrentAssumeCharSet_flag != UCLYhndl_for_unspec ||
                verbose_img_flag != verbose_img ||
-               LYRawMode_flag != LYRawMode ||
+               LYUseDefaultRawMode_flag != LYUseDefaultRawMode ||
                LYSelectPopups_flag != LYSelectPopups ||
                ((strcmp(CurrentUserAgent, (LYUserAgent ?
                                            LYUserAgent : "")) ||
@@ -4044,7 +4044,7 @@
            CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
            show_dotfiles_flag = show_dotfiles;
            verbose_img_flag = verbose_img;
-           LYRawMode_flag = LYRawMode;
+           LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
            LYSelectPopups_flag = LYSelectPopups;
            StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
                                            LYUserAgent : ""));
@@ -5557,7 +5557,7 @@
                LYUseDefaultRawMode = !LYUseDefaultRawMode;
                HTUserMsg(LYRawMode ? RAWMODE_OFF : RAWMODE_ON);
                HTMLSetCharacterHandling(current_char_set);
-               LYRawMode_flag = LYRawMode;
+               LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
 #ifdef SOURCE_CACHE
                if (HTreparse_document()) {
                    refresh_screen = TRUE;


diff -u old/lycharse.c ./lycharse.c
--- old/lycharse.c      Thu Mar 18 11:05:46 1999
+++ ./lycharse.c        Mon Apr 12 17:19:50 1999
@@ -397,6 +397,8 @@
 PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
 {
     int chndl = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset);
+    BOOLEAN LYRawMode_flag = LYRawMode;
+    int UCLYhndl_for_unspec_flag = UCLYhndl_for_unspec;

     if (LYCharSet_UC[i].enc != UCT_ENC_CJK) {
        HTCJK = NOCJK;
@@ -484,6 +486,19 @@

     ena_csi((LYlowest_eightbit[current_char_set] > 155));

+
+    /* some diagnostics */
+    it (TRACE) {
+       if (LYRawMode_flag != LYRawMode)
+         CTRACE(tfp, "HTMLSetCharacterHandling: LYRawMode changed %s -> %s\n",
+                       (LYRawMode_flag ? "ON" : "OFF"),
+                       (LYRawMode      ? "ON" : "OFF"));
+       if (UCLYhndl_for_unspec_flag != UCLYhndl_for_unspec)
+         CTRACE(tfp, "HTMLSetCharacterHandling: UCLYhndl_for_unspec changed %d 
-> %d\n",
+                       UCLYhndl_for_unspec_flag,
+                       UCLYhndl_for_unspec);
+    }
+
     return;
 }




reply via email to

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