2 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3 * Copyright (C) 2005 Atsushi Konno 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"
25 #define CHECK_BOX_PREFIX "_chxj_c_"
26 #define RADIO_BUTTON_PREFIX "_chxj_r_"
27 #define SUBMIT_BUTTON_PREFIX "_chxj_s_"
29 #define GET_HDML(X) ((hdml_t*)(X))
31 static void s_init_hdml (hdml_t* hdml, Doc* doc, request_rec* r, device_table* spec);
34 static char* s_hdml_start_html_tag (void* pdoc, Node* node);
35 static char* s_hdml_end_html_tag (void* pdoc, Node* node);
36 static char* s_hdml_start_meta_tag (void* pdoc, Node* node);
37 static char* s_hdml_end_meta_tag (void* pdoc, Node* node);
38 static char* s_hdml_start_li_tag (void* pdoc, Node* node);
39 static char* s_hdml_end_li_tag (void* pdoc, Node* node);
40 static char* s_hdml_start_head_tag (void* pdoc, Node* node);
41 static char* s_hdml_end_head_tag (void* pdoc, Node* node);
42 static char* s_hdml_start_title_tag (void* pdoc, Node* node);
43 static char* s_hdml_end_title_tag (void* pdoc, Node* node);
44 static char* s_hdml_start_base_tag (void* pdoc, Node* node);
45 static char* s_hdml_end_base_tag (void* pdoc, Node* node);
46 static char* s_hdml_start_body_tag (void* pdoc, Node* node);
47 static char* s_hdml_end_body_tag (void* pdoc, Node* node);
48 static char* s_hdml_start_a_tag (void* pdoc, Node* node);
49 static char* s_hdml_end_a_tag (void* pdoc, Node* node);
50 static char* s_hdml_start_br_tag (void* pdoc, Node* node);
51 static char* s_hdml_end_br_tag (void* pdoc, Node* node);
52 static char* s_hdml_start_tr_tag (void* pdoc, Node* node);
53 static char* s_hdml_end_tr_tag (void* pdoc, Node* node);
54 static char* s_hdml_start_font_tag (void* pdoc, Node* node);
55 static char* s_hdml_end_font_tag (void* pdoc, Node* node);
56 static char* s_hdml_start_form_tag (void* pdoc, Node* node);
57 static char* s_hdml_end_form_tag (void* pdoc, Node* node);
58 static char* s_hdml_start_input_tag (void* pdoc, Node* node);
59 static char* s_hdml_end_input_tag (void* pdoc, Node* node);
60 static char* s_hdml_start_select_tag (void* pdoc, Node* node);
61 static char* s_hdml_end_select_tag (void* pdoc, Node* node);
62 static char* s_hdml_start_option_tag (void* pdoc, Node* node);
63 static char* s_hdml_end_option_tag (void* pdoc, Node* node);
64 static char* s_hdml_start_center_tag (void* pdoc, Node* node);
65 static char* s_hdml_end_center_tag (void* pdoc, Node* node);
66 static char* s_hdml_start_hr_tag (void* pdoc, Node* node);
67 static char* s_hdml_end_hr_tag (void* pdoc, Node* node);
68 static char* s_hdml_start_img_tag (void* pdoc, Node* node);
69 static char* s_hdml_end_img_tag (void* pdoc, Node* node);
70 static char* s_hdml_start_div_tag (void* pdoc, Node* node);
71 static char* s_hdml_end_div_tag (void* pdoc, Node* node);
73 static char* s_get_form_no (request_rec* r, hdml_t* hdml);
75 static void s_hdml_count_radio_tag (hdml_t* hdml, Node* node) ;
77 static void s_hdml_do_input_text_tag (hdml_t* hdml, Node* tag);
78 static void s_hdml_do_input_password_tag(hdml_t* hdml, Node* tag);
79 static void s_hdml_do_input_submit_tag (hdml_t* hdml, Node* tag);
80 static void s_hdml_do_input_hidden_tag (hdml_t* hdml, Node* tag);
81 static void s_hdml_do_input_radio_tag (hdml_t* hdml, Node* tag);
82 static void s_hdml_do_input_checkbox_tag(hdml_t* hdml, Node* tag);
83 static void s_hdml_tag_output_upper_half(hdml_t* hdml, Node* node);
85 static hdml_t* s_output_to_hdml_out (hdml_t* hdml, char* s);
86 static hdml_t* s_output_to_hdml_card (hdml_t* hdml, char* s);
87 static void s_output_to_postdata (hdml_t* hdml, char* s);
88 static void s_output_to_init_vars (hdml_t* hdml, char* s);
89 static int s_hdml_search_emoji (hdml_t* hdml, char* txt, char** rslt);
91 static char* s_hdml_chxjif_tag (void* pdoc, Node* node);
92 static char* s_hdml_text_tag (void* pdoc, Node* node) ;
95 tag_handler hdml_handler[] = {
98 s_hdml_start_html_tag,
103 s_hdml_start_meta_tag,
168 s_hdml_start_head_tag,
173 s_hdml_start_title_tag,
174 s_hdml_end_title_tag,
178 s_hdml_start_base_tag,
183 s_hdml_start_body_tag,
218 s_hdml_start_font_tag,
223 s_hdml_start_form_tag,
228 s_hdml_start_input_tag,
229 s_hdml_end_input_tag,
233 s_hdml_start_center_tag,
234 s_hdml_end_center_tag,
243 s_hdml_start_img_tag,
248 s_hdml_start_select_tag,
249 s_hdml_end_select_tag,
253 s_hdml_start_option_tag,
254 s_hdml_end_option_tag,
258 s_hdml_start_div_tag,
304 * converts from CHTML to hdml.
306 * @param r [i] Requet_rec is appointed.
307 * @param spec [i] The result of the device specification processing which
308 * was done in advance is appointed.
309 * @param src [i] The character string before the converting is appointed.
310 * @return The character string after the converting is returned.
319 chxjconvrule_entry* entryp,
320 const char* cookie_id
328 /*--------------------------------------------------------------------------*/
330 /*--------------------------------------------------------------------------*/
332 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
334 DBG(r,"i found qrcode xml");
337 DBG(r,"not found qrcode xml");
339 /*--------------------------------------------------------------------------*/
340 /* initialize hdml structure */
341 /*--------------------------------------------------------------------------*/
342 s_init_hdml(&hdml,&doc,r, spec);
344 hdml.entryp = entryp;
346 ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
347 /*--------------------------------------------------------------------------*/
349 /*--------------------------------------------------------------------------*/
351 chxj_dump_out("[src] CHTML->HDML", src, srclen);
355 /*--------------------------------------------------------------------------*/
356 /* It is examined whether there is a location header. It ends without doing */
357 /* anything when is. */
358 /*--------------------------------------------------------------------------*/
359 buf = (char*)apr_table_get(r->headers_out, (const char*)"Location");
361 /*------------------------------------------------------------------------*/
362 /* The Location header generates tag in an initial HDML machine for the */
363 /* uncorrespon dence. */
364 /*------------------------------------------------------------------------*/
365 DBG1(r, "Location is not null[Location:%s]", buf);
366 s_output_to_hdml_out(&hdml,
367 "<HDML VERSION=3.0 MARKABLE=TRUE PUBLIC=TRUE>\n"
368 "<NODISPLAY MARKABLE=TRUE PUBLIC=TRUE TITLE=\" \">\n"
369 "<ACTION TYPE=ACCEPT TASK=GO DEST=\""
371 s_output_to_hdml_out(&hdml, buf);
372 s_output_to_hdml_out(&hdml,
377 dst = apr_pstrdup(r->pool, hdml.out);
380 /*------------------------------------------------------------------------*/
381 /* Here, the parsing of the received character string is done */
382 /*------------------------------------------------------------------------*/
383 char *ss = apr_pstrdup(r->pool, src);
385 DBG1(r, "input srclen=[%d]\n", srclen);
387 qs_init_malloc(&doc);
388 qs_init_root_node(&doc);
390 qs_parse_string(&doc, ss, srclen);
392 /*------------------------------------------------------------------------*/
393 /* The number of radiobuttons is counted. */
394 /*------------------------------------------------------------------------*/
395 s_hdml_count_radio_tag(&hdml, qs_get_root(&doc));
397 chxj_node_exchange(spec,r,(void*)&hdml, &doc, qs_get_root(&doc), 0);
400 DBG1(r,"tmp=[%s]", dst);
401 qs_all_free(&doc,QX_LOGMARK);
404 /*--------------------------------------------------------------------------*/
406 /*--------------------------------------------------------------------------*/
408 chxj_dump_out("[dst] CHTML->HDML", hdml.out, hdml.out_len);
411 /*--------------------------------------------------------------------------*/
412 /* When there is no processing result, former character string is copied */
413 /* and it returns it. */
414 /*--------------------------------------------------------------------------*/
417 return apr_pstrdup(r->pool,src);
420 *dstlen = hdml.out_len;
422 /*--------------------------------------------------------------------------*/
423 /* Null is set at the end of the character string to make sure. */
424 /*--------------------------------------------------------------------------*/
425 dst[hdml.out_len] = 0;
431 * The HDML structure is initialized.
433 * @param hdml [i/o] The pointer to the HDML structure that wants to be
434 * initialized is specified.
435 * @param doc [i] The Doc structure that should be set to the initialized
436 * HDML structure is specified.
437 * @param r [i] To use POOL, the pointer to request_rec is specified.
438 * @param spec [i] The pointer to the device_table
441 s_init_hdml(hdml_t* hdml, Doc* doc, request_rec* r, device_table* spec)
446 /*--------------------------------------------------------------------------*/
447 /* init hdml structure value */
448 /*--------------------------------------------------------------------------*/
449 memset(hdml, 0, sizeof(hdml_t));
451 hdml->card = qs_alloc_zero_byte_string(r);
453 hdml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
454 hdml->doc->parse_mode = PARSE_MODE_CHTML;
456 for (ii=0; ii<MAX_FORM_COUNT; ii++) {
457 hdml->var_cnt[ii] = 0;
458 hdml->postdata[ii] = qs_alloc_zero_byte_string(r);
461 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
462 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
463 hdml->radio_value_list[ii][jj] = NULL;
465 hdml->radio_name_list[ii] = NULL;
466 hdml->radio_out_cnt[ii] = 0;
467 hdml->radio_checked_value[ii] = NULL;
470 for (ii=0; ii<MAX_SUBMIT_BUTTON_COUNT; ii++)
471 hdml->submit_button[ii] = NULL;
473 hdml->init_vars = qs_alloc_zero_byte_string(r);
477 hdml->form_cnt = apr_time_now();
478 hdml->out = qs_alloc_zero_byte_string(r);
482 s_hdml_search_emoji(hdml_t* hdml, char* txt, char** rslt)
495 DBG(r,"spec is NULL");
497 for (ee = hdml->conf->emoji;
500 unsigned char hex1byte;
501 unsigned char hex2byte;
504 DBG(r, "emoji->imode is NULL");
508 hex1byte = ee->imode->hex1byte & 0xff;
509 hex2byte = ee->imode->hex2byte & 0xff;
511 if (ee->imode->string
512 && strlen(ee->imode->string) > 0
513 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
514 if (spec == NULL || spec->emoji_type == NULL) {
515 *rslt = apr_psprintf(r->pool,
518 return strlen(ee->imode->string);
521 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
522 *rslt = apr_psprintf(r->pool,
525 return strlen(ee->imode->string);
528 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
529 *rslt = apr_psprintf(r->pool,
532 return strlen(ee->imode->string);
535 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
536 *rslt = apr_psprintf(r->pool,
539 return strlen(ee->imode->string);
542 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
543 *rslt = apr_psprintf(r->pool,
546 return strlen(ee->imode->string);
549 *rslt = apr_psprintf(r->pool,
552 return strlen(ee->imode->string);
557 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
558 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
559 if (spec == NULL || spec->emoji_type == NULL) {
560 *rslt = apr_psprintf(r->pool,
566 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
567 *rslt = apr_psprintf(r->pool,
573 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
574 *rslt = apr_psprintf(r->pool,
580 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
581 *rslt = apr_psprintf(r->pool,
587 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
588 *rslt = apr_psprintf(r->pool,
594 *rslt = apr_psprintf(r->pool,
607 * It is a handler who processes the HTML tag.
609 * @param pdoc [i/o] The pointer to the HDML structure at the output
610 * destination is specified.
611 * @param node [i] The HTML tag node is specified.
612 * @return The conversion result is returned.
615 s_hdml_start_html_tag(void* pdoc, Node* node)
619 hdml = GET_HDML(pdoc);
621 s_output_to_hdml_out(hdml,
622 "<HDML VERSION=3.0 TTL=0 MARKABLE=TRUE>\n"
623 "<NODISPLAY NAME=D0>\n"
624 "<ACTION TYPE=ACCEPT TASK=GOSUB DEST=#D1 NEXT=#D2 CLEAR=TRUE>\n"
629 hdml->hdml_br_flag = 0;
636 * It is a handler who processes the HTML tag.
638 * @param pdoc [i/o] The pointer to the HDML structure at the output
639 * destination is specified.
640 * @param node [i] The HTML tag node is specified.
641 * @return The conversion result is returned.
644 s_hdml_end_html_tag(void* pdoc, Node* child)
648 hdml = GET_HDML(pdoc);
650 s_output_to_hdml_card(hdml,
651 "<NODISPLAY NAME=D1>\n"
652 "<ACTION TYPE=ACCEPT TASK=RETURN VARS=\""
655 if (strlen(hdml->init_vars))
656 s_output_to_hdml_card(hdml, hdml->init_vars );
658 s_output_to_hdml_card(hdml, "_chxj_dmy=" );
660 s_output_to_hdml_card(hdml,
665 s_output_to_hdml_out(hdml, hdml->card );
666 s_output_to_hdml_out(hdml, "</HDML>\n");
668 hdml->hdml_end_flag = 1;
675 * It is a handler who processes the META tag.
677 * @param pdoc [i/o] The pointer to the HDML structure at the output
678 * destination is specified.
679 * @param node [i] The META tag node is specified.
680 * @return The conversion result is returned.
683 s_hdml_start_meta_tag(void* pdoc, Node* node)
687 hdml = GET_HDML(pdoc);
689 hdml->hdml_br_flag = 0;
698 * It is a handler who processes the META tag.
700 * @param pdoc [i/o] The pointer to the HDML structure at the output
701 * destination is specified.
702 * @param node [i] The META tag node is specified.
703 * @return The conversion result is returned.
706 s_hdml_end_meta_tag(void* pdoc, Node* child)
710 hdml = GET_HDML(pdoc);
717 * It is a handler who processes the HEAD tag.
719 * @param pdoc [i/o] The pointer to the HDML structure at the output
720 * destination is specified.
721 * @param node [i] The HEAD tag node is specified.
722 * @return The conversion result is returned.
725 s_hdml_start_head_tag(void* pdoc, Node* node)
729 hdml = GET_HDML(pdoc);
733 hdml->hdml_br_flag = 0;
740 * It is a handler who processes the HEAD tag.
742 * @param pdoc [i/o] The pointer to the HDML structure at the output
743 * destination is specified.
744 * @param node [i] The HEAD tag node is specified.
745 * @return The conversion result is returned.
748 s_hdml_end_head_tag(void* pdoc, Node* child)
752 hdml = GET_HDML(pdoc);
760 * It is a handler who processes the TITLE tag.
762 * @param pdoc [i/o] The pointer to the HDML structure at the output
763 * destination is specified.
764 * @param node [i] The TITLE tag node is specified.
765 * @return The conversion result is returned.
768 s_hdml_start_title_tag(void* pdoc, Node* node)
772 hdml = GET_HDML(pdoc);
774 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"");
776 hdml->found_title = 1;
777 hdml->hdml_br_flag = 0;
784 * It is a handler who processes the TITLE tag.
786 * @param pdoc [i/o] The pointer to the HDML structure at the output
787 * destination is specified.
788 * @param node [i] The TITLE tag node is specified.
789 * @return The conversion result is returned.
792 s_hdml_end_title_tag(void* pdoc, Node* child)
796 hdml = GET_HDML(pdoc);
798 s_output_to_hdml_out(hdml, "\">\n");
805 * It is a handler who processes the BASE tag.
807 * @param pdoc [i/o] The pointer to the HDML structure at the output
808 * destination is specified.
809 * @param node [i] The BASE tag node is specified.
810 * @return The conversion result is returned.
813 s_hdml_start_base_tag(void* pdoc, Node* node)
817 hdml = GET_HDML(pdoc);
819 hdml->hdml_br_flag = 0;
826 * It is a handler who processes the BASE tag.
828 * @param pdoc [i/o] The pointer to the HDML structure at the output
829 * destination is specified.
830 * @param node [i] The BASE tag node is specified.
831 * @return The conversion result is returned.
834 s_hdml_end_base_tag(void* pdoc, Node* child)
838 hdml = GET_HDML(pdoc);
845 * It is a handler who processes the BODY tag.
847 * @param pdoc [i/o] The pointer to the HDML structure at the output
848 * destination is specified.
849 * @param node [i] The BODY tag node is specified.
850 * @return The conversion result is returned.
853 s_hdml_start_body_tag(void* pdoc, Node* node)
859 hdml = GET_HDML(pdoc);
863 if (hdml->found_title == 0)
864 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"NO TITLE\">\n");
866 s_output_to_hdml_out(hdml, "<ACTION TYPE=ACCEPT TASK=NOOP LABEL=\" \"");
868 /*--------------------------------*/
870 /*--------------------------------*/
871 for (attr = qs_get_attr(doc,node);
873 attr = qs_get_next_attr(doc,attr)) {
874 char* name = qs_get_attr_name(doc,attr);
876 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
880 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
884 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
888 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
892 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
897 s_output_to_hdml_out(hdml, ">\n");
899 hdml->hdml_br_flag = 0;
906 * It is a handler who processes the BODY tag.
908 * @param pdoc [i/o] The pointer to the HDML structure at the output
909 * destination is specified.
910 * @param node [i] The BODY tag node is specified.
911 * @return The conversion result is returned.
914 s_hdml_end_body_tag(void* pdoc, Node* child)
918 hdml = GET_HDML(pdoc);
920 s_output_to_hdml_out(hdml, "\n</DISPLAY>\n");
927 * It is a handler who processes the A tag.
929 * @param pdoc [i/o] The pointer to the HDML structure at the output
930 * destination is specified.
931 * @param node [i] The A tag node is specified.
932 * @return The conversion result is returned.
935 s_hdml_start_a_tag(void* pdoc, Node* node)
941 hdml = GET_HDML(pdoc);
944 s_hdml_tag_output_upper_half(hdml,node);
946 s_output_to_hdml_out(hdml, "<A");
949 /*------------------------------------*/
951 /*------------------------------------*/
952 for (attr = qs_get_attr(doc,node);
954 attr = qs_get_next_attr(doc,attr)) {
955 char* name = qs_get_attr_name(doc,attr);
956 char* value = qs_get_attr_value(doc,attr);
957 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
961 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
962 if ((*value == 'm' || *value == 'M') && strncasecmp(value, "mailto:", 7) == 0) {
963 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
964 s_output_to_hdml_out(hdml, value );
965 s_output_to_hdml_out(hdml, "\" " );
968 if ((*value == 't' || *value == 'T') && strncasecmp(value, "tel:", 4) == 0) {
970 s_output_to_hdml_out(hdml, " TASK=CALL NUMBER=\"");
971 s_output_to_hdml_out(hdml, &value[4] );
972 s_output_to_hdml_out(hdml, "\" " );
975 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
976 s_output_to_hdml_out(hdml, value );
977 s_output_to_hdml_out(hdml, "\"" );
981 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
982 if (strcasecmp(value, "0") != 0) {
983 s_output_to_hdml_out(hdml, " ACCESSKEY=" );
984 s_output_to_hdml_out(hdml, value );
985 s_output_to_hdml_out(hdml, "" );
989 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
993 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
997 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1001 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1005 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1009 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1013 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1017 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1021 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1025 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1029 s_output_to_hdml_out(hdml, ">" );
1031 hdml->hdml_a_flag = 1;
1033 hdml->hdml_br_flag = 0;
1040 * It is a handler who processes the A tag.
1042 * @param pdoc [i/o] The pointer to the HDML structure at the output
1043 * destination is specified.
1044 * @param node [i] The A tag node is specified.
1045 * @return The conversion result is returned.
1048 s_hdml_end_a_tag(void* pdoc, Node* child)
1052 hdml = GET_HDML(pdoc);
1054 s_output_to_hdml_out(hdml, "</A>\n");
1056 hdml->hdml_a_flag = 0;
1063 * It is a handler who processes the BR tag.
1065 * @param pdoc [i/o] The pointer to the HDML structure at the output
1066 * destination is specified.
1067 * @param node [i] The BR tag node is specified.
1068 * @return The conversion result is returned.
1071 s_hdml_start_br_tag(void* pdoc, Node* node)
1075 hdml = GET_HDML(pdoc);
1077 if (hdml->in_center > 0)
1078 hdml->in_center = 0;
1080 if (hdml->div_in_center > 0)
1081 hdml->div_in_center = 0;
1083 s_output_to_hdml_out(hdml, "<BR>\n");
1085 hdml->hdml_br_flag = 1;
1092 * It is a handler who processes the BR tag.
1094 * @param pdoc [i/o] The pointer to the HDML structure at the output
1095 * destination is specified.
1096 * @param node [i] The BR tag node is specified.
1097 * @return The conversion result is returned.
1100 s_hdml_end_br_tag(void* pdoc, Node* child)
1104 hdml = GET_HDML(pdoc);
1111 * It is a handler who processes the TR tag.
1113 * @param pdoc [i/o] The pointer to the HDML structure at the output
1114 * destination is specified.
1115 * @param node [i] The TR tag node is specified.
1116 * @return The conversion result is returned.
1119 s_hdml_start_tr_tag(void* pdoc, Node* node)
1123 hdml = GET_HDML(pdoc);
1125 if (hdml->in_center > 0)
1126 hdml->in_center = 0;
1128 if (hdml->div_in_center > 0)
1129 hdml->div_in_center = 0;
1131 s_output_to_hdml_out(hdml, "<BR>\n");
1133 hdml->hdml_br_flag = 1;
1140 * It is a handler who processes the TR tag.
1142 * @param pdoc [i/o] The pointer to the HDML structure at the output
1143 * destination is specified.
1144 * @param node [i] The TR tag node is specified.
1145 * @return The conversion result is returned.
1148 s_hdml_end_tr_tag(void* pdoc, Node* child)
1152 hdml = GET_HDML(pdoc);
1159 * It is a handler who processes the FONT tag.
1161 * @param pdoc [i/o] The pointer to the HDML structure at the output
1162 * destination is specified.
1163 * @param node [i] The FONT tag node is specified.
1164 * @return The conversion result is returned.
1167 s_hdml_start_font_tag(void* pdoc, Node* node)
1171 hdml = GET_HDML(pdoc);
1178 * It is a handler who processes the FONT tag.
1180 * @param pdoc [i/o] The pointer to the HDML structure at the output
1181 * destination is specified.
1182 * @param node [i] The FONT tag node is specified.
1183 * @return The conversion result is returned.
1186 s_hdml_end_font_tag(void* pdoc, Node* child)
1190 hdml = GET_HDML(pdoc);
1197 * It is a handler who processes the FORM tag.
1199 * @param pdoc [i/o] The pointer to the HDML structure at the output
1200 * destination is specified.
1201 * @param node [i] The FORM tag node is specified.
1202 * @return The conversion result is returned.
1205 s_hdml_start_form_tag(void* pdoc, Node* node)
1213 hdml = GET_HDML(pdoc);
1217 hdml->form_tmp = apr_psprintf(r->pool,
1218 "<NODISPLAY NAME=F%d>\n",
1219 hdml->pure_form_cnt);
1220 hdml->form_tmp = apr_pstrcat(r->pool,
1222 "<ACTION TYPE=ACCEPT TASK=GO METHOD=POST DEST=\"",NULL);
1223 /* Get Attributes */
1224 for (attr = qs_get_attr(doc,node);
1226 attr = qs_get_next_attr(doc,attr)) {
1227 char* name = qs_get_attr_name(doc,attr);
1228 char* value = qs_get_attr_value(doc,attr);
1230 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1231 act = apr_psprintf(r->pool, "%s", value);
1236 hdml->form_tmp = apr_pstrcat(r->pool,
1241 hdml->form_tmp = apr_pstrcat(r->pool,
1244 hdml->form_tmp = apr_pstrcat(r->pool,
1246 "POSTDATA=\"", NULL);
1248 hdml->hdml_br_flag = 0;
1255 * handler of the form end tag.
1257 * @param pdoc [i/o] The pointer to the HDML structure at the output
1258 * destination is specified.
1259 * @param child [i] unused.
1260 * @return The HDML output result after it edits it is returned.
1263 s_hdml_end_form_tag(void* pdoc, Node* child)
1268 hdml = GET_HDML(pdoc);
1271 s_output_to_postdata(hdml, "_chxj_dmy=");
1273 hdml->form_tmp = apr_pstrcat(r->pool,
1275 hdml->postdata[hdml->pure_form_cnt],
1278 hdml->form_tmp = apr_pstrcat(r->pool,
1280 "\" CLEAR=TRUE >\n",
1282 hdml->form_tmp = apr_pstrcat(r->pool,
1287 s_output_to_hdml_card(hdml, hdml->form_tmp);
1289 hdml->form_tmp = NULL;
1290 hdml->pure_form_cnt++;
1296 * It is a handler that takes charge of the processing of the input tag.
1298 * @param pdoc [i/o] The pointer to the HDML structure at the output
1299 * destination is specified.
1300 * @param node [i] The tag node to be processed is specified.
1303 s_hdml_start_input_tag(void* pdoc, Node* node)
1309 hdml = GET_HDML(pdoc);
1312 /*--------------------------------------------------------------------------*/
1313 /* The attribute of the input tag is acquired. */
1314 /*--------------------------------------------------------------------------*/
1315 for (attr = qs_get_attr(doc,node);
1317 attr = qs_get_next_attr(doc,attr)) {
1318 char* name = qs_get_attr_name(doc,attr);
1319 char* value = qs_get_attr_value(doc,attr);
1321 if ((*name == 't'|| *name == 'T') && strcasecmp(name, "type") == 0) {
1322 if ((*value == 't' || *value == 'T') && strcasecmp(value, "text") == 0) {
1323 /*--------------------------------------------------------------------*/
1324 /* "input type ='text'" tag is processed. */
1325 /*--------------------------------------------------------------------*/
1326 s_hdml_do_input_text_tag(hdml, node);
1329 if ((*value == 'p' || *value == 'P') && strcasecmp(value, "password") == 0) {
1330 /*--------------------------------------------------------------------*/
1331 /* "input type='password'" tag is processed. */
1332 /*--------------------------------------------------------------------*/
1333 s_hdml_do_input_password_tag(hdml, node);
1336 if ((*value == 's' || *value == 'S') && strcasecmp(value, "submit") == 0) {
1337 /*--------------------------------------------------------------------*/
1338 /* "input type='submit'" tag is processed. */
1339 /*--------------------------------------------------------------------*/
1340 s_hdml_do_input_submit_tag(hdml, node);
1343 if ((*value == 'h' || *value == 'H') && strcasecmp(value, "hidden") == 0) {
1344 /*--------------------------------------------------------------------*/
1345 /* "input type='hidden'" tag is processed. */
1346 /*--------------------------------------------------------------------*/
1347 s_hdml_do_input_hidden_tag(hdml, node);
1350 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "radio") == 0) {
1351 /*--------------------------------------------------------------------*/
1352 /* "input type='radio'" tag is processed. */
1353 /*--------------------------------------------------------------------*/
1354 s_hdml_do_input_radio_tag(hdml, node);
1357 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "checkbox") == 0) {
1358 /*--------------------------------------------------------------------*/
1359 /* "input type='checkbox'" tag is processed. */
1360 /*--------------------------------------------------------------------*/
1361 s_hdml_do_input_checkbox_tag(hdml, node);
1365 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1369 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "value") == 0) {
1373 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1377 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "maxlength") == 0) {
1381 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "checked") == 0) {
1385 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1389 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "istyle") == 0) {
1394 hdml->hdml_br_flag = 0;
1401 * The substitution processing of tag "input type = text" is done.
1403 * @param hdml [i/o] The pointer to the HDML structure at the output
1404 * destination is specified.
1405 * @param tag [i] The tag node of input type=text is specified.
1408 s_hdml_do_input_text_tag(hdml_t* hdml, Node* tag)
1410 Doc* doc = hdml->doc;
1411 request_rec* r = doc->r;
1418 s_hdml_tag_output_upper_half(hdml, tag);
1421 s_output_to_hdml_out(hdml,
1422 apr_psprintf(r->pool,
1423 "<A TASK=GOSUB LABEL=\x93\xfc\x97\xcd DEST=#D%d "
1424 "VARS=\"V=$%s%02d\" RECEIVE=%s%02d>",
1426 s_get_form_no(r, hdml),
1427 hdml->var_cnt[hdml->pure_form_cnt],
1428 s_get_form_no(r, hdml),
1429 hdml->var_cnt[hdml->pure_form_cnt]
1432 s_output_to_hdml_out(hdml,
1433 apr_psprintf(r->pool, "[$%s%02d]</A>\n" ,
1434 s_get_form_no(r, hdml),
1435 hdml->var_cnt[hdml->pure_form_cnt]));
1437 /*--------------------------------------------------------------------------*/
1438 /* ENTRY CARD is output here. */
1439 /*--------------------------------------------------------------------------*/
1440 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1441 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1442 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1448 nm = qs_get_name_attr(doc, tag, r);
1450 nm = qs_alloc_zero_byte_string(r);
1453 s_output_to_postdata(hdml,
1454 apr_psprintf(r->pool,
1457 s_get_form_no(r, hdml),
1458 hdml->var_cnt[hdml->pure_form_cnt]));
1460 mlen = qs_get_maxlength_attr (doc, tag, r);
1461 is = qs_get_istyle_attr (doc, tag, r);
1462 val = qs_get_value_attr (doc, tag, r);
1464 fmt = qs_conv_istyle_to_format(r, is);
1465 DBG(r,"qs_conv_istyle_to_format end");
1469 for (ii=0; ii<strlen(mlen); ii++) {
1470 if (mlen[ii] < '0' || mlen[ii] > '9') {
1471 mlen = apr_psprintf(r->pool, "0");
1475 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=%d%s", atoi(mlen), fmt));
1478 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1481 s_output_to_hdml_card(hdml,
1482 " MARKABLE=FALSE>\n"
1483 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1487 s_output_to_init_vars(hdml,
1488 apr_psprintf(r->pool, "%s%02d=%s",
1489 s_get_form_no(r, hdml),
1490 hdml->var_cnt[hdml->pure_form_cnt],
1491 ap_escape_uri(r->pool,val)));
1493 s_output_to_init_vars(hdml,
1494 apr_psprintf(r->pool, "%s%02d=",
1495 s_get_form_no(r, hdml),
1496 hdml->var_cnt[hdml->pure_form_cnt]));
1498 hdml->var_cnt[hdml->pure_form_cnt]++;
1502 * The substitution processing of tag "input type = password" is done.
1504 * @param hdml [i/o] The pointer to the HDML structure at the output
1505 * destination is specified.
1506 * @param tag [i] The tag node of input type=password is specified.
1509 s_hdml_do_input_password_tag(hdml_t* hdml, Node* tag)
1511 Doc* doc = hdml->doc;
1512 request_rec* r = doc->r;
1519 s_hdml_tag_output_upper_half(hdml, tag);
1522 s_output_to_hdml_out(hdml, "<A TASK=GOSUB LABEL=\"\x93\xfc\x97\xcd\" DEST=");
1523 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "#D%d ", hdml->card_cnt));
1524 s_output_to_hdml_out(hdml,
1525 apr_psprintf(r->pool, "VARS=\"V=$%s%02d\" ",
1526 s_get_form_no(r, hdml),
1527 hdml->var_cnt[hdml->pure_form_cnt]));
1529 s_output_to_hdml_out(hdml,
1530 apr_psprintf(r->pool, "RECEIVE=%s%02d>" ,
1531 s_get_form_no(r, hdml),
1532 hdml->var_cnt[hdml->pure_form_cnt]));
1533 s_output_to_hdml_out(hdml,
1534 apr_psprintf(r->pool, "[$%s%02d]</A>\n" ,
1535 s_get_form_no(r, hdml),
1536 hdml->var_cnt[hdml->pure_form_cnt]));
1538 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1539 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1540 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1547 nm = qs_get_name_attr(doc, tag, r);
1549 nm = qs_alloc_zero_byte_string(r);
1551 s_output_to_postdata(hdml,
1552 apr_psprintf(r->pool,
1555 s_get_form_no(r, hdml),
1556 hdml->var_cnt[hdml->pure_form_cnt]));
1558 mlen = qs_get_maxlength_attr (doc, tag, r);
1559 val = qs_get_value_attr (doc, tag, r);
1560 /*--------------------------------------------------------------------------*/
1561 /* Default is a figure input. */
1562 /*--------------------------------------------------------------------------*/
1563 fmt = apr_psprintf(r->pool, "N");
1565 if (chxj_chk_numeric(mlen) != 0)
1566 mlen = apr_psprintf(r->pool, "0");
1567 s_output_to_hdml_card(hdml,
1568 apr_psprintf(r->pool, " FORMAT=%d%s", chxj_atoi(mlen), fmt));
1571 s_output_to_hdml_card(hdml,
1572 apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1574 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " NOECHO=TRUE "));
1576 s_output_to_hdml_card(hdml,
1577 " MARKABLE=FALSE>\n"
1578 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1582 s_output_to_init_vars(hdml,
1583 apr_psprintf(r->pool, "%s%02d=%s",
1584 s_get_form_no(r, hdml),
1585 hdml->var_cnt[hdml->pure_form_cnt],
1586 ap_escape_uri(r->pool,val)));
1588 s_output_to_init_vars(hdml,
1589 apr_psprintf(r->pool, "%s%02d=",
1590 s_get_form_no(r, hdml),
1591 hdml->var_cnt[hdml->pure_form_cnt]));
1593 hdml->var_cnt[hdml->pure_form_cnt]++;
1597 * The substitution processing of tag "input type = submit" is done.
1599 * @param hdml [i/o] The pointer to the HDML structure at the output
1600 * destination is specified.
1601 * @param tag [i] The tag node of input type=submit is specified.
1604 s_hdml_do_input_submit_tag(hdml_t* hdml, Node* tag)
1606 Doc* doc = hdml->doc;
1607 request_rec* r = doc->r;
1611 s_hdml_tag_output_upper_half(hdml, tag);
1613 s_output_to_hdml_out(hdml,
1614 apr_psprintf(r->pool,
1615 "<A TASK=GO LABEL=OK DEST=#F%d ",
1616 hdml->pure_form_cnt));
1618 /*--------------------------------------------------------------------------*/
1619 /* get name and value attribute */
1620 /*--------------------------------------------------------------------------*/
1621 nm = qs_get_name_attr (doc, tag, r);
1622 val = qs_get_value_attr (doc, tag, r);
1625 s_output_to_hdml_out(hdml,
1626 apr_psprintf(r->pool, "VARS=\"%s=%s\" ",
1628 ap_escape_uri(r->pool,val)));
1629 if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL) {
1630 s_output_to_postdata(hdml,
1631 apr_psprintf(r->pool,"%s%s=$%s",
1632 SUBMIT_BUTTON_PREFIX, nm, nm));
1635 s_output_to_hdml_out(hdml, ">" );
1636 s_output_to_hdml_out(hdml, val);
1637 s_output_to_hdml_out(hdml, "</A>\n" );
1641 * The substitution processing of tag "input type = hidden" is done.
1643 * @param hdml [i/o] The pointer to the HDML structure at the output
1644 * destination is specified.
1645 * @param tag [i] The tag node of input type=hidden is specified.
1648 s_hdml_do_input_hidden_tag(hdml_t* hdml, Node* tag)
1650 Doc* doc = hdml->doc;
1651 request_rec* r = doc->r;
1655 /*--------------------------------------------------------------------------*/
1656 /* get name and value attribute */
1657 /*--------------------------------------------------------------------------*/
1658 nm = qs_get_name_attr (doc, tag, r);
1659 val = qs_get_value_attr (doc, tag, r);
1662 s_output_to_postdata(hdml,
1663 apr_psprintf(r->pool,
1666 ap_escape_uri(r->pool, val)));
1671 * The substitution processing of tag "input type = radio" is done.
1673 * @param hdml [i/o] The pointer to the HDML structure at the output
1674 * destination is specified.
1675 * @param tag [i] The tag node of input type=radio is specified.
1678 s_hdml_do_input_radio_tag(hdml_t* hdml, Node* tag)
1680 Doc* doc = hdml->doc;
1681 request_rec* r = doc->r;
1689 s_hdml_tag_output_upper_half(hdml, tag);
1691 /*--------------------------------------------------------------------------*/
1692 /* get name and value attribute */
1693 /*--------------------------------------------------------------------------*/
1694 nm = qs_get_name_attr (doc, tag, r);
1695 val = qs_get_value_attr (doc, tag, r);
1697 /*--------------------------------------------------------------------------*/
1698 /* The same name is searched out from the list made beforehand. */
1699 /*--------------------------------------------------------------------------*/
1700 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
1701 if (! hdml->radio_name_list[ii]) {
1703 DBG1(r, "Oops... radio list is null[%d]", ii);
1704 /*----------------------------------------------------------------------*/
1705 /* Processing is ended because it doesn't happen off the fly. */
1706 /*----------------------------------------------------------------------*/
1710 if (strcasecmp(hdml->radio_name_list[ii], nm) == 0)
1713 if (ii == MAX_RADIO_COUNT) {
1715 DBG(r,"Oops... The same name was not in the list. ");
1716 /*------------------------------------------------------------------------*/
1717 /* Processing is ended because it doesn't happen off the fly. */
1718 /*------------------------------------------------------------------------*/
1722 s_output_to_hdml_out(hdml,
1723 apr_psprintf(r->pool,
1725 "LABEL=\"\x93\xfc\x97\xcd\" "
1726 "DEST=#R%d VARS=\"VAL=%s\" "
1732 if (hdml->radio_out_cnt[ii] == 0) {
1733 s_output_to_hdml_card(hdml,
1734 apr_psprintf(r->pool,
1735 "<NODISPLAY NAME=R%d>\n",
1737 s_output_to_hdml_card(hdml,
1738 apr_psprintf(r->pool,
1740 "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
1743 kk = hdml->radio_out_cnt[ii];
1744 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
1745 if (! hdml->radio_value_list[ii][jj])
1750 for (jj=0; jj<r_cnt; jj++) {
1751 if (! hdml->radio_value_list[ii][jj])
1755 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
1756 if (hdml->radio_out_cnt[ii] == 0)
1757 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
1760 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
1761 if (hdml->radio_out_cnt[ii] == 0) {
1763 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
1765 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
1772 s_output_to_hdml_out(hdml,
1773 apr_psprintf(r->pool, "\" >$%s_%02d</A>",
1775 hdml->radio_out_cnt[ii]));
1776 if (! hdml->radio_out_cnt[ii]) {
1777 s_output_to_hdml_card(hdml, "\">\n" );
1778 s_output_to_hdml_card(hdml, "</NODISPLAY>\n");
1780 s_output_to_postdata(hdml, apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
1782 for (jj=0; jj<r_cnt; jj++) {
1783 if (hdml->radio_value_list[ii][jj] && hdml->radio_checked_value[ii]) {
1784 if (strcasecmp(hdml->radio_value_list[ii][jj],
1785 hdml->radio_checked_value[ii]) == 0) {
1786 s_output_to_init_vars(hdml,
1787 apr_psprintf(r->pool,
1793 s_output_to_init_vars(hdml,
1794 apr_psprintf(r->pool,
1801 s_output_to_init_vars(hdml,
1802 apr_psprintf(r->pool,
1809 if (hdml->radio_checked_value[ii]) {
1810 DBG1(r,"radio button is checked. checked value is [%s]",
1811 hdml->radio_checked_value[ii]);
1812 s_output_to_init_vars(hdml,
1813 apr_psprintf(r->pool,
1816 hdml->radio_checked_value[ii]));
1819 DBG(r,"radio button is not checked. checked value is []");
1820 s_output_to_init_vars(hdml,
1821 apr_psprintf(r->pool,
1826 hdml->radio_out_cnt[ii]++;
1830 * The substitution processing of tag "input type = checkbox" is done.
1832 * @param hdml [i/o] The pointer to the HDML structure at the output
1833 * destination is specified.
1834 * @param tag [i] The tag node of input type=checkbox is specified.
1837 s_hdml_do_input_checkbox_tag(hdml_t* hdml, Node* tag)
1839 Doc* doc = hdml->doc;
1840 request_rec* r = doc->r;
1845 /*--------------------------------------------------------------------------*/
1846 /* It is posted to the one without the checked attribute. */
1847 /* However, they were able to be removed with INPUT FILTER. */
1848 /*--------------------------------------------------------------------------*/
1849 if (! hdml->has_checkbox) {
1850 hdml->has_checkbox++;
1851 s_output_to_hdml_card(hdml,
1852 "<NODISPLAY NAME=\"_chk\">\n"
1853 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1854 "RETVALS=\"_uchk;$V;X\" >\n"
1856 "<NODISPLAY NAME=\"_uchk\">\n"
1857 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1858 "RETVALS=\"_chk;;_\" >\n"
1861 DBG(r, "wrote checkbox hdml card.");
1864 /*--------------------------------------------------------------------------*/
1865 /* It is examined whether it is CHECKED. */
1866 /*--------------------------------------------------------------------------*/
1867 chk = qs_is_checked_checkbox_attr(doc, tag, r);
1869 /*--------------------------------------------------------------------------*/
1870 /* The value of the name attribute and the value attribute is acquired */
1872 /*--------------------------------------------------------------------------*/
1873 val = qs_get_value_attr(doc, tag, r);
1874 nm = qs_get_name_attr(doc, tag, r);
1877 val = qs_alloc_zero_byte_string(r);
1880 nm = qs_alloc_zero_byte_string(r);
1882 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
1883 "<A TASK=GOSUB LABEL=\"a\xaf\xb8\" "
1884 "DEST=\"#$%s%02d\" "
1886 "RECEIVE=\"%s%02d;%s%02d;%s%02d\">"
1888 s_get_form_no(r, hdml),
1889 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1891 s_get_form_no(r, hdml),
1892 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1893 s_get_form_no(r, hdml),
1894 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1895 s_get_form_no(r, hdml),
1896 hdml->var_cnt[hdml->pure_form_cnt] + 2,
1897 s_get_form_no(r, hdml),
1898 hdml->var_cnt[hdml->pure_form_cnt] + 2));
1900 s_output_to_init_vars(hdml,
1901 apr_psprintf(r->pool,
1902 "%s%02d=_uchk&%s%02d=%s&%s%02d=X",
1903 s_get_form_no(r, hdml),
1904 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1905 s_get_form_no(r, hdml),
1906 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1907 ap_escape_uri(r->pool,val),
1908 s_get_form_no(r, hdml),
1909 hdml->var_cnt[hdml->pure_form_cnt] + 2
1913 s_output_to_init_vars(hdml,
1914 apr_psprintf(r->pool,
1915 "%s%02d=_chk&%s%02d=&%s%02d=_",
1916 s_get_form_no(r, hdml),
1917 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1918 s_get_form_no(r, hdml),
1919 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1920 s_get_form_no(r, hdml),
1921 hdml->var_cnt[hdml->pure_form_cnt] + 2
1925 s_output_to_postdata(hdml,
1926 apr_psprintf(r->pool, "%s%s=$%s%02d",
1929 s_get_form_no(r, hdml),
1930 hdml->var_cnt[hdml->pure_form_cnt] + 1));
1932 hdml->var_cnt[hdml->pure_form_cnt] += 3;
1936 * The ISTYLE attribute is converted into the HDML form.
1938 * @param r [i] To use POOL, the pointer to request_rec is specified.
1939 * @param is [i] The value of the ISTYLE attribute is specified.
1940 * @return The ISTYLE attribute converted into the HDML form is returned.
1943 qs_conv_istyle_to_format(request_rec* r, char* is)
1952 fmt = apr_psprintf(r->pool, "M");
1955 fmt = apr_psprintf(r->pool, "M");
1958 fmt = apr_psprintf(r->pool, "m");
1961 fmt = apr_psprintf(r->pool, "N");
1972 * It is a handler who processes the INPUT tag.
1974 * @param pdoc [i/o] The pointer to the HDML structure at the output
1975 * destination is specified.
1976 * @param node [i] The INPUT tag node is specified.
1977 * @return The conversion result is returned.
1980 s_hdml_end_input_tag(void* pdoc, Node* child)
1984 hdml = GET_HDML(pdoc);
1991 * It is a handler who processes the CENTER tag.
1993 * @param pdoc [i/o] The pointer to the HDML structure at the output
1994 * destination is specified.
1995 * @param node [i] The CENTER tag node is specified.
1996 * @return The conversion result is returned.
1999 s_hdml_start_center_tag(void* pdoc, Node* node)
2003 hdml = GET_HDML(pdoc);
2008 if (hdml->hdml_br_flag == 0)
2009 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
2011 hdml = s_output_to_hdml_out(hdml, "<CENTER>");
2018 * It is a handler who processes the CENTER tag.
2020 * @param pdoc [i/o] The pointer to the HDML structure at the output
2021 * destination is specified.
2022 * @param node [i] The CENTER tag node is specified.
2023 * @return The conversion result is returned.
2026 s_hdml_end_center_tag(void* pdoc, Node* child)
2030 hdml = GET_HDML(pdoc);
2033 hdml->in_center = 0;
2035 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
2036 hdml->hdml_br_flag = 1;
2043 * It is a handler who processes the HR tag.
2045 * @param pdoc [i/o] The pointer to the HDML structure at the output
2046 * destination is specified.
2047 * @param node [i] The HR tag node is specified.
2048 * @return The conversion result is returned.
2051 s_hdml_start_hr_tag(void* pdoc, Node* node)
2055 hdml = GET_HDML(pdoc);
2057 if (hdml->hdml_br_flag == 0) {
2058 s_output_to_hdml_out(hdml, "<BR>\n");
2059 if (hdml->in_center)
2062 if (hdml->div_in_center)
2063 hdml->div_in_center--;
2066 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");
2068 hdml->hdml_br_flag = 1;
2075 * It is a handler who processes the HR tag.
2077 * @param pdoc [i/o] The pointer to the HDML structure at the output
2078 * destination is specified.
2079 * @param node [i] The HR tag node is specified.
2080 * @return The conversion result is returned.
2083 s_hdml_end_hr_tag(void* pdoc, Node* child)
2087 hdml = GET_HDML(pdoc);
2094 * It is a handler who processes the LI tag.
2096 * @param pdoc [i/o] The pointer to the HDML structure at the output
2097 * destination is specified.
2098 * @param node [i] The LI tag node is specified.
2099 * @return The conversion result is returned.
2102 s_hdml_start_li_tag(void* pdoc, Node* node)
2106 hdml = GET_HDML(pdoc);
2108 if (hdml->hdml_br_flag == 0) {
2109 s_output_to_hdml_out(hdml, "<BR>\n");
2110 if (hdml->in_center)
2113 if (hdml->div_in_center)
2114 hdml->div_in_center--;
2117 hdml->hdml_br_flag = 1;
2124 * It is a handler who processes the LI tag.
2126 * @param pdoc [i/o] The pointer to the HDML structure at the output
2127 * destination is specified.
2128 * @param node [i] The LI tag node is specified.
2129 * @return The conversion result is returned.
2132 s_hdml_end_li_tag(void* pdoc, Node* child)
2136 hdml = GET_HDML(pdoc);
2138 if (hdml->hdml_br_flag == 0) {
2139 s_output_to_hdml_out(hdml, "<BR>\n");
2140 if (hdml->in_center)
2143 if (hdml->div_in_center)
2144 hdml->div_in_center--;
2147 hdml->hdml_br_flag = 1;
2154 * It is a handler who processes the IMG tag.
2156 * @param pdoc [i/o] The pointer to the HDML structure at the output
2157 * destination is specified.
2158 * @param node [i] The IMG tag node is specified.
2159 * @return The conversion result is returned.
2162 s_hdml_start_img_tag(void* pdoc, Node* node)
2166 #ifndef IMG_NOT_CONVERT_FILENAME
2167 device_table_t* spec;
2171 hdml = GET_HDML(pdoc);
2173 #ifndef IMG_NOT_CONVERT_FILENAME
2177 s_hdml_tag_output_upper_half(hdml, node);
2179 s_output_to_hdml_out(hdml, "<img");
2181 /* Get Attributes */
2182 for (attr = qs_get_attr(doc,node);
2184 attr = qs_get_next_attr(doc,attr)) {
2186 char* name = qs_get_attr_name(doc,attr);
2187 char* value = qs_get_attr_value(doc,attr);
2189 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
2190 s_output_to_hdml_out(hdml, " src=\"");
2191 #ifdef IMG_NOT_CONVERT_FILENAME
2192 s_output_to_hdml_out(hdml, value );
2194 s_output_to_hdml_out(hdml, chxj_img_conv(doc->r, spec,value));
2196 s_output_to_hdml_out(hdml, "\"" );
2199 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
2200 s_output_to_hdml_out(hdml, " align=\"" );
2201 s_output_to_hdml_out(hdml, value );
2202 s_output_to_hdml_out(hdml, "\"" );
2205 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2206 s_output_to_hdml_out(hdml, " width=\"");
2207 s_output_to_hdml_out(hdml, value );
2208 s_output_to_hdml_out(hdml, "\"" );
2211 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
2212 s_output_to_hdml_out(hdml, " height=\"");
2213 s_output_to_hdml_out(hdml, value );
2214 s_output_to_hdml_out(hdml, "\"" );
2217 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
2218 s_output_to_hdml_out(hdml, " hspace=\"");
2219 s_output_to_hdml_out(hdml, value );
2220 s_output_to_hdml_out(hdml, "\"" );
2223 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2224 s_output_to_hdml_out(hdml, " vspace=\"");
2225 s_output_to_hdml_out(hdml, value );
2226 s_output_to_hdml_out(hdml, "\"" );
2229 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
2230 s_output_to_hdml_out(hdml, " alt=\"" );
2231 s_output_to_hdml_out(hdml, value );
2232 s_output_to_hdml_out(hdml, "\"" );
2235 s_output_to_hdml_out(hdml, ">" );
2237 hdml->hdml_br_flag = 0;
2244 * It is a handler who processes the IMG tag.
2246 * @param pdoc [i/o] The pointer to the HDML structure at the output
2247 * destination is specified.
2248 * @param node [i] The IMG tag node is specified.
2249 * @return The conversion result is returned.
2252 s_hdml_end_img_tag(void* pdoc, Node* child)
2256 hdml = GET_HDML(pdoc);
2263 * It is a handler who processes the SELECT tag.
2265 * @param pdoc [i/o] The pointer to the HDML structure at the output
2266 * destination is specified.
2267 * @param node [i] The SELECT tag node is specified.
2268 * @return The conversion result is returned.
2271 s_hdml_start_select_tag(void* pdoc, Node* node)
2278 hdml = GET_HDML(pdoc);
2282 s_hdml_tag_output_upper_half(hdml, node);
2286 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
2287 "<A TASK=GOSUB LABEL=\x91\x49\x91\xf0 "
2288 "VARS=\"V=$%s%02d\" DEST=#D%d "
2289 "RECEIVE=\"%s%02d;%s%02d\">"
2291 s_get_form_no(r, hdml),
2292 hdml->var_cnt[hdml->pure_form_cnt]+0,
2294 s_get_form_no(r, hdml),
2295 hdml->var_cnt[hdml->pure_form_cnt]+0,
2296 s_get_form_no(r, hdml),
2297 hdml->var_cnt[hdml->pure_form_cnt]+1,
2298 s_get_form_no(r, hdml),
2299 hdml->var_cnt[hdml->pure_form_cnt]+1));
2301 s_output_to_hdml_card(hdml,
2302 apr_psprintf(r->pool,
2303 "<CHOICE KEY=V NAME=D%d ", hdml->card_cnt));
2304 s_output_to_hdml_card(hdml,
2305 apr_psprintf(r->pool,
2306 "DEFAULT=$V METHOD=ALPHA MARKABLE=FALSE>\n"));
2307 /*--------------------------------------------------------------------------*/
2308 /* Get Attributes */
2309 /*--------------------------------------------------------------------------*/
2310 for (attr = qs_get_attr(doc,node);
2312 attr=qs_get_next_attr(doc,attr)) {
2314 char* name = qs_get_attr_name(doc,attr);
2315 char* value = qs_get_attr_value(doc,attr);
2316 char* selval = NULL;
2317 char* selvaltxt = NULL;
2319 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2321 s_output_to_postdata(hdml,
2322 apr_psprintf(r->pool, "%s=$%s%02d",
2324 s_get_form_no(r, hdml),
2325 hdml->var_cnt[hdml->pure_form_cnt]));
2326 selval = qs_get_selected_value(doc, node, r);
2328 DBG(r, "selected value not found");
2329 selval = qs_alloc_zero_byte_string(r);
2332 DBG1(r, "selected value found[%s]" , selval);
2334 selvaltxt = qs_get_selected_value_text(doc, node, r);
2336 selvaltxt = qs_alloc_zero_byte_string(r);
2338 DBG1(r, "selvaltxt:[%s]" ,selvaltxt);
2340 s_output_to_init_vars(hdml,
2341 apr_psprintf(r->pool,
2342 "%s%02d=%s&%s%02d=%s",
2343 s_get_form_no(r, hdml),
2344 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2346 s_get_form_no(r, hdml),
2347 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2350 hdml->var_cnt[hdml->pure_form_cnt] += 2;
2355 hdml->hdml_br_flag = 0;
2361 * It is a handler who processes the SELECT tag.
2363 * @param pdoc [i/o] The pointer to the HDML structure at the output
2364 * destination is specified.
2365 * @param node [i] The SELECT tag node is specified.
2366 * @return The conversion result is returned.
2369 s_hdml_end_select_tag(void* pdoc, Node* node)
2373 hdml = GET_HDML(pdoc);
2375 s_output_to_hdml_card(hdml, "</CHOICE>\n");
2382 * It is a handler who processes the OPTION tag.
2384 * @param pdoc [i/o] The pointer to the HDML structure at the output
2385 * destination is specified.
2386 * @param node [i] The OPTION tag node is specified.
2387 * @return The conversion result is returned.
2390 s_hdml_start_option_tag(void* pdoc, Node* node)
2399 hdml = GET_HDML(pdoc);
2405 hdml->option_flag = 1;
2406 val = qs_get_value_attr(doc, node, r);
2408 /*--------------------------------------------------------------------------*/
2409 /* The child node of the object tag node acquires the value in assumption */
2410 /* that is the TEXT node. */
2411 /*--------------------------------------------------------------------------*/
2412 child = qs_get_child_node(doc, node);
2414 txtval = apr_palloc(r->pool, 1);
2418 txtval = qs_get_node_value(doc, child);
2420 DBG1(r, "txtval:[%s]" , txtval);
2422 if (val && txtval) {
2423 s_output_to_hdml_card(hdml,
2424 apr_psprintf(r->pool,
2425 "<CE TASK=RETURN VALUE=\"%s\" "
2426 "RETVALS=\"$V;%s\">%s</CE>\n",
2428 qs_trim_string(r,txtval),
2429 qs_trim_string(r,txtval)));
2432 hdml->hdml_br_flag = 0;
2439 * It is a handler who processes the OPTION tag.
2441 * @param pdoc [i/o] The pointer to the HDML structure at the output
2442 * destination is specified.
2443 * @param node [i] The OPTION tag node is specified.
2444 * @return The conversion result is returned.
2447 s_hdml_end_option_tag(void* pdoc, Node* node)
2451 hdml = GET_HDML(pdoc);
2453 hdml->option_flag = 0;
2460 * It is a handler who processes the DIV tag.
2462 * @param pdoc [i/o] The pointer to the HDML structure at the output
2463 * destination is specified.
2464 * @param node [i] The DIV tag node is specified.
2465 * @return The conversion result is returned.
2468 s_hdml_start_div_tag(void* pdoc, Node* node)
2474 hdml = GET_HDML(pdoc);
2477 /*--------------------------------------------------------------------------*/
2478 /* If the br tag is not output immediately before the div tag appears, the */
2479 /* br tag is output. */
2480 /*--------------------------------------------------------------------------*/
2481 if (hdml->hdml_br_flag == 0) {
2482 hdml->hdml_br_flag = 1;
2483 s_output_to_hdml_out(hdml, "<BR>\n");
2486 /*--------------------------------------------------------------------------*/
2487 /* The object tag node is scanned. */
2488 /*--------------------------------------------------------------------------*/
2489 for (attr = qs_get_attr(doc,node);
2491 attr = qs_get_next_attr(doc,attr)) {
2492 char* name = qs_get_attr_name(doc,attr);
2493 char* value = qs_get_attr_value(doc,attr);
2495 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
2496 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "right") == 0) {
2497 hdml->div_right_flag = 1;
2498 s_output_to_hdml_out(hdml, "<RIGHT>");
2499 hdml->hdml_br_flag = 0;
2503 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "center") == 0) {
2504 hdml->div_center_flag = 1;
2505 s_output_to_hdml_out(hdml, "<CENTER>");
2506 hdml->hdml_br_flag = 0;
2511 hdml->hdml_br_flag = 0;
2518 * It is a handler who processes the DIV tag.
2520 * @param pdoc [i/o] The pointer to the HDML structure at the output
2521 * destination is specified.
2522 * @param node [i] The DIV tag node is specified.
2523 * @return The conversion result is returned.
2526 s_hdml_end_div_tag(void* pdoc, Node* node)
2531 hdml = GET_HDML(pdoc);
2534 if (hdml->div_right_flag == 1) {
2535 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2536 hdml->div_right_flag = 0;
2538 if (hdml->div_center_flag == 1) {
2539 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2540 hdml->div_center_flag = 0;
2541 hdml->div_in_center = 0;
2549 * It is a wrapper of the apr_pstrcat function.
2551 * @param r [i] To use POOL, the pointer to request_rec is specified.
2552 * @param o [i] The character string of connected origin is specified.
2553 * @param s [i] The character string connected with 'o' parameter is
2555 * @param len [i/o] The pointer to the area where the character string
2556 * length is stored is specified.
2557 * @return The character string after it connects it is returned.
2560 qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len)
2562 *len = (strlen(s) + *len);
2563 return apr_pstrcat(r->pool, o, s, NULL);
2567 * The prepositive character string used to generate the variable for HDML is
2570 * @param r [i] To use POOL, the pointer to request_rec is specified.
2571 * @param hdml [i] The pointer to the HDML structure that maintains the seed
2572 * to generate it is specified.
2573 * @return The character string after it generates it is returned.
2576 s_get_form_no(request_rec* r, hdml_t* hdml)
2580 unsigned long fc = hdml->form_cnt;
2582 apr_time_exp_tz(&tm, hdml->form_cnt, 0);
2584 result = apr_psprintf(r->pool, "%c",(int)('A' + ((fc / 100) % 26)));
2585 result = apr_pstrcat(r->pool, result,
2586 apr_psprintf(r->pool, "%02d%02d%02d",
2594 * The number of tag nodes .."Input type =' radio '".. is counted.
2596 * @param hdml [i] The pointer to the HDML structure is specified.
2597 * @param node [i] The first parents node that counts the radio tag node is
2601 s_hdml_count_radio_tag(hdml_t* hdml, Node* node)
2604 Doc* doc = hdml->doc;
2605 request_rec* r = doc->r;
2607 /*--------------------------------------------------------------------------*/
2608 /* All the child nodes of the specified node are scanned. */
2609 /*--------------------------------------------------------------------------*/
2610 for (child = qs_get_child_node(doc,node);
2612 child = qs_get_next_node(doc,child)) {
2623 name = qs_get_node_name(doc,child);
2624 if (strcasecmp(name, "input") != 0) {
2625 s_hdml_count_radio_tag(hdml, child);
2629 DBG(r,"found input tag");
2631 type = qs_get_type_attr(doc, child, r);
2633 ERR(r, "Oops! The input tag without the type attribute has been found.Please give a type.");
2637 if (strcasecmp(type, "radio") != 0)
2640 DBG(r, "found type=radio");
2642 rname = qs_get_name_attr (doc, child, r);
2643 rvalue = qs_get_value_attr(doc, child, r);
2646 /*----------------------------------------------------------------------*/
2647 /* Oops!. The input tag without the name attribute has been found. */
2648 /*----------------------------------------------------------------------*/
2649 DBG(r, "Oops!. The input tag without the name attribute has been found. Please give a name.");
2653 DBG(r, "found name attribute");
2655 /*------------------------------------------------------------------------*/
2656 /* It scans in radio_name_list. When the same value exists, the */
2657 /* value is overwrited. */
2658 /* The value is written in a new area when not is. */
2659 /*------------------------------------------------------------------------*/
2660 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
2661 if (! hdml->radio_name_list[ii]) {
2662 DBG1(r, "new name:[%s]", rname);
2665 if (strcasecmp(hdml->radio_name_list[ii], rname) == 0) {
2666 DBG1(r, "already registered name:[%s]", rname);
2670 if (ii == MAX_RADIO_COUNT) {
2671 DBG(r, apr_psprintf(r->pool,
2672 "I do not understand the name of the radiobutton "
2673 "of %d piece or more. Please decrease "
2674 "the number of radiobuttons.",
2679 DBG1(r,"add radio name:[%s]" ,rname);
2681 hdml->radio_name_list[ii] = apr_pstrdup(r->pool, rname);
2683 /*------------------------------------------------------------------------*/
2684 /* It adds it to radio_value_list. */
2685 /*------------------------------------------------------------------------*/
2686 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) {
2687 if (!hdml->radio_value_list[ii][jj])
2690 if (jj == MAX_RADIO_VALUE_COUNT) {
2691 DBG(r, apr_psprintf(r->pool,
2692 "I do not understand the value of the radiobutton "
2693 "of %d piece or more. Please decrease "
2694 "the number of radiobuttons.",
2695 MAX_RADIO_VALUE_COUNT));
2698 hdml->radio_value_list[ii][jj] = apr_pstrdup(r->pool, rvalue);
2700 /*------------------------------------------------------------------------*/
2701 /* Now let's be the checked attribute or scan. */
2702 /*------------------------------------------------------------------------*/
2703 chkd = qs_get_checked_attr(hdml->doc, child, hdml->doc->r);
2705 DBG(r,apr_psprintf(r->pool,
2706 "The tag scanned now had the checked "
2707 "attribute. The value is [%s].",
2709 hdml->radio_checked_value[ii] = apr_pstrdup(r->pool, rvalue);
2716 * The character string is added, and output to the out member of the HDML
2719 * @param hdml [i/o] The pointer to the HDML structure that maintains the out
2720 * member at the output destination is specified.
2721 * @param s [i] The character string that should be output is specified.
2722 * @return The pointer to the HDML structure after it processes it is returned.
2725 s_output_to_hdml_out(hdml_t* hdml, char* s)
2727 hdml->out = qs_out_apr_pstrcat(hdml->doc->r, hdml->out, s, &hdml->out_len);
2734 * The character string is added, and output to the card member of the HDML
2737 * @param hdml [i/o] The pointer to the HDML structure that maintains the
2738 * card member at the output destination is specified.
2739 * @param s [i] The character string that should be output is specified.
2740 * @return The pointer to the HDML structure after it processes it is returned.
2743 s_output_to_hdml_card(hdml_t* hdml, char* s)
2745 hdml->card = qs_out_apr_pstrcat(hdml->doc->r, hdml->card, s, &hdml->card_len);
2753 * The data for the post is added, and output.
2755 * @param hdml [i/o] The pointer to the HDML structure at the output
2756 * destination is specified.
2757 * @param s [i] The character string that wants to output to postdata is
2761 s_output_to_postdata(hdml_t* hdml, char* s)
2763 request_rec* r = hdml->doc->r;
2765 if (strlen(hdml->postdata[hdml->pure_form_cnt]))
2766 hdml->postdata[hdml->pure_form_cnt] =
2767 apr_pstrcat(r->pool,
2768 hdml->postdata[hdml->pure_form_cnt],
2772 hdml->postdata[hdml->pure_form_cnt] =
2773 apr_pstrcat(r->pool,
2774 hdml->postdata[hdml->pure_form_cnt],
2775 qs_trim_string(r, s),
2778 DBG1(r, "POSTDATA:[%s]", hdml->postdata[hdml->pure_form_cnt] );
2784 * The tag output upper half.
2786 * @param hdml [i/o] The pointer to the HDML structure at the output
2787 * destination is specified.
2788 * @param node [i] The A tag node is specified.
2791 s_hdml_tag_output_upper_half(hdml_t* hdml, Node* node)
2793 if (hdml->hdml_br_flag == 1
2794 && hdml->div_right_flag == 1) {
2795 s_output_to_hdml_out(hdml, "<RIGHT>");
2796 hdml->hdml_br_flag = 0;
2799 if (hdml->hdml_br_flag == 1
2801 && hdml->in_center == 0) {
2802 s_output_to_hdml_out(hdml, "<CENTER>");
2804 hdml->hdml_br_flag = 0;
2807 if (hdml->hdml_br_flag == 1
2808 && hdml->div_center_flag > 0
2809 && hdml->div_in_center == 0) {
2810 s_output_to_hdml_out(hdml, "<CENTER>");
2811 hdml->div_in_center++;
2812 hdml->hdml_br_flag = 0;
2819 * The data for the init_vars is added, and output.
2821 * @param hdml [i/o] The pointer to the HDML structure at the output
2822 * destination is specified.
2823 * @param s [i] The character string that wants to output to postdata is
2827 s_output_to_init_vars(hdml_t* hdml, char* s)
2829 request_rec* r = hdml->doc->r;
2831 if (strlen(hdml->init_vars))
2832 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, "&", NULL);
2834 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, qs_trim_string(r,s), NULL);
2836 DBG1(r, "INIT_VARS:[%s]", hdml->init_vars);
2842 s_hdml_chxjif_tag(void* pdoc, Node* node)
2848 hdml = GET_HDML(pdoc);
2851 for (child = qs_get_child_node(doc, node);
2853 child = qs_get_next_node(doc, child)) {
2854 s_output_to_hdml_out(hdml, child->otext);
2855 s_hdml_chxjif_tag(hdml, child);
2861 s_hdml_text_tag(void* pdoc, Node* child)
2873 hdml = GET_HDML(pdoc);
2877 textval = qs_get_node_value(doc,child);
2878 textval = qs_trim_string(r, textval);
2879 if (strlen(textval) == 0)
2882 if (hdml->option_flag == 1)
2885 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2886 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2887 tdst = apr_palloc(r->pool, 1);
2892 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2894 int rtn = s_hdml_search_emoji(hdml, &textval[ii], &out);
2896 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2900 if (is_sjis_kanji(textval[ii])) {
2901 one_byte[0] = textval[ii+0];
2902 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2903 one_byte[0] = textval[ii+1];
2904 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2908 if (textval[ii] != '\r' && textval[ii] != '\n') {
2909 one_byte[0] = textval[ii+0];
2910 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2913 memcpy(tmp, textval, strlen(textval)-1);
2915 s_hdml_tag_output_upper_half(hdml, child->parent);
2916 s_output_to_hdml_out(hdml, tdst);
2917 hdml->hdml_br_flag = 0;