diff -urN w3m-0.1.10-pre+666/cookie.c w3m-0.1.10-pre+666-kokb/cookie.c --- w3m-0.1.10-pre+666/cookie.c Fri May 26 17:03:13 2000 +++ w3m-0.1.10-pre+666-kokb/cookie.c Fri May 26 17:03:57 2000 @@ -238,7 +238,7 @@ struct portlist *portlist = NULL; #ifdef DEBUG - fprintf(stderr, "host: [%s, %s] %d\n", pu->host, pu->file, secure); + fprintf(stderr, "host: [%s, %s] %d\n", pu->host, pu->file, flag); fprintf(stderr, "cookie: [%s=%s]\n", name->ptr, value->ptr); fprintf(stderr, "expires: [%s]\n", asctime(gmtime(&expires))); if (domain) diff -urN w3m-0.1.10-pre+666/display.c w3m-0.1.10-pre+666-kokb/display.c --- w3m-0.1.10-pre+666/display.c Fri May 26 17:03:13 2000 +++ w3m-0.1.10-pre+666-kokb/display.c Fri May 26 17:03:57 2000 @@ -618,13 +618,18 @@ else if (c != '\n') addch(c); #else + else if ((unsigned char) c == 0xa0) /* NO-BREAK SPACE */ + addch(' '); else if (c != '\n') { if ((unsigned char) c < 0x80 || (unsigned char) c > 0x9F) { addch(c); } + else { /* else: Eliminate unprintables according to * iso-8859-*. Particularly 0x96 messes up T.Dickey's * (xfree-)xterm */ + addch(' '); + } } #endif /* do nothing for \n */ diff -urN w3m-0.1.10-pre+666/file.c w3m-0.1.10-pre+666-kokb/file.c --- w3m-0.1.10-pre+666/file.c Fri May 26 17:03:13 2000 +++ w3m-0.1.10-pre+666-kokb/file.c Fri May 26 17:03:58 2000 @@ -3847,9 +3847,6 @@ return 0; } -static char *tbl_srch_table[] = -{"flag & RB_INTXTA) { - p = strcasestr(str, ""); - if (p == NULL) { - feed_textarea(str); - return; - } - else { - if (p != str) { - q = allocStr(str, p - str); - feed_textarea(q); - } - close_textarea(h_env); - str = p + 11; - } - } - -#ifdef MENU_SELECT - if (obuf->flag & RB_INSELECT) { - p = strcasestr(str, ""); - if (p == NULL) - /* fail safe */ - p = strcasestr(str, ""); - - if (p == NULL) { - feed_select(str); - return; - } - else { - if (p != str) { - q = allocStr(str, p - str); - feed_select(q); - } - obuf->flag &= ~RB_INSELECT; - if (!strncasecmp(p, "", 7)) - process_n_select(); - str = p; - } - } -#endif /* MENU_SELECT */ - - /* script */ - if (obuf->flag & RB_IGNORE) { - p = strcasestr(str, obuf->ignore_tag->ptr); - if (p == NULL) { - /* just ignore script */ - return; - } - obuf->flag &= ~RB_IGNORE; - str = p + obuf->ignore_tag->length; - } - /* comment processing */ if (obuf->status == R_ST_CMNT || obuf->status == R_ST_NCMNT3 || obuf->status == R_ST_IRRTAG) { @@ -3944,27 +3889,70 @@ return; } - /* .. : Don't process tag */ - if (obuf->flag & RB_XMPMODE) { - p = strcasestr(str, ""); - if (p == NULL) - goto read_as_plain; - if (p != str) { - q = allocStr(str, p - str); - HTMLlineproc1(q, h_env); - } - str = p; - } - /* .. : ignore tag */ - if (obuf->flag & RB_LSTMODE) { - p = strcasestr(str, ""); - if (p == NULL) - goto read_as_plain; - if (p != str) { - q = allocStr(str, p - str); - HTMLlineproc1(q, h_env); + if (obuf->flag & (RB_INTXTA +#ifdef MENU_SELECT + |RB_INSELECT +#endif + |RB_XMPMODE|RB_LSTMODE|RB_IGNORE)) { + Str tok = Strnew(), tmp; + if (obuf->status != R_ST_NORMAL && h_env->tagbuf->length > 0) { + tmp = Strdup(h_env->tagbuf); + Strcat_charp(tmp, str); + str = tmp->ptr; + obuf->status = R_ST_NORMAL; + } + while (read_token(tok, &str, &obuf->status, 0, 0)) { + char *p = tok->ptr; + int status, cmd = -1; + if (ST_IS_COMMENT(obuf->status)) + goto beginning; + if (obuf->status != R_ST_NORMAL) { + h_env->tagbuf = tok; + return; + } + if (*p == '<') + cmd = gethtmlcmd(&p, &status); + /* textarea */ + if (obuf->flag & RB_INTXTA) { + if (cmd == HTML_N_TEXTAREA) { + close_textarea(h_env); + break; + } + feed_textarea(tok->ptr); + } +#ifdef MENU_SELECT + else if (obuf->flag & RB_INSELECT) { + if (cmd == HTML_N_SELECT || cmd == HTML_N_FORM) { + obuf->flag &= ~RB_INSELECT; + if (cmd == HTML_N_FORM) + str -= tok->length; + tmp = process_n_select(); + if (tmp) + HTMLlineproc1(tmp->ptr, h_env); + break; + } + feed_select(tok->ptr); + } +#endif + /* .. : Don't process tag */ + /* .. : ignore tag */ + else if (obuf->flag & (RB_XMPMODE|RB_LSTMODE)) { + if (obuf->flag & RB_XMPMODE && cmd == HTML_N_XMP || + obuf->flag & RB_LSTMODE && cmd == HTML_N_LISTING) { + str -= tok->length; + break; + } + goto read_as_plain; + } + /* script */ + else if (obuf->flag & RB_IGNORE) { + if (TAG_IS(tok->ptr, obuf->ignore_tag->ptr, + obuf->ignore_tag->length -1)) { + obuf->flag &= ~RB_IGNORE; + break; + } + } } - str = p; } while (*str != '\0') { @@ -3974,89 +3962,49 @@ * are fed to the table renderer, and then the renderer * makes HTML output. */ - check_table_tag: - if (obuf->flag & RB_N_TABLE) { - /* ``'' */ - while (*str) { - if (*str == '>') { - obuf->flag &= ~RB_N_TABLE; - str++; - goto table_end; - } - str++; - } + check_table_tag: + if (*str == '\0') return; - } - - i = strcasemstr(str, tbl_srch_table, &p); - if (i >= 0) { - if (p != str) { - q = allocStr(str, p - str); - feed_table(tables[obuf->table_level - 1], q, + switch (feed_table(tables[obuf->table_level - 1], &str, + &table_mode[obuf->table_level - 1], + table_width[obuf->table_level - 1])) { + case 0: + /* tag */ + obuf->table_level--; + obuf->prevchar = ' '; + if (obuf->table_level > 0) { + Str tmp; + if (table_width[obuf->table_level] > 0) + tmp = Sprintf("", + tables[obuf->table_level - 1]->ntable, + table_width[obuf->table_level]); + else + tmp = Sprintf("", + tables[obuf->table_level - 1]->ntable); + pushTable(tables[obuf->table_level - 1], + tables[obuf->table_level]); + feed_table1(tables[obuf->table_level - 1], tmp, &table_mode[obuf->table_level - 1], table_width[obuf->table_level - 1]); - str = p; - } - switch (i) { - case 0: - /* tag */ - str += 7; - while (*str && *str != '>') - str++; - if (*str != '>') { - obuf->flag |= RB_N_TABLE; - return; - } - str++; - table_end: - obuf->table_level--; - obuf->prevchar = ' '; - if (obuf->table_level > 0) { - Str tmp; - if (table_width[obuf->table_level] > 0) - tmp = Sprintf("", - tables[obuf->table_level - 1]->ntable, - table_width[obuf->table_level]); - else - tmp = Sprintf("", - tables[obuf->table_level - 1]->ntable); - pushTable(tables[obuf->table_level - 1], - tables[obuf->table_level]); - feed_table(tables[obuf->table_level - 1], tmp->ptr, - &table_mode[obuf->table_level - 1], - table_width[obuf->table_level - 1]); - goto check_table_tag; - /* continue to the next */ - } - if (obuf->table_level == 0) { - save_fonteffect(h_env, obuf); - renderTable(tables[0], table_width[0], h_env); - restore_fonteffect(h_env, obuf); - mode = PC_ASCII; - } - case 1: - /* tag */ - goto proc_normal; - case 2: - /* comment */ - regexCompile("--[ \t\n\r]*>", 0); - if (regexMatch(str, 0)) { - matchedPosition(&p, &q); - obuf->status = R_ST_NORMAL; - str = q; - } - else { - obuf->status = R_ST_CMNT; - return; - } + goto check_table_tag; + /* continue to the next */ } - goto check_table_tag; - } - else { - feed_table(tables[obuf->table_level - 1], str, - &table_mode[obuf->table_level - 1], - table_width[obuf->table_level - 1]); + if (obuf->table_level == 0) { + save_fonteffect(h_env, obuf); + renderTable(tables[0], table_width[0], h_env); + restore_fonteffect(h_env, obuf); + mode = PC_ASCII; + } + case 1: + /*
tag */ + goto proc_normal; + case 2: + /* comment */ + obuf->status = tables[obuf->table_level - 1]->status; + tables[obuf->table_level - 1]->status = R_ST_NORMAL; return; + default: + goto check_table_tag; } } proc_normal: @@ -4275,7 +4223,11 @@ } } } - if (!(obuf->flag & (RB_PREMODE | RB_NOBR))) { + if (!(obuf->flag & (RB_PREMODE | RB_NOBR | RB_INTXTA +#ifdef MENU_SELECT + | RB_INSELECT +#endif + | RB_XMPMODE | RB_LSTMODE | RB_IGNORE))) { char *tp; int i = 0; diff -urN w3m-0.1.10-pre+666/fm.h w3m-0.1.10-pre+666-kokb/fm.h --- w3m-0.1.10-pre+666/fm.h Fri May 26 17:03:13 2000 +++ w3m-0.1.10-pre+666-kokb/fm.h Fri May 26 17:03:58 2000 @@ -383,7 +383,6 @@ #define RB_IGNORE_P 0x4000 #define RB_TITLE 0x8000 -#define RB_N_TABLE 0x100000 #ifdef FORMAT_NICE #define RB_FILL 0x200000 #endif /* FORMAT_NICE */ diff -urN w3m-0.1.10-pre+666/proto.h w3m-0.1.10-pre+666-kokb/proto.h --- w3m-0.1.10-pre+666/proto.h Fri May 26 17:03:13 2000 +++ w3m-0.1.10-pre+666-kokb/proto.h Fri May 26 17:03:58 2000 @@ -230,7 +230,8 @@ extern struct table *begin_table(int border, int spacing, int padding); extern void check_rowcol(struct table *tbl); extern int minimum_length(char *line); -extern void feed_table(struct table *tbl, char *tline, struct table_mode *mode, int width); +extern int feed_table(struct table *tbl, char **tline, struct table_mode *mode, int width); +extern void feed_table1(struct table *tbl, Str tok, struct table_mode *mode, int width); extern void pushTable(struct table *, struct table *); extern struct form_list *newFormList(char *action, char *method, char *charset, char *enctype, char *target, struct form_list *_next); extern struct form_item_list *formList_addInput(struct form_list *fl, struct parsed_tagarg *arg); diff -urN w3m-0.1.10-pre+666/table.c w3m-0.1.10-pre+666-kokb/table.c --- w3m-0.1.10-pre+666/table.c Fri May 26 17:03:13 2000 +++ w3m-0.1.10-pre+666-kokb/table.c Fri May 26 17:03:58 2000 @@ -1984,12 +1984,15 @@ #define TAG_ACTION_NONE 0 #define TAG_ACTION_FEED 1 +#define TAG_ACTION_TABLE 2 +#define TAG_ACTION_N_TABLE 3 static int feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width) { int cmd; char *s_line; + char *p; struct table_cell *cell = &tbl->cell; struct parsed_tagarg *t_arg, *t; @@ -2013,22 +2016,51 @@ s_line = line; cmd = gethtmlcmd(&s_line, &status); + if (mode->pre_mode & TBLM_IGNORE) { + switch (cmd) { + case HTML_N_STYLE: + mode->pre_mode &= ~TBLM_STYLE; + case HTML_N_SCRIPT: + mode->pre_mode &= ~TBLM_SCRIPT; + default: + return TAG_ACTION_NONE; + } + } + #ifdef MENU_SELECT /* failsafe: a tag other than and in * . */ - if ((mode->pre_mode & TBLM_INSELECT) && - cmd != HTML_OPTION && - cmd != HTML_N_OPTION && - cmd != HTML_N_SELECT) { - mode->pre_mode &= ~TBLM_INSELECT; - tmp = process_n_select(); - if (tmp) - feed_table(tbl, tmp->ptr, mode, width); - return TAG_ACTION_NONE; + if (mode->pre_mode & TBLM_INSELECT) { + switch (cmd) { + case HTML_TABLE: + case HTML_N_TABLE: + case HTML_TR: + case HTML_N_TR: + case HTML_TD: + case HTML_N_TD: + case HTML_TH: + case HTML_N_TH: + case HTML_THEAD: + case HTML_N_THEAD: + case HTML_TBODY: + case HTML_N_TBODY: + case HTML_TFOOT: + case HTML_N_TFOOT: + case HTML_COLGROUP: + case HTML_N_COLGROUP: + case HTML_COL: + mode->pre_mode &= ~TBLM_INSELECT; + tmp = process_n_select(); + feed_table1(tbl, tmp, mode, width); + } } #endif /* MENU_SELECT */ switch (cmd) { + case HTML_TABLE: + return TAG_ACTION_TABLE; + case HTML_N_TABLE: + return TAG_ACTION_N_TABLE; case HTML_TR: if (tbl->col >= 0 && tbl->tabcontentssize > 0) setwidth(tbl, mode); @@ -2239,6 +2271,17 @@ case HTML_N_TD: setwidth(tbl, mode); tbl->flag &= ~TBL_IN_COL; +#ifdef TABLE_DEBUG + { + TextListItem *it; + int i = tbl->col, j = tbl->row; + fprintf(stderr, "(a) row,col: %d, %d\n", j, i); + if (tbl->tabdata[j] && tbl->tabdata[j][i]) { + for (it = tbl->tabdata[j][i]->first; it; it = it->next) + fprintf(stderr," [%s] \n", it->ptr); + } + } +#endif return TAG_ACTION_NONE; case HTML_P: case HTML_BR: @@ -2356,7 +2399,7 @@ break; case HTML_IMG: tok = process_img(parse_tag(line + 3)); - feed_table(tbl, tok->ptr, mode, width); + feed_table1(tbl, tok, mode, width); break; #ifdef NEW_FORM case HTML_FORM: @@ -2385,14 +2428,12 @@ #endif /* not NEW_FORM */ case HTML_INPUT: tmp = process_input(parse_tag(line + 6)); - if (tmp) - feed_table(tbl, tmp->ptr, mode, width); + feed_table1(tbl, tmp, mode, width); break; case HTML_SELECT: t_arg = parse_tag(line + 7); tmp = process_select(t_arg); - if (tmp) - feed_table(tbl, tmp->ptr, mode, width); + feed_table1(tbl, tmp, mode, width); #ifdef MENU_SELECT if (!tag_exists(t_arg, "multiple")) /* non-multiple select */ mode->pre_mode |= TBLM_INSELECT; @@ -2403,13 +2444,12 @@ mode->pre_mode &= ~TBLM_INSELECT; #endif /* MENU_SELECT */ tmp = process_n_select(); - if (tmp) - feed_table(tbl, tmp->ptr, mode, width); + feed_table1(tbl, tmp, mode, width); break; case HTML_OPTION: tmp = process_option(parse_tag(line + 7)); if (tmp) - feed_table(tbl, tmp->ptr, mode, width); + feed_table1(tbl, tmp, mode, width); #ifdef MENU_SELECT else feed_select(line); @@ -2428,15 +2468,13 @@ w = tbl->fixed_width[tbl->col]; } tmp = process_textarea(parse_tag(line + 9), w); - if (tmp) - feed_table(tbl, tmp->ptr, mode, width); + feed_table1(tbl, tmp, mode, width); mode->pre_mode |= TBLM_INTXTA; break; case HTML_N_TEXTAREA: mode->pre_mode &= ~TBLM_INTXTA; tmp = process_n_textarea(); - if (tmp) - feed_table(tbl, tmp->ptr, mode, width); + feed_table1(tbl, tmp, mode, width); break; case HTML_A: anchor = NULL; @@ -2517,6 +2555,12 @@ case HTML_N_COLGROUP: case HTML_COL: break; + case HTML_SCRIPT: + mode->pre_mode |= TBLM_SCRIPT; + break; + case HTML_STYLE: + mode->pre_mode |= TBLM_STYLE; + break; default: /* unknown tag: put into table */ return TAG_ACTION_FEED; @@ -2525,8 +2569,8 @@ } -void -feed_table(struct table *tbl, char *tline, struct table_mode *mode, int width) +int +feed_table(struct table *tbl, char **tline, struct table_mode *mode, int width) { int i; char *line; @@ -2535,17 +2579,21 @@ tmp; struct table_linfo *linfo = &tbl->linfo; - if (tline == NULL || *tline == '\0') - return; + if (*tline == NULL || **tline == '\0') + return -1; + tok = Strnew(); if (tbl->suspended_input->length > 0) { - Strcat_charp(tbl->suspended_input, tline); - tline = tbl->suspended_input->ptr; + Strcat_charp(tbl->suspended_input, *tline); + *tline = tbl->suspended_input->ptr; tbl->suspended_input = Strnew(); tbl->status = R_ST_NORMAL; } - while (read_token(tok, &tline, &tbl->status, mode->pre_mode & TBLM_PREMODE, 0)) { - if (tbl->status != R_ST_NORMAL) { + while (read_token(tok, tline, &tbl->status, mode->pre_mode & TBLM_PREMODE, 0)) { + if (ST_IS_COMMENT(tbl->status)) { + continue; + } + else if (tbl->status != R_ST_NORMAL) { /* line ended within tag */ int l = tok->length; if (tok->ptr[l - 1] == '\n') { @@ -2554,17 +2602,26 @@ Strcat_char(tok, ' '); } tbl->suspended_input = Strdup(tok); - return; + return -1; } line = tok->ptr; - if (mode->caption && strcasecmp(line, "") != 0) { + if (mode->caption && !TAG_IS(line, "caption, tok); continue; } if (*line == '<') { - if (feed_table_tag(tbl, line, mode, width) == TAG_ACTION_NONE) + int action = feed_table_tag(tbl, line, mode, width); + if (action == TAG_ACTION_NONE) continue; + else if (action == TAG_ACTION_N_TABLE) + return 0; + else if (action == TAG_ACTION_TABLE) { + *tline -= tok->length; + return 1; + } } + if (mode->pre_mode & TBLM_IGNORE) + continue; if (mode->pre_mode & TBLM_INTXTA) { feed_textarea(line); continue; @@ -2645,6 +2702,20 @@ } pushdata(tbl, tbl->row, tbl->col, line); } + if (ST_IS_COMMENT(tbl->status)) + return 2; + else + return -1; +} + +void +feed_table1(struct table *tbl, Str tok, struct table_mode *mode, int width) +{ + char *p; + if (!tok) + return; + p = tok->ptr; + feed_table(tbl, &p, mode, width); } void diff -urN w3m-0.1.10-pre+666/table.h w3m-0.1.10-pre+666-kokb/table.h --- w3m-0.1.10-pre+666/table.h Fri May 26 17:03:13 2000 +++ w3m-0.1.10-pre+666-kokb/table.h Fri May 26 17:03:58 2000 @@ -120,10 +120,14 @@ #define TBLM_INTXTA 64 #define TBLM_INSELECT 128 #define TBLM_PREMODE (TBLM_PRE|TBLM_INTXTA|TBLM_INSELECT) +#define TBLM_SCRIPT 256 +#define TBLM_STYLE 512 +#define TBLM_IGNORE (TBLM_SCRIPT|TBLM_STYLE) #define uchar unsigned char +#define ushort unsigned short struct table_mode { - uchar pre_mode; + ushort pre_mode; char indent_level; char caption; short nobr_offset;