about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-08-29 23:26:30 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-08-29 23:26:30 -0400
commit51f21bae26e432283a7b5e2b6c558bffe8bbb034 (patch)
tree08b61afd9adc7cd5635bed6d21d3bd4e3867ce75 /WWW
parent3c7cb4bbcd56c17e1abba05f20d001a2484d9919 (diff)
downloadlynx-snapshots-51f21bae26e432283a7b5e2b6c558bffe8bbb034.tar.gz
snapshot of project "lynx", label v2-8-1dev_23
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTAnchor.c108
-rw-r--r--WWW/Library/Implementation/HTFormat.c42
-rw-r--r--WWW/Library/Implementation/HTUtils.h1
3 files changed, 78 insertions, 73 deletions
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index ef76ee1b..59b4cd50 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -45,7 +45,7 @@ PRIVATE int HASH_FUNCTION ARGS1(
     for (p = (CONST unsigned char *)cp_address, hash = 0; *p; p++)
 	hash = (int) (hash * 3 + (*(CONST unsigned char *)p)) % HASH_SIZE;
 
-    return hash;
+    return(hash);
 }
 
 typedef struct _HyperDoc Hyperdoc;
@@ -90,7 +90,7 @@ PRIVATE HTParentAnchor * HTParentAnchor_new NOARGS
     newAnchor->expires = NULL;		/* Expires. - FM */
     newAnchor->last_modified = NULL;	/* Last-Modified. - FM */
     newAnchor->server = NULL;		/* Server. - FM */
-    return newAnchor;
+    return(newAnchor);
 }
 
 PRIVATE HTChildAnchor * HTChildAnchor_new NOARGS
@@ -116,12 +116,12 @@ PRIVATE BOOL HTEquivalent ARGS2(
     if (s && t) {  /* Make sure they point to something */
 	for (; *s && *t; s++, t++) {
 	    if (TOUPPER(*s) != TOUPPER(*t)) {
-		return NO;
+		return(NO);
 	    }
 	}
-	return TOUPPER(*s) == TOUPPER(*t);
+	return( TOUPPER(*s) == TOUPPER(*t));
     } else {
-	return s == t;	/* Two NULLs are equivalent, aren't they ? */
+	return(s == t); 	/* Two NULLs are equivalent, aren't they ? */
     }
 }
 
@@ -143,12 +143,12 @@ PRIVATE BOOL HTIdentical ARGS2(
     if (s && t) {  /* Make sure they point to something */
 	for (; *s && *t; s++, t++) {
 	    if (*s != *t) {
-		return NO;
+		return(NO);
 	    }
 	}
-	return *s == *t;
+	return(*s == *t);
     } else {
-	return s == t;	/* Two NULLs are identical, aren't they ? */
+	return(s == t); 	/* Two NULLs are identical, aren't they ? */
     }
 }
 #endif /* CASE_INSENSITIVE_ANCHORS */
@@ -169,7 +169,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
 
     if (!parent) {
 	CTRACE(tfp, "HTAnchor_findChild called with NULL parent.\n");
-	return NULL;
+	return(NULL);
     }
     if ((kids = parent->children) != 0) {
 	/*
@@ -185,7 +185,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
 		{
 		    CTRACE(tfp, "Child anchor %p of parent %p with name `%s' already exists.\n",
 				(void *)child, (void *)parent, tag);
-		    return child;
+		    return(child);
 		}
 	    }
 	}  /*  end if tag is void */
@@ -201,7 +201,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
     HTList_addObject (parent->children, child);
     child->parent = parent;
     StrAllocCopy(child->tag, tag);
-    return child;
+    return(child);
 }
 
 
@@ -249,7 +249,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4(
 	FREE(parsed_doc.address);
 	FREE(relative_to);
     }
-    return child;
+    return(child);
 }
 
 /*
@@ -717,7 +717,7 @@ PUBLIC void HTAnchor_makeLastChild ARGS1(
 PUBLIC HTParentAnchor * HTAnchor_parent ARGS1(
 	HTAnchor *,	me)
 {
-    return me ? me->parent : NULL;
+    return( me ? me->parent : NULL);
 }
 
 PUBLIC void HTAnchor_setDocument ARGS2(
@@ -731,7 +731,7 @@ PUBLIC void HTAnchor_setDocument ARGS2(
 PUBLIC HyperDoc * HTAnchor_document ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->document : NULL;
+    return( me ? me->document : NULL);
 }
 
 
@@ -764,7 +764,7 @@ PUBLIC char * HTAnchor_address ARGS1(
 			   me->parent->address, ((HTChildAnchor *)me)->tag);
 	}
     }
-    return addr;
+    return(addr);
 }
 
 PUBLIC void HTAnchor_setFormat ARGS2(
@@ -778,7 +778,7 @@ PUBLIC void HTAnchor_setFormat ARGS2(
 PUBLIC HTFormat HTAnchor_format ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->format : NULL;
+    return( me ? me->format : NULL);
 }
 
 PUBLIC void HTAnchor_setIndex ARGS2(
@@ -803,7 +803,7 @@ PUBLIC void HTAnchor_setPrompt ARGS2(
 PUBLIC BOOL HTAnchor_isIndex ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->isIndex : NO;
+    return( me ? me->isIndex : NO);
 }
 
 /*	Whether Anchor has been designated as an ISMAP link
@@ -812,13 +812,13 @@ PUBLIC BOOL HTAnchor_isIndex ARGS1(
 PUBLIC BOOL HTAnchor_isISMAPScript ARGS1(
 	HTAnchor *,	me)
 {
-    return me ? me->parent->isISMAPScript : NO;
+    return( me ? me->parent->isISMAPScript : NO);
 }
 
 PUBLIC BOOL HTAnchor_hasChildren ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? ! HTList_isEmpty(me->children) : NO;
+    return( me ? ! HTList_isEmpty(me->children) : NO);
 }
 
 #if defined(USE_HASH)
@@ -827,7 +827,7 @@ PUBLIC BOOL HTAnchor_hasChildren ARGS1(
 PUBLIC CONST char * HTAnchor_style ARGS1(
 	HTParentAnchor *,	me)
 {
-	return me ? me->style : NULL;
+	return( me ? me->style : NULL);
 }
 
 PUBLIC void HTAnchor_setStyle ARGS2(
@@ -846,7 +846,7 @@ PUBLIC void HTAnchor_setStyle ARGS2(
 PUBLIC CONST char * HTAnchor_title ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->title : NULL;
+    return( me ? me->title : NULL);
 }
 
 PUBLIC void HTAnchor_setTitle ARGS2(
@@ -888,7 +888,7 @@ PUBLIC void HTAnchor_appendTitle ARGS2(
 PUBLIC CONST char * HTAnchor_bookmark ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->bookmark : NULL;
+    return( me ? me->bookmark : NULL);
 }
 
 PUBLIC void HTAnchor_setBookmark ARGS2(
@@ -904,7 +904,7 @@ PUBLIC void HTAnchor_setBookmark ARGS2(
 PUBLIC CONST char * HTAnchor_owner ARGS1(
 	HTParentAnchor *,	me)
 {
-    return (me ? me->owner : NULL);
+    return( me ? me->owner : NULL);
 }
 
 PUBLIC void HTAnchor_setOwner ARGS2(
@@ -921,7 +921,7 @@ PUBLIC void HTAnchor_setOwner ARGS2(
 PUBLIC CONST char * HTAnchor_RevTitle ARGS1(
 	HTParentAnchor *,	me)
 {
-    return (me ? me->RevTitle : NULL);
+    return( me ? me->RevTitle : NULL);
 }
 
 PUBLIC void HTAnchor_setRevTitle ARGS2(
@@ -948,7 +948,7 @@ PUBLIC void HTAnchor_setRevTitle ARGS2(
 PUBLIC CONST char * HTAnchor_SugFname ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->SugFname : NULL;
+    return( me ? me->SugFname : NULL);
 }
 
 /*	Content-Encoding handling. - FM
@@ -958,7 +958,7 @@ PUBLIC CONST char * HTAnchor_SugFname ARGS1(
 PUBLIC CONST char * HTAnchor_content_encoding ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->content_encoding : NULL;
+    return( me ? me->content_encoding : NULL);
 }
 
 /*	Content-Type handling. - FM
@@ -966,7 +966,7 @@ PUBLIC CONST char * HTAnchor_content_encoding ARGS1(
 PUBLIC CONST char * HTAnchor_content_type ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->content_type : NULL;
+    return( me ? me->content_type : NULL);
 }
 
 /*	Last-Modified header handling. - FM
@@ -974,7 +974,7 @@ PUBLIC CONST char * HTAnchor_content_type ARGS1(
 PUBLIC CONST char * HTAnchor_last_modified ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->last_modified : NULL;
+    return( me ? me->last_modified : NULL);
 }
 
 /*	Date header handling. - FM
@@ -982,7 +982,7 @@ PUBLIC CONST char * HTAnchor_last_modified ARGS1(
 PUBLIC CONST char * HTAnchor_date ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->date : NULL;
+    return( me ? me->date : NULL);
 }
 
 /*	Server header handling. - FM
@@ -990,7 +990,7 @@ PUBLIC CONST char * HTAnchor_date ARGS1(
 PUBLIC CONST char * HTAnchor_server ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->server : NULL;
+    return( me ? me->server : NULL);
 }
 
 /*	Safe header handling. - FM
@@ -998,7 +998,7 @@ PUBLIC CONST char * HTAnchor_server ARGS1(
 PUBLIC BOOL HTAnchor_safe ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->safe : FALSE;
+    return( me ? me->safe : FALSE);
 }
 
 /*	Content-Base header handling. - FM
@@ -1006,7 +1006,7 @@ PUBLIC BOOL HTAnchor_safe ARGS1(
 PUBLIC CONST char * HTAnchor_content_base ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->content_base : NULL;
+    return( me ? me->content_base : NULL);
 }
 
 /*	Content-Location header handling. - FM
@@ -1014,7 +1014,7 @@ PUBLIC CONST char * HTAnchor_content_base ARGS1(
 PUBLIC CONST char * HTAnchor_content_location ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me ? me->content_location : NULL;
+    return( me ? me->content_location : NULL);
 }
 
 /*	Link me Anchor to another given one
@@ -1026,7 +1026,7 @@ PUBLIC BOOL HTAnchor_link ARGS3(
 	HTLinkType *,	type)
 {
     if (!(source && destination))
-	return NO;  /* Can't link to/from non-existing anchor */
+	return(NO);  /* Can't link to/from non-existing anchor */
     CTRACE(tfp, "Linking anchor %p to anchor %p\n", source, destination);
     if (!source->mainLink.dest) {
 	source->mainLink.dest = destination;
@@ -1044,7 +1044,7 @@ PUBLIC BOOL HTAnchor_link ARGS3(
     if (!destination->parent->sources)
 	destination->parent->sources = HTList_new();
     HTList_addObject (destination->parent->sources, source);
-    return YES;  /* Success */
+    return(YES);  /* Success */
 }
 
 
@@ -1054,7 +1054,7 @@ PUBLIC BOOL HTAnchor_link ARGS3(
 PUBLIC HTAnchor * HTAnchor_followMainLink ARGS1(
 	HTAnchor *,	me)
 {
-    return me->mainLink.dest;
+    return( me->mainLink.dest);
 }
 
 PUBLIC HTAnchor * HTAnchor_followTypedLink ARGS2(
@@ -1062,17 +1062,17 @@ PUBLIC HTAnchor * HTAnchor_followTypedLink ARGS2(
 	HTLinkType *,	type)
 {
     if (me->mainLink.type == type)
-	return me->mainLink.dest;
+	return( me->mainLink.dest);
     if (me->links) {
 	HTList *links = me->links;
 	HTLink *the_link;
 	while (NULL != (the_link=(HTLink *)HTList_nextObject(links))) {
 	    if (the_link->type == type) {
-		return the_link->dest;
+		return( the_link->dest);
 	    }
 	}
     }
-    return NULL;  /* No link of me type */
+    return(NULL);  /* No link of me type */
 }
 
 
@@ -1084,7 +1084,7 @@ PUBLIC BOOL HTAnchor_makeMainLink ARGS2(
 {
     /* Check that everything's OK */
     if (!(me && HTList_removeObject (me->links, movingLink))) {
-	return NO;  /* link not found or NULL anchor */
+	return(NO);  /* link not found or NULL anchor */
     } else {
 	/* First push current main link onto top of links list */
 	HTLink *newLink = (HTLink *)calloc (1, sizeof (HTLink));
@@ -1098,7 +1098,7 @@ PUBLIC BOOL HTAnchor_makeMainLink ARGS2(
 	memcpy((void *)&me->mainLink,
 	       (CONST void *)movingLink, sizeof (HTLink));
 	FREE(movingLink);
-	return YES;
+	return(YES);
     }
 }
 
@@ -1112,7 +1112,7 @@ PUBLIC HTList * HTAnchor_methods ARGS1(
     if (!me->methods) {
 	me->methods = HTList_new();
     }
-    return me->methods;
+    return( me->methods);
 }
 
 /*	Protocol
@@ -1121,7 +1121,7 @@ PUBLIC HTList * HTAnchor_methods ARGS1(
 PUBLIC void * HTAnchor_protocol ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me->protocol;
+    return( me->protocol);
 }
 
 PUBLIC void HTAnchor_setProtocol ARGS2(
@@ -1137,7 +1137,7 @@ PUBLIC void HTAnchor_setProtocol ARGS2(
 PUBLIC char * HTAnchor_physical ARGS1(
 	HTParentAnchor *,	me)
 {
-    return me->physical;
+    return( me->physical);
 }
 
 PUBLIC void HTAnchor_setPhysical ARGS2(
@@ -1209,9 +1209,9 @@ PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2(
 	me->UCStages = stages;
     }
     if (me) {
-	return &me->UCStages->s[which_stage].C;
+	return( &me->UCStages->s[which_stage].C);
     }
-    return NULL;
+    return(NULL);
 }
 
 PUBLIC int HTAnchor_getUCLYhndl ARGS2(
@@ -1226,10 +1226,10 @@ PUBLIC int HTAnchor_getUCLYhndl ARGS2(
 	    (void) HTAnchor_getUCInfoStage(me, which_stage);
 	}
 	if (me->UCStages->s[which_stage].lock > UCT_SETBY_NONE) {
-	    return me->UCStages->s[which_stage].LYhndl;
+	    return( me->UCStages->s[which_stage].LYhndl);
 	}
     }
-    return -1;
+    return( -1);
 }
 
 PUBLIC LYUCcharset * HTAnchor_setUCInfoStage ARGS4(
@@ -1255,10 +1255,10 @@ PUBLIC LYUCcharset * HTAnchor_setUCInfoStage ARGS4(
 	    else {
 		p->UChndl = -1;
 	    }
-	    return p;
+	    return(p);
 	}
     }
-    return NULL;
+    return(NULL);
 }
 
 PUBLIC LYUCcharset * HTAnchor_resetUCInfoStage ARGS4(
@@ -1268,10 +1268,10 @@ PUBLIC LYUCcharset * HTAnchor_resetUCInfoStage ARGS4(
 	int,			set_by)
 {
     if (!me || !me->UCStages)
-	return NULL;
+	return(NULL);
     me->UCStages->s[which_stage].lock = set_by;
     me->UCStages->s[which_stage].LYhndl = LYhndl;
-    return &me->UCStages->s[which_stage].C;
+    return( &me->UCStages->s[which_stage].C);
 }
 
 /*
@@ -1302,8 +1302,8 @@ PUBLIC LYUCcharset * HTAnchor_copyUCInfoStage ARGS4(
 		me->UCStages->s[from_stage].LYhndl;
 	    if (p_to != p_from)
 		memcpy(p_to, p_from, sizeof(LYUCcharset));
-	    return p_to;
+	    return(p_to);
 	}
     }
-    return NULL;
+    return(NULL);
 }
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index 58afc4b8..e1c9a851 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -260,7 +260,7 @@ PRIVATE int half_match ARGS2(char *,trial_type, char *,target)
 	return 0;
 
     CTRACE(tfp, "HTFormat: comparing %s and %s for half match\n",
-	        trial_type, target);
+		trial_type, target);
 
 	/* main type matches */
     if (!strncmp(trial_type, target, (cp-trial_type)-1))
@@ -486,26 +486,30 @@ PRIVATE void HTDisplayPartial NOARGS
 	**  HText_getNumOfLines() = "current" number of lines received
 	**  NumOfLines_partial = number of lines at the moment of last repaint.
 	**
-	**  Update NumOfLines_partial only if we repaint the display,
-	**  so it corresponds to real number of displayed lines.
-	**  Repaint the page only when necessary:
+	**  We update NumOfLines_partial only when we repaint the display.
+	**  -1 is the special value:
+	**  This is a synchronization flag switched to 0 when HText_new()
+	**  starts a new HTMainText object - all hypertext functions use it,
+	**  lines counter in particular [we call it from HText_getNumOfLines()].
+	**
+	**  Otherwise HTMainText holds info from the previous document
+	**  and we may repaint it instead of the new one:
+	**  prev doc scrolled to the first line (=Newline_partial)
+	**  is not good looking :-)       23 Aug 1998 Leonid Pauzner
+	**
+	**  So repaint the page only when necessary:
 	*/
-	if ((Newline_partial + display_lines) > NumOfLines_partial) {
+	if ((NumOfLines_partial != -1)
+		/* new hypertext document available  */
+	&& ((Newline_partial + display_lines) > NumOfLines_partial)
 		/* current page not complete... */
-	if ((Newline_partial + 2)  < HText_getNumOfLines()) {
+	&& ((Newline_partial + 2)  < HText_getNumOfLines())) {
 		/* and we MAY display at least a couple of lines on the top.
-		**
-		** Note: we check the lines in _rendered_ document
-		** and real HTML source may have several Kb of headers,
-		** Javascript applets etc., which are not visible in lynx
-		** and we got a delay (correct).
-		** We should NOT try to repaint at that early stage
-		** to avoid interfere with previously displayed document. - LP
-		*/
+		 *
+		 */
 	    NumOfLines_partial = HText_getNumOfLines();
 	    HText_pageDisplay(Newline_partial, "");
 	}
-	}
     }
 }
 #else
@@ -518,7 +522,7 @@ PRIVATE void HTDisplayPartial NOARGS
 **   This routine is responsible for creating and PRESENTING any
 **   graphic (or other) objects described by the file.
 **
-**   The file number given is assumed to be a TELNET stream ie containing
+**   The file number given is assumed to be a TELNET stream, i.e., containing
 **   CRLF at the end of lines which need to be stripped to LF for unix
 **   when the format is textual.
 **
@@ -579,7 +583,7 @@ PUBLIC int HTCopy ARGS4(
 		       SOCKET_ERRNO == ECONNRESET ||
 		       SOCKET_ERRNO == EPIPE) {
 		/*
-		 *  Arrrrgh, HTTP 0/1 compability problem, maybe.
+		 *  Arrrrgh, HTTP 0/1 compatibility problem, maybe.
 		 */
 		if (bytes <= 0) {
 		    /*
@@ -613,7 +617,7 @@ PUBLIC int HTCopy ARGS4(
 
 	(*targetClass.put_block)(sink, input_buffer, status);
 	bytes += status;
-        HTReadProgress(bytes, anchor ? anchor->content_length : 0);
+	HTReadProgress(bytes, anchor ? anchor->content_length : 0);
 	HTDisplayPartial();
 
     } /* next bufferload */
@@ -707,7 +711,7 @@ PRIVATE int HTGzFileCopy ARGS2(
     */
     targetClass = *(sink->isa); /* Copy pointers to procedures */
 
-    /*	read and inflate gzipped file, and push binary down sink
+    /*	read and inflate gzip'd file, and push binary down sink
     */
     HTReadProgress(bytes = 0, 0);
     for (;;) {
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index e6917daa..100dd390 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -373,6 +373,7 @@ The local equivalents of CR and LF
 #define CTRACE if(TRACE)fprintf
 #define tfp TraceFP()
 #define CTRACE_SLEEP(secs) if (TRACE && LYTraceLogFP == 0) sleep(secs)
+#define CTRACE_FLUSH(fp) if(TRACE) fflush(fp)
 
 extern FILE *TraceFP NOPARAMS;