diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-11-10 19:47:00 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-11-10 19:47:00 -0500 |
commit | d3f9d5478df478427c2aa5db4507ddd0a38f0eb6 (patch) | |
tree | e27eacd6bbda653dd77f11cc020b9e0a59f7f4fc /src/HTML.c | |
parent | 18024037b515bfff83e0230b35151babe6005e18 (diff) | |
download | lynx-snapshots-d3f9d5478df478427c2aa5db4507ddd0a38f0eb6.tar.gz |
snapshot of project "lynx", label v2-8-2dev_2
Diffstat (limited to 'src/HTML.c')
-rw-r--r-- | src/HTML.c | 748 |
1 files changed, 368 insertions, 380 deletions
diff --git a/src/HTML.c b/src/HTML.c index c456d6e5..e3d05a3a 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -11,8 +11,9 @@ ** Being Overidden ** */ +#define DICKEY_TEST + #include <HTUtils.h> -#include <tcp.h> #define Lynx_HTML_Handler #include <HTChunk.h> @@ -40,6 +41,7 @@ #include <HTNestedList.h> #include <GridText.h> #include <LYSignal.h> +#include <LYStrings.h> #include <LYUtils.h> #include <LYMap.h> #include <LYList.h> @@ -47,7 +49,6 @@ #ifdef VMS #include <LYCurses.h> -#include <HTVMSUtils.h> #endif /* VMS */ #ifdef USE_COLOR_STYLE @@ -62,7 +63,7 @@ char Style_className[16384]; #include <LYexit.h> #include <LYLeaks.h> -#define FREE(x) if (x) {free(x); x = NULL;} +#define STACKLEVEL(me) ((me->stack + MAX_NESTING - 1) - me->sp) extern BOOL HTPassEightBitRaw; extern HTCJKlang HTCJK; @@ -81,7 +82,7 @@ PRIVATE HTStyleSheet * styleSheet; /* Application-wide */ /* Module-wide style cache */ -PUBLIC HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ +PRIVATE HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles */ /* and 3 header alignment styles */ /* and 3 div alignment styles */ PRIVATE HTStyle *default_style; @@ -99,19 +100,15 @@ PRIVATE void HTML_end_element PARAMS((HTStructured *me, int element_number, char **include)); -/* Forward declarations of routines -*/ -PRIVATE void get_styles NOPARAMS; -PRIVATE void change_paragraph_style PARAMS((HTStructured * me, - HTStyle * style)); - /* * If we have verbose_img set, display labels for images. */ -#define VERBOSE_IMG(value,string) \ - ((verbose_img) ? (newtitle = MakeNewTitle(value)): string) +#define VERBOSE_IMG(value,src_type,string) \ + ((verbose_img) ? (newtitle = MakeNewTitle(value,src_type)): string) -PRIVATE char * MakeNewTitle(CONST char ** value); +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)); /* Set an internal flag that the next call to a stack-affecting method ** is only internal and the stack manipulation should be skipped. - kw @@ -179,6 +176,18 @@ PRIVATE void change_paragraph_style ARGS2(HTStructured *, me, HTStyle *,style) ** 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. + */ +#if EXP_JAPANESE_SPACES +#define FIX_JAPANESE_SPACES \ + (HTCJK == CHINESE || HTCJK == JAPANESE || HTCJK == TAIPEI) + /* don't replace '\n' with ' ' if Chinese or Japanese - HN + */ +#else +#define FIX_JAPANESE_SPACES 0 +#endif + /* Character handling ** ------------------ */ @@ -218,10 +227,17 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) case HTML_TITLE: if (c == LY_SOFT_HYPHEN) return; - if (c != '\n' && c != '\t' && c != '\r') + if (c != '\n' && c != '\t' && c != '\r') { HTChunkPutc(&me->title, c); - else + } else if (FIX_JAPANESE_SPACES) { + if (c == '\t') { + HTChunkPutc(&me->title, ' '); + } else { + return; + } + } else { HTChunkPutc(&me->title, ' '); + } return; case HTML_STYLE: @@ -333,13 +349,15 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) UPDATE_STYLE; } if (c == '\n') { - if (me->in_word) { - if (HText_getLastChar(me->text) != ' ') { - me->inP = TRUE; - me->inLABEL = FALSE; - HText_appendCharacter(me->text, ' '); + if (!FIX_JAPANESE_SPACES) { + if (me->in_word) { + if (HText_getLastChar(me->text) != ' ') { + me->inP = TRUE; + me->inLABEL = FALSE; + HText_appendCharacter(me->text, ' '); + } + me->in_word = NO; } - me->in_word = NO; } } else if (c == ' ' || c == '\t') { @@ -362,15 +380,15 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c) } /* end second switch */ if (c == '\n' || c == '\t') { - HText_setLastChar(me->text, ' '); /* set it to a generic seperater */ + 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 - * seperater if there was one + * separator if there was one */ } else if (c == '\r' && HText_getLastChar(me->text) == ' ') { - HText_setLastChar(me->text, ' '); /* set it to a generic seperater */ + HText_setLastChar(me->text, ' '); /* set it to a generic separator */ } else { HText_setLastChar(me->text, c); } @@ -468,10 +486,12 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s) UPDATE_STYLE; } if (c == '\n') { - if (me->in_word) { - if (HText_getLastChar(me->text) != ' ') - HText_appendCharacter(me->text, ' '); - me->in_word = NO; + if (!FIX_JAPANESE_SPACES) { + if (me->in_word) { + if (HText_getLastChar(me->text) != ' ') + HText_appendCharacter(me->text, ' '); + me->in_word = NO; + } } } else if (c == ' ' || c == '\t') { @@ -487,15 +507,15 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s) /* set the Last Character */ if (c == '\n' || c == '\t') { - /* set it to a generic seperater */ + /* set it to a generic separator */ HText_setLastChar(me->text, ' '); } 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 seperator, if there was one. So we - * set LastChar to a generic seperater. + * previous separator, if there was one. So we + * set LastChar to a generic separator. */ HText_setLastChar(me->text, ' '); } else { @@ -616,7 +636,7 @@ PRIVATE void HTML_start_element ARGS6( char *I_value = NULL; char *I_name = NULL; char *temp = NULL; - int dest_char_set = -1; + int dest_char_set = UCLYhndl_for_unrec; HTParentAnchor *dest = NULL; /* An anchor's destination */ BOOL dest_ismap = FALSE; /* Is dest an image map script? */ BOOL UseBASE = TRUE; /* Resoved vs. BASE if present? */ @@ -671,31 +691,30 @@ PRIVATE void HTML_start_element ARGS6( if (TRACE) { - fprintf(stderr, "CSSTRIM:%s -> %d", myHash, hcode); + fprintf(tfp, "CSSTRIM:%s -> %d", myHash, hcode); if (hashStyles[hcode].code!=hcode) { char *rp=strrchr(myHash, '.'); - fprintf(stderr, " (undefined) %s\n", myHash); + fprintf(tfp, " (undefined) %s\n", myHash); if (rp) { int hcd; *rp='\0'; /* trim the class */ hcd = hash_code(myHash); - fprintf(stderr, "CSS:%s -> %d", myHash, hcd); + fprintf(tfp, "CSS:%s -> %d", myHash, hcd); if (hashStyles[hcd].code!=hcd) - fprintf(stderr, " (undefined) %s\n", myHash); + fprintf(tfp, " (undefined) %s\n", myHash); else - fprintf(stderr, " ca=%d\n", hashStyles[hcd].color); + fprintf(tfp, " ca=%d\n", hashStyles[hcd].color); } } else - fprintf(stderr, " ca=%d\n", hashStyles[hcode].color); + fprintf(tfp, " ca=%d\n", hashStyles[hcode].color); } if (displayStyles[element_number + STARTAT].color > -2) /* actually set */ { - if (TRACE) - fprintf(stderr, "CSSTRIM: start_element: top <%s>\n", HTML_dtd.tags[element_number].name); + CTRACE(tfp, "CSSTRIM: start_element: top <%s>\n", HTML_dtd.tags[element_number].name); HText_characterStyle(me->text, hcode, 1); } #endif /* USE_COLOR_STYLE */ @@ -718,11 +737,8 @@ PRIVATE void HTML_start_element ARGS6( char *related = NULL; StrAllocCopy(base, value[HTML_BASE_HREF]); - if (!(url_type = LYLegitimizeHREF(me, (char**)&base, - TRUE, TRUE))) { - if (TRACE) - fprintf(stderr, - "HTML: BASE '%s' is not an absolute URL.\n", + if (!(url_type = LYLegitimizeHREF(me, &base, TRUE, TRUE))) { + CTRACE(tfp, "HTML: BASE '%s' is not an absolute URL.\n", (base ? base : "")); if (me->inBadBASE == FALSE) HTAlert(BASE_NOT_ABSOLUTE); @@ -815,7 +831,7 @@ PRIVATE void HTML_start_element ARGS6( case HTML_META: if (present) - LYHandleMETA(me, present, value, (char **)&include); + LYHandleMETA(me, present, value, include); break; case HTML_TITLE: @@ -839,7 +855,7 @@ PRIVATE void HTML_start_element ARGS6( } } else { StrAllocCopy(href, value[HTML_LINK_HREF]); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); } /* @@ -857,7 +873,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -882,15 +898,13 @@ PRIVATE void HTML_start_element ARGS6( PARSE_ALL); StrAllocCopy(href, temp); FREE(temp); - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, (me->inBASE ? me->base_href : me->node_anchor->address)); } HTAnchor_setOwner(me->node_anchor, href); - if (TRACE) - fprintf(stderr, - "HTML: DOC OWNER '%s' found\n", href); + CTRACE(tfp, "HTML: DOC OWNER '%s' found\n", href); FREE(href); /* @@ -922,10 +936,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (!strcasecomp(value[HTML_LINK_REL], "StyleSheet") || !strcasecomp(value[HTML_LINK_REL], "Style")) { - if (TRACE) { - fprintf(stderr, - "HTML: StyleSheet link found.\n"); - } + CTRACE(tfp, "HTML: StyleSheet link found.\n"); #ifdef LINKEDSTYLES if (href && *href != '\0') { @@ -945,18 +956,16 @@ PRIVATE void HTML_start_element ARGS6( res = style_readFromFile(href); } } - if (TRACE) - fprintf(stderr, "CSS: StyleSheet=%s %d\n", href, res); + CTRACE(tfp, "CSS: StyleSheet=%s %d\n", href, res); if (res == 0) HTAnchor_setStyle (me->node_anchor, href); } - else - if (TRACE) - fprintf(stderr, + else { + CTRACE(tfp, " non-local StyleSheets not yet implemented.\n"); + } #else - if (TRACE) - fprintf(stderr, + CTRACE(tfp, " StyleSheets not yet implemented.\n"); #endif FREE(href); @@ -1012,11 +1021,8 @@ PRIVATE void HTML_start_element ARGS6( !strcasecomp(value[HTML_LINK_REL], "Bibliography")) { StrAllocCopy(title, value[HTML_LINK_REL]); } else { - if (TRACE) { - fprintf(stderr, - "HTML: LINK with REL=\"%s\" ignored.\n", + CTRACE(tfp, "HTML: LINK with REL=\"%s\" ignored.\n", value[HTML_LINK_REL]); - } FREE(href); break; } @@ -1034,11 +1040,8 @@ PRIVATE void HTML_start_element ARGS6( } else if (!strcasecomp(value[HTML_LINK_REL], "Index")) { StrAllocCopy(href, indexfile); } else { - if (TRACE) { - fprintf(stderr, - "HTML: LINK with REL=\"%s\" and no HREF ignored.\n", + CTRACE(tfp, "HTML: LINK with REL=\"%s\" and no HREF ignored.\n", value[HTML_LINK_REL]); - } break; } StrAllocCopy(title, value[HTML_LINK_REL]); @@ -1070,7 +1073,7 @@ PRIVATE void HTML_start_element ARGS6( * fingers. - FM */ SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } /* @@ -1093,12 +1096,13 @@ PRIVATE void HTML_start_element ARGS6( dest_char_set = UCGetLYhndl_byMIME(value[HTML_LINK_CHARSET]); if (dest_char_set < 0) dest_char_set = UCLYhndl_for_unrec; + if (dest_char_set < 0) /* recover if not defined :-( */ + dest_char_set = UCLYhndl_for_unspec; /* always >= 0 */ } - if (dest && dest_char_set >= 0) + if (dest) HTAnchor_setUCInfoStage(dest, dest_char_set, UCT_STAGE_PARSER, UCT_SETBY_LINK); - dest_char_set = -1; } UPDATE_STYLE; if (!HText_hasToolbar(me->text) && @@ -1122,8 +1126,7 @@ PRIVATE void HTML_start_element ARGS6( { char tmp[1024]; sprintf(tmp, "link.%s.%s.%s", value[HTML_LINK_CLASS], title, value[HTML_LINK_CLASS]); - if (TRACE) - fprintf(stderr, "CSSTRIM:link=%s\n", tmp); + CTRACE(tfp, "CSSTRIM:link=%s\n", tmp); HText_characterStyle(me->text, hash_code(tmp), 1); HTML_put_string(me, title); @@ -1160,8 +1163,7 @@ PRIVATE void HTML_start_element ARGS6( StrAllocCopy(isindex_href, value[HTML_ISINDEX_HREF]); else StrAllocCopy(isindex_href, value[HTML_ISINDEX_ACTION]); - url_type = LYLegitimizeHREF(me, (char**)&isindex_href, - TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &isindex_href, TRUE, TRUE); /* * Check whether a base tag is in effect. @@ -1206,12 +1208,11 @@ PRIVATE void HTML_start_element ARGS6( StrAllocCat(temp, " "); HTAnchor_setPrompt(me->node_anchor, temp); } else { - HTAnchor_setPrompt(me->node_anchor, - "Enter a database query: "); + HTAnchor_setPrompt(me->node_anchor, ENTER_DATABASE_QUERY); } FREE(temp); } else { - HTAnchor_setPrompt(me->node_anchor, "Enter a database query: "); + HTAnchor_setPrompt(me->node_anchor, ENTER_DATABASE_QUERY); } break; @@ -1257,7 +1258,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_FRAME_SRC] && *value[HTML_FRAME_SRC] != '\0') { StrAllocCopy(href, value[HTML_FRAME_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -1274,14 +1275,14 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -1329,7 +1330,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_IFRAME_SRC] && *value[HTML_IFRAME_SRC] != '\0') { StrAllocCopy(href, value[HTML_IFRAME_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -1346,13 +1347,13 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ NULL, /* Tag */ @@ -1412,8 +1413,8 @@ PRIVATE void HTML_start_element ARGS6( case HTML_DIV: if (me->Division_Level < (MAX_NESTING - 1)) { me->Division_Level++; - } else if (TRACE) { - fprintf(stderr, + } else { + CTRACE(tfp, "HTML: ****** Maximum nesting of %d divisions exceeded!\n", MAX_NESTING); } @@ -1541,13 +1542,20 @@ PRIVATE void HTML_start_element ARGS6( break; case HTML_P: - LYHandleP(me, present, value, (char **)&include, TRUE); + LYHandleP(me, present, value, include, TRUE); break; case HTML_BR: UPDATE_STYLE; CHECK_ID(HTML_GEN_ID); - if ((LYCollapseBRs == FALSE) || + /* 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_PreviousLineSize(me->text, FALSE)) || HText_LastLineSize(me->text, FALSE)) { HText_setLastChar(me->text, ' '); /* absorb white space */ HText_appendCharacter(me->text, '\r'); @@ -1675,9 +1683,7 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TAB: if (!present) { /* Bad tag. Must have at least one attribute. - FM */ - if (TRACE) - fprintf(stderr, - "HTML: TAB tag has no attributes. Ignored.\n"); + CTRACE(tfp, "HTML: TAB tag has no attributes. Ignored.\n"); break; } UPDATE_STYLE; @@ -1690,9 +1696,7 @@ PRIVATE void HTML_start_element ARGS6( * the ALIGN and DP attributes implemented. - FM */ HTML_put_character(me, ' '); - if (TRACE) - fprintf(stderr, - "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) { @@ -1703,9 +1707,7 @@ PRIVATE void HTML_start_element ARGS6( * that the alignment be HT_LEFT. - FM */ HTML_put_character(me, ' '); - if (TRACE) - fprintf(stderr, - "HTML: Not HT_LEFT. Using space instead of TAB.\n"); + 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]) || @@ -1744,9 +1746,7 @@ PRIVATE void HTML_start_element ARGS6( if (target < column || target > HText_getMaximumColumn(me->text)) { HTML_put_character(me, ' '); - if (TRACE) - fprintf(stderr, - "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, ' '); @@ -1789,7 +1789,7 @@ PRIVATE void HTML_start_element ARGS6( */ #ifdef NOTUSED_FOTEMODS if (me->inFONT == TRUE) - HTML_end_element(me, HTML_FONT, (char **)&include); + HTML_end_element(me, HTML_FONT, &include); #endif /* NOTUSED_FOTEMODS */ /* @@ -1815,18 +1815,15 @@ PRIVATE void HTML_start_element ARGS6( * Can't display both underline and bold at same time. */ if (me->inBoldA == TRUE || me->inBoldH == TRUE) { - if (TRACE) - fprintf(stderr,"Underline Level is %d\n", me->Underline_Level); + CTRACE(tfp, "Underline Level is %d\n", me->Underline_Level); break; } if (me->inUnderline == FALSE) { HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR); me->inUnderline = TRUE; - if (TRACE) - fprintf(stderr,"Beginning underline\n"); + CTRACE(tfp,"Beginning underline\n"); } else { - if (TRACE) - fprintf(stderr,"Underline Level is %d\n", me->Underline_Level); + CTRACE(tfp,"Underline Level is %d\n", me->Underline_Level); } break; @@ -1932,16 +1929,14 @@ PRIVATE void HTML_start_element ARGS6( (!strcasecomp(value[HTML_NOTE_CLASS], "CAUTION") || !strcasecomp(value[HTML_NOTE_CLASS], "WARNING"))) { StrAllocCopy(note, value[HTML_NOTE_CLASS]); - for (i = 0; note[i] != '\0'; i++) - note[i] = TOUPPER(note[i]); + LYUpperCase(note); StrAllocCat(note, ":"); } else if (present && present[HTML_NOTE_ROLE] && value[HTML_NOTE_ROLE] && (!strcasecomp(value[HTML_NOTE_ROLE], "CAUTION") || !strcasecomp(value[HTML_NOTE_ROLE], "WARNING"))) { StrAllocCopy(note, value[HTML_NOTE_ROLE]); - for (i = 0; note[i] != '\0'; i++) - note[i] = TOUPPER(note[i]); + LYUpperCase(note); StrAllocCat(note, ":"); } else { StrAllocCopy(note, "NOTE:"); @@ -2397,7 +2392,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } /* * Set to know we are in an anchor. @@ -2444,7 +2439,7 @@ PRIVATE void HTML_start_element ARGS6( } else { StrAllocCopy(href, value[HTML_A_HREF]); } - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Deal with our ftp gateway kludge. - FM @@ -2452,8 +2447,8 @@ PRIVATE void HTML_start_element ARGS6( if (!url_type && !strncmp(href, "/foo/..", 7) && (!strncmp(me->node_anchor->address, "ftp:", 4) || !strncmp(me->node_anchor->address, "file:", 5))) { - for (i = 0; href[i]; i++) - href[i] = href[i+7]; + for (i = 0; (href[i] = href[i+7]) != 0; i++) + ; } /* @@ -2476,7 +2471,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -2496,9 +2491,7 @@ PRIVATE void HTML_start_element ARGS6( ** Found TYPE="internal link" but not in a valid context ** where we have written it. - kw */ - if (TRACE) - fprintf(stderr, - "HTML: Found invalid HREF=\"%s\" TYPE=\"%s\"!\n", + CTRACE(tfp, "HTML: Found invalid HREF=\"%s\" TYPE=\"%s\"!\n", href, temp); FREE(temp); } @@ -2539,6 +2532,8 @@ PRIVATE void HTML_start_element ARGS6( dest_char_set = UCGetLYhndl_byMIME(temp); if (dest_char_set < 0) { dest_char_set = UCLYhndl_for_unrec; + if (dest_char_set < 0) /* recover if not defined :-( */ + dest_char_set = UCLYhndl_for_unspec; /* always >= 0 */ } } if (title != NULL || dest_ismap == TRUE || dest_char_set >= 0) { @@ -2550,7 +2545,7 @@ PRIVATE void HTML_start_element ARGS6( HTAnchor_setTitle(dest, title); if (dest && dest_ismap) dest->isISMAPScript = TRUE; - if (dest && dest_char_set >= 0) { + if (dest) { /* ** Load the anchor's chartrans structures. ** This should be done more intelligently @@ -2567,7 +2562,6 @@ PRIVATE void HTML_start_element ARGS6( FREE(temp); dest = NULL; dest_ismap = FALSE; - dest_char_set = -1; FREE(title); } me->CurrentANum = HText_beginAnchor(me->text, @@ -2582,7 +2576,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (href == NULL && me->inBoldA == FALSE) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, &include); } #endif /* NOTUSED_FOTEMODS */ FREE(href); @@ -2601,16 +2595,12 @@ PRIVATE void HTML_start_element ARGS6( )) != NULL) { if (dest->isISMAPScript == TRUE) { dest_ismap = TRUE; - if (TRACE) - fprintf(stderr, - "HTML: '%s' is an ISMAP script\n", + CTRACE(tfp, "HTML: '%s' is an ISMAP script\n", dest->address); } else if (present && present[HTML_IMG_ISMAP]) { dest_ismap = TRUE; dest->isISMAPScript = TRUE; - if (TRACE) - fprintf(stderr, - "HTML: Designating '%s' as an ISMAP script\n", + CTRACE(tfp, "HTML: Designating '%s' as an ISMAP script\n", dest->address); } } @@ -2626,7 +2616,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_IMG_USEMAP] && *value[HTML_IMG_USEMAP]) { StrAllocCopy(map_href, value[HTML_IMG_USEMAP]); CHECK_FOR_INTERN(map_href); - url_type = LYLegitimizeHREF(me, (char**)&map_href, TRUE, TRUE); + 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 @@ -2674,7 +2664,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&map_href, + LYFillLocalFileURL(&map_href, ((UseBASE && me->inBASE) ? me->base_href : me->node_anchor->address)); UseBASE = TRUE; @@ -2743,16 +2733,16 @@ PRIVATE void HTML_start_element ARGS6( LYTrimTail(alt_string); if (*alt_string == '\0') { if (map_href) { - StrAllocCopy(alt_string, (title ? - title : "[USEMAP]")); + StrAllocCopy(alt_string, (title ? title : + MakeNewMapValue(value,"USEMAP"))); } else if (dest_ismap) { - StrAllocCopy(alt_string, (title ? - title : "[ISMAP]")); + StrAllocCopy(alt_string, (title ? title : + MakeNewMapValue(value,"ISMAP"))); } else if (me->inA == TRUE && dest) { StrAllocCopy(alt_string, (title ? title : - VERBOSE_IMG(value, "[LINK]"))); + VERBOSE_IMG(value, HTML_IMG_SRC, "[LINK]"))); } else { StrAllocCopy(alt_string, @@ -2760,24 +2750,24 @@ PRIVATE void HTML_start_element ARGS6( ((present && present[HTML_IMG_ISOBJECT]) ? "(OBJECT)" : - VERBOSE_IMG(value, "[INLINE]")))); + VERBOSE_IMG(value, HTML_IMG_SRC, "[INLINE]")))); } } } } else if (map_href) { - StrAllocCopy(alt_string, (title ? - title : "[USEMAP]")); + StrAllocCopy(alt_string, (title ? title : + MakeNewMapValue(value,"USEMAP"))); } else if ((dest_ismap == TRUE) || (me->inA && present && present[HTML_IMG_ISMAP])) { - StrAllocCopy(alt_string, (title ? - title : "[ISMAP]")); + StrAllocCopy(alt_string, (title ? title : + MakeNewMapValue(value,"ISMAP"))); } else if (me->inA == TRUE && dest) { StrAllocCopy(alt_string, (title ? title : - VERBOSE_IMG(value, "[LINK]"))); + VERBOSE_IMG(value, HTML_IMG_SRC, "[LINK]"))); } else { if (pseudo_inline_alts || clickable_images) @@ -2785,22 +2775,19 @@ PRIVATE void HTML_start_element ARGS6( ((present && present[HTML_IMG_ISOBJECT]) ? "(OBJECT)" : - VERBOSE_IMG(value, "[INLINE]")))); + VERBOSE_IMG(value, HTML_IMG_SRC, "[INLINE]")))); else StrAllocCopy(alt_string, (title ? title : "")); } if (*alt_string == '\0' && map_href) { - StrAllocCopy(alt_string, "[USEMAP]"); + StrAllocCopy(alt_string, MakeNewMapValue(value,"USEMAP")); } - if (TRACE) { - fprintf(stderr, - "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n", + 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); - } /* * Check for an ID attribute. - FM @@ -2821,7 +2808,7 @@ PRIVATE void HTML_start_element ARGS6( present && present[HTML_IMG_SRC] && value[HTML_IMG_SRC] && *value[HTML_IMG_SRC] != '\0') { StrAllocCopy(href, value[HTML_IMG_SRC]); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -2838,7 +2825,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -2856,7 +2843,7 @@ PRIVATE void HTML_start_element ARGS6( if (dest_ismap) { HTML_put_character(me, ' '); me->in_word = NO; - HTML_put_string(me, "[ISMAP]"); + HTML_put_string(me, MakeNewMapValue(value,"ISMAP")); } else if (dest) { HTML_put_character(me, ' '); me->in_word = NO; @@ -2917,7 +2904,7 @@ PRIVATE void HTML_start_element ARGS6( present[HTML_IMG_ISOBJECT]) ? ((map_href || dest_ismap) ? "(IMAGE)" : "(OBJECT)") : - VERBOSE_IMG(value, "[IMAGE]"))); + VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]"))); if (id_string && !map_href) { if ((ID_A = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -2972,7 +2959,7 @@ PRIVATE void HTML_start_element ARGS6( ((present && present[HTML_IMG_ISOBJECT]) ? "(IMAGE)" : - VERBOSE_IMG(value, "[IMAGE]"))); + VERBOSE_IMG(value, HTML_IMG_SRC, "[IMAGE]"))); } else { HTML_put_character(me, ' '); /* space char may be ignored */ me->in_word = NO; @@ -3024,7 +3011,7 @@ PRIVATE void HTML_start_element ARGS6( if (dest_ismap) { HTML_put_character(me, ' ');/* space char may be ignored */ me->in_word = NO; - HTML_put_string(me, "[ISMAP]"); + HTML_put_string(me, MakeNewMapValue(value,"ISMAP")); } else if (dest) { HTML_put_character(me, ' ');/* space char may be ignored */ me->in_word = NO; @@ -3163,7 +3150,7 @@ PRIVATE void HTML_start_element ARGS6( */ StrAllocCopy(href, value[HTML_AREA_HREF]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a BASE tag is in effect, and use it @@ -3185,7 +3172,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((((me->inBASE && *href != '\0') && !(*href == '#' && LYSeekFragAREAinCur == TRUE))) @@ -3268,7 +3255,7 @@ PRIVATE void HTML_start_element ARGS6( me->inFIG = TRUE; if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (!present || (present && !present[HTML_FIG_ISOBJECT])) { @@ -3287,7 +3274,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_FIG_SRC] && *value[HTML_FIG_SRC] != '\0') { StrAllocCopy(href, value[HTML_FIG_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -3304,7 +3291,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3447,7 +3434,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_OVERLAY_SRC] && *value[HTML_OVERLAY_SRC] != '\0') { StrAllocCopy(href, value[HTML_OVERLAY_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -3464,14 +3451,14 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -3560,21 +3547,20 @@ PRIVATE void HTML_start_element ARGS6( if (present[HTML_APPLET_CODEBASE] && value[HTML_APPLET_CODEBASE] && *value[HTML_APPLET_CODEBASE]) { StrAllocCopy(base, value[HTML_APPLET_CODEBASE]); - collapse_spaces(base); + LYRemoveBlanks(base); TRANSLATE_AND_UNESCAPE_TO_STD(&base); /* * Force it to be a directory. - FM */ if (*base == '\0') StrAllocCopy(base, "/"); - if (base[strlen(base)-1] != '/') - StrAllocCat(base, "/"); - url_type = LYLegitimizeHREF(me, (char**)&base, TRUE, FALSE); + LYAddHtmlSep(&base); + url_type = LYLegitimizeHREF(me, &base, TRUE, FALSE); /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&base, + LYFillLocalFileURL(&base, (me->inBASE ? me->base_href : me->node_anchor->address)); @@ -3600,7 +3586,7 @@ PRIVATE void HTML_start_element ARGS6( } StrAllocCopy(code, value[HTML_APPLET_CODE]); - url_type = LYLegitimizeHREF(me, (char**)&code, TRUE, FALSE); + url_type = LYLegitimizeHREF(me, &code, TRUE, FALSE); href = HTParse(code, base, PARSE_ALL); FREE(base); FREE(code); @@ -3653,7 +3639,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_BGSOUND_SRC] && *value[HTML_BGSOUND_SRC] != '\0') { StrAllocCopy(href, value[HTML_BGSOUND_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href == '\0') { FREE(href); break; @@ -3674,7 +3660,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3767,7 +3753,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_EMBED_SRC] && *value[HTML_EMBED_SRC] != '\0') { StrAllocCopy(href, value[HTML_EMBED_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href != '\0') { /* * Check whether a base tag is in effect. - FM @@ -3784,7 +3770,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3911,12 +3897,9 @@ PRIVATE void HTML_start_element ARGS6( * that one now. - FM */ if (me->inFORM) { - if (TRACE) { - fprintf(stderr, - "HTML: Missing FORM end tag. Faking it!\n"); - } + CTRACE(tfp, "HTML: Missing FORM end tag. Faking it!\n"); SET_SKIP_STACK(HTML_FORM); - HTML_end_element(me, HTML_FORM, (char **)&include); + HTML_end_element(me, HTML_FORM, include); } /* @@ -3934,7 +3917,7 @@ PRIVATE void HTML_start_element ARGS6( * Prepare to do housekeeping on the reference. - FM */ StrAllocCopy(action, value[HTML_FORM_ACTION]); - url_type = LYLegitimizeHREF(me, (char**)&action, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &action, TRUE, TRUE); /* * Check whether a base tag is in effect. Note that @@ -3995,11 +3978,7 @@ PRIVATE void HTML_start_element ARGS6( if (present && present[HTML_FORM_ENCTYPE] && value[HTML_FORM_ENCTYPE] && *value[HTML_FORM_ENCTYPE]) { StrAllocCopy(enctype, value[HTML_FORM_ENCTYPE]); - /* - * Force the enctype value to all lower case. - FM - */ - for (cp = enctype; *cp; cp++) - *cp = TOLOWER(*cp); + LYLowerCase(enctype); } if (present) { @@ -4093,12 +4072,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: BUTTON tag not within FORM tag\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } /* * We'll process it, since the chances of a crash are @@ -4248,6 +4226,7 @@ PRIVATE void HTML_start_element ARGS6( int chars; BOOL UseALTasVALUE = FALSE; BOOL HaveSRClink = FALSE; + char* ImageSrc = NULL; BOOL IsSubmitOrReset = FALSE; /* init */ @@ -4300,8 +4279,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inFORM) HText_DisableCurrentForm(); #endif /* NOTDEFINED */ - if (TRACE) - fprintf(stderr, "HTML: Ignoring TYPE=\"range\"\n"); + CTRACE(tfp, "HTML: Ignoring TYPE=\"range\"\n"); break; } else if (!strcasecomp(I.type, "file")) { @@ -4323,8 +4301,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inFORM) HText_DisableCurrentForm(); #endif /* NOTDEFINED */ - if (TRACE) - fprintf(stderr, "HTML: Ignoring TYPE=\"file\"\n"); + CTRACE(tfp, "HTML: Ignoring TYPE=\"file\"\n"); break; } else if (!strcasecomp(I.type, "button")) { @@ -4341,12 +4318,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: INPUT tag not within FORM tag\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } /* * We'll process it, since the chances of a crash are @@ -4361,12 +4337,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: Missing TEXTAREA end tag.\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } } @@ -4374,13 +4349,11 @@ PRIVATE void HTML_start_element ARGS6( * Check for an unclosed SELECT, try to close it if found. */ if (me->inSELECT) { - if (TRACE) { - fprintf(stderr, "HTML: Missing SELECT end tag, faking it...\n"); - } + CTRACE(tfp, "HTML: Missing SELECT end tag, faking it...\n"); if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, (char **)&include); + HTML_end_element(me, HTML_SELECT, include); } /* @@ -4410,7 +4383,12 @@ PRIVATE void HTML_start_element ARGS6( */ UseALTasVALUE = TRUE; } - if (clickable_images == TRUE && + if (verbose_img && !clickable_images && + present && present[HTML_INPUT_SRC] && + value[HTML_INPUT_SRC] && *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")) { @@ -4421,7 +4399,7 @@ PRIVATE void HTML_start_element ARGS6( * SRC's value a link if it's still not zero-length * legitiimizing it. - FM */ - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -4438,7 +4416,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : @@ -4446,7 +4424,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -4456,7 +4434,7 @@ PRIVATE void HTML_start_element ARGS6( 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, "[IMAGE]")); + HTML_put_string(me, VERBOSE_IMG(value,HTML_INPUT_SRC,"[IMAGE]")); if (me->inBoldH == FALSE) HText_appendCharacter(me->text, LY_BOLD_END_CHAR); HText_endAnchor(me->text, 0); @@ -4479,7 +4457,7 @@ PRIVATE void HTML_start_element ARGS6( if (I.type && !strcasecomp(I.type, "hidden")) { me->HiddenValue = TRUE; - current_char_set = 0; /* Default ISO-Latin1 */ + current_char_set = LATIN1; /* Default ISO-Latin1 */ LYUseDefaultRawMode = TRUE; HTMLSetCharacterHandling(current_char_set); } @@ -4537,6 +4515,11 @@ PRIVATE void HTML_start_element ARGS6( */ StrAllocCopy(I_value, "Submit"); I.value = I_value; + } else if ( ImageSrc ) { + /* [IMAGE]-Submit with verbose images and not clickable images. + * Use ImageSrc if no other alt or value is supplied. --LE + */ + I.value = ImageSrc; } if (present && present[HTML_INPUT_CHECKED]) I.checked = YES; @@ -4714,12 +4697,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: TEXTAREA start tag not within FORM tag\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } /* * Too likely to cause a crash, so we'll ignore it. - FM @@ -4805,17 +4787,16 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inSELECT) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: SELECT start tag in SELECT element. Faking SELECT end tag. *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, (char **)&include); + HTML_end_element(me, HTML_SELECT, include); } /* @@ -4823,7 +4804,7 @@ PRIVATE void HTML_start_element ARGS6( */ LYHandleSELECT(me, present, (CONST char **)value, - (char **)&include, + include, TRUE); break; @@ -4839,12 +4820,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inSELECT) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: OPTION tag not within SELECT tag\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } /* @@ -5040,11 +5020,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } me->inTABLE = TRUE; if (!strcmp(me->sp->style->name, "Preformatted")) { @@ -5054,8 +5034,8 @@ PRIVATE void HTML_start_element ARGS6( } if (me->Division_Level < (MAX_NESTING - 1)) { me->Division_Level++; - } else if (TRACE) { - fprintf(stderr, + } else { + CTRACE(tfp, "HTML: ****** Maximum nesting of %d divisions/tables exceeded!\n", MAX_NESTING); } @@ -5094,11 +5074,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; if (HText_LastLineSize(me->text, FALSE)) { @@ -5146,11 +5126,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_TR_ID); @@ -5163,11 +5143,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_COL_ID); @@ -5176,11 +5156,11 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TH: if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_TD_ID); @@ -5194,11 +5174,11 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TD: if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_TD_ID); @@ -5223,11 +5203,12 @@ PRIVATE void HTML_start_element ARGS6( } /* end switch */ - if (HTML_dtd.tags[ElementNumber].contents != SGML_EMPTY) { +#if defined(DICKEY_TEST) + if (HTML_dtd.tags[ElementNumber].contents != SGML_EMPTY) +#endif + { if (me->skip_stack > 0) { - if (TRACE) - fprintf(stderr, - "HTML:begin_element: internal call (level %d), leaving on stack - %s\n", + CTRACE(tfp, "HTML:begin_element: internal call (level %d), leaving on stack - %s\n", me->skip_stack, me->sp->style->name); me->skip_stack--; return; @@ -5235,7 +5216,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->sp == me->stack) { if (me->stack_overrun == FALSE) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "HTML: ****** Maximum nesting of %d tags exceeded!\n", MAX_NESTING); @@ -5247,21 +5228,19 @@ PRIVATE void HTML_start_element ARGS6( return; } + CTRACE(tfp,"HTML:begin_element[%d]: adding style to stack - %s\n", + (int) STACKLEVEL(me), + me->new_style->name); (me->sp)--; me->sp[0].style = me->new_style; /* Stack new style */ me->sp[0].tag_number = ElementNumber; - - if (TRACE) - fprintf(stderr,"HTML:begin_element: adding style to stack - %s\n", - me->new_style->name); } -#if defined(USE_COLOR_STYLE) +#if defined(DICKEY_TEST) && defined(USE_COLOR_STYLE) /* end empty tags straight away */ if (HTML_dtd.tags[ElementNumber].contents == SGML_EMPTY) { - if (TRACE) - fprintf(stderr, "STYLE:begin_element:ending EMPTY element style\n"); + CTRACE(tfp, "STYLE:begin_element:ending EMPTY element style\n"); #if !defined(USE_HASH) HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF); #else @@ -5288,14 +5267,12 @@ PRIVATE void HTML_start_element ARGS6( #if defined(PREVAIL) start=strrchr(Style_className, '.'); if (start) - strcpy(prevailing_class, (char*)(start+1)); + strcpy(prevailing_class, (start+1)); else strcpy(prevailing_class, ""); #endif - - if (TRACE) - fprintf(stderr, "CSS:%s (trimmed %s, SGML_EMPTY)\n", Style_className, tmp); + CTRACE(tfp, "CSS:%s (trimmed %s, SGML_EMPTY)\n", Style_className, tmp); } } #endif /* USE_COLOR_STYLE */ @@ -5327,7 +5304,7 @@ PRIVATE void HTML_end_element ARGS3( #ifdef CAREFUL /* parser assumed to produce good nesting */ if (element_number != me->sp[0].tag_number && HTML_dtd.tags[element_number].contents != SGML_EMPTY) { - fprintf(stderr, + CTRACE(tfp, "HTMLText: end of element %s when expecting end of %s\n", HTML_dtd.tags[element_number].name, HTML_dtd.tags[me->sp->tag_number].name); @@ -5371,9 +5348,7 @@ PRIVATE void HTML_end_element ARGS3( BreakFlag = TRUE; } if (me->skip_stack > 0) { - if (TRACE) - fprintf(stderr, - "HTML:end_element: Internal call (level %d), leaving on stack - %s\n", + CTRACE(tfp, "HTML:end_element: Internal call (level %d), leaving on stack - %s\n", me->skip_stack, me->sp->style->name); me->skip_stack--; } else if (me->stack_overrun == TRUE && @@ -5419,13 +5394,11 @@ PRIVATE void HTML_end_element ARGS3( return; } else if (me->sp < (me->stack + MAX_NESTING - 1)) { (me->sp)++; - if (TRACE) - fprintf(stderr, - "HTML:end_element: Popped style off stack - %s\n", + CTRACE(tfp, "HTML:end_element[%d]: Popped style off stack - %s\n", + (int) STACKLEVEL(me), me->sp->style->name); } else { - if (TRACE) - fprintf(stderr, + CTRACE(tfp, "Stack underflow error! Tried to pop off more styles than exist in stack\n"); } } @@ -5437,11 +5410,10 @@ PRIVATE void HTML_end_element ARGS3( */ if (me->inTEXTAREA && element_number != HTML_TEXTAREA) { if (TRACE) { - fprintf(stderr, "Bad HTML: Missing TEXTAREA end tag\n"); + fprintf(tfp, "Bad HTML: Missing TEXTAREA end tag\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } } @@ -5455,9 +5427,9 @@ PRIVATE void HTML_end_element ARGS3( switch(element_number) { case HTML_HTML: - if (me->inA || me->inSELECT || me->inTEXTAREA) + if (me->inA || me->inSELECT || me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: %s%s%s%s%s not closed before HTML end tag *****\n", me->inSELECT ? "SELECT" : "", (me->inSELECT && me->inTEXTAREA) ? ", " : "", @@ -5465,10 +5437,10 @@ PRIVATE void HTML_end_element ARGS3( ((me->inSELECT || me->inTEXTAREA) && me->inA) ? ", " : "", me->inA ? "A" : ""); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } + } break; case HTML_HEAD: @@ -5510,20 +5482,23 @@ PRIVATE void HTML_end_element ARGS3( if (MBM_A_subbookmark[i] && !strcmp(MBM_A_subbookmark[i], me->node_anchor->bookmark)) { - StrAllocCat(*include, "<H2><EM>Description:</EM> "); + StrAllocCat(*include, "<H2><EM>"); + StrAllocCat(*include, gettext("Description:")); + StrAllocCat(*include, "</EM> "); StrAllocCopy(temp, ((MBM_A_subdescript[i] && *MBM_A_subdescript[i]) ? - MBM_A_subdescript[i] : "(none)")); - LYEntify((char **)&temp, TRUE); + MBM_A_subdescript[i] : gettext("(none)"))); + LYEntify(&temp, TRUE); StrAllocCat(*include, temp); - StrAllocCat(*include, - "<BR><EM> Filepath:</EM> "); + StrAllocCat(*include, "<BR><EM> "); + StrAllocCat(*include, gettext("Filepath:")); + StrAllocCat(*include, "</EM> "); StrAllocCopy(temp, ((MBM_A_subbookmark[i] && *MBM_A_subbookmark[i]) ? - MBM_A_subbookmark[i] : "(unknown)")); - LYEntify((char **)&temp, TRUE); + MBM_A_subbookmark[i] : gettext("(unknown)"))); + LYEntify(&temp, TRUE); StrAllocCat(*include, temp); FREE(temp); StrAllocCat(*include, "</H2>"); @@ -5540,10 +5515,8 @@ PRIVATE void HTML_end_element ARGS3( * we'll just ignore. - FM */ HTChunkTerminate(&me->style_block); - if (TRACE) { - fprintf(stderr, "HTML: STYLE content =\n%s\n", + CTRACE(tfp, "HTML: STYLE content =\n%s\n", me->style_block.data); - } HTChunkClear(&me->style_block); break; @@ -5553,17 +5526,15 @@ PRIVATE void HTML_end_element ARGS3( * we'll just ignore. - FM */ HTChunkTerminate(&me->script); - if (TRACE) { - fprintf(stderr, "HTML: SCRIPT content =\n%s\n", + CTRACE(tfp, "HTML: SCRIPT content =\n%s\n", me->script.data); - } HTChunkClear(&me->script); break; case HTML_BODY: - if (me->inA || me->inSELECT || me->inTEXTAREA) + if (me->inA || me->inSELECT || me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: %s%s%s%s%s not closed before BODY end tag *****\n", me->inSELECT ? "SELECT" : "", (me->inSELECT && me->inTEXTAREA) ? ", " : "", @@ -5571,10 +5542,10 @@ PRIVATE void HTML_end_element ARGS3( ((me->inSELECT || me->inTEXTAREA) && me->inA) ? ", " : "", me->inA ? "A" : ""); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } + } break; case HTML_FRAMESET: @@ -5656,7 +5627,7 @@ PRIVATE void HTML_end_element ARGS3( case HTML_P: LYHandleP(me, (CONST BOOL*)0, (CONST char **)0, - (char **)&include, + include, FALSE); break; @@ -5687,11 +5658,9 @@ PRIVATE void HTML_end_element ARGS3( if (me->inUnderline && me->Underline_Level < 1) { HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR); me->inUnderline = FALSE; - if (TRACE) - fprintf(stderr,"Ending underline\n"); + CTRACE(tfp, "Ending underline\n"); } else { - if (TRACE) - fprintf(stderr,"Underline Level is %d\n", me->Underline_Level); + CTRACE(tfp, "Underline Level is %d\n", me->Underline_Level); } break; @@ -5787,11 +5756,8 @@ PRIVATE void HTML_end_element ARGS3( case HTML_MENU: case HTML_DIR: me->List_Nesting_Level--; - if (TRACE) { - fprintf(stderr, - "HTML_end_element: Reducing List Nesting Level to %d\n", + CTRACE(tfp, "HTML_end_element: Reducing List Nesting Level to %d\n", me->List_Nesting_Level); - } change_paragraph_style(me, me->sp->style); /* Often won't really change */ UPDATE_STYLE; if (me->List_Nesting_Level >= 0) @@ -5915,8 +5881,7 @@ PRIVATE void HTML_end_element ARGS3( * pass a dummy start tag to the SGML parser so that it * will resume the accumulation of OBJECT content. - FM */ - if (TRACE) - fprintf(stderr, "HTML: Nested OBJECT tags. Recycling.\n"); + CTRACE(tfp, "HTML: Nested OBJECT tags. Recycling.\n"); if (*include == NULL) { StrAllocCopy(*include, "<OBJECT>"); } else { @@ -5935,13 +5900,12 @@ PRIVATE void HTML_end_element ARGS3( * we have bad HTML or otherwise misparsed. - FM */ if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: Unmatched OBJECT start and end tags. Discarding content:\n%s\n", me->object.data); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } goto End_Object; } @@ -5951,8 +5915,7 @@ PRIVATE void HTML_end_element ARGS3( * assuming we weren't tripped up by comments * or quoted attributes. - FM */ - if (TRACE) - fprintf(stderr, "HTML:OBJECT content:\n%s\n", me->object.data); + CTRACE(tfp, "HTML:OBJECT content:\n%s\n", me->object.data); /* * OBJECTs with DECLARE should be saved but @@ -5965,8 +5928,7 @@ PRIVATE void HTML_end_element ARGS3( if (me->object_declare == TRUE) { if (me->object_id && *me->object_id) LYHandleID(me, me->object_id); - if (TRACE) - fprintf(stderr, "HTML: DECLAREd OBJECT. Ignoring!\n"); + CTRACE(tfp, "HTML: DECLAREd OBJECT. Ignoring!\n"); goto End_Object; } @@ -5979,8 +5941,7 @@ PRIVATE void HTML_end_element ARGS3( if (me->object_name != NULL) { if (me->object_id && *me->object_id) LYHandleID(me, me->object_id); - if (TRACE) - fprintf(stderr, "HTML: NAMEd OBJECT. Ignoring!\n"); + CTRACE(tfp, "HTML: NAMEd OBJECT. Ignoring!\n"); goto End_Object; } @@ -6006,22 +5967,19 @@ PRIVATE void HTML_end_element ARGS3( } StrAllocCat(data, "</OBJECT>"); StrAllocCat(*include, data); - if (TRACE) - fprintf(stderr, "HTML: Recycling nested OBJECT%s.\n", + CTRACE(tfp, "HTML: Recycling nested OBJECT%s.\n", (e > 1) ? "s" : ""); FREE(data); goto End_Object; } else { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: Unmatched OBJECT start and end tags. Discarding content.\n"); - goto End_Object; } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); - goto End_Object; } + goto End_Object; } } @@ -6029,9 +5987,7 @@ PRIVATE void HTML_end_element ARGS3( * If it's content has SHAPES, convert it to FIG. - FM */ if (me->object_shapes == TRUE) { - if (TRACE) - fprintf(stderr, - "HTML: OBJECT has SHAPES. Converting to FIG.\n"); + CTRACE(tfp, "HTML: OBJECT has SHAPES. Converting to FIG.\n"); StrAllocCat(*include, "<FIG ISOBJECT IMAGEMAP"); if (me->object_ismap == TRUE) StrAllocCat(*include, " IMAGEMAP"); @@ -6059,9 +6015,7 @@ PRIVATE void HTML_end_element ARGS3( * convert it to IMG. - FM */ if (me->object_usemap != NULL) { - if (TRACE) - fprintf(stderr, - "HTML: OBJECT has USEMAP. Converting to IMG.\n"); + CTRACE(tfp, "HTML: OBJECT has USEMAP. Converting to IMG.\n"); StrAllocCat(*include, "<IMG ISOBJECT"); if (me->object_id != NULL) { @@ -6218,11 +6172,10 @@ End_Object: */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, "Bad HTML: Unmatched FORM end tag\n"); + fprintf(tfp, "Bad HTML: Unmatched FORM end tag\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } } @@ -6239,17 +6192,16 @@ End_Object: */ if (me->inSELECT) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: Open SELECT at FORM end. Faking SELECT end tag. *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, (char **)&include); + HTML_end_element(me, HTML_SELECT, include); } /* @@ -6298,11 +6250,10 @@ End_Object: */ if (!me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, "Bad HTML: Unmatched TEXTAREA end tag\n"); + fprintf(tfp, "Bad HTML: Unmatched TEXTAREA end tag\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } break; } @@ -6478,11 +6429,10 @@ End_Object: */ if (!me->inSELECT) { if (TRACE) { - fprintf(stderr, "Bad HTML: Unmatched SELECT end tag *****\n"); + fprintf(tfp, "Bad HTML: Unmatched SELECT end tag *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } break; } @@ -6502,12 +6452,11 @@ End_Object: */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: SELECT end tag not within FORM element *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } /* * Hopefully won't crash, so we'll ignore it. - kw @@ -6684,15 +6633,15 @@ End_Object: */ if (end) *end='\0'; - hcode=hash_code(lookfrom && *lookfrom ? lookfrom : &tmp[1]); - if (TRACE) - fprintf(stderr, "CSS:%s (trimmed %s, END_ELEMENT)\n", Style_className, tmp); + hcode = hash_code(lookfrom && *lookfrom ? lookfrom : &tmp[1]); + CTRACE(tfp, "CSS:%s (trimmed %s, END_ELEMENT)\n", Style_className, tmp); } +#if defined(DICKEY_TEST) if (HTML_dtd.tags[element_number].contents != SGML_EMPTY) +#endif { - if (TRACE) - fprintf(stderr, "STYLE:end_element: ending non-EMPTY style\n"); + CTRACE(tfp, "STYLE:end_element: ending non-EMPTY style\n"); #if !defined(USE_HASH) HText_characterStyle(me->text, element_number+STARTAT, STACK_OFF); #else @@ -6703,7 +6652,7 @@ End_Object: { char *dot=strrchr(Style_className,'.'); LYstrncpy(prevailing_class, - dot ? (char*)(dot+1) : "", + dot ? (dot+1) : "", (TEMPSTRINGSIZE - 1)); } #endif @@ -6779,19 +6728,18 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR); me->inUnderline = FALSE; me->Underline_Level = 0; - if (TRACE) - fprintf(stderr,"HTML_free: Ending underline\n"); + CTRACE(tfp,"HTML_free: Ending underline\n"); } if (me->inA) { - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, &include); me->inA = FALSE; } if (me->inFONT) { - HTML_end_element(me, HTML_FONT, (char **)&include); + HTML_end_element(me, HTML_FONT, &include); me->inFONT = FALSE; } if (me->inFORM) { - HTML_end_element(me, HTML_FORM, (char **)&include); + HTML_end_element(me, HTML_FORM, &include); me->inFORM = FALSE; } if (me->option.size > 0) { @@ -6801,20 +6749,18 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: SELECT or OPTION not ended properly *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } HTChunkTerminate(&me->option); /* * Output the left-over data as text, maybe it was invalid * markup meant to be shown somewhere. - kw */ - if (TRACE) - fprintf(stderr, "HTML_free: ***** leftover option data: %s\n", + CTRACE(tfp, "HTML_free: ***** leftover option data: %s\n", me->option.data); HTML_put_string(me, me->option.data); HTChunkClear(&me->option); @@ -6826,20 +6772,18 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: TEXTAREA not used properly *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } HTChunkTerminate(&me->textarea); /* * Output the left-over data as text, maybe it was invalid * markup meant to be shown somewhere. - kw */ - if (TRACE) - fprintf(stderr, "HTML_free: ***** leftover textarea data: %s\n", + CTRACE(tfp, "HTML_free: ***** leftover textarea data: %s\n", me->textarea.data); HTML_put_string(me, me->textarea.data); HTChunkClear(&me->textarea); @@ -6852,14 +6796,14 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) if (!dump_output_immediately && HText_sourceAnchors(me->text) < 1 && HText_HiddenLinkCount(me->text) > 0) { - HTML_start_element(me, HTML_P, 0, 0, -1, (char **)&include); + HTML_start_element(me, HTML_P, 0, 0, -1, &include); HTML_put_character(me, '['); - HTML_start_element(me, HTML_EM, 0, 0, -1, (char **)&include); + HTML_start_element(me, HTML_EM, 0, 0, -1, &include); HTML_put_string(me, - "Document has only hidden links. Use the 'l'ist command."); - HTML_end_element(me, HTML_EM, (char **)&include); + 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, (char **)&include); + HTML_end_element(me, HTML_P, &include); } /* @@ -6874,16 +6818,15 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: SELECT or OPTION not ended properly *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } if (TRACE) { HTChunkTerminate(&me->option); - fprintf(stderr, "HTML_free: ***** leftover option data: %s\n", + fprintf(tfp, "HTML_free: ***** leftover option data: %s\n", me->option.data); } HTChunkClear(&me->option); @@ -6895,16 +6838,15 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * have gone very wrong. - kw */ if (TRACE) { - fprintf(stderr, + fprintf(tfp, "Bad HTML: TEXTAREA not used properly *****\n"); } else if (!me->inBadHTML) { - _statusline(BAD_HTML_USE_TRACE); + HTUserMsg(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; - sleep(MessageSecs); } if (TRACE) { HTChunkTerminate(&me->textarea); - fprintf(stderr, "HTML_free: ***** leftover textarea data: %s\n", + fprintf(tfp, "HTML_free: ***** leftover textarea data: %s\n", me->textarea.data); } HTChunkClear(&me->textarea); @@ -6947,15 +6889,15 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) me->Underline_Level = 0; } if (me->inA) { - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, &include); me->inA = FALSE; } if (me->inFONT) { - HTML_end_element(me, HTML_FONT, (char **)&include); + HTML_end_element(me, HTML_FONT, &include); me->inFONT = FALSE; } if (me->inFORM) { - HTML_end_element(me, HTML_FORM, (char **)&include); + HTML_end_element(me, HTML_FORM, &include); me->inFORM = FALSE; } @@ -6972,10 +6914,10 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) * have gone very wrong. - kw */ if (TRACE) { - fprintf(stderr, + fprintf(tfp, "HTML_abort: SELECT or OPTION not ended properly *****\n"); HTChunkTerminate(&me->option); - fprintf(stderr, "HTML_abort: ***** leftover option data: %s\n", + fprintf(tfp, "HTML_abort: ***** leftover option data: %s\n", me->option.data); } HTChunkClear(&me->option); @@ -6987,10 +6929,10 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) * have gone very wrong. - kw */ if (TRACE) { - fprintf(stderr, + fprintf(tfp, "HTML_abort: TEXTAREA not used properly *****\n"); HTChunkTerminate(&me->textarea); - fprintf(stderr, "HTML_abort: ***** leftover textarea data: %s\n", + fprintf(tfp, "HTML_abort: ***** leftover textarea data: %s\n", me->textarea.data); } HTChunkClear(&me->textarea); @@ -7027,6 +6969,7 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) */ PRIVATE void get_styles NOARGS { + styleSheet = DefaultStyle(); default_style = HTStyleNamed(styleSheet, "Normal"); styles[HTML_H1] = HTStyleNamed(styleSheet, "Heading1"); @@ -7093,6 +7036,17 @@ PRIVATE void get_styles NOARGS styles[HTML_LISTING] = HTStyleNamed(styleSheet, "Listing"); } +/* + * If we're called from another module, make sure we've initialized styles + * array first. + */ +PUBLIC HTStyle *LYstyles ARGS1(int, style_number) +{ + if (styles[style_number] == 0) + get_styles(); + return styles[style_number]; +} + /* P U B L I C */ @@ -7154,7 +7108,6 @@ PUBLIC HTStructured* HTML_new ARGS3( * array is not necessarily the same as it was from 'get_styles()'. So * we reinitialize the whole thing. */ - styleSheet = DefaultStyle(); get_styles(); me->isa = &HTMLPresentation; @@ -7315,16 +7268,16 @@ PUBLIC HTStructured* HTML_new ARGS3( LYUCcharset *p_in = HTAnchor_getUCInfoStage(me->node_anchor, UCT_STAGE_MIME); if (p_in->enc == UCT_ENC_CJK && HTCJK == NOCJK) { - HTAnchor_resetUCInfoStage(me->node_anchor, 0, + HTAnchor_resetUCInfoStage(me->node_anchor, LATIN1, UCT_STAGE_MIME, UCT_SETBY_DEFAULT); - HTAnchor_setUCInfoStage(me->node_anchor, 0, + HTAnchor_setUCInfoStage(me->node_anchor, LATIN1, UCT_STAGE_MIME, UCT_SETBY_DEFAULT); - HTAnchor_resetUCInfoStage(me->node_anchor, 0, + HTAnchor_resetUCInfoStage(me->node_anchor, LATIN1, UCT_STAGE_PARSER, UCT_SETBY_DEFAULT); - HTAnchor_setUCInfoStage(me->node_anchor, 0, + HTAnchor_setUCInfoStage(me->node_anchor, LATIN1, UCT_STAGE_PARSER, UCT_SETBY_DEFAULT); } @@ -7509,19 +7462,54 @@ PUBLIC int HTLoadError ARGS3( return -number; } +PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type) +{ + char *ptr; + char *newtitle = NULL; -PRIVATE char * MakeNewTitle(CONST char ** value) + StrAllocCopy(newtitle, "["); + ptr = strrchr(value[src_type], '/'); + if (!ptr) { + StrAllocCat(newtitle, value[src_type]); + } else { + StrAllocCat(newtitle, ptr + 1); + } + StrAllocCat(newtitle, "]"); + return newtitle; +} + +PRIVATE char * MakeNewImageValue ARGS1(CONST char **, value) { char *ptr; char *newtitle = NULL; StrAllocCopy(newtitle, "["); - ptr = strrchr(value[HTML_IMG_SRC], '/'); + ptr = strrchr(value[HTML_INPUT_SRC], '/'); if (!ptr) { - StrAllocCat(newtitle, value[HTML_IMG_SRC]); + StrAllocCat(newtitle, value[HTML_INPUT_SRC]); } else { StrAllocCat(newtitle, ptr + 1); } + StrAllocCat(newtitle, "]-Submit"); + return newtitle; +} + +PRIVATE char * MakeNewMapValue ARGS2(const char **, value, const char*, mapstr) +{ + char *ptr; + char *newtitle = NULL; + + StrAllocCopy(newtitle, "["); + StrAllocCat(newtitle,mapstr); /* ISMAP or USEMAP */ + if ( verbose_img ) { + StrAllocCat(newtitle,":"); + ptr = strrchr(value[HTML_IMG_SRC], '/'); + if (!ptr) { + StrAllocCat(newtitle, value[HTML_IMG_SRC]); + } else { + StrAllocCat(newtitle, ptr + 1); + } + } StrAllocCat(newtitle, "]"); return newtitle; } |