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,
309 * converts from CHTML to hdml.
311 * @param r [i] Requet_rec is appointed.
312 * @param spec [i] The result of the device specification processing which
313 * was done in advance is appointed.
314 * @param src [i] The character string before the converting is appointed.
315 * @return The character string after the converting is returned.
324 chxjconvrule_entry* entryp,
336 /*--------------------------------------------------------------------------*/
338 /*--------------------------------------------------------------------------*/
340 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
342 DBG(r,"i found qrcode xml");
345 DBG(r,"not found qrcode xml");
347 /*--------------------------------------------------------------------------*/
348 /* initialize hdml structure */
349 /*--------------------------------------------------------------------------*/
350 s_init_hdml(&hdml,&doc,r, spec);
352 hdml.entryp = entryp;
354 ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
355 /*--------------------------------------------------------------------------*/
357 /*--------------------------------------------------------------------------*/
359 chxj_dump_out("[src] CHTML->HDML", src, srclen);
363 /*--------------------------------------------------------------------------*/
364 /* It is examined whether there is a location header. It ends without doing */
365 /* anything when is. */
366 /*--------------------------------------------------------------------------*/
367 buf = (char*)apr_table_get(r->headers_out, (const char*)"Location");
369 /*------------------------------------------------------------------------*/
370 /* The Location header generates tag in an initial HDML machine for the */
371 /* uncorrespon dence. */
372 /*------------------------------------------------------------------------*/
373 DBG1(r, "Location is not null[Location:%s]", buf);
374 s_output_to_hdml_out(&hdml,
375 "<HDML VERSION=3.0 MARKABLE=TRUE PUBLIC=TRUE>\n"
376 "<NODISPLAY MARKABLE=TRUE PUBLIC=TRUE TITLE=\" \">\n"
377 "<ACTION TYPE=ACCEPT TASK=GO DEST=\""
379 s_output_to_hdml_out(&hdml, buf);
380 s_output_to_hdml_out(&hdml,
385 dst = apr_pstrdup(r->pool, hdml.out);
388 /*------------------------------------------------------------------------*/
389 /* Here, the parsing of the received character string is done */
390 /*------------------------------------------------------------------------*/
391 char *ss = apr_pstrdup(r->pool, src);
393 DBG1(r, "input srclen=[%d]\n", srclen);
395 qs_init_malloc(&doc);
396 qs_init_root_node(&doc);
398 qs_parse_string(&doc, ss, srclen);
400 /*------------------------------------------------------------------------*/
401 /* The number of radiobuttons is counted. */
402 /*------------------------------------------------------------------------*/
403 s_hdml_count_radio_tag(&hdml, qs_get_root(&doc));
405 chxj_node_exchange(spec,r,(void*)&hdml, &doc, qs_get_root(&doc), 0);
408 DBG1(r,"tmp=[%s]", dst);
409 qs_all_free(&doc,QX_LOGMARK);
412 /*--------------------------------------------------------------------------*/
414 /*--------------------------------------------------------------------------*/
416 chxj_dump_out("[dst] CHTML->HDML", hdml.out, hdml.out_len);
419 /*--------------------------------------------------------------------------*/
420 /* When there is no processing result, former character string is copied */
421 /* and it returns it. */
422 /*--------------------------------------------------------------------------*/
425 return apr_pstrdup(r->pool,src);
428 *dstlen = hdml.out_len;
430 /*--------------------------------------------------------------------------*/
431 /* Null is set at the end of the character string to make sure. */
432 /*--------------------------------------------------------------------------*/
433 dst[hdml.out_len] = 0;
440 * The HDML structure is initialized.
442 * @param hdml [i/o] The pointer to the HDML structure that wants to be
443 * initialized is specified.
444 * @param doc [i] The Doc structure that should be set to the initialized
445 * HDML structure is specified.
446 * @param r [i] To use POOL, the pointer to request_rec is specified.
447 * @param spec [i] The pointer to the device_table
450 s_init_hdml(hdml_t* hdml, Doc* doc, request_rec* r, device_table* spec)
455 /*--------------------------------------------------------------------------*/
456 /* init hdml structure value */
457 /*--------------------------------------------------------------------------*/
458 memset(hdml, 0, sizeof(hdml_t));
460 hdml->card = qs_alloc_zero_byte_string(r);
462 hdml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
463 hdml->doc->parse_mode = PARSE_MODE_CHTML;
465 for (ii=0; ii<MAX_FORM_COUNT; ii++) {
466 hdml->var_cnt[ii] = 0;
467 hdml->postdata[ii] = qs_alloc_zero_byte_string(r);
470 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
471 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
472 hdml->radio_value_list[ii][jj] = NULL;
474 hdml->radio_name_list[ii] = NULL;
475 hdml->radio_out_cnt[ii] = 0;
476 hdml->radio_checked_value[ii] = NULL;
479 for (ii=0; ii<MAX_SUBMIT_BUTTON_COUNT; ii++)
480 hdml->submit_button[ii] = NULL;
482 hdml->init_vars = qs_alloc_zero_byte_string(r);
486 hdml->form_cnt = apr_time_now();
487 hdml->out = qs_alloc_zero_byte_string(r);
492 s_hdml_search_emoji(hdml_t* hdml, char* txt, char** rslt)
505 DBG(r,"spec is NULL");
507 for (ee = hdml->conf->emoji;
511 unsigned char hex1byte;
512 unsigned char hex2byte;
515 DBG(r, "emoji->imode is NULL");
519 hex1byte = ee->imode->hex1byte & 0xff;
520 hex2byte = ee->imode->hex2byte & 0xff;
522 if (ee->imode->string
523 && strlen(ee->imode->string) > 0
524 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
525 if (spec == NULL || spec->emoji_type == NULL) {
526 *rslt = apr_psprintf(r->pool,
529 return strlen(ee->imode->string);
532 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
533 *rslt = apr_psprintf(r->pool,
536 return strlen(ee->imode->string);
539 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
540 *rslt = apr_psprintf(r->pool,
543 return strlen(ee->imode->string);
546 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
547 *rslt = apr_psprintf(r->pool,
550 return strlen(ee->imode->string);
553 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
554 *rslt = apr_psprintf(r->pool,
557 return strlen(ee->imode->string);
560 *rslt = apr_psprintf(r->pool,
563 return strlen(ee->imode->string);
568 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
569 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
570 if (spec == NULL || spec->emoji_type == NULL) {
571 *rslt = apr_psprintf(r->pool,
577 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
578 *rslt = apr_psprintf(r->pool,
584 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
585 *rslt = apr_psprintf(r->pool,
591 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
592 *rslt = apr_psprintf(r->pool,
598 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
599 *rslt = apr_psprintf(r->pool,
605 *rslt = apr_psprintf(r->pool,
618 * It is a handler who processes the HTML tag.
620 * @param pdoc [i/o] The pointer to the HDML structure at the output
621 * destination is specified.
622 * @param node [i] The HTML tag node is specified.
623 * @return The conversion result is returned.
626 s_hdml_start_html_tag(void* pdoc, Node* node)
630 hdml = GET_HDML(pdoc);
632 s_output_to_hdml_out(hdml,
633 "<HDML VERSION=3.0 TTL=0 MARKABLE=TRUE>\n"
634 "<NODISPLAY NAME=D0>\n"
635 "<ACTION TYPE=ACCEPT TASK=GOSUB DEST=#D1 NEXT=#D2 CLEAR=TRUE>\n"
640 hdml->hdml_br_flag = 0;
647 * It is a handler who processes the HTML tag.
649 * @param pdoc [i/o] The pointer to the HDML structure at the output
650 * destination is specified.
651 * @param node [i] The HTML tag node is specified.
652 * @return The conversion result is returned.
655 s_hdml_end_html_tag(void* pdoc, Node* child)
659 hdml = GET_HDML(pdoc);
661 s_output_to_hdml_card(hdml,
662 "<NODISPLAY NAME=D1>\n"
663 "<ACTION TYPE=ACCEPT TASK=RETURN VARS=\""
666 if (strlen(hdml->init_vars))
667 s_output_to_hdml_card(hdml, hdml->init_vars );
669 s_output_to_hdml_card(hdml, "_chxj_dmy=" );
671 s_output_to_hdml_card(hdml,
676 s_output_to_hdml_out(hdml, hdml->card );
677 s_output_to_hdml_out(hdml, "</HDML>\n");
679 hdml->hdml_end_flag = 1;
686 * It is a handler who processes the META tag.
688 * @param pdoc [i/o] The pointer to the HDML structure at the output
689 * destination is specified.
690 * @param node [i] The META tag node is specified.
691 * @return The conversion result is returned.
694 s_hdml_start_meta_tag(void* pdoc, Node* node)
698 hdml = GET_HDML(pdoc);
700 hdml->hdml_br_flag = 0;
709 * It is a handler who processes the META tag.
711 * @param pdoc [i/o] The pointer to the HDML structure at the output
712 * destination is specified.
713 * @param node [i] The META tag node is specified.
714 * @return The conversion result is returned.
717 s_hdml_end_meta_tag(void* pdoc, Node* child)
721 hdml = GET_HDML(pdoc);
728 * It is a handler who processes the HEAD tag.
730 * @param pdoc [i/o] The pointer to the HDML structure at the output
731 * destination is specified.
732 * @param node [i] The HEAD tag node is specified.
733 * @return The conversion result is returned.
736 s_hdml_start_head_tag(void* pdoc, Node* node)
740 hdml = GET_HDML(pdoc);
744 hdml->hdml_br_flag = 0;
751 * It is a handler who processes the HEAD tag.
753 * @param pdoc [i/o] The pointer to the HDML structure at the output
754 * destination is specified.
755 * @param node [i] The HEAD tag node is specified.
756 * @return The conversion result is returned.
759 s_hdml_end_head_tag(void* pdoc, Node* child)
763 hdml = GET_HDML(pdoc);
771 * It is a handler who processes the TITLE tag.
773 * @param pdoc [i/o] The pointer to the HDML structure at the output
774 * destination is specified.
775 * @param node [i] The TITLE tag node is specified.
776 * @return The conversion result is returned.
779 s_hdml_start_title_tag(void* pdoc, Node* node)
783 hdml = GET_HDML(pdoc);
785 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"");
787 hdml->found_title = 1;
788 hdml->hdml_br_flag = 0;
795 * It is a handler who processes the TITLE tag.
797 * @param pdoc [i/o] The pointer to the HDML structure at the output
798 * destination is specified.
799 * @param node [i] The TITLE tag node is specified.
800 * @return The conversion result is returned.
803 s_hdml_end_title_tag(void* pdoc, Node* child)
807 hdml = GET_HDML(pdoc);
809 s_output_to_hdml_out(hdml, "\">\n");
816 * It is a handler who processes the BASE tag.
818 * @param pdoc [i/o] The pointer to the HDML structure at the output
819 * destination is specified.
820 * @param node [i] The BASE tag node is specified.
821 * @return The conversion result is returned.
824 s_hdml_start_base_tag(void* pdoc, Node* node)
828 hdml = GET_HDML(pdoc);
830 hdml->hdml_br_flag = 0;
837 * It is a handler who processes the BASE tag.
839 * @param pdoc [i/o] The pointer to the HDML structure at the output
840 * destination is specified.
841 * @param node [i] The BASE tag node is specified.
842 * @return The conversion result is returned.
845 s_hdml_end_base_tag(void* pdoc, Node* child)
849 hdml = GET_HDML(pdoc);
856 * It is a handler who processes the BODY tag.
858 * @param pdoc [i/o] The pointer to the HDML structure at the output
859 * destination is specified.
860 * @param node [i] The BODY tag node is specified.
861 * @return The conversion result is returned.
864 s_hdml_start_body_tag(void* pdoc, Node* node)
870 hdml = GET_HDML(pdoc);
874 if (hdml->found_title == 0)
875 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"NO TITLE\">\n");
877 s_output_to_hdml_out(hdml, "<ACTION TYPE=ACCEPT TASK=NOOP LABEL=\" \"");
879 /*--------------------------------*/
881 /*--------------------------------*/
882 for (attr = qs_get_attr(doc,node);
884 attr = qs_get_next_attr(doc,attr)) {
888 name = qs_get_attr_name(doc,attr);
890 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
894 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
898 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
902 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
906 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
911 s_output_to_hdml_out(hdml, ">\n");
913 hdml->hdml_br_flag = 0;
920 * It is a handler who processes the BODY tag.
922 * @param pdoc [i/o] The pointer to the HDML structure at the output
923 * destination is specified.
924 * @param node [i] The BODY tag node is specified.
925 * @return The conversion result is returned.
928 s_hdml_end_body_tag(void* pdoc, Node* child)
932 hdml = GET_HDML(pdoc);
934 s_output_to_hdml_out(hdml, "\n</DISPLAY>\n");
941 * It is a handler who processes the A tag.
943 * @param pdoc [i/o] The pointer to the HDML structure at the output
944 * destination is specified.
945 * @param node [i] The A tag node is specified.
946 * @return The conversion result is returned.
949 s_hdml_start_a_tag(void* pdoc, Node* node)
955 hdml = GET_HDML(pdoc);
958 s_hdml_tag_output_upper_half(hdml,node);
960 s_output_to_hdml_out(hdml, "<A");
963 /*------------------------------------*/
965 /*------------------------------------*/
966 for (attr = qs_get_attr(doc,node);
968 attr = qs_get_next_attr(doc,attr)) {
973 name = qs_get_attr_name(doc,attr);
974 value = qs_get_attr_value(doc,attr);
976 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
980 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
981 if ((*value == 'm' || *value == 'M') && strncasecmp(value, "mailto:", 7) == 0) {
982 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
983 s_output_to_hdml_out(hdml, value );
984 s_output_to_hdml_out(hdml, "\" " );
987 if ((*value == 't' || *value == 'T') && strncasecmp(value, "tel:", 4) == 0) {
989 s_output_to_hdml_out(hdml, " TASK=CALL NUMBER=\"");
990 s_output_to_hdml_out(hdml, &value[4] );
991 s_output_to_hdml_out(hdml, "\" " );
994 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
995 s_output_to_hdml_out(hdml, value );
996 s_output_to_hdml_out(hdml, "\"" );
1000 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1001 if (strcasecmp(value, "0") != 0) {
1002 s_output_to_hdml_out(hdml, " ACCESSKEY=" );
1003 s_output_to_hdml_out(hdml, value );
1004 s_output_to_hdml_out(hdml, "" );
1008 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
1012 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
1016 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1020 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1024 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1028 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1032 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1036 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1040 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1044 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1048 s_output_to_hdml_out(hdml, ">" );
1050 hdml->hdml_a_flag = 1;
1052 hdml->hdml_br_flag = 0;
1059 * It is a handler who processes the A tag.
1061 * @param pdoc [i/o] The pointer to the HDML structure at the output
1062 * destination is specified.
1063 * @param node [i] The A tag node is specified.
1064 * @return The conversion result is returned.
1067 s_hdml_end_a_tag(void* pdoc, Node* child)
1071 hdml = GET_HDML(pdoc);
1073 s_output_to_hdml_out(hdml, "</A>\n");
1075 hdml->hdml_a_flag = 0;
1082 * It is a handler who processes the BR tag.
1084 * @param pdoc [i/o] The pointer to the HDML structure at the output
1085 * destination is specified.
1086 * @param node [i] The BR tag node is specified.
1087 * @return The conversion result is returned.
1090 s_hdml_start_br_tag(void* pdoc, Node* node)
1094 hdml = GET_HDML(pdoc);
1096 if (hdml->in_center > 0)
1097 hdml->in_center = 0;
1099 if (hdml->div_in_center > 0)
1100 hdml->div_in_center = 0;
1102 s_output_to_hdml_out(hdml, "<BR>\n");
1104 hdml->hdml_br_flag = 1;
1111 * It is a handler who processes the BR tag.
1113 * @param pdoc [i/o] The pointer to the HDML structure at the output
1114 * destination is specified.
1115 * @param node [i] The BR tag node is specified.
1116 * @return The conversion result is returned.
1119 s_hdml_end_br_tag(void* pdoc, Node* child)
1123 hdml = GET_HDML(pdoc);
1130 * It is a handler who processes the TR tag.
1132 * @param pdoc [i/o] The pointer to the HDML structure at the output
1133 * destination is specified.
1134 * @param node [i] The TR tag node is specified.
1135 * @return The conversion result is returned.
1138 s_hdml_start_tr_tag(void* pdoc, Node* node)
1142 hdml = GET_HDML(pdoc);
1144 if (hdml->in_center > 0)
1145 hdml->in_center = 0;
1147 if (hdml->div_in_center > 0)
1148 hdml->div_in_center = 0;
1150 s_output_to_hdml_out(hdml, "<BR>\n");
1152 hdml->hdml_br_flag = 1;
1159 * It is a handler who processes the TR tag.
1161 * @param pdoc [i/o] The pointer to the HDML structure at the output
1162 * destination is specified.
1163 * @param node [i] The TR tag node is specified.
1164 * @return The conversion result is returned.
1167 s_hdml_end_tr_tag(void* pdoc, Node* child)
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_start_font_tag(void* pdoc, Node* node)
1190 hdml = GET_HDML(pdoc);
1197 * It is a handler who processes the FONT tag.
1199 * @param pdoc [i/o] The pointer to the HDML structure at the output
1200 * destination is specified.
1201 * @param node [i] The FONT tag node is specified.
1202 * @return The conversion result is returned.
1205 s_hdml_end_font_tag(void* pdoc, Node* child)
1209 hdml = GET_HDML(pdoc);
1216 * It is a handler who processes the FORM tag.
1218 * @param pdoc [i/o] The pointer to the HDML structure at the output
1219 * destination is specified.
1220 * @param node [i] The FORM tag node is specified.
1221 * @return The conversion result is returned.
1224 s_hdml_start_form_tag(void* pdoc, Node* node)
1232 hdml = GET_HDML(pdoc);
1237 hdml->form_tmp = apr_psprintf(r->pool,
1238 "<NODISPLAY NAME=F%d>\n",
1239 hdml->pure_form_cnt);
1240 hdml->form_tmp = apr_pstrcat(r->pool,
1242 "<ACTION TYPE=ACCEPT TASK=GO METHOD=POST DEST=\"",NULL);
1243 /* Get Attributes */
1244 for (attr = qs_get_attr(doc,node);
1246 attr = qs_get_next_attr(doc,attr)) {
1251 name = qs_get_attr_name(doc,attr);
1252 value = qs_get_attr_value(doc,attr);
1254 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1255 act = apr_psprintf(r->pool, "%s", value);
1261 hdml->form_tmp = apr_pstrcat(r->pool,
1266 hdml->form_tmp = apr_pstrcat(r->pool,
1270 hdml->form_tmp = apr_pstrcat(r->pool,
1275 hdml->hdml_br_flag = 0;
1282 * handler of the form end tag.
1284 * @param pdoc [i/o] The pointer to the HDML structure at the output
1285 * destination is specified.
1286 * @param child [i] unused.
1287 * @return The HDML output result after it edits it is returned.
1290 s_hdml_end_form_tag(void* pdoc, Node* child)
1295 hdml = GET_HDML(pdoc);
1298 s_output_to_postdata(hdml, "_chxj_dmy=");
1300 hdml->form_tmp = apr_pstrcat(r->pool,
1302 hdml->postdata[hdml->pure_form_cnt],
1305 hdml->form_tmp = apr_pstrcat(r->pool,
1307 "\" CLEAR=TRUE >\n",
1309 hdml->form_tmp = apr_pstrcat(r->pool,
1314 s_output_to_hdml_card(hdml, hdml->form_tmp);
1316 hdml->form_tmp = NULL;
1317 hdml->pure_form_cnt++;
1324 * It is a handler that takes charge of the processing of the input tag.
1326 * @param pdoc [i/o] The pointer to the HDML structure at the output
1327 * destination is specified.
1328 * @param node [i] The tag node to be processed is specified.
1331 s_hdml_start_input_tag(void* pdoc, Node* node)
1337 hdml = GET_HDML(pdoc);
1340 /*--------------------------------------------------------------------------*/
1341 /* The attribute of the input tag is acquired. */
1342 /*--------------------------------------------------------------------------*/
1343 for (attr = qs_get_attr(doc,node);
1345 attr = qs_get_next_attr(doc,attr)) {
1350 name = qs_get_attr_name(doc,attr);
1351 value = qs_get_attr_value(doc,attr);
1353 if ((*name == 't'|| *name == 'T') && strcasecmp(name, "type") == 0) {
1354 if ((*value == 't' || *value == 'T') && strcasecmp(value, "text") == 0) {
1355 /*--------------------------------------------------------------------*/
1356 /* "input type ='text'" tag is processed. */
1357 /*--------------------------------------------------------------------*/
1358 s_hdml_do_input_text_tag(hdml, node);
1361 if ((*value == 'p' || *value == 'P') && strcasecmp(value, "password") == 0) {
1362 /*--------------------------------------------------------------------*/
1363 /* "input type='password'" tag is processed. */
1364 /*--------------------------------------------------------------------*/
1365 s_hdml_do_input_password_tag(hdml, node);
1368 if ((*value == 's' || *value == 'S') && strcasecmp(value, "submit") == 0) {
1369 /*--------------------------------------------------------------------*/
1370 /* "input type='submit'" tag is processed. */
1371 /*--------------------------------------------------------------------*/
1372 s_hdml_do_input_submit_tag(hdml, node);
1375 if ((*value == 'h' || *value == 'H') && strcasecmp(value, "hidden") == 0) {
1376 /*--------------------------------------------------------------------*/
1377 /* "input type='hidden'" tag is processed. */
1378 /*--------------------------------------------------------------------*/
1379 s_hdml_do_input_hidden_tag(hdml, node);
1382 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "radio") == 0) {
1383 /*--------------------------------------------------------------------*/
1384 /* "input type='radio'" tag is processed. */
1385 /*--------------------------------------------------------------------*/
1386 s_hdml_do_input_radio_tag(hdml, node);
1389 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "checkbox") == 0) {
1390 /*--------------------------------------------------------------------*/
1391 /* "input type='checkbox'" tag is processed. */
1392 /*--------------------------------------------------------------------*/
1393 s_hdml_do_input_checkbox_tag(hdml, node);
1397 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1401 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "value") == 0) {
1405 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1409 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "maxlength") == 0) {
1413 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "checked") == 0) {
1417 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1421 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "istyle") == 0) {
1426 hdml->hdml_br_flag = 0;
1433 * The substitution processing of tag "input type = text" is done.
1435 * @param hdml [i/o] The pointer to the HDML structure at the output
1436 * destination is specified.
1437 * @param tag [i] The tag node of input type=text is specified.
1440 s_hdml_do_input_text_tag(hdml_t* hdml, Node* tag)
1454 s_hdml_tag_output_upper_half(hdml, tag);
1457 s_output_to_hdml_out(hdml,
1458 apr_psprintf(r->pool,
1459 "<A TASK=GOSUB LABEL=\x93\xfc\x97\xcd DEST=#D%d "
1460 "VARS=\"V=$%s%02d\" RECEIVE=%s%02d>",
1462 s_get_form_no(r, hdml),
1463 hdml->var_cnt[hdml->pure_form_cnt],
1464 s_get_form_no(r, hdml),
1465 hdml->var_cnt[hdml->pure_form_cnt]
1468 s_output_to_hdml_out(hdml,
1469 apr_psprintf(r->pool, "[$%s%02d]</A>\n" ,
1470 s_get_form_no(r, hdml),
1471 hdml->var_cnt[hdml->pure_form_cnt]));
1473 /*--------------------------------------------------------------------------*/
1474 /* ENTRY CARD is output here. */
1475 /*--------------------------------------------------------------------------*/
1476 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1477 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1478 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1484 nm = qs_get_name_attr(doc, tag, r);
1486 nm = qs_alloc_zero_byte_string(r);
1489 s_output_to_postdata(hdml,
1490 apr_psprintf(r->pool,
1493 s_get_form_no(r, hdml),
1494 hdml->var_cnt[hdml->pure_form_cnt]));
1496 mlen = qs_get_maxlength_attr (doc, tag, r);
1497 is = qs_get_istyle_attr (doc, tag, r);
1498 val = qs_get_value_attr (doc, tag, r);
1500 fmt = qs_conv_istyle_to_format(r, is);
1501 DBG(r,"qs_conv_istyle_to_format end");
1505 for (ii=0; ii<strlen(mlen); ii++) {
1506 if (mlen[ii] < '0' || mlen[ii] > '9') {
1507 mlen = apr_psprintf(r->pool, "0");
1511 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=%d%s", atoi(mlen), fmt));
1514 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1517 s_output_to_hdml_card(hdml,
1518 " MARKABLE=FALSE>\n"
1519 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1523 s_output_to_init_vars(hdml,
1524 apr_psprintf(r->pool, "%s%02d=%s",
1525 s_get_form_no(r, hdml),
1526 hdml->var_cnt[hdml->pure_form_cnt],
1527 ap_escape_uri(r->pool,val)));
1529 s_output_to_init_vars(hdml,
1530 apr_psprintf(r->pool, "%s%02d=",
1531 s_get_form_no(r, hdml),
1532 hdml->var_cnt[hdml->pure_form_cnt]));
1534 hdml->var_cnt[hdml->pure_form_cnt]++;
1538 * The substitution processing of tag "input type = password" is done.
1540 * @param hdml [i/o] The pointer to the HDML structure at the output
1541 * destination is specified.
1542 * @param tag [i] The tag node of input type=password is specified.
1545 s_hdml_do_input_password_tag(hdml_t* hdml, Node* tag)
1547 Doc* doc = hdml->doc;
1548 request_rec* r = doc->r;
1555 s_hdml_tag_output_upper_half(hdml, tag);
1558 s_output_to_hdml_out(hdml, "<A TASK=GOSUB LABEL=\"\x93\xfc\x97\xcd\" DEST=");
1559 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "#D%d ", hdml->card_cnt));
1560 s_output_to_hdml_out(hdml,
1561 apr_psprintf(r->pool, "VARS=\"V=$%s%02d\" ",
1562 s_get_form_no(r, hdml),
1563 hdml->var_cnt[hdml->pure_form_cnt]));
1565 s_output_to_hdml_out(hdml,
1566 apr_psprintf(r->pool, "RECEIVE=%s%02d>" ,
1567 s_get_form_no(r, hdml),
1568 hdml->var_cnt[hdml->pure_form_cnt]));
1569 s_output_to_hdml_out(hdml,
1570 apr_psprintf(r->pool, "[$%s%02d]</A>\n" ,
1571 s_get_form_no(r, hdml),
1572 hdml->var_cnt[hdml->pure_form_cnt]));
1574 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1575 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1576 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1583 nm = qs_get_name_attr(doc, tag, r);
1585 nm = qs_alloc_zero_byte_string(r);
1587 s_output_to_postdata(hdml,
1588 apr_psprintf(r->pool,
1591 s_get_form_no(r, hdml),
1592 hdml->var_cnt[hdml->pure_form_cnt]));
1594 mlen = qs_get_maxlength_attr (doc, tag, r);
1595 val = qs_get_value_attr (doc, tag, r);
1596 /*--------------------------------------------------------------------------*/
1597 /* Default is a figure input. */
1598 /*--------------------------------------------------------------------------*/
1599 fmt = apr_psprintf(r->pool, "N");
1601 if (chxj_chk_numeric(mlen) != 0)
1602 mlen = apr_psprintf(r->pool, "0");
1603 s_output_to_hdml_card(hdml,
1604 apr_psprintf(r->pool, " FORMAT=%d%s", chxj_atoi(mlen), fmt));
1607 s_output_to_hdml_card(hdml,
1608 apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1610 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " NOECHO=TRUE "));
1612 s_output_to_hdml_card(hdml,
1613 " MARKABLE=FALSE>\n"
1614 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1618 s_output_to_init_vars(hdml,
1619 apr_psprintf(r->pool, "%s%02d=%s",
1620 s_get_form_no(r, hdml),
1621 hdml->var_cnt[hdml->pure_form_cnt],
1622 ap_escape_uri(r->pool,val)));
1624 s_output_to_init_vars(hdml,
1625 apr_psprintf(r->pool, "%s%02d=",
1626 s_get_form_no(r, hdml),
1627 hdml->var_cnt[hdml->pure_form_cnt]));
1629 hdml->var_cnt[hdml->pure_form_cnt]++;
1633 * The substitution processing of tag "input type = submit" is done.
1635 * @param hdml [i/o] The pointer to the HDML structure at the output
1636 * destination is specified.
1637 * @param tag [i] The tag node of input type=submit is specified.
1640 s_hdml_do_input_submit_tag(hdml_t* hdml, Node* tag)
1642 Doc* doc = hdml->doc;
1643 request_rec* r = doc->r;
1647 s_hdml_tag_output_upper_half(hdml, tag);
1649 s_output_to_hdml_out(hdml,
1650 apr_psprintf(r->pool,
1651 "<A TASK=GO LABEL=OK DEST=#F%d ",
1652 hdml->pure_form_cnt));
1654 /*--------------------------------------------------------------------------*/
1655 /* get name and value attribute */
1656 /*--------------------------------------------------------------------------*/
1657 nm = qs_get_name_attr (doc, tag, r);
1658 val = qs_get_value_attr (doc, tag, r);
1661 s_output_to_hdml_out(hdml,
1662 apr_psprintf(r->pool, "VARS=\"%s=%s\" ",
1664 ap_escape_uri(r->pool,val)));
1665 if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL) {
1666 s_output_to_postdata(hdml,
1667 apr_psprintf(r->pool,"%s%s=$%s",
1668 SUBMIT_BUTTON_PREFIX, nm, nm));
1671 s_output_to_hdml_out(hdml, ">" );
1672 s_output_to_hdml_out(hdml, val);
1673 s_output_to_hdml_out(hdml, "</A>\n" );
1677 * The substitution processing of tag "input type = hidden" is done.
1679 * @param hdml [i/o] The pointer to the HDML structure at the output
1680 * destination is specified.
1681 * @param tag [i] The tag node of input type=hidden is specified.
1684 s_hdml_do_input_hidden_tag(hdml_t* hdml, Node* tag)
1686 Doc* doc = hdml->doc;
1687 request_rec* r = doc->r;
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);
1698 s_output_to_postdata(hdml,
1699 apr_psprintf(r->pool,
1702 ap_escape_uri(r->pool, val)));
1707 * The substitution processing of tag "input type = radio" is done.
1709 * @param hdml [i/o] The pointer to the HDML structure at the output
1710 * destination is specified.
1711 * @param tag [i] The tag node of input type=radio is specified.
1714 s_hdml_do_input_radio_tag(hdml_t* hdml, Node* tag)
1716 Doc* doc = hdml->doc;
1717 request_rec* r = doc->r;
1725 s_hdml_tag_output_upper_half(hdml, tag);
1727 /*--------------------------------------------------------------------------*/
1728 /* get name and value attribute */
1729 /*--------------------------------------------------------------------------*/
1730 nm = qs_get_name_attr (doc, tag, r);
1731 val = qs_get_value_attr (doc, tag, r);
1733 /*--------------------------------------------------------------------------*/
1734 /* The same name is searched out from the list made beforehand. */
1735 /*--------------------------------------------------------------------------*/
1736 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
1737 if (! hdml->radio_name_list[ii]) {
1739 DBG1(r, "Oops... radio list is null[%d]", ii);
1740 /*----------------------------------------------------------------------*/
1741 /* Processing is ended because it doesn't happen off the fly. */
1742 /*----------------------------------------------------------------------*/
1746 if (strcasecmp(hdml->radio_name_list[ii], nm) == 0)
1749 if (ii == MAX_RADIO_COUNT) {
1751 DBG(r,"Oops... The same name was not in the list. ");
1752 /*------------------------------------------------------------------------*/
1753 /* Processing is ended because it doesn't happen off the fly. */
1754 /*------------------------------------------------------------------------*/
1758 s_output_to_hdml_out(hdml,
1759 apr_psprintf(r->pool,
1761 "LABEL=\"\x93\xfc\x97\xcd\" "
1762 "DEST=#R%d VARS=\"VAL=%s\" "
1768 if (hdml->radio_out_cnt[ii] == 0) {
1769 s_output_to_hdml_card(hdml,
1770 apr_psprintf(r->pool,
1771 "<NODISPLAY NAME=R%d>\n",
1773 s_output_to_hdml_card(hdml,
1774 apr_psprintf(r->pool,
1776 "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
1779 kk = hdml->radio_out_cnt[ii];
1780 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
1781 if (! hdml->radio_value_list[ii][jj])
1786 for (jj=0; jj<r_cnt; jj++) {
1787 if (! hdml->radio_value_list[ii][jj])
1791 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
1792 if (hdml->radio_out_cnt[ii] == 0)
1793 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
1796 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
1797 if (hdml->radio_out_cnt[ii] == 0) {
1799 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
1801 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
1808 s_output_to_hdml_out(hdml,
1809 apr_psprintf(r->pool, "\" >$%s_%02d</A>",
1811 hdml->radio_out_cnt[ii]));
1812 if (! hdml->radio_out_cnt[ii]) {
1813 s_output_to_hdml_card(hdml, "\">\n" );
1814 s_output_to_hdml_card(hdml, "</NODISPLAY>\n");
1816 s_output_to_postdata(hdml, apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
1818 for (jj=0; jj<r_cnt; jj++) {
1819 if (hdml->radio_value_list[ii][jj] && hdml->radio_checked_value[ii]) {
1820 if (strcasecmp(hdml->radio_value_list[ii][jj],
1821 hdml->radio_checked_value[ii]) == 0) {
1822 s_output_to_init_vars(hdml,
1823 apr_psprintf(r->pool,
1829 s_output_to_init_vars(hdml,
1830 apr_psprintf(r->pool,
1837 s_output_to_init_vars(hdml,
1838 apr_psprintf(r->pool,
1845 if (hdml->radio_checked_value[ii]) {
1846 DBG1(r,"radio button is checked. checked value is [%s]",
1847 hdml->radio_checked_value[ii]);
1848 s_output_to_init_vars(hdml,
1849 apr_psprintf(r->pool,
1852 hdml->radio_checked_value[ii]));
1855 DBG(r,"radio button is not checked. checked value is []");
1856 s_output_to_init_vars(hdml,
1857 apr_psprintf(r->pool,
1862 hdml->radio_out_cnt[ii]++;
1866 * The substitution processing of tag "input type = checkbox" is done.
1868 * @param hdml [i/o] The pointer to the HDML structure at the output
1869 * destination is specified.
1870 * @param tag [i] The tag node of input type=checkbox is specified.
1873 s_hdml_do_input_checkbox_tag(hdml_t* hdml, Node* tag)
1875 Doc* doc = hdml->doc;
1876 request_rec* r = doc->r;
1881 /*--------------------------------------------------------------------------*/
1882 /* It is posted to the one without the checked attribute. */
1883 /* However, they were able to be removed with INPUT FILTER. */
1884 /*--------------------------------------------------------------------------*/
1885 if (! hdml->has_checkbox) {
1886 hdml->has_checkbox++;
1887 s_output_to_hdml_card(hdml,
1888 "<NODISPLAY NAME=\"_chk\">\n"
1889 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1890 "RETVALS=\"_uchk;$V;X\" >\n"
1892 "<NODISPLAY NAME=\"_uchk\">\n"
1893 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1894 "RETVALS=\"_chk;;_\" >\n"
1897 DBG(r, "wrote checkbox hdml card.");
1900 /*--------------------------------------------------------------------------*/
1901 /* It is examined whether it is CHECKED. */
1902 /*--------------------------------------------------------------------------*/
1903 chk = qs_is_checked_checkbox_attr(doc, tag, r);
1905 /*--------------------------------------------------------------------------*/
1906 /* The value of the name attribute and the value attribute is acquired */
1908 /*--------------------------------------------------------------------------*/
1909 val = qs_get_value_attr(doc, tag, r);
1910 nm = qs_get_name_attr(doc, tag, r);
1913 val = qs_alloc_zero_byte_string(r);
1916 nm = qs_alloc_zero_byte_string(r);
1918 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
1919 "<A TASK=GOSUB LABEL=\"a\xaf\xb8\" "
1920 "DEST=\"#$%s%02d\" "
1922 "RECEIVE=\"%s%02d;%s%02d;%s%02d\">"
1924 s_get_form_no(r, hdml),
1925 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1927 s_get_form_no(r, hdml),
1928 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1929 s_get_form_no(r, hdml),
1930 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1931 s_get_form_no(r, hdml),
1932 hdml->var_cnt[hdml->pure_form_cnt] + 2,
1933 s_get_form_no(r, hdml),
1934 hdml->var_cnt[hdml->pure_form_cnt] + 2));
1936 s_output_to_init_vars(hdml,
1937 apr_psprintf(r->pool,
1938 "%s%02d=_uchk&%s%02d=%s&%s%02d=X",
1939 s_get_form_no(r, hdml),
1940 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1941 s_get_form_no(r, hdml),
1942 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1943 ap_escape_uri(r->pool,val),
1944 s_get_form_no(r, hdml),
1945 hdml->var_cnt[hdml->pure_form_cnt] + 2
1949 s_output_to_init_vars(hdml,
1950 apr_psprintf(r->pool,
1951 "%s%02d=_chk&%s%02d=&%s%02d=_",
1952 s_get_form_no(r, hdml),
1953 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1954 s_get_form_no(r, hdml),
1955 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1956 s_get_form_no(r, hdml),
1957 hdml->var_cnt[hdml->pure_form_cnt] + 2
1961 s_output_to_postdata(hdml,
1962 apr_psprintf(r->pool, "%s%s=$%s%02d",
1965 s_get_form_no(r, hdml),
1966 hdml->var_cnt[hdml->pure_form_cnt] + 1));
1968 hdml->var_cnt[hdml->pure_form_cnt] += 3;
1972 * The ISTYLE attribute is converted into the HDML form.
1974 * @param r [i] To use POOL, the pointer to request_rec is specified.
1975 * @param is [i] The value of the ISTYLE attribute is specified.
1976 * @return The ISTYLE attribute converted into the HDML form is returned.
1979 qs_conv_istyle_to_format(request_rec* r, char* is)
1988 fmt = apr_psprintf(r->pool, "M");
1991 fmt = apr_psprintf(r->pool, "M");
1994 fmt = apr_psprintf(r->pool, "m");
1997 fmt = apr_psprintf(r->pool, "N");
2008 * It is a handler who processes the INPUT tag.
2010 * @param pdoc [i/o] The pointer to the HDML structure at the output
2011 * destination is specified.
2012 * @param node [i] The INPUT tag node is specified.
2013 * @return The conversion result is returned.
2016 s_hdml_end_input_tag(void* pdoc, Node* child)
2020 hdml = GET_HDML(pdoc);
2027 * It is a handler who processes the CENTER tag.
2029 * @param pdoc [i/o] The pointer to the HDML structure at the output
2030 * destination is specified.
2031 * @param node [i] The CENTER tag node is specified.
2032 * @return The conversion result is returned.
2035 s_hdml_start_center_tag(void* pdoc, Node* node)
2039 hdml = GET_HDML(pdoc);
2044 if (hdml->hdml_br_flag == 0)
2045 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
2047 hdml = s_output_to_hdml_out(hdml, "<CENTER>");
2054 * It is a handler who processes the CENTER tag.
2056 * @param pdoc [i/o] The pointer to the HDML structure at the output
2057 * destination is specified.
2058 * @param node [i] The CENTER tag node is specified.
2059 * @return The conversion result is returned.
2062 s_hdml_end_center_tag(void* pdoc, Node* child)
2066 hdml = GET_HDML(pdoc);
2069 hdml->in_center = 0;
2071 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
2072 hdml->hdml_br_flag = 1;
2079 * It is a handler who processes the HR tag.
2081 * @param pdoc [i/o] The pointer to the HDML structure at the output
2082 * destination is specified.
2083 * @param node [i] The HR tag node is specified.
2084 * @return The conversion result is returned.
2087 s_hdml_start_hr_tag(void* pdoc, Node* node)
2091 hdml = GET_HDML(pdoc);
2093 if (hdml->hdml_br_flag == 0) {
2094 s_output_to_hdml_out(hdml, "<BR>\n");
2095 if (hdml->in_center)
2098 if (hdml->div_in_center)
2099 hdml->div_in_center--;
2102 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");
2104 hdml->hdml_br_flag = 1;
2111 * It is a handler who processes the HR tag.
2113 * @param pdoc [i/o] The pointer to the HDML structure at the output
2114 * destination is specified.
2115 * @param node [i] The HR tag node is specified.
2116 * @return The conversion result is returned.
2119 s_hdml_end_hr_tag(void* pdoc, Node* child)
2123 hdml = GET_HDML(pdoc);
2130 * It is a handler who processes the LI tag.
2132 * @param pdoc [i/o] The pointer to the HDML structure at the output
2133 * destination is specified.
2134 * @param node [i] The LI tag node is specified.
2135 * @return The conversion result is returned.
2138 s_hdml_start_li_tag(void* pdoc, Node* node)
2142 hdml = GET_HDML(pdoc);
2144 if (hdml->hdml_br_flag == 0) {
2145 s_output_to_hdml_out(hdml, "<BR>\n");
2146 if (hdml->in_center)
2149 if (hdml->div_in_center)
2150 hdml->div_in_center--;
2153 hdml->hdml_br_flag = 1;
2160 * It is a handler who processes the LI tag.
2162 * @param pdoc [i/o] The pointer to the HDML structure at the output
2163 * destination is specified.
2164 * @param node [i] The LI tag node is specified.
2165 * @return The conversion result is returned.
2168 s_hdml_end_li_tag(void* pdoc, Node* child)
2172 hdml = GET_HDML(pdoc);
2174 if (hdml->hdml_br_flag == 0) {
2175 s_output_to_hdml_out(hdml, "<BR>\n");
2176 if (hdml->in_center)
2179 if (hdml->div_in_center)
2180 hdml->div_in_center--;
2183 hdml->hdml_br_flag = 1;
2190 * It is a handler who processes the IMG tag.
2192 * @param pdoc [i/o] The pointer to the HDML structure at the output
2193 * destination is specified.
2194 * @param node [i] The IMG tag node is specified.
2195 * @return The conversion result is returned.
2198 s_hdml_start_img_tag(void* pdoc, Node* node)
2202 #ifndef IMG_NOT_CONVERT_FILENAME
2203 device_table_t* spec;
2207 hdml = GET_HDML(pdoc);
2209 #ifndef IMG_NOT_CONVERT_FILENAME
2213 s_hdml_tag_output_upper_half(hdml, node);
2215 s_output_to_hdml_out(hdml, "<img");
2217 /* Get Attributes */
2218 for (attr = qs_get_attr(doc,node);
2220 attr = qs_get_next_attr(doc,attr)) {
2222 char* name = qs_get_attr_name(doc,attr);
2223 char* value = qs_get_attr_value(doc,attr);
2225 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
2226 s_output_to_hdml_out(hdml, " src=\"");
2227 #ifdef IMG_NOT_CONVERT_FILENAME
2228 s_output_to_hdml_out(hdml, value );
2230 s_output_to_hdml_out(hdml, chxj_img_conv(doc->r, spec,value));
2232 s_output_to_hdml_out(hdml, "\"" );
2235 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
2236 s_output_to_hdml_out(hdml, " align=\"" );
2237 s_output_to_hdml_out(hdml, value );
2238 s_output_to_hdml_out(hdml, "\"" );
2241 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2242 s_output_to_hdml_out(hdml, " width=\"");
2243 s_output_to_hdml_out(hdml, value );
2244 s_output_to_hdml_out(hdml, "\"" );
2247 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
2248 s_output_to_hdml_out(hdml, " height=\"");
2249 s_output_to_hdml_out(hdml, value );
2250 s_output_to_hdml_out(hdml, "\"" );
2253 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
2254 s_output_to_hdml_out(hdml, " hspace=\"");
2255 s_output_to_hdml_out(hdml, value );
2256 s_output_to_hdml_out(hdml, "\"" );
2259 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2260 s_output_to_hdml_out(hdml, " vspace=\"");
2261 s_output_to_hdml_out(hdml, value );
2262 s_output_to_hdml_out(hdml, "\"" );
2265 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
2266 s_output_to_hdml_out(hdml, " alt=\"" );
2267 s_output_to_hdml_out(hdml, value );
2268 s_output_to_hdml_out(hdml, "\"" );
2271 s_output_to_hdml_out(hdml, ">" );
2273 hdml->hdml_br_flag = 0;
2280 * It is a handler who processes the IMG tag.
2282 * @param pdoc [i/o] The pointer to the HDML structure at the output
2283 * destination is specified.
2284 * @param node [i] The IMG tag node is specified.
2285 * @return The conversion result is returned.
2288 s_hdml_end_img_tag(void* pdoc, Node* child)
2292 hdml = GET_HDML(pdoc);
2299 * It is a handler who processes the SELECT tag.
2301 * @param pdoc [i/o] The pointer to the HDML structure at the output
2302 * destination is specified.
2303 * @param node [i] The SELECT tag node is specified.
2304 * @return The conversion result is returned.
2307 s_hdml_start_select_tag(void* pdoc, Node* node)
2314 hdml = GET_HDML(pdoc);
2318 s_hdml_tag_output_upper_half(hdml, node);
2322 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
2323 "<A TASK=GOSUB LABEL=\x91\x49\x91\xf0 "
2324 "VARS=\"V=$%s%02d\" DEST=#D%d "
2325 "RECEIVE=\"%s%02d;%s%02d\">"
2327 s_get_form_no(r, hdml),
2328 hdml->var_cnt[hdml->pure_form_cnt]+0,
2330 s_get_form_no(r, hdml),
2331 hdml->var_cnt[hdml->pure_form_cnt]+0,
2332 s_get_form_no(r, hdml),
2333 hdml->var_cnt[hdml->pure_form_cnt]+1,
2334 s_get_form_no(r, hdml),
2335 hdml->var_cnt[hdml->pure_form_cnt]+1));
2337 s_output_to_hdml_card(hdml,
2338 apr_psprintf(r->pool,
2339 "<CHOICE KEY=V NAME=D%d ", hdml->card_cnt));
2340 s_output_to_hdml_card(hdml,
2341 apr_psprintf(r->pool,
2342 "DEFAULT=$V METHOD=ALPHA MARKABLE=FALSE>\n"));
2343 /*--------------------------------------------------------------------------*/
2344 /* Get Attributes */
2345 /*--------------------------------------------------------------------------*/
2346 for (attr = qs_get_attr(doc,node);
2348 attr=qs_get_next_attr(doc,attr)) {
2350 char* name = qs_get_attr_name(doc,attr);
2351 char* value = qs_get_attr_value(doc,attr);
2352 char* selval = NULL;
2353 char* selvaltxt = NULL;
2355 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2357 s_output_to_postdata(hdml,
2358 apr_psprintf(r->pool, "%s=$%s%02d",
2360 s_get_form_no(r, hdml),
2361 hdml->var_cnt[hdml->pure_form_cnt]));
2362 selval = qs_get_selected_value(doc, node, r);
2364 DBG(r, "selected value not found");
2365 selval = qs_alloc_zero_byte_string(r);
2368 DBG1(r, "selected value found[%s]" , selval);
2370 selvaltxt = qs_get_selected_value_text(doc, node, r);
2372 selvaltxt = qs_alloc_zero_byte_string(r);
2374 DBG1(r, "selvaltxt:[%s]" ,selvaltxt);
2376 s_output_to_init_vars(hdml,
2377 apr_psprintf(r->pool,
2378 "%s%02d=%s&%s%02d=%s",
2379 s_get_form_no(r, hdml),
2380 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2382 s_get_form_no(r, hdml),
2383 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2386 hdml->var_cnt[hdml->pure_form_cnt] += 2;
2391 hdml->hdml_br_flag = 0;
2397 * It is a handler who processes the SELECT tag.
2399 * @param pdoc [i/o] The pointer to the HDML structure at the output
2400 * destination is specified.
2401 * @param node [i] The SELECT tag node is specified.
2402 * @return The conversion result is returned.
2405 s_hdml_end_select_tag(void* pdoc, Node* node)
2409 hdml = GET_HDML(pdoc);
2411 s_output_to_hdml_card(hdml, "</CHOICE>\n");
2418 * It is a handler who processes the OPTION tag.
2420 * @param pdoc [i/o] The pointer to the HDML structure at the output
2421 * destination is specified.
2422 * @param node [i] The OPTION tag node is specified.
2423 * @return The conversion result is returned.
2426 s_hdml_start_option_tag(void* pdoc, Node* node)
2435 hdml = GET_HDML(pdoc);
2441 hdml->option_flag = 1;
2442 val = qs_get_value_attr(doc, node, r);
2444 /*--------------------------------------------------------------------------*/
2445 /* The child node of the object tag node acquires the value in assumption */
2446 /* that is the TEXT node. */
2447 /*--------------------------------------------------------------------------*/
2448 child = qs_get_child_node(doc, node);
2450 txtval = apr_palloc(r->pool, 1);
2454 txtval = qs_get_node_value(doc, child);
2456 DBG1(r, "txtval:[%s]" , txtval);
2458 if (val && txtval) {
2459 s_output_to_hdml_card(hdml,
2460 apr_psprintf(r->pool,
2461 "<CE TASK=RETURN VALUE=\"%s\" "
2462 "RETVALS=\"$V;%s\">%s</CE>\n",
2464 qs_trim_string(r,txtval),
2465 qs_trim_string(r,txtval)));
2468 hdml->hdml_br_flag = 0;
2475 * It is a handler who processes the OPTION tag.
2477 * @param pdoc [i/o] The pointer to the HDML structure at the output
2478 * destination is specified.
2479 * @param node [i] The OPTION tag node is specified.
2480 * @return The conversion result is returned.
2483 s_hdml_end_option_tag(void* pdoc, Node* node)
2487 hdml = GET_HDML(pdoc);
2489 hdml->option_flag = 0;
2496 * It is a handler who processes the DIV tag.
2498 * @param pdoc [i/o] The pointer to the HDML structure at the output
2499 * destination is specified.
2500 * @param node [i] The DIV tag node is specified.
2501 * @return The conversion result is returned.
2504 s_hdml_start_div_tag(void* pdoc, Node* node)
2510 hdml = GET_HDML(pdoc);
2513 /*--------------------------------------------------------------------------*/
2514 /* If the br tag is not output immediately before the div tag appears, the */
2515 /* br tag is output. */
2516 /*--------------------------------------------------------------------------*/
2517 if (hdml->hdml_br_flag == 0) {
2518 hdml->hdml_br_flag = 1;
2519 s_output_to_hdml_out(hdml, "<BR>\n");
2522 /*--------------------------------------------------------------------------*/
2523 /* The object tag node is scanned. */
2524 /*--------------------------------------------------------------------------*/
2525 for (attr = qs_get_attr(doc,node);
2527 attr = qs_get_next_attr(doc,attr)) {
2528 char* name = qs_get_attr_name(doc,attr);
2529 char* value = qs_get_attr_value(doc,attr);
2531 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
2532 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "right") == 0) {
2533 hdml->div_right_flag = 1;
2534 s_output_to_hdml_out(hdml, "<RIGHT>");
2535 hdml->hdml_br_flag = 0;
2539 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "center") == 0) {
2540 hdml->div_center_flag = 1;
2541 s_output_to_hdml_out(hdml, "<CENTER>");
2542 hdml->hdml_br_flag = 0;
2547 hdml->hdml_br_flag = 0;
2554 * It is a handler who processes the DIV tag.
2556 * @param pdoc [i/o] The pointer to the HDML structure at the output
2557 * destination is specified.
2558 * @param node [i] The DIV tag node is specified.
2559 * @return The conversion result is returned.
2562 s_hdml_end_div_tag(void* pdoc, Node* node)
2567 hdml = GET_HDML(pdoc);
2570 if (hdml->div_right_flag == 1) {
2571 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2572 hdml->div_right_flag = 0;
2574 if (hdml->div_center_flag == 1) {
2575 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2576 hdml->div_center_flag = 0;
2577 hdml->div_in_center = 0;
2585 * It is a wrapper of the apr_pstrcat function.
2587 * @param r [i] To use POOL, the pointer to request_rec is specified.
2588 * @param o [i] The character string of connected origin is specified.
2589 * @param s [i] The character string connected with 'o' parameter is
2591 * @param len [i/o] The pointer to the area where the character string
2592 * length is stored is specified.
2593 * @return The character string after it connects it is returned.
2596 qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len)
2598 *len = (strlen(s) + *len);
2599 return apr_pstrcat(r->pool, o, s, NULL);
2603 * The prepositive character string used to generate the variable for HDML is
2606 * @param r [i] To use POOL, the pointer to request_rec is specified.
2607 * @param hdml [i] The pointer to the HDML structure that maintains the seed
2608 * to generate it is specified.
2609 * @return The character string after it generates it is returned.
2612 s_get_form_no(request_rec* r, hdml_t* hdml)
2616 unsigned long fc = hdml->form_cnt;
2618 apr_time_exp_tz(&tm, hdml->form_cnt, 0);
2620 result = apr_psprintf(r->pool, "%c",(int)('A' + ((fc / 100) % 26)));
2621 result = apr_pstrcat(r->pool, result,
2622 apr_psprintf(r->pool, "%02d%02d%02d",
2630 * The number of tag nodes .."Input type =' radio '".. is counted.
2632 * @param hdml [i] The pointer to the HDML structure is specified.
2633 * @param node [i] The first parents node that counts the radio tag node is
2637 s_hdml_count_radio_tag(hdml_t* hdml, Node* node)
2640 Doc* doc = hdml->doc;
2641 request_rec* r = doc->r;
2643 /*--------------------------------------------------------------------------*/
2644 /* All the child nodes of the specified node are scanned. */
2645 /*--------------------------------------------------------------------------*/
2646 for (child = qs_get_child_node(doc,node);
2648 child = qs_get_next_node(doc,child)) {
2659 name = qs_get_node_name(doc,child);
2660 if (strcasecmp(name, "input") != 0) {
2661 s_hdml_count_radio_tag(hdml, child);
2665 DBG(r,"found input tag");
2667 type = qs_get_type_attr(doc, child, r);
2669 ERR(r, "Oops! The input tag without the type attribute has been found.Please give a type.");
2673 if (strcasecmp(type, "radio") != 0)
2676 DBG(r, "found type=radio");
2678 rname = qs_get_name_attr (doc, child, r);
2679 rvalue = qs_get_value_attr(doc, child, r);
2682 /*----------------------------------------------------------------------*/
2683 /* Oops!. The input tag without the name attribute has been found. */
2684 /*----------------------------------------------------------------------*/
2685 DBG(r, "Oops!. The input tag without the name attribute has been found. Please give a name.");
2689 DBG(r, "found name attribute");
2691 /*------------------------------------------------------------------------*/
2692 /* It scans in radio_name_list. When the same value exists, the */
2693 /* value is overwrited. */
2694 /* The value is written in a new area when not is. */
2695 /*------------------------------------------------------------------------*/
2696 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
2697 if (! hdml->radio_name_list[ii]) {
2698 DBG1(r, "new name:[%s]", rname);
2701 if (strcasecmp(hdml->radio_name_list[ii], rname) == 0) {
2702 DBG1(r, "already registered name:[%s]", rname);
2706 if (ii == MAX_RADIO_COUNT) {
2707 DBG(r, apr_psprintf(r->pool,
2708 "I do not understand the name of the radiobutton "
2709 "of %d piece or more. Please decrease "
2710 "the number of radiobuttons.",
2715 DBG1(r,"add radio name:[%s]" ,rname);
2717 hdml->radio_name_list[ii] = apr_pstrdup(r->pool, rname);
2719 /*------------------------------------------------------------------------*/
2720 /* It adds it to radio_value_list. */
2721 /*------------------------------------------------------------------------*/
2722 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) {
2723 if (!hdml->radio_value_list[ii][jj])
2726 if (jj == MAX_RADIO_VALUE_COUNT) {
2727 DBG(r, apr_psprintf(r->pool,
2728 "I do not understand the value of the radiobutton "
2729 "of %d piece or more. Please decrease "
2730 "the number of radiobuttons.",
2731 MAX_RADIO_VALUE_COUNT));
2734 hdml->radio_value_list[ii][jj] = apr_pstrdup(r->pool, rvalue);
2736 /*------------------------------------------------------------------------*/
2737 /* Now let's be the checked attribute or scan. */
2738 /*------------------------------------------------------------------------*/
2739 chkd = qs_get_checked_attr(hdml->doc, child, hdml->doc->r);
2741 DBG(r,apr_psprintf(r->pool,
2742 "The tag scanned now had the checked "
2743 "attribute. The value is [%s].",
2745 hdml->radio_checked_value[ii] = apr_pstrdup(r->pool, rvalue);
2752 * The character string is added, and output to the out member of the HDML
2755 * @param hdml [i/o] The pointer to the HDML structure that maintains the out
2756 * member at the output destination is specified.
2757 * @param s [i] The character string that should be output is specified.
2758 * @return The pointer to the HDML structure after it processes it is returned.
2761 s_output_to_hdml_out(hdml_t* hdml, char* s)
2763 hdml->out = qs_out_apr_pstrcat(hdml->doc->r, hdml->out, s, &hdml->out_len);
2770 * The character string is added, and output to the card member of the HDML
2773 * @param hdml [i/o] The pointer to the HDML structure that maintains the
2774 * card member at the output destination is specified.
2775 * @param s [i] The character string that should be output is specified.
2776 * @return The pointer to the HDML structure after it processes it is returned.
2779 s_output_to_hdml_card(hdml_t* hdml, char* s)
2781 hdml->card = qs_out_apr_pstrcat(hdml->doc->r, hdml->card, s, &hdml->card_len);
2789 * The data for the post is added, and output.
2791 * @param hdml [i/o] The pointer to the HDML structure at the output
2792 * destination is specified.
2793 * @param s [i] The character string that wants to output to postdata is
2797 s_output_to_postdata(hdml_t* hdml, char* s)
2799 request_rec* r = hdml->doc->r;
2801 if (strlen(hdml->postdata[hdml->pure_form_cnt]))
2802 hdml->postdata[hdml->pure_form_cnt] =
2803 apr_pstrcat(r->pool,
2804 hdml->postdata[hdml->pure_form_cnt],
2808 hdml->postdata[hdml->pure_form_cnt] =
2809 apr_pstrcat(r->pool,
2810 hdml->postdata[hdml->pure_form_cnt],
2811 qs_trim_string(r, s),
2814 DBG1(r, "POSTDATA:[%s]", hdml->postdata[hdml->pure_form_cnt] );
2820 * The tag output upper half.
2822 * @param hdml [i/o] The pointer to the HDML structure at the output
2823 * destination is specified.
2824 * @param node [i] The A tag node is specified.
2827 s_hdml_tag_output_upper_half(hdml_t* hdml, Node* node)
2829 if (hdml->hdml_br_flag == 1
2830 && hdml->div_right_flag == 1) {
2831 s_output_to_hdml_out(hdml, "<RIGHT>");
2832 hdml->hdml_br_flag = 0;
2835 if (hdml->hdml_br_flag == 1
2837 && hdml->in_center == 0) {
2838 s_output_to_hdml_out(hdml, "<CENTER>");
2840 hdml->hdml_br_flag = 0;
2843 if (hdml->hdml_br_flag == 1
2844 && hdml->div_center_flag > 0
2845 && hdml->div_in_center == 0) {
2846 s_output_to_hdml_out(hdml, "<CENTER>");
2847 hdml->div_in_center++;
2848 hdml->hdml_br_flag = 0;
2855 * The data for the init_vars is added, and output.
2857 * @param hdml [i/o] The pointer to the HDML structure at the output
2858 * destination is specified.
2859 * @param s [i] The character string that wants to output to postdata is
2863 s_output_to_init_vars(hdml_t* hdml, char* s)
2865 request_rec* r = hdml->doc->r;
2867 if (strlen(hdml->init_vars))
2868 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, "&", NULL);
2870 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, qs_trim_string(r,s), NULL);
2872 DBG1(r, "INIT_VARS:[%s]", hdml->init_vars);
2878 s_hdml_chxjif_tag(void* pdoc, Node* node)
2884 hdml = GET_HDML(pdoc);
2887 for (child = qs_get_child_node(doc, node);
2889 child = qs_get_next_node(doc, child)) {
2890 s_output_to_hdml_out(hdml, child->otext);
2891 s_hdml_chxjif_tag(hdml, child);
2897 s_hdml_text_tag(void* pdoc, Node* child)
2909 hdml = GET_HDML(pdoc);
2913 textval = qs_get_node_value(doc,child);
2914 textval = qs_trim_string(r, textval);
2915 if (strlen(textval) == 0)
2918 if (hdml->option_flag == 1)
2921 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2922 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2923 tdst = apr_palloc(r->pool, 1);
2928 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2930 int rtn = s_hdml_search_emoji(hdml, &textval[ii], &out);
2932 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2936 if (is_sjis_kanji(textval[ii])) {
2937 one_byte[0] = textval[ii+0];
2938 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2939 one_byte[0] = textval[ii+1];
2940 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2944 if (textval[ii] != '\r' && textval[ii] != '\n') {
2945 one_byte[0] = textval[ii+0];
2946 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2949 memcpy(tmp, textval, strlen(textval)-1);
2951 s_hdml_tag_output_upper_half(hdml, child->parent);
2952 s_output_to_hdml_out(hdml, tdst);
2953 hdml->hdml_br_flag = 0;