2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_hdml.h"
18 #include "chxj_tag_util.h"
19 #include "chxj_str_util.h"
21 #include "chxj_img_conv.h"
22 #include "chxj_dump.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_encoding.h"
26 #define CHECK_BOX_PREFIX "_chxj_c_"
27 #define RADIO_BUTTON_PREFIX "_chxj_r_"
28 #define SUBMIT_BUTTON_PREFIX "_chxj_s_"
30 #define GET_HDML(X) ((hdml_t *)(X))
32 static void s_init_hdml (hdml_t *hdml, Doc *doc, request_rec *r, device_table *spec);
35 static char *s_hdml_start_html_tag (void *pdoc, Node *node);
36 static char *s_hdml_end_html_tag (void *pdoc, Node *node);
37 static char *s_hdml_start_meta_tag (void *pdoc, Node *node);
38 static char *s_hdml_end_meta_tag (void *pdoc, Node *node);
39 static char *s_hdml_start_li_tag (void *pdoc, Node *node);
40 static char *s_hdml_end_li_tag (void *pdoc, Node *node);
41 static char *s_hdml_start_head_tag (void *pdoc, Node *node);
42 static char *s_hdml_end_head_tag (void *pdoc, Node *node);
43 static char *s_hdml_start_title_tag (void *pdoc, Node *node);
44 static char *s_hdml_end_title_tag (void *pdoc, Node *node);
45 static char *s_hdml_start_base_tag (void *pdoc, Node *node);
46 static char *s_hdml_end_base_tag (void *pdoc, Node *node);
47 static char *s_hdml_start_body_tag (void *pdoc, Node *node);
48 static char *s_hdml_end_body_tag (void *pdoc, Node *node);
49 static char *s_hdml_start_a_tag (void *pdoc, Node *node);
50 static char *s_hdml_end_a_tag (void *pdoc, Node *node);
51 static char *s_hdml_start_br_tag (void *pdoc, Node *node);
52 static char *s_hdml_end_br_tag (void *pdoc, Node *node);
53 static char *s_hdml_start_tr_tag (void *pdoc, Node *node);
54 static char *s_hdml_end_tr_tag (void *pdoc, Node *node);
55 static char *s_hdml_start_font_tag (void *pdoc, Node *node);
56 static char *s_hdml_end_font_tag (void *pdoc, Node *node);
57 static char *s_hdml_start_form_tag (void *pdoc, Node *node);
58 static char *s_hdml_end_form_tag (void *pdoc, Node *node);
59 static char *s_hdml_start_input_tag (void *pdoc, Node *node);
60 static char *s_hdml_end_input_tag (void *pdoc, Node *node);
61 static char *s_hdml_start_select_tag (void *pdoc, Node *node);
62 static char *s_hdml_end_select_tag (void *pdoc, Node *node);
63 static char *s_hdml_start_option_tag (void *pdoc, Node *node);
64 static char *s_hdml_end_option_tag (void *pdoc, Node *node);
65 static char *s_hdml_start_center_tag (void *pdoc, Node *node);
66 static char *s_hdml_end_center_tag (void *pdoc, Node *node);
67 static char *s_hdml_start_hr_tag (void *pdoc, Node *node);
68 static char *s_hdml_end_hr_tag (void *pdoc, Node *node);
69 static char *s_hdml_start_img_tag (void *pdoc, Node *node);
70 static char *s_hdml_end_img_tag (void *pdoc, Node *node);
71 static char *s_hdml_start_div_tag (void *pdoc, Node *node);
72 static char *s_hdml_end_div_tag (void *pdoc, Node *node);
74 static char *s_get_form_no (request_rec *r, hdml_t *hdml);
76 static void s_hdml_count_radio_tag (hdml_t *hdml, Node *node) ;
78 static void s_hdml_do_input_text_tag (hdml_t *hdml, Node *tag);
79 static void s_hdml_do_input_password_tag(hdml_t *hdml, Node *tag);
80 static void s_hdml_do_input_submit_tag (hdml_t *hdml, Node *tag);
81 static void s_hdml_do_input_hidden_tag (hdml_t *hdml, Node *tag);
82 static void s_hdml_do_input_radio_tag (hdml_t *hdml, Node *tag);
83 static void s_hdml_do_input_checkbox_tag(hdml_t *hdml, Node *tag);
84 static void s_hdml_tag_output_upper_half(hdml_t *hdml, Node *node);
86 static hdml_t *s_output_to_hdml_out (hdml_t *hdml, char *s);
87 static hdml_t *s_output_to_hdml_card (hdml_t *hdml, char *s);
88 static void s_output_to_postdata (hdml_t *hdml, char *s);
89 static void s_output_to_init_vars (hdml_t *hdml, char *s);
90 static char *s_hdml_chxjif_tag (void *pdoc, Node *node);
91 static char *s_hdml_text_tag (void *pdoc, Node *node);
94 tag_handler hdml_handler[] = {
97 s_hdml_start_html_tag,
102 s_hdml_start_meta_tag,
167 s_hdml_start_head_tag,
172 s_hdml_start_title_tag,
173 s_hdml_end_title_tag,
177 s_hdml_start_base_tag,
182 s_hdml_start_body_tag,
217 s_hdml_start_font_tag,
222 s_hdml_start_form_tag,
227 s_hdml_start_input_tag,
228 s_hdml_end_input_tag,
232 s_hdml_start_center_tag,
233 s_hdml_end_center_tag,
242 s_hdml_start_img_tag,
247 s_hdml_start_select_tag,
248 s_hdml_end_select_tag,
252 s_hdml_start_option_tag,
253 s_hdml_end_option_tag,
257 s_hdml_start_div_tag,
322 NULL, /* not support */
323 NULL, /* not support */
333 * converts from CHTML to hdml.
335 * @param r [i] Requet_rec is appointed.
336 * @param spec [i] The result of the device specification processing which
337 * was done in advance is appointed.
338 * @param src [i] The character string before the converting is appointed.
339 * @return The character string after the converting is returned.
348 chxjconvrule_entry *entryp,
349 cookie_t *UNUSED(cookie)
360 /*--------------------------------------------------------------------------*/
362 /*--------------------------------------------------------------------------*/
364 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
366 DBG(r,"i found qrcode xml");
369 DBG(r,"not found qrcode xml");
371 /*--------------------------------------------------------------------------*/
372 /* initialize hdml structure */
373 /*--------------------------------------------------------------------------*/
374 s_init_hdml(&hdml,&doc,r, spec);
376 hdml.entryp = entryp;
378 ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
379 /*--------------------------------------------------------------------------*/
381 /*--------------------------------------------------------------------------*/
383 chxj_dump_out("[src] CHTML->HDML", src, srclen);
386 /*--------------------------------------------------------------------------*/
387 /* It is examined whether there is a location header. It ends without doing */
388 /* anything when is. */
389 /*--------------------------------------------------------------------------*/
390 buf = (char *)apr_table_get(r->headers_out, (const char *)"Location");
392 /*------------------------------------------------------------------------*/
393 /* The Location header generates tag in an initial HDML machine for the */
394 /* uncorrespon dence. */
395 /*------------------------------------------------------------------------*/
396 DBG(r, "Location is not null[Location:%s]", buf);
397 s_output_to_hdml_out(&hdml,
398 "<HDML VERSION=3.0 MARKABLE=TRUE PUBLIC=TRUE>\n"
399 "<NODISPLAY MARKABLE=TRUE PUBLIC=TRUE TITLE=\" \">\n"
400 "<ACTION TYPE=ACCEPT TASK=GO DEST=\""
402 s_output_to_hdml_out(&hdml, buf);
403 s_output_to_hdml_out(&hdml,
408 dst = apr_pstrdup(r->pool, hdml.out);
411 /*------------------------------------------------------------------------*/
412 /* Here, the parsing of the received character string is done */
413 /*------------------------------------------------------------------------*/
414 // char *ss = apr_pstrdup(r->pool, src);
415 char *ss = apr_palloc(r->pool, srclen + 1);
416 memset(ss, 0, srclen + 1);
417 memcpy(ss, src, srclen);
419 DBG(r, "input strlen(src)=[%d]\n", (int)srclen);
420 DBG(r, "[[[[%s]]]\n", src);
422 qs_init_malloc(&doc);
423 qs_init_root_node(&doc);
425 qs_parse_string(&doc, ss, srclen);
427 /*------------------------------------------------------------------------*/
428 /* The number of radiobuttons is counted. */
429 /*------------------------------------------------------------------------*/
430 s_hdml_count_radio_tag(&hdml, qs_get_root(&doc));
432 chxj_node_convert(spec,r,(void*)&hdml, &doc, qs_get_root(&doc), 0);
435 DBG(r,"tmp=[%s]", dst);
436 qs_all_free(&doc,QX_LOGMARK);
439 /*--------------------------------------------------------------------------*/
441 /*--------------------------------------------------------------------------*/
443 chxj_dump_out("[dst] CHTML->HDML", hdml.out, hdml.out_len);
446 /*--------------------------------------------------------------------------*/
447 /* When there is no processing result, former character string is copied */
448 /* and it returns it. */
449 /*--------------------------------------------------------------------------*/
452 return apr_pstrdup(r->pool,src);
455 *dstlen = hdml.out_len;
457 /*--------------------------------------------------------------------------*/
458 /* Null is set at the end of the character string to make sure. */
459 /*--------------------------------------------------------------------------*/
460 dst[hdml.out_len] = 0;
467 * The HDML structure is initialized.
469 * @param hdml [i/o] The pointer to the HDML structure that wants to be
470 * initialized is specified.
471 * @param doc [i] The Doc structure that should be set to the initialized
472 * HDML structure is specified.
473 * @param r [i] To use POOL, the pointer to request_rec is specified.
474 * @param spec [i] The pointer to the device_table
477 s_init_hdml(hdml_t *hdml, Doc *doc, request_rec *r, device_table *spec)
482 /*--------------------------------------------------------------------------*/
483 /* init hdml structure value */
484 /*--------------------------------------------------------------------------*/
485 memset(hdml, 0, sizeof(hdml_t));
487 hdml->card = qs_alloc_zero_byte_string(r);
489 hdml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
490 hdml->doc->parse_mode = PARSE_MODE_CHTML;
492 for (ii=0; ii<MAX_FORM_COUNT; ii++) {
493 hdml->var_cnt[ii] = 0;
494 hdml->postdata[ii] = qs_alloc_zero_byte_string(r);
497 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
498 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
499 hdml->radio_value_list[ii][jj] = NULL;
501 hdml->radio_name_list[ii] = NULL;
502 hdml->radio_out_cnt[ii] = 0;
503 hdml->radio_checked_value[ii] = NULL;
506 for (ii=0; ii<MAX_SUBMIT_BUTTON_COUNT; ii++)
507 hdml->submit_button[ii] = NULL;
509 hdml->init_vars = qs_alloc_zero_byte_string(r);
513 hdml->form_cnt = apr_time_now();
514 hdml->out = qs_alloc_zero_byte_string(r);
519 * It is a handler who processes the HTML tag.
521 * @param pdoc [i/o] The pointer to the HDML structure at the output
522 * destination is specified.
523 * @param node [i] The HTML tag node is specified.
524 * @return The conversion result is returned.
527 s_hdml_start_html_tag(void *pdoc, Node *UNUSED(node))
531 hdml = GET_HDML(pdoc);
533 s_output_to_hdml_out(hdml,
534 "<HDML VERSION=3.0 TTL=0 MARKABLE=TRUE>\n"
535 "<NODISPLAY NAME=D0>\n"
536 "<ACTION TYPE=ACCEPT TASK=GOSUB DEST=#D1 NEXT=#D2 CLEAR=TRUE>\n"
541 hdml->hdml_br_flag = 0;
548 * It is a handler who processes the HTML tag.
550 * @param pdoc [i/o] The pointer to the HDML structure at the output
551 * destination is specified.
552 * @param node [i] The HTML tag node is specified.
553 * @return The conversion result is returned.
556 s_hdml_end_html_tag(void *pdoc, Node *UNUSED(child))
560 hdml = GET_HDML(pdoc);
562 s_output_to_hdml_card(hdml,
563 "<NODISPLAY NAME=D1>\n"
564 "<ACTION TYPE=ACCEPT TASK=RETURN VARS=\""
567 if (strlen(hdml->init_vars))
568 s_output_to_hdml_card(hdml, hdml->init_vars );
570 s_output_to_hdml_card(hdml, "_chxj_dmy=" );
572 s_output_to_hdml_card(hdml,
577 s_output_to_hdml_out(hdml, hdml->card );
578 s_output_to_hdml_out(hdml, "</HDML>\n");
580 hdml->hdml_end_flag = 1;
587 * It is a handler who processes the META tag.
589 * @param pdoc [i/o] The pointer to the HDML structure at the output
590 * destination is specified.
591 * @param node [i] The META tag node is specified.
592 * @return The conversion result is returned.
595 s_hdml_start_meta_tag(void *pdoc, Node *UNUSED(node))
599 hdml = GET_HDML(pdoc);
601 hdml->hdml_br_flag = 0;
610 * It is a handler who processes the META tag.
612 * @param pdoc [i/o] The pointer to the HDML structure at the output
613 * destination is specified.
614 * @param node [i] The META tag node is specified.
615 * @return The conversion result is returned.
618 s_hdml_end_meta_tag(void *pdoc, Node *UNUSED(child))
622 hdml = GET_HDML(pdoc);
629 * It is a handler who processes the HEAD tag.
631 * @param pdoc [i/o] The pointer to the HDML structure at the output
632 * destination is specified.
633 * @param node [i] The HEAD tag node is specified.
634 * @return The conversion result is returned.
637 s_hdml_start_head_tag(void *pdoc, Node *UNUSED(node))
641 hdml = GET_HDML(pdoc);
645 hdml->hdml_br_flag = 0;
652 * It is a handler who processes the HEAD tag.
654 * @param pdoc [i/o] The pointer to the HDML structure at the output
655 * destination is specified.
656 * @param node [i] The HEAD tag node is specified.
657 * @return The conversion result is returned.
660 s_hdml_end_head_tag(void *pdoc, Node *UNUSED(child))
664 hdml = GET_HDML(pdoc);
672 * It is a handler who processes the TITLE tag.
674 * @param pdoc [i/o] The pointer to the HDML structure at the output
675 * destination is specified.
676 * @param node [i] The TITLE tag node is specified.
677 * @return The conversion result is returned.
680 s_hdml_start_title_tag(void *pdoc, Node *UNUSED(node))
684 hdml = GET_HDML(pdoc);
686 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"");
688 hdml->found_title = 1;
689 hdml->hdml_br_flag = 0;
696 * It is a handler who processes the TITLE tag.
698 * @param pdoc [i/o] The pointer to the HDML structure at the output
699 * destination is specified.
700 * @param node [i] The TITLE tag node is specified.
701 * @return The conversion result is returned.
704 s_hdml_end_title_tag(void *pdoc, Node *UNUSED(child))
708 hdml = GET_HDML(pdoc);
710 s_output_to_hdml_out(hdml, "\">\n");
717 * It is a handler who processes the BASE tag.
719 * @param pdoc [i/o] The pointer to the HDML structure at the output
720 * destination is specified.
721 * @param node [i] The BASE tag node is specified.
722 * @return The conversion result is returned.
725 s_hdml_start_base_tag(void *pdoc, Node *UNUSED(node))
729 hdml = GET_HDML(pdoc);
731 hdml->hdml_br_flag = 0;
738 * It is a handler who processes the BASE tag.
740 * @param pdoc [i/o] The pointer to the HDML structure at the output
741 * destination is specified.
742 * @param node [i] The BASE tag node is specified.
743 * @return The conversion result is returned.
746 s_hdml_end_base_tag(void *pdoc, Node *UNUSED(child))
750 hdml = GET_HDML(pdoc);
757 * It is a handler who processes the BODY tag.
759 * @param pdoc [i/o] The pointer to the HDML structure at the output
760 * destination is specified.
761 * @param node [i] The BODY tag node is specified.
762 * @return The conversion result is returned.
765 s_hdml_start_body_tag(void *pdoc, Node *node)
771 hdml = GET_HDML(pdoc);
775 if (hdml->found_title == 0)
776 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"NO TITLE\">\n");
778 s_output_to_hdml_out(hdml, "<ACTION TYPE=ACCEPT TASK=NOOP LABEL=\" \"");
780 /*--------------------------------*/
782 /*--------------------------------*/
783 for (attr = qs_get_attr(doc,node);
785 attr = qs_get_next_attr(doc,attr)) {
789 name = qs_get_attr_name(doc,attr);
791 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
795 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
799 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
803 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
807 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
812 s_output_to_hdml_out(hdml, ">\n");
814 hdml->hdml_br_flag = 0;
821 * It is a handler who processes the BODY tag.
823 * @param pdoc [i/o] The pointer to the HDML structure at the output
824 * destination is specified.
825 * @param node [i] The BODY tag node is specified.
826 * @return The conversion result is returned.
829 s_hdml_end_body_tag(void *pdoc, Node *UNUSED(child))
833 hdml = GET_HDML(pdoc);
835 s_output_to_hdml_out(hdml, "\n</DISPLAY>\n");
842 * It is a handler who processes the A tag.
844 * @param pdoc [i/o] The pointer to the HDML structure at the output
845 * destination is specified.
846 * @param node [i] The A tag node is specified.
847 * @return The conversion result is returned.
850 s_hdml_start_a_tag(void *pdoc, Node *node)
856 hdml = GET_HDML(pdoc);
859 s_hdml_tag_output_upper_half(hdml,node);
861 s_output_to_hdml_out(hdml, "<A");
864 /*------------------------------------*/
866 /*------------------------------------*/
867 for (attr = qs_get_attr(doc,node);
869 attr = qs_get_next_attr(doc,attr)) {
874 name = qs_get_attr_name(doc,attr);
875 value = qs_get_attr_value(doc,attr);
877 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
881 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
882 if ((*value == 'm' || *value == 'M')
883 && strncasecmp(value, "mailto:", 7) == 0) {
884 value = chxj_encoding_parameter(hdml->doc->r, value);
885 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
886 s_output_to_hdml_out(hdml, value );
887 s_output_to_hdml_out(hdml, "\" " );
890 if ((*value == 't' || *value == 'T')
891 && strncasecmp(value, "tel:", 4) == 0) {
893 s_output_to_hdml_out(hdml, " TASK=CALL NUMBER=\"");
894 s_output_to_hdml_out(hdml, &value[4] );
895 s_output_to_hdml_out(hdml, "\" " );
898 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
899 s_output_to_hdml_out(hdml, value );
900 s_output_to_hdml_out(hdml, "\"" );
904 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
905 if (strcasecmp(value, "0") != 0) {
906 s_output_to_hdml_out(hdml, " ACCESSKEY=" );
907 s_output_to_hdml_out(hdml, value );
908 s_output_to_hdml_out(hdml, "" );
912 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
916 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
920 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
924 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
928 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
932 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
936 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
940 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
944 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
948 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
952 s_output_to_hdml_out(hdml, ">" );
954 hdml->hdml_a_flag = 1;
956 hdml->hdml_br_flag = 0;
963 * It is a handler who processes the A tag.
965 * @param pdoc [i/o] The pointer to the HDML structure at the output
966 * destination is specified.
967 * @param node [i] The A tag node is specified.
968 * @return The conversion result is returned.
971 s_hdml_end_a_tag(void *pdoc, Node *UNUSED(child))
975 hdml = GET_HDML(pdoc);
977 s_output_to_hdml_out(hdml, "</A>\n");
979 hdml->hdml_a_flag = 0;
986 * It is a handler who processes the BR tag.
988 * @param pdoc [i/o] The pointer to the HDML structure at the output
989 * destination is specified.
990 * @param node [i] The BR tag node is specified.
991 * @return The conversion result is returned.
994 s_hdml_start_br_tag(void *pdoc, Node *UNUSED(node))
998 hdml = GET_HDML(pdoc);
1000 if (hdml->in_center > 0)
1001 hdml->in_center = 0;
1003 if (hdml->div_in_center > 0)
1004 hdml->div_in_center = 0;
1006 s_output_to_hdml_out(hdml, "<BR>\n");
1008 hdml->hdml_br_flag = 1;
1015 * It is a handler who processes the BR tag.
1017 * @param pdoc [i/o] The pointer to the HDML structure at the output
1018 * destination is specified.
1019 * @param node [i] The BR tag node is specified.
1020 * @return The conversion result is returned.
1023 s_hdml_end_br_tag(void *pdoc, Node *UNUSED(child))
1027 hdml = GET_HDML(pdoc);
1034 * It is a handler who processes the TR tag.
1036 * @param pdoc [i/o] The pointer to the HDML structure at the output
1037 * destination is specified.
1038 * @param node [i] The TR tag node is specified.
1039 * @return The conversion result is returned.
1042 s_hdml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1046 hdml = GET_HDML(pdoc);
1048 if (hdml->in_center > 0)
1049 hdml->in_center = 0;
1051 if (hdml->div_in_center > 0)
1052 hdml->div_in_center = 0;
1054 s_output_to_hdml_out(hdml, "<BR>\n");
1056 hdml->hdml_br_flag = 1;
1063 * It is a handler who processes the TR tag.
1065 * @param pdoc [i/o] The pointer to the HDML structure at the output
1066 * destination is specified.
1067 * @param node [i] The TR tag node is specified.
1068 * @return The conversion result is returned.
1071 s_hdml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1075 hdml = GET_HDML(pdoc);
1082 * It is a handler who processes the FONT tag.
1084 * @param pdoc [i/o] The pointer to the HDML structure at the output
1085 * destination is specified.
1086 * @param node [i] The FONT tag node is specified.
1087 * @return The conversion result is returned.
1090 s_hdml_start_font_tag(void *pdoc, Node *UNUSED(node))
1094 hdml = GET_HDML(pdoc);
1101 * It is a handler who processes the FONT tag.
1103 * @param pdoc [i/o] The pointer to the HDML structure at the output
1104 * destination is specified.
1105 * @param node [i] The FONT tag node is specified.
1106 * @return The conversion result is returned.
1109 s_hdml_end_font_tag(void *pdoc, Node *UNUSED(child))
1113 hdml = GET_HDML(pdoc);
1120 * It is a handler who processes the FORM tag.
1122 * @param pdoc [i/o] The pointer to the HDML structure at the output
1123 * destination is specified.
1124 * @param node [i] The FORM tag node is specified.
1125 * @return The conversion result is returned.
1128 s_hdml_start_form_tag(void *pdoc, Node *node)
1136 hdml = GET_HDML(pdoc);
1141 hdml->form_tmp = apr_psprintf(r->pool,
1142 "<NODISPLAY NAME=F%d>\n",
1143 hdml->pure_form_cnt);
1144 hdml->form_tmp = apr_pstrcat(r->pool,
1146 "<ACTION TYPE=ACCEPT TASK=GO METHOD=POST DEST=\"",
1148 /* Get Attributes */
1149 for (attr = qs_get_attr(doc,node);
1151 attr = qs_get_next_attr(doc,attr)) {
1156 name = qs_get_attr_name(doc,attr);
1157 value = qs_get_attr_value(doc,attr);
1159 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1160 value = chxj_encoding_parameter(hdml->doc->r, value);
1161 act = apr_psprintf(r->pool, "%s", value);
1167 hdml->form_tmp = apr_pstrcat(r->pool,
1172 hdml->form_tmp = apr_pstrcat(r->pool,
1176 hdml->form_tmp = apr_pstrcat(r->pool,
1181 hdml->hdml_br_flag = 0;
1188 * handler of the form end tag.
1190 * @param pdoc [i/o] The pointer to the HDML structure at the output
1191 * destination is specified.
1192 * @param child [i] unused.
1193 * @return The HDML output result after it edits it is returned.
1196 s_hdml_end_form_tag(void *pdoc, Node *UNUSED(child))
1201 hdml = GET_HDML(pdoc);
1204 s_output_to_postdata(hdml, "_chxj_dmy=");
1206 hdml->form_tmp = apr_pstrcat(r->pool,
1208 hdml->postdata[hdml->pure_form_cnt],
1211 hdml->form_tmp = apr_pstrcat(r->pool,
1213 "\" CLEAR=TRUE >\n",
1215 hdml->form_tmp = apr_pstrcat(r->pool,
1220 s_output_to_hdml_card(hdml, hdml->form_tmp);
1222 hdml->form_tmp = NULL;
1223 hdml->pure_form_cnt++;
1230 * It is a handler that takes charge of the processing of the input tag.
1232 * @param pdoc [i/o] The pointer to the HDML structure at the output
1233 * destination is specified.
1234 * @param node [i] The tag node to be processed is specified.
1237 s_hdml_start_input_tag(void *pdoc, Node *node)
1243 hdml = GET_HDML(pdoc);
1246 /*--------------------------------------------------------------------------*/
1247 /* The attribute of the input tag is acquired. */
1248 /*--------------------------------------------------------------------------*/
1249 for (attr = qs_get_attr(doc,node);
1251 attr = qs_get_next_attr(doc,attr)) {
1256 name = qs_get_attr_name(doc,attr);
1257 value = qs_get_attr_value(doc,attr);
1259 if ((*name == 't'|| *name == 'T') && strcasecmp(name, "type") == 0) {
1260 if ((*value == 't' || *value == 'T') && strcasecmp(value, "text") == 0) {
1261 /*--------------------------------------------------------------------*/
1262 /* "input type ='text'" tag is processed. */
1263 /*--------------------------------------------------------------------*/
1264 s_hdml_do_input_text_tag(hdml, node);
1267 if ((*value == 'p' || *value == 'P') && strcasecmp(value, "password") == 0) {
1268 /*--------------------------------------------------------------------*/
1269 /* "input type='password'" tag is processed. */
1270 /*--------------------------------------------------------------------*/
1271 s_hdml_do_input_password_tag(hdml, node);
1274 if ((*value == 's' || *value == 'S') && strcasecmp(value, "submit") == 0) {
1275 /*--------------------------------------------------------------------*/
1276 /* "input type='submit'" tag is processed. */
1277 /*--------------------------------------------------------------------*/
1278 s_hdml_do_input_submit_tag(hdml, node);
1281 if ((*value == 'h' || *value == 'H') && strcasecmp(value, "hidden") == 0) {
1282 /*--------------------------------------------------------------------*/
1283 /* "input type='hidden'" tag is processed. */
1284 /*--------------------------------------------------------------------*/
1285 s_hdml_do_input_hidden_tag(hdml, node);
1288 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "radio") == 0) {
1289 /*--------------------------------------------------------------------*/
1290 /* "input type='radio'" tag is processed. */
1291 /*--------------------------------------------------------------------*/
1292 s_hdml_do_input_radio_tag(hdml, node);
1295 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "checkbox") == 0) {
1296 /*--------------------------------------------------------------------*/
1297 /* "input type='checkbox'" tag is processed. */
1298 /*--------------------------------------------------------------------*/
1299 s_hdml_do_input_checkbox_tag(hdml, node);
1303 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1307 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "value") == 0) {
1311 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1315 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "maxlength") == 0) {
1319 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "checked") == 0) {
1323 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1327 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "istyle") == 0) {
1332 hdml->hdml_br_flag = 0;
1339 * The substitution processing of tag "input type = text" is done.
1341 * @param hdml [i/o] The pointer to the HDML structure at the output
1342 * destination is specified.
1343 * @param tag [i] The tag node of input type=text is specified.
1346 s_hdml_do_input_text_tag(hdml_t *hdml, Node *tag)
1360 s_hdml_tag_output_upper_half(hdml, tag);
1363 s_output_to_hdml_out(hdml,
1364 apr_psprintf(r->pool,
1365 "<A TASK=GOSUB LABEL=\x93\xfc\x97\xcd DEST=#D%d "
1366 "VARS=\"V=$%s%02d\" RECEIVE=%s%02d>",
1368 s_get_form_no(r, hdml),
1369 hdml->var_cnt[hdml->pure_form_cnt],
1370 s_get_form_no(r, hdml),
1371 hdml->var_cnt[hdml->pure_form_cnt]
1374 s_output_to_hdml_out(hdml,
1375 apr_psprintf(r->pool,
1377 s_get_form_no(r, hdml),
1378 hdml->var_cnt[hdml->pure_form_cnt]));
1380 /*--------------------------------------------------------------------------*/
1381 /* ENTRY CARD is output here. */
1382 /*--------------------------------------------------------------------------*/
1383 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1384 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1385 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1391 nm = qs_get_name_attr(doc, tag, r);
1393 nm = qs_alloc_zero_byte_string(r);
1396 s_output_to_postdata(hdml,
1397 apr_psprintf(r->pool,
1400 s_get_form_no(r, hdml),
1401 hdml->var_cnt[hdml->pure_form_cnt]));
1403 mlen = qs_get_maxlength_attr (doc, tag, r);
1404 is = qs_get_istyle_attr (doc, tag, r);
1405 val = qs_get_value_attr (doc, tag, r);
1407 fmt = qs_conv_istyle_to_format(r, is);
1408 DBG(r,"qs_conv_istyle_to_format end");
1412 for (ii=0; ii<strlen(mlen); ii++) {
1413 if (mlen[ii] < '0' || mlen[ii] > '9') {
1414 mlen = apr_psprintf(r->pool, "0");
1418 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=%d%s", atoi(mlen), fmt));
1421 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1424 s_output_to_hdml_card(hdml,
1425 " MARKABLE=FALSE>\n"
1426 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1430 s_output_to_init_vars(hdml,
1431 apr_psprintf(r->pool,
1433 s_get_form_no(r, hdml),
1434 hdml->var_cnt[hdml->pure_form_cnt],
1435 ap_escape_uri(r->pool,val)));
1437 s_output_to_init_vars(hdml,
1438 apr_psprintf(r->pool,
1440 s_get_form_no(r, hdml),
1441 hdml->var_cnt[hdml->pure_form_cnt]));
1443 hdml->var_cnt[hdml->pure_form_cnt]++;
1448 * The substitution processing of tag "input type = password" is done.
1450 * @param hdml [i/o] The pointer to the HDML structure at the output
1451 * destination is specified.
1452 * @param tag [i] The tag node of input type=password is specified.
1455 s_hdml_do_input_password_tag(hdml_t *hdml, Node *tag)
1468 s_hdml_tag_output_upper_half(hdml, tag);
1471 s_output_to_hdml_out(hdml, "<A TASK=GOSUB LABEL=\"\x93\xfc\x97\xcd\" DEST=");
1472 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "#D%d ", hdml->card_cnt));
1473 s_output_to_hdml_out(hdml,
1474 apr_psprintf(r->pool,
1475 "VARS=\"V=$%s%02d\" ",
1476 s_get_form_no(r, hdml),
1477 hdml->var_cnt[hdml->pure_form_cnt]));
1479 s_output_to_hdml_out(hdml,
1480 apr_psprintf(r->pool, "RECEIVE=%s%02d>" ,
1481 s_get_form_no(r, hdml),
1482 hdml->var_cnt[hdml->pure_form_cnt]));
1483 s_output_to_hdml_out(hdml,
1484 apr_psprintf(r->pool, "[$%s%02d]</A>\n" ,
1485 s_get_form_no(r, hdml),
1486 hdml->var_cnt[hdml->pure_form_cnt]));
1488 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1489 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1490 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1497 nm = qs_get_name_attr(doc, tag, r);
1499 nm = qs_alloc_zero_byte_string(r);
1501 s_output_to_postdata(hdml,
1502 apr_psprintf(r->pool,
1505 s_get_form_no(r, hdml),
1506 hdml->var_cnt[hdml->pure_form_cnt]));
1508 mlen = qs_get_maxlength_attr (doc, tag, r);
1509 val = qs_get_value_attr (doc, tag, r);
1510 /*--------------------------------------------------------------------------*/
1511 /* Default is a figure input. */
1512 /*--------------------------------------------------------------------------*/
1513 fmt = apr_psprintf(r->pool, "N");
1515 if (chxj_chk_numeric(mlen) != 0)
1516 mlen = apr_psprintf(r->pool, "0");
1517 s_output_to_hdml_card(hdml,
1518 apr_psprintf(r->pool, " FORMAT=%d%s", chxj_atoi(mlen), fmt));
1521 s_output_to_hdml_card(hdml,
1522 apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1524 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " NOECHO=TRUE "));
1526 s_output_to_hdml_card(hdml,
1527 " MARKABLE=FALSE>\n"
1528 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1532 s_output_to_init_vars(hdml,
1533 apr_psprintf(r->pool, "%s%02d=%s",
1534 s_get_form_no(r, hdml),
1535 hdml->var_cnt[hdml->pure_form_cnt],
1536 ap_escape_uri(r->pool,val)));
1538 s_output_to_init_vars(hdml,
1539 apr_psprintf(r->pool, "%s%02d=",
1540 s_get_form_no(r, hdml),
1541 hdml->var_cnt[hdml->pure_form_cnt]));
1543 hdml->var_cnt[hdml->pure_form_cnt]++;
1547 * The substitution processing of tag "input type = submit" is done.
1549 * @param hdml [i/o] The pointer to the HDML structure at the output
1550 * destination is specified.
1551 * @param tag [i] The tag node of input type=submit is specified.
1554 s_hdml_do_input_submit_tag(hdml_t *hdml, Node *tag)
1556 Doc *doc = hdml->doc;
1557 request_rec *r = doc->r;
1561 s_hdml_tag_output_upper_half(hdml, tag);
1563 s_output_to_hdml_out(hdml,
1564 apr_psprintf(r->pool,
1565 "<A TASK=GO LABEL=OK DEST=#F%d ",
1566 hdml->pure_form_cnt));
1568 /*--------------------------------------------------------------------------*/
1569 /* get name and value attribute */
1570 /*--------------------------------------------------------------------------*/
1571 nm = qs_get_name_attr (doc, tag, r);
1572 val = qs_get_value_attr (doc, tag, r);
1575 s_output_to_hdml_out(hdml,
1576 apr_psprintf(r->pool, "VARS=\"%s=%s\" ",
1578 ap_escape_uri(r->pool,val)));
1579 if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL) {
1580 s_output_to_postdata(hdml,
1581 apr_psprintf(r->pool,"%s%s=$%s",
1582 SUBMIT_BUTTON_PREFIX, nm, nm));
1585 s_output_to_hdml_out(hdml, ">" );
1586 s_output_to_hdml_out(hdml, val);
1587 s_output_to_hdml_out(hdml, "</A>\n" );
1592 * The substitution processing of tag "input type = hidden" is done.
1594 * @param hdml [i/o] The pointer to the HDML structure at the output
1595 * destination is specified.
1596 * @param tag [i] The tag node of input type=hidden is specified.
1599 s_hdml_do_input_hidden_tag(hdml_t *hdml, Node *tag)
1601 Doc *doc = hdml->doc;
1602 request_rec *r = doc->r;
1606 /*--------------------------------------------------------------------------*/
1607 /* get name and value attribute */
1608 /*--------------------------------------------------------------------------*/
1609 nm = qs_get_name_attr (doc, tag, r);
1610 val = qs_get_value_attr (doc, tag, r);
1613 s_output_to_postdata(hdml,
1614 apr_psprintf(r->pool,
1617 ap_escape_uri(r->pool, val)));
1622 * The substitution processing of tag "input type = radio" is done.
1624 * @param hdml [i/o] The pointer to the HDML structure at the output
1625 * destination is specified.
1626 * @param tag [i] The tag node of input type=radio is specified.
1629 s_hdml_do_input_radio_tag(hdml_t *hdml, Node *tag)
1631 Doc *doc = hdml->doc;
1632 request_rec *r = doc->r;
1640 s_hdml_tag_output_upper_half(hdml, tag);
1642 /*--------------------------------------------------------------------------*/
1643 /* get name and value attribute */
1644 /*--------------------------------------------------------------------------*/
1645 nm = qs_get_name_attr (doc, tag, r);
1646 val = qs_get_value_attr (doc, tag, r);
1648 /*--------------------------------------------------------------------------*/
1649 /* The same name is searched out from the list made beforehand. */
1650 /*--------------------------------------------------------------------------*/
1651 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
1652 if (! hdml->radio_name_list[ii]) {
1654 DBG(r, "Oops... radio list is null[%d]", ii);
1655 /*----------------------------------------------------------------------*/
1656 /* Processing is ended because it doesn't happen off the fly. */
1657 /*----------------------------------------------------------------------*/
1661 if (strcasecmp(hdml->radio_name_list[ii], nm) == 0)
1664 if (ii == MAX_RADIO_COUNT) {
1666 DBG(r,"Oops... The same name was not in the list. ");
1667 /*------------------------------------------------------------------------*/
1668 /* Processing is ended because it doesn't happen off the fly. */
1669 /*------------------------------------------------------------------------*/
1673 s_output_to_hdml_out(hdml,
1674 apr_psprintf(r->pool,
1676 "LABEL=\"\x93\xfc\x97\xcd\" "
1677 "DEST=#R%d VARS=\"VAL=%s\" "
1683 if (hdml->radio_out_cnt[ii] == 0) {
1684 s_output_to_hdml_card(hdml,
1685 apr_psprintf(r->pool,
1686 "<NODISPLAY NAME=R%d>\n",
1688 s_output_to_hdml_card(hdml,
1689 apr_psprintf(r->pool,
1691 "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
1694 kk = hdml->radio_out_cnt[ii];
1695 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
1696 if (! hdml->radio_value_list[ii][jj])
1701 for (jj=0; jj<r_cnt; jj++) {
1702 if (! hdml->radio_value_list[ii][jj])
1706 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
1707 if (hdml->radio_out_cnt[ii] == 0)
1708 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
1711 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
1712 if (hdml->radio_out_cnt[ii] == 0) {
1714 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
1716 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
1723 s_output_to_hdml_out(hdml,
1724 apr_psprintf(r->pool, "\" >$%s_%02d</A>",
1726 hdml->radio_out_cnt[ii]));
1727 if (! hdml->radio_out_cnt[ii]) {
1728 s_output_to_hdml_card(hdml, "\">\n" );
1729 s_output_to_hdml_card(hdml, "</NODISPLAY>\n");
1731 s_output_to_postdata(hdml, apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
1733 for (jj=0; jj<r_cnt; jj++) {
1734 if (hdml->radio_value_list[ii][jj] && hdml->radio_checked_value[ii]) {
1735 if (strcasecmp(hdml->radio_value_list[ii][jj],
1736 hdml->radio_checked_value[ii]) == 0) {
1737 s_output_to_init_vars(hdml,
1738 apr_psprintf(r->pool,
1744 s_output_to_init_vars(hdml,
1745 apr_psprintf(r->pool,
1752 s_output_to_init_vars(hdml,
1753 apr_psprintf(r->pool,
1760 if (hdml->radio_checked_value[ii]) {
1761 DBG(r,"radio button is checked. checked value is [%s]",
1762 hdml->radio_checked_value[ii]);
1763 s_output_to_init_vars(hdml,
1764 apr_psprintf(r->pool,
1767 hdml->radio_checked_value[ii]));
1770 DBG(r,"radio button is not checked. checked value is []");
1771 s_output_to_init_vars(hdml,
1772 apr_psprintf(r->pool,
1777 hdml->radio_out_cnt[ii]++;
1782 * The substitution processing of tag "input type = checkbox" is done.
1784 * @param hdml [i/o] The pointer to the HDML structure at the output
1785 * destination is specified.
1786 * @param tag [i] The tag node of input type=checkbox is specified.
1789 s_hdml_do_input_checkbox_tag(hdml_t *hdml, Node *tag)
1791 Doc *doc = hdml->doc;
1792 request_rec *r = doc->r;
1797 /*--------------------------------------------------------------------------*/
1798 /* It is posted to the one without the checked attribute. */
1799 /* However, they were able to be removed with INPUT FILTER. */
1800 /*--------------------------------------------------------------------------*/
1801 if (! hdml->has_checkbox) {
1802 hdml->has_checkbox++;
1803 s_output_to_hdml_card(hdml,
1804 "<NODISPLAY NAME=\"_chk\">\n"
1805 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1806 "RETVALS=\"_uchk;$V;X\" >\n"
1808 "<NODISPLAY NAME=\"_uchk\">\n"
1809 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1810 "RETVALS=\"_chk;;_\" >\n"
1813 DBG(r, "wrote checkbox hdml card.");
1816 /*--------------------------------------------------------------------------*/
1817 /* It is examined whether it is CHECKED. */
1818 /*--------------------------------------------------------------------------*/
1819 chk = qs_is_checked_checkbox_attr(doc, tag, r);
1821 /*--------------------------------------------------------------------------*/
1822 /* The value of the name attribute and the value attribute is acquired */
1824 /*--------------------------------------------------------------------------*/
1825 val = qs_get_value_attr(doc, tag, r);
1826 nm = qs_get_name_attr(doc, tag, r);
1829 val = qs_alloc_zero_byte_string(r);
1832 nm = qs_alloc_zero_byte_string(r);
1834 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
1835 "<A TASK=GOSUB LABEL=\"a\xaf\xb8\" "
1836 "DEST=\"#$%s%02d\" "
1838 "RECEIVE=\"%s%02d;%s%02d;%s%02d\">"
1840 s_get_form_no(r, hdml),
1841 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1843 s_get_form_no(r, hdml),
1844 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1845 s_get_form_no(r, hdml),
1846 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1847 s_get_form_no(r, hdml),
1848 hdml->var_cnt[hdml->pure_form_cnt] + 2,
1849 s_get_form_no(r, hdml),
1850 hdml->var_cnt[hdml->pure_form_cnt] + 2));
1852 s_output_to_init_vars(hdml,
1853 apr_psprintf(r->pool,
1854 "%s%02d=_uchk&%s%02d=%s&%s%02d=X",
1855 s_get_form_no(r, hdml),
1856 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1857 s_get_form_no(r, hdml),
1858 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1859 ap_escape_uri(r->pool,val),
1860 s_get_form_no(r, hdml),
1861 hdml->var_cnt[hdml->pure_form_cnt] + 2
1865 s_output_to_init_vars(hdml,
1866 apr_psprintf(r->pool,
1867 "%s%02d=_chk&%s%02d=&%s%02d=_",
1868 s_get_form_no(r, hdml),
1869 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1870 s_get_form_no(r, hdml),
1871 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1872 s_get_form_no(r, hdml),
1873 hdml->var_cnt[hdml->pure_form_cnt] + 2
1877 s_output_to_postdata(hdml,
1878 apr_psprintf(r->pool, "%s%s=$%s%02d",
1881 s_get_form_no(r, hdml),
1882 hdml->var_cnt[hdml->pure_form_cnt] + 1));
1884 hdml->var_cnt[hdml->pure_form_cnt] += 3;
1889 * The ISTYLE attribute is converted into the HDML form.
1891 * @param r [i] To use POOL, the pointer to request_rec is specified.
1892 * @param is [i] The value of the ISTYLE attribute is specified.
1893 * @return The ISTYLE attribute converted into the HDML form is returned.
1896 qs_conv_istyle_to_format(request_rec *r, char *is)
1905 fmt = apr_psprintf(r->pool, "M");
1908 fmt = apr_psprintf(r->pool, "M");
1911 fmt = apr_psprintf(r->pool, "m");
1914 fmt = apr_psprintf(r->pool, "N");
1925 * It is a handler who processes the INPUT tag.
1927 * @param pdoc [i/o] The pointer to the HDML structure at the output
1928 * destination is specified.
1929 * @param node [i] The INPUT tag node is specified.
1930 * @return The conversion result is returned.
1933 s_hdml_end_input_tag(void *pdoc, Node *UNUSED(child))
1937 hdml = GET_HDML(pdoc);
1944 * It is a handler who processes the CENTER tag.
1946 * @param pdoc [i/o] The pointer to the HDML structure at the output
1947 * destination is specified.
1948 * @param node [i] The CENTER tag node is specified.
1949 * @return The conversion result is returned.
1952 s_hdml_start_center_tag(void *pdoc, Node *UNUSED(node))
1956 hdml = GET_HDML(pdoc);
1961 if (hdml->hdml_br_flag == 0)
1962 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
1964 hdml = s_output_to_hdml_out(hdml, "<CENTER>");
1971 * It is a handler who processes the CENTER tag.
1973 * @param pdoc [i/o] The pointer to the HDML structure at the output
1974 * destination is specified.
1975 * @param node [i] The CENTER tag node is specified.
1976 * @return The conversion result is returned.
1979 s_hdml_end_center_tag(void *pdoc, Node *UNUSED(child))
1983 hdml = GET_HDML(pdoc);
1986 hdml->in_center = 0;
1988 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
1989 hdml->hdml_br_flag = 1;
1996 * It is a handler who processes the HR tag.
1998 * @param pdoc [i/o] The pointer to the HDML structure at the output
1999 * destination is specified.
2000 * @param node [i] The HR tag node is specified.
2001 * @return The conversion result is returned.
2004 s_hdml_start_hr_tag(void *pdoc, Node *UNUSED(node))
2008 hdml = GET_HDML(pdoc);
2010 if (hdml->hdml_br_flag == 0) {
2011 s_output_to_hdml_out(hdml, "<BR>\n");
2012 if (hdml->in_center)
2015 if (hdml->div_in_center)
2016 hdml->div_in_center--;
2019 s_output_to_hdml_out(hdml, "<CENTER>\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c<BR>\n");
2021 hdml->hdml_br_flag = 1;
2028 * It is a handler who processes the HR tag.
2030 * @param pdoc [i/o] The pointer to the HDML structure at the output
2031 * destination is specified.
2032 * @param node [i] The HR tag node is specified.
2033 * @return The conversion result is returned.
2036 s_hdml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2040 hdml = GET_HDML(pdoc);
2047 * It is a handler who processes the LI tag.
2049 * @param pdoc [i/o] The pointer to the HDML structure at the output
2050 * destination is specified.
2051 * @param node [i] The LI tag node is specified.
2052 * @return The conversion result is returned.
2055 s_hdml_start_li_tag(void *pdoc, Node *UNUSED(node))
2059 hdml = GET_HDML(pdoc);
2061 if (hdml->hdml_br_flag == 0) {
2062 s_output_to_hdml_out(hdml, "<BR>\n");
2063 if (hdml->in_center)
2066 if (hdml->div_in_center)
2067 hdml->div_in_center--;
2070 hdml->hdml_br_flag = 1;
2077 * It is a handler who processes the LI tag.
2079 * @param pdoc [i/o] The pointer to the HDML structure at the output
2080 * destination is specified.
2081 * @param node [i] The LI tag node is specified.
2082 * @return The conversion result is returned.
2085 s_hdml_end_li_tag(void *pdoc, Node *UNUSED(child))
2089 hdml = GET_HDML(pdoc);
2091 if (hdml->hdml_br_flag == 0) {
2092 s_output_to_hdml_out(hdml, "<BR>\n");
2093 if (hdml->in_center)
2096 if (hdml->div_in_center)
2097 hdml->div_in_center--;
2100 hdml->hdml_br_flag = 1;
2107 * It is a handler who processes the IMG tag.
2109 * @param pdoc [i/o] The pointer to the HDML structure at the output
2110 * destination is specified.
2111 * @param node [i] The IMG tag node is specified.
2112 * @return The conversion result is returned.
2115 s_hdml_start_img_tag(void *pdoc, Node *node)
2119 #ifndef IMG_NOT_CONVERT_FILENAME
2124 hdml = GET_HDML(pdoc);
2126 #ifndef IMG_NOT_CONVERT_FILENAME
2130 s_hdml_tag_output_upper_half(hdml, node);
2132 s_output_to_hdml_out(hdml, "<img");
2134 /* Get Attributes */
2135 for (attr = qs_get_attr(doc,node);
2137 attr = qs_get_next_attr(doc,attr)) {
2139 char *name = qs_get_attr_name(doc,attr);
2140 char *value = qs_get_attr_value(doc,attr);
2142 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
2143 value = chxj_encoding_parameter(hdml->doc->r, value);
2144 s_output_to_hdml_out(hdml, " src=\"");
2145 #ifdef IMG_NOT_CONVERT_FILENAME
2146 s_output_to_hdml_out(hdml, value );
2148 s_output_to_hdml_out(hdml, chxj_img_conv(doc->r, spec,value));
2150 s_output_to_hdml_out(hdml, "\"" );
2153 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
2154 s_output_to_hdml_out(hdml, " align=\"" );
2155 s_output_to_hdml_out(hdml, value );
2156 s_output_to_hdml_out(hdml, "\"" );
2159 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2160 s_output_to_hdml_out(hdml, " width=\"");
2161 s_output_to_hdml_out(hdml, value );
2162 s_output_to_hdml_out(hdml, "\"" );
2165 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
2166 s_output_to_hdml_out(hdml, " height=\"");
2167 s_output_to_hdml_out(hdml, value );
2168 s_output_to_hdml_out(hdml, "\"" );
2171 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
2172 s_output_to_hdml_out(hdml, " hspace=\"");
2173 s_output_to_hdml_out(hdml, value );
2174 s_output_to_hdml_out(hdml, "\"" );
2177 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2178 s_output_to_hdml_out(hdml, " vspace=\"");
2179 s_output_to_hdml_out(hdml, value );
2180 s_output_to_hdml_out(hdml, "\"" );
2183 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
2184 s_output_to_hdml_out(hdml, " alt=\"" );
2185 s_output_to_hdml_out(hdml, value );
2186 s_output_to_hdml_out(hdml, "\"" );
2189 s_output_to_hdml_out(hdml, ">" );
2191 hdml->hdml_br_flag = 0;
2198 * It is a handler who processes the IMG tag.
2200 * @param pdoc [i/o] The pointer to the HDML structure at the output
2201 * destination is specified.
2202 * @param node [i] The IMG tag node is specified.
2203 * @return The conversion result is returned.
2206 s_hdml_end_img_tag(void *pdoc, Node *UNUSED(child))
2210 hdml = GET_HDML(pdoc);
2217 * It is a handler who processes the SELECT tag.
2219 * @param pdoc [i/o] The pointer to the HDML structure at the output
2220 * destination is specified.
2221 * @param node [i] The SELECT tag node is specified.
2222 * @return The conversion result is returned.
2225 s_hdml_start_select_tag(void *pdoc, Node *node)
2232 hdml = GET_HDML(pdoc);
2236 s_hdml_tag_output_upper_half(hdml, node);
2240 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
2241 "<A TASK=GOSUB LABEL=\x91\x49\x91\xf0 "
2242 "VARS=\"V=$%s%02d\" DEST=#D%d "
2243 "RECEIVE=\"%s%02d;%s%02d\">"
2245 s_get_form_no(r, hdml),
2246 hdml->var_cnt[hdml->pure_form_cnt]+0,
2248 s_get_form_no(r, hdml),
2249 hdml->var_cnt[hdml->pure_form_cnt]+0,
2250 s_get_form_no(r, hdml),
2251 hdml->var_cnt[hdml->pure_form_cnt]+1,
2252 s_get_form_no(r, hdml),
2253 hdml->var_cnt[hdml->pure_form_cnt]+1));
2255 s_output_to_hdml_card(hdml,
2256 apr_psprintf(r->pool,
2257 "<CHOICE KEY=V NAME=D%d ", hdml->card_cnt));
2258 s_output_to_hdml_card(hdml,
2259 apr_psprintf(r->pool,
2260 "DEFAULT=$V METHOD=ALPHA MARKABLE=FALSE>\n"));
2261 /*--------------------------------------------------------------------------*/
2262 /* Get Attributes */
2263 /*--------------------------------------------------------------------------*/
2264 for (attr = qs_get_attr(doc,node);
2266 attr=qs_get_next_attr(doc,attr)) {
2268 char *name = qs_get_attr_name(doc,attr);
2269 char *value = qs_get_attr_value(doc,attr);
2270 char *selval = NULL;
2271 char *selvaltxt = NULL;
2273 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2275 s_output_to_postdata(hdml,
2276 apr_psprintf(r->pool, "%s=$%s%02d",
2278 s_get_form_no(r, hdml),
2279 hdml->var_cnt[hdml->pure_form_cnt]));
2280 selval = qs_get_selected_value(doc, node, r);
2282 DBG(r, "selected value not found");
2283 selval = qs_alloc_zero_byte_string(r);
2286 DBG(r, "selected value found[%s]" , selval);
2288 selvaltxt = qs_get_selected_value_text(doc, node, r);
2290 selvaltxt = qs_alloc_zero_byte_string(r);
2292 DBG(r, "selvaltxt:[%s]" ,selvaltxt);
2294 s_output_to_init_vars(hdml,
2295 apr_psprintf(r->pool,
2296 "%s%02d=%s&%s%02d=%s",
2297 s_get_form_no(r, hdml),
2298 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2300 s_get_form_no(r, hdml),
2301 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2304 hdml->var_cnt[hdml->pure_form_cnt] += 2;
2309 hdml->hdml_br_flag = 0;
2316 * It is a handler who processes the SELECT tag.
2318 * @param pdoc [i/o] The pointer to the HDML structure at the output
2319 * destination is specified.
2320 * @param node [i] The SELECT tag node is specified.
2321 * @return The conversion result is returned.
2324 s_hdml_end_select_tag(void *pdoc, Node *UNUSED(node))
2328 hdml = GET_HDML(pdoc);
2330 s_output_to_hdml_card(hdml, "</CHOICE>\n");
2337 * It is a handler who processes the OPTION tag.
2339 * @param pdoc [i/o] The pointer to the HDML structure at the output
2340 * destination is specified.
2341 * @param node [i] The OPTION tag node is specified.
2342 * @return The conversion result is returned.
2345 s_hdml_start_option_tag(void *pdoc, Node *node)
2354 hdml = GET_HDML(pdoc);
2360 hdml->option_flag = 1;
2361 val = qs_get_value_attr(doc, node, r);
2363 /*--------------------------------------------------------------------------*/
2364 /* The child node of the object tag node acquires the value in assumption */
2365 /* that is the TEXT node. */
2366 /*--------------------------------------------------------------------------*/
2367 child = qs_get_child_node(doc, node);
2369 txtval = apr_palloc(r->pool, 1);
2373 txtval = qs_get_node_value(doc, child);
2375 DBG(r, "txtval:[%s]" , txtval);
2377 if (val && txtval) {
2378 s_output_to_hdml_card(hdml,
2379 apr_psprintf(r->pool,
2380 "<CE TASK=RETURN VALUE=\"%s\" "
2381 "RETVALS=\"$V;%s\">%s</CE>\n",
2383 qs_trim_string(r->pool,txtval),
2384 qs_trim_string(r->pool,txtval)));
2387 hdml->hdml_br_flag = 0;
2394 * It is a handler who processes the OPTION tag.
2396 * @param pdoc [i/o] The pointer to the HDML structure at the output
2397 * destination is specified.
2398 * @param node [i] The OPTION tag node is specified.
2399 * @return The conversion result is returned.
2402 s_hdml_end_option_tag(void *pdoc, Node *UNUSED(node))
2406 hdml = GET_HDML(pdoc);
2408 hdml->option_flag = 0;
2415 * It is a handler who processes the DIV tag.
2417 * @param pdoc [i/o] The pointer to the HDML structure at the output
2418 * destination is specified.
2419 * @param node [i] The DIV tag node is specified.
2420 * @return The conversion result is returned.
2423 s_hdml_start_div_tag(void *pdoc, Node *node)
2429 hdml = GET_HDML(pdoc);
2432 /*--------------------------------------------------------------------------*/
2433 /* If the br tag is not output immediately before the div tag appears, the */
2434 /* br tag is output. */
2435 /*--------------------------------------------------------------------------*/
2436 if (hdml->hdml_br_flag == 0) {
2437 hdml->hdml_br_flag = 1;
2438 s_output_to_hdml_out(hdml, "<BR>\n");
2441 /*--------------------------------------------------------------------------*/
2442 /* The object tag node is scanned. */
2443 /*--------------------------------------------------------------------------*/
2444 for (attr = qs_get_attr(doc,node);
2446 attr = qs_get_next_attr(doc,attr)) {
2447 char *name = qs_get_attr_name(doc,attr);
2448 char *value = qs_get_attr_value(doc,attr);
2450 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
2451 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "right") == 0) {
2452 hdml->div_right_flag = 1;
2453 s_output_to_hdml_out(hdml, "<RIGHT>");
2454 hdml->hdml_br_flag = 0;
2458 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "center") == 0) {
2459 hdml->div_center_flag = 1;
2460 s_output_to_hdml_out(hdml, "<CENTER>");
2461 hdml->hdml_br_flag = 0;
2466 hdml->hdml_br_flag = 0;
2473 * It is a handler who processes the DIV tag.
2475 * @param pdoc [i/o] The pointer to the HDML structure at the output
2476 * destination is specified.
2477 * @param node [i] The DIV tag node is specified.
2478 * @return The conversion result is returned.
2481 s_hdml_end_div_tag(void *pdoc, Node *UNUSED(node))
2486 hdml = GET_HDML(pdoc);
2489 if (hdml->div_right_flag == 1) {
2490 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2491 hdml->div_right_flag = 0;
2493 if (hdml->div_center_flag == 1) {
2494 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2495 hdml->div_center_flag = 0;
2496 hdml->div_in_center = 0;
2504 * It is a wrapper of the apr_pstrcat function.
2506 * @param r [i] To use POOL, the pointer to request_rec is specified.
2507 * @param o [i] The character string of connected origin is specified.
2508 * @param s [i] The character string connected with 'o' parameter is
2510 * @param len [i/o] The pointer to the area where the character string
2511 * length is stored is specified.
2512 * @return The character string after it connects it is returned.
2515 qs_out_apr_pstrcat(request_rec *r, char *o, char *s, int *len)
2517 *len = (strlen(s) + *len);
2518 return apr_pstrcat(r->pool, o, s, NULL);
2522 * The prepositive character string used to generate the variable for HDML is
2525 * @param r [i] To use POOL, the pointer to request_rec is specified.
2526 * @param hdml [i] The pointer to the HDML structure that maintains the seed
2527 * to generate it is specified.
2528 * @return The character string after it generates it is returned.
2531 s_get_form_no(request_rec *r, hdml_t *hdml)
2537 fc = hdml->form_cnt;
2539 apr_time_exp_tz(&tm, hdml->form_cnt, 0);
2541 result = apr_psprintf(r->pool, "%c",(int)('A' + ((fc / 100) % 26)));
2542 result = apr_pstrcat(r->pool, result,
2543 apr_psprintf(r->pool, "%02d%02d%02d",
2552 * The number of tag nodes .."Input type =' radio '".. is counted.
2554 * @param hdml [i] The pointer to the HDML structure is specified.
2555 * @param node [i] The first parents node that counts the radio tag node is
2559 s_hdml_count_radio_tag(hdml_t *hdml, Node *node)
2568 /*--------------------------------------------------------------------------*/
2569 /* All the child nodes of the specified node are scanned. */
2570 /*--------------------------------------------------------------------------*/
2571 for (child = qs_get_child_node(doc,node);
2573 child = qs_get_next_node(doc,child)) {
2584 name = qs_get_node_name(doc,child);
2585 if (strcasecmp(name, "input") != 0) {
2586 s_hdml_count_radio_tag(hdml, child);
2590 DBG(r,"found input tag");
2592 type = qs_get_type_attr(doc, child, r);
2594 ERR(r, "Oops! The input tag without the type attribute has been found.Please give a type.");
2598 if (strcasecmp(type, "radio") != 0)
2601 DBG(r, "found type=radio");
2603 rname = qs_get_name_attr (doc, child, r);
2604 rvalue = qs_get_value_attr(doc, child, r);
2607 /*----------------------------------------------------------------------*/
2608 /* Oops!. The input tag without the name attribute has been found. */
2609 /*----------------------------------------------------------------------*/
2610 DBG(r, "Oops!. The input tag without the name attribute has been found. Please give a name.");
2614 DBG(r, "found name attribute");
2616 /*------------------------------------------------------------------------*/
2617 /* It scans in radio_name_list. When the same value exists, the */
2618 /* value is overwrited. */
2619 /* The value is written in a new area when not is. */
2620 /*------------------------------------------------------------------------*/
2621 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
2622 if (! hdml->radio_name_list[ii]) {
2623 DBG(r, "new name:[%s]", rname);
2626 if (strcasecmp(hdml->radio_name_list[ii], rname) == 0) {
2627 DBG(r, "already registered name:[%s]", rname);
2631 if (ii == MAX_RADIO_COUNT) {
2632 DBG(r, apr_psprintf(r->pool,
2633 "I do not understand the name of the radiobutton "
2634 "of %d piece or more. Please decrease "
2635 "the number of radiobuttons.",
2640 DBG(r,"add radio name:[%s]" ,rname);
2642 hdml->radio_name_list[ii] = apr_pstrdup(r->pool, rname);
2644 /*------------------------------------------------------------------------*/
2645 /* It adds it to radio_value_list. */
2646 /*------------------------------------------------------------------------*/
2647 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) {
2648 if (!hdml->radio_value_list[ii][jj])
2651 if (jj == MAX_RADIO_VALUE_COUNT) {
2652 DBG(r, apr_psprintf(r->pool,
2653 "I do not understand the value of the radiobutton "
2654 "of %d piece or more. Please decrease "
2655 "the number of radiobuttons.",
2656 MAX_RADIO_VALUE_COUNT));
2659 hdml->radio_value_list[ii][jj] = apr_pstrdup(r->pool, rvalue);
2661 /*------------------------------------------------------------------------*/
2662 /* Now let's be the checked attribute or scan. */
2663 /*------------------------------------------------------------------------*/
2664 chkd = qs_get_checked_attr(hdml->doc, child, hdml->doc->r);
2666 DBG(r,apr_psprintf(r->pool,
2667 "The tag scanned now had the checked "
2668 "attribute. The value is [%s].",
2670 hdml->radio_checked_value[ii] = apr_pstrdup(r->pool, rvalue);
2677 * The character string is added, and output to the out member of the HDML
2680 * @param hdml [i/o] The pointer to the HDML structure that maintains the out
2681 * member at the output destination is specified.
2682 * @param s [i] The character string that should be output is specified.
2683 * @return The pointer to the HDML structure after it processes it is returned.
2686 s_output_to_hdml_out(hdml_t *hdml, char *s)
2688 hdml->out = qs_out_apr_pstrcat(hdml->doc->r, hdml->out, s, &hdml->out_len);
2695 * The character string is added, and output to the card member of the HDML
2698 * @param hdml [i/o] The pointer to the HDML structure that maintains the
2699 * card member at the output destination is specified.
2700 * @param s [i] The character string that should be output is specified.
2701 * @return The pointer to the HDML structure after it processes it is returned.
2704 s_output_to_hdml_card(hdml_t *hdml, char *s)
2706 hdml->card = qs_out_apr_pstrcat(hdml->doc->r, hdml->card, s, &hdml->card_len);
2713 * The data for the post is added, and output.
2715 * @param hdml [i/o] The pointer to the HDML structure at the output
2716 * destination is specified.
2717 * @param s [i] The character string that wants to output to postdata is
2721 s_output_to_postdata(hdml_t *hdml, char *s)
2727 if (strlen(hdml->postdata[hdml->pure_form_cnt]))
2728 hdml->postdata[hdml->pure_form_cnt] =
2729 apr_pstrcat(r->pool,
2730 hdml->postdata[hdml->pure_form_cnt],
2734 hdml->postdata[hdml->pure_form_cnt] =
2735 apr_pstrcat(r->pool,
2736 hdml->postdata[hdml->pure_form_cnt],
2737 qs_trim_string(r->pool, s),
2740 DBG(r, "POSTDATA:[%s]", hdml->postdata[hdml->pure_form_cnt] );
2746 * The tag output upper half.
2748 * @param hdml [i/o] The pointer to the HDML structure at the output
2749 * destination is specified.
2750 * @param node [i] The A tag node is specified.
2753 s_hdml_tag_output_upper_half(hdml_t *hdml, Node *UNUSED(node))
2755 if (hdml->hdml_br_flag == 1
2756 && hdml->div_right_flag == 1) {
2757 s_output_to_hdml_out(hdml, "<RIGHT>");
2758 hdml->hdml_br_flag = 0;
2761 if (hdml->hdml_br_flag == 1
2763 && hdml->in_center == 0) {
2764 s_output_to_hdml_out(hdml, "<CENTER>");
2766 hdml->hdml_br_flag = 0;
2769 if (hdml->hdml_br_flag == 1
2770 && hdml->div_center_flag > 0
2771 && hdml->div_in_center == 0) {
2772 s_output_to_hdml_out(hdml, "<CENTER>");
2773 hdml->div_in_center++;
2774 hdml->hdml_br_flag = 0;
2780 * The data for the init_vars is added, and output.
2782 * @param hdml [i/o] The pointer to the HDML structure at the output
2783 * destination is specified.
2784 * @param s [i] The character string that wants to output to postdata is
2788 s_output_to_init_vars(hdml_t *hdml, char *s)
2790 request_rec *r = hdml->doc->r;
2792 if (strlen(hdml->init_vars))
2793 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, "&", NULL);
2795 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, qs_trim_string(r->pool,s), NULL);
2797 DBG(r, "INIT_VARS:[%s]", hdml->init_vars);
2803 s_hdml_chxjif_tag(void *pdoc, Node *node)
2809 hdml = GET_HDML(pdoc);
2812 for (child = qs_get_child_node(doc, node);
2814 child = qs_get_next_node(doc, child)) {
2815 s_output_to_hdml_out(hdml, child->otext);
2816 s_hdml_chxjif_tag(hdml, child);
2822 s_hdml_text_tag(void *pdoc, Node *child)
2834 hdml = GET_HDML(pdoc);
2838 textval = qs_get_node_value(doc,child);
2839 textval = qs_trim_string(r->pool, textval);
2840 if (strlen(textval) == 0)
2843 if (hdml->option_flag == 1)
2846 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2847 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2848 tdst = apr_palloc(r->pool, 1);
2853 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2854 if (is_sjis_kanji(textval[ii])) {
2855 one_byte[0] = textval[ii+0];
2856 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2857 one_byte[0] = textval[ii+1];
2858 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2862 if (textval[ii] != '\r' && textval[ii] != '\n') {
2863 one_byte[0] = textval[ii+0];
2864 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2867 memcpy(tmp, textval, strlen(textval)-1);
2869 s_hdml_tag_output_upper_half(hdml, child->parent);
2870 s_output_to_hdml_out(hdml, tdst);
2871 hdml->hdml_br_flag = 0;