OSDN Git Service

*** empty log message ***
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 21 Jun 2006 11:47:30 +0000 (11:47 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 21 Jun 2006 11:47:30 +0000 (11:47 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@1091 1a406e8e-add9-4483-a2c8-d8cac5b7c224

include/mod_chxj.h
src/chxj_chtml10.c

index 545c8f0..7f671c7 100644 (file)
@@ -194,6 +194,39 @@ typedef struct {
   tag_handler* handler;
 } tag_handlers;
 
+typedef enum {
+  tagHTML = 0,
+  tagMETA,  
+  tagTEXTAREA,
+  tagP,
+  tagPRE,
+  tagUL,
+  tagLI,
+  tagOL,
+  tagH1,
+  tagH2,
+  tagH3,
+  tagH4,
+  tagH5,
+  tagH6,
+  tagHEAD,
+  tagTITLE,
+  tagBASE,
+  tagBODY,
+  tagA,
+  tagBR,
+  tagTR,
+  tagFONT,
+  tagFORM,
+  tagINPUT,
+  tagCENTER,
+  tagHR,
+  tagIMG,
+  tagSELECT,
+  tagOPTION,
+  tagDIV,
+  tagCHXJIF,  
+} tag_type;
 
 typedef struct {
   int                   image;
index 20d65b2..908e101 100644 (file)
@@ -20,6 +20,8 @@
 #include "chxj_img_conv.h"
 #include "chxj_qr_code.h"
 
+#define GET_CHTML10(X) ((chtml10_t*)(X))
+
 static char* s_chtml10_node_exchange    (chtml10_t* chtml, Node* node, int indent);
 
 static char* s_chtml10_start_html_tag     (void* pdoc, Node* node);
@@ -30,9 +32,9 @@ static char* s_chtml10_start_textarea_tag (void* pdoc, Node* node);
 static char* s_chtml10_end_textarea_tag   (void* pdoc, Node* node);
 static char* s_chtml10_start_p_tag        (void* pdoc, Node* node);
 static char* s_chtml10_end_p_tag          (void* pdoc, Node* node);
+static char* s_chtml10_start_pre_tag      (void* pdoc, Node* node);
+static char* s_chtml10_end_pre_tag        (void* pdoc, Node* node);
 
-static char* s_chtml10_start_pre_tag    (chtml10_t* chtml, Node* node);
-static char* s_chtml10_end_pre_tag      (chtml10_t* chtml, Node* node);
 static char* s_chtml10_start_ul_tag     (chtml10_t* chtml, Node* node);
 static char* s_chtml10_end_ul_tag       (chtml10_t* chtml, Node* node);
 static char* s_chtml10_start_li_tag     (chtml10_t* chtml, Node* node);
@@ -88,26 +90,64 @@ static int   s_chtml10_search_emoji(chtml10_t* chtml, char* txt, char** rslt);
 static void  s_chtml10_chxjif_tag(chtml10_t* chtml, Node* node);
 
 tag_handler chtml10_handler[] = {
+  /* tagHTML */
   {
     "html",
     s_chtml10_start_html_tag,
     s_chtml10_end_html_tag,
   },
+  /* tagMETA */
   {
     "meta",
     s_chtml10_start_meta_tag,
     s_chtml10_end_meta_tag,
   },
+  /* tagTEXTAREA */
   {
     "textarea",
     s_chtml10_start_textarea_tag,
     s_chtml10_end_textarea_tag,
   },
+  /* tagP */
   {
     "p",
     s_chtml10_start_p_tag,
     s_chtml10_end_p_tag,
   },
+  /* tagPRE */
+  {
+    "pre",
+    s_chtml10_start_pre_tag,
+    s_chtml10_end_pre_tag,
+  },
+#if 0
+  tagUL,
+  tagLI,
+  tagOL,
+  tagH1,
+  tagH2,
+  tagH3,
+  tagH4,
+  tagH5,
+  tagH6,
+  tagHEAD,
+  tagTITLE,
+  tagBASE,
+  tagBODY,
+  tagA,
+  tagBR,
+  tagTR,
+  tagFONT,
+  tagFORM,
+  tagINPUT,
+  tagCENTER,
+  tagHR,
+  tagIMG,
+  tagSELECT,
+  tagOPTION,
+  tagDIV,
+  tagCHXJIF,  
+#endif
 };
 
 
@@ -714,9 +754,9 @@ s_chtml10_start_html_tag(void* pdoc, Node* node)
   request_rec*  r;
   chtml10_t*    chtml10;
 
-  chtml10 = (chtml10_t*)pdoc;
-  doc = chtml10->doc;
-  r   = doc->r;
+  chtml10 = GET_CHTML10(pdoc);
+  doc     = chtml10->doc;
+  r       = doc->r;
 
   /*--------------------------------------------------------------------------*/
   /* start HTML tag                                                           */
@@ -742,7 +782,7 @@ s_chtml10_end_html_tag(void* pdoc, Node* child)
   chtml10_t*    chtml10;
 
   
-  chtml10 = (chtml10_t*)pdoc;
+  chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
@@ -764,7 +804,7 @@ s_chtml10_start_meta_tag(void* pdoc, Node* node)
 {
   chtml10_t* chtml10;
 
-  chtml10 = (chtml10_t*)pdoc;
+  chtml10 = GET_CHTML10(pdoc);
 
   /* ignore */
   return chtml10->out;
@@ -783,7 +823,7 @@ s_chtml10_end_meta_tag(void* pdoc, Node* child)
 {
   chtml10_t* chtml10;
 
-  chtml10 = (chtml10_t*)pdoc;
+  chtml10 = GET_CHTML10(pdoc);
 
   return chtml10->out;
 }
@@ -2241,16 +2281,21 @@ s_chtml10_chxjif_tag(chtml10_t* chtml10, Node* node)
 /**
  * It is a handler who processes the PRE tag.
  *
- * @param chtml10  [i/o] The pointer to the XHTML structure at the output
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
  *                     destination is specified.
  * @param node   [i]   The PRE tag node is specified.
  * @return The conversion result is returned.
  */
 static char*
-s_chtml10_start_pre_tag(chtml10_t* chtml10, Node* node) 
+s_chtml10_start_pre_tag(void* pdoc, Node* node) 
 {
-  Doc*          doc = chtml10->doc;
-  request_rec*  r   = doc->r;
+  Doc*          doc;
+  request_rec*  r;
+  chtml10_t*    chtml10;
+
+  chtml10 = GET_CHTML10(pdoc);
+  doc     = chtml10->doc;
+  r       = doc->r;
 
   chtml10->pre_flag++;
   chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<pre>", NULL);
@@ -2261,16 +2306,21 @@ s_chtml10_start_pre_tag(chtml10_t* chtml10, Node* node)
 /**
  * It is a handler who processes the PRE tag.
  *
- * @param chtml10  [i/o] The pointer to the XHTML structure at the output
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
  *                     destination is specified.
  * @param node   [i]   The PRE tag node is specified.
  * @return The conversion result is returned.
  */
 static char*
-s_chtml10_end_pre_tag(chtml10_t* chtml10, Node* child) 
+s_chtml10_end_pre_tag(void* pdoc, Node* child) 
 {
-  Doc*          doc = chtml10->doc;
-  request_rec*  r   = doc->r;
+  chtml10_t*    chtml10;
+  Doc*          doc;
+  request_rec*  r;
+
+  chtml10 = GET_CHTML10(pdoc);
+  doc     = chtml10->doc;
+  r       = doc->r;
 
   chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</pre>", NULL);
   chtml10->pre_flag--;
@@ -2293,7 +2343,7 @@ s_chtml10_start_p_tag(void* pdoc, Node* node)
   request_rec*  r;
   chtml10_t*    chtml10;
 
-  chtml10 = (chtml10_t*)pdoc;
+  chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
@@ -2317,7 +2367,7 @@ s_chtml10_end_p_tag(void* pdoc, Node* child)
   request_rec*  r;
   chtml10_t*    chtml10;
 
-  chtml10 = (chtml10_t*)pdoc;
+  chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
@@ -2342,7 +2392,7 @@ s_chtml10_start_textarea_tag(void* pdoc, Node* node)
   chtml10_t*    chtml10;
   Attr* attr;
 
-  chtml10 = (chtml10_t*)pdoc;
+  chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;
 
@@ -2390,7 +2440,7 @@ s_chtml10_end_textarea_tag(void* pdoc, Node* child)
   request_rec*  r;
   chtml10_t*    chtml10;
 
-  chtml10 = (chtml10_t*)pdoc;
+  chtml10 = GET_CHTML10(pdoc);
   doc     = chtml10->doc;
   r       = doc->r;