commit bb63805ced4e0055db88d8efd55e9c0dd2ec72a8
parent 39a5c2120239059b73a4b99addee0aa18febe4e8
Author: ukai <ukai>
Date: Thu, 7 Feb 2002 14:15:59 +0000
[w3m-dev 03006] fix form order in table
* file.c (process_form): static
fix form index order
method should be quoted
* file.c (process_form): added
* file.c (HTMLlineproc2body): add form_id
* html.c (ALST_FORM_INT): added
* html.c (form_int): update
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat:
3 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,14 @@
+2002-02-07 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03006] fix form order in table
+ * file.c (process_form): static
+ fix form index order
+ method should be quoted
+ * file.c (process_form): added
+ * file.c (HTMLlineproc2body): add form_id
+ * html.c (ALST_FORM_INT): added
+ * html.c (form_int): update
+
2002-02-07 Fumitoshi UKAI <ukai@debian.or.jp>
* [w3m-dev 03005] fix Bad cert ident
diff --git a/file.c b/file.c
@@ -3593,8 +3593,8 @@ check_accept_charset(char *s)
}
#endif /* JP_CHARSET */
-Str
-process_form(struct parsed_tag *tag)
+static Str
+process_form_int(struct parsed_tag *tag, int fid)
{
char *p, *q, *r, *s, *tg, *n;
char cs = 0;
@@ -3617,8 +3617,16 @@ process_form(struct parsed_tag *tag)
n = NULL;
parsedtag_get_value(tag, ATTR_NAME, &n);
- form_max++;
- form_sp++;
+ if (fid < 0) {
+ form_max++;
+ form_sp++;
+ fid = form_max;
+ }
+ else { /* <form_int> */
+ if (form_max < fid)
+ form_max = fid;
+ form_sp = fid;
+ }
if (forms_size == 0) {
forms_size = INITIAL_FORM_SIZE;
forms = New_N(FormList *, forms_size);
@@ -3629,11 +3637,11 @@ process_form(struct parsed_tag *tag)
forms = New_Reuse(FormList *, forms, forms_size);
form_stack = New_Reuse(int, form_stack, forms_size);
}
- form_stack[form_sp] = form_max;
+ form_stack[form_sp] = fid;
if (w3m_halfdump) {
Str tmp = Sprintf("<form_int fid=\"%d\" action=\"%s\" method=\"%s\"",
- form_max, html_quote(q), p);
+ fid, html_quote(q), html_quote(p));
if (s)
Strcat(tmp, Sprintf(" enctype=\"%s\"", html_quote(s)));
if (tg)
@@ -3648,13 +3656,17 @@ process_form(struct parsed_tag *tag)
return tmp;
}
- forms[form_max] =
- newFormList(q, p, &cs, s, tg, n,
- (form_max > 0) ? forms[form_max - 1] : NULL);
+ forms[fid] = newFormList(q, p, &cs, s, tg, n, NULL);
return NULL;
}
Str
+process_form(struct parsed_tag *tag)
+{
+ return process_form_int(tag, -1);
+}
+
+Str
process_n_form(void)
{
if (form_sp >= 0)
@@ -4578,7 +4590,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
int frameset_sp = -1;
union frameset_element *idFrame = NULL;
char *id = NULL;
- int hseq;
+ int hseq, form_id;
Str line;
char *endp;
#ifndef KANJI_SYMBOLS
@@ -4824,13 +4836,13 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
{
FormList *form;
int top = 0, bottom = 0;
- int form_id = -1;
int textareanumber = -1;
#ifdef MENU_SELECT
int selectnumber = -1;
#endif
-
hseq = 0;
+ form_id = -1;
+
parsedtag_get_value(tag, ATTR_HSEQ, &hseq);
parsedtag_get_value(tag, ATTR_FID, &form_id);
parsedtag_get_value(tag, ATTR_TOP_MARGIN, &top);
diff --git a/html.c b/html.c
@@ -94,6 +94,11 @@ unsigned char ALST_RULE[] = { ATTR_TYPE };
#define MAXA_RULE 1
unsigned char ALST_TITLE_ALT[] = { ATTR_TITLE };
#define MAXA_TITLE_ALT 1
+unsigned char ALST_FORM_INT[] =
+ { ATTR_METHOD, ATTR_ACTION, ATTR_CHARSET, ATTR_ACCEPT_CHARSET,
+ ATTR_ENCTYPE, ATTR_TARGET, ATTR_NAME, ATTR_FID
+};
+#define MAXA_FORM_INT 8
unsigned char ALST_INPUT_ALT[] =
{ ATTR_HSEQ, ATTR_FID, ATTR_NO_EFFECT, ATTR_TYPE, ATTR_NAME, ATTR_VALUE,
ATTR_CHECKED, ATTR_ACCEPT, ATTR_SIZE, ATTR_MAXLENGTH, ATTR_READONLY,
@@ -232,7 +237,7 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"pre_int", NULL, 0, TFLG_INT}, /* 116 HTML_PRE_INT */
{"/pre_int", NULL, 0, TFLG_INT | TFLG_END}, /* 117 HTML_N_PRE_INT */
{"title_alt", ALST_TITLE_ALT, MAXA_TITLE_ALT, TFLG_INT}, /* 118 HTML_TITLE_ALT */
- {"form_int", ALST_FORM, MAXA_FORM, TFLG_INT}, /* 119 HTML_FORM_INT */
+ {"form_int", ALST_FORM_INT, MAXA_FORM_INT, TFLG_INT}, /* 119 HTML_FORM_INT */
{"/form_int", NULL, 0, TFLG_INT | TFLG_END}, /* 120 HTML_N_FORM_INT */
{"dl_compact", NULL, 0, TFLG_INT}, /* 121 HTML_DL_COMPACT */
{"input_alt", ALST_INPUT_ALT, MAXA_INPUT_ALT, TFLG_INT}, /* 122 HTML_INPUT_ALT */