summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/lynx/src/HTML.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/lynx/src/HTML.c')
-rw-r--r--gnu/usr.bin/lynx/src/HTML.c4176
1 files changed, 2072 insertions, 2104 deletions
diff --git a/gnu/usr.bin/lynx/src/HTML.c b/gnu/usr.bin/lynx/src/HTML.c
index 1a508067830..01a3ed1f4b7 100644
--- a/gnu/usr.bin/lynx/src/HTML.c
+++ b/gnu/usr.bin/lynx/src/HTML.c
@@ -1,16 +1,16 @@
/* Structured stream to Rich hypertext converter
-** ============================================
-**
-** This generates a hypertext object. It converts from the
-** structured stream interface of HTML events into the style-
-** oriented interface of the HText.h interface. This module is
-** only used in clients and should not be linked into servers.
-**
-** Override this module if making a new GUI browser.
-**
-** Being Overidden
-**
-*/
+ * ============================================
+ *
+ * This generates a hypertext object. It converts from the
+ * structured stream interface of HTML events into the style-
+ * oriented interface of the HText.h interface. This module is
+ * only used in clients and should not be linked into servers.
+ *
+ * Override this module if making a new GUI browser.
+ *
+ * Being Overidden
+ *
+ */
#include <HTUtils.h>
@@ -61,9 +61,9 @@
#define pHText_changeStyle(X,Y,Z) {}
#if OMIT_SCN_KEEPING
-# define HCODE_TO_STACK_OFF(x) /*(CSHASHSIZE+1)*/ 88888 /*special value.*/
+# define HCODE_TO_STACK_OFF(x) /*(CSHASHSIZE+1)*/ 88888 /*special value. */
#else
-# define HCODE_TO_STACK_OFF(x) x /*pass computed value*/
+# define HCODE_TO_STACK_OFF(x) x /*pass computed value */
#endif
#endif /* USE_COLOR_STYLE */
@@ -94,50 +94,49 @@
}
struct _HTStream {
- CONST HTStreamClass * isa;
+ const HTStreamClass *isa;
#ifdef USE_SOURCE_CACHE
- HTParentAnchor * anchor;
- FILE * fp;
- char * filename;
- HTChunk * chunk;
- CONST HTStreamClass * actions;
- HTStream * target;
- int status;
+ HTParentAnchor *anchor;
+ FILE *fp;
+ char *filename;
+ HTChunk *chunk;
+ HTChunk *last_chunk; /* the last chunk in a chain! */
+ const HTStreamClass *actions;
+ HTStream *target;
+ int status;
#else
/* .... */
#endif
};
-PRIVATE HTStyleSheet * styleSheet = NULL; /* Application-wide */
+static HTStyleSheet *styleSheet = NULL; /* Application-wide */
/* Module-wide style cache
*/
-PRIVATE HTStyle *styles[HTML_ELEMENTS+LYNX_HTML_EXTRA_ELEMENTS];
+static HTStyle *styles[HTML_ELEMENTS + LYNX_HTML_EXTRA_ELEMENTS];
+
/* adding 24 nested list styles */
/* and 3 header alignment styles */
/* and 3 div alignment styles */
-PRIVATE HTStyle *default_style = NULL;
+static HTStyle *default_style = NULL;
-PUBLIC char *LYToolbarName = "LynxPseudoToolbar";
+const char *LYToolbarName = "LynxPseudoToolbar";
/* used to turn off a style if the HTML author forgot to
-PRIVATE int i_prior_style = -1;
+static int i_prior_style = -1;
*/
/*
* Private function....
*/
-PRIVATE int HTML_end_element PARAMS((HTStructured *me,
- int element_number,
- char **include));
-
-PRIVATE int HTML_start_element PARAMS((
- HTStructured * me,
- int element_number,
- CONST BOOL* present,
- CONST char ** value,
- int tag_charset,
- char ** include));
+static int HTML_end_element(HTStructured * me, int element_number,
+ char **include);
+
+static int HTML_start_element(HTStructured * me, int element_number,
+ const BOOL *present,
+ const char **value,
+ int tag_charset,
+ char **include);
/*
* If we have verbose_img set, display labels for images.
@@ -145,40 +144,44 @@ PRIVATE int HTML_start_element PARAMS((
#define VERBOSE_IMG(value,src_type,string) \
((verbose_img) ? (newtitle = MakeNewTitle(value,src_type)): string)
-PRIVATE char* MakeNewTitle PARAMS((CONST char ** value, int src_type));
-PRIVATE char* MakeNewImageValue PARAMS((CONST char ** value));
-PRIVATE char* MakeNewMapValue PARAMS((CONST char ** value, CONST char* mapstr));
+static char *MakeNewTitle(const char **value, int src_type);
+static char *MakeNewImageValue(const char **value);
+static char *MakeNewMapValue(const char **value, const char *mapstr);
/* Set an internal flag that the next call to a stack-affecting method
-** is only internal and the stack manipulation should be skipped. - kw
-*/
+ * is only internal and the stack manipulation should be skipped. - kw
+ */
#define SET_SKIP_STACK(el_num) if (HTML_dtd.tags[el_num].contents != SGML_EMPTY) \
{ me->skip_stack++; }
-PUBLIC void strtolower ARGS1(char*, i)
+void strtolower(char *i)
{
- if (!i) return;
- while (*i) { *i = (char)TOLOWER(*i); i++; }
+ if (!i)
+ return;
+ while (*i) {
+ *i = (char) TOLOWER(*i);
+ i++;
+ }
}
/* Flattening the style structure
-** ------------------------------
-**
-On the NeXT, and on any read-only browser, it is simpler for the text to have
-a sequence of styles, rather than a nested tree of styles. In this
-case we have to flatten the structure as it arrives from SGML tags into
-a sequence of styles.
-*/
+ * ------------------------------
+ *
+ * On the NeXT, and on any read-only browser, it is simpler for the text to
+ * have a sequence of styles, rather than a nested tree of styles. In this
+ * case we have to flatten the structure as it arrives from SGML tags into a
+ * sequence of styles.
+ */
/*
-** If style really needs to be set, call this.
-*/
-PUBLIC void actually_set_style ARGS1(HTStructured *, me)
+ * If style really needs to be set, call this.
+ */
+void actually_set_style(HTStructured * me)
{
- if (!me->text) { /* First time through */
+ if (!me->text) { /* First time through */
LYGetChartransInfo(me);
UCSetTransParams(&me->T,
- me->UCLYhndl, me->UCI,
+ me->UCLYhndl, me->UCI,
HTAnchor_getUCLYhndl(me->node_anchor,
UCT_STAGE_HTEXT),
HTAnchor_getUCInfoStage(me->node_anchor,
@@ -197,9 +200,9 @@ PUBLIC void actually_set_style ARGS1(HTStructured *, me)
}
/*
-** If you THINK you need to change style, call this.
-*/
-PRIVATE void change_paragraph_style ARGS2(HTStructured *, me, HTStyle *,style)
+ * If you THINK you need to change style, call this.
+ */
+static void change_paragraph_style(HTStructured * me, HTStyle *style)
{
if (me->new_style != style) {
me->style_change = YES;
@@ -208,8 +211,7 @@ PRIVATE void change_paragraph_style ARGS2(HTStructured *, me, HTStyle *,style)
me->in_word = NO;
}
-PUBLIC BOOL LYBadHTML ARGS1(
- HTStructured *, me)
+BOOL LYBadHTML(HTStructured * me)
{
if (!TRACE && !me->inBadHTML) {
HTUserMsg(BAD_HTML_USE_TRACE);
@@ -220,9 +222,9 @@ PUBLIC BOOL LYBadHTML ARGS1(
}
/*_________________________________________________________________________
-**
-** A C T I O N R O U T I N E S
-*/
+ *
+ * A C T I O N R O U T I N E S
+ */
/* FIXME: this should be amended to do the substitution only when not in a
* multibyte stream.
@@ -237,24 +239,23 @@ PUBLIC BOOL LYBadHTML ARGS1(
#endif
/* Character handling
-** ------------------
-*/
-PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
+ * ------------------
+ */
+void HTML_put_character(HTStructured * me, char c)
{
/*
- * Ignore all non-MAP content when just
- * scanning a document for MAPs. - FM
+ * Ignore all non-MAP content when just scanning a document for MAPs. - FM
*/
if (LYMapsOnly && me->sp[0].tag_number != HTML_OBJECT)
return;
/*
- * Do EOL conversion if needed. - FM
+ * Do EOL conversion if needed. - FM
*
- * Convert EOL styles:
- * macintosh: cr --> lf
- * ascii: cr-lf --> lf
- * unix: lf --> lf
+ * Convert EOL styles:
+ * macintosh: cr --> lf
+ * ascii: cr-lf --> lf
+ * unix: lf --> lf
*/
if ((me->lastraw == '\r') && c == '\n') {
me->lastraw = -1;
@@ -265,12 +266,12 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
c = '\n';
/*
- * Handle SGML_LITTERAL tags that have HTChunk elements. - FM
+ * Handle SGML_LITTERAL tags that have HTChunk elements. - FM
*/
switch (me->sp[0].tag_number) {
case HTML_COMMENT:
- return; /* Do Nothing */
+ return; /* Do Nothing */
case HTML_TITLE:
if (c == LY_SOFT_HYPHEN)
@@ -316,15 +317,15 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
default:
if (me->inSELECT) {
/*
- * If we are within a SELECT not caught by the cases
- * above - HTML_SELECT or HTML_OPTION may not be the
- * last element pushed on the style stack if there were
- * invalid markup tags within a SELECT element. For error
- * recovery, treat text as part of the OPTION text, it is
- * probably meant to show up as user-visible text.
- * Having A as an open element while in SELECT is really sick,
- * don't make anchor text part of the option text in that case
- * since the option text will probably just be discarded. - kw
+ * If we are within a SELECT not caught by the cases above -
+ * HTML_SELECT or HTML_OPTION may not be the last element pushed on
+ * the style stack if there were invalid markup tags within a
+ * SELECT element. For error recovery, treat text as part of the
+ * OPTION text, it is probably meant to show up as user-visible
+ * text. Having A as an open element while in SELECT is really
+ * sick, don't make anchor text part of the option text in that
+ * case since the option text will probably just be discarded. -
+ * kw
*/
if (me->sp[0].tag_number == HTML_A)
break;
@@ -332,17 +333,17 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
return;
}
break;
- } /* end first switch */
+ } /* end first switch */
/*
- * Handle all other tag content. - FM
+ * Handle all other tag content. - FM
*/
switch (me->sp[0].tag_number) {
- case HTML_PRE: /* Formatted text */
+ case HTML_PRE: /* Formatted text */
/*
- * We guarantee that the style is up-to-date in begin_litteral
- * But we still want to strip \r's
+ * We guarantee that the style is up-to-date in begin_litteral. But we
+ * still want to strip \r's.
*/
if (c != '\r' &&
!(c == '\n' && me->inLABEL && !me->inP) &&
@@ -354,14 +355,14 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
me->inPRE = TRUE;
break;
- case HTML_LISTING: /* Literal text */
+ case HTML_LISTING: /* Literal text */
case HTML_XMP:
case HTML_PLAINTEXT:
/*
- * We guarantee that the style is up-to-date in begin_litteral
- * But we still want to strip \r's
+ * We guarantee that the style is up-to-date in begin_litteral. But we
+ * still want to strip \r's.
*/
- if (c != '\r') {
+ if (c != '\r') {
me->inP = TRUE;
me->inLABEL = FALSE;
HText_appendCharacter(me->text, c);
@@ -370,7 +371,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
default:
/*
- * Free format text.
+ * Free format text.
*/
if (me->sp->style->id == ST_Preformatted) {
if (c != '\r' &&
@@ -416,7 +417,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
}
} else if (c == '\r') {
- /* ignore */
+ /* ignore */
} else {
me->inP = TRUE;
@@ -425,49 +426,48 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
me->in_word = YES;
}
}
- } /* end second switch */
+ } /* end second switch */
if (c == '\n' || c == '\t') {
- HText_setLastChar(me->text, ' '); /* set it to a generic separator */
+ HText_setLastChar(me->text, ' '); /* set it to a generic separator */
/*
- * \r's are ignored. In order to keep collapsing spaces
- * correctly we must default back to the previous
- * separator if there was one
+ * \r's are ignored. In order to keep collapsing spaces correctly we
+ * must default back to the previous separator if there was one.
*/
} else if (c == '\r' && HText_getLastChar(me->text) == ' ') {
- HText_setLastChar(me->text, ' '); /* set it to a generic separator */
+ HText_setLastChar(me->text, ' '); /* set it to a generic separator */
} else {
HText_setLastChar(me->text, c);
}
}
/* String handling
-** ---------------
-**
-** This is written separately from put_character because the loop can
-** in some cases be promoted to a higher function call level for speed.
-*/
-PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
+ * ---------------
+ *
+ * This is written separately from put_character because the loop can
+ * in some cases be promoted to a higher function call level for speed.
+ */
+void HTML_put_string(HTStructured * me, const char *s)
{
#ifdef USE_PRETTYSRC
- char* translated_string = NULL;
+ char *translated_string = NULL;
#endif
if (s == NULL || (LYMapsOnly && me->sp[0].tag_number != HTML_OBJECT))
return;
#ifdef USE_PRETTYSRC
if (psrc_convert_string) {
- StrAllocCopy(translated_string,s);
+ StrAllocCopy(translated_string, s);
TRANSLATE_AND_UNESCAPE_ENTITIES(&translated_string, TRUE, FALSE);
- s = (CONST char *) translated_string;
+ s = (const char *) translated_string;
}
#endif
switch (me->sp[0].tag_number) {
case HTML_COMMENT:
- break; /* Do Nothing */
+ break; /* Do Nothing */
case HTML_TITLE:
HTChunkPuts(&me->title, s);
@@ -481,12 +481,12 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
HTChunkPuts(&me->script, s);
break;
- case HTML_PRE: /* Formatted text */
- case HTML_LISTING: /* Literal text */
+ case HTML_PRE: /* Formatted text */
+ case HTML_LISTING: /* Literal text */
case HTML_XMP:
case HTML_PLAINTEXT:
/*
- * We guarantee that the style is up-to-date in begin_litteral
+ * We guarantee that the style is up-to-date in begin_litteral
*/
HText_appendText(me->text, s);
break;
@@ -508,12 +508,12 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
HTChunkPuts(&me->math, s);
break;
- default: /* Free format text? */
+ default: /* Free format text? */
if (!me->sp->style->freeFormat) {
/*
- * If we are within a preformatted text style not caught
- * by the cases above (HTML_PRE or similar may not be the
- * last element pushed on the style stack). - kw
+ * If we are within a preformatted text style not caught by the
+ * cases above (HTML_PRE or similar may not be the last element
+ * pushed on the style stack). - kw
*/
#ifdef USE_PRETTYSRC
if (psrc_view) {
@@ -523,19 +523,19 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
* '\r' to HText_appendText is treated by it as a request to
* insert a blank line - VH
*/
- for(; *s; ++s)
+ for (; *s; ++s)
HTML_put_character(me, *s);
} else
#endif
- HText_appendText(me->text, s);
+ HText_appendText(me->text, s);
break;
} else {
- CONST char *p = s;
+ const char *p = s;
char c;
+
if (me->style_change) {
for (; *p && ((*p == '\n') || (*p == '\r') ||
- (*p == ' ') || (*p == '\t')); p++)
- ; /* Ignore leaders */
+ (*p == ' ') || (*p == '\t')); p++) ; /* Ignore leaders */
if (!*p)
break;
UPDATE_STYLE;
@@ -543,9 +543,9 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
for (; *p; p++) {
if (*p == 13 && p[1] != 10) {
/*
- * Treat any '\r' which is not followed by '\n'
- * as '\n', to account for macintosh lineend in
- * ALT attributes etc. - kw
+ * Treat any '\r' which is not followed by '\n' as '\n', to
+ * account for macintosh lineend in ALT attributes etc. -
+ * kw
*/
c = '\n';
} else {
@@ -553,7 +553,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
}
if (me->style_change) {
if ((c == '\n') || (c == ' ') || (c == '\t'))
- continue; /* Ignore it */
+ continue; /* Ignore it */
UPDATE_STYLE;
}
if (c == '\n') {
@@ -566,11 +566,11 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
}
} else if (c == ' ' || c == '\t') {
- if (HText_getLastChar(me->text) != ' ')
+ if (HText_getLastChar(me->text) != ' ')
HText_appendCharacter(me->text, ' ');
} else if (c == '\r') {
- /* ignore */
+ /* ignore */
} else {
HText_appendCharacter(me->text, c);
me->in_word = YES;
@@ -583,19 +583,19 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
} else if (c == '\r' &&
HText_getLastChar(me->text) == ' ') {
/*
- * \r's are ignored. In order to keep collapsing
- * spaces correctly, we must default back to the
- * previous separator, if there was one. So we
- * set LastChar to a generic separator.
+ * \r's are ignored. In order to keep collapsing spaces
+ * correctly, we must default back to the previous
+ * separator, if there was one. So we set LastChar to a
+ * generic separator.
*/
HText_setLastChar(me->text, ' ');
} else {
HText_setLastChar(me->text, c);
}
- } /* for */
+ } /* for */
}
- } /* end switch */
+ } /* end switch */
#ifdef USE_PRETTYSRC
if (psrc_convert_string) {
psrc_convert_string = FALSE;
@@ -605,12 +605,12 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
}
/* Buffer write
-** ------------
-*/
-PUBLIC void HTML_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
+ * ------------
+ */
+void HTML_write(HTStructured * me, const char *s, int l)
{
- CONST char* p;
- CONST char* e = s+l;
+ const char *p;
+ const char *e = s + l;
if (LYMapsOnly && me->sp[0].tag_number != HTML_OBJECT)
return;
@@ -675,24 +675,22 @@ PUBLIC void HTML_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
just an abbreviation. - kw */
#define INTERN_LT (HTLinkType *)(intern_flag ? HTInternalLink : NULL)
-
#ifdef USE_COLOR_STYLE
-PRIVATE char* Style_className = 0;
-PRIVATE char* Style_className_end = 0;
-PRIVATE unsigned Style_className_len = 0;
-PRIVATE int hcode;
+static char *Style_className = 0;
+static char *Style_className_end = 0;
+static unsigned Style_className_len = 0;
+static int hcode;
#ifdef LY_FIND_LEAKS
-PRIVATE void free_Style_className NOARGS
+static void free_Style_className(void)
{
FREE(Style_className);
}
#endif
-PRIVATE void addClassName ARGS3(
- CONST char *, prefix,
- CONST char *, actual,
- int, length)
+static void addClassName(const char *prefix,
+ const char *actual,
+ int length)
{
int offset = strlen(prefix);
unsigned have = (Style_className_end - Style_className);
@@ -701,9 +699,9 @@ PRIVATE void addClassName ARGS3(
if ((have + need) >= Style_className_len) {
Style_className_len += 1024 + 2 * (have + need);
if (Style_className == 0) {
- Style_className = malloc(Style_className_len);
+ Style_className = typeMallocn(char, Style_className_len);
} else {
- Style_className = realloc(Style_className, Style_className_len);
+ Style_className = typeRealloc(char, Style_className, Style_className_len);
}
if (Style_className == NULL)
outofmem(__FILE__, "addClassName");
@@ -719,19 +717,15 @@ PRIVATE void addClassName ARGS3(
Style_className_end += (offset + length);
}
#else
-#define addClassName(prefix, actual, length) /* nothing */
+#define addClassName(prefix, actual, length) /* nothing */
#endif
-
#ifdef USE_PRETTYSRC
-PRIVATE void HTMLSRC_apply_markup ARGS4(
- HTStructured *, context,
- HTlexeme, lexeme,
- BOOL, start,
- int, tag_charset)
+static void HTMLSRC_apply_markup(HTStructured * context, HTlexeme lexeme, BOOL start,
+ int tag_charset)
{
- HT_tagspec* ts = *( ( start ? lexeme_start : lexeme_end ) + lexeme);
+ HT_tagspec *ts = *((start ? lexeme_start : lexeme_end) + lexeme);
while (ts) {
#ifdef USE_COLOR_STYLE
@@ -742,81 +736,70 @@ PRIVATE void HTMLSRC_apply_markup ARGS4(
force_classname = TRUE;
}
#endif
- CTRACE((tfp,ts->start ? "SRCSTART %d\n" : "SRCSTOP %d\n",(int)lexeme));
+ CTRACE((tfp, ts->start ? "SRCSTART %d\n" : "SRCSTOP %d\n", (int) lexeme));
if (ts->start)
- HTML_start_element(
- context,
- ts->element,
- ts->present,
- (CONST char **)ts->value,
- tag_charset,
- NULL);
+ HTML_start_element(context,
+ ts->element,
+ ts->present,
+ (const char **) ts->value,
+ tag_charset,
+ NULL);
else
- HTML_end_element(
- context,
- ts->element,
- NULL);
+ HTML_end_element(context,
+ ts->element,
+ NULL);
ts = ts->next;
}
}
# define START TRUE
# define STOP FALSE
-#if defined(__STDC__) || defined(_WIN_CC)
# define PSRCSTART(x) HTMLSRC_apply_markup(me,HTL_##x,START,tag_charset)
# define PSRCSTOP(x) HTMLSRC_apply_markup(me,HTL_##x,STOP,tag_charset)
-#else
-# define PSRCSTART(x) HTMLSRC_apply_markup(me,HTL_/**/x,START,tag_charset)
-# define PSRCSTOP(x) HTMLSRC_apply_markup(me,HTL_/**/x,STOP,tag_charset)
-#endif
# define PUTC(x) HTML_put_character(me,x)
# define PUTS(x) HTML_put_string(me,x)
-#endif /* USE_PRETTYSRC*/
+#endif /* USE_PRETTYSRC */
-PRIVATE void LYStartArea ARGS5(
- HTStructured *, obj,
- CONST char *, href,
- CONST char *, alt,
- CONST char *, title,
- int, tag_charset)
+static void LYStartArea(HTStructured * obj, const char *href,
+ const char *alt,
+ const char *title,
+ int tag_charset)
{
- BOOL new_present[HTML_AREA_ATTRIBUTES];
- CONST char * new_value[HTML_AREA_ATTRIBUTES];
+ BOOL new_present[HTML_AREA_ATTRIBUTES];
+ const char *new_value[HTML_AREA_ATTRIBUTES];
int i;
for (i = 0; i < HTML_AREA_ATTRIBUTES; i++)
- new_present[i] = NO;
+ new_present[i] = NO;
if (alt) {
new_present[HTML_AREA_ALT] = YES;
- new_value[HTML_AREA_ALT] = (CONST char *)alt;
+ new_value[HTML_AREA_ALT] = (const char *) alt;
}
- if (title && *title) {
+ if (non_empty(title)) {
new_present[HTML_AREA_TITLE] = YES;
- new_value[HTML_AREA_TITLE] = (CONST char *)title;
+ new_value[HTML_AREA_TITLE] = (const char *) title;
}
if (href) {
new_present[HTML_AREA_HREF] = YES;
- new_value[HTML_AREA_HREF] = (CONST char *)href;
+ new_value[HTML_AREA_HREF] = (const char *) href;
}
- (*obj->isa->start_element)(obj, HTML_AREA, new_present, new_value,
- tag_charset, 0);
+ (*obj->isa->start_element) (obj, HTML_AREA, new_present, new_value,
+ tag_charset, 0);
}
-PRIVATE void LYHandleFIG ARGS10(
- HTStructured *, me,
- CONST BOOL*, present,
- CONST char **, value,
- BOOL, isobject,
- BOOL, imagemap,
- CONST char *, id,
- CONST char *, src,
- BOOL, convert,
- BOOL, start,
- BOOL *, intern_flag GCC_UNUSED)
+static void LYHandleFIG(HTStructured * me, const BOOL *present,
+ const char **value,
+ BOOL isobject,
+ BOOL imagemap,
+ const char *id,
+ const char *src,
+ BOOL convert,
+ BOOL start,
+ BOOL *intern_flag GCC_UNUSED)
{
if (start == TRUE) {
me->inFIG = TRUE;
@@ -830,9 +813,9 @@ PRIVATE void LYHandleFIG ARGS10(
me->inFIGwithP = TRUE;
} else {
me->inFIGwithP = FALSE;
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
}
- if (id && *id) {
+ if (non_empty(id)) {
if (present && convert) {
CHECK_ID(HTML_FIG_ID);
} else
@@ -841,27 +824,30 @@ PRIVATE void LYHandleFIG ARGS10(
me->in_word = NO;
me->inP = FALSE;
- if (clickable_images && src && *src) {
+ if (clickable_images && non_empty(src)) {
char *href = NULL;
+
StrAllocCopy(href, src);
- CHECK_FOR_INTERN(*intern_flag,href);
+ CHECK_FOR_INTERN(*intern_flag, href);
LYLegitimizeHREF(me, &href, TRUE, TRUE);
if (*href) {
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- INTERN_LT); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ INTERN_LT); /* Type */
HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
if (me->inBoldH == FALSE)
HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
- HTML_put_string(me, (isobject ?
- (imagemap ? "(IMAGE)" : "(OBJECT)") : "[FIGURE]"));
+ HTML_put_string(me, (isobject
+ ? (imagemap
+ ? "(IMAGE)"
+ : "(OBJECT)")
+ : "[FIGURE]"));
if (me->inBoldH == FALSE)
HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
HText_endAnchor(me->text, 0);
HTML_put_character(me, '-');
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
}
FREE(href);
@@ -870,12 +856,12 @@ PRIVATE void LYHandleFIG ARGS10(
if (me->inFIGwithP) {
LYEnsureDoubleSpace(me);
} else {
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
}
LYResetParagraphAlignment(me);
me->inFIGwithP = FALSE;
me->inFIG = FALSE;
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
if (me->List_Nesting_Level >= 0) {
UPDATE_STYLE;
HText_NegateLineOne(me->text);
@@ -883,8 +869,7 @@ PRIVATE void LYHandleFIG ARGS10(
}
}
-PRIVATE void clear_objectdata ARGS1(
- HTStructured *, me)
+static void clear_objectdata(HTStructured * me)
{
if (me) {
HTChunkClear(&me->object);
@@ -911,15 +896,13 @@ PRIVATE void clear_objectdata ARGS1(
}
/* Start Element
-** -------------
-*/
-PRIVATE int HTML_start_element ARGS6(
- HTStructured *, me,
- int, element_number,
- CONST BOOL*, present,
- CONST char **, value,
- int, tag_charset,
- char **, include)
+ * -------------
+ */
+static int HTML_start_element(HTStructured * me, int element_number,
+ const BOOL *present,
+ const char **value,
+ int tag_charset,
+ char **include)
{
char *alt_string = NULL;
char *id_string = NULL;
@@ -931,17 +914,18 @@ PRIVATE int HTML_start_element ARGS6(
char *I_value = NULL;
char *I_name = NULL;
char *temp = NULL;
- CONST char *Base = NULL;
+ const char *Base = NULL;
int dest_char_set = -1;
- HTParentAnchor *dest = NULL; /* An anchor's destination */
- BOOL dest_ismap = FALSE; /* Is dest an image map script? */
- HTChildAnchor *ID_A = NULL; /* HTML_foo_ID anchor */
+ HTParentAnchor *dest = NULL; /* An anchor's destination */
+ BOOL dest_ismap = FALSE; /* Is dest an image map script? */
+ HTChildAnchor *ID_A = NULL; /* HTML_foo_ID anchor */
int url_type = 0, i = 0;
char *cp = NULL;
- HTMLElement ElementNumber = element_number;
+ HTMLElement ElementNumber = (HTMLElement) element_number;
BOOL intern_flag = FALSE;
short stbl_align = HT_ALIGN_NONE;
int status = HT_OK;
+
#ifdef USE_COLOR_STYLE
char *class_name;
int class_used = 0;
@@ -950,16 +934,17 @@ PRIVATE int HTML_start_element ARGS6(
#ifdef USE_PRETTYSRC
if (psrc_view && !sgml_in_psrc_was_initialized) {
if (!psrc_nested_call) {
- HTTag * tag = &HTML_dtd.tags[element_number];
+ HTTag *tag = &HTML_dtd.tags[element_number];
char buf[200];
- CONST char* p;
+ const char *p;
+
if (psrc_first_tag) {
psrc_first_tag = FALSE;
/* perform the special actions on the begining of the document.
It's assumed that all lynx modules start generating html
from tag (ie not a text) so we are able to trap this moment
and initialize.
- */
+ */
psrc_nested_call = TRUE;
HTML_start_element(me, HTML_BODY, NULL, NULL, tag_charset, NULL);
HTML_start_element(me, HTML_PRE, NULL, NULL, tag_charset, NULL);
@@ -968,13 +953,15 @@ PRIVATE int HTML_start_element ARGS6(
}
psrc_nested_call = TRUE;
- /*write markup for tags and exit*/
- PSRCSTART(abracket); PUTC('<'); PSRCSTOP(abracket);
+ /*write markup for tags and exit */
+ PSRCSTART(abracket);
+ PUTC('<');
+ PSRCSTOP(abracket);
PSRCSTART(tag);
- if (tagname_transform!=0)
+ if (tagname_transform != 0)
PUTS(tag->name);
else {
- LYstrncpy(buf, tag->name, sizeof(buf)-1);
+ LYstrncpy(buf, tag->name, sizeof(buf) - 1);
LYLowerCase(buf);
PUTS(buf);
}
@@ -983,34 +970,38 @@ PRIVATE int HTML_start_element ARGS6(
if (present[i]) {
PUTC(' ');
PSRCSTART(attrib);
- if (attrname_transform!=0)
+ if (attrname_transform != 0)
PUTS(tag->attributes[i].name);
else {
- LYstrncpy(buf, tag->attributes[i].name, sizeof(buf)-1);
+ LYstrncpy(buf,
+ tag->attributes[i].name,
+ sizeof(buf) - 1);
LYLowerCase(buf);
PUTS(buf);
}
if (value[i]) {
- char q='"';
- /*0 in dquotes, 1 - in quotes, 2 mixed*/
- char kind= (char) ( !strchr(value[i], '"') ?
- 0 :
- !strchr(value[i], '\'') ?
- q='\'',1 :
- 2);
+ char q = '"';
+
+ /*0 in dquotes, 1 - in quotes, 2 mixed */
+ char kind = (char) (!strchr(value[i], '"') ?
+ 0 :
+ !strchr(value[i], '\'') ?
+ q = '\'', 1 :
+ 2);
+
PUTC('=');
PSRCSTOP(attrib);
PSRCSTART(attrval);
PUTC(q);
/*is it special ? */
if (tag->attributes[i].type == HTMLA_ANAME) {
- HTStartAnchor(me,value[i],NULL);
- HTML_end_element(me,HTML_A,NULL);
+ HTStartAnchor(me, value[i], NULL);
+ HTML_end_element(me, HTML_A, NULL);
} else if (tag->attributes[i].type == HTMLA_HREF) {
PSRCSTART(href);
- HTStartAnchor(me,NULL,value[i]);
+ HTStartAnchor(me, NULL, value[i]);
}
- if (kind!=2)
+ if (kind != 2)
PUTS(value[i]);
else
for (p = value[i]; *p; p++)
@@ -1020,20 +1011,22 @@ PRIVATE int HTML_start_element ARGS6(
PUTS("&#34;");
/*is it special ? */
if (tag->attributes[i].type == HTMLA_HREF) {
- HTML_end_element(me,HTML_A,NULL);
+ HTML_end_element(me, HTML_A, NULL);
PSRCSTOP(href);
}
PUTC(q);
PSRCSTOP(attrval);
- } /* if value */
- } /* if present[i] */
- }/* if present*/
+ } /* if value */
+ } /* if present[i] */
+ } /* if present */
PSRCSTOP(tag);
- PSRCSTART(abracket); PUTC('>'); PSRCSTOP(abracket);
- psrc_nested_call=FALSE;
+ PSRCSTART(abracket);
+ PUTC('>');
+ PSRCSTOP(abracket);
+ psrc_nested_call = FALSE;
return HT_OK;
- } /*if (!psrc_nested_call) */
- /*fall through*/
+ } /*if (!psrc_nested_call) */
+ /*fall through */
}
#endif /* USE_PRETTYSRC */
@@ -1045,16 +1038,14 @@ PRIVATE int HTML_start_element ARGS6(
}
} else if (!me->text) {
UPDATE_STYLE;
- }
-
- {
+ } {
/* me->tag_charset is charset for attribute values. */
int j = ((tag_charset < 0) ? me->UCLYhndl : tag_charset);
- if ((me->tag_charset != j) || (j < 0 /* for trace entry */)) {
- CTRACE((tfp, "me->tag_charset: %d -> %d", me->tag_charset, j ));
+ if ((me->tag_charset != j) || (j < 0 /* for trace entry */ )) {
+ CTRACE((tfp, "me->tag_charset: %d -> %d", me->tag_charset, j));
CTRACE((tfp, " (me->UCLYhndl: %d, tag_charset: %d)\n",
- me->UCLYhndl, tag_charset));
+ me->UCLYhndl, tag_charset));
me->tag_charset = j;
}
}
@@ -1062,17 +1053,17 @@ PRIVATE int HTML_start_element ARGS6(
/* this should be done differently */
#if defined(USE_COLOR_STYLE)
- addClassName(";",
- HTML_dtd.tags[element_number].name,
- HTML_dtd.tags[element_number].name_len);
+ addClassName(";",
+ HTML_dtd.tags[element_number].name,
+ HTML_dtd.tags[element_number].name_len);
class_name = (force_classname ? forced_classname : class_string);
force_classname = FALSE;
if (force_current_tag_style == FALSE) {
current_tag_style = class_name[0]
- ? -1
- : cached_tag_styles[element_number];
+ ? -1
+ : cached_tag_styles[element_number];
} else {
force_current_tag_style = FALSE;
}
@@ -1086,24 +1077,25 @@ PRIVATE int HTML_start_element ARGS6(
hcode = hash_code_aggregate_char('.', hcode);
hcode = hash_code_aggregate_lower_str(class_name, hcode);
- if (!hashStyles[hcode].name) { /* None such -> classless version */
+ if (!hashStyles[hcode].name) { /* None such -> classless version */
hcode = ohcode;
CTRACE2(TRACE_STYLE,
- (tfp, "STYLE.start_element: <%s> (class <%s> not configured), hcode=%d.\n",
- HTML_dtd.tags[element_number].name, class_name, hcode));
+ (tfp,
+ "STYLE.start_element: <%s> (class <%s> not configured), hcode=%d.\n",
+ HTML_dtd.tags[element_number].name, class_name, hcode));
} else {
addClassName(".", class_name, strlen(class_name));
CTRACE2(TRACE_STYLE,
(tfp, "STYLE.start_element: <%s>.<%s>, hcode=%d.\n",
- HTML_dtd.tags[element_number].name, class_name, hcode));
+ HTML_dtd.tags[element_number].name, class_name, hcode));
class_used = 1;
}
}
class_string[0] = '\0';
- } else { /* (current_tag_style!=-1) */
+ } else { /* (current_tag_style!=-1) */
if (class_name[0]) {
addClassName(".", class_name, strlen(class_name));
class_string[0] = '\0';
@@ -1111,13 +1103,13 @@ PRIVATE int HTML_start_element ARGS6(
hcode = current_tag_style;
CTRACE2(TRACE_STYLE,
(tfp, "STYLE.start_element: <%s>, hcode=%d.\n",
- HTML_dtd.tags[element_number].name, hcode));
+ HTML_dtd.tags[element_number].name, hcode));
current_tag_style = -1;
}
#if !OMIT_SCN_KEEPING /* Can be done in other cases too... */
- if (!class_used && ElementNumber == HTML_INPUT) { /* For some other too? */
- CONST char *type = "";
+ if (!class_used && ElementNumber == HTML_INPUT) { /* For some other too? */
+ const char *type = "";
int ohcode = hcode;
if (present && present[HTML_INPUT_TYPE] && value[HTML_INPUT_TYPE])
@@ -1125,26 +1117,26 @@ PRIVATE int HTML_start_element ARGS6(
hcode = hash_code_aggregate_lower_str(".type.", hcode);
hcode = hash_code_aggregate_lower_str(type, hcode);
- if (!hashStyles[hcode].name) { /* None such -> classless version */
+ if (!hashStyles[hcode].name) { /* None such -> classless version */
hcode = ohcode;
CTRACE2(TRACE_STYLE,
(tfp, "STYLE.start_element: type <%s> not configured.\n",
- type));
+ type));
} else {
addClassName(".type.", type, strlen(type));
CTRACE2(TRACE_STYLE,
(tfp, "STYLE.start_element: <%s>.type.<%s>, hcode=%d.\n",
- HTML_dtd.tags[element_number].name, type, hcode));
+ HTML_dtd.tags[element_number].name, type, hcode));
}
}
-#endif /* !OMIT_SCN_KEEPING */
+#endif /* !OMIT_SCN_KEEPING */
HText_characterStyle(me->text, hcode, 1);
#endif /* USE_COLOR_STYLE */
/*
- * Handle the start tag. - FM
+ * Handle the start tag. - FM
*/
switch (ElementNumber) {
@@ -1156,16 +1148,16 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_BASE:
if (present && present[HTML_BASE_HREF] && !local_host_only &&
- value[HTML_BASE_HREF] && *value[HTML_BASE_HREF]) {
+ non_empty(value[HTML_BASE_HREF])) {
char *base = NULL;
- CONST char *related = NULL;
+ const char *related = NULL;
StrAllocCopy(base, value[HTML_BASE_HREF]);
CTRACE((tfp, "*HTML_BASE: initial href=`%s'\n", NonNull(base)));
if (!(url_type = LYLegitimizeHREF(me, &base, TRUE, TRUE))) {
CTRACE((tfp, "HTML: BASE '%s' is not an absolute URL.\n",
- NonNull(base)));
+ NonNull(base)));
if (me->inBadBASE == FALSE)
HTAlert(BASE_NOT_ABSOLUTE);
me->inBadBASE = TRUE;
@@ -1173,12 +1165,11 @@ PRIVATE int HTML_start_element ARGS6(
if (url_type == LYNXIMGMAP_URL_TYPE) {
/*
- * These have a non-standard form, basically
- * strip the prefix or the code below would insert
- * a nonsense host into the pseudo URL. These
- * should never occur where they would be used for
- * resolution of relative URLs anyway. We can
- * also strip the #map part. - kw
+ * These have a non-standard form, basically strip the prefix
+ * or the code below would insert a nonsense host into the
+ * pseudo URL. These should never occur where they would be
+ * used for resolution of relative URLs anyway. We can also
+ * strip the #map part. - kw
*/
temp = base;
base = HTParse(base + 11, "", PARSE_ALL_WITHOUT_ANCHOR);
@@ -1186,21 +1177,21 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Get parent's address for defaulted fields.
+ * Get parent's address for defaulted fields.
*/
related = me->node_anchor->address;
/*
- * Create the access field.
+ * Create the access field.
*/
- temp = HTParse(base, related, PARSE_ACCESS+PARSE_PUNCTUATION);
+ temp = HTParse(base, related, PARSE_ACCESS + PARSE_PUNCTUATION);
StrAllocCopy(me->base_href, temp);
FREE(temp);
/*
- * Create the host[:port] field.
+ * Create the host[:port] field.
*/
- temp = HTParse(base, "", PARSE_HOST+PARSE_PUNCTUATION);
+ temp = HTParse(base, "", PARSE_HOST + PARSE_PUNCTUATION);
if (!strncmp(temp, "//", 2)) {
StrAllocCat(me->base_href, temp);
if (!strcmp(me->base_href, "file://")) {
@@ -1212,22 +1203,23 @@ PRIVATE int HTML_start_element ARGS6(
} else if (strcmp(me->base_href, STR_NEWS_URL)) {
FREE(temp);
StrAllocCat(me->base_href, (temp = HTParse(related, "",
- PARSE_HOST+PARSE_PUNCTUATION)));
+ PARSE_HOST + PARSE_PUNCTUATION)));
}
}
FREE(temp);
/*
- * Create the path field.
+ * Create the path field.
*/
- temp = HTParse(base, "", PARSE_PATH+PARSE_PUNCTUATION);
+ temp = HTParse(base, "", PARSE_PATH + PARSE_PUNCTUATION);
if (*temp != '\0') {
char *p = strchr(temp, '?');
+
if (p)
*p = '\0';
p = strrchr(temp, '/');
if (p)
- *(p+1) = '\0'; /* strip after the last slash */
+ *(p + 1) = '\0'; /* strip after the last slash */
StrAllocCat(me->base_href, temp);
} else if (!strcmp(me->base_href, STR_NEWS_URL)) {
@@ -1263,45 +1255,45 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_LINK:
intern_flag = FALSE;
if (present && present[HTML_LINK_HREF]) {
- CHECK_FOR_INTERN(intern_flag,value[HTML_LINK_HREF]);
+ CHECK_FOR_INTERN(intern_flag, value[HTML_LINK_HREF]);
/*
- * Prepare to do housekeeping on the reference. - FM
+ * Prepare to do housekeeping on the reference. - FM
*/
- if (!value[HTML_LINK_HREF]) {
+ if (isEmpty(value[HTML_LINK_HREF])) {
Base = (me->inBASE)
- ? me->base_href
- : me->node_anchor->address;
+ ? me->base_href
+ : me->node_anchor->address;
StrAllocCopy(href, Base);
} else {
StrAllocCopy(href, value[HTML_LINK_HREF]);
url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
Base = (me->inBASE && *href != '\0' && *href != '#')
- ? me->base_href
- : me->node_anchor->address;
+ ? me->base_href
+ : me->node_anchor->address;
HTParseALL(&href, Base);
}
/*
- * Handle links with a REV attribute. - FM
+ * Handle links with a REV attribute. - FM
*/
if (present &&
present[HTML_LINK_REV] && value[HTML_LINK_REV]) {
/*
- * Handle REV="made" or REV="owner". - LM & FM
+ * Handle REV="made" or REV="owner". - LM & FM
*/
if (!strcasecomp("made", value[HTML_LINK_REV]) ||
!strcasecomp("owner", value[HTML_LINK_REV])) {
/*
- * Load the owner element. - FM
+ * Load the owner element. - FM
*/
HTAnchor_setOwner(me->node_anchor, href);
CTRACE((tfp, "HTML: DOC OWNER '%s' found\n", href));
FREE(href);
/*
- * Load the RevTitle element if a TITLE attribute
- * and value are present. - FM
+ * Load the RevTitle element if a TITLE attribute and value
+ * are present. - FM
*/
if (present && present[HTML_LINK_TITLE] &&
value[HTML_LINK_TITLE] &&
@@ -1319,13 +1311,13 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Handle REL links. - FM
+ * Handle REL links. - FM
*/
if (present &&
present[HTML_LINK_REL] && value[HTML_LINK_REL]) {
/*
- * Ignore style sheets, for now. - FM
+ * Ignore style sheets, for now. - FM
*
* lss and css have different syntax - lynx shouldn't try to
* parse them now (it tries to parse them as lss, so it exits
@@ -1334,20 +1326,22 @@ PRIVATE int HTML_start_element ARGS6(
#ifndef USE_COLOR_STYLE
if (!strcasecomp(value[HTML_LINK_REL], "StyleSheet") ||
!strcasecomp(value[HTML_LINK_REL], "Style")) {
- CTRACE2(TRACE_STYLE, (tfp, "HTML: StyleSheet link found.\n"));
- CTRACE2(TRACE_STYLE, (tfp, " StyleSheets not yet implemented.\n"));
+ CTRACE2(TRACE_STYLE,
+ (tfp, "HTML: StyleSheet link found.\n"));
+ CTRACE2(TRACE_STYLE,
+ (tfp, " StyleSheets not yet implemented.\n"));
FREE(href);
break;
}
#endif /* ! USE_COLOR_STYLE */
/*
- * Ignore anything not registered in the 28-Mar-95
- * IETF HTML 3.0 draft and W3C HTML 3.2 draft, or not
- * appropriate for Lynx banner links in the expired
- * Maloney and Quin relrev draft. We'll make this more
- * efficient when the situation stabilizes, and for now,
- * we'll treat "Banner" as another toolbar element. - FM
+ * Ignore anything not registered in the 28-Mar-95 IETF HTML
+ * 3.0 draft and W3C HTML 3.2 draft, or not appropriate for
+ * Lynx banner links in the expired Maloney and Quin relrev
+ * draft. We'll make this more efficient when the situation
+ * stabilizes, and for now, we'll treat "Banner" as another
+ * toolbar element. - FM
*/
if (!strcasecomp(value[HTML_LINK_REL], "Home") ||
!strcasecomp(value[HTML_LINK_REL], "ToC") ||
@@ -1378,24 +1372,23 @@ PRIVATE int HTML_start_element ARGS6(
!strcasecomp(value[HTML_LINK_REL], "Start") ||
!strcasecomp(value[HTML_LINK_REL], "Appendix")) {
StrAllocCopy(title, value[HTML_LINK_REL]);
- pdoctitle = &title; /* for setting HTAnchor's title */
- } else
- if (!strcasecomp(value[HTML_LINK_REL], "Up") ||
- !strcasecomp(value[HTML_LINK_REL], "Next") ||
- !strcasecomp(value[HTML_LINK_REL], "Previous") ||
- !strcasecomp(value[HTML_LINK_REL], "Prev") ||
- !strcasecomp(value[HTML_LINK_REL], "Child") ||
- !strcasecomp(value[HTML_LINK_REL], "Sibling") ||
- !strcasecomp(value[HTML_LINK_REL], "Parent") ||
- !strcasecomp(value[HTML_LINK_REL], "Meta") ||
- !strcasecomp(value[HTML_LINK_REL], "URC") ||
- !strcasecomp(value[HTML_LINK_REL], "Pointer") ||
- !strcasecomp(value[HTML_LINK_REL], "Translation") ||
- !strcasecomp(value[HTML_LINK_REL], "Definition") ||
- !strcasecomp(value[HTML_LINK_REL], "Alternate") ||
- !strcasecomp(value[HTML_LINK_REL], "Section") ||
- !strcasecomp(value[HTML_LINK_REL], "Subsection") ||
- !strcasecomp(value[HTML_LINK_REL], "Chapter")) {
+ pdoctitle = &title; /* for setting HTAnchor's title */
+ } else if (!strcasecomp(value[HTML_LINK_REL], "Up") ||
+ !strcasecomp(value[HTML_LINK_REL], "Next") ||
+ !strcasecomp(value[HTML_LINK_REL], "Previous") ||
+ !strcasecomp(value[HTML_LINK_REL], "Prev") ||
+ !strcasecomp(value[HTML_LINK_REL], "Child") ||
+ !strcasecomp(value[HTML_LINK_REL], "Sibling") ||
+ !strcasecomp(value[HTML_LINK_REL], "Parent") ||
+ !strcasecomp(value[HTML_LINK_REL], "Meta") ||
+ !strcasecomp(value[HTML_LINK_REL], "URC") ||
+ !strcasecomp(value[HTML_LINK_REL], "Pointer") ||
+ !strcasecomp(value[HTML_LINK_REL], "Translation") ||
+ !strcasecomp(value[HTML_LINK_REL], "Definition") ||
+ !strcasecomp(value[HTML_LINK_REL], "Alternate") ||
+ !strcasecomp(value[HTML_LINK_REL], "Section") ||
+ !strcasecomp(value[HTML_LINK_REL], "Subsection") ||
+ !strcasecomp(value[HTML_LINK_REL], "Chapter")) {
StrAllocCopy(title, value[HTML_LINK_REL]);
/* not setting target HTAnchor's title, for these
links of highly relative character. Instead,
@@ -1417,7 +1410,7 @@ PRIVATE int HTML_start_element ARGS6(
#endif
} else {
CTRACE((tfp, "HTML: LINK with REL=\"%s\" ignored.\n",
- value[HTML_LINK_REL]));
+ value[HTML_LINK_REL]));
FREE(href);
break;
}
@@ -1425,8 +1418,8 @@ PRIVATE int HTML_start_element ARGS6(
} else if (present &&
present[HTML_LINK_REL] && value[HTML_LINK_REL]) {
/*
- * If no HREF was specified, handle special REL links
- * with self-designated HREFs. - FM
+ * If no HREF was specified, handle special REL links with
+ * self-designated HREFs. - FM
*/
if (!strcasecomp(value[HTML_LINK_REL], "Home")) {
StrAllocCopy(href, LynxHome);
@@ -1435,8 +1428,9 @@ PRIVATE int HTML_start_element ARGS6(
} else if (!strcasecomp(value[HTML_LINK_REL], "Index")) {
StrAllocCopy(href, indexfile);
} else {
- CTRACE((tfp, "HTML: LINK with REL=\"%s\" and no HREF ignored.\n",
- value[HTML_LINK_REL]));
+ CTRACE((tfp,
+ "HTML: LINK with REL=\"%s\" and no HREF ignored.\n",
+ value[HTML_LINK_REL]));
break;
}
StrAllocCopy(title, value[HTML_LINK_REL]);
@@ -1444,20 +1438,19 @@ PRIVATE int HTML_start_element ARGS6(
}
if (href) {
/*
- * Create a title (link name) from the TITLE value,
- * if present, or default to the REL value that was
- * loaded into title. - FM
+ * Create a title (link name) from the TITLE value, if present, or
+ * default to the REL value that was loaded into title. - FM
*/
if (present && present[HTML_LINK_TITLE] &&
- value[HTML_LINK_TITLE] && *value[HTML_LINK_TITLE] != '\0') {
+ non_empty(value[HTML_LINK_TITLE])) {
StrAllocCopy(title, value[HTML_LINK_TITLE]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&title, TRUE, FALSE);
LYTrimHead(title);
LYTrimTail(title);
pdoctitle = &title;
- FREE(temp); /* forget about recording RelTitle - kw */
+ FREE(temp); /* forget about recording RelTitle - kw */
}
- if (!(title && *title)) {
+ if (isEmpty(title)) {
FREE(href);
FREE(title);
break;
@@ -1465,30 +1458,27 @@ PRIVATE int HTML_start_element ARGS6(
if (me->inA) {
/*
- * Ugh! The LINK tag, which is a HEAD element,
- * is in an Anchor, which is BODY element. All
- * we can do is close the Anchor and cross our
- * fingers. - FM
+ * Ugh! The LINK tag, which is a HEAD element, is in an
+ * Anchor, which is BODY element. All we can do is close the
+ * Anchor and cross our fingers. - FM
*/
SET_SKIP_STACK(HTML_A);
HTML_end_element(me, HTML_A, include);
}
/*
- * Create anchors for the links that simulate
- * a toolbar. - FM
+ * Create anchors for the links that simulate a toolbar. - FM
*/
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- temp
- ? (HTLinkType*)HTAtom_for(temp)
- : INTERN_LT); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (temp
+ ? (HTLinkType *)
+ HTAtom_for(temp)
+ : INTERN_LT)); /* Type */
FREE(temp);
- if ((dest = HTAnchor_parent(
- HTAnchor_followLink(me->CurrentA)
- )) != NULL) {
+ if ((dest = HTAnchor_parent(HTAnchor_followLink(me->CurrentA)
+ )) != NULL) {
if (pdoctitle && !HTAnchor_title(dest))
HTAnchor_setTitle(dest, *pdoctitle);
@@ -1497,7 +1487,7 @@ PRIVATE int HTML_start_element ARGS6(
if (dest == me->node_anchor)
dest = NULL;
if (present[HTML_LINK_CHARSET] &&
- value[HTML_LINK_CHARSET] && *value[HTML_LINK_CHARSET] != '\0') {
+ non_empty(value[HTML_LINK_CHARSET])) {
dest_char_set = UCGetLYhndl_byMIME(value[HTML_LINK_CHARSET]);
if (dest_char_set < 0)
dest_char_set = UCLYhndl_for_unrec;
@@ -1509,20 +1499,19 @@ PRIVATE int HTML_start_element ARGS6(
}
UPDATE_STYLE;
if (!HText_hasToolbar(me->text) &&
- (ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- LYToolbarName, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0))) { /* Type */
+ (ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ LYToolbarName, /* Tag */
+ NULL, /* Addresss */
+ (HTLinkType *) 0))) { /* Type */
HText_appendCharacter(me->text, '#');
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
HText_setToolbar(me->text);
} else {
/*
- * Add collapsible space to separate link from previous
- * generated links. - kw
+ * Add collapsible space to separate link from previous
+ * generated links. - kw
*/
HTML_put_character(me, ' ');
}
@@ -1531,9 +1520,9 @@ PRIVATE int HTML_start_element ARGS6(
HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
#ifdef USE_COLOR_STYLE
if (present && present[HTML_LINK_CLASS] &&
- value && *value[HTML_LINK_CLASS]!='\0')
- {
+ non_empty(value[HTML_LINK_CLASS])) {
char *tmp = 0;
+
HTSprintf0(&tmp, "link.%s.%s", value[HTML_LINK_CLASS], title);
CTRACE2(TRACE_STYLE,
(tfp, "STYLE.link: using style <%s>\n", tmp));
@@ -1545,10 +1534,9 @@ PRIVATE int HTML_start_element ARGS6(
HTML_put_string(me, ")");
HText_characterStyle(me->text, hash_code(tmp), 0);
FREE(tmp);
- }
- else
+ } else
#endif
- HTML_put_string(me, title);
+ HTML_put_string(me, title);
if (me->inBoldH == FALSE)
HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
HText_endAnchor(me->text, 0);
@@ -1562,10 +1550,10 @@ PRIVATE int HTML_start_element ARGS6(
((present[HTML_ISINDEX_HREF] && value[HTML_ISINDEX_HREF]) ||
(present[HTML_ISINDEX_ACTION] && value[HTML_ISINDEX_ACTION]))) {
/*
- * Lynx was supporting ACTION, which never made it into
- * the HTML 2.0 specs. HTML 3.0 uses HREF, so we'll
- * use that too, but allow use of ACTION as an alternate
- * until people have fully switched over. - FM
+ * Lynx was supporting ACTION, which never made it into the HTML
+ * 2.0 specs. HTML 3.0 uses HREF, so we'll use that too, but allow
+ * use of ACTION as an alternate until people have fully switched
+ * over. - FM
*/
if (present[HTML_ISINDEX_HREF] && value[HTML_ISINDEX_HREF])
StrAllocCopy(href, value[HTML_ISINDEX_HREF]);
@@ -1574,23 +1562,23 @@ PRIVATE int HTML_start_element ARGS6(
LYLegitimizeHREF(me, &href, TRUE, TRUE);
Base = (me->inBASE && *href != '\0' && *href != '#')
- ? me->base_href
- : me->node_anchor->address;
+ ? me->base_href
+ : me->node_anchor->address;
HTParseALL(&href, Base);
HTAnchor_setIndex(me->node_anchor, href);
FREE(href);
} else {
Base = (me->inBASE) ?
- me->base_href : me->node_anchor->address;
+ me->base_href : me->node_anchor->address;
HTAnchor_setIndex(me->node_anchor, Base);
}
/*
- * Support HTML 3.0 PROMPT attribute. - FM
+ * Support HTML 3.0 PROMPT attribute. - FM
*/
if (present &&
present[HTML_ISINDEX_PROMPT] &&
- value[HTML_ISINDEX_PROMPT] && *value[HTML_ISINDEX_PROMPT]) {
+ non_empty(value[HTML_ISINDEX_PROMPT])) {
StrAllocCopy(temp, value[HTML_ISINDEX_PROMPT]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&temp, TRUE, FALSE);
LYTrimHead(temp);
@@ -1612,16 +1600,16 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_STYLE:
/*
- * We're getting it as Literal text, which, for now,
- * we'll just ignore. - FM
+ * We're getting it as Literal text, which, for now, we'll just ignore.
+ * - FM
*/
HTChunkClear(&me->style_block);
break;
case HTML_SCRIPT:
/*
- * We're getting it as Literal text, which, for now,
- * we'll just ignore. - FM
+ * We're getting it as Literal text, which, for now, we'll just ignore.
+ * - FM
*/
HTChunkClear(&me->script);
break;
@@ -1637,14 +1625,14 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_FRAME:
if (present && present[HTML_FRAME_NAME] &&
- value[HTML_FRAME_NAME] && *value[HTML_FRAME_NAME]) {
+ non_empty(value[HTML_FRAME_NAME])) {
StrAllocCopy(id_string, value[HTML_FRAME_NAME]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&id_string, TRUE, FALSE);
LYTrimHead(id_string);
LYTrimTail(id_string);
}
if (present && present[HTML_FRAME_SRC] &&
- value[HTML_FRAME_SRC] && *value[HTML_FRAME_SRC]) {
+ non_empty(value[HTML_FRAME_SRC])) {
StrAllocCopy(href, value[HTML_FRAME_SRC]);
LYLegitimizeHREF(me, &href, TRUE, TRUE);
@@ -1652,11 +1640,10 @@ PRIVATE int HTML_start_element ARGS6(
SET_SKIP_STACK(HTML_A);
HTML_end_element(me, HTML_A, include);
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
CAN_JUSTIFY_PUSH(FALSE);
LYEnsureSingleSpace(me);
if (me->inUnderline == FALSE)
@@ -1691,28 +1678,27 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_IFRAME:
if (present && present[HTML_IFRAME_NAME] &&
- value[HTML_IFRAME_NAME] && *value[HTML_IFRAME_NAME]) {
+ non_empty(value[HTML_IFRAME_NAME])) {
StrAllocCopy(id_string, value[HTML_IFRAME_NAME]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&id_string, TRUE, FALSE);
LYTrimHead(id_string);
LYTrimTail(id_string);
}
if (present && present[HTML_IFRAME_SRC] &&
- value[HTML_IFRAME_SRC] && *value[HTML_IFRAME_SRC]) {
+ non_empty(value[HTML_IFRAME_SRC])) {
StrAllocCopy(href, value[HTML_IFRAME_SRC]);
LYLegitimizeHREF(me, &href, TRUE, TRUE);
if (me->inA)
HTML_end_element(me, HTML_A, include);
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
LYEnsureDoubleSpace(me);
CAN_JUSTIFY_PUSH_F
- LYResetParagraphAlignment(me);
+ LYResetParagraphAlignment(me);
if (me->inUnderline == FALSE)
HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
HTML_put_string(me, "IFRAME:");
@@ -1745,17 +1731,15 @@ PRIVATE int HTML_start_element ARGS6(
if (me->sp->tag_number == (int) ElementNumber)
LYEnsureDoubleSpace(me);
/*
- * Treat this as a toolbar if we don't have one
- * yet, and we are in the first half of the
- * first page. - FM
+ * Treat this as a toolbar if we don't have one yet, and we are in the
+ * first half of the first page. - FM
*/
if ((!HText_hasToolbar(me->text) &&
- HText_getLines(me->text) < (display_lines/2)) &&
- (ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- LYToolbarName, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0))) { /* Type */
+ HText_getLines(me->text) < (display_lines / 2)) &&
+ (ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ LYToolbarName, /* Tag */
+ NULL, /* Addresss */
+ (HTLinkType *) 0))) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
HText_setToolbar(me->text);
@@ -1769,11 +1753,11 @@ PRIVATE int HTML_start_element ARGS6(
me->Division_Level++;
} else {
CTRACE((tfp,
- "HTML: ****** Maximum nesting of %d divisions exceeded!\n",
- MAX_NESTING));
+ "HTML: ****** Maximum nesting of %d divisions exceeded!\n",
+ MAX_NESTING));
}
if (me->inP)
- LYEnsureSingleSpace(me); /* always at least break line - kw */
+ LYEnsureSingleSpace(me); /* always at least break line - kw */
if (ElementNumber == HTML_CENTER) {
me->DivisionAlignments[me->Division_Level] = HT_CENTER;
change_paragraph_style(me, styles[HTML_DCENTER]);
@@ -1800,7 +1784,7 @@ PRIVATE int HTML_start_element ARGS6(
me->DivisionAlignments[me->Division_Level] = (short)
me->current_default_alignment;
} else if (present && present[HTML_DIV_ALIGN] &&
- value[HTML_DIV_ALIGN] && *value[HTML_DIV_ALIGN]) {
+ non_empty(value[HTML_DIV_ALIGN])) {
if (!strcasecomp(value[HTML_DIV_ALIGN], "center")) {
me->DivisionAlignments[me->Division_Level] = HT_CENTER;
change_paragraph_style(me, styles[HTML_DCENTER]);
@@ -1833,21 +1817,21 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_H5:
case HTML_H6:
/*
- * Close the previous style if not done by HTML doc.
- * Added to get rid of core dumps in BAD HTML on the net.
- * GAB 07-07-94
- * But then again, these are actually allowed to nest. I guess
- * I have to depend on the HTML writers correct style.
- * GAB 07-12-94
- if (i_prior_style != -1) {
- HTML_end_element(me, i_prior_style);
- }
- i_prior_style = ElementNumber;
+ * Close the previous style if not done by HTML doc. Added to get rid
+ * of core dumps in BAD HTML on the net.
+ * GAB 07-07-94
+ * But then again, these are actually allowed to nest. I guess I have
+ * to depend on the HTML writers correct style.
+ * GAB 07-12-94
+ if (i_prior_style != -1) {
+ HTML_end_element(me, i_prior_style);
+ }
+ i_prior_style = ElementNumber;
*/
/*
- * Check whether we have an H# in a list,
- * and if so, treat it as an LH. - FM
+ * Check whether we have an H# in a list, and if so, treat it as an LH.
+ * - FM
*/
if ((me->List_Nesting_Level >= 0) &&
(me->sp[0].tag_number == HTML_UL ||
@@ -1859,18 +1843,16 @@ PRIVATE int HTML_start_element ARGS6(
ElementNumber = HTML_LH;
} else {
me->new_style = me->sp[0].style;
- ElementNumber = me->sp[0].tag_number;
+ ElementNumber = (HTMLElement) me->sp[0].tag_number;
UPDATE_STYLE;
}
/*
- * Some authors use H# headers as a substitute for
- * FONT, so check if this one immediately followed
- * an LI. If so, both me->inP and me->in_word will
- * be FALSE (though the line might not be empty due
- * to a bullet and/or nbsp) and we can assume it is
- * just for a FONT change. We thus will not create
- * another line break nor add to the current left
- * indentation. - FM
+ * Some authors use H# headers as a substitute for FONT, so check
+ * if this one immediately followed an LI. If so, both me->inP and
+ * me->in_word will be FALSE (though the line might not be empty
+ * due to a bullet and/or nbsp) and we can assume it is just for a
+ * FONT change. We thus will not create another line break nor add
+ * to the current left indentation. - FM
*/
if (!(me->inP == FALSE && me->in_word == NO)) {
HText_appendParagraph(me->text);
@@ -1884,7 +1866,7 @@ PRIVATE int HTML_start_element ARGS6(
}
if (present && present[HTML_H_ALIGN] &&
- value[HTML_H_ALIGN] && *value[HTML_H_ALIGN]) {
+ non_empty(value[HTML_H_ALIGN])) {
if (!strcasecomp(value[HTML_H_ALIGN], "center"))
change_paragraph_style(me, styles[HTML_HCENTER]);
else if (!strcasecomp(value[HTML_H_ALIGN], "right"))
@@ -1910,7 +1892,7 @@ PRIVATE int HTML_start_element ARGS6(
if ((bold_headers == TRUE ||
(ElementNumber == HTML_H1 && bold_H1 == TRUE)) &&
- (styles[ElementNumber]->font&HT_BOLD)) {
+ (styles[ElementNumber]->font & HT_BOLD)) {
if (me->inBoldA == FALSE && me->inBoldH == FALSE) {
HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
}
@@ -1926,16 +1908,16 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_BR:
UPDATE_STYLE;
CHECK_ID(HTML_GEN_ID);
- /* Add a \r (new line) if these three conditions are true:
- * 1. We are not collapsing BR's, and
- * 2. The previous line has text on it, or
- * 3. This line has text on it.
- * Otherwise, don't do anything. -DH 980814, TD 980827
- */
+ /* Add a \r (new line) if these three conditions are true:
+ * 1. We are not collapsing BR's, and
+ * 2. The previous line has text on it, or
+ * 3. This line has text on it.
+ * Otherwise, don't do anything. -DH 980814, TD 980827
+ */
if ((LYCollapseBRs == FALSE &&
!HText_PreviousLineEmpty(me->text, FALSE)) ||
!HText_LastLineEmpty(me->text, FALSE)) {
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
HText_appendCharacter(me->text, '\r');
}
me->in_word = NO;
@@ -1960,14 +1942,13 @@ PRIVATE int HTML_start_element ARGS6(
int width;
/*
- * Start a new line only if we had printable
- * characters following the previous newline,
- * or remove the previous line if both it and
- * the last line are blank. - FM
+ * Start a new line only if we had printable characters following
+ * the previous newline, or remove the previous line if both it and
+ * the last line are blank. - FM
*/
UPDATE_STYLE;
if (!HText_LastLineEmpty(me->text, FALSE)) {
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
HText_appendCharacter(me->text, '\r');
} else if (HText_PreviousLineEmpty(me->text, FALSE)) {
HText_RemovePreviousLine(me->text);
@@ -1976,17 +1957,16 @@ PRIVATE int HTML_start_element ARGS6(
me->inP = FALSE;
/*
- * Add an ID link if needed. - FM
+ * Add an ID link if needed. - FM
*/
CHECK_ID(HTML_HR_ID);
- /*
- * Center lines within the current margins, if
- * a right or left ALIGNment is not specified.
- * If WIDTH="#%" is given and not garbage,
- * use that to calculate the width, otherwise
- * use the default width. - FM
- */
+ /*
+ * Center lines within the current margins, if a right or left
+ * ALIGNment is not specified. If WIDTH="#%" is given and not
+ * garbage, use that to calculate the width, otherwise use the
+ * default width. - FM
+ */
if (present && present[HTML_HR_ALIGN] && value[HTML_HR_ALIGN]) {
if (!strcasecomp(value[HTML_HR_ALIGN], "right")) {
me->sp->style->alignment = HT_RIGHT;
@@ -1998,15 +1978,16 @@ PRIVATE int HTML_start_element ARGS6(
} else {
me->sp->style->alignment = HT_CENTER;
}
- width = LYcols - 1 -
- me->new_style->leftIndent - me->new_style->rightIndent;
+ width = LYcolLimit -
+ me->new_style->leftIndent - me->new_style->rightIndent;
if (present && present[HTML_HR_WIDTH] && value[HTML_HR_WIDTH] &&
isdigit(UCH(*value[HTML_HR_WIDTH])) &&
- value[HTML_HR_WIDTH][strlen(value[HTML_HR_WIDTH])-1] == '%') {
+ value[HTML_HR_WIDTH][strlen(value[HTML_HR_WIDTH]) - 1] == '%') {
char *percent = NULL;
int Percent, Width;
+
StrAllocCopy(percent, value[HTML_HR_WIDTH]);
- percent[strlen(percent)-1] = '\0';
+ percent[strlen(percent) - 1] = '\0';
Percent = atoi(percent);
if (Percent > 100 || Percent < 1)
width -= 5;
@@ -2028,13 +2009,13 @@ PRIVATE int HTML_start_element ARGS6(
me->inP = FALSE;
/*
- * Reset the alignment appropriately
- * for the division and/or block. - FM
+ * Reset the alignment appropriately for the division and/or block.
+ * - FM
*/
if (me->List_Nesting_Level < 0 &&
me->Division_Level >= 0) {
me->sp->style->alignment =
- me->DivisionAlignments[me->Division_Level];
+ me->DivisionAlignments[me->Division_Level];
} else if (me->sp->style->id == ST_HeadingCenter ||
me->sp->style->id == ST_Heading1) {
me->sp->style->alignment = HT_CENTER;
@@ -2045,13 +2026,12 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Add a blank line and set the second line
- * indentation for lists and addresses, or a
- * paragraph separator for other blocks. - FM
+ * Add a blank line and set the second line indentation for lists
+ * and addresses, or a paragraph separator for other blocks. - FM
*/
if (me->List_Nesting_Level >= 0 ||
me->sp[0].tag_number == HTML_ADDRESS) {
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
HText_appendCharacter(me->text, '\r');
} else {
HText_appendParagraph(me->text);
@@ -2060,15 +2040,14 @@ PRIVATE int HTML_start_element ARGS6(
break;
case HTML_TAB:
- if (!present) { /* Bad tag. Must have at least one attribute. - FM */
+ if (!present) { /* Bad tag. Must have at least one attribute. - FM */
CTRACE((tfp, "HTML: TAB tag has no attributes. Ignored.\n"));
break;
}
/*
- * If page author is using TAB within a TABLE, it's probably
- * formatted specifically to work well for Lynx without simple
- * table tracking code. Cancel tracking, it would only make
- * things worse. - kw
+ * If page author is using TAB within a TABLE, it's probably formatted
+ * specifically to work well for Lynx without simple table tracking
+ * code. Cancel tracking, it would only make things worse. - kw
*/
HText_cancelStbl(me->text);
UPDATE_STYLE;
@@ -2078,25 +2057,25 @@ PRIVATE int HTML_start_element ARGS6(
(strcasecomp(value[HTML_TAB_ALIGN], "left") ||
!(present[HTML_TAB_TO] || present[HTML_TAB_INDENT]))) {
/*
- * Just ensure a collapsible space, until we have
- * the ALIGN and DP attributes implemented. - FM
+ * Just ensure a collapsible space, until we have the ALIGN and DP
+ * attributes implemented. - FM
*/
HTML_put_character(me, ' ');
- CTRACE((tfp, "HTML: ALIGN not 'left'. Using space instead of TAB.\n"));
+ CTRACE((tfp,
+ "HTML: ALIGN not 'left'. Using space instead of TAB.\n"));
} else if (!LYoverride_default_alignment(me) &&
me->current_default_alignment != HT_LEFT) {
/*
- * Just ensure a collapsible space, until we
- * can replace HText_getCurrentColumn() in
- * GridText.c with code which doesn't require
- * that the alignment be HT_LEFT. - FM
+ * Just ensure a collapsible space, until we can replace
+ * HText_getCurrentColumn() in GridText.c with code which doesn't
+ * require that the alignment be HT_LEFT. - FM
*/
HTML_put_character(me, ' ');
CTRACE((tfp, "HTML: Not HT_LEFT. Using space instead of TAB.\n"));
} else if ((present[HTML_TAB_TO] &&
- value[HTML_TAB_TO] && *value[HTML_TAB_TO]) ||
+ non_empty(value[HTML_TAB_TO])) ||
(present[HTML_TAB_INDENT] &&
value[HTML_TAB_INDENT] &&
isdigit(UCH(*value[HTML_TAB_INDENT])))) {
@@ -2105,50 +2084,51 @@ PRIVATE int HTML_start_element ARGS6(
column = HText_getCurrentColumn(me->text);
if (present[HTML_TAB_TO] &&
- value[HTML_TAB_TO] && *value[HTML_TAB_TO]) {
+ non_empty(value[HTML_TAB_TO])) {
/*
- * TO has priority over INDENT if both are present. - FM
+ * TO has priority over INDENT if both are present. - FM
*/
StrAllocCopy(temp, value[HTML_TAB_TO]);
TRANSLATE_AND_UNESCAPE_TO_STD(&temp);
if (*temp) {
target = HText_getTabIDColumn(me->text, temp);
}
- } else if (!(temp && *temp) && present[HTML_TAB_INDENT] &&
+ } else if (isEmpty(temp) && present[HTML_TAB_INDENT] &&
value[HTML_TAB_INDENT] &&
isdigit(UCH(*value[HTML_TAB_INDENT]))) {
/*
- * The INDENT value is in "en" (enval per column) units.
- * Divide it by enval, rounding odd values up. - FM
+ * The INDENT value is in "en" (enval per column) units.
+ * Divide it by enval, rounding odd values up. - FM
*/
target =
- (int)(((1.0 * atoi(value[HTML_TAB_INDENT]))/enval)+(0.5));
+ (int) (((1.0 * atoi(value[HTML_TAB_INDENT])) / enval) + (0.5));
}
FREE(temp);
/*
- * If we are being directed to a column too far to the left
- * or right, just add a collapsible space, otherwise, add the
- * appropriate number of spaces. - FM
+ * If we are being directed to a column too far to the left or
+ * right, just add a collapsible space, otherwise, add the
+ * appropriate number of spaces. - FM
*/
if (target < column ||
target > HText_getMaximumColumn(me->text)) {
HTML_put_character(me, ' ');
- CTRACE((tfp, "HTML: Column out of bounds. Using space instead of TAB.\n"));
+ CTRACE((tfp,
+ "HTML: Column out of bounds. Using space instead of TAB.\n"));
} else {
for (i = column; i < target; i++)
HText_appendCharacter(me->text, ' ');
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
}
}
me->in_word = NO;
/*
- * If we have an ID attribute, save it together
- * with the value of the column we've reached. - FM
+ * If we have an ID attribute, save it together with the value of the
+ * column we've reached. - FM
*/
if (present[HTML_TAB_ID] &&
- value[HTML_TAB_ID] && *value[HTML_TAB_ID]) {
+ non_empty(value[HTML_TAB_ID])) {
StrAllocCopy(temp, value[HTML_TAB_ID]);
TRANSLATE_AND_UNESCAPE_TO_STD(&temp);
if (*temp)
@@ -2163,17 +2143,16 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_FONT:
/*
- * FONT *may* have been declared SGML_EMPTY in HTMLDTD.c, and
- * SGML_character() in SGML.c *may* check for a FONT end
- * tag to call HTML_end_element() directly (with a
- * check in that to bypass decrementing of the HTML
- * parser's stack). Or this may have been really a </FONT>
- * end tag, for which some incarnations of SGML.c would fake
- * a <FONT> start tag instead. - fm & kw
+ * FONT *may* have been declared SGML_EMPTY in HTMLDTD.c, and
+ * SGML_character() in SGML.c *may* check for a FONT end tag to call
+ * HTML_end_element() directly (with a check in that to bypass
+ * decrementing of the HTML parser's stack). Or this may have been
+ * really a </FONT> end tag, for which some incarnations of SGML.c
+ * would fake a <FONT> start tag instead. - fm & kw
*
- * But if we have an open FONT, DON'T close that one now,
- * since FONT tags can be legally nested AFAIK, and Lynx
- * currently doesn't do anything with them anyway... - kw
+ * But if we have an open FONT, DON'T close that one now, since FONT
+ * tags can be legally nested AFAIK, and Lynx currently doesn't do
+ * anything with them anyway... - kw
*/
#ifdef NOTUSED_FOTEMODS
if (me->inFONT == TRUE)
@@ -2181,26 +2160,26 @@ PRIVATE int HTML_start_element ARGS6(
#endif /* NOTUSED_FOTEMODS */
/*
- * Set flag to know we are in a FONT container, and
- * add code to do something about it, someday. - FM
+ * Set flag to know we are in a FONT container, and add code to do
+ * something about it, someday. - FM
*/
me->inFONT = TRUE;
break;
- case HTML_B: /* Physical character highlighting */
+ case HTML_B: /* Physical character highlighting */
case HTML_BLINK:
case HTML_I:
case HTML_U:
- case HTML_CITE: /* Logical character highlighting */
+ case HTML_CITE: /* Logical character highlighting */
case HTML_EM:
case HTML_STRONG:
UPDATE_STYLE;
me->Underline_Level++;
CHECK_ID(HTML_GEN_ID);
/*
- * Ignore this if inside of a bold anchor or header.
- * Can't display both underline and bold at same time.
+ * Ignore this if inside of a bold anchor or header. Can't display
+ * both underline and bold at same time.
*/
if (me->inBoldA == TRUE || me->inBoldH == TRUE) {
CTRACE((tfp, "Underline Level is %d\n", me->Underline_Level));
@@ -2209,13 +2188,13 @@ PRIVATE int HTML_start_element ARGS6(
if (me->inUnderline == FALSE) {
HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
me->inUnderline = TRUE;
- CTRACE((tfp,"Beginning underline\n"));
+ CTRACE((tfp, "Beginning underline\n"));
} else {
- CTRACE((tfp,"Underline Level is %d\n", me->Underline_Level));
+ CTRACE((tfp, "Underline Level is %d\n", me->Underline_Level));
}
break;
- case HTML_ABBREV: /* Miscellaneous character containers */
+ case HTML_ABBREV: /* Miscellaneous character containers */
case HTML_ACRONYM:
case HTML_AU:
case HTML_AUTHOR:
@@ -2228,7 +2207,7 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_TT:
case HTML_VAR:
CHECK_ID(HTML_GEN_ID);
- break; /* ignore */
+ break; /* ignore */
case HTML_SUP:
HText_appendCharacter(me->text, '^');
@@ -2267,11 +2246,10 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_Q:
CHECK_ID(HTML_GEN_ID);
/*
- * Should check LANG and/or DIR attributes, and the
- * me->node_anchor->charset and/or yet to be added
- * structure elements, to determine whether we should
- * use chevrons, but for now we'll always use double-
- * or single-quotes. - FM
+ * Should check LANG and/or DIR attributes, and the
+ * me->node_anchor->charset and/or yet to be added structure elements,
+ * to determine whether we should use chevrons, but for now we'll
+ * always use double- or single-quotes. - FM
*/
if (!(me->Quote_Level & 1))
HTML_put_character(me, '"');
@@ -2280,17 +2258,16 @@ PRIVATE int HTML_start_element ARGS6(
me->Quote_Level++;
break;
- case HTML_PRE: /* Formatted text */
+ case HTML_PRE: /* Formatted text */
/*
- ** Set our inPRE flag to FALSE so that a newline
- ** immediately following the PRE start tag will
- ** be ignored. HTML_put_character() will set it
- ** to TRUE when the first character within the
- ** PRE block is received. - FM
- */
+ * Set our inPRE flag to FALSE so that a newline immediately following
+ * the PRE start tag will be ignored. HTML_put_character() will set it
+ * to TRUE when the first character within the PRE block is received.
+ * - FM
+ */
me->inPRE = FALSE;
/* FALLTHRU */
- case HTML_LISTING: /* Literal text */
+ case HTML_LISTING: /* Literal text */
/* FALLTHRU */
case HTML_XMP:
/* FALLTHRU */
@@ -2321,7 +2298,7 @@ PRIVATE int HTML_start_element ARGS6(
char *note = NULL;
/*
- * Indicate the type of NOTE.
+ * Indicate the type of NOTE.
*/
if (present && present[HTML_NOTE_CLASS] &&
value[HTML_NOTE_CLASS] &&
@@ -2364,27 +2341,27 @@ PRIVATE int HTML_start_element ARGS6(
break;
case HTML_DL:
- me->List_Nesting_Level++; /* increment the List nesting level */
+ me->List_Nesting_Level++; /* increment the List nesting level */
if (me->List_Nesting_Level <= 0) {
change_paragraph_style(me, present && present[HTML_DL_COMPACT]
- ? styles[HTML_DLC] : styles[HTML_DL]);
+ ? styles[HTML_DLC] : styles[HTML_DL]);
} else if (me->List_Nesting_Level >= 6) {
change_paragraph_style(me, present && present[HTML_DL_COMPACT]
- ? styles[HTML_DLC6] : styles[HTML_DL6]);
+ ? styles[HTML_DLC6] : styles[HTML_DL6]);
} else {
change_paragraph_style(me, present && present[HTML_DL_COMPACT]
- ? styles[(HTML_DLC1 - 1) + me->List_Nesting_Level]
- : styles[(HTML_DL1 - 1) + me->List_Nesting_Level]);
+ ? styles[(HTML_DLC1 - 1) + me->List_Nesting_Level]
+ : styles[(HTML_DL1 - 1) + me->List_Nesting_Level]);
}
- UPDATE_STYLE; /* update to the new style */
+ UPDATE_STYLE; /* update to the new style */
CHECK_ID(HTML_DL_ID);
break;
case HTML_DLC:
- me->List_Nesting_Level++; /* increment the List nesting level */
+ me->List_Nesting_Level++; /* increment the List nesting level */
if (me->List_Nesting_Level <= 0) {
change_paragraph_style(me, styles[HTML_DLC]);
@@ -2393,9 +2370,9 @@ PRIVATE int HTML_start_element ARGS6(
} else {
change_paragraph_style(me,
- styles[(HTML_DLC1 - 1) + me->List_Nesting_Level]);
+ styles[(HTML_DLC1 - 1) + me->List_Nesting_Level]);
}
- UPDATE_STYLE; /* update to the new style */
+ UPDATE_STYLE; /* update to the new style */
CHECK_ID(HTML_DL_ID);
break;
@@ -2405,20 +2382,21 @@ PRIVATE int HTML_start_element ARGS6(
BOOL in_line_1 = HText_inLineOne(me->text);
HTCoord saved_spaceBefore = me->sp->style->spaceBefore;
HTCoord saved_spaceAfter = me->sp->style->spaceAfter;
+
/*
- * If there are several DT elements and this is not the first,
- * and the preceding DT element's first (and normally only) line
- * has not yet been ended, suppress intervening blank line by
- * temporarily modifying the paragraph style in place. Ugly
- * but there's ample precedence. - kw
+ * If there are several DT elements and this is not the first, and
+ * the preceding DT element's first (and normally only) line has
+ * not yet been ended, suppress intervening blank line by
+ * temporarily modifying the paragraph style in place. Ugly but
+ * there's ample precedence. - kw
*/
if (in_line_1) {
- me->sp->style->spaceBefore = 0; /* temporary change */
+ me->sp->style->spaceBefore = 0; /* temporary change */
me->sp->style->spaceAfter = 0; /* temporary change */
}
HText_appendParagraph(me->text);
- me->sp->style->spaceBefore = saved_spaceBefore; /* undo */
- me->sp->style->spaceAfter = saved_spaceAfter; /* undo */
+ me->sp->style->spaceBefore = saved_spaceBefore; /* undo */
+ me->sp->style->spaceAfter = saved_spaceAfter; /* undo */
me->in_word = NO;
me->sp->style->alignment = HT_LEFT;
}
@@ -2427,8 +2405,8 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_DD:
CHECK_ID(HTML_GEN_ID);
- HText_setLastChar(me->text, ' '); /* absorb white space */
- if (!me->style_change) {
+ HText_setLastChar(me->text, ' '); /* absorb white space */
+ if (!me->style_change) {
if (!HText_LastLineEmpty(me->text, FALSE)) {
HText_appendCharacter(me->text, '\r');
} else {
@@ -2447,90 +2425,88 @@ PRIVATE int HTML_start_element ARGS6(
/*
* Set the default TYPE.
*/
- me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = '1';
+ me->OL_Type[(me->List_Nesting_Level < 11 ?
+ me->List_Nesting_Level + 1 : 11)] = '1';
/*
- * Check whether we have a starting sequence number,
- * or want to continue the numbering from a previous
- * OL in this nest. - FM
+ * Check whether we have a starting sequence number, or want to
+ * continue the numbering from a previous OL in this nest. - FM
*/
if (present && (present[HTML_OL_SEQNUM] || present[HTML_OL_START])) {
int seqnum;
/*
- * Give preference to the valid HTML 3.0 SEQNUM attribute name
- * over the Netscape START attribute name (too bad the Netscape
- * developers didn't read the HTML 3.0 specs before re-inventing
- * the "wheel" as "we'll"). - FM
+ * Give preference to the valid HTML 3.0 SEQNUM attribute name over
+ * the Netscape START attribute name (too bad the Netscape
+ * developers didn't read the HTML 3.0 specs before re-inventing
+ * the "wheel" as "we'll"). - FM
*/
if (present[HTML_OL_SEQNUM] &&
- value[HTML_OL_SEQNUM] && *value[HTML_OL_SEQNUM]) {
+ non_empty(value[HTML_OL_SEQNUM])) {
seqnum = atoi(value[HTML_OL_SEQNUM]);
} else if (present[HTML_OL_START] &&
- value[HTML_OL_START] && *value[HTML_OL_START]) {
+ non_empty(value[HTML_OL_START])) {
seqnum = atoi(value[HTML_OL_START]);
} else {
seqnum = 1;
}
/*
- * Don't allow negative numbers less than
- * or equal to our flags, or numbers less
- * than 1 if an Alphabetic or Roman TYPE. - FM
+ * Don't allow negative numbers less than or equal to our flags, or
+ * numbers less than 1 if an Alphabetic or Roman TYPE. - FM
*/
if (present[HTML_OL_TYPE] && value[HTML_OL_TYPE]) {
if (*value[HTML_OL_TYPE] == 'A') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'A';
+ me->List_Nesting_Level + 1 : 11)] = 'A';
if (seqnum < 1)
seqnum = 1;
} else if (*value[HTML_OL_TYPE] == 'a') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'a';
+ me->List_Nesting_Level + 1 : 11)] = 'a';
if (seqnum < 1)
seqnum = 1;
} else if (*value[HTML_OL_TYPE] == 'I') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'I';
+ me->List_Nesting_Level + 1 : 11)] = 'I';
if (seqnum < 1)
seqnum = 1;
} else if (*value[HTML_OL_TYPE] == 'i') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'i';
+ me->List_Nesting_Level + 1 : 11)] = 'i';
if (seqnum < 1)
seqnum = 1;
} else {
- if (seqnum <= OL_VOID)
- seqnum = OL_VOID + 1;
+ if (seqnum <= OL_VOID)
+ seqnum = OL_VOID + 1;
}
} else if (seqnum <= OL_VOID) {
seqnum = OL_VOID + 1;
}
me->OL_Counter[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = seqnum;
+ me->List_Nesting_Level + 1 : 11)] = seqnum;
} else if (present && present[HTML_OL_CONTINUE]) {
me->OL_Counter[me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11] = OL_CONTINUE;
+ me->List_Nesting_Level + 1 : 11] = OL_CONTINUE;
} else {
me->OL_Counter[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 1;
+ me->List_Nesting_Level + 1 : 11)] = 1;
if (present && present[HTML_OL_TYPE] && value[HTML_OL_TYPE]) {
if (*value[HTML_OL_TYPE] == 'A') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'A';
+ me->List_Nesting_Level + 1 : 11)] = 'A';
} else if (*value[HTML_OL_TYPE] == 'a') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'a';
+ me->List_Nesting_Level + 1 : 11)] = 'a';
} else if (*value[HTML_OL_TYPE] == 'I') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'I';
+ me->List_Nesting_Level + 1 : 11)] = 'I';
} else if (*value[HTML_OL_TYPE] == 'i') {
me->OL_Type[(me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level+1 : 11)] = 'i';
+ me->List_Nesting_Level + 1 : 11)] = 'i';
}
}
}
@@ -2544,9 +2520,9 @@ PRIVATE int HTML_start_element ARGS6(
} else {
change_paragraph_style(me,
- styles[HTML_OL1 + me->List_Nesting_Level - 1]);
+ styles[HTML_OL1 + me->List_Nesting_Level - 1]);
}
- UPDATE_STYLE; /* update to the new style */
+ UPDATE_STYLE; /* update to the new style */
CHECK_ID(HTML_OL_ID);
break;
@@ -2557,7 +2533,7 @@ PRIVATE int HTML_start_element ARGS6(
if (!(present && present[HTML_UL_PLAIN]) &&
!(present && present[HTML_UL_TYPE] &&
value[HTML_UL_TYPE] &&
- 0==strcasecomp(value[HTML_UL_TYPE], "PLAIN"))) {
+ 0 == strcasecomp(value[HTML_UL_TYPE], "PLAIN"))) {
change_paragraph_style(me, styles[ElementNumber]);
} else {
change_paragraph_style(me, styles[HTML_DIR]);
@@ -2568,7 +2544,7 @@ PRIVATE int HTML_start_element ARGS6(
if (!(present && present[HTML_UL_PLAIN]) &&
!(present && present[HTML_UL_TYPE] &&
value[HTML_UL_TYPE] &&
- 0==strcasecomp(value[HTML_UL_TYPE], "PLAIN"))) {
+ 0 == strcasecomp(value[HTML_UL_TYPE], "PLAIN"))) {
change_paragraph_style(me, styles[HTML_OL6]);
} else {
change_paragraph_style(me, styles[HTML_MENU6]);
@@ -2579,16 +2555,18 @@ PRIVATE int HTML_start_element ARGS6(
if (!(present && present[HTML_UL_PLAIN]) &&
!(present && present[HTML_UL_TYPE] &&
value[HTML_UL_TYPE] &&
- 0==strcasecomp(value[HTML_UL_TYPE], "PLAIN"))) {
+ 0 == strcasecomp(value[HTML_UL_TYPE], "PLAIN"))) {
change_paragraph_style(me,
- styles[HTML_OL1 + me->List_Nesting_Level - 1]);
+ styles[HTML_OL1 + me->List_Nesting_Level
+ - 1]);
} else {
change_paragraph_style(me,
- styles[HTML_MENU1 + me->List_Nesting_Level - 1]);
+ styles[HTML_MENU1 + me->List_Nesting_Level
+ - 1]);
ElementNumber = HTML_DIR;
}
}
- UPDATE_STYLE; /* update to the new style */
+ UPDATE_STYLE; /* update to the new style */
CHECK_ID(HTML_UL_ID);
break;
@@ -2604,14 +2582,15 @@ PRIVATE int HTML_start_element ARGS6(
} else {
change_paragraph_style(me,
- styles[HTML_MENU1 + me->List_Nesting_Level - 1]);
+ styles[HTML_MENU1 + me->List_Nesting_Level
+ - 1]);
}
- UPDATE_STYLE; /* update to the new style */
+ UPDATE_STYLE; /* update to the new style */
CHECK_ID(HTML_UL_ID);
break;
case HTML_LH:
- UPDATE_STYLE; /* update to the new style */
+ UPDATE_STYLE; /* update to the new style */
HText_appendParagraph(me->text);
CHECK_ID(HTML_GEN_ID);
HTML_put_character(me, HT_NON_BREAK_SPACE);
@@ -2621,16 +2600,17 @@ PRIVATE int HTML_start_element ARGS6(
break;
case HTML_LI:
- UPDATE_STYLE; /* update to the new style */
+ UPDATE_STYLE; /* update to the new style */
HText_appendParagraph(me->text);
me->sp->style->alignment = HT_LEFT;
CHECK_ID(HTML_LI_ID);
{
int surrounding_tag_number = me->sp[0].tag_number;
+
/*
- * No, a LI should never occur directly within another LI,
- * but this may result from incomplete error recovery.
- * So check one more surrounding level in this case. - kw
+ * No, a LI should never occur directly within another LI, but this
+ * may result from incomplete error recovery. So check one more
+ * surrounding level in this case. - kw
*/
if (surrounding_tag_number == HTML_LI &&
me->sp < (me->stack + MAX_NESTING - 1))
@@ -2700,7 +2680,7 @@ PRIVATE int HTML_start_element ARGS6(
me->Last_OL_Count = seqnum;
me->Last_OL_Type = seqtype;
/*
- * Hack, because there is no append string!
+ * Hack, because there is no append string!
*/
for (i = 0; number_string[i] != '\0'; i++)
if (number_string[i] == ' ')
@@ -2709,23 +2689,22 @@ PRIVATE int HTML_start_element ARGS6(
HTML_put_character(me, number_string[i]);
/*
- * Use HTML_put_character so that any other spaces
- * coming through will be collapsed. We'll use
- * nbsp, so it won't break at the spacing character
- * if there are no spaces in the subsequent text up
- * to the right margin, but will declare it as a
- * normal space to ensure collapsing if a normal
- * space does immediately follow it. - FM
+ * Use HTML_put_character so that any other spaces coming
+ * through will be collapsed. We'll use nbsp, so it won't
+ * break at the spacing character if there are no spaces in the
+ * subsequent text up to the right margin, but will declare it
+ * as a normal space to ensure collapsing if a normal space
+ * does immediately follow it. - FM
*/
HTML_put_character(me, HT_NON_BREAK_SPACE);
HText_setLastChar(me->text, ' ');
} else if (surrounding_tag_number == HTML_UL) {
/*
- * Hack, because there is no append string!
+ * Hack, because there is no append string!
*/
HTML_put_character(me, HT_NON_BREAK_SPACE);
HTML_put_character(me, HT_NON_BREAK_SPACE);
- switch(me->List_Nesting_Level % 7) {
+ switch (me->List_Nesting_Level % 7) {
case 0:
HTML_put_character(me, '*');
break;
@@ -2750,19 +2729,18 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Keep using HTML_put_character so that any other
- * spaces coming through will be collapsed. We use
- * nbsp, so we won't wrap at the spacing character
- * if there are no spaces in the subsequent text up
- * to the right margin, but will declare it as a
- * normal space to ensure collapsing if a normal
- * space does immediately follow it. - FM
+ * Keep using HTML_put_character so that any other spaces
+ * coming through will be collapsed. We use nbsp, so we won't
+ * wrap at the spacing character if there are no spaces in the
+ * subsequent text up to the right margin, but will declare it
+ * as a normal space to ensure collapsing if a normal space
+ * does immediately follow it. - FM
*/
HTML_put_character(me, HT_NON_BREAK_SPACE);
HText_setLastChar(me->text, ' ');
} else {
/*
- * Hack, because there is no append string!
+ * Hack, because there is no append string!
*/
HTML_put_character(me, HT_NON_BREAK_SPACE);
HTML_put_character(me, HT_NON_BREAK_SPACE);
@@ -2777,18 +2755,18 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_SPAN:
CHECK_ID(HTML_GEN_ID);
/*
- * Should check LANG and/or DIR attributes, and the
- * me->node_anchor->charset and/or yet to be added
- * structure elements, and do something here. - FM
+ * Should check LANG and/or DIR attributes, and the
+ * me->node_anchor->charset and/or yet to be added structure elements,
+ * and do something here. - FM
*/
break;
case HTML_BDO:
CHECK_ID(HTML_GEN_ID);
/*
- * Should check DIR (and LANG) attributes, and the
- * me->node_anchor->charset and/or yet to be added
- * structure elements, and do something here. - FM
+ * Should check DIR (and LANG) attributes, and the
+ * me->node_anchor->charset and/or yet to be added structure elements,
+ * and do something here. - FM
*/
break;
@@ -2809,22 +2787,21 @@ PRIVATE int HTML_start_element ARGS6(
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
HTML_put_character(me, ' ');
CAN_JUSTIFY_START
- me->inLABEL = TRUE;
+ me->inLABEL = TRUE;
me->in_word = NO;
me->inP = FALSE;
break;
case HTML_A:
- /*
- * If we are looking for client-side image maps,
- * then handle an A within a MAP that has a COORDS
- * attribute as an AREA tag. Unfortunately we lose
- * the anchor text this way for the LYNXIMGMAP, we
- * would have to do much more parsing to collect it.
- * After potentially handling the A as AREA, always return
- * immediately if only looking for image maps, without
- * pushing anything on the style stack. - kw
- */
+ /*
+ * If we are looking for client-side image maps, then handle an A
+ * within a MAP that has a COORDS attribute as an AREA tag.
+ * Unfortunately we lose the anchor text this way for the LYNXIMGMAP,
+ * we would have to do much more parsing to collect it. After
+ * potentially handling the A as AREA, always return immediately if
+ * only looking for image maps, without pushing anything on the style
+ * stack. - kw
+ */
if (me->map_address && present && present[HTML_A_COORDS])
LYStartArea(me,
present[HTML_A_HREF] ? value[HTML_A_HREF] : NULL,
@@ -2835,37 +2812,36 @@ PRIVATE int HTML_start_element ARGS6(
return HT_OK;
}
/*
- * A may have been declared SGML_EMPTY in HTMLDTD.c, and
- * SGML_character() in SGML.c may check for an A end
- * tag to call HTML_end_element() directly (with a
- * check in that to bypass decrementing of the HTML
- * parser's stack), so if we have an open A, close
- * that one now. - FM & kw
+ * A may have been declared SGML_EMPTY in HTMLDTD.c, and
+ * SGML_character() in SGML.c may check for an A end tag to call
+ * HTML_end_element() directly (with a check in that to bypass
+ * decrementing of the HTML parser's stack), so if we have an open A,
+ * close that one now. - FM & kw
*/
if (me->inA) {
SET_SKIP_STACK(HTML_A);
HTML_end_element(me, HTML_A, include);
}
/*
- * Set to know we are in an anchor.
+ * Set to know we are in an anchor.
*/
me->inA = TRUE;
/*
- * Load id_string if we have an ID or NAME. - FM
+ * Load id_string if we have an ID or NAME. - FM
*/
if (present && present[HTML_A_ID] &&
- value[HTML_A_ID] && *value[HTML_A_ID]) {
+ non_empty(value[HTML_A_ID])) {
StrAllocCopy(id_string, value[HTML_A_ID]);
} else if (present && present[HTML_A_NAME] &&
- value[HTML_A_NAME] && *value[HTML_A_NAME]) {
+ non_empty(value[HTML_A_NAME])) {
StrAllocCopy(id_string, value[HTML_A_NAME]);
}
if (id_string)
TRANSLATE_AND_UNESCAPE_TO_STD(&id_string);
/*
- * Handle the reference. - FM
+ * Handle the reference. - FM
*/
if (present && present[HTML_A_HREF]) {
/*
@@ -2873,10 +2849,11 @@ PRIVATE int HTML_start_element ARGS6(
*/
me->inBoldA = TRUE;
- StrAllocCopy(href, value[HTML_A_HREF]);
- if (isEmpty(href))
+ if (isEmpty(value[HTML_A_HREF]))
StrAllocCopy(href, "#");
- CHECK_FOR_INTERN(intern_flag,href); /* '#'*/
+ else
+ StrAllocCopy(href, value[HTML_A_HREF]);
+ CHECK_FOR_INTERN(intern_flag, href); /* '#' */
if (intern_flag) { /*** FAST WAY: ***/
TRANSLATE_AND_UNESCAPE_TO_STD(&href);
@@ -2888,14 +2865,13 @@ PRIVATE int HTML_start_element ARGS6(
* Deal with our ftp gateway kludge. - FM
*/
if (!url_type && !strncmp(href, "/foo/..", 7) &&
- (isFTP_URL(me->node_anchor->address) ||
- isFILE_URL(me->node_anchor->address))) {
- for (i = 0; (href[i] = href[i+7]) != 0; i++)
- ;
+ (isFTP_URL(me->node_anchor->address) ||
+ isFILE_URL(me->node_anchor->address))) {
+ for (i = 0; (href[i] = href[i + 7]) != 0; i++) ;
}
}
- if (present[HTML_A_ISMAP]) /*???*/
+ if (present[HTML_A_ISMAP]) /*??? */
intern_flag = FALSE;
} else {
if (bold_name_anchors == TRUE) {
@@ -2911,27 +2887,28 @@ PRIVATE int HTML_start_element ARGS6(
!LYIsUIPage3(me->node_anchor->address, UIP_ADDRLIST_PAGE, 0) &&
!isLYNXIMGMAP(me->node_anchor->address)) {
/* Some kind of spoof?
- ** Found TYPE="internal link" but not in a valid context
- ** where we have written it. - kw
- */
+ * Found TYPE="internal link" but not in a valid context
+ * where we have written it. - kw
+ */
CTRACE((tfp, "HTML: Found invalid HREF=\"%s\" TYPE=\"%s\"!\n",
- href, temp));
+ href, temp));
FREE(temp);
}
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- id_string, /* Tag */
- href, /* Address */
- temp ?
- (HTLinkType*)HTAtom_for(temp) : INTERN_LT); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ id_string, /* Tag */
+ href, /* Address */
+ (temp
+ ? (HTLinkType *)
+ HTAtom_for(temp)
+ : INTERN_LT)); /* Type */
FREE(temp);
FREE(id_string);
if (me->CurrentA && present) {
if (present[HTML_A_TITLE] &&
- value[HTML_A_TITLE] && *value[HTML_A_TITLE] != '\0') {
+ non_empty(value[HTML_A_TITLE])) {
StrAllocCopy(title, value[HTML_A_TITLE]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&title, TRUE, FALSE);
LYTrimHead(title);
@@ -2943,23 +2920,22 @@ PRIVATE int HTML_start_element ARGS6(
if (present[HTML_A_ISMAP])
dest_ismap = TRUE;
if (present[HTML_A_CHARSET] &&
- value[HTML_A_CHARSET] && *value[HTML_A_CHARSET] != '\0') {
+ non_empty(value[HTML_A_CHARSET])) {
/*
- ** Set up to load the anchor's chartrans structures
- ** appropriately for the current display character
- ** set if it can handle what's claimed. - FM
- */
+ * Set up to load the anchor's chartrans structures
+ * appropriately for the current display character set if it
+ * can handle what's claimed. - FM
+ */
StrAllocCopy(temp, value[HTML_A_CHARSET]);
TRANSLATE_AND_UNESCAPE_TO_STD(&temp);
dest_char_set = UCGetLYhndl_byMIME(temp);
if (dest_char_set < 0) {
- dest_char_set = UCLYhndl_for_unrec;
+ dest_char_set = UCLYhndl_for_unrec;
}
}
if (title != NULL || dest_ismap == TRUE || dest_char_set >= 0) {
- dest = HTAnchor_parent(
- HTAnchor_followLink(me->CurrentA)
- );
+ dest = HTAnchor_parent(HTAnchor_followLink(me->CurrentA)
+ );
}
if (dest && title != NULL && HTAnchor_title(dest) == NULL)
HTAnchor_setTitle(dest, title);
@@ -2969,11 +2945,10 @@ PRIVATE int HTML_start_element ARGS6(
charset assumption. - kw */
if (dest && dest != me->node_anchor && dest_char_set >= 0) {
/*
- ** Load the anchor's chartrans structures.
- ** This should be done more intelligently
- ** when setting up the structured object,
- ** but it gets the job done for now. - FM
- */
+ * Load the anchor's chartrans structures. This should be done
+ * more intelligently when setting up the structured object,
+ * but it gets the job done for now. - FM
+ */
HTAnchor_setUCInfoStage(dest, dest_char_set,
UCT_STAGE_MIME,
UCT_SETBY_DEFAULT);
@@ -2992,9 +2967,9 @@ PRIVATE int HTML_start_element ARGS6(
HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
#if defined(NOTUSED_FOTEMODS)
/*
- * Close an HREF-less NAMED-ed now if we aren't making their
- * content bold, and let the check in HTML_end_element() deal
- * with any dangling end tag this creates. - FM
+ * Close an HREF-less NAMED-ed now if we aren't making their content
+ * bold, and let the check in HTML_end_element() deal with any dangling
+ * end tag this creates. - FM
*/
if (href == NULL && me->inBoldA == FALSE) {
SET_SKIP_STACK(HTML_A);
@@ -3002,7 +2977,7 @@ PRIVATE int HTML_start_element ARGS6(
}
#else
/*Close an HREF-less NAMED-ed now if force_empty_hrefless_a was
- requested - VH*/
+ requested - VH */
if (href == NULL && force_empty_hrefless_a) {
SET_SKIP_STACK(HTML_A);
HTML_end_element(me, HTML_A, include);
@@ -3011,42 +2986,40 @@ PRIVATE int HTML_start_element ARGS6(
FREE(href);
break;
- case HTML_IMG: /* Images */
+ case HTML_IMG: /* Images */
/*
- * If we're in an anchor, get the destination, and if it's a
- * clickable image for the current anchor, set our flags for
- * faking a 0,0 coordinate pair, which typically returns the
- * image's default. - FM
+ * If we're in an anchor, get the destination, and if it's a clickable
+ * image for the current anchor, set our flags for faking a 0,0
+ * coordinate pair, which typically returns the image's default. - FM
*/
if (me->inA && me->CurrentA) {
- if ((dest = HTAnchor_parent(
- HTAnchor_followLink(me->CurrentA)
- )) != NULL) {
+ if ((dest = HTAnchor_parent(HTAnchor_followLink(me->CurrentA)
+ )) != NULL) {
if (dest->isISMAPScript == TRUE) {
dest_ismap = TRUE;
CTRACE((tfp, "HTML: '%s' is an ISMAP script\n",
- dest->address));
+ dest->address));
} else if (present && present[HTML_IMG_ISMAP]) {
dest_ismap = TRUE;
dest->isISMAPScript = TRUE;
CTRACE((tfp, "HTML: Designating '%s' as an ISMAP script\n",
- dest->address));
+ dest->address));
}
}
}
intern_flag = FALSE; /* unless set below - kw */
/*
- * If there's a USEMAP, resolve it. - FM
+ * If there's a USEMAP, resolve it. - FM
*/
if (present && present[HTML_IMG_USEMAP] &&
- value[HTML_IMG_USEMAP] && *value[HTML_IMG_USEMAP]) {
+ non_empty(value[HTML_IMG_USEMAP])) {
StrAllocCopy(map_href, value[HTML_IMG_USEMAP]);
- CHECK_FOR_INTERN(intern_flag,map_href);
+ CHECK_FOR_INTERN(intern_flag, map_href);
url_type = LYLegitimizeHREF(me, &map_href, TRUE, TRUE);
/*
- * If map_href ended up zero-length or otherwise doesn't
- * have a hash, it can't be valid, so ignore it. - FM
+ * If map_href ended up zero-length or otherwise doesn't have a
+ * hash, it can't be valid, so ignore it. - FM
*/
if (findPoundSelector(map_href) == NULL) {
FREE(map_href);
@@ -3054,26 +3027,26 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Handle a MAP reference if we have one at this point. - FM
+ * Handle a MAP reference if we have one at this point. - FM
*/
if (map_href) {
/*
- * If the MAP reference doesn't yet begin with a scheme,
- * check whether a base tag is in effect. - FM
+ * If the MAP reference doesn't yet begin with a scheme, check
+ * whether a base tag is in effect. - FM
*/
- /*
- * If the
- * USEMAP value is a lone fragment and LYSeekFragMAPinCur
- * is set, we'll use the current document's URL for
- * resolving. Otherwise use the BASE. - kw
- */
- Base = (me->inBASE &&
- !(*map_href == '#' && LYSeekFragMAPinCur == TRUE)) ?
- me->base_href : me->node_anchor->address;
+ /*
+ * If the USEMAP value is a lone fragment and LYSeekFragMAPinCur is
+ * set, we'll use the current document's URL for resolving.
+ * Otherwise use the BASE. - kw
+ */
+ Base = ((me->inBASE &&
+ !(*map_href == '#' && LYSeekFragMAPinCur == TRUE))
+ ? me->base_href
+ : me->node_anchor->address);
HTParseALL(&map_href, Base);
/*
- * Prepend our client-side MAP access field. - FM
+ * Prepend our client-side MAP access field. - FM
*/
StrAllocCopy(temp, STR_LYNXIMGMAP);
StrAllocCat(temp, map_href);
@@ -3082,8 +3055,8 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Check whether we want to suppress the server-side
- * ISMAP link if a client-side MAP is present. - FM
+ * Check whether we want to suppress the server-side ISMAP link if a
+ * client-side MAP is present. - FM
*/
if (LYNoISMAPifUSEMAP && map_href && dest_ismap) {
dest_ismap = FALSE;
@@ -3091,10 +3064,10 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Check for a TITLE attribute. - FM
+ * Check for a TITLE attribute. - FM
*/
if (present && present[HTML_IMG_TITLE] &&
- value[HTML_IMG_TITLE] && *value[HTML_IMG_TITLE]) {
+ non_empty(value[HTML_IMG_TITLE])) {
StrAllocCopy(title, value[HTML_IMG_TITLE]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&title, TRUE, FALSE);
LYTrimHead(title);
@@ -3105,9 +3078,9 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * If there's an ALT string, use it, unless the ALT string
- * is zero-length or just spaces and we are making all SRCs
- * links or have a USEMAP link. - FM
+ * If there's an ALT string, use it, unless the ALT string is
+ * zero-length or just spaces and we are making all SRCs links or have
+ * a USEMAP link. - FM
*/
if (((present) &&
(present[HTML_IMG_ALT] && value[HTML_IMG_ALT])) &&
@@ -3118,8 +3091,8 @@ PRIVATE int HTML_start_element ARGS6(
TRANSLATE_AND_UNESCAPE_ENTITIES(&alt_string,
me->UsePlainSpace, me->HiddenValue);
/*
- * If it's all spaces and we are making SRC or
- * USEMAP links, treat it as zero-length. - FM
+ * If it's all spaces and we are making SRC or USEMAP links, treat
+ * it as zero-length. - FM
*/
if (clickable_images || map_href) {
LYTrimHead(alt_string);
@@ -3127,71 +3100,76 @@ PRIVATE int HTML_start_element ARGS6(
if (*alt_string == '\0') {
if (map_href) {
StrAllocCopy(alt_string, (title ? title :
- (temp = MakeNewMapValue(value,"USEMAP"))));
+ (temp = MakeNewMapValue(value,
+ "USEMAP"))));
FREE(temp);
} else if (dest_ismap) {
StrAllocCopy(alt_string, (title ? title :
- (temp = MakeNewMapValue(value,"ISMAP"))));
+ (temp = MakeNewMapValue(value,
+ "ISMAP"))));
FREE(temp);
} else if (me->inA == TRUE && dest) {
StrAllocCopy(alt_string, (title ?
title :
- VERBOSE_IMG(value, HTML_IMG_SRC, "[LINK]")));
+ VERBOSE_IMG(value, HTML_IMG_SRC,
+ "[LINK]")));
} else {
StrAllocCopy(alt_string,
- (title ? title :
- ((present &&
- present[HTML_IMG_ISOBJECT]) ?
- "(OBJECT)" :
- VERBOSE_IMG(value, HTML_IMG_SRC, "[INLINE]"))));
+ (title ? title :
+ ((present &&
+ present[HTML_IMG_ISOBJECT]) ?
+ "(OBJECT)" :
+ VERBOSE_IMG(value, HTML_IMG_SRC,
+ "[INLINE]"))));
}
}
}
} else if (map_href) {
StrAllocCopy(alt_string, (title ? title :
- (temp = MakeNewMapValue(value,"USEMAP"))));
+ (temp = MakeNewMapValue(value, "USEMAP"))));
FREE(temp);
} else if ((dest_ismap == TRUE) ||
(me->inA && present && present[HTML_IMG_ISMAP])) {
StrAllocCopy(alt_string, (title ? title :
- (temp = MakeNewMapValue(value,"ISMAP"))));
+ (temp = MakeNewMapValue(value, "ISMAP"))));
FREE(temp);
} else if (me->inA == TRUE && dest) {
StrAllocCopy(alt_string, (title ?
title :
- VERBOSE_IMG(value, HTML_IMG_SRC, "[LINK]")));
+ VERBOSE_IMG(value, HTML_IMG_SRC,
+ "[LINK]")));
} else {
if (pseudo_inline_alts || clickable_images)
StrAllocCopy(alt_string, (title ? title :
- ((present &&
- present[HTML_IMG_ISOBJECT]) ?
- "(OBJECT)" :
- VERBOSE_IMG(value, HTML_IMG_SRC, "[INLINE]"))));
+ ((present &&
+ present[HTML_IMG_ISOBJECT]) ?
+ "(OBJECT)" :
+ VERBOSE_IMG(value, HTML_IMG_SRC,
+ "[INLINE]"))));
else
- StrAllocCopy(alt_string, (title ?
- title : ""));
+ StrAllocCopy(alt_string, NonNull(title));
}
if (*alt_string == '\0' && map_href) {
- StrAllocCopy(alt_string, (temp = MakeNewMapValue(value,"USEMAP")));
+ StrAllocCopy(alt_string, (temp = MakeNewMapValue(value, "USEMAP")));
FREE(temp);
}
CTRACE((tfp, "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n",
- map_href ? 1 : 0,
- (dest_ismap == TRUE) ? 1 : 0,
- me->inA, me->inP));
+ map_href ? 1 : 0,
+ (dest_ismap == TRUE) ? 1 : 0,
+ me->inA, me->inP));
/*
- * Check for an ID attribute. - FM
+ * Check for an ID attribute. - FM
*/
if (present && present[HTML_IMG_ID] &&
- value[HTML_IMG_ID] && *value[HTML_IMG_ID]) {
+ non_empty(value[HTML_IMG_ID])) {
StrAllocCopy(id_string, value[HTML_IMG_ID]);
TRANSLATE_AND_UNESCAPE_TO_STD(&id_string);
if (*id_string == '\0') {
@@ -3200,28 +3178,29 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Create links to the SRC for all images, if desired. - FM
+ * Create links to the SRC for all images, if desired. - FM
*/
if (clickable_images &&
present && present[HTML_IMG_SRC] &&
- value[HTML_IMG_SRC] && *value[HTML_IMG_SRC]) {
+ non_empty(value[HTML_IMG_SRC])) {
StrAllocCopy(href, value[HTML_IMG_SRC]);
LYLegitimizeHREF(me, &href, TRUE, TRUE);
/*
- * If it's an ISMAP and/or USEMAP, or graphic for an
- * anchor, end that anchor and start one for the SRC. - FM
+ * If it's an ISMAP and/or USEMAP, or graphic for an anchor, end
+ * that anchor and start one for the SRC. - FM
*/
if (me->inA) {
/*
- * If we have a USEMAP, end this anchor and
- * start a new one for the client-side MAP. - FM
+ * If we have a USEMAP, end this anchor and start a new one for
+ * the client-side MAP. - FM
*/
if (map_href) {
if (dest_ismap) {
HTML_put_character(me, ' ');
me->in_word = NO;
- HTML_put_string(me, (temp = MakeNewMapValue(value,"ISMAP")));
+ HTML_put_string(me,
+ (temp = MakeNewMapValue(value, "ISMAP")));
FREE(temp);
} else if (dest) {
HTML_put_character(me, ' ');
@@ -3237,24 +3216,21 @@ PRIVATE int HTML_start_element ARGS6(
if (dest_ismap || dest)
HTML_put_character(me, '-');
if (id_string) {
- if ((ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- id_string, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0)) != NULL) { /* Type */
+ if ((ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ id_string, /* Tag */
+ NULL, /* Addresss */
+ 0)) != NULL) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
}
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- map_href, /* Addresss */
- INTERN_LT); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ map_href, /* Addresss */
+ INTERN_LT); /* Type */
if (me->CurrentA && title) {
- if ((dest = HTAnchor_parent(
- HTAnchor_followLink(me->CurrentA)
- )) != NULL) {
+ if ((dest = HTAnchor_parent(HTAnchor_followLink(me->CurrentA)
+ )) != NULL) {
if (!HTAnchor_title(dest))
HTAnchor_setTitle(dest, title);
}
@@ -3267,7 +3243,7 @@ PRIVATE int HTML_start_element ARGS6(
}
me->inBoldA = TRUE;
} else {
- HTML_put_character(me, ' ');/* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
}
HTML_put_string(me, alt_string);
@@ -3282,41 +3258,37 @@ PRIVATE int HTML_start_element ARGS6(
StrAllocCopy(alt_string,
((present &&
present[HTML_IMG_ISOBJECT]) ?
- ((map_href || dest_ismap) ?
- "(IMAGE)" : "(OBJECT)") :
- VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]")));
+ ((map_href || dest_ismap) ?
+ "(IMAGE)" : "(OBJECT)") :
+ VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]")));
if (id_string && !map_href) {
- if ((ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- id_string, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0)) != NULL) { /* Type */
+ if ((ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ id_string, /* Tag */
+ NULL, /* Addresss */
+ 0)) != NULL) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
}
}
} else if (map_href) {
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
if (id_string) {
- if ((ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- id_string, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0)) != NULL) { /* Type */
+ if ((ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ id_string, /* Tag */
+ NULL, /* Addresss */
+ 0)) != NULL) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
}
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- map_href, /* Addresss */
- INTERN_LT); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ map_href, /* Addresss */
+ INTERN_LT); /* Type */
if (me->CurrentA && title) {
- if ((dest = HTAnchor_parent(
- HTAnchor_followLink(me->CurrentA)
- )) != NULL) {
+ if ((dest = HTAnchor_parent(HTAnchor_followLink(me->CurrentA)
+ )) != NULL) {
if (!HTAnchor_title(dest))
HTAnchor_setTitle(dest, title);
}
@@ -3339,17 +3311,16 @@ PRIVATE int HTML_start_element ARGS6(
StrAllocCopy(alt_string,
((present &&
present[HTML_IMG_ISOBJECT]) ?
- "(IMAGE)" :
- VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]")));
+ "(IMAGE)" :
+ VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]")));
} else {
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
if (id_string) {
- if ((ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- id_string, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0)) != NULL) { /* Type */
+ if ((ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ id_string, /* Tag */
+ NULL, /* Addresss */
+ 0)) != NULL) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
}
@@ -3357,13 +3328,12 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Create the link to the SRC. - FM
+ * Create the link to the SRC. - FM
*/
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
FREE(href);
me->CurrentANum = HText_beginAnchor(me->text,
me->inUnderline,
@@ -3376,26 +3346,26 @@ PRIVATE int HTML_start_element ARGS6(
HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
HText_endAnchor(me->text, me->CurrentANum);
me->CurrentANum = 0;
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
} else {
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
me->inBoldA = TRUE;
}
} else if (map_href) {
if (me->inA) {
/*
- * We're in an anchor and have a USEMAP, so end the anchor
- * and start a new one for the client-side MAP. - FM
+ * We're in an anchor and have a USEMAP, so end the anchor and
+ * start a new one for the client-side MAP. - FM
*/
if (dest_ismap) {
- HTML_put_character(me, ' ');/* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
- HTML_put_string(me, (temp = MakeNewMapValue(value,"ISMAP")));
+ HTML_put_string(me, (temp = MakeNewMapValue(value, "ISMAP")));
FREE(temp);
} else if (dest) {
- HTML_put_character(me, ' ');/* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
HTML_put_string(me, "[LINK]");
}
@@ -3412,15 +3382,13 @@ PRIVATE int HTML_start_element ARGS6(
HTML_put_character(me, ' ');
me->in_word = NO;
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- map_href, /* Addresss */
- INTERN_LT); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ map_href, /* Addresss */
+ INTERN_LT); /* Type */
if (me->CurrentA && title) {
- if ((dest = HTAnchor_parent(
- HTAnchor_followLink(me->CurrentA)
- )) != NULL) {
+ if ((dest = HTAnchor_parent(HTAnchor_followLink(me->CurrentA)
+ )) != NULL) {
if (!HTAnchor_title(dest))
HTAnchor_setTitle(dest, title);
}
@@ -3443,24 +3411,22 @@ PRIVATE int HTML_start_element ARGS6(
}
} else {
/*
- * Just put in the ALT or pseudo-ALT string
- * for the current anchor or inline, with an
- * ID link if indicated. - FM
+ * Just put in the ALT or pseudo-ALT string for the current anchor
+ * or inline, with an ID link if indicated. - FM
*/
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
if (id_string) {
- if ((ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- id_string, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0)) != NULL) { /* Type */
+ if ((ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ id_string, /* Tag */
+ NULL, /* Addresss */
+ (HTLinkType *) 0)) != NULL) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
}
}
HTML_put_string(me, alt_string);
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
}
FREE(map_href);
@@ -3474,13 +3440,13 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_MAP:
/*
- * Load id_string if we have a NAME or ID. - FM
+ * Load id_string if we have a NAME or ID. - FM
*/
if (present && present[HTML_MAP_NAME] &&
- value[HTML_MAP_NAME] && *value[HTML_MAP_NAME]) {
+ non_empty(value[HTML_MAP_NAME])) {
StrAllocCopy(id_string, value[HTML_MAP_NAME]);
} else if (present && present[HTML_MAP_ID] &&
- value[HTML_MAP_ID] && *value[HTML_MAP_ID]) {
+ non_empty(value[HTML_MAP_ID])) {
StrAllocCopy(id_string, value[HTML_MAP_ID]);
}
if (id_string) {
@@ -3491,26 +3457,24 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Generate a target anchor in this place in the containing
- * document. MAP can now contain block markup, if it doesn't
- * contain any AREAs (or A anchors with COORDS converted to AREAs)
- * the current location can be used as a fallback for following
- * a USEMAP link. - kw
+ * Generate a target anchor in this place in the containing document.
+ * MAP can now contain block markup, if it doesn't contain any AREAs
+ * (or A anchors with COORDS converted to AREAs) the current location
+ * can be used as a fallback for following a USEMAP link. - kw
*/
- if (!LYMapsOnly)
- LYHandleID(me, id_string);
+ if (!LYMapsOnly)
+ LYHandleID(me, id_string);
/*
- * Load map_address. - FM
+ * Load map_address. - FM
*/
if (id_string) {
/*
- * The MAP must be in the current stream, even if it
- * had a BASE tag, so we'll use its address here, but
- * still use the BASE, if present, when resolving the
- * AREA elements in it's content, unless the AREA's
- * HREF is a lone fragment and LYSeekFragAREAinCur is
- * set. - FM && KW
+ * The MAP must be in the current stream, even if it had a BASE
+ * tag, so we'll use its address here, but still use the BASE, if
+ * present, when resolving the AREA elements in it's content,
+ * unless the AREA's HREF is a lone fragment and
+ * LYSeekFragAREAinCur is set. - FM && KW
*/
StrAllocCopy(me->map_address, me->node_anchor->address);
if ((cp = strchr(me->map_address, '#')) != NULL)
@@ -3519,7 +3483,7 @@ PRIVATE int HTML_start_element ARGS6(
StrAllocCat(me->map_address, id_string);
FREE(id_string);
if (present && present[HTML_MAP_TITLE] &&
- value[HTML_MAP_TITLE] && *value[HTML_MAP_TITLE] != '\0') {
+ non_empty(value[HTML_MAP_TITLE])) {
StrAllocCopy(title, value[HTML_MAP_TITLE]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&title, TRUE, FALSE);
LYTrimHead(title);
@@ -3536,36 +3500,36 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_AREA:
if (me->map_address &&
present && present[HTML_AREA_HREF] &&
- value[HTML_AREA_HREF] && *value[HTML_AREA_HREF]) {
+ non_empty(value[HTML_AREA_HREF])) {
/*
- * Resolve the HREF. - FM
+ * Resolve the HREF. - FM
*/
StrAllocCopy(href, value[HTML_AREA_HREF]);
- CHECK_FOR_INTERN(intern_flag,href);
+ CHECK_FOR_INTERN(intern_flag, href);
url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
/*
- * Check whether a BASE tag is in effect, and use it
- * for resolving, even though we used this stream's
- * address for locating the MAP itself, unless the
- * HREF is a lone fragment and LYSeekFragAREAinCur
- * is set. - FM
+ * Check whether a BASE tag is in effect, and use it for resolving,
+ * even though we used this stream's address for locating the MAP
+ * itself, unless the HREF is a lone fragment and
+ * LYSeekFragAREAinCur is set. - FM
*/
- Base = ((me->inBASE && *href != '\0') &&
- !(*href == '#' && LYSeekFragAREAinCur == TRUE)) ?
- me->base_href : me->node_anchor->address;
+ Base = (((me->inBASE && *href != '\0') &&
+ !(*href == '#' && LYSeekFragAREAinCur == TRUE))
+ ? me->base_href
+ : me->node_anchor->address);
HTParseALL(&href, Base);
/*
- * Check for an ALT. - FM
+ * Check for an ALT. - FM
*/
if (present[HTML_AREA_ALT] &&
- value[HTML_AREA_ALT] && *value[HTML_AREA_ALT]) {
+ non_empty(value[HTML_AREA_ALT])) {
StrAllocCopy(alt_string, value[HTML_AREA_ALT]);
} else if (present[HTML_AREA_TITLE] &&
- value[HTML_AREA_TITLE] && *value[HTML_AREA_TITLE]) {
+ non_empty(value[HTML_AREA_TITLE])) {
/*
- * Use the TITLE as an ALT. - FM
+ * Use the TITLE as an ALT. - FM
*/
StrAllocCopy(alt_string, value[HTML_AREA_TITLE]);
}
@@ -3574,7 +3538,7 @@ PRIVATE int HTML_start_element ARGS6(
me->UsePlainSpace,
me->HiddenValue);
/*
- * Make sure it's not just space(s). - FM
+ * Make sure it's not just space(s). - FM
*/
LYTrimHead(alt_string);
LYTrimTail(alt_string);
@@ -3583,7 +3547,7 @@ PRIVATE int HTML_start_element ARGS6(
}
} else {
/*
- * Use the HREF as an ALT. - FM
+ * Use the HREF as an ALT. - FM
*/
StrAllocCopy(alt_string, href);
}
@@ -3597,25 +3561,24 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_PARAM:
/*
- * We may need to look at this someday to deal with
- * MAPs, OBJECTs or APPLETs optimally, but just ignore
- * it for now. - FM
+ * We may need to look at this someday to deal with MAPs, OBJECTs or
+ * APPLETs optimally, but just ignore it for now. - FM
*/
break;
case HTML_BODYTEXT:
CHECK_ID(HTML_BODYTEXT_ID);
/*
- * We may need to look at this someday to deal with
- * OBJECTs optimally, but just ignore it for now. - FM
+ * We may need to look at this someday to deal with OBJECTs optimally,
+ * but just ignore it for now. - FM
*/
break;
case HTML_TEXTFLOW:
CHECK_ID(HTML_BODYTEXT_ID);
/*
- * We may need to look at this someday to deal with
- * APPLETs optimally, but just ignore it for now. - FM
+ * We may need to look at this someday to deal with APPLETs optimally,
+ * but just ignore it for now. - FM
*/
break;
@@ -3638,9 +3601,8 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_OBJECT:
if (!me->object_started) {
/*
- * This is an outer OBJECT start tag,
- * i.e., not a nested OBJECT, so save
- * it's relevant attributes. - FM
+ * This is an outer OBJECT start tag, i.e., not a nested OBJECT, so
+ * save its relevant attributes. - FM
*/
if (present) {
if (present[HTML_OBJECT_DECLARE])
@@ -3650,7 +3612,7 @@ PRIVATE int HTML_start_element ARGS6(
if (present[HTML_OBJECT_ISMAP])
me->object_ismap = TRUE;
if (present[HTML_OBJECT_USEMAP] &&
- value[HTML_OBJECT_USEMAP] && *value[HTML_OBJECT_USEMAP]) {
+ non_empty(value[HTML_OBJECT_USEMAP])) {
StrAllocCopy(me->object_usemap, value[HTML_OBJECT_USEMAP]);
TRANSLATE_AND_UNESCAPE_TO_STD(&me->object_usemap);
if (*me->object_usemap == '\0') {
@@ -3658,7 +3620,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_ID] &&
- value[HTML_OBJECT_ID] && *value[HTML_OBJECT_ID]) {
+ non_empty(value[HTML_OBJECT_ID])) {
StrAllocCopy(me->object_id, value[HTML_OBJECT_ID]);
TRANSLATE_AND_UNESCAPE_TO_STD(&me->object_id);
if (*me->object_id == '\0') {
@@ -3666,7 +3628,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_TITLE] &&
- value[HTML_OBJECT_TITLE] && *value[HTML_OBJECT_TITLE]) {
+ non_empty(value[HTML_OBJECT_TITLE])) {
StrAllocCopy(me->object_title, value[HTML_OBJECT_TITLE]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&me->object_title, TRUE, FALSE);
LYTrimHead(me->object_title);
@@ -3676,7 +3638,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_DATA] &&
- value[HTML_OBJECT_DATA] && *value[HTML_OBJECT_DATA]) {
+ non_empty(value[HTML_OBJECT_DATA])) {
StrAllocCopy(me->object_data, value[HTML_OBJECT_DATA]);
TRANSLATE_AND_UNESCAPE_TO_STD(&me->object_data);
if (*me->object_data == '\0') {
@@ -3684,7 +3646,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_TYPE] &&
- value[HTML_OBJECT_TYPE] && *value[HTML_OBJECT_TYPE]) {
+ non_empty(value[HTML_OBJECT_TYPE])) {
StrAllocCopy(me->object_type, value[HTML_OBJECT_TYPE]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&me->object_type, TRUE, FALSE);
LYTrimHead(me->object_type);
@@ -3694,8 +3656,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_CLASSID] &&
- value[HTML_OBJECT_CLASSID] &&
- *value[HTML_OBJECT_CLASSID]) {
+ non_empty(value[HTML_OBJECT_CLASSID])) {
StrAllocCopy(me->object_classid,
value[HTML_OBJECT_CLASSID]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&me->object_classid, TRUE, FALSE);
@@ -3706,8 +3667,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_CODEBASE] &&
- value[HTML_OBJECT_CODEBASE] &&
- *value[HTML_OBJECT_CODEBASE]) {
+ non_empty(value[HTML_OBJECT_CODEBASE])) {
StrAllocCopy(me->object_codebase,
value[HTML_OBJECT_CODEBASE]);
TRANSLATE_AND_UNESCAPE_TO_STD(&me->object_codebase);
@@ -3716,11 +3676,12 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_CODETYPE] &&
- value[HTML_OBJECT_CODETYPE] &&
- *value[HTML_OBJECT_CODETYPE]) {
+ non_empty(value[HTML_OBJECT_CODETYPE])) {
StrAllocCopy(me->object_codetype,
value[HTML_OBJECT_CODETYPE]);
- TRANSLATE_AND_UNESCAPE_ENTITIES(&me->object_codetype, TRUE, FALSE);
+ TRANSLATE_AND_UNESCAPE_ENTITIES(&me->object_codetype,
+ TRUE,
+ FALSE);
LYTrimHead(me->object_codetype);
LYTrimTail(me->object_codetype);
if (me->object_codetype == '\0') {
@@ -3728,7 +3689,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
if (present[HTML_OBJECT_NAME] &&
- value[HTML_OBJECT_NAME] && *value[HTML_OBJECT_NAME]) {
+ non_empty(value[HTML_OBJECT_NAME])) {
StrAllocCopy(me->object_name, value[HTML_OBJECT_NAME]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&me->object_name, TRUE, FALSE);
LYTrimHead(me->object_name);
@@ -3739,17 +3700,17 @@ PRIVATE int HTML_start_element ARGS6(
}
}
/*
- * If we can determine now that we are not going to do anything
- * special to the OBJECT element's SGML contents, like skipping
- * it completely or collecting it up in order to add something
- * after it, then generate any output that should be emitted in the
- * place of the OBJECT start tag NOW, then don't initialize special
- * handling but return, letting our SGML parser know that further
- * content is to be parsed normally not literally. We could defer
- * this until we have collected the contents and then recycle the
- * contents (as was previously always done), but that has a higher
- * chance of completely losing content in case of nesting errors
- * in the input, incomplete transmissions, etc. - kw
+ * If we can determine now that we are not going to do anything
+ * special to the OBJECT element's SGML contents, like skipping it
+ * completely or collecting it up in order to add something after
+ * it, then generate any output that should be emitted in the place
+ * of the OBJECT start tag NOW, then don't initialize special
+ * handling but return, letting our SGML parser know that further
+ * content is to be parsed normally not literally. We could defer
+ * this until we have collected the contents and then recycle the
+ * contents (as was previously always done), but that has a higher
+ * chance of completely losing content in case of nesting errors in
+ * the input, incomplete transmissions, etc. - kw
*/
if ((!present ||
(me->object_declare == FALSE && me->object_name == NULL &&
@@ -3763,8 +3724,9 @@ PRIVATE int HTML_start_element ARGS6(
FREE(me->object_data);
if (me->object_data) {
HTStartAnchor5(me,
- me->object_id ? value[HTML_OBJECT_ID]
- : NULL,
+ (me->object_id
+ ? value[HTML_OBJECT_ID]
+ : NULL),
value[HTML_OBJECT_DATA],
value[HTML_OBJECT_TYPE],
tag_charset);
@@ -3773,24 +3735,24 @@ PRIVATE int HTML_start_element ARGS6(
HTML_put_string(me, "(IMAGE)");
else
HTML_put_string(me, "(OBJECT)");
- HTML_end_element(me,HTML_A,NULL);
+ HTML_end_element(me, HTML_A, NULL);
} else if (me->object_id)
LYHandleID(me, me->object_id);
}
clear_objectdata(me);
/*
- * We do NOT want the HTML_put_* functions that are going
- * to be called for the OBJECT's character content to
- * add to the chunk, so we don't push on the stack.
- * Instead we keep a counter for open OBJECT tags that
- * are treated this way, so HTML_end_element can skip
- * handling the corresponding end tag that is going to
- * arrive unexpectedly as far as our stack is concerned.
+ * We do NOT want the HTML_put_* functions that are going to be
+ * called for the OBJECT's character content to add to the
+ * chunk, so we don't push on the stack. Instead we keep a
+ * counter for open OBJECT tags that are treated this way, so
+ * HTML_end_element can skip handling the corresponding end tag
+ * that is going to arrive unexpectedly as far as our stack is
+ * concerned.
*/
status = HT_PARSER_OTHER_CONTENT;
if (me->sp[0].tag_number == HTML_FIG &&
me->objects_figged_open > 0) {
- ElementNumber = HTML_OBJECT_M;
+ ElementNumber = (HTMLElement) HTML_OBJECT_M;
} else {
me->objects_mixed_open++;
SET_SKIP_STACK(HTML_OBJECT);
@@ -3798,11 +3760,13 @@ PRIVATE int HTML_start_element ARGS6(
} else if (me->object_declare == FALSE && me->object_name == NULL &&
me->object_shapes == TRUE) {
LYHandleFIG(me, present, value,
- 1,
- 1 || me->object_ismap,
- me->object_id,
- (me->object_data && !me->object_classid) ? value[HTML_OBJECT_DATA] : NULL,
- NO, TRUE, &intern_flag);
+ 1,
+ 1 || me->object_ismap,
+ me->object_id,
+ ((me->object_data && !me->object_classid)
+ ? value[HTML_OBJECT_DATA]
+ : NULL),
+ NO, TRUE, &intern_flag);
clear_objectdata(me);
status = HT_PARSER_OTHER_CONTENT;
me->objects_figged_open++;
@@ -3810,7 +3774,7 @@ PRIVATE int HTML_start_element ARGS6(
} else {
/*
- * Set flag that we are accumulating OBJECT content. - FM
+ * Set flag that we are accumulating OBJECT content. - FM
*/
me->object_started = TRUE;
}
@@ -3820,7 +3784,7 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_OVERLAY:
if (clickable_images && me->inFIG &&
present && present[HTML_OVERLAY_SRC] &&
- value[HTML_OVERLAY_SRC] && *value[HTML_OVERLAY_SRC]) {
+ non_empty(value[HTML_OVERLAY_SRC])) {
StrAllocCopy(href, value[HTML_OVERLAY_SRC]);
LYLegitimizeHREF(me, &href, TRUE, TRUE);
if (*href) {
@@ -3829,11 +3793,10 @@ PRIVATE int HTML_start_element ARGS6(
SET_SKIP_STACK(HTML_A);
HTML_end_element(me, HTML_A, include);
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
HTML_put_character(me, ' ');
HText_appendCharacter(me->text, '+');
me->CurrentANum = HText_beginAnchor(me->text,
@@ -3855,15 +3818,15 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_APPLET:
me->inAPPLET = TRUE;
me->inAPPLETwithP = FALSE;
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
/*
- * Load id_string if we have an ID or NAME. - FM
+ * Load id_string if we have an ID or NAME. - FM
*/
if (present && present[HTML_APPLET_ID] &&
- value[HTML_APPLET_ID] && *value[HTML_APPLET_ID]) {
+ non_empty(value[HTML_APPLET_ID])) {
StrAllocCopy(id_string, value[HTML_APPLET_ID]);
} else if (present && present[HTML_APPLET_NAME] &&
- value[HTML_APPLET_NAME] && *value[HTML_APPLET_NAME]) {
+ non_empty(value[HTML_APPLET_NAME])) {
StrAllocCopy(id_string, value[HTML_APPLET_NAME]);
}
if (id_string) {
@@ -3874,18 +3837,18 @@ PRIVATE int HTML_start_element ARGS6(
me->in_word = NO;
/*
- * If there's an ALT string, use it, unless the ALT string
- * is zero-length and we are making all sources links. - FM
+ * If there's an ALT string, use it, unless the ALT string is
+ * zero-length and we are making all sources links. - FM
*/
if (present && present[HTML_APPLET_ALT] && value[HTML_APPLET_ALT] &&
(!clickable_images ||
(clickable_images && *value[HTML_APPLET_ALT] != '\0'))) {
StrAllocCopy(alt_string, value[HTML_APPLET_ALT]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&alt_string,
- me->UsePlainSpace, me->HiddenValue);
+ me->UsePlainSpace, me->HiddenValue);
/*
- * If it's all spaces and we are making sources links,
- * treat it as zero-length. - FM
+ * If it's all spaces and we are making sources links, treat it as
+ * zero-length. - FM
*/
if (clickable_images) {
LYTrimHead(alt_string);
@@ -3903,25 +3866,25 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * If we're making all sources links, get the source. - FM
+ * If we're making all sources links, get the source. - FM
*/
if (clickable_images && present && present[HTML_APPLET_CODE] &&
- value[HTML_APPLET_CODE] && *value[HTML_APPLET_CODE]) {
- char * base = NULL;
+ non_empty(value[HTML_APPLET_CODE])) {
+ char *base = NULL;
Base = (me->inBASE)
- ? me->base_href
- : me->node_anchor->address;
+ ? me->base_href
+ : me->node_anchor->address;
/*
- * Check for a CODEBASE attribute. - FM
+ * Check for a CODEBASE attribute. - FM
*/
if (present[HTML_APPLET_CODEBASE] &&
- value[HTML_APPLET_CODEBASE] && *value[HTML_APPLET_CODEBASE]) {
+ non_empty(value[HTML_APPLET_CODEBASE])) {
StrAllocCopy(base, value[HTML_APPLET_CODEBASE]);
LYRemoveBlanks(base);
TRANSLATE_AND_UNESCAPE_TO_STD(&base);
/*
- * Force it to be a directory. - FM
+ * Force it to be a directory. - FM
*/
if (*base == '\0')
StrAllocCopy(base, "/");
@@ -3943,11 +3906,10 @@ PRIVATE int HTML_start_element ARGS6(
HText_endAnchor(me->text, me->CurrentANum);
HTML_put_character(me, '-');
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
me->CurrentANum = HText_beginAnchor(me->text,
me->inUnderline,
me->CurrentA);
@@ -3960,16 +3922,16 @@ PRIVATE int HTML_start_element ARGS6(
HText_endAnchor(me->text, me->CurrentANum);
me->CurrentANum = 0;
}
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
}
FREE(href);
} else if (*alt_string) {
/*
- * Just put up the ALT string, if non-zero. - FM
+ * Just put up the ALT string, if non-zero. - FM
*/
HTML_put_string(me, alt_string);
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
}
FREE(alt_string);
@@ -3978,10 +3940,10 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_BGSOUND:
/*
- * If we're making all sources links, get the source. - FM
+ * If we're making all sources links, get the source. - FM
*/
if (clickable_images && present && present[HTML_BGSOUND_SRC] &&
- value[HTML_BGSOUND_SRC] && *value[HTML_BGSOUND_SRC]) {
+ non_empty(value[HTML_BGSOUND_SRC])) {
StrAllocCopy(href, value[HTML_BGSOUND_SRC]);
LYLegitimizeHREF(me, &href, TRUE, TRUE);
if (*href == '\0') {
@@ -3995,14 +3957,13 @@ PRIVATE int HTML_start_element ARGS6(
HText_endAnchor(me->text, me->CurrentANum);
HTML_put_character(me, '-');
} else {
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
me->CurrentANum = HText_beginAnchor(me->text,
me->inUnderline,
me->CurrentA);
@@ -4015,7 +3976,7 @@ PRIVATE int HTML_start_element ARGS6(
HText_endAnchor(me->text, me->CurrentANum);
me->CurrentANum = 0;
}
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
FREE(href);
}
@@ -4023,15 +3984,15 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_EMBED:
if (pseudo_inline_alts || clickable_images)
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
/*
- * Load id_string if we have an ID or NAME. - FM
+ * Load id_string if we have an ID or NAME. - FM
*/
if (present && present[HTML_EMBED_ID] &&
- value[HTML_EMBED_ID] && *value[HTML_EMBED_ID]) {
+ non_empty(value[HTML_EMBED_ID])) {
StrAllocCopy(id_string, value[HTML_EMBED_ID]);
} else if (present && present[HTML_EMBED_NAME] &&
- value[HTML_EMBED_NAME] && *value[HTML_EMBED_NAME]) {
+ non_empty(value[HTML_EMBED_NAME])) {
StrAllocCopy(id_string, value[HTML_EMBED_NAME]);
}
if (id_string) {
@@ -4043,18 +4004,18 @@ PRIVATE int HTML_start_element ARGS6(
me->in_word = NO;
/*
- * If there's an ALT string, use it, unless the ALT string
- * is zero-length and we are making all sources links. - FM
+ * If there's an ALT string, use it, unless the ALT string is
+ * zero-length and we are making all sources links. - FM
*/
if (present && present[HTML_EMBED_ALT] && value[HTML_EMBED_ALT] &&
(!clickable_images ||
(clickable_images && *value[HTML_EMBED_ALT] != '\0'))) {
StrAllocCopy(alt_string, value[HTML_EMBED_ALT]);
TRANSLATE_AND_UNESCAPE_ENTITIES(&alt_string,
- me->UsePlainSpace, me->HiddenValue);
+ me->UsePlainSpace, me->HiddenValue);
/*
- * If it's all spaces and we are making sources links,
- * treat it as zero-length. - FM
+ * If it's all spaces and we are making sources links, treat it as
+ * zero-length. - FM
*/
if (clickable_images) {
LYTrimHead(alt_string);
@@ -4071,10 +4032,10 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * If we're making all sources links, get the source. - FM
+ * If we're making all sources links, get the source. - FM
*/
if (clickable_images && present && present[HTML_EMBED_SRC] &&
- value[HTML_EMBED_SRC] && *value[HTML_EMBED_SRC]) {
+ non_empty(value[HTML_EMBED_SRC])) {
StrAllocCopy(href, value[HTML_EMBED_SRC]);
LYLegitimizeHREF(me, &href, TRUE, TRUE);
if (*href) {
@@ -4084,11 +4045,10 @@ PRIVATE int HTML_start_element ARGS6(
HText_endAnchor(me->text, me->CurrentANum);
HTML_put_character(me, '-');
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
me->CurrentANum = HText_beginAnchor(me->text,
me->inUnderline,
me->CurrentA);
@@ -4109,10 +4069,10 @@ PRIVATE int HTML_start_element ARGS6(
FREE(href);
} else if (*alt_string) {
/*
- * Just put up the ALT string, if non-zero. - FM
+ * Just put up the ALT string, if non-zero. - FM
*/
HTML_put_string(me, alt_string);
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
me->in_word = NO;
}
FREE(alt_string);
@@ -4134,15 +4094,15 @@ PRIVATE int HTML_start_element ARGS6(
if (me->inFIG)
/*
- * Assume all text in the FIG container is intended
- * to be paragraphed. - FM
+ * Assume all text in the FIG container is intended to be
+ * paragraphed. - FM
*/
me->inFIGwithP = TRUE;
if (me->inAPPLET)
/*
- * Assume all text in the APPLET container is intended
- * to be paragraphed. - FM
+ * Assume all text in the APPLET container is intended to be
+ * paragraphed. - FM
*/
me->inAPPLETwithP = TRUE;
@@ -4166,15 +4126,15 @@ PRIVATE int HTML_start_element ARGS6(
if (me->inFIG)
/*
- * Assume all text in the FIG container is intended
- * to be paragraphed. - FM
+ * Assume all text in the FIG container is intended to be
+ * paragraphed. - FM
*/
me->inFIGwithP = TRUE;
if (me->inAPPLET)
/*
- * Assume all text in the APPLET container is intended
- * to be paragraphed. - FM
+ * Assume all text in the APPLET container is intended to be
+ * paragraphed. - FM
*/
me->inAPPLETwithP = TRUE;
@@ -4185,21 +4145,20 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_FORM:
{
- char * action = NULL;
- char * method = NULL;
- char * enctype = NULL;
- CONST char * accept_cs = NULL;
+ char *action = NULL;
+ char *method = NULL;
+ char *enctype = NULL;
+ const char *accept_cs = NULL;
- HTChildAnchor * source;
+ HTChildAnchor *source;
HTAnchor *link_dest;
/*
- * FORM may have been declared SGML_EMPTY in HTMLDTD.c, and
- * SGML_character() in SGML.c may check for a FORM end
- * tag to call HTML_end_element() directly (with a
- * check in that to bypass decrementing of the HTML
- * parser's stack), so if we have an open FORM, close
- * that one now. - FM
+ * FORM may have been declared SGML_EMPTY in HTMLDTD.c, and
+ * SGML_character() in SGML.c may check for a FORM end tag to call
+ * HTML_end_element() directly (with a check in that to bypass
+ * decrementing of the HTML parser's stack), so if we have an open
+ * FORM, close that one now. - FM
*/
if (me->inFORM) {
CTRACE((tfp, "HTML: Missing FORM end tag. Faking it!\n"));
@@ -4208,19 +4167,20 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Set to know we are in a new form.
+ * Set to know we are in a new form.
*/
me->inFORM = TRUE;
EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext = TRUE);
if (present && present[HTML_FORM_ACCEPT_CHARSET]) {
- accept_cs = value[HTML_FORM_ACCEPT_CHARSET] ?
- value[HTML_FORM_ACCEPT_CHARSET] : "UNKNOWN";
+ accept_cs = (value[HTML_FORM_ACCEPT_CHARSET]
+ ? value[HTML_FORM_ACCEPT_CHARSET]
+ : "UNKNOWN");
}
Base = (me->inBASE)
- ? me->base_href
- : me->node_anchor->address;
+ ? me->base_href
+ : me->node_anchor->address;
if (present && present[HTML_FORM_ACTION] &&
value[HTML_FORM_ACTION]) {
@@ -4229,9 +4189,9 @@ PRIVATE int HTML_start_element ARGS6(
LYLegitimizeHREF(me, &action, TRUE, TRUE);
/*
- * Check whether a base tag is in effect. Note that
- * actions always are resolved w.r.t. to the base,
- * even if the action is empty. - FM
+ * Check whether a base tag is in effect. Note that actions
+ * always are resolved w.r.t. to the base, even if the action
+ * is empty. - FM
*/
HTParseALL(&action, Base);
@@ -4240,15 +4200,15 @@ PRIVATE int HTML_start_element ARGS6(
}
source = HTAnchor_findChildAndLink(me->node_anchor,
- NULL,
- action,
- (HTLinkType*)0);
+ NULL,
+ action,
+ (HTLinkType *) 0);
if ((link_dest = HTAnchor_followLink(source)) != NULL) {
/*
- * Memory leak fixed.
- * 05-28-94 Lynx 2-3-1 Garrett Arch Blythe
+ * Memory leak fixed. 05-28-94 Lynx 2-3-1 Garrett Arch Blythe
*/
- char* cp_freeme = HTAnchor_address(link_dest);
+ char *cp_freeme = HTAnchor_address(link_dest);
+
if (cp_freeme != NULL) {
StrAllocCopy(action, cp_freeme);
FREE(cp_freeme);
@@ -4258,30 +4218,29 @@ PRIVATE int HTML_start_element ARGS6(
}
if (present && present[HTML_FORM_METHOD])
- StrAllocCopy(method, value[HTML_FORM_METHOD] ?
- value[HTML_FORM_METHOD] : "GET");
+ StrAllocCopy(method, (value[HTML_FORM_METHOD]
+ ? value[HTML_FORM_METHOD]
+ : "GET"));
if (present && present[HTML_FORM_ENCTYPE] &&
- value[HTML_FORM_ENCTYPE] && *value[HTML_FORM_ENCTYPE]) {
+ non_empty(value[HTML_FORM_ENCTYPE])) {
StrAllocCopy(enctype, value[HTML_FORM_ENCTYPE]);
LYLowerCase(enctype);
}
if (present) {
/*
- * Check for a TITLE attribute, and if none is present,
- * check for a SUBJECT attribute as a synonym. - FM
+ * Check for a TITLE attribute, and if none is present, check
+ * for a SUBJECT attribute as a synonym. - FM
*/
if (present[HTML_FORM_TITLE] &&
- value[HTML_FORM_TITLE] &&
- *value[HTML_FORM_TITLE] != '\0') {
+ non_empty(value[HTML_FORM_TITLE])) {
StrAllocCopy(title, value[HTML_FORM_TITLE]);
} else if (present[HTML_FORM_SUBJECT] &&
- value[HTML_FORM_SUBJECT] &&
- *value[HTML_FORM_SUBJECT] != '\0') {
+ non_empty(value[HTML_FORM_SUBJECT])) {
StrAllocCopy(title, value[HTML_FORM_SUBJECT]);
}
- if (title != NULL && *title != '\0') {
+ if (non_empty(title)) {
TRANSLATE_AND_UNESCAPE_ENTITIES(&title, TRUE, FALSE);
LYTrimHead(title);
LYTrimTail(title);
@@ -4327,11 +4286,25 @@ PRIVATE int HTML_start_element ARGS6(
int chars;
/* init */
- I.align=NULL; I.accept=NULL; I.checked=NO; I.class=NULL;
- I.disabled=NO; I.error=NULL; I.height= NULL; I.id=NULL;
- I.lang=NULL; I.max=NULL; I.maxlength=NULL; I.md=NULL;
- I.min=NULL; I.name=NULL; I.size=0; I.src=NULL;
- I.type=NULL; I.value=NULL; I.width=NULL;
+ I.align = NULL;
+ I.accept = NULL;
+ I.checked = NO;
+ I.iclass = NULL;
+ I.disabled = NO;
+ I.error = NULL;
+ I.height = NULL;
+ I.id = NULL;
+ I.lang = NULL;
+ I.max = NULL;
+ I.maxlength = NULL;
+ I.md = NULL;
+ I.min = NULL;
+ I.name = NULL;
+ I.size = 0;
+ I.src = NULL;
+ I.type = NULL;
+ I.value = NULL;
+ I.width = NULL;
I.accept_cs = NULL;
I.name_cs = ATTR_CS_IN;
I.value_cs = ATTR_CS_IN;
@@ -4342,46 +4315,45 @@ PRIVATE int HTML_start_element ARGS6(
(!strcasecomp(value[HTML_BUTTON_TYPE], "submit") ||
!strcasecomp(value[HTML_BUTTON_TYPE], "reset"))) {
/*
- * It's a button for submitting or resetting a form. - FM
+ * It's a button for submitting or resetting a form. - FM
*/
I.type = value[HTML_BUTTON_TYPE];
} else {
/*
- * Ugh, it's a button for a script. - FM
+ * Ugh, it's a button for a script. - FM
*/
- HTML_put_string(me," [BUTTON] ");
+ HTML_put_string(me, " [BUTTON] ");
break;
}
/*
- * Make sure we're in a form.
+ * Make sure we're in a form.
*/
if (!me->inFORM) {
if (LYBadHTML(me))
CTRACE((tfp,
"Bad HTML: BUTTON tag not within FORM tag\n"));
/*
- * We'll process it, since the chances of a crash are
- * small, and we probably do have a form started. - FM
+ * We'll process it, since the chances of a crash are small,
+ * and we probably do have a form started. - FM
*
- break;
+ break;
*/
}
/*
- * Before any input field, add a collapsible space if
- * we're not in a PRE block, to promote a wrap there
- * for any long values that would extend past the right
- * margin from our current position in the line. If
- * we are in a PRE block, start a new line if the last
- * line already is within 6 characters of the wrap point
- * for PRE blocks. - FM
+ * Before any input field, add a collapsible space if we're not in
+ * a PRE block, to promote a wrap there for any long values that
+ * would extend past the right margin from our current position in
+ * the line. If we are in a PRE block, start a new line if the
+ * last line already is within 6 characters of the wrap point for
+ * PRE blocks. - FM
*/
if (me->sp[0].tag_number != HTML_PRE && !me->inPRE &&
me->sp->style->freeFormat) {
HTML_put_character(me, ' ');
me->in_word = NO;
- } else if (HText_LastLineSize(me->text, FALSE) > (LYcols - 7)) {
+ } else if (HText_LastLineSize(me->text, FALSE) > (LYcolLimit - 6)) {
HTML_put_character(me, '\n');
me->in_word = NO;
}
@@ -4399,93 +4371,82 @@ PRIVATE int HTML_start_element ARGS6(
}
if (present && present[HTML_BUTTON_VALUE] &&
- value[HTML_BUTTON_VALUE] && *value[HTML_BUTTON_VALUE]) {
+ non_empty(value[HTML_BUTTON_VALUE])) {
/*
- * Convert any HTML entities or decimal escaping. - FM
+ * Convert any HTML entities or decimal escaping. - FM
*/
- int len;
-
StrAllocCopy(I_value, value[HTML_BUTTON_VALUE]);
me->UsePlainSpace = TRUE;
TRANSLATE_AND_UNESCAPE_ENTITIES(&I_value, TRUE, me->HiddenValue);
me->UsePlainSpace = FALSE;
I.value = I_value;
/*
- * Convert any newlines or tabs to spaces,
- * and trim any lead or trailing spaces. - FM
+ * Convert any newlines or tabs to spaces, and trim any lead or
+ * trailing spaces. - FM
*/
- convert_to_spaces(I.value, FALSE);
- while (I.value && I.value[0] == ' ')
- I.value++;
- len = strlen(I.value) - 1;
- while (len > 0 && I.value[len] == ' ')
- I.value[len--] = '\0';
+ LYReduceBlanks(I.value);
}
if (present && present[HTML_BUTTON_DISABLED])
I.disabled = YES;
- if (present && present[HTML_BUTTON_CLASS] && /* Not yet used. */
- value[HTML_BUTTON_CLASS] && *value[HTML_BUTTON_CLASS])
- I.class = value[HTML_BUTTON_CLASS];
+ if (present && present[HTML_BUTTON_CLASS] && /* Not yet used. */
+ non_empty(value[HTML_BUTTON_CLASS]))
+ I.iclass = value[HTML_BUTTON_CLASS];
if (present && present[HTML_BUTTON_ID] &&
- value[HTML_BUTTON_ID] && *value[HTML_BUTTON_ID]) {
+ non_empty(value[HTML_BUTTON_ID])) {
I.id = value[HTML_BUTTON_ID];
CHECK_ID(HTML_BUTTON_ID);
}
- if (present && present[HTML_BUTTON_LANG] && /* Not yet used. */
- value[HTML_BUTTON_LANG] && *value[HTML_BUTTON_LANG])
+ if (present && present[HTML_BUTTON_LANG] && /* Not yet used. */
+ non_empty(value[HTML_BUTTON_LANG]))
I.lang = value[HTML_BUTTON_LANG];
chars = HText_beginInput(me->text, me->inUnderline, &I);
/*
- * Submit and reset buttons have values which don't change,
- * so HText_beginInput() sets I.value to the string which
- * should be displayed, and we'll enter that instead of
- * underscore placeholders into the HText structure to
- * see it instead of underscores when dumping or printing.
- * We also won't worry about a wrap in PRE blocks, because
- * the line editor never is invoked for submit or reset
- * buttons. - LE & FM
+ * Submit and reset buttons have values which don't change, so
+ * HText_beginInput() sets I.value to the string which should be
+ * displayed, and we'll enter that instead of underscore
+ * placeholders into the HText structure to see it instead of
+ * underscores when dumping or printing. We also won't worry about
+ * a wrap in PRE blocks, because the line editor never is invoked
+ * for submit or reset buttons. - LE & FM
*/
if (me->sp[0].tag_number == HTML_PRE ||
- !me->sp->style->freeFormat) {
+ !me->sp->style->freeFormat) {
/*
- * We have a submit or reset button in a PRE block,
- * so output the entire value from the markup. If
- * it extends to the right margin, it will wrap
- * there, and only the portion before that wrap will
- * be hightlighted on screen display (Yuk!) but we
- * may as well show the rest of the full value on
- * the next or more lines. - FM
+ * We have a submit or reset button in a PRE block, so output
+ * the entire value from the markup. If it extends to the
+ * right margin, it will wrap there, and only the portion
+ * before that wrap will be hightlighted on screen display
+ * (Yuk!) but we may as well show the rest of the full value on
+ * the next or more lines. - FM
*/
while (I.value[i])
HTML_put_character(me, I.value[i++]);
} else {
/*
- * The submit or reset button is not in a PRE block.
- * Note that if a wrap occurs before outputting the
- * entire value, the wrapped portion will not be
- * highlighted or clearly indicated as part of the
- * link for submission or reset (Yuk!).
- * We'll replace any spaces in the submit or reset
- * button value with nbsp, to promote a wrap at the
- * space we ensured would be present before the start
- * of the string, as when we use all underscores
- * instead of the INPUT's actual value, but we could
- * still get a wrap at the right margin, instead, if
- * the value is greater than a line width for the
- * current style. Also, if chars somehow ended up
- * longer than the length of the actual value
- * (shouldn't have), we'll continue padding with nbsp
- * up to the length of chars. - FM
+ * The submit or reset button is not in a PRE block. Note that
+ * if a wrap occurs before outputting the entire value, the
+ * wrapped portion will not be highlighted or clearly indicated
+ * as part of the link for submission or reset (Yuk!). We'll
+ * replace any spaces in the submit or reset button value with
+ * nbsp, to promote a wrap at the space we ensured would be
+ * present before the start of the string, as when we use all
+ * underscores instead of the INPUT's actual value, but we
+ * could still get a wrap at the right margin, instead, if the
+ * value is greater than a line width for the current style.
+ * Also, if chars somehow ended up longer than the length of
+ * the actual value (shouldn't have), we'll continue padding
+ * with nbsp up to the length of chars. - FM
*/
for (i = 0; I.value[i]; i++) {
HTML_put_character(me,
- (char)(I.value[i] == ' ' ?
- HT_NON_BREAK_SPACE : I.value[i]));
+ (I.value[i] == ' ')
+ ? HT_NON_BREAK_SPACE
+ : I.value[i]);
}
while (i++ < chars) {
HTML_put_character(me, HT_NON_BREAK_SPACE);
@@ -4508,16 +4469,31 @@ PRIVATE int HTML_start_element ARGS6(
int chars;
BOOL UseALTasVALUE = FALSE;
BOOL HaveSRClink = FALSE;
- char* ImageSrc = NULL;
+ char *ImageSrc = NULL;
BOOL IsSubmitOrReset = FALSE;
- HTkcode kcode = 0;
- HTkcode specified_kcode = 0;
+ HTkcode kcode = NOKANJI;
+ HTkcode specified_kcode = NOKANJI;
+
/* init */
- I.align=NULL; I.accept=NULL; I.checked=NO; I.class=NULL;
- I.disabled=NO; I.error=NULL; I.height= NULL; I.id=NULL;
- I.lang=NULL; I.max=NULL; I.maxlength=NULL; I.md=NULL;
- I.min=NULL; I.name=NULL; I.size=0; I.src=NULL;
- I.type=NULL; I.value=NULL; I.width=NULL;
+ I.align = NULL;
+ I.accept = NULL;
+ I.checked = NO;
+ I.iclass = NULL;
+ I.disabled = NO;
+ I.error = NULL;
+ I.height = NULL;
+ I.id = NULL;
+ I.lang = NULL;
+ I.max = NULL;
+ I.maxlength = NULL;
+ I.md = NULL;
+ I.min = NULL;
+ I.name = NULL;
+ I.size = 0;
+ I.src = NULL;
+ I.type = NULL;
+ I.value = NULL;
+ I.width = NULL;
I.accept_cs = NULL;
I.name_cs = ATTR_CS_IN;
I.value_cs = ATTR_CS_IN;
@@ -4525,40 +4501,41 @@ PRIVATE int HTML_start_element ARGS6(
UPDATE_STYLE;
/*
- * Before any input field, add a collapsible space if
- * we're not in a PRE block, to promote a wrap there
- * for any long values that would extend past the right
- * margin from our current position in the line. If
- * we are in a PRE block, start a new line if the last
- * line already is within 6 characters of the wrap point
- * for PRE blocks. - FM
+ * Before any input field, add a collapsible space if we're not in
+ * a PRE block, to promote a wrap there for any long values that
+ * would extend past the right margin from our current position in
+ * the line. If we are in a PRE block, start a new line if the
+ * last line already is within 6 characters of the wrap point for
+ * PRE blocks. - FM
*/
if (me->sp[0].tag_number != HTML_PRE && !me->inPRE &&
me->sp->style->freeFormat) {
HTML_put_character(me, ' ');
me->in_word = NO;
- } else if (HText_LastLineSize(me->text, FALSE) > (LYcols - 7)) {
+ } else if (HText_LastLineSize(me->text, FALSE) > (LYcolLimit - 6)) {
HTML_put_character(me, '\n');
me->in_word = NO;
}
/*
- * Get the TYPE and make sure we can handle it. - FM
+ * Get the TYPE and make sure we can handle it. - FM
*/
if (present && present[HTML_INPUT_TYPE] &&
- value[HTML_INPUT_TYPE] && *value[HTML_INPUT_TYPE]) {
- char *not_impl = NULL;
+ non_empty(value[HTML_INPUT_TYPE])) {
+ const char *not_impl = NULL;
char *usingval = NULL;
I.type = value[HTML_INPUT_TYPE];
if (!strcasecomp(I.type, "range")) {
- if (present[HTML_INPUT_MIN])
+ if (present[HTML_INPUT_MIN] &&
+ non_empty(value[HTML_INPUT_MIN]))
I.min = value[HTML_INPUT_MIN];
- if (present[HTML_INPUT_MAX])
+ if (present[HTML_INPUT_MAX] &&
+ non_empty(value[HTML_INPUT_MAX]))
I.max = value[HTML_INPUT_MAX];
/*
- * Not yet implemented.
+ * Not yet implemented.
*/
not_impl = "[RANGE Input]";
#ifdef NOTDEFINED
@@ -4569,7 +4546,8 @@ PRIVATE int HTML_start_element ARGS6(
break;
} else if (!strcasecomp(I.type, "file")) {
- if (present[HTML_INPUT_ACCEPT])
+ if (present[HTML_INPUT_ACCEPT] &&
+ non_empty(value[HTML_INPUT_ACCEPT]))
I.accept = value[HTML_INPUT_ACCEPT];
#ifndef USE_FILE_UPLOAD
not_impl = "[FILE Input]";
@@ -4583,9 +4561,9 @@ PRIVATE int HTML_start_element ARGS6(
} else if (!strcasecomp(I.type, "button")) {
/*
- * Ugh, a button for a script.
+ * Ugh, a button for a script.
*/
- HTML_put_string(me,"[BUTTON] ");
+ HTML_put_string(me, "[BUTTON] ");
break;
}
if (not_impl != NULL) {
@@ -4608,24 +4586,24 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Check if we're in a form. - FM
+ * Check if we're in a form. - FM
*/
if (!me->inFORM) {
if (LYBadHTML(me))
CTRACE((tfp,
"Bad HTML: INPUT tag not within FORM tag\n"));
/*
- * We'll process it, since the chances of a crash are
- * small, and we probably do have a form started. - FM
+ * We'll process it, since the chances of a crash are small,
+ * and we probably do have a form started. - FM
*
- break;
+ break;
*/
}
CTRACE((tfp, "Ok, we're trying type=[%s]\n", NONNULL(I.type)));
/*
- * Check for an unclosed TEXTAREA.
+ * Check for an unclosed TEXTAREA.
*/
if (me->inTEXTAREA) {
if (LYBadHTML(me))
@@ -4633,7 +4611,7 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Check for an unclosed SELECT, try to close it if found.
+ * Check for an unclosed SELECT, try to close it if found.
*/
if (me->inSELECT) {
CTRACE((tfp, "HTML: Missing SELECT end tag, faking it...\n"));
@@ -4644,10 +4622,10 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * Handle the INPUT as for a FORM. - FM
+ * Handle the INPUT as for a FORM. - FM
*/
if (!(present && present[HTML_INPUT_NAME] &&
- value[HTML_INPUT_NAME])) {
+ non_empty(value[HTML_INPUT_NAME]))) {
I.name = "";
} else if (strchr(value[HTML_INPUT_NAME], '&') == NULL) {
I.name = value[HTML_INPUT_NAME];
@@ -4656,35 +4634,34 @@ PRIVATE int HTML_start_element ARGS6(
UNESCAPE_FIELDNAME_TO_STD(&I_name);
I.name = I_name;
}
+
if ((present && present[HTML_INPUT_ALT] &&
- value[HTML_INPUT_ALT] && *value[HTML_INPUT_ALT] &&
+ non_empty(value[HTML_INPUT_ALT]) &&
I.type && !strcasecomp(I.type, "image")) &&
!(present && present[HTML_INPUT_VALUE] &&
- value[HTML_INPUT_VALUE] && *value[HTML_INPUT_VALUE])) {
+ non_empty(value[HTML_INPUT_VALUE]))) {
/*
- * This is a TYPE="image" using an ALT rather than
- * VALUE attribute to indicate the link string for
- * text clients or GUIs with image loading off, so
- * set the flag to use that as if it were a VALUE
- * attribute. - FM
+ * This is a TYPE="image" using an ALT rather than VALUE
+ * attribute to indicate the link string for text clients or
+ * GUIs with image loading off, so set the flag to use that as
+ * if it were a VALUE attribute. - FM
*/
UseALTasVALUE = TRUE;
}
if (verbose_img && !clickable_images &&
present && present[HTML_INPUT_SRC] &&
- value[HTML_INPUT_SRC] && *value[HTML_INPUT_SRC] &&
+ non_empty(value[HTML_INPUT_SRC]) &&
I.type && !strcasecomp(I.type, "image")) {
ImageSrc = MakeNewImageValue(value);
} else if (clickable_images == TRUE &&
- present && present[HTML_INPUT_SRC] &&
- value[HTML_INPUT_SRC] && *value[HTML_INPUT_SRC] &&
- I.type && !strcasecomp(I.type, "image")) {
+ present && present[HTML_INPUT_SRC] &&
+ non_empty(value[HTML_INPUT_SRC]) &&
+ I.type && !strcasecomp(I.type, "image")) {
StrAllocCopy(href, value[HTML_INPUT_SRC]);
/*
- * We have a TYPE="image" with a non-zero-length SRC
- * attribute and want clickable images. Make the
- * SRC's value a link if it's still not zero-length
- * legitimizing it. - FM
+ * We have a TYPE="image" with a non-zero-length SRC attribute
+ * and want clickable images. Make the SRC's value a link if
+ * it's still not zero-length legitimizing it. - FM
*/
LYLegitimizeHREF(me, &href, TRUE, TRUE);
if (*href) {
@@ -4693,15 +4670,16 @@ PRIVATE int HTML_start_element ARGS6(
SET_SKIP_STACK(HTML_A);
HTML_end_element(me, HTML_A, include);
}
- me->CurrentA = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- NULL, /* Tag */
- href, /* Addresss */
- (HTLinkType*)0); /* Type */
+ me->CurrentA = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ NULL, /* Tag */
+ href, /* Addresss */
+ (HTLinkType *) 0); /* Type */
HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
if (me->inBoldH == FALSE)
HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
- HTML_put_string(me, VERBOSE_IMG(value,HTML_INPUT_SRC,"[IMAGE]"));
+ HTML_put_string(me, VERBOSE_IMG(value,
+ HTML_INPUT_SRC,
+ "[IMAGE]"));
FREE(newtitle);
if (me->inBoldH == FALSE)
HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
@@ -4711,23 +4689,24 @@ PRIVATE int HTML_start_element ARGS6(
}
FREE(href);
}
- CTRACE((tfp, "2.Ok, we're trying type=[%s] (present=%p)\n", NONNULL(I.type), present));
+ CTRACE((tfp, "2.Ok, we're trying type=[%s] (present=%p)\n",
+ NONNULL(I.type),
+ present));
/* text+file don't go in here */
if ((UseALTasVALUE == TRUE) ||
(present && present[HTML_INPUT_VALUE] &&
value[HTML_INPUT_VALUE] &&
- (*value[HTML_INPUT_VALUE] ||
- (I.type && (!strcasecomp(I.type, "checkbox") ||
- !strcasecomp(I.type, "radio")))))) {
+ (*value[HTML_INPUT_VALUE] ||
+ (I.type && (!strcasecomp(I.type, "checkbox") ||
+ !strcasecomp(I.type, "radio")))))) {
/*
- * Convert any HTML entities or decimal escaping. - FM
+ * Convert any HTML entities or decimal escaping. - FM
*/
int CurrentCharSet = current_char_set;
BOOL CurrentEightBitRaw = HTPassEightBitRaw;
BOOLEAN CurrentUseDefaultRawMode = LYUseDefaultRawMode;
HTCJKlang CurrentHTCJK = HTCJK;
- int len;
if (I.type && !strcasecomp(I.type, "hidden")) {
me->HiddenValue = TRUE;
@@ -4751,36 +4730,30 @@ PRIVATE int HTML_start_element ARGS6(
}
StrAllocCopy(I_value,
- ((UseALTasVALUE == TRUE) ?
- value[HTML_INPUT_ALT] :
- value[HTML_INPUT_VALUE]));
+ ((UseALTasVALUE == TRUE)
+ ? value[HTML_INPUT_ALT]
+ : value[HTML_INPUT_VALUE]));
if (me->UsePlainSpace && !me->HiddenValue) {
I.value_cs = current_char_set;
}
CTRACE((tfp, "4.Ok, we're trying type=[%s]\n", NONNULL(I.type)));
- TRANSLATE_AND_UNESCAPE_ENTITIES6(
- &I_value,
- ATTR_CS_IN,
- I.value_cs,
- (BOOL)(me->UsePlainSpace && !me->HiddenValue),
- me->UsePlainSpace,
- me->HiddenValue);
+ TRANSLATE_AND_UNESCAPE_ENTITIES6(&I_value,
+ ATTR_CS_IN,
+ I.value_cs,
+ (BOOL) (me->UsePlainSpace &&
+ !me->HiddenValue),
+ me->UsePlainSpace,
+ me->HiddenValue);
I.value = I_value;
if (me->UsePlainSpace == TRUE) {
/*
- * Convert any newlines or tabs to spaces,
- * and trim any lead or trailing spaces. - FM
+ * Convert any newlines or tabs to spaces, and trim any
+ * lead or trailing spaces. - FM
*/
- convert_to_spaces(I.value, FALSE);
- while (I.value && I.value[0] == ' ')
- I.value++;
- len = strlen(I.value) - 1;
- while (len > 0 && I.value[len] == ' ')
- I.value[len--] = '\0';
+ LYReduceBlanks(I.value);
}
me->UsePlainSpace = FALSE;
-
if (I.type && !strcasecomp(I.type, "hidden")) {
me->HiddenValue = FALSE;
current_char_set = CurrentCharSet;
@@ -4791,14 +4764,14 @@ PRIVATE int HTML_start_element ARGS6(
}
} else if (HaveSRClink == TRUE) {
/*
- * We put up an [IMAGE] link and '-' for a TYPE="image"
- * and didn't get a VALUE or ALT string, so fake a
- * "Submit" value. If we didn't put up a link, then
- * HText_beginInput() will use "[IMAGE]-Submit". - FM
+ * We put up an [IMAGE] link and '-' for a TYPE="image" and
+ * didn't get a VALUE or ALT string, so fake a "Submit" value.
+ * If we didn't put up a link, then HText_beginInput() will use
+ * "[IMAGE]-Submit". - FM
*/
StrAllocCopy(I_value, "Submit");
I.value = I_value;
- } else if ( ImageSrc ) {
+ } else if (ImageSrc) {
/* [IMAGE]-Submit with verbose images and not clickable images.
* Use ImageSrc if no other alt or value is supplied. --LE
*/
@@ -4807,71 +4780,72 @@ PRIVATE int HTML_start_element ARGS6(
if (present && present[HTML_INPUT_CHECKED])
I.checked = YES;
if (present && present[HTML_INPUT_SIZE] &&
- value[HTML_INPUT_SIZE] && *value[HTML_INPUT_SIZE])
+ non_empty(value[HTML_INPUT_SIZE]))
I.size = atoi(value[HTML_INPUT_SIZE]);
+ LimitValue(I.size, MAX_LINE);
if (present && present[HTML_INPUT_MAXLENGTH] &&
- value[HTML_INPUT_MAXLENGTH] && *value[HTML_INPUT_MAXLENGTH])
+ non_empty(value[HTML_INPUT_MAXLENGTH]))
I.maxlength = value[HTML_INPUT_MAXLENGTH];
if (present && present[HTML_INPUT_DISABLED])
I.disabled = YES;
- if (present && present[HTML_INPUT_ACCEPT_CHARSET]) { /* Not yet used. */
- I.accept_cs = value[HTML_INPUT_ACCEPT_CHARSET] ?
- value[HTML_INPUT_ACCEPT_CHARSET] : "UNKNOWN";
+ if (present && present[HTML_INPUT_ACCEPT_CHARSET]) { /* Not yet used. */
+ I.accept_cs = (value[HTML_INPUT_ACCEPT_CHARSET]
+ ? value[HTML_INPUT_ACCEPT_CHARSET]
+ : "UNKNOWN");
}
- if (present && present[HTML_INPUT_ALIGN] && /* Not yet used. */
- value[HTML_INPUT_ALIGN] && *value[HTML_INPUT_ALIGN])
+ if (present && present[HTML_INPUT_ALIGN] && /* Not yet used. */
+ non_empty(value[HTML_INPUT_ALIGN]))
I.align = value[HTML_INPUT_ALIGN];
- if (present && present[HTML_INPUT_CLASS] && /* Not yet used. */
- value[HTML_INPUT_CLASS] && *value[HTML_INPUT_CLASS])
- I.class = value[HTML_INPUT_CLASS];
- if (present && present[HTML_INPUT_ERROR] && /* Not yet used. */
- value[HTML_INPUT_ERROR] && *value[HTML_INPUT_ERROR])
+ if (present && present[HTML_INPUT_CLASS] && /* Not yet used. */
+ non_empty(value[HTML_INPUT_CLASS]))
+ I.iclass = value[HTML_INPUT_CLASS];
+ if (present && present[HTML_INPUT_ERROR] && /* Not yet used. */
+ non_empty(value[HTML_INPUT_ERROR]))
I.error = value[HTML_INPUT_ERROR];
- if (present && present[HTML_INPUT_HEIGHT] && /* Not yet used. */
- value[HTML_INPUT_HEIGHT] && *value[HTML_INPUT_HEIGHT])
+ if (present && present[HTML_INPUT_HEIGHT] && /* Not yet used. */
+ non_empty(value[HTML_INPUT_HEIGHT]))
I.height = value[HTML_INPUT_HEIGHT];
- if (present && present[HTML_INPUT_WIDTH] && /* Not yet used. */
- value[HTML_INPUT_WIDTH] && *value[HTML_INPUT_WIDTH])
+ if (present && present[HTML_INPUT_WIDTH] && /* Not yet used. */
+ non_empty(value[HTML_INPUT_WIDTH]))
I.width = value[HTML_INPUT_WIDTH];
if (present && present[HTML_INPUT_ID] &&
- value[HTML_INPUT_ID] && *value[HTML_INPUT_ID]) {
+ non_empty(value[HTML_INPUT_ID])) {
I.id = value[HTML_INPUT_ID];
CHECK_ID(HTML_INPUT_ID);
}
- if (present && present[HTML_INPUT_LANG] && /* Not yet used. */
- value[HTML_INPUT_LANG] && *value[HTML_INPUT_LANG])
+ if (present && present[HTML_INPUT_LANG] && /* Not yet used. */
+ non_empty(value[HTML_INPUT_LANG]))
I.lang = value[HTML_INPUT_LANG];
- if (present && present[HTML_INPUT_MD] && /* Not yet used. */
- value[HTML_INPUT_MD] && *value[HTML_INPUT_MD])
+ if (present && present[HTML_INPUT_MD] && /* Not yet used. */
+ non_empty(value[HTML_INPUT_MD]))
I.md = value[HTML_INPUT_MD];
chars = HText_beginInput(me->text, me->inUnderline, &I);
-#ifndef USE_FILE_UPLOAD
- CTRACE((tfp, "I.%s have %d chars, or something\n", NONNULL(I.type), chars));
-#endif
+ CTRACE((tfp,
+ "I.%s have %d chars, or something\n",
+ NONNULL(I.type),
+ chars));
/*
- * Submit and reset buttons have values which don't change,
- * so HText_beginInput() sets I.value to the string which
- * should be displayed, and we'll enter that instead of
- * underscore placeholders into the HText structure to
- * see it instead of underscores when dumping or printing.
- * We also won't worry about a wrap in PRE blocks, because
- * the line editor never is invoked for submit or reset
- * buttons. - LE & FM
+ * Submit and reset buttons have values which don't change, so
+ * HText_beginInput() sets I.value to the string which should be
+ * displayed, and we'll enter that instead of underscore
+ * placeholders into the HText structure to see it instead of
+ * underscores when dumping or printing. We also won't worry about
+ * a wrap in PRE blocks, because the line editor never is invoked
+ * for submit or reset buttons. - LE & FM
*/
if (I.type &&
- (!strcasecomp(I.type,"submit") ||
- !strcasecomp(I.type,"reset") ||
- !strcasecomp(I.type,"image")))
+ (!strcasecomp(I.type, "submit") ||
+ !strcasecomp(I.type, "reset") ||
+ !strcasecomp(I.type, "image")))
IsSubmitOrReset = TRUE;
if (I.type && chars == 3 &&
!strcasecomp(I.type, "radio")) {
/*
- * Put a (_) placeholder, and one space
- * (collapsible) before the label that is
- * expected to follow. - FM
+ * Put a (_) placeholder, and one space (collapsible) before
+ * the label that is expected to follow. - FM
*/
HTML_put_string(me, "(_)");
HText_endInput(me->text);
@@ -4883,11 +4857,10 @@ PRIVATE int HTML_start_element ARGS6(
me->in_word = NO;
}
} else if (I.type && chars == 3 &&
- !strcasecomp(I.type, "checkbox")) {
+ !strcasecomp(I.type, "checkbox")) {
/*
- * Put a [_] placeholder, and one space
- * (collapsible) before the label that is
- * expected to follow. - FM
+ * Put a [_] placeholder, and one space (collapsible) before
+ * the label that is expected to follow. - FM
*/
HTML_put_string(me, "[_]");
HText_endInput(me->text);
@@ -4903,20 +4876,18 @@ PRIVATE int HTML_start_element ARGS6(
&& chars > 6 &&
IsSubmitOrReset == FALSE) {
/*
- * This is not a submit or reset button, and we are
- * in a PRE block with a field intended to exceed 6
- * character widths. The code inadequately handles
- * INPUT fields in PRE tags if wraps occur (at the
- * right margin) for the underscore placeholders.
- * We'll put up a minimum of 6 underscores, since we
- * should have wrapped artificially, above, if the
- * INPUT begins within 6 columns of the right margin,
- * and if any more would exceed the wrap column, we'll
- * ignore them. Note that if we somehow get tripped
- * up and a wrap still does occur before all 6 of the
- * underscores are output, the wrapped ones won't be
- * treated as part of the editing window, nor be
- * highlighted when not editing (Yuk!). - FM
+ * This is not a submit or reset button, and we are in a PRE
+ * block with a field intended to exceed 6 character widths.
+ * The code inadequately handles INPUT fields in PRE tags if
+ * wraps occur (at the right margin) for the underscore
+ * placeholders. We'll put up a minimum of 6 underscores,
+ * since we should have wrapped artificially, above, if the
+ * INPUT begins within 6 columns of the right margin, and if
+ * any more would exceed the wrap column, we'll ignore them.
+ * Note that if we somehow get tripped up and a wrap still does
+ * occur before all 6 of the underscores are output, the
+ * wrapped ones won't be treated as part of the editing window,
+ * nor be highlighted when not editing (Yuk!). - FM
*/
for (i = 0; i < 6; i++) {
HTML_put_character(me, '_');
@@ -4924,14 +4895,11 @@ PRIVATE int HTML_start_element ARGS6(
}
HText_setIgnoreExcess(me->text, TRUE);
}
-#ifndef USE_FILE_UPLOAD
CTRACE((tfp, "I.%s, %d\n", NONNULL(I.type), IsSubmitOrReset));
-#endif
if (IsSubmitOrReset == FALSE) {
/*
- * This is not a submit or reset button,
- * so output the rest of the underscore
- * placeholders, if any more are needed. - FM
+ * This is not a submit or reset button, so output the rest of
+ * the underscore placeholders, if any more are needed. - FM
*/
if (chars > 0) {
for (; chars > 0; chars--)
@@ -4948,38 +4916,35 @@ PRIVATE int HTML_start_element ARGS6(
if (me->sp[0].tag_number == HTML_PRE ||
!me->sp->style->freeFormat) {
/*
- * We have a submit or reset button in a PRE block,
- * so output the entire value from the markup. If
- * it extends to the right margin, it will wrap
- * there, and only the portion before that wrap will
- * be hightlighted on screen display (Yuk!) but we
- * may as well show the rest of the full value on
- * the next or more lines. - FM
+ * We have a submit or reset button in a PRE block, so
+ * output the entire value from the markup. If it extends
+ * to the right margin, it will wrap there, and only the
+ * portion before that wrap will be hightlighted on screen
+ * display (Yuk!) but we may as well show the rest of the
+ * full value on the next or more lines. - FM
*/
while (I.value[i])
HTML_put_character(me, I.value[i++]);
} else {
/*
- * The submit or reset button is not in a PRE block.
- * Note that if a wrap occurs before outputting the
- * entire value, the wrapped portion will not be
- * highlighted or clearly indicated as part of the
- * link for submission or reset (Yuk!).
- * We'll replace any spaces in the submit or reset
- * button value with nbsp, to promote a wrap at the
- * space we ensured would be present before the start
- * of the string, as when we use all underscores
- * instead of the INPUT's actual value, but we could
- * still get a wrap at the right margin, instead, if
- * the value is greater than a line width for the
- * current style. Also, if chars somehow ended up
- * longer than the length of the actual value
- * (shouldn't have), we'll continue padding with nbsp
- * up to the length of chars. - FM
+ * The submit or reset button is not in a PRE block. Note
+ * that if a wrap occurs before outputting the entire
+ * value, the wrapped portion will not be highlighted or
+ * clearly indicated as part of the link for submission or
+ * reset (Yuk!). We'll replace any spaces in the submit or
+ * reset button value with nbsp, to promote a wrap at the
+ * space we ensured would be present before the start of
+ * the string, as when we use all underscores instead of
+ * the INPUT's actual value, but we could still get a wrap
+ * at the right margin, instead, if the value is greater
+ * than a line width for the current style. Also, if chars
+ * somehow ended up longer than the length of the actual
+ * value (shouldn't have), we'll continue padding with nbsp
+ * up to the length of chars. - FM
*/
for (i = 0; I.value[i]; i++)
HTML_put_character(me,
- (char)(I.value[i] == ' '
+ (char) (I.value[i] == ' '
? HT_NON_BREAK_SPACE
: I.value[i]));
while (i++ < chars)
@@ -5002,24 +4967,25 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_TEXTAREA:
/*
- * Make sure we're in a form.
+ * Make sure we're in a form.
*/
if (!me->inFORM) {
if (LYBadHTML(me))
- CTRACE((tfp, "Bad HTML: TEXTAREA start tag not within FORM tag\n"));
+ CTRACE((tfp,
+ "Bad HTML: TEXTAREA start tag not within FORM tag\n"));
/*
- * Too likely to cause a crash, so we'll ignore it. - FM
+ * Too likely to cause a crash, so we'll ignore it. - FM
*/
break;
}
/*
- * Set to know we are in a textarea.
+ * Set to know we are in a textarea.
*/
me->inTEXTAREA = TRUE;
/*
- * Get ready for the value.
+ * Get ready for the value.
*/
HTChunkClear(&me->textarea);
if (present && present[HTML_TEXTAREA_NAME] &&
@@ -5050,11 +5016,12 @@ PRIVATE int HTML_start_element ARGS6(
me->textarea_cols = atoi(value[HTML_TEXTAREA_COLS]);
else {
int width;
- width = LYcols - 1 -
- me->new_style->leftIndent - me->new_style->rightIndent;
- if (dump_output_immediately) /* don't waste too much for this */
+
+ width = LYcolLimit -
+ me->new_style->leftIndent - me->new_style->rightIndent;
+ if (dump_output_immediately) /* don't waste too much for this */
width = HTMIN(width, DFT_TEXTAREA_COLS);
- if (width > 1 && (width-1)*6 < MAX_LINE - 3 -
+ if (width > 1 && (width - 1) * 6 < MAX_LINE - 3 -
me->new_style->leftIndent - me->new_style->rightIndent)
me->textarea_cols = width;
else
@@ -5076,15 +5043,14 @@ PRIVATE int HTML_start_element ARGS6(
me->textarea_disabled = NO;
if (present && present[HTML_TEXTAREA_ID]
- && value[HTML_TEXTAREA_ID] && *value[HTML_TEXTAREA_ID]) {
+ && non_empty(value[HTML_TEXTAREA_ID])) {
StrAllocCopy(id_string, value[HTML_TEXTAREA_ID]);
TRANSLATE_AND_UNESCAPE_TO_STD(&id_string);
if ((id_string != '\0') &&
- (ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- id_string, /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0))) { /* Type */
+ (ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ id_string, /* Tag */
+ NULL, /* Addresss */
+ (HTLinkType *) 0))) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
StrAllocCopy(me->textarea_id, id_string);
@@ -5099,11 +5065,12 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_SELECT:
/*
- * Check for an already open SELECT block. - FM
+ * Check for an already open SELECT block. - FM
*/
if (me->inSELECT) {
if (LYBadHTML(me))
- CTRACE((tfp, "Bad HTML: SELECT start tag in SELECT element. Faking SELECT end tag. *****\n"));
+ CTRACE((tfp,
+ "Bad HTML: SELECT start tag in SELECT element. Faking SELECT end tag. *****\n"));
if (me->sp->tag_number != HTML_SELECT) {
SET_SKIP_STACK(HTML_SELECT);
}
@@ -5114,7 +5081,7 @@ PRIVATE int HTML_start_element ARGS6(
* Start a new SELECT block. - FM
*/
LYHandleSELECT(me,
- present, (CONST char **)value,
+ present, (const char **) value,
include,
TRUE);
break;
@@ -5122,31 +5089,32 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_OPTION:
{
/*
- * An option is a special case of an input field.
+ * An option is a special case of an input field.
*/
InputFieldData I;
/*
- * Make sure we're in a select tag.
+ * Make sure we're in a select tag.
*/
if (!me->inSELECT) {
if (LYBadHTML(me))
- CTRACE((tfp, "Bad HTML: OPTION tag not within SELECT tag\n"));
+ CTRACE((tfp,
+ "Bad HTML: OPTION tag not within SELECT tag\n"));
/*
- * Too likely to cause a crash, so we'll ignore it. - FM
+ * Too likely to cause a crash, so we'll ignore it. - FM
*/
break;
}
if (!me->first_option) {
/*
- * Finish the data off.
+ * Finish the data off.
*/
HTChunkTerminate(&me->option);
/*
- * Finish the previous option @@@@@
+ * Finish the previous option @@@@@
*/
HText_setLastOptionValue(me->text,
me->option.data,
@@ -5158,9 +5126,9 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * If it's not a multiple option list and select popups
- * are enabled, then don't use the checkbox/button method,
- * and don't put anything on the screen yet.
+ * If it's not a multiple option list and select popups are
+ * enabled, then don't use the checkbox/button method, and don't
+ * put anything on the screen yet.
*/
if (me->first_option ||
HTCurSelectGroupType == F_CHECKBOX_TYPE ||
@@ -5168,27 +5136,23 @@ PRIVATE int HTML_start_element ARGS6(
if (HTCurSelectGroupType == F_CHECKBOX_TYPE ||
LYSelectPopups == FALSE) {
/*
- * Start a newline before each option.
+ * Start a newline before each option.
*/
LYEnsureSingleSpace(me);
} else {
/*
- * Add option list designation character.
+ * Add option list designation character.
*/
HText_appendCharacter(me->text, '[');
me->in_word = YES;
}
/*
- * Inititialize.
+ * Inititialize.
*/
- I.align=NULL; I.accept=NULL; I.checked=NO; I.class=NULL;
- I.disabled=NO; I.error=NULL; I.height= NULL; I.id=NULL;
- I.lang=NULL; I.max=NULL; I.maxlength=NULL; I.md=NULL;
- I.min=NULL; I.name=NULL; I.size=0; I.src=NULL;
- I.type=NULL; I.value=NULL; I.width=NULL;
I.accept_cs = NULL;
I.name_cs = -1;
+ I.maxlength = NULL;
I.value_cs = current_char_set;
I.type = "OPTION";
@@ -5196,20 +5160,20 @@ PRIVATE int HTML_start_element ARGS6(
if ((present && present[HTML_OPTION_SELECTED]) ||
(me->first_option && LYSelectPopups == FALSE &&
HTCurSelectGroupType == F_RADIO_TYPE))
- I.checked=YES;
+ I.checked = YES;
if (present && present[HTML_OPTION_VALUE] &&
value[HTML_OPTION_VALUE]) {
/*
- * Convert any HTML entities or decimal escaping. - FM
+ * Convert any HTML entities or decimal escaping. - FM
*/
StrAllocCopy(I_value, value[HTML_OPTION_VALUE]);
me->HiddenValue = TRUE;
TRANSLATE_AND_UNESCAPE_ENTITIES6(&I_value,
- ATTR_CS_IN,
- ATTR_CS_IN,
- NO,
- me->UsePlainSpace, me->HiddenValue);
+ ATTR_CS_IN,
+ ATTR_CS_IN,
+ NO,
+ me->UsePlainSpace, me->HiddenValue);
I.value_cs = ATTR_CS_IN;
me->HiddenValue = FALSE;
@@ -5217,16 +5181,15 @@ PRIVATE int HTML_start_element ARGS6(
}
if (me->select_disabled ||
- (present && present[HTML_OPTION_DISABLED]))
- I.disabled=YES;
+ (present && present[HTML_OPTION_DISABLED]))
+ I.disabled = YES;
if (present && present[HTML_OPTION_ID]
- && value[HTML_OPTION_ID] && *value[HTML_OPTION_ID]) {
- if ((ID_A = HTAnchor_findChildAndLink(
- me->node_anchor, /* Parent */
- value[HTML_OPTION_ID], /* Tag */
- NULL, /* Addresss */
- (HTLinkType*)0)) != NULL) { /* Type */
+ && non_empty(value[HTML_OPTION_ID])) {
+ if ((ID_A = HTAnchor_findChildAndLink(me->node_anchor, /* Parent */
+ value[HTML_OPTION_ID], /* Tag */
+ NULL, /* Addresss */
+ 0)) != NULL) { /* Type */
HText_beginAnchor(me->text, me->inUnderline, ID_A);
HText_endAnchor(me->text, 0);
I.id = value[HTML_OPTION_ID];
@@ -5237,33 +5200,31 @@ PRIVATE int HTML_start_element ARGS6(
if (HTCurSelectGroupType == F_CHECKBOX_TYPE) {
/*
- * Put a "[_]" placeholder, and one space
- * (collapsible) before the label that is
- * expected to follow. - FM
+ * Put a "[_]" placeholder, and one space (collapsible)
+ * before the label that is expected to follow. - FM
*/
HText_appendCharacter(me->text, '[');
HText_appendCharacter(me->text, '_');
HText_appendCharacter(me->text, ']');
HText_appendCharacter(me->text, ' ');
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
me->in_word = NO;
} else if (LYSelectPopups == FALSE) {
/*
- * Put a "(_)" placeholder, and one space
- * (collapsible) before the label that is
- * expected to follow. - FM
+ * Put a "(_)" placeholder, and one space (collapsible)
+ * before the label that is expected to follow. - FM
*/
HText_appendCharacter(me->text, '(');
HText_appendCharacter(me->text, '_');
HText_appendCharacter(me->text, ')');
HText_appendCharacter(me->text, ' ');
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
me->in_word = NO;
}
}
/*
- * Get ready for the next value.
+ * Get ready for the next value.
*/
HTChunkClear(&me->option);
if ((present && present[HTML_OPTION_SELECTED]) ||
@@ -5278,15 +5239,15 @@ PRIVATE int HTML_start_element ARGS6(
value[HTML_OPTION_VALUE]) {
if (!I_value) {
/*
- * Convert any HTML entities or decimal escaping. - FM
+ * Convert any HTML entities or decimal escaping. - FM
*/
StrAllocCopy(I_value, value[HTML_OPTION_VALUE]);
me->HiddenValue = TRUE;
TRANSLATE_AND_UNESCAPE_ENTITIES6(&I_value,
- ATTR_CS_IN,
- ATTR_CS_IN,
- NO,
- me->UsePlainSpace, me->HiddenValue);
+ ATTR_CS_IN,
+ ATTR_CS_IN,
+ NO,
+ me->UsePlainSpace, me->HiddenValue);
me->HiddenValue = FALSE;
}
StrAllocCopy(me->LastOptionValue, I_value);
@@ -5295,8 +5256,8 @@ PRIVATE int HTML_start_element ARGS6(
}
/*
- * If this is a popup option, print its option
- * for use in selecting option by number. - LE
+ * If this is a popup option, print its option for use in selecting
+ * option by number. - LE
*/
if (HTCurSelectGroupType == F_RADIO_TYPE &&
LYSelectPopups &&
@@ -5305,7 +5266,7 @@ PRIVATE int HTML_start_element ARGS6(
int opnum = HText_getOptionNum(me->text);
if (opnum > 0 && opnum < 100000) {
- sprintf(marker,"(%d)", opnum);
+ sprintf(marker, "(%d)", opnum);
HTML_put_string(me, marker);
for (i = strlen(marker); i < 5; ++i) {
HTML_put_character(me, '_');
@@ -5318,24 +5279,21 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_TABLE:
/*
- * Not fully implemented. Just treat as a division
- * with respect to any ALIGN attribute, with
- * a default of HT_LEFT, or leave as a PRE
- * block if we are presently in one. - FM
+ * Not fully implemented. Just treat as a division with respect to any
+ * ALIGN attribute, with a default of HT_LEFT, or leave as a PRE block
+ * if we are presently in one. - FM
*
- * Also notify simple table tracking code unless
- * in a preformatted section, or (currently) non-left
- * alignment.
+ * Also notify simple table tracking code unless in a preformatted
+ * section, or (currently) non-left alignment.
*
- * If page author is using a TABLE within PRE, it's probably
- * formatted specifically to work well for Lynx without simple
- * table tracking code. Cancel tracking, it would only make
- * things worse. - kw
+ * If page author is using a TABLE within PRE, it's probably formatted
+ * specifically to work well for Lynx without simple table tracking
+ * code. Cancel tracking, it would only make things worse. - kw
*/
#ifdef EXP_NESTED_TABLES
if (!nested_tables)
#endif
- HText_cancelStbl(me->text);
+ HText_cancelStbl(me->text);
if (me->inA) {
SET_SKIP_STACK(HTML_A);
@@ -5355,24 +5313,24 @@ PRIVATE int HTML_start_element ARGS6(
me->Division_Level++;
} else {
CTRACE((tfp,
- "HTML: ****** Maximum nesting of %d divisions/tables exceeded!\n",
+ "HTML: ****** Maximum nesting of %d divisions/tables exceeded!\n",
MAX_NESTING));
}
if (present && present[HTML_TABLE_ALIGN] &&
- value[HTML_TABLE_ALIGN] && *value[HTML_TABLE_ALIGN]) {
+ non_empty(value[HTML_TABLE_ALIGN])) {
if (!strcasecomp(value[HTML_TABLE_ALIGN], "center")) {
if (no_table_center) {
me->DivisionAlignments[me->Division_Level] = HT_LEFT;
change_paragraph_style(me, styles[HTML_DLEFT]);
UPDATE_STYLE;
me->current_default_alignment =
- styles[HTML_DLEFT]->alignment;
+ styles[HTML_DLEFT]->alignment;
} else {
me->DivisionAlignments[me->Division_Level] = HT_CENTER;
change_paragraph_style(me, styles[HTML_DCENTER]);
UPDATE_STYLE;
me->current_default_alignment =
- styles[HTML_DCENTER]->alignment;
+ styles[HTML_DCENTER]->alignment;
}
stbl_align = HT_CENTER;
@@ -5405,10 +5363,9 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_TR:
/*
- * Not fully implemented. Just start a new row,
- * if needed, act on an ALIGN attribute if present,
- * and check for an ID link. - FM
- * Also notify simple table tracking code. - kw
+ * Not fully implemented. Just start a new row, if needed, act on an
+ * ALIGN attribute if present, and check for an ID link. - FM
+ * Also notify simple table tracking code. - kw
*/
if (me->inA) {
SET_SKIP_STACK(HTML_A);
@@ -5420,7 +5377,7 @@ PRIVATE int HTML_start_element ARGS6(
}
UPDATE_STYLE;
if (!HText_LastLineEmpty(me->text, FALSE)) {
- HText_setLastChar(me->text, ' '); /* absorb white space */
+ HText_setLastChar(me->text, ' '); /* absorb white space */
HText_appendCharacter(me->text, '\r');
}
me->in_word = NO;
@@ -5437,7 +5394,7 @@ PRIVATE int HTML_start_element ARGS6(
((me->Division_Level < 0) &&
(me->sp->style->id == ST_Normal ||
me->sp->style->id == ST_Preformatted))) {
- me->sp->style->alignment = HT_LEFT;
+ me->sp->style->alignment = HT_LEFT;
} else {
me->sp->style->alignment = (short) me->current_default_alignment;
}
@@ -5470,7 +5427,7 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_TBODY:
HText_endStblTR(me->text);
/*
- * Not fully implemented. Just check for an ID link. - FM
+ * Not fully implemented. Just check for an ID link. - FM
*/
if (me->inA) {
SET_SKIP_STACK(HTML_A);
@@ -5500,7 +5457,7 @@ PRIVATE int HTML_start_element ARGS6(
case HTML_COL:
case HTML_COLGROUP:
/*
- * Not fully implemented. Just check for an ID link. - FM
+ * Not fully implemented. Just check for an ID link. - FM
*/
if (me->inA) {
SET_SKIP_STACK(HTML_A);
@@ -5513,6 +5470,7 @@ PRIVATE int HTML_start_element ARGS6(
UPDATE_STYLE;
if (me->inTABLE) {
int span = 1;
+
if (present && present[HTML_COL_SPAN] &&
value[HTML_COL_SPAN] &&
isdigit(UCH(*value[HTML_COL_SPAN])))
@@ -5528,7 +5486,7 @@ PRIVATE int HTML_start_element ARGS6(
}
}
HText_startStblCOL(me->text, span, stbl_align,
- (BOOL)(ElementNumber == HTML_COLGROUP));
+ (BOOL) (ElementNumber == HTML_COLGROUP));
}
CHECK_ID(HTML_COL_ID);
break;
@@ -5546,12 +5504,13 @@ PRIVATE int HTML_start_element ARGS6(
UPDATE_STYLE;
CHECK_ID(HTML_TD_ID);
/*
- * Not fully implemented. Just add a collapsible space and break. - FM
- * Also notify simple table tracking code. - kw
+ * Not fully implemented. Just add a collapsible space and break - FM
+ * Also notify simple table tracking code. - kw
*/
HTML_put_character(me, ' ');
{
int colspan = 1, rowspan = 1;
+
if (present && present[HTML_TD_COLSPAN] &&
value[HTML_TD_COLSPAN] &&
isdigit(UCH(*value[HTML_TD_COLSPAN])))
@@ -5571,15 +5530,15 @@ PRIVATE int HTML_start_element ARGS6(
}
}
HText_startStblTD(me->text, colspan, rowspan, stbl_align,
- (BOOL)(ElementNumber == HTML_TH));
+ (BOOL) (ElementNumber == HTML_TH));
}
me->in_word = NO;
break;
case HTML_MATH:
/*
- * We're getting it as Literal text, which, until we can process
- * it, we'll display as is, within brackets to alert the user. - FM
+ * We're getting it as Literal text, which, until we can process it,
+ * we'll display as is, within brackets to alert the user. - FM
*/
HTChunkClear(&me->math);
CHECK_ID(HTML_GEN_ID);
@@ -5588,14 +5547,14 @@ PRIVATE int HTML_start_element ARGS6(
default:
break;
- } /* end switch */
+ } /* end switch */
if (ElementNumber >= HTML_ELEMENTS ||
HTML_dtd.tags[ElementNumber].contents != SGML_EMPTY) {
if (me->skip_stack > 0) {
CTRACE((tfp,
- "HTML:begin_element: internal call (level %d), leaving on stack - `%s'\n",
- me->skip_stack, NONNULL(me->sp->style->name)));
+ "HTML:begin_element: internal call (level %d), leaving on stack - `%s'\n",
+ me->skip_stack, NONNULL(me->sp->style->name)));
me->skip_stack--;
return status;
}
@@ -5610,20 +5569,20 @@ PRIVATE int HTML_start_element ARGS6(
return HT_ERROR;
}
- CTRACE((tfp, "HTML:begin_element[%d]: adding style to stack - %s (%s)\n",
- (int) STACKLEVEL(me),
- NONNULL(me->new_style->name),
- HTML_dtd.tags[ElementNumber].name));
+ CTRACE((tfp,
+ "HTML:begin_element[%d]: adding style to stack - %s (%s)\n",
+ (int) STACKLEVEL(me),
+ NONNULL(me->new_style->name),
+ HTML_dtd.tags[ElementNumber].name));
(me->sp)--;
me->sp[0].style = me->new_style; /* Stack new style */
me->sp[0].tag_number = ElementNumber;
#ifdef EXP_JUSTIFY_ELTS
if (wait_for_this_stacked_elt < 0 &&
- HTML_dtd.tags[ElementNumber].can_justify == FALSE)
+ HTML_dtd.tags[ElementNumber].can_justify == FALSE)
wait_for_this_stacked_elt = me->stack - me->sp + MAX_NESTING;
#endif
}
-
#ifdef EXP_JUSTIFY_ELTS
if (in_DT && ElementNumber == HTML_DD)
in_DT = FALSE;
@@ -5634,8 +5593,7 @@ PRIVATE int HTML_start_element ARGS6(
#if defined(USE_COLOR_STYLE)
/* end really empty tags straight away */
- if (ReallyEmptyTagNum(element_number))
- {
+ if (ReallyEmptyTagNum(element_number)) {
CTRACE2(TRACE_STYLE,
(tfp, "STYLE.begin_element:ending \"EMPTY\" element style\n"));
HText_characterStyle(me->text, HCODE_TO_STACK_OFF(hcode), STACK_OFF);
@@ -5652,23 +5610,21 @@ PRIVATE int HTML_start_element ARGS6(
}
/* End Element
-** -----------
-**
-** When we end an element, the style must be returned to that
-** in effect before that element. Note that anchors (etc?)
-** don't have an associated style, so that we must scan down the
-** stack for an element with a defined style. (In fact, the styles
-** should be linked to the whole stack not just the top one.)
-** TBL 921119
-**
-** We don't turn on "CAREFUL" check because the parser produces
-** (internal code errors apart) good nesting. The parser checks
-** incoming code errors, not this module.
-*/
-PRIVATE int HTML_end_element ARGS3(
- HTStructured *, me,
- int, element_number,
- char **, include)
+ * -----------
+ *
+ * When we end an element, the style must be returned to that
+ * in effect before that element. Note that anchors (etc?)
+ * don't have an associated style, so that we must scan down the
+ * stack for an element with a defined style. (In fact, the styles
+ * should be linked to the whole stack not just the top one.)
+ * TBL 921119
+ *
+ * We don't turn on "CAREFUL" check because the parser produces
+ * (internal code errors apart) good nesting. The parser checks
+ * incoming code errors, not this module.
+ */
+static int HTML_end_element(HTStructured * me, int element_number,
+ char **include)
{
int i = 0;
int status = HT_OK;
@@ -5681,26 +5637,30 @@ PRIVATE int HTML_end_element ARGS3(
#ifdef USE_PRETTYSRC
if (psrc_view && !sgml_in_psrc_was_initialized) {
if (!psrc_nested_call) {
- HTTag * tag = &HTML_dtd.tags[element_number];
+ HTTag *tag = &HTML_dtd.tags[element_number];
char buf[200];
- int tag_charset=0;
+ int tag_charset = 0;
- psrc_nested_call=TRUE;
- PSRCSTART(abracket); PUTS("</"); PSRCSTOP(abracket);
+ psrc_nested_call = TRUE;
+ PSRCSTART(abracket);
+ PUTS("</");
+ PSRCSTOP(abracket);
PSRCSTART(tag);
- if (tagname_transform!=0)
+ if (tagname_transform != 0)
PUTS(tag->name);
else {
- LYstrncpy(buf, tag->name, sizeof(buf)-1);
+ LYstrncpy(buf, tag->name, sizeof(buf) - 1);
LYLowerCase(buf);
PUTS(buf);
}
PSRCSTOP(tag);
- PSRCSTART(abracket); PUTC('>'); PSRCSTOP(abracket);
- psrc_nested_call=FALSE;
+ PSRCSTART(abracket);
+ PUTC('>');
+ PSRCSTOP(abracket);
+ psrc_nested_call = FALSE;
return HT_OK;
}
- /*fall through*/
+ /*fall through */
}
#endif
@@ -5710,18 +5670,18 @@ PRIVATE int HTML_end_element ARGS3(
CTRACE((tfp,
"HTML: end of element %s when expecting end of %s\n",
HTML_dtd.tags[element_number].name,
- (me->sp == me->stack + MAX_NESTING - 1) ? "none" :
- (me->sp->tag_number < 0) ? "*invalid tag*" :
- (me->sp->tag_number >= HTML_ELEMENTS) ? "special tag" :
+ (me->sp == me->stack + MAX_NESTING - 1) ? "none" :
+ (me->sp->tag_number < 0) ? "*invalid tag*" :
+ (me->sp->tag_number >= HTML_ELEMENTS) ? "special tag" :
HTML_dtd.tags[me->sp->tag_number].name));
#ifdef CAREFUL /* parser assumed to produce good nesting */
- /* panic */
+ /* panic */
#endif /* CAREFUL */
}
/*
- * If we're seeking MAPs, skip everything that's
- * not a MAP or AREA tag. - FM
+ * If we're seeking MAPs, skip everything that's not a MAP or AREA tag. -
+ * FM
*/
if (LYMapsOnly) {
if (!(element_number == HTML_MAP || element_number == HTML_AREA ||
@@ -5731,8 +5691,8 @@ PRIVATE int HTML_end_element ARGS3(
}
/*
- * Pop state off stack if we didn't declare the element
- * SGML_EMPTY in HTMLDTD.c. - FM & KW
+ * Pop state off stack if we didn't declare the element SGML_EMPTY in
+ * HTMLDTD.c. - FM & KW
*/
if (HTML_dtd.tags[element_number].contents != SGML_EMPTY) {
skip_stack_requested = (BOOL) (me->skip_stack > 0);
@@ -5751,9 +5711,8 @@ PRIVATE int HTML_end_element ARGS3(
element_number == HTML_H6 ||
element_number == HTML_H6)) {
/*
- * Set the break flag if we're popping
- * a dummy HTML_LH substituted for an
- * HTML_H# encountered in a list.
+ * Set the break flag if we're popping a dummy HTML_LH substituted
+ * for an HTML_H# encountered in a list.
*/
BreakFlag = TRUE;
}
@@ -5763,67 +5722,63 @@ PRIVATE int HTML_end_element ARGS3(
me->sp[0].tag_number = HTML_OBJECT;
if (me->skip_stack > 0) {
CTRACE2(TRACE_STYLE,
- (tfp, "HTML:end_element: Internal call (level %d), leaving on stack - %s\n",
- me->skip_stack, NONNULL(me->sp->style->name)));
+ (tfp,
+ "HTML:end_element: Internal call (level %d), leaving on stack - %s\n",
+ me->skip_stack, NONNULL(me->sp->style->name)));
me->skip_stack--;
} else if (element_number == HTML_OBJECT &&
me->sp[0].tag_number != HTML_OBJECT &&
me->sp[0].tag_number != HTML_OBJECT_M &&
me->objects_mixed_open > 0 &&
!(me->objects_figged_open > 0 &&
- me->sp[0].tag_number == HTML_FIG)) {
+ me->sp[0].tag_number == HTML_FIG)) {
/*
- * Ignore non-corresponding OBJECT tags that we
- * didn't push because the SGML parser was supposed
- * to go on parsing the contents non-literally. - kw
+ * Ignore non-corresponding OBJECT tags that we didn't push because
+ * the SGML parser was supposed to go on parsing the contents
+ * non-literally. - kw
*/
CTRACE2(TRACE_STYLE,
(tfp, "HTML:end_element[%d]: %s (level %d), %s - %s\n",
- (int) STACKLEVEL(me),
- "Special OBJECT handling", me->objects_mixed_open,
- "leaving on stack",
- NONNULL(me->sp->style->name)));
+ (int) STACKLEVEL(me),
+ "Special OBJECT handling", me->objects_mixed_open,
+ "leaving on stack",
+ NONNULL(me->sp->style->name)));
me->objects_mixed_open--;
} else if (me->stack_overrun == TRUE &&
- element_number != me->sp[0].tag_number) {
+ element_number != me->sp[0].tag_number) {
/*
- * Ignore non-corresponding tags if we had
- * a stack overrun. This is not a completely
- * fail-safe strategy for protection against
- * any seriously adverse consequences of a
- * stack overrun, and the rendering of the
- * document will not be as intended, but we
- * expect overruns to be rare, and this should
- * offer reasonable protection against crashes
- * if an overrun does occur. - FM
+ * Ignore non-corresponding tags if we had a stack overrun. This
+ * is not a completely fail-safe strategy for protection against
+ * any seriously adverse consequences of a stack overrun, and the
+ * rendering of the document will not be as intended, but we expect
+ * overruns to be rare, and this should offer reasonable protection
+ * against crashes if an overrun does occur. - FM
*/
- return HT_OK; /* let's pretend... */
+ return HT_OK; /* let's pretend... */
} else if (element_number == HTML_SELECT &&
- me->sp[0].tag_number != HTML_SELECT) {
+ me->sp[0].tag_number != HTML_SELECT) {
/*
- * Ignore non-corresponding SELECT tags, since we
- * probably popped it and closed the SELECT block
- * to deal with markup which amounts to a nested
- * SELECT, or an out of order FORM end tag. - FM
+ * Ignore non-corresponding SELECT tags, since we probably popped
+ * it and closed the SELECT block to deal with markup which amounts
+ * to a nested SELECT, or an out of order FORM end tag. - FM
*/
return HT_OK;
} else if ((element_number != me->sp[0].tag_number) &&
- HTML_dtd.tags[HTML_LH].contents == SGML_EMPTY &&
- (me->sp[0].tag_number == HTML_UL ||
- me->sp[0].tag_number == HTML_OL ||
- me->sp[0].tag_number == HTML_MENU ||
- me->sp[0].tag_number == HTML_DIR ||
- me->sp[0].tag_number == HTML_LI) &&
- (element_number == HTML_H1 ||
- element_number == HTML_H2 ||
- element_number == HTML_H3 ||
- element_number == HTML_H4 ||
- element_number == HTML_H6 ||
- element_number == HTML_H6)) {
+ HTML_dtd.tags[HTML_LH].contents == SGML_EMPTY &&
+ (me->sp[0].tag_number == HTML_UL ||
+ me->sp[0].tag_number == HTML_OL ||
+ me->sp[0].tag_number == HTML_MENU ||
+ me->sp[0].tag_number == HTML_DIR ||
+ me->sp[0].tag_number == HTML_LI) &&
+ (element_number == HTML_H1 ||
+ element_number == HTML_H2 ||
+ element_number == HTML_H3 ||
+ element_number == HTML_H4 ||
+ element_number == HTML_H6 ||
+ element_number == HTML_H6)) {
/*
- * It's an H# for which we substituted
- * an HTML_LH, which we've declared as
- * SGML_EMPTY, so just return. - FM
+ * It's an H# for which we substituted an HTML_LH, which we've
+ * declared as SGML_EMPTY, so just return. - FM
*/
return HT_OK;
} else if (me->sp < (me->stack + MAX_NESTING - 1)) {
@@ -5835,41 +5790,43 @@ PRIVATE int HTML_end_element ARGS3(
if (me->sp[0].tag_number == HTML_FIG &&
me->objects_figged_open > 0) {
/*
- * It's an OBJECT for which we substituted a FIG,
- * so pop the FIG and pretend that's what we are
- * being called for. - kw
+ * It's an OBJECT for which we substituted a FIG, so pop
+ * the FIG and pretend that's what we are being called for.
+ * - kw
*/
CTRACE2(TRACE_STYLE,
- (tfp, "HTML:end_element[%d]: %s (level %d), %s - %s\n",
- (int) STACKLEVEL(me),
- "Special OBJECT->FIG handling",
- me->objects_figged_open,
- "treating as end FIG",
- NONNULL(me->sp->style->name)));
+ (tfp,
+ "HTML:end_element[%d]: %s (level %d), %s - %s\n",
+ (int) STACKLEVEL(me),
+ "Special OBJECT->FIG handling",
+ me->objects_figged_open,
+ "treating as end FIG",
+ NONNULL(me->sp->style->name)));
me->objects_figged_open--;
element_number = HTML_FIG;
}
}
(me->sp)++;
CTRACE2(TRACE_STYLE,
- (tfp, "HTML:end_element[%d]: Popped style off stack - %s\n",
- (int) STACKLEVEL(me),
- NONNULL(me->sp->style->name)));
+ (tfp,
+ "HTML:end_element[%d]: Popped style off stack - %s\n",
+ (int) STACKLEVEL(me),
+ NONNULL(me->sp->style->name)));
} else {
CTRACE2(TRACE_STYLE, (tfp,
- "Stack underflow error! Tried to pop off more styles than exist in stack\n"));
+ "Stack underflow error! Tried to pop off more styles than exist in stack\n"));
}
}
if (BreakFlag == TRUE) {
#ifdef EXP_JUSTIFY_ELTS
- if (reached_awaited_stacked_elt)
- wait_for_this_stacked_elt=-1;
+ if (reached_awaited_stacked_elt)
+ wait_for_this_stacked_elt = -1;
#endif
- return HT_OK; /* let's pretend... */
+ return HT_OK; /* let's pretend... */
}
/*
- * Check for unclosed TEXTAREA. - FM
+ * Check for unclosed TEXTAREA. - FM
*/
if (me->inTEXTAREA && element_number != HTML_TEXTAREA) {
if (LYBadHTML(me))
@@ -5881,9 +5838,9 @@ PRIVATE int HTML_end_element ARGS3(
}
/*
- * Handle the end tag. - FM
+ * Handle the end tag. - FM
*/
- switch(element_number) {
+ switch (element_number) {
case HTML_HTML:
if (me->inA || me->inSELECT || me->inTEXTAREA) {
@@ -5893,7 +5850,9 @@ PRIVATE int HTML_end_element ARGS3(
me->inSELECT ? "SELECT" : "",
(me->inSELECT && me->inTEXTAREA) ? ", " : "",
me->inTEXTAREA ? "TEXTAREA" : "",
- ((me->inSELECT || me->inTEXTAREA) && me->inA) ? ", " : "",
+ (((me->inSELECT || me->inTEXTAREA) && me->inA)
+ ? ", "
+ : ""),
me->inA ? "A" : ""));
}
break;
@@ -5902,12 +5861,11 @@ PRIVATE int HTML_end_element ARGS3(
if (me->inBASE &&
(LYIsUIPage3(me->node_anchor->address, UIP_LIST_PAGE, 0) ||
LYIsUIPage3(me->node_anchor->address, UIP_ADDRLIST_PAGE, 0))) {
- /* If we are parsing the List Page, and have a BASE after
- * we are done with the HEAD element, propagate it back
- * to the node_anchor object. The base should have been
- * inserted by showlist() to record what document the List
- * Page is about, and other functions may later look for it
- * in the anchor. - kw
+ /* If we are parsing the List Page, and have a BASE after we are
+ * done with the HEAD element, propagate it back to the node_anchor
+ * object. The base should have been inserted by showlist() to
+ * record what document the List Page is about, and other functions
+ * may later look for it in the anchor. - kw
*/
StrAllocCopy(me->node_anchor->content_base, me->base_href);
}
@@ -5920,19 +5878,17 @@ PRIVATE int HTML_end_element ARGS3(
HTAnchor_setTitle(me->node_anchor, me->title.data);
HTChunkClear(&me->title);
/*
- * Check if it's a bookmark file, and if so, and multiple
- * bookmark support is on, or it's off but this isn't the
- * default bookmark file (e.g., because it was on before,
- * and this is another bookmark file that has been retrieved
- * as a previous document), insert the current description
- * string and filepath for it. We pass the strings back to
- * the SGML parser so that any 8 bit or multibyte/CJK
- * characters will be handled by the parser's state and
- * charset routines. - FM
+ * Check if it's a bookmark file, and if so, and multiple bookmark
+ * support is on, or it's off but this isn't the default bookmark file
+ * (e.g., because it was on before, and this is another bookmark file
+ * that has been retrieved as a previous document), insert the current
+ * description string and filepath for it. We pass the strings back to
+ * the SGML parser so that any 8 bit or multibyte/CJK characters will
+ * be handled by the parser's state and charset routines. - FM
*/
- if (me->node_anchor->bookmark && *me->node_anchor->bookmark) {
+ if (non_empty(me->node_anchor->bookmark)) {
if ((LYMultiBookmarks != MBM_OFF) ||
- ((bookmark_page && *bookmark_page) &&
+ (non_empty(bookmark_page) &&
strcmp(me->node_anchor->bookmark, bookmark_page))) {
if (!include)
include = &me->xinclude;
@@ -5946,7 +5902,7 @@ PRIVATE int HTML_end_element ARGS3(
StrAllocCopy(temp,
((MBM_A_subdescript[i] &&
*MBM_A_subdescript[i]) ?
- MBM_A_subdescript[i] : gettext("(none)")));
+ MBM_A_subdescript[i] : gettext("(none)")));
LYEntify(&temp, TRUE);
StrAllocCat(*include, temp);
StrAllocCat(*include, "<BR><EM>&nbsp;&nbsp;&nbsp;");
@@ -5954,8 +5910,9 @@ PRIVATE int HTML_end_element ARGS3(
StrAllocCat(*include, "</EM> ");
StrAllocCopy(temp,
((MBM_A_subbookmark[i] &&
- *MBM_A_subbookmark[i]) ?
- MBM_A_subbookmark[i] : gettext("(unknown)")));
+ *MBM_A_subbookmark[i])
+ ? MBM_A_subbookmark[i]
+ : gettext("(unknown)")));
LYEntify(&temp, TRUE);
StrAllocCat(*include, temp);
FREE(temp);
@@ -5969,24 +5926,24 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_STYLE:
/*
- * We're getting it as Literal text, which, for now,
- * we'll just ignore. - FM
+ * We're getting it as Literal text, which, for now, we'll just ignore.
+ * - FM
*/
HTChunkTerminate(&me->style_block);
CTRACE2(TRACE_STYLE,
(tfp, "HTML: STYLE content =\n%s\n",
- me->style_block.data));
+ me->style_block.data));
HTChunkClear(&me->style_block);
break;
case HTML_SCRIPT:
/*
- * We're getting it as Literal text, which, for now,
- * we'll just ignore. - FM
+ * We're getting it as Literal text, which, for now, we'll just ignore.
+ * - FM
*/
HTChunkTerminate(&me->script);
CTRACE((tfp, "HTML: SCRIPT content =\n%s\n",
- me->script.data));
+ me->script.data));
HTChunkClear(&me->script);
break;
@@ -5998,20 +5955,22 @@ PRIVATE int HTML_end_element ARGS3(
me->inSELECT ? "SELECT" : "",
(me->inSELECT && me->inTEXTAREA) ? ", " : "",
me->inTEXTAREA ? "TEXTAREA" : "",
- ((me->inSELECT || me->inTEXTAREA) && me->inA) ? ", " : "",
+ (((me->inSELECT || me->inTEXTAREA) && me->inA)
+ ? ", "
+ : ""),
me->inA ? "A" : ""));
}
break;
case HTML_FRAMESET:
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_NOFRAMES:
case HTML_IFRAME:
LYEnsureDoubleSpace(me);
LYResetParagraphAlignment(me);
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_BANNER:
@@ -6019,11 +5978,10 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_BLOCKQUOTE:
case HTML_BQ:
case HTML_ADDRESS:
- /*
- * Set flag to know that style has ended.
- * Fall through.
- i_prior_style = -1;
- */
+ /*
+ * Set flag to know that style has ended. Fall through.
+ i_prior_style = -1;
+ */
change_paragraph_style(me, me->sp->style);
UPDATE_STYLE;
if (me->sp->tag_number == element_number)
@@ -6042,7 +6000,7 @@ PRIVATE int HTML_end_element ARGS3(
if (me->inP)
LYEnsureSingleSpace(me);
me->sp->style->alignment =
- me->DivisionAlignments[me->Division_Level];
+ me->DivisionAlignments[me->Division_Level];
}
}
change_paragraph_style(me, me->sp->style);
@@ -6055,7 +6013,7 @@ PRIVATE int HTML_end_element ARGS3(
me->current_default_alignment = me->sp->style->alignment;
break;
- case HTML_H1: /* header styles */
+ case HTML_H1: /* header styles */
case HTML_H2:
case HTML_H3:
case HTML_H4:
@@ -6063,7 +6021,7 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_H6:
if (me->Division_Level >= 0) {
me->sp->style->alignment =
- me->DivisionAlignments[me->Division_Level];
+ me->DivisionAlignments[me->Division_Level];
} else if (me->sp->style->id == ST_HeadingCenter ||
me->sp->style->id == ST_Heading1) {
me->sp->style->alignment = HT_CENTER;
@@ -6090,33 +6048,33 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_P:
LYHandlePlike(me,
- (CONST BOOL*)0, (CONST char **)0,
- include, 0,
- FALSE);
+ (const BOOL *) 0, (const char **) 0,
+ include, 0,
+ FALSE);
break;
case HTML_FONT:
me->inFONT = FALSE;
break;
- case HTML_B: /* Physical character highlighting */
+ case HTML_B: /* Physical character highlighting */
case HTML_BLINK:
case HTML_I:
case HTML_U:
- case HTML_CITE: /* Logical character highlighting */
+ case HTML_CITE: /* Logical character highlighting */
case HTML_EM:
case HTML_STRONG:
/*
- * Ignore any emphasis end tags if the
- * Underline_Level is not set. - FM
+ * Ignore any emphasis end tags if the Underline_Level is not set. -
+ * FM
*/
if (me->Underline_Level <= 0)
break;
/*
- * Adjust the Underline level counter, and
- * turn off underlining if appropriate. - FM
+ * Adjust the Underline level counter, and turn off underlining if
+ * appropriate. - FM
*/
me->Underline_Level--;
if (me->inUnderline && me->Underline_Level < 1) {
@@ -6128,7 +6086,7 @@ PRIVATE int HTML_end_element ARGS3(
}
break;
- case HTML_ABBREV: /* Miscellaneous character containers */
+ case HTML_ABBREV: /* Miscellaneous character containers */
case HTML_ACRONYM:
case HTML_AU:
case HTML_AUTHOR:
@@ -6175,11 +6133,10 @@ PRIVATE int HTML_end_element ARGS3(
if (me->Quote_Level > 0)
me->Quote_Level--;
/*
- * Should check LANG and/or DIR attributes, and the
- * me->node_anchor->charset and/or yet to be added
- * structure elements, to determine whether we should
- * use chevrons, but for now we'll always use double-
- * or single-quotes. - FM
+ * Should check LANG and/or DIR attributes, and the
+ * me->node_anchor->charset and/or yet to be added structure elements,
+ * to determine whether we should use chevrons, but for now we'll
+ * always use double- or single-quotes. - FM
*/
if (!(me->Quote_Level & 1))
HTML_put_character(me, '"');
@@ -6187,20 +6144,21 @@ PRIVATE int HTML_end_element ARGS3(
HTML_put_character(me, '\'');
break;
- case HTML_PRE: /* Formatted text */
+ case HTML_PRE: /* Formatted text */
/*
- * Set to know that we are no longer in a PRE block.
+ * Set to know that we are no longer in a PRE block.
*/
+ HText_appendCharacter(me->text, '\n');
me->inPRE = FALSE;
/* FALLTHRU */
- case HTML_LISTING: /* Literal text */
+ case HTML_LISTING: /* Literal text */
/* FALLTHRU */
case HTML_XMP:
/* FALLTHRU */
case HTML_PLAINTEXT:
if (me->comment_start)
HText_appendText(me->text, me->comment_start);
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
if (me->List_Nesting_Level >= 0) {
UPDATE_STYLE;
HText_NegateLineOne(me->text);
@@ -6209,7 +6167,7 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_NOTE:
case HTML_FN:
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
UPDATE_STYLE;
if (me->sp->tag_number == element_number)
LYEnsureDoubleSpace(me);
@@ -6220,7 +6178,7 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_OL:
me->OL_Counter[me->List_Nesting_Level < 11 ?
- me->List_Nesting_Level : 11] = OL_VOID;
+ me->List_Nesting_Level : 11] = OL_VOID;
/* FALLTHRU */
case HTML_DL:
/* FALLTHRU */
@@ -6231,12 +6189,12 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_DIR:
me->List_Nesting_Level--;
CTRACE((tfp, "HTML_end_element: Reducing List Nesting Level to %d\n",
- me->List_Nesting_Level));
+ me->List_Nesting_Level));
#ifdef EXP_JUSTIFY_ELTS
if (element_number == HTML_DL)
- in_DT = FALSE; /*close the term that was without definition. */
+ in_DT = FALSE; /*close the term that was without definition. */
#endif
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
UPDATE_STYLE;
if (me->List_Nesting_Level >= 0)
LYEnsureSingleSpace(me);
@@ -6244,34 +6202,34 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_SPAN:
/*
- * Should undo anything we did based on LANG and/or DIR
- * attributes, and the me->node_anchor->charset and/or
- * yet to be added structure elements. - FM
+ * Should undo anything we did based on LANG and/or DIR attributes, and
+ * the me->node_anchor->charset and/or yet to be added structure
+ * elements. - FM
*/
break;
case HTML_BDO:
/*
- * Should undo anything we did based on DIR (and/or LANG)
- * attributes, and the me->node_anchor->charset and/or
- * yet to be added structure elements. - FM
+ * Should undo anything we did based on DIR (and/or LANG) attributes,
+ * and the me->node_anchor->charset and/or yet to be added structure
+ * elements. - FM
*/
break;
case HTML_A:
/*
- * Ignore any spurious A end tags. - FM
+ * Ignore any spurious A end tags. - FM
*/
if (me->inA == FALSE)
break;
/*
- * Set to know that we are no longer in an anchor.
+ * Set to know that we are no longer in an anchor.
*/
me->inA = FALSE;
#ifdef MARK_HIDDEN_LINKS
- if (hidden_link_marker && *hidden_link_marker &&
- HText_isAnchorBlank(me->text, me->CurrentANum) ) {
- HText_appendText(me->text,hidden_link_marker);
+ if (non_empty(hidden_link_marker) &&
+ HText_isAnchorBlank(me->text, me->CurrentANum)) {
+ HText_appendText(me->text, hidden_link_marker);
}
#endif
UPDATE_STYLE;
@@ -6292,18 +6250,18 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_BODYTEXT:
/*
- * We may need to look at this someday to deal with
- * OBJECTs optimally, but just ignore it for now. - FM
+ * We may need to look at this someday to deal with OBJECTs optimally,
+ * but just ignore it for now. - FM
*/
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_TEXTFLOW:
/*
- * We may need to look at this someday to deal with
- * APPLETs optimally, but just ignore it for now. - FM
+ * We may need to look at this someday to deal with APPLETs optimally,
+ * but just ignore it for now. - FM
*/
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_FIG:
@@ -6316,7 +6274,7 @@ PRIVATE int HTML_end_element ARGS3(
case HTML_OBJECT:
/*
- * Finish the data off.
+ * Finish the data off.
*/
{
int s = 0, e = 0;
@@ -6329,46 +6287,46 @@ PRIVATE int HTML_end_element ARGS3(
data = me->object.data;
while ((cp = strchr(data, '<')) != NULL) {
/*
- * Look for nested OBJECTs. This procedure
- * could get tripped up if invalid comments
- * are present in the content, or if an OBJECT
- * end tag is present in a quoted attribute. - FM
+ * Look for nested OBJECTs. This procedure could get tripped
+ * up if invalid comments are present in the content, or if an
+ * OBJECT end tag is present in a quoted attribute. - FM
*/
if (!strncmp(cp, "<!--", 4)) {
data = LYFindEndOfComment(cp);
cp = data;
} else if (s == 0 && !strncasecomp(cp, "<PARAM", 6) &&
- !IsNmChar(cp[6])) {
+ !IsNmChar(cp[6])) {
have_param = TRUE;
} else if (!strncasecomp(cp, "<OBJECT", 7) &&
- !IsNmChar(cp[7])) {
+ !IsNmChar(cp[7])) {
if (s == 0)
start = cp;
s++;
} else if (!strncasecomp(cp, "</OBJECT", 8) &&
- !IsNmChar(cp[8])) {
+ !IsNmChar(cp[8])) {
if (e == 0)
first_end = cp;
last_end = cp;
e++;
} else if (!strncasecomp(cp, "<MAP", 4) &&
- !IsNmChar(cp[4])) {
+ !IsNmChar(cp[4])) {
if (!first_map)
first_map = cp;
last_map = cp;
} else if (!strncasecomp(cp, "</MAP", 5) &&
- !IsNmChar(cp[5])) {
+ !IsNmChar(cp[5])) {
last_map = cp;
}
data = ++cp;
}
if (s < e) {
/*
- * We had more end tags than start tags, so
- * we have bad HTML or otherwise misparsed. - FM
+ * We had more end tags than start tags, so we have bad HTML or
+ * otherwise misparsed. - FM
*/
if (LYBadHTML(me))
- CTRACE((tfp, "Bad HTML: Unmatched OBJECT start and end tags. Discarding content:\n%s\n",
+ CTRACE((tfp,
+ "Bad HTML: Unmatched OBJECT start and end tags. Discarding content:\n%s\n",
me->object.data));
goto End_Object;
}
@@ -6383,21 +6341,21 @@ PRIVATE int HTML_end_element ARGS3(
me->object_codebase == NULL &&
me->object_codetype == NULL)) {
/*
- * We have nested OBJECT tags, and not yet all of the
- * end tags, but have a case where the content needs
- * to be parsed again (not dropped) and where we don't
- * want to output anything special at the point when we
- * *do* have accumulated all the end tags. So recycle
- * the incomplete contents now, and signal the SGML
- * parser that it should not regard the current OBJECT
- * ended but should treat its contents as mixed.
- * Normally these cases would have already handled
- * in the real start_element call, so this block may
- * not be necessary. - kw
+ * We have nested OBJECT tags, and not yet all of the end
+ * tags, but have a case where the content needs to be
+ * parsed again (not dropped) and where we don't want to
+ * output anything special at the point when we
+ * *do* have accumulated all the end tags. So recycle
+ * the incomplete contents now, and signal the SGML parser
+ * that it should not regard the current OBJECT ended but
+ * should treat its contents as mixed. Normally these
+ * cases would have already handled in the real
+ * start_element call, so this block may not be necessary.
+ * - kw
*/
CTRACE((tfp, "%s:\n%s\n",
- "HTML: Nested OBJECT tags. Recycling incomplete contents",
- me->object.data));
+ "HTML: Nested OBJECT tags. Recycling incomplete contents",
+ me->object.data));
status = HT_PARSER_OTHER_CONTENT;
me->object.size--;
HTChunkPuts(&me->object, "</OBJECT>");
@@ -6406,17 +6364,17 @@ PRIVATE int HTML_end_element ARGS3(
StrnAllocCat(*include, me->object.data, me->object.size);
clear_objectdata(me);
/* an internal fake call to keep our stack happy: */
- HTML_start_element(me, HTML_OBJECT, NULL,NULL,
+ HTML_start_element(me, HTML_OBJECT, NULL, NULL,
me->tag_charset, include);
break;
}
/*
- * We have nested OBJECT tags, and not yet all of the
- * end tags, and we want the end tags. So restore an
- * end tag to the content, and signal to the SGML parser
- * that it should resume the accumulation of OBJECT content
- * (after calling back to start_element) in a way that
- * is equivalent to passing it a dummy start tag. - FM, kw
+ * We have nested OBJECT tags, and not yet all of the end tags,
+ * and we want the end tags. So restore an end tag to the
+ * content, and signal to the SGML parser that it should resume
+ * the accumulation of OBJECT content (after calling back to
+ * start_element) in a way that is equivalent to passing it a
+ * dummy start tag. - FM, kw
*/
CTRACE((tfp, "HTML: Nested OBJECT tags. Recycling.\n"));
status = HT_PARSER_REOPEN_ELT;
@@ -6428,59 +6386,55 @@ PRIVATE int HTML_end_element ARGS3(
}
/*
- * OBJECT start and end tags are fully matched,
- * assuming we weren't tripped up by comments
- * or quoted attributes. - FM
+ * OBJECT start and end tags are fully matched, assuming we weren't
+ * tripped up by comments or quoted attributes. - FM
*/
CTRACE((tfp, "HTML:OBJECT content:\n%s\n", me->object.data));
/*
- * OBJECTs with DECLARE should be saved but
- * not instantiated, and if nested, can have
- * only other DECLAREd OBJECTs. Until we have
- * code to handle these, we'll just create an
- * anchor for the ID, if present, and discard
- * the content (sigh 8-). - FM
+ * OBJECTs with DECLARE should be saved but not instantiated, and
+ * if nested, can have only other DECLAREd OBJECTs. Until we have
+ * code to handle these, we'll just create an anchor for the ID, if
+ * present, and discard the content (sigh 8-). - FM
*/
if (me->object_declare == TRUE) {
- if (me->object_id && *me->object_id && !LYMapsOnly)
+ if (non_empty(me->object_id) && !LYMapsOnly)
LYHandleID(me, me->object_id);
CTRACE((tfp, "HTML: DECLAREd OBJECT. Ignoring!\n"));
goto End_Object;
}
/*
- * OBJECTs with NAME are for FORM submissions.
- * We'll just create an anchor for the ID, if
- * present, and discard the content until we
- * have code to handle these. (sigh 8-). - FM
+ * OBJECTs with NAME are for FORM submissions. We'll just create
+ * an anchor for the ID, if present, and discard the content until
+ * we have code to handle these. (sigh 8-). - FM
*/
if (me->object_name != NULL && !LYMapsOnly) {
- if (me->object_id && *me->object_id)
+ if (non_empty(me->object_id))
LYHandleID(me, me->object_id);
CTRACE((tfp, "HTML: NAMEd OBJECT. Ignoring!\n"));
goto End_Object;
}
/*
- * Deal with any nested OBJECTs by descending
- * to the inner-most OBJECT. - FM
+ * Deal with any nested OBJECTs by descending to the inner-most
+ * OBJECT. - FM
*/
if (s > 0) {
if (start != NULL &&
first_end != NULL && first_end > start) {
/*
- * Minumum requirements for the ad hoc parsing
- * to have succeeded are met. We'll hope that
- * it did succeed. - FM
+ * Minumum requirements for the ad hoc parsing to have
+ * succeeded are met. We'll hope that it did succeed. -
+ * FM
*/
if (LYMapsOnly) {
/*
- * Well we don't need to do this any more,
- * nested objects should either not get here
- * any more at all or can be handled fine by
- * other code below. Leave in place for now
- * as a special case for LYMapsOnly. - kw
+ * Well we don't need to do this any more, nested
+ * objects should either not get here any more at all
+ * or can be handled fine by other code below. Leave
+ * in place for now as a special case for LYMapsOnly.
+ * - kw
*/
if (LYMapsOnly && (!last_map || last_map < first_end))
*first_end = '\0';
@@ -6500,23 +6454,24 @@ PRIVATE int HTML_end_element ARGS3(
include = &me->xinclude;
StrAllocCat(*include, data);
CTRACE((tfp, "HTML: Recycling nested OBJECT%s.\n",
- (s > 1) ? "s" : ""));
+ (s > 1) ? "s" : ""));
FREE(data);
goto End_Object;
}
} else {
if (LYBadHTML(me))
- CTRACE((tfp, "Bad HTML: Unmatched OBJECT start and end tags. Discarding content.\n"));
+ CTRACE((tfp,
+ "Bad HTML: Unmatched OBJECT start and end tags. Discarding content.\n"));
goto End_Object;
}
}
/*
- * If its content has SHAPES, convert it to FIG. - FM
+ * If its content has SHAPES, convert it to FIG. - FM
*
- * This is now handled in our start_element without using
- * include if the SGML parser cooperates, so this block
- * may be unnecessary. - kw
+ * This is now handled in our start_element without using include
+ * if the SGML parser cooperates, so this block may be unnecessary.
+ * - kw
*/
if (me->object_shapes == TRUE && !LYMapsOnly) {
CTRACE((tfp, "HTML: OBJECT has SHAPES. Converting to FIG.\n"));
@@ -6545,8 +6500,8 @@ PRIVATE int HTML_end_element ARGS3(
}
/*
- * If it has a USEMAP attribute and didn't have SHAPES,
- * convert it to IMG. - FM
+ * If it has a USEMAP attribute and didn't have SHAPES, convert it
+ * to IMG. - FM
*/
if (me->object_usemap != NULL && !LYMapsOnly) {
CTRACE((tfp, "HTML: OBJECT has USEMAP. Converting to IMG.\n"));
@@ -6556,7 +6511,7 @@ PRIVATE int HTML_end_element ARGS3(
StrAllocCat(*include, "<IMG ISOBJECT");
if (me->object_id != NULL) {
/*
- * Pass the ID. - FM
+ * Pass the ID. - FM
*/
StrAllocCat(*include, " ID=\"");
StrAllocCat(*include, me->object_id);
@@ -6565,8 +6520,8 @@ PRIVATE int HTML_end_element ARGS3(
if (me->object_data != NULL &&
me->object_classid == NULL) {
/*
- * We have DATA with no CLASSID, so let's
- * hope it' equivalent to an SRC. - FM
+ * We have DATA with no CLASSID, so let's hope it'
+ * equivalent to an SRC. - FM
*/
StrAllocCat(*include, " SRC=\"");
StrAllocCat(*include, me->object_data);
@@ -6574,8 +6529,7 @@ PRIVATE int HTML_end_element ARGS3(
}
if (me->object_title != NULL) {
/*
- * Use the TITLE for both the MAP
- * and the IMGs ALT. - FM
+ * Use the TITLE for both the MAP and the IMGs ALT. - FM
*/
StrAllocCat(*include, " TITLE=\"");
StrAllocCat(*include, me->object_title);
@@ -6584,7 +6538,7 @@ PRIVATE int HTML_end_element ARGS3(
StrAllocCat(*include, "\"");
}
/*
- * Add the USEMAP, and an ISMAP if present. - FM
+ * Add the USEMAP, and an ISMAP if present. - FM
*/
if (me->object_usemap != NULL) {
StrAllocCat(*include, " USEMAP=\"");
@@ -6597,17 +6551,17 @@ PRIVATE int HTML_end_element ARGS3(
StrAllocCat(*include, ">");
}
/*
- * Add the content if it has <MAP, since that may
- * be the MAP this usemap points to. But if we have
- * nested objects, try to eliminate portions that
- * cannot contribute to the quest for MAP. This is
- * not perfect, we may get too much content; this seems
- * preferable over losing too much. - kw
+ * Add the content if it has <MAP, since that may be the MAP
+ * this usemap points to. But if we have nested objects, try
+ * to eliminate portions that cannot contribute to the quest
+ * for MAP. This is not perfect, we may get too much content;
+ * this seems preferable over losing too much. - kw
*/
if (first_map) {
if (s == 0) {
StrAllocCat(*include, me->object.data);
- CTRACE((tfp, "HTML: MAP found, recycling object contents.\n"));
+ CTRACE((tfp,
+ "HTML: MAP found, recycling object contents.\n"));
goto End_Object;
}
/* s > 0 and s == e */
@@ -6638,8 +6592,8 @@ PRIVATE int HTML_end_element ARGS3(
StrAllocCat(data, "</OBJECT>");
}
CTRACE((tfp, "%s:\n%s\n",
- "HTML: MAP and nested OBJECT tags. Recycling parts",
- data));
+ "HTML: MAP and nested OBJECT tags. Recycling parts",
+ data));
StrAllocCat(*include, data);
FREE(data);
}
@@ -6647,13 +6601,13 @@ PRIVATE int HTML_end_element ARGS3(
}
/*
- * Add an ID link if needed. - FM
+ * Add an ID link if needed. - FM
*/
- if (me->object_id && *me->object_id && !LYMapsOnly)
+ if (non_empty(me->object_id) && !LYMapsOnly)
LYHandleID(me, me->object_id);
/*
- * Add the OBJECTs content if not empty. - FM
+ * Add the OBJECTs content if not empty. - FM
*/
if (me->object.size > 1) {
if (!include) /* error, should not happen */
@@ -6662,12 +6616,10 @@ PRIVATE int HTML_end_element ARGS3(
}
/*
- * Create a link to the DATA, if desired, and
- * we can rule out that it involves scripting
- * code. This a risky thing to do, but we can
- * toggle clickable_images mode off if it really
- * screws things up, and so we may as well give
- * it a try. - FM
+ * Create a link to the DATA, if desired, and we can rule out that
+ * it involves scripting code. This a risky thing to do, but we
+ * can toggle clickable_images mode off if it really screws things
+ * up, and so we may as well give it a try. - FM
*/
if (clickable_images) {
if (!LYMapsOnly &&
@@ -6677,12 +6629,11 @@ PRIVATE int HTML_end_element ARGS3(
me->object_codebase == NULL &&
me->object_codetype == NULL) {
/*
- * We have a DATA value and no need for scripting
- * code, so close the current Anchor, if one is
- * open, and add an Anchor for this source. If
- * we also have a TYPE value, check whether it's
- * an image or not, and set the link name
- * accordingly. - FM
+ * We have a DATA value and no need for scripting code, so
+ * close the current Anchor, if one is open, and add an
+ * Anchor for this source. If we also have a TYPE value,
+ * check whether it's an image or not, and set the link
+ * name accordingly. - FM
*/
if (!include) /* error, should not happen */
include = &me->xinclude;
@@ -6703,32 +6654,32 @@ PRIVATE int HTML_end_element ARGS3(
}
/*
- * Re-intialize all of the OBJECT elements. - FM
+ * Re-intialize all of the OBJECT elements. - FM
*/
-End_Object:
+ End_Object:
clear_objectdata(me);
if (!LYMapsOnly)
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_APPLET:
if (me->inAPPLETwithP) {
LYEnsureDoubleSpace(me);
} else {
- HTML_put_character(me, ' '); /* space char may be ignored */
+ HTML_put_character(me, ' '); /* space char may be ignored */
}
LYResetParagraphAlignment(me);
me->inAPPLETwithP = FALSE;
me->inAPPLET = FALSE;
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_CAPTION:
LYEnsureDoubleSpace(me);
LYResetParagraphAlignment(me);
me->inCAPTION = FALSE;
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
me->inLABEL = FALSE;
break;
@@ -6736,16 +6687,15 @@ End_Object:
LYEnsureDoubleSpace(me);
LYResetParagraphAlignment(me);
me->inCREDIT = FALSE;
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
me->inLABEL = FALSE;
break;
case HTML_FORM:
/*
- * Check if we had a FORM start tag, and issue a
- * message if not, but fall through to check for
- * an open SELECT and ensure that the FORM-related
- * globals in GridText.c are initialized. - FM
+ * Check if we had a FORM start tag, and issue a message if not, but
+ * fall through to check for an open SELECT and ensure that the
+ * FORM-related globals in GridText.c are initialized. - FM
*/
if (!me->inFORM) {
if (LYBadHTML(me))
@@ -6754,19 +6704,18 @@ End_Object:
EMIT_IFDEF_EXP_JUSTIFY_ELTS(form_in_htext = FALSE);
/*
- * Check if we still have a SELECT element open.
- * FORM may have been declared SGML_EMPTY in HTMLDTD.c,
- * and in that case SGML_character() in SGML.c is
- * not able to ensure correct nesting; or it may have
- * failed to enforce valid nesting. If a SELECT is open,
- * issue a message, then
- * call HTML_end_element() directly (with a
- * check in that to bypass decrementing of the HTML
- * parser's stack) to close the SELECT. - kw
+ * Check if we still have a SELECT element open. FORM may have been
+ * declared SGML_EMPTY in HTMLDTD.c, and in that case SGML_character()
+ * in SGML.c is not able to ensure correct nesting; or it may have
+ * failed to enforce valid nesting. If a SELECT is open, issue a
+ * message, then call HTML_end_element() directly (with a check in that
+ * to bypass decrementing of the HTML parser's stack) to close the
+ * SELECT. - kw
*/
if (me->inSELECT) {
if (LYBadHTML(me))
- CTRACE((tfp, "Bad HTML: Open SELECT at FORM end. Faking SELECT end tag. *****\n"));
+ CTRACE((tfp,
+ "Bad HTML: Open SELECT at FORM end. Faking SELECT end tag. *****\n"));
if (me->sp->tag_number != HTML_SELECT) {
SET_SKIP_STACK(HTML_SELECT);
}
@@ -6774,17 +6723,16 @@ End_Object:
}
/*
- * Set to know that we are no longer in an form.
+ * Set to know that we are no longer in an form.
*/
me->inFORM = FALSE;
HText_endForm(me->text);
/*
- * If we are in a list and are on the first line
- * with no text following a bullet or number,
- * don't force a newline. This could happen if
- * we were called from HTML_start_element() due
- * to a missing FORM end tag. - FM
+ * If we are in a list and are on the first line with no text following
+ * a bullet or number, don't force a newline. This could happen if we
+ * were called from HTML_start_element() due to a missing FORM end tag.
+ * - FM
*/
if (!(me->List_Nesting_Level >= 0 && !me->inP))
LYEnsureSingleSpace(me);
@@ -6793,13 +6741,13 @@ End_Object:
case HTML_FIELDSET:
LYEnsureDoubleSpace(me);
LYResetParagraphAlignment(me);
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_LEGEND:
LYEnsureDoubleSpace(me);
LYResetParagraphAlignment(me);
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
case HTML_LABEL:
@@ -6815,7 +6763,7 @@ End_Object:
char *data;
/*
- * Make sure we had a textarea start tag.
+ * Make sure we had a textarea start tag.
*/
if (!me->inTEXTAREA) {
if (LYBadHTML(me))
@@ -6824,33 +6772,47 @@ End_Object:
}
/*
- * Set to know that we are no longer in a textarea tag.
+ * Set to know that we are no longer in a textarea tag.
*/
me->inTEXTAREA = FALSE;
/*
- * Initialize.
+ * Initialize.
*/
- I.align=NULL; I.accept=NULL; I.checked=NO; I.class=NULL;
- I.disabled=NO; I.error=NULL; I.height= NULL; I.id=NULL;
- I.lang=NULL; I.max=NULL; I.maxlength=NULL; I.md=NULL;
- I.min=NULL; I.name=NULL; I.size=0; I.src=NULL;
- I.type=NULL; I.value=NULL; I.width=NULL;
+ I.align = NULL;
+ I.accept = NULL;
+ I.checked = NO;
+ I.iclass = NULL;
+ I.disabled = NO;
+ I.error = NULL;
+ I.height = NULL;
+ I.id = NULL;
+ I.lang = NULL;
+ I.max = NULL;
+ I.maxlength = NULL;
+ I.md = NULL;
+ I.min = NULL;
+ I.name = NULL;
+ I.size = 0;
+ I.src = NULL;
+ I.type = NULL;
+ I.value = NULL;
+ I.width = NULL;
I.value_cs = current_char_set;
UPDATE_STYLE;
/*
- * Before any input field add a space if necessary.
+ * Before any input field add a space if necessary.
*/
HTML_put_character(me, ' ');
me->in_word = NO;
/*
- * Add a return.
+ * Add a return.
*/
HText_appendCharacter(me->text, '\r');
/*
- * Finish the data off.
+ * Finish the data off.
*/
HTChunkTerminate(&me->textarea);
FREE(temp);
@@ -6865,17 +6827,16 @@ End_Object:
I.id = me->textarea_id;
/*
- * Transform the TEXTAREA content as needed, then parse
- * it into individual lines to be handled as a series
- * series of INPUT fields (ugh!).
- * Any raw 8-bit or multibyte characters already have been
- * handled in relation to the display character set
- * in SGML_character().
+ * Transform the TEXTAREA content as needed, then parse it into
+ * individual lines to be handled as a series series of INPUT
+ * fields (ugh!). Any raw 8-bit or multibyte characters already
+ * have been handled in relation to the display character set in
+ * SGML_character().
*
- * If TEXTAREA is handled as SGML_LITTERAL (the old way),
- * we need to SGML-unescape any character references and NCRs
- * here. Otherwise this will already have happened in the
- * SGML.c parsing. - kw
+ * If TEXTAREA is handled as SGML_LITTERAL (the old way), we need
+ * to SGML-unescape any character references and NCRs here.
+ * Otherwise this will already have happened in the SGML.c parsing.
+ * - kw
*/
me->UsePlainSpace = TRUE;
@@ -6887,32 +6848,28 @@ End_Object:
me->UsePlainSpace, me->HiddenValue);
} else {
/*
- * This shouldn't have anything to do, normally, but
- * just in case...
- * There shouldn't be lynx special character codes in
- * the chunk ("DTD" flag Tgf_nolyspcl tells SGML.c not
- * to generate them). If there were, we could set the
- * last parameter ('Back') below to YES, which would
- * take them out of the data.
- * The data may however contain non break space, soft
- * hyphen, or en space etc., in the me->UCLYhndl character
- * encoding. If that's a problem, perhaps for the (line
- * or other) editor, setting 'Back' to YES should also
- * help to always convert them to plain spaces (or drop
- * them). - kw
+ * This shouldn't have anything to do, normally, but just in
+ * case... There shouldn't be lynx special character codes in
+ * the chunk ("DTD" flag Tgf_nolyspcl tells SGML.c not to
+ * generate them). If there were, we could set the last
+ * parameter ('Back') below to YES, which would take them out
+ * of the data. The data may however contain non break space,
+ * soft hyphen, or en space etc., in the me->UCLYhndl character
+ * encoding. If that's a problem, perhaps for the (line or
+ * other) editor, setting 'Back' to YES should also help to
+ * always convert them to plain spaces (or drop them). - kw
*/
TRANSLATE_HTML7(&me->textarea.data,
- me->UCLYhndl,
- current_char_set,
- NO,
- me->UsePlainSpace, me->HiddenValue,
- NO);
+ me->UCLYhndl,
+ current_char_set,
+ NO,
+ me->UsePlainSpace, me->HiddenValue,
+ NO);
}
data = me->textarea.data;
/*
- * Trim any trailing newlines and
- * skip any lead newlines. - FM
+ * Trim any trailing newlines and skip any lead newlines. - FM
*/
if (*data != '\0') {
cp = (data + strlen(data)) - 1;
@@ -6924,8 +6881,7 @@ End_Object:
}
}
/*
- * Load the first text line, or set
- * up for all blank rows. - FM
+ * Load the first text line, or set up for all blank rows. - FM
*/
if ((cp = strchr(data, '\n')) != NULL) {
*cp = '\0';
@@ -6941,14 +6897,15 @@ End_Object:
data = "";
}
/*
- * Display at least the requested number
- * of text lines and/or blank rows. - FM
+ * Display at least the requested number of text lines and/or blank
+ * rows. - FM
*/
for (i = 0; i < me->textarea_rows; i++) {
int j;
+
for (j = 0; temp && temp[j]; j++) {
if (temp[j] == '\r')
- temp[j] = (char) (temp[j+1] ? ' ' : '\0');
+ temp[j] = (char) (temp[j + 1] ? ' ' : '\0');
}
I.value = temp;
chars = HText_beginInput(me->text, me->inUnderline, &I);
@@ -6973,15 +6930,16 @@ End_Object:
}
}
/*
- * Check for more data lines than the rows attribute.
- * We add them to the display, because we support only
- * horizontal and not also vertical scrolling. - FM
+ * Check for more data lines than the rows attribute. We add them
+ * to the display, because we support only horizontal and not also
+ * vertical scrolling. - FM
*/
while (*data != '\0' || temp != NULL) {
int j;
+
for (j = 0; temp && temp[j]; j++) {
if (temp[j] == '\r')
- temp[j] = (char) (temp[j+1] ? ' ' : '\0');
+ temp[j] = (char) (temp[j + 1] ? ' ' : '\0');
}
I.value = temp;
chars = HText_beginInput(me->text, me->inUnderline, &I);
@@ -7019,7 +6977,7 @@ End_Object:
char *ptr;
/*
- * Make sure we had a select start tag.
+ * Make sure we had a select start tag.
*/
if (!me->inSELECT) {
if (LYBadHTML(me))
@@ -7028,33 +6986,33 @@ End_Object:
}
/*
- * Set to know that we are no longer in a select tag.
+ * Set to know that we are no longer in a select tag.
*/
me->inSELECT = FALSE;
/*
- * Clear the disable attribute.
+ * Clear the disable attribute.
*/
me->select_disabled = FALSE;
/*
- * Make sure we're in a form.
+ * Make sure we're in a form.
*/
if (!me->inFORM) {
if (LYBadHTML(me))
CTRACE((tfp,
"Bad HTML: SELECT end tag not within FORM element *****\n"));
/*
- * Hopefully won't crash, so we'll ignore it. - kw
+ * Hopefully won't crash, so we'll ignore it. - kw
*/
}
/*
- * Finish the data off.
+ * Finish the data off.
*/
HTChunkTerminate(&me->option);
/*
- * Finish the previous option.
+ * Finish the previous option.
*/
ptr = HText_setLastOptionValue(me->text,
me->option.data,
@@ -7069,46 +7027,47 @@ End_Object:
if (HTCurSelectGroupType == F_CHECKBOX_TYPE ||
LYSelectPopups == FALSE) {
- /*
- * Start a newline after the last checkbox/button option.
- */
- LYEnsureSingleSpace(me);
+ /*
+ * Start a newline after the last checkbox/button option.
+ */
+ LYEnsureSingleSpace(me);
} else {
/*
- * Output popup box with the default option to screen,
- * but use non-breaking spaces for output.
+ * Output popup box with the default option to screen, but use
+ * non-breaking spaces for output.
*/
if (ptr &&
(me->sp[0].tag_number == HTML_PRE || me->inPRE == TRUE ||
!me->sp->style->freeFormat) &&
strlen(ptr) > 6) {
/*
- * The code inadequately handles OPTION fields in PRE tags.
- * We'll put up a minimum of 6 characters, and if any
- * more would exceed the wrap column, we'll ignore them.
+ * The code inadequately handles OPTION fields in PRE tags.
+ * We'll put up a minimum of 6 characters, and if any more
+ * would exceed the wrap column, we'll ignore them.
*/
for (i = 0; i < 6; i++) {
if (*ptr == ' ')
- HText_appendCharacter(me->text,HT_NON_BREAK_SPACE);
+ HText_appendCharacter(me->text, HT_NON_BREAK_SPACE);
else
- HText_appendCharacter(me->text,*ptr);
+ HText_appendCharacter(me->text, *ptr);
ptr++;
}
HText_setIgnoreExcess(me->text, TRUE);
}
- for (; ptr && *ptr != '\0'; ptr++) {
+ for (; non_empty(ptr); ptr++) {
if (*ptr == ' ')
- HText_appendCharacter(me->text,HT_NON_BREAK_SPACE);
+ HText_appendCharacter(me->text, HT_NON_BREAK_SPACE);
else {
- HTkcode kcode = 0;
- HTkcode specified_kcode = 0;
+ HTkcode kcode = NOKANJI;
+ HTkcode specified_kcode = NOKANJI;
+
if (HTCJK == JAPANESE) {
kcode = HText_getKcode(me->text);
HText_updateKcode(me->text, kanji_code);
specified_kcode = HText_getSpecifiedKcode(me->text);
HText_updateSpecifiedKcode(me->text, kanji_code);
}
- HText_appendCharacter(me->text,*ptr);
+ HText_appendCharacter(me->text, *ptr);
if (HTCJK == JAPANESE) {
HText_updateKcode(me->text, kcode);
HText_updateSpecifiedKcode(me->text, specified_kcode);
@@ -7116,7 +7075,7 @@ End_Object:
}
}
/*
- * Add end option character.
+ * Add end option character.
*/
if (!me->first_option) {
HText_appendCharacter(me->text, ']');
@@ -7144,7 +7103,7 @@ End_Object:
#ifdef EXP_NESTED_TABLES
if (!nested_tables)
#endif
- me->inTABLE = FALSE;
+ me->inTABLE = FALSE;
if (me->sp->style->id == ST_Preformatted) {
break;
@@ -7153,7 +7112,7 @@ End_Object:
me->Division_Level--;
if (me->Division_Level >= 0)
me->sp->style->alignment =
- me->DivisionAlignments[me->Division_Level];
+ me->DivisionAlignments[me->Division_Level];
change_paragraph_style(me, me->sp->style);
UPDATE_STYLE;
@@ -7176,7 +7135,7 @@ End_Object:
case HTML_TR:
HText_endStblTR(me->text);
if (!HText_LastLineEmpty(me->text, FALSE)) {
- HText_setLastChar(me->text, ' '); /* absorb next white space */
+ HText_setLastChar(me->text, ' '); /* absorb next white space */
HText_appendCharacter(me->text, '\r');
}
me->in_word = NO;
@@ -7207,8 +7166,8 @@ End_Object:
case HTML_MATH:
/*
- * We're getting it as Literal text, which, until we can process
- * it, we'll display as is, within brackets to alert the user. - FM
+ * We're getting it as Literal text, which, until we can process it,
+ * we'll display as is, within brackets to alert the user. - FM
*/
HTChunkPutc(&me->math, ' ');
HTChunkTerminate(&me->math);
@@ -7230,14 +7189,14 @@ End_Object:
break;
default:
- change_paragraph_style(me, me->sp->style); /* Often won't really change */
+ change_paragraph_style(me, me->sp->style); /* Often won't really change */
break;
- } /* switch */
+ } /* switch */
#ifdef EXP_JUSTIFY_ELTS
- if (reached_awaited_stacked_elt)
- wait_for_this_stacked_elt=-1;
+ if (reached_awaited_stacked_elt)
+ wait_for_this_stacked_elt = -1;
#endif
if (me->xinclude) {
@@ -7245,9 +7204,8 @@ End_Object:
HText_appendText(me->text, me->xinclude);
FREE(me->xinclude);
}
-
#ifdef USE_COLOR_STYLE
- if (!skip_stack_requested) { /*don't emit stylechanges if skipped stack element - VH*/
+ if (!skip_stack_requested) { /*don't emit stylechanges if skipped stack element - VH */
# if !OMIT_SCN_KEEPING
FastTrimColorClass(HTML_dtd.tags[element_number].name,
HTML_dtd.tags[element_number].name_len,
@@ -7255,11 +7213,11 @@ End_Object:
&Style_className_end, &hcode);
# endif
- if (!ReallyEmptyTagNum(element_number))
- {
+ if (!ReallyEmptyTagNum(element_number)) {
CTRACE2(TRACE_STYLE,
- (tfp, "STYLE.end_element: ending non-\"EMPTY\" style <%s...>\n",
- HTML_dtd.tags[element_number].name));
+ (tfp,
+ "STYLE.end_element: ending non-\"EMPTY\" style <%s...>\n",
+ HTML_dtd.tags[element_number].name));
HText_characterStyle(me->text, HCODE_TO_STACK_OFF(hcode), STACK_OFF);
}
}
@@ -7268,11 +7226,11 @@ End_Object:
}
/* Expanding entities
-** ------------------
-*/
+ * ------------------
+ */
/* (In fact, they all shrink!)
*/
-PUBLIC int HTML_put_entity ARGS2(HTStructured *, me, int, entity_number)
+int HTML_put_entity(HTStructured * me, int entity_number)
{
int nent = HTML_dtd.number_of_entities;
@@ -7284,26 +7242,25 @@ PUBLIC int HTML_put_entity ARGS2(HTStructured *, me, int, entity_number)
}
/* Free an HTML object
-** -------------------
-**
-** If the document is empty, the text object will not yet exist.
-** So we could in fact abandon creating the document and return
-** an error code. In fact an empty document is an important type
-** of document, so we don't.
-**
-** If non-interactive, everything is freed off. No: crashes -listrefs
-** Otherwise, the interactive object is left.
-*/
-PRIVATE void HTML_free ARGS1(HTStructured *, me)
+ * -------------------
+ *
+ * If the document is empty, the text object will not yet exist.
+ * So we could in fact abandon creating the document and return
+ * an error code. In fact an empty document is an important type
+ * of document, so we don't.
+ *
+ * If non-interactive, everything is freed off. No: crashes -listrefs
+ * Otherwise, the interactive object is left.
+ */
+static void HTML_free(HTStructured * me)
{
char *include = NULL;
if (LYMapsOnly && !me->text) {
/*
- * We only handled MAP, AREA and BASE tags, and didn't
- * create an HText structure for the document nor want
- * one now, so just make sure we free anything that might
- * have been allocated. - FM
+ * We only handled MAP, AREA and BASE tags, and didn't create an HText
+ * structure for the document nor want one now, so just make sure we
+ * free anything that might have been allocated. - FM
*/
FREE(me->base_href);
FREE(me->map_address);
@@ -7318,20 +7275,18 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
HTML_put_string(me, me->comment_end);
if (me->text) {
/*
- * Emphasis containers, A, FONT, and FORM may be declared
- * SGML_EMPTY in HTMLDTD.c, and SGML_character() in SGML.c
- * may check for their end tags to call HTML_end_element()
- * directly (with a check in that to bypass decrementing
- * of the HTML parser's stack). So if we still have the
- * emphasis (Underline) on, or any open A, FONT, or FORM
- * containers, turn it off or close them now. - FM & kw
+ * Emphasis containers, A, FONT, and FORM may be declared SGML_EMPTY in
+ * HTMLDTD.c, and SGML_character() in SGML.c may check for their end
+ * tags to call HTML_end_element() directly (with a check in that to
+ * bypass decrementing of the HTML parser's stack). So if we still
+ * have the emphasis (Underline) on, or any open A, FONT, or FORM
+ * containers, turn it off or close them now. - FM & kw
*
- * IF those tags are not declared SGML_EMPTY, but we let
- * the SGML.c parser take care of correctly stacked ordering,
- * and of correct wind-down on end-of-stream (in SGML_free
- * SGML_abort),
- * THEN these and other checks here in HTML.c should not be
- * necessary. Still it can't hurt to include them. - kw
+ * IF those tags are not declared SGML_EMPTY, but we let the SGML.c
+ * parser take care of correctly stacked ordering, and of correct
+ * wind-down on end-of-stream (in SGML_free SGML_abort), THEN these and
+ * other checks here in HTML.c should not be necessary. Still it can't
+ * hurt to include them. - kw
*/
if (me->inUnderline) {
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
@@ -7354,46 +7309,46 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
}
if (me->option.size > 0) {
/*
- * If we still have data in the me->option chunk after
- * forcing a close of a still-open form, something must
- * have gone very wrong. - kw
+ * If we still have data in the me->option chunk after forcing a
+ * close of a still-open form, something must have gone very wrong.
+ * - kw
*/
if (LYBadHTML(me))
CTRACE((tfp,
"Bad HTML: SELECT or OPTION not ended properly *****\n"));
HTChunkTerminate(&me->option);
/*
- * Output the left-over data as text, maybe it was invalid
- * markup meant to be shown somewhere. - kw
+ * Output the left-over data as text, maybe it was invalid markup
+ * meant to be shown somewhere. - kw
*/
CTRACE((tfp, "HTML_free: ***** leftover option data: %s\n",
- me->option.data));
+ me->option.data));
HTML_put_string(me, me->option.data);
HTChunkClear(&me->option);
}
if (me->textarea.size > 0) {
/*
- * If we still have data in the me->textarea chunk after
- * forcing a close of a still-open form, something must
- * have gone very wrong. - kw
+ * If we still have data in the me->textarea chunk after forcing a
+ * close of a still-open form, something must have gone very wrong.
+ * - kw
*/
if (LYBadHTML(me))
CTRACE((tfp,
"Bad HTML: TEXTAREA not used properly *****\n"));
HTChunkTerminate(&me->textarea);
/*
- * Output the left-over data as text, maybe it was invalid
- * markup meant to be shown somewhere. - kw
+ * Output the left-over data as text, maybe it was invalid markup
+ * meant to be shown somewhere. - kw
*/
CTRACE((tfp, "HTML_free: ***** leftover textarea data: %s\n",
- me->textarea.data));
+ me->textarea.data));
HTML_put_string(me, me->textarea.data);
HTChunkClear(&me->textarea);
}
/*
- * If we're interactive and have hidden links but no visible
- * links, add a message informing the user about this and
- * suggesting use of the 'l'ist command. - FM
+ * If we're interactive and have hidden links but no visible links, add
+ * a message informing the user about this and suggesting use of the
+ * 'l'ist command. - FM
*/
if (!dump_output_immediately &&
HText_sourceAnchors(me->text) < 1 &&
@@ -7402,7 +7357,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
HTML_put_character(me, '[');
HTML_start_element(me, HTML_EM, 0, 0, -1, &include);
HTML_put_string(me,
- gettext("Document has only hidden links. Use the 'l'ist command."));
+ gettext("Document has only hidden links. Use the 'l'ist command."));
HTML_end_element(me, HTML_EM, &include);
HTML_put_character(me, ']');
HTML_end_element(me, HTML_P, &include);
@@ -7414,15 +7369,14 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
}
/*
- * Now call the cleanup function. - FM
+ * Now call the cleanup function. - FM
*/
HText_endAppend(me->text);
}
if (me->option.size > 0) {
/*
- * If we still have data in the me->option chunk after
- * forcing a close of a still-open form, something must
- * have gone very wrong. - kw
+ * If we still have data in the me->option chunk after forcing a close
+ * of a still-open form, something must have gone very wrong. - kw
*/
if (LYBadHTML(me))
CTRACE((tfp,
@@ -7430,15 +7384,15 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
if (TRACE) {
HTChunkTerminate(&me->option);
CTRACE((tfp, "HTML_free: ***** leftover option data: %s\n",
- me->option.data));
+ me->option.data));
}
HTChunkClear(&me->option);
}
if (me->textarea.size > 0) {
/*
- * If we still have data in the me->textarea chunk after
- * forcing a close of a still-open form, something must
- * have gone very wrong. - kw
+ * If we still have data in the me->textarea chunk after forcing a
+ * close of a still-open form, something must have gone very wrong. -
+ * kw
*/
if (LYBadHTML(me))
CTRACE((tfp,
@@ -7446,13 +7400,13 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
if (TRACE) {
HTChunkTerminate(&me->textarea);
CTRACE((tfp, "HTML_free: ***** leftover textarea data: %s\n",
- me->textarea.data));
+ me->textarea.data));
}
HTChunkClear(&me->textarea);
}
if (me->target) {
- (*me->targetClass._free)(me->target);
+ (*me->targetClass._free) (me->target);
}
if (me->sp && me->sp->style && me->sp->style->name) {
if (me->sp->style->id == ST_DivCenter ||
@@ -7462,7 +7416,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
} else if (me->sp->style->id == ST_DivRight ||
me->sp->style->id == ST_HeadingRight) {
me->sp->style->alignment = HT_RIGHT;
- } else {
+ } else {
me->sp->style->alignment = HT_LEFT;
}
styles[HTML_PRE]->alignment = HT_LEFT;
@@ -7474,14 +7428,14 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me)
FREE(me);
}
-PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e)
+static void HTML_abort(HTStructured * me, HTError e)
{
char *include = NULL;
if (me->text) {
/*
- * If we have emphasis on, or open A, FONT, or FORM
- * containers, turn it off or close them now. - FM
+ * If we have emphasis on, or open A, FONT, or FORM containers, turn it
+ * off or close them now. - FM
*/
if (me->inUnderline) {
HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR);
@@ -7502,42 +7456,42 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e)
}
/*
- * Now call the cleanup function. - FM
+ * Now call the cleanup function. - FM
*/
HText_endAppend(me->text);
}
if (me->option.size > 0) {
/*
- * If we still have data in the me->option chunk after
- * forcing a close of a still-open form, something must
- * have gone very wrong. - kw
+ * If we still have data in the me->option chunk after forcing a close
+ * of a still-open form, something must have gone very wrong. - kw
*/
if (TRACE) {
- CTRACE((tfp, "HTML_abort: SELECT or OPTION not ended properly *****\n"));
+ CTRACE((tfp,
+ "HTML_abort: SELECT or OPTION not ended properly *****\n"));
HTChunkTerminate(&me->option);
CTRACE((tfp, "HTML_abort: ***** leftover option data: %s\n",
- me->option.data));
+ me->option.data));
}
HTChunkClear(&me->option);
}
if (me->textarea.size > 0) {
/*
- * If we still have data in the me->textarea chunk after
- * forcing a close of a still-open form, something must
- * have gone very wrong. - kw
+ * If we still have data in the me->textarea chunk after forcing a
+ * close of a still-open form, something must have gone very wrong. -
+ * kw
*/
if (TRACE) {
CTRACE((tfp, "HTML_abort: TEXTAREA not used properly *****\n"));
HTChunkTerminate(&me->textarea);
CTRACE((tfp, "HTML_abort: ***** leftover textarea data: %s\n",
- me->textarea.data));
+ me->textarea.data));
}
HTChunkClear(&me->textarea);
}
if (me->target) {
- (*me->targetClass._abort)(me->target, e);
+ (*me->targetClass._abort) (me->target, e);
}
if (me->sp && me->sp->style && me->sp->style->name) {
if (me->sp->style->id == ST_DivCenter ||
@@ -7547,7 +7501,7 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e)
} else if (me->sp->style->id == ST_DivRight ||
me->sp->style->id == ST_HeadingRight) {
me->sp->style->alignment = HT_RIGHT;
- } else {
+ } else {
me->sp->style->alignment = HT_LEFT;
}
styles[HTML_PRE]->alignment = HT_LEFT;
@@ -7564,84 +7518,85 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e)
}
/* Get Styles from style sheet
-** ---------------------------
-*/
-PRIVATE void get_styles NOARGS
+ * ---------------------------
+ */
+static void get_styles(void)
{
- HTStyle** st = NULL;
- styleSheet = DefaultStyle(&st); /* sets st[] array */
-
- default_style = st[ST_Normal];
-
- styles[HTML_H1] = st[ST_Heading1];
- styles[HTML_H2] = st[ST_Heading2];
- styles[HTML_H3] = st[ST_Heading3];
- styles[HTML_H4] = st[ST_Heading4];
- styles[HTML_H5] = st[ST_Heading5];
- styles[HTML_H6] = st[ST_Heading6];
- styles[HTML_HCENTER] = st[ST_HeadingCenter];
- styles[HTML_HLEFT] = st[ST_HeadingLeft];
- styles[HTML_HRIGHT] = st[ST_HeadingRight];
-
- styles[HTML_DCENTER] = st[ST_DivCenter];
- styles[HTML_DLEFT] = st[ST_DivLeft];
- styles[HTML_DRIGHT] = st[ST_DivRight];
-
- styles[HTML_DL] = st[ST_Glossary];
- /* nested list styles */
- styles[HTML_DL1] = st[ST_Glossary1];
- styles[HTML_DL2] = st[ST_Glossary2];
- styles[HTML_DL3] = st[ST_Glossary3];
- styles[HTML_DL4] = st[ST_Glossary4];
- styles[HTML_DL5] = st[ST_Glossary5];
- styles[HTML_DL6] = st[ST_Glossary6];
+ HTStyle **st = NULL;
+
+ styleSheet = DefaultStyle(&st); /* sets st[] array */
+
+ default_style = st[ST_Normal];
+
+ styles[HTML_H1] = st[ST_Heading1];
+ styles[HTML_H2] = st[ST_Heading2];
+ styles[HTML_H3] = st[ST_Heading3];
+ styles[HTML_H4] = st[ST_Heading4];
+ styles[HTML_H5] = st[ST_Heading5];
+ styles[HTML_H6] = st[ST_Heading6];
+ styles[HTML_HCENTER] = st[ST_HeadingCenter];
+ styles[HTML_HLEFT] = st[ST_HeadingLeft];
+ styles[HTML_HRIGHT] = st[ST_HeadingRight];
+
+ styles[HTML_DCENTER] = st[ST_DivCenter];
+ styles[HTML_DLEFT] = st[ST_DivLeft];
+ styles[HTML_DRIGHT] = st[ST_DivRight];
+
+ styles[HTML_DL] = st[ST_Glossary];
+ /* nested list styles */
+ styles[HTML_DL1] = st[ST_Glossary1];
+ styles[HTML_DL2] = st[ST_Glossary2];
+ styles[HTML_DL3] = st[ST_Glossary3];
+ styles[HTML_DL4] = st[ST_Glossary4];
+ styles[HTML_DL5] = st[ST_Glossary5];
+ styles[HTML_DL6] = st[ST_Glossary6];
styles[HTML_UL] =
- styles[HTML_OL] = st[ST_List];
- /* nested list styles */
- styles[HTML_OL1] = st[ST_List1];
- styles[HTML_OL2] = st[ST_List2];
- styles[HTML_OL3] = st[ST_List3];
- styles[HTML_OL4] = st[ST_List4];
- styles[HTML_OL5] = st[ST_List5];
- styles[HTML_OL6] = st[ST_List6];
+ styles[HTML_OL] = st[ST_List];
+ /* nested list styles */
+ styles[HTML_OL1] = st[ST_List1];
+ styles[HTML_OL2] = st[ST_List2];
+ styles[HTML_OL3] = st[ST_List3];
+ styles[HTML_OL4] = st[ST_List4];
+ styles[HTML_OL5] = st[ST_List5];
+ styles[HTML_OL6] = st[ST_List6];
styles[HTML_MENU] =
- styles[HTML_DIR] = st[ST_Menu];
- /* nested list styles */
- styles[HTML_MENU1] = st[ST_Menu1];
- styles[HTML_MENU2] = st[ST_Menu2];
- styles[HTML_MENU3] = st[ST_Menu3];
- styles[HTML_MENU4] = st[ST_Menu4];
- styles[HTML_MENU5] = st[ST_Menu5];
- styles[HTML_MENU6] = st[ST_Menu6];
-
- styles[HTML_DLC] = st[ST_GlossaryCompact];
- /* nested list styles */
- styles[HTML_DLC1] = st[ST_GlossaryCompact1];
- styles[HTML_DLC2] = st[ST_GlossaryCompact2];
- styles[HTML_DLC3] = st[ST_GlossaryCompact3];
- styles[HTML_DLC4] = st[ST_GlossaryCompact4];
- styles[HTML_DLC5] = st[ST_GlossaryCompact5];
- styles[HTML_DLC6] = st[ST_GlossaryCompact6];
-
- styles[HTML_ADDRESS] = st[ST_Address];
- styles[HTML_BANNER] = st[ST_Banner];
- styles[HTML_BLOCKQUOTE] = st[ST_Blockquote];
- styles[HTML_BQ] = st[ST_Bq];
- styles[HTML_FN] = st[ST_Footnote];
- styles[HTML_NOTE] = st[ST_Note];
+ styles[HTML_DIR] = st[ST_Menu];
+ /* nested list styles */
+ styles[HTML_MENU1] = st[ST_Menu1];
+ styles[HTML_MENU2] = st[ST_Menu2];
+ styles[HTML_MENU3] = st[ST_Menu3];
+ styles[HTML_MENU4] = st[ST_Menu4];
+ styles[HTML_MENU5] = st[ST_Menu5];
+ styles[HTML_MENU6] = st[ST_Menu6];
+
+ styles[HTML_DLC] = st[ST_GlossaryCompact];
+ /* nested list styles */
+ styles[HTML_DLC1] = st[ST_GlossaryCompact1];
+ styles[HTML_DLC2] = st[ST_GlossaryCompact2];
+ styles[HTML_DLC3] = st[ST_GlossaryCompact3];
+ styles[HTML_DLC4] = st[ST_GlossaryCompact4];
+ styles[HTML_DLC5] = st[ST_GlossaryCompact5];
+ styles[HTML_DLC6] = st[ST_GlossaryCompact6];
+
+ styles[HTML_ADDRESS] = st[ST_Address];
+ styles[HTML_BANNER] = st[ST_Banner];
+ styles[HTML_BLOCKQUOTE] = st[ST_Blockquote];
+ styles[HTML_BQ] = st[ST_Bq];
+ styles[HTML_FN] = st[ST_Footnote];
+ styles[HTML_NOTE] = st[ST_Note];
styles[HTML_PLAINTEXT] =
- styles[HTML_XMP] = st[ST_Example];
- styles[HTML_PRE] = st[ST_Preformatted];
- styles[HTML_LISTING] = st[ST_Listing];
+ styles[HTML_XMP] = st[ST_Example];
+ styles[HTML_PRE] = st[ST_Preformatted];
+ styles[HTML_LISTING] = st[ST_Listing];
}
/*
* If we're called from another module, make sure we've initialized styles
* array first.
*/
-PUBLIC HTStyle *LYstyles ARGS1(int, style_number)
+HTStyle *LYstyles(int style_number)
{
if (styles[style_number] == 0)
get_styles();
@@ -7652,40 +7607,42 @@ PUBLIC HTStyle *LYstyles ARGS1(int, style_number)
*/
/* Structured Object Class
-** -----------------------
-*/
-PUBLIC CONST HTStructuredClass HTMLPresentation = /* As opposed to print etc */
+ * -----------------------
+ */
+const HTStructuredClass HTMLPresentation = /* As opposed to print etc */
{
- "Lynx_HTML_Handler",
- HTML_free,
- HTML_abort,
- HTML_put_character, HTML_put_string, HTML_write,
- HTML_start_element, HTML_end_element,
- HTML_put_entity
+ "Lynx_HTML_Handler",
+ HTML_free,
+ HTML_abort,
+ HTML_put_character, HTML_put_string, HTML_write,
+ HTML_start_element, HTML_end_element,
+ HTML_put_entity
};
/* New Structured Text object
-** --------------------------
-**
-** The structured stream can generate either presentation,
-** or plain text, or HTML.
-*/
-PUBLIC HTStructured* HTML_new ARGS3(
- HTParentAnchor *, anchor,
- HTFormat, format_out,
- HTStream*, stream)
+ * --------------------------
+ *
+ * The structured stream can generate either presentation,
+ * or plain text, or HTML.
+ */
+HTStructured *HTML_new(HTParentAnchor *anchor,
+ HTFormat format_out,
+ HTStream *stream)
{
- HTStructured * me;
+ HTStructured *me;
+
+ CTRACE((tfp, "start HTML_new\n"));
if (format_out != WWW_PLAINTEXT && format_out != WWW_PRESENT) {
- HTStream * intermediate = HTStreamStack(WWW_HTML, format_out,
- stream, anchor);
+ HTStream *intermediate = HTStreamStack(WWW_HTML, format_out,
+ stream, anchor);
+
if (intermediate)
return HTMLGenerator(intermediate);
fprintf(stderr, "\n** Internal error: can't parse HTML to %s\n",
HTAtom_name(format_out));
- exit_immediately (EXIT_FAILURE);
+ exit_immediately(EXIT_FAILURE);
}
me = typecalloc(HTStructured);
@@ -7753,8 +7710,8 @@ PUBLIC HTStructured* HTML_new ARGS3(
me->current_default_alignment = HT_LEFT;
me->sp = (me->stack + MAX_NESTING - 1);
me->skip_stack = 0;
- me->sp->tag_number = -1; /* INVALID */
- me->sp->style = default_style; /* INVALID */
+ me->sp->tag_number = -1; /* INVALID */
+ me->sp->style = default_style; /* INVALID */
me->sp->style->alignment = HT_LEFT;
me->stack_overrun = FALSE;
@@ -7767,12 +7724,12 @@ PUBLIC HTStructured* HTML_new ARGS3(
me->lastraw = -1;
/*
- * Used for nested lists. - FM
+ * Used for nested lists. - FM
*/
- me->List_Nesting_Level = -1; /* counter for list nesting level */
- LYZero_OL_Counter(me); /* Initializes OL_Counter[] and OL_Type[] */
- me->Last_OL_Count = 0; /* last count in ordered lists */
- me->Last_OL_Type = '1'; /* last type in ordered lists */
+ me->List_Nesting_Level = -1; /* counter for list nesting level */
+ LYZero_OL_Counter(me); /* Initializes OL_Counter[] and OL_Type[] */
+ me->Last_OL_Count = 0; /* last count in ordered lists */
+ me->Last_OL_Type = '1'; /* last type in ordered lists */
me->inA = FALSE;
me->inAPPLET = FALSE;
@@ -7813,19 +7770,18 @@ PUBLIC HTStructured* HTML_new ARGS3(
#endif
/*
- ** Create a chartrans stage info structure for the anchor,
- ** if it does not exist already (in which case the default
- ** MIME stage info will be loaded as well), and load the
- ** HTML stage info into me->UCI and me->UCLYhndl. - FM
- */
+ * Create a chartrans stage info structure for the anchor, if it does not
+ * exist already (in which case the default MIME stage info will be loaded
+ * as well), and load the HTML stage info into me->UCI and me->UCLYhndl. -
+ * FM
+ */
LYGetChartransInfo(me);
UCTransParams_clear(&me->T);
/*
- ** Load the existing or default input charset info
- ** into the holding elements. We'll believe what
- ** is indicated for UCT_STAGE_PARSER. - FM
- */
+ * Load the existing or default input charset info into the holding
+ * elements. We'll believe what is indicated for UCT_STAGE_PARSER. - FM
+ */
me->inUCLYhndl = HTAnchor_getUCLYhndl(me->node_anchor,
UCT_STAGE_PARSER);
if (me->inUCLYhndl < 0) {
@@ -7839,11 +7795,10 @@ PUBLIC HTStructured* HTML_new ARGS3(
}
/*
- ** Load the existing or default output charset info
- ** into the holding elements, UCT_STAGE_STRUCTURED
- ** should be the same as UCT_STAGE_TEXT at this point,
- ** but we could check, perhaps. - FM
- */
+ * Load the existing or default output charset info into the holding
+ * elements, UCT_STAGE_STRUCTURED should be the same as UCT_STAGE_TEXT at
+ * this point, but we could check, perhaps. - FM
+ */
me->outUCI = HTAnchor_getUCInfoStage(me->node_anchor,
UCT_STAGE_STRUCTURED);
me->outUCLYhndl = HTAnchor_getUCLYhndl(me->node_anchor,
@@ -7851,28 +7806,27 @@ PUBLIC HTStructured* HTML_new ARGS3(
me->target = stream;
if (stream)
- me->targetClass = *stream->isa; /* Copy pointers */
+ me->targetClass = *stream->isa; /* Copy pointers */
- return (HTStructured*) me;
+ return (HTStructured *) me;
}
#ifdef USE_SOURCE_CACHE
/*
- * A flag set by a file write error. Used for only generating an alert
- * the first time such an error happens, since Lynx should still be usable
- * if the temp space becomes full, and an alert each time a cache file
- * cannot be written would be annoying. Reset when lynx.cfg is being
- * reloaded (user may change SOURCE_CACHE setting). - kw
+ * A flag set by a file write error. Used for only generating an alert the
+ * first time such an error happens, since Lynx should still be usable if the
+ * temp space becomes full, and an alert each time a cache file cannot be
+ * written would be annoying. Reset when lynx.cfg is being reloaded (user may
+ * change SOURCE_CACHE setting). - kw
*/
-PUBLIC BOOLEAN source_cache_file_error = FALSE;
+BOOLEAN source_cache_file_error = FALSE;
/*
* Pass-thru cache HTStream
*/
-PRIVATE void CacheThru_do_free ARGS1(
- HTStream *, me)
+static void CacheThru_do_free(HTStream *me)
{
if (me->anchor->source_cache_file) {
CTRACE((tfp, "SourceCacheWriter: Removing previous file %s\n",
@@ -7882,7 +7836,7 @@ PRIVATE void CacheThru_do_free ARGS1(
}
if (me->anchor->source_cache_chunk) {
CTRACE((tfp, "SourceCacheWriter: Removing previous memory chunk %p\n",
- (void *)me->anchor->source_cache_chunk));
+ (void *) me->anchor->source_cache_chunk));
HTChunkFree(me->anchor->source_cache_chunk);
me->anchor->source_cache_chunk = NULL;
}
@@ -7892,10 +7846,14 @@ PRIVATE void CacheThru_do_free ARGS1(
me->status = HT_ERROR;
LYCloseTempFP(me->fp);
if (me->status == HT_OK) {
+ char *cp_freeme = 0;
+
me->anchor->source_cache_file = me->filename;
CTRACE((tfp,
"SourceCacheWriter: Committing file %s for URL %s to anchor\n",
- me->filename, HTAnchor_address((HTAnchor *)me->anchor)));
+ me->filename,
+ cp_freeme = HTAnchor_address((HTAnchor *) me->anchor)));
+ FREE(cp_freeme);
} else {
if (source_cache_file_error == FALSE) {
HTAlert(gettext("Source cache error - disk full?"));
@@ -7909,29 +7867,30 @@ PRIVATE void CacheThru_do_free ARGS1(
CTRACE((tfp, "SourceCacheWriter: memory chunk %p had errors.\n",
me->chunk));
HTChunkFree(me->chunk);
- me->chunk = NULL;
+ me->chunk = me->last_chunk = NULL;
}
HTAlert(gettext("Source cache error - not enough memory!"));
}
if (me->chunk) {
+ char *cp_freeme = NULL;
+
me->anchor->source_cache_chunk = me->chunk;
CTRACE((tfp,
"SourceCacheWriter: Committing memory chunk %p for URL %s to anchor\n",
- (void *)me->chunk, HTAnchor_address((HTAnchor *)me->anchor)));
+ (void *) me->chunk,
+ cp_freeme = HTAnchor_address((HTAnchor *) me->anchor)));
+ FREE(cp_freeme);
}
}
-PRIVATE void CacheThru_free ARGS1(
- HTStream *, me)
+static void CacheThru_free(HTStream *me)
{
CacheThru_do_free(me);
- (*me->actions->_free)(me->target);
+ (*me->actions->_free) (me->target);
FREE(me);
}
-PRIVATE void CacheThru_abort ARGS2(
- HTStream *, me,
- HTError, e)
+static void CacheThru_abort(HTStream *me, HTError e)
{
if (me->fp)
LYCloseTempFP(me->fp);
@@ -7943,70 +7902,70 @@ PRIVATE void CacheThru_abort ARGS2(
FREE(me->filename);
}
if (me->chunk) {
- CTRACE((tfp, "SourceCacheWriter: Removing active memory chunk %p\n",
- (void *)me->chunk));
+ CTRACE((tfp,
+ "SourceCacheWriter: Removing active memory chunk %p\n",
+ (void *) me->chunk));
HTChunkFree(me->chunk);
}
} else {
- me->status = HT_OK; /*fake it*/
+ me->status = HT_OK; /*fake it */
CacheThru_do_free(me);
}
- (*me->actions->_abort)(me->target, e);
+ (*me->actions->_abort) (me->target, e);
FREE(me);
}
-PRIVATE void CacheThru_put_character ARGS2(
- HTStream *, me,
- char, c_in)
+/*
+ * FIXME: never used!
+ */
+static void CacheThru_put_character(HTStream *me, char c_in)
{
if (me->status == HT_OK) {
if (me->fp) {
fputc(c_in, me->fp);
} else if (me->chunk) {
- HTChunkPutc(me->chunk, c_in);
- if (me->chunk->allocated == 0)
+ me->last_chunk = HTChunkPutc2(me->last_chunk, c_in);
+ if (me->last_chunk == NULL || me->last_chunk->allocated == 0)
me->status = HT_ERROR;
}
}
- (*me->actions->put_character)(me->target, c_in);
+ (*me->actions->put_character) (me->target, c_in);
}
-PRIVATE void CacheThru_put_string ARGS2(
- HTStream *, me,
- CONST char *, str)
+/*
+ * FIXME: never used!
+ */
+static void CacheThru_put_string(HTStream *me, const char *str)
{
if (me->status == HT_OK) {
if (me->fp) {
fputs(str, me->fp);
} else if (me->chunk) {
- HTChunkPuts(me->chunk, str);
- if (me->chunk->allocated == 0 && *str)
+ me->last_chunk = HTChunkPuts2(me->last_chunk, str);
+ if (me->last_chunk == NULL || me->last_chunk->allocated == 0)
me->status = HT_ERROR;
}
}
- (*me->actions->put_string)(me->target, str);
+ (*me->actions->put_string) (me->target, str);
}
-PRIVATE void CacheThru_write ARGS3(
- HTStream *, me,
- CONST char *, str,
- int, l)
+static void CacheThru_write(HTStream *me, const char *str, int l)
{
- if (me->status == HT_OK) {
+ if (me->status == HT_OK && l != 0) {
if (me->fp) {
fwrite(str, 1, l, me->fp);
if (ferror(me->fp))
me->status = HT_ERROR;
} else if (me->chunk) {
- HTChunkPutb(me->chunk, str, l);
- if (me->chunk->allocated == 0 && l != 0)
+ me->last_chunk = HTChunkPutb2(me->last_chunk, str, l);
+ if (me->last_chunk == NULL || me->last_chunk->allocated == 0)
me->status = HT_ERROR;
}
}
- (*me->actions->put_block)(me->target, str, l);
+ (*me->actions->put_block) (me->target, str, l);
}
-PRIVATE CONST HTStreamClass PassThruCache =
+static const HTStreamClass PassThruCache =
{
"PassThruCache",
CacheThru_free,
@@ -8016,13 +7975,13 @@ PRIVATE CONST HTStreamClass PassThruCache =
CacheThru_write
};
-PRIVATE HTStream* CacheThru_new ARGS2(
- HTParentAnchor *, anchor,
- HTStream *, target)
+static HTStream *CacheThru_new(HTParentAnchor *anchor,
+ HTStream *target)
{
+ char *cp_freeme = NULL;
char filename[LY_MAXPATH];
HTStream *stream = NULL;
- HTProtocol *p = (HTProtocol *)anchor->protocol;
+ HTProtocol *p = (HTProtocol *) anchor->protocol;
/*
* Neatly and transparently vanish if source caching is disabled.
@@ -8034,14 +7993,16 @@ PRIVATE HTStream* CacheThru_new ARGS2(
/* Only remote HTML documents may benefit from HTreparse_document(), */
/* oh, assume http protocol: */
if (strcmp(p->name, "http") != 0
- && strcmp(p->name, "https") != 0) {
- CTRACE((tfp, "SourceCacheWriter: Protocol is \"%s\"; not caching\n", p->name));
+ && strcmp(p->name, "https") != 0) {
+ CTRACE((tfp, "SourceCacheWriter: Protocol is \"%s\"; not cached\n", p->name));
return target;
}
#else
/* all HTStreams will be cached */
#endif
+ CTRACE((tfp, "start CacheThru_new\n"));
+
stream = (HTStream *) malloc(sizeof(*stream));
if (!stream)
outofmem(__FILE__, "CacheThru_new");
@@ -8056,8 +8017,10 @@ PRIVATE HTStream* CacheThru_new ARGS2(
stream->status = HT_OK;
if (LYCacheSource == SOURCE_CACHE_FILE) {
+
if (anchor->source_cache_file) {
- CTRACE((tfp, "SourceCacheWriter: If successful, will replace source cache file %s\n",
+ CTRACE((tfp,
+ "SourceCacheWriter: If successful, will replace source cache file %s\n",
anchor->source_cache_file));
}
@@ -8068,36 +8031,38 @@ PRIVATE HTStream* CacheThru_new ARGS2(
* contain exactly what came in from the network.
*/
if (!(stream->fp = LYOpenTemp(filename, HTML_SUFFIX, BIN_W))) {
- CTRACE((tfp, "SourceCacheWriter: Cannot open source cache file for URL %s\n",
- HTAnchor_address((HTAnchor *)anchor)));
+ CTRACE((tfp,
+ "SourceCacheWriter: Cannot open source cache file for URL %s\n",
+ cp_freeme = HTAnchor_address((HTAnchor *) anchor)));
FREE(stream);
+ FREE(cp_freeme);
return target;
}
StrAllocCopy(stream->filename, filename);
- CTRACE((tfp, "SourceCacheWriter: Caching source for URL %s in file %s\n",
- HTAnchor_address((HTAnchor *)anchor), filename));
+ CTRACE((tfp,
+ "SourceCacheWriter: Caching source for URL %s in file %s\n",
+ cp_freeme = HTAnchor_address((HTAnchor *) anchor),
+ filename));
+ FREE(cp_freeme);
}
if (LYCacheSource == SOURCE_CACHE_MEMORY) {
if (anchor->source_cache_chunk) {
CTRACE((tfp,
"SourceCacheWriter: If successful, will replace memory chunk %p\n",
- (void *)anchor->source_cache_chunk));
+ (void *) anchor->source_cache_chunk));
}
-
-#ifdef SAVE_TIME_NOT_SPACE
- stream->chunk = HTChunkCreateMayFail(4096, 1);
-#else
- stream->chunk = HTChunkCreateMayFail(128, 1);
-#endif
+ stream->chunk = stream->last_chunk = HTChunkCreateMayFail(4096, 1);
if (!stream->chunk) /* failed already? pretty bad... - kw */
stream->status = HT_ERROR;
- CTRACE((tfp, "SourceCacheWriter: Caching source for URL %s in memory chunk %p\n",
- HTAnchor_address((HTAnchor *)anchor), (void *)stream->chunk));
-
+ CTRACE((tfp,
+ "SourceCacheWriter: Caching source for URL %s in memory chunk %p\n",
+ cp_freeme = HTAnchor_address((HTAnchor *) anchor),
+ (void *) stream->chunk));
+ FREE(cp_freeme);
}
return stream;
@@ -8107,64 +8072,65 @@ PRIVATE HTStream* CacheThru_new ARGS2(
#endif
/* HTConverter for HTML to plain text
-** ----------------------------------
-**
-** This will convert from HTML to presentation or plain text.
-**
-** It is registered in HTInit.c, but never actually used by lynx.
-** - kw 1999-03-15
-*/
-PUBLIC HTStream* HTMLToPlain ARGS3(
- HTPresentation *, pres,
- HTParentAnchor *, anchor,
- HTStream *, sink)
+ * ----------------------------------
+ *
+ * This will convert from HTML to presentation or plain text.
+ *
+ * It is registered in HTInit.c, but never actually used by lynx.
+ * - kw 1999-03-15
+ */
+HTStream *HTMLToPlain(HTPresentation *pres,
+ HTParentAnchor *anchor,
+ HTStream *sink)
{
+ CTRACE((tfp, "HTMLToPlain calling CacheThru_new\n"));
return CacheThru_new(anchor,
SGML_new(&HTML_dtd, anchor,
HTML_new(anchor, pres->rep_out, sink)));
}
/* HTConverter for HTML source to plain text
-** -----------------------------------------
-**
-** This will preparse HTML and convert back to presentation or plain text.
-**
-** It is registered in HTInit.c and used by lynx if invoked with
-** -preparsed. The stream generated here will be fed with HTML text,
-** It feeds that to the SGML.c parser, which in turn feeds an HTMLGen.c
-** structured stream for regenerating flat text; the latter should
-** end up being handled as text/plain. - kw
-*/
-PUBLIC HTStream* HTMLParsedPresent ARGS3(
- HTPresentation *, pres,
- HTParentAnchor *, anchor,
- HTStream *, sink)
+ * -----------------------------------------
+ *
+ * This will preparse HTML and convert back to presentation or plain text.
+ *
+ * It is registered in HTInit.c and used by lynx if invoked with
+ * -preparsed. The stream generated here will be fed with HTML text,
+ * It feeds that to the SGML.c parser, which in turn feeds an HTMLGen.c
+ * structured stream for regenerating flat text; the latter should
+ * end up being handled as text/plain. - kw
+ */
+HTStream *HTMLParsedPresent(HTPresentation *pres,
+ HTParentAnchor *anchor,
+ HTStream *sink)
{
- HTStream * intermediate = sink;
+ HTStream *intermediate = sink;
+
if (!intermediate) {
/*
- * Trick to prevent HTPlainPresent from translating again.
- * Temporarily change UCT_STAGE_PARSER setting in anchor
- * while the HTPlain stream is initialized, so that HTPlain
- * sees its input and output charsets as the same. - kw
+ * Trick to prevent HTPlainPresent from translating again. Temporarily
+ * change UCT_STAGE_PARSER setting in anchor while the HTPlain stream
+ * is initialized, so that HTPlain sees its input and output charsets
+ * as the same. - kw
*/
- int old_parser_cset = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_PARSER);
- int structured_cset = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_STRUCTURED);
+ int old_parser_cset = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER);
+ int structured_cset = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_STRUCTURED);
+
if (structured_cset < 0)
- structured_cset = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_HTEXT);
+ structured_cset = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT);
if (structured_cset < 0)
structured_cset = current_char_set;
HTAnchor_setUCInfoStage(anchor, structured_cset,
UCT_STAGE_PARSER, UCT_SETBY_MIME);
if (pres->rep_out == WWW_SOURCE) {
- /* same effect as
- intermediate = HTPlainPresent(pres, anchor, NULL);
- just written in a more general way:
- */
+ /* same effect as
+ intermediate = HTPlainPresent(pres, anchor, NULL);
+ just written in a more general way:
+ */
intermediate = HTStreamStack(WWW_PLAINTEXT, WWW_PRESENT,
NULL, anchor);
} else {
- /* this too should amount to calling HTPlainPresent: */
+ /* this too should amount to calling HTPlainPresent: */
intermediate = HTStreamStack(WWW_PLAINTEXT, pres->rep_out,
NULL, anchor);
}
@@ -8174,58 +8140,60 @@ PUBLIC HTStream* HTMLParsedPresent ARGS3(
if (old_parser_cset >= 0) {
HTAnchor_setUCInfoStage(anchor, old_parser_cset,
UCT_STAGE_PARSER,
- UCT_SETBY_DEFAULT+1);
+ UCT_SETBY_DEFAULT + 1);
}
}
}
if (!intermediate)
return NULL;
+ CTRACE((tfp, "HTMLParsedPresent calling CacheThru_new\n"));
return CacheThru_new(anchor,
SGML_new(&HTML_dtd, anchor,
HTMLGenerator(intermediate)));
}
/* HTConverter for HTML to C code
-** ------------------------------
-**
-** C code is like plain text but all non-preformatted code
-** is commented out.
-** This will convert from HTML to presentation or plain text.
-**
-** It is registered in HTInit.c, but normally not used by lynx.
-** - kw 1999-03-15
-*/
-PUBLIC HTStream* HTMLToC ARGS3(
- HTPresentation *, pres GCC_UNUSED,
- HTParentAnchor *, anchor,
- HTStream *, sink)
+ * ------------------------------
+ *
+ * C code is like plain text but all non-preformatted code
+ * is commented out.
+ * This will convert from HTML to presentation or plain text.
+ *
+ * It is registered in HTInit.c, but normally not used by lynx.
+ * - kw 1999-03-15
+ */
+HTStream *HTMLToC(HTPresentation *pres GCC_UNUSED,
+ HTParentAnchor *anchor,
+ HTStream *sink)
{
- HTStructured * html;
+ HTStructured *html;
+
if (sink)
- (*sink->isa->put_string)(sink, "/* "); /* Before even title */
+ (*sink->isa->put_string) (sink, "/* "); /* Before even title */
html = HTML_new(anchor, WWW_PLAINTEXT, sink);
html->comment_start = "/* ";
html->comment_end = " */\n"; /* Must start in col 1 for cpp */
if (!sink)
- HTML_put_string(html,html->comment_start);
+ HTML_put_string(html, html->comment_start);
+ CTRACE((tfp, "HTMLToC calling CacheThru_new\n"));
return CacheThru_new(anchor,
SGML_new(&HTML_dtd, anchor, html));
}
/* Presenter for HTML
-** ------------------
-**
-** This will convert from HTML to presentation or plain text.
-**
-** (Comment from original libwww:)
-** Override this if you have a windows version
-*/
+ * ------------------
+ *
+ * This will convert from HTML to presentation or plain text.
+ *
+ * (Comment from original libwww:)
+ * Override this if you have a windows version
+ */
#ifndef GUI
-PUBLIC HTStream* HTMLPresent ARGS3(
- HTPresentation *, pres GCC_UNUSED,
- HTParentAnchor *, anchor,
- HTStream *, sink GCC_UNUSED)
+HTStream *HTMLPresent(HTPresentation *pres GCC_UNUSED,
+ HTParentAnchor *anchor,
+ HTStream *sink GCC_UNUSED)
{
+ CTRACE((tfp, "HTMLPresent calling CacheThru_new\n"));
return CacheThru_new(anchor,
SGML_new(&HTML_dtd, anchor,
HTML_new(anchor, WWW_PRESENT, NULL)));
@@ -8234,37 +8202,35 @@ PUBLIC HTStream* HTMLPresent ARGS3(
/* (Comments from original libwww:) */
/* Record error message as a hypertext object
-** ------------------------------------------
-**
-** The error message should be marked as an error so that
-** it can be reloaded later.
-** This implementation just throws up an error message
-** and leaves the document unloaded.
-** A smarter implementation would load an error document,
-** marking at such so that it is retried on reload.
-**
-** On entry,
-** sink is a stream to the output device if any
-** number is the HTTP error number
-** message is the human readable message.
-**
-** On exit,
-** returns a negative number to indicate lack of success in the load.
-*/
+ * ------------------------------------------
+ *
+ * The error message should be marked as an error so that
+ * it can be reloaded later.
+ * This implementation just throws up an error message
+ * and leaves the document unloaded.
+ * A smarter implementation would load an error document,
+ * marking at such so that it is retried on reload.
+ *
+ * On entry,
+ * sink is a stream to the output device if any
+ * number is the HTTP error number
+ * message is the human readable message.
+ *
+ * On exit,
+ * returns a negative number to indicate lack of success in the load.
+ */
/* (We don't actually do any of that hypertext stuff for errors,
the trivial implementation for lynx just generates a message
and returns. - kw 1999-03-15)
*/
-PUBLIC int HTLoadError ARGS3(
- HTStream *, sink GCC_UNUSED,
- int, number,
- CONST char *, message)
+int HTLoadError(HTStream *sink GCC_UNUSED, int number,
+ const char *message)
{
HTAlert(message); /* @@@@@@@@@@@@@@@@@@@ */
return -number;
}
-PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type)
+static char *MakeNewTitle(const char **value, int src_type)
{
char *ptr;
char *newtitle = NULL;
@@ -8279,7 +8245,7 @@ PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type)
} else {
StrAllocCat(newtitle, ptr + 1);
}
-#ifdef SH_EX /* 1998/04/02 (Thu) 16:02:00 */
+#ifdef SH_EX /* 1998/04/02 (Thu) 16:02:00 */
/* for proxy server 1998/12/19 (Sat) 11:53:30 */
if (AS_casecomp(newtitle + 1, "internal-gopher-menu") == 0) {
@@ -8290,12 +8256,12 @@ PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type)
/* normal title */
ptr = strrchr(newtitle, '.');
if (ptr) {
- if (AS_casecomp(ptr, ".gif") == 0)
- *ptr = '\0';
- else if (AS_casecomp(ptr, ".jpg") == 0)
- *ptr = '\0';
- else if (AS_casecomp(ptr, ".jpeg") == 0)
- *ptr = '\0';
+ if (AS_casecomp(ptr, ".gif") == 0)
+ *ptr = '\0';
+ else if (AS_casecomp(ptr, ".jpg") == 0)
+ *ptr = '\0';
+ else if (AS_casecomp(ptr, ".jpeg") == 0)
+ *ptr = '\0';
}
StrAllocCat(newtitle, "]");
}
@@ -8305,13 +8271,15 @@ PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type)
return newtitle;
}
-PRIVATE char * MakeNewImageValue ARGS1(CONST char **, value)
+static char *MakeNewImageValue(const char **value)
{
char *ptr;
char *newtitle = NULL;
StrAllocCopy(newtitle, "[");
- ptr = strrchr(value[HTML_INPUT_SRC], '/');
+ ptr = (value[HTML_INPUT_SRC]
+ ? strrchr(value[HTML_INPUT_SRC], '/')
+ : 0);
if (!ptr) {
StrAllocCat(newtitle, value[HTML_INPUT_SRC]);
} else {
@@ -8321,15 +8289,15 @@ PRIVATE char * MakeNewImageValue ARGS1(CONST char **, value)
return newtitle;
}
-PRIVATE char * MakeNewMapValue ARGS2(CONST char **, value, CONST char*, mapstr)
+static char *MakeNewMapValue(const char **value, const char *mapstr)
{
char *ptr;
char *newtitle = NULL;
StrAllocCopy(newtitle, "[");
- StrAllocCat(newtitle,mapstr); /* ISMAP or USEMAP */
- if ( verbose_img && value[HTML_IMG_SRC] && *value[HTML_IMG_SRC] ) {
- StrAllocCat(newtitle,":");
+ StrAllocCat(newtitle, mapstr); /* ISMAP or USEMAP */
+ if (verbose_img && non_empty(value[HTML_IMG_SRC])) {
+ StrAllocCat(newtitle, ":");
ptr = strrchr(value[HTML_IMG_SRC], '/');
if (!ptr) {
StrAllocCat(newtitle, value[HTML_IMG_SRC]);