#include "chxj_img_conv.h"
#include "chxj_qr_code.h"
#include "chxj_encoding.h"
-
-#define BUFFERED 1
+#include "chxj_buffered_write.h"
#define GET_CHTML20(X) ((chtml20_t*)(X))
#define W_L(X) do { chtml20->out = BUFFERED_WRITE_LITERAL(chtml20->out, &doc->buf, (X)); } while(0)
/*--------------------------------------------------------------------------*/
/* start HTML tag */
/*--------------------------------------------------------------------------*/
-#if BUFFERED
W_L("<html>\n");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<html>\n", NULL);
-#endif
return chtml20->out;
}
doc = chtml20->doc;
r = doc->r;
-#if BUFFERED
W_L("</html>\n");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</html>\n", NULL);
-#endif
-
return chtml20->out;
}
content_type_flag = 0;
refresh_flag = 0;
-#if BUFFERED
W_L("<meta");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<meta", NULL);
-#endif
-
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* CHTML 2.0 */
/*----------------------------------------------------------------------*/
-#if BUFFERED
W_L(" http-equiv=\"");
W_V(value);
W_L("\"");
-#else
- chtml20->out = apr_pstrcat(r->pool,
- chtml20->out,
- " http-equiv=\"",
- value,
- "\"",
- NULL);
-#endif
-
if (STRCASEEQ('c','C',"content-type",value)) {
content_type_flag = 1;
}
if (strcasecmp(name, "content") == 0) {
if (content_type_flag) {
if (IS_SJIS_STRING(GET_SPEC_CHARSET(chtml20->spec))) {
-#if BUFFERED
W_L(" ");
W_V(name);
W_L("=\"");
W_L("text/html; charset=Windows-31J");
W_L("\"");
-#else
- chtml20->out = apr_pstrcat(r->pool,
- chtml20->out,
- " ",
- name,
- "=\"",
- "text/html; charset=Windows-31J",
- "\"",
- NULL);
-#endif
}
else {
-#if BUFFERED
W_L(" ");
W_V(name);
W_L("=\"");
W_L("text/html; charset=UTF-8");
-#else
- chtml20->out = apr_pstrcat(r->pool,
- chtml20->out,
- " ",
- name,
- "=\"",
- "text/html; charset=UTF-8",
- "\"",
- NULL);
-#endif
}
}
else if (refresh_flag) {
url++;
url = chxj_encoding_parameter(r, url);
url = chxj_add_cookie_parameter(r, url, chtml20->cookie);
-#if BUFFERED
W_L(" ");
W_V(name);
W_L("=\"");
W_L(";");
W_V(url);
W_L("\"");
-#else
- chtml20->out = apr_pstrcat(r->pool,
- chtml20->out,
- " ",
- name,
- "=\"",
- sec,
- ";",
- url,
- "\"",
- NULL);
-#endif
}
}
else {
-#if BUFFERED
W_L(" ");
W_V(name);
W_L("=\"");
W_V(value);
-#else
- chtml20->out = apr_pstrcat(r->pool,
- chtml20->out,
- " ",
- name,
- "=\"",
- value,
- "\"",
- NULL);
-#endif
}
}
break;
break;
}
}
-
-#if BUFFERED
W_L(">");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
-#endif
-
return chtml20->out;
}
doc = chtml20->doc;
r = doc->r;
-#if BUFFERED
W_L("<head>\r\n");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<head>\r\n", NULL);
-#endif
-
return chtml20->out;
}
doc = chtml20->doc;
r = doc->r;
-#if BUFFERED
W_L("</head>\r\n");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</head>\r\n", NULL);
-#endif
-
return chtml20->out;
}
doc = chtml20->doc;
r = doc->r;
-#if BUFFERED
W_L("<title>");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<title>", NULL);
-#endif
-
return chtml20->out;
}
doc = chtml20->doc;
r = doc->r;
-#if BUFFERED
W_L("</title>\r\n");
-#else
- chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</title>\r\n", NULL);
-#endif
-
return chtml20->out;
}
#include "chxj_img_conv.h"
#include "chxj_qr_code.h"
#include "chxj_encoding.h"
+#include "chxj_buffered_write.h"
+#define BUFFERED 1
#define GET_CHTML30(X) ((chtml30_t *)(X))
+#define W_L(X) do { chtml30->out = BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, (X)); } while(0)
+#define W_V(X) do { chtml30->out = (X) ? BUFFERED_WRITE_VALUE(chtml30->out, &doc->buf, (X)) \
+ : BUFFERED_WRITE_LITERAL(chtml30->out, &doc->buf, ""); } while(0)
static char *s_chtml30_start_html_tag (void *pdoc, Node *node);
static char *s_chtml30_end_html_tag (void *pdoc, Node *node);