[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev more dev22 patch
From: |
Leonid Pauzner |
Subject: |
lynx-dev more dev22 patch |
Date: |
Sun, 18 Apr 1999 15:49:41 +0400 (MSD) |
Assorted notes:
- Oddly, some of the commands I modified reload the document by faking an
LYK_RELOAD, and some by calling HTuncache_current_document(). Any
particular reason for the difference? I ask because the latter did the
HTuncache_...() before printing the associated message and I had to
move it after to get the reparse to work, and I probably did it wrong.
(quoted from original SOURCE_CACHE implementation above).
* Fix reloading with HTreparse_document() for LYK_MINIMAL, LYK_HISTORICAL,
LYK_SOFT_DQUOTES, LYK_SWITCH_DTD mainloop events (hope we work around
replies from POST properly). - LP
diff -u ../gridtext.c ./gridtext.c
--- ../gridtext.c Sat Apr 17 18:46:40 1999
+++ ./gridtext.c Sun Apr 18 14:23:30 1999
@@ -6282,6 +6282,34 @@
return ok;
}
+PUBLIC BOOLEAN HTcan_reparse_document NOARGS
+{
+ if (!HTMainText || LYCacheSource == SOURCE_CACHE_NONE ||
+ (LYCacheSource == SOURCE_CACHE_FILE &&
+ !HTMainText->source_cache_file) ||
+ (LYCacheSource == SOURCE_CACHE_MEMORY &&
+ !HTMainText->source_cache_chunk))
+ return FALSE;
+
+ if (LYCacheSource == SOURCE_CACHE_FILE && HTMainText->source_cache_file) {
+ FILE * fp;
+
+ fp = fopen(HTMainText->source_cache_file, "r");
+ if (!fp) {
+ return FALSE;
+ }
+ fclose(fp);
+ return TRUE;
+ }
+
+ if (LYCacheSource == SOURCE_CACHE_MEMORY &&
+ HTMainText->source_cache_chunk) {
+ return TRUE;
+ }
+
+ return FALSE; /* if came to here */
+}
+
PRIVATE void trace_setting_change ARGS3(
CONST char *, name,
BOOLEAN, prev_setting,
diff -u ../gridtext.h ./gridtext.h
--- ../gridtext.h Tue Apr 13 02:39:16 1999
+++ ./gridtext.h Sun Apr 18 14:47:04 1999
@@ -168,6 +168,7 @@
extern void HTuncache_current_document NOPARAMS;
#ifdef SOURCE_CACHE
extern BOOLEAN HTreparse_document NOPARAMS;
+extern BOOLEAN HTcan_reparse_document NOPARAMS;
extern BOOLEAN HTdocument_settings_changed NOPARAMS;
#endif
extern int HText_getTopOfScreen NOPARAMS;
diff -u ../lymainlo.c ./lymainlo.c
--- ../lymainlo.c Sat Apr 17 22:06:50 1999
+++ ./lymainlo.c Sun Apr 18 14:59:28 1999
@@ -2189,6 +2189,9 @@
break;
case LYK_HISTORICAL: /* toggle 'historical' comments parsing */
+#ifdef SOURCE_CACHE
+ if (!HTcan_reparse_document()) {
+#endif
/*
* Check if this is a reply from a POST, and if so,
* seek confirmation of reload if the safe element
@@ -2200,14 +2203,15 @@
0, 0) == FALSE) {
HTInfoMsg(WILL_NOT_RELOAD_DOC);
} else {
-#ifndef SOURCE_CACHE
HTuncache_current_document();
StrAllocCopy(newdoc.address, curdoc.address);
FREE(curdoc.address);
newdoc.line = curdoc.line;
newdoc.link = curdoc.link;
-#endif
}
+#ifdef SOURCE_CACHE
+ } /* end if no bypass */
+#endif
if (historical_comments)
historical_comments = FALSE;
else
@@ -2221,18 +2225,16 @@
}
#ifdef SOURCE_CACHE
if (HTreparse_document()) {
- break;
+ break; /* OK */
}
- HTuncache_current_document();
- StrAllocCopy(newdoc.address, curdoc.address);
- FREE(curdoc.address);
- newdoc.line = curdoc.line;
- newdoc.link = curdoc.link;
#endif
break;
case LYK_MINIMAL: /* toggle 'minimal' comments parsing */
if (!historical_comments) {
+#ifdef SOURCE_CACHE
+ if (!HTcan_reparse_document()) {
+#endif
/*
* Check if this is a reply from a POST, and if so,
* seek confirmation of reload if the safe element
@@ -2244,14 +2246,15 @@
0, 0) == FALSE) {
HTInfoMsg(WILL_NOT_RELOAD_DOC);
} else {
-#ifndef SOURCE_CACHE
HTuncache_current_document();
StrAllocCopy(newdoc.address, curdoc.address);
FREE(curdoc.address);
newdoc.line = curdoc.line;
newdoc.link = curdoc.link;
-#endif
}
+#ifdef SOURCE_CACHE
+ } /* end if no bypass */
+#endif
}
if (minimal_comments)
minimal_comments = FALSE;
@@ -2266,17 +2269,15 @@
}
#ifdef SOURCE_CACHE
if (HTreparse_document()) {
- break;
+ break; /* OK */
}
- HTuncache_current_document();
- StrAllocCopy(newdoc.address, curdoc.address);
- FREE(curdoc.address);
- newdoc.line = curdoc.line;
- newdoc.link = curdoc.link;
#endif
break;
case LYK_SOFT_DQUOTES:
+#ifdef SOURCE_CACHE
+ if (!HTcan_reparse_document()) {
+#endif
/*
* Check if this is a reply from a POST, and if so,
* seek confirmation of reload if the safe element
@@ -2288,14 +2289,15 @@
1, 1) == FALSE) {
HTInfoMsg(WILL_NOT_RELOAD_DOC);
} else {
-#ifndef SOURCE_CACHE
HTuncache_current_document();
StrAllocCopy(newdoc.address, curdoc.address);
FREE(curdoc.address);
newdoc.line = curdoc.line;
newdoc.link = curdoc.link;
-#endif
}
+#ifdef SOURCE_CACHE
+ } /* end if no bypass */
+#endif
if (soft_dquotes)
soft_dquotes = FALSE;
else
@@ -2304,17 +2306,15 @@
SOFT_DOUBLE_QUOTE_ON : SOFT_DOUBLE_QUOTE_OFF);
#ifdef SOURCE_CACHE
if (HTreparse_document()) {
- break;
+ break; /* OK */
}
- HTuncache_current_document();
- StrAllocCopy(newdoc.address, curdoc.address);
- FREE(curdoc.address);
- newdoc.line = curdoc.line;
- newdoc.link = curdoc.link;
#endif
break;
case LYK_SWITCH_DTD:
+#ifdef SOURCE_CACHE
+ if (!HTcan_reparse_document()) {
+#endif
/*
* Check if this is a reply from a POST, and if so,
* seek confirmation of reload if the safe element
@@ -2345,29 +2345,37 @@
#endif
HTOutputFormat = WWW_SOURCE;
}
-#ifndef SOURCE_CACHE
HTuncache_current_document();
StrAllocCopy(newdoc.address, curdoc.address);
FREE(curdoc.address);
-#endif
- }
#ifdef NO_ASSUME_SAME_DOC
- newdoc.line = 1;
- newdoc.link = 0;
+ newdoc.line = 1;
+ newdoc.link = 0;
#else
- newdoc.line = curdoc.line;
- newdoc.link = curdoc.link;
+ newdoc.line = curdoc.line;
+ newdoc.link = curdoc.link;
#endif /* NO_ASSUME_SAME_DOC */
+ }
+#ifdef SOURCE_CACHE
+ } /* end if no bypass */
+#endif
Old_DTD = !Old_DTD;
HTSwitchDTD(!Old_DTD);
HTUserMsg(Old_DTD ? USING_DTD_0 : USING_DTD_1);
#ifdef SOURCE_CACHE
+ if (HTcan_reparse_document()) {
+ if (HTisDocumentSource() && LYPreparsedSource) {
+#ifdef USE_PSRC
+ if (LYpsrc)
+ psrc_view = TRUE;
+ else
+#endif
+ HTOutputFormat = WWW_SOURCE;
+ }
if (HTreparse_document()) {
break;
}
- HTuncache_current_document();
- StrAllocCopy(newdoc.address, curdoc.address);
- FREE(curdoc.address);
+ } /* end if bypass */
#endif
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lynx-dev more dev22 patch,
Leonid Pauzner <=