OSDN Git Service

* move header files.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 15 Jun 2006 19:01:49 +0000 (19:01 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Thu, 15 Jun 2006 19:01:49 +0000 (19:01 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@683 1a406e8e-add9-4483-a2c8-d8cac5b7c224

27 files changed:
include/chxj_apply_convrule.h [new file with mode: 0644]
include/chxj_calc_ecc.h [new file with mode: 0644]
include/chxj_chtml10.h [new file with mode: 0644]
include/chxj_chtml20.h [new file with mode: 0644]
include/chxj_chtml30.h [new file with mode: 0644]
include/chxj_dump.h [new file with mode: 0644]
include/chxj_encoding.h [new file with mode: 0644]
include/chxj_hdml.h [new file with mode: 0644]
include/chxj_img_conv.h [new file with mode: 0644]
include/chxj_img_conv_format.h [new file with mode: 0644]
include/chxj_jhtml.h [new file with mode: 0644]
include/chxj_load_device_data.h [new file with mode: 0644]
include/chxj_load_emoji_data.h [new file with mode: 0644]
include/chxj_qr_code.h [new file with mode: 0644]
include/chxj_specified_device.h [new file with mode: 0644]
include/chxj_str_util.h [new file with mode: 0644]
include/chxj_tag_util.h [new file with mode: 0644]
include/chxj_xhtml_mobile_1_0.h [new file with mode: 0644]
include/mod_chxj.h [new file with mode: 0644]
include/qs_ignore_sp.h [new file with mode: 0644]
include/qs_log.h [new file with mode: 0644]
include/qs_malloc.h [new file with mode: 0644]
include/qs_parse_attr.h [new file with mode: 0644]
include/qs_parse_file.h [new file with mode: 0644]
include/qs_parse_string.h [new file with mode: 0644]
include/qs_parse_tag.h [new file with mode: 0644]
src/Makefile.am

diff --git a/include/chxj_apply_convrule.h b/include/chxj_apply_convrule.h
new file mode 100644 (file)
index 0000000..23141b0
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_APPLY_CONVRULE_H__
+#define __CHXJ_APPLY_CONVRULE_H__
+
+#include "mod_chxj.h"
+
+extern chxjconvrule_entry* chxj_apply_convrule(request_rec *r, apr_array_header_t *convrules);
+
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/include/chxj_calc_ecc.h b/include/chxj_calc_ecc.h
new file mode 100644 (file)
index 0000000..e8f8ff0
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_CALC_ECC_H__
+#define __CHXJ_CALC_ECC_H__
+#include "chxj_qr_code.h"
+
+int chxj_calc_ecc(qr_code_t* qrcode,
+              unsigned char* indata, 
+              unsigned char* dst);
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/include/chxj_chtml10.h b/include/chxj_chtml10.h
new file mode 100644 (file)
index 0000000..712b887
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_CHTM_1_0_H__
+#define __CHXJ_CHTM_1_0_H__
+
+/*#define DUMP_CHTML10 "" */
+#include "mod_chxj.h"
+
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _ctml10_t {
+    Doc*               doc;
+    char*              out;
+    int                out_len;
+
+    device_table_t*    spec;
+    mod_chxj_config*   conf;
+} chtml10_t;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char* chxj_exchange_chtml10( request_rec* r, device_table_t* spec, const char* src, apr_size_t srclen, apr_size_t *dstlen);
+#endif
diff --git a/include/chxj_chtml20.h b/include/chxj_chtml20.h
new file mode 100644 (file)
index 0000000..f04d39a
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_CHTM20_H__
+#define __CHXJ_CHTM20_H__
+
+/*#define DUMP_CHTML20 ""*/
+#include "mod_chxj.h"
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _ctml20_t {
+    Doc*               doc;
+    char*              out;
+    int                out_len;
+
+    device_table_t*    spec;
+    mod_chxj_config*   conf;
+} chtml20_t;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char*
+chxj_exchange_chtml20(
+                  request_rec* r,
+                  device_table_t* spec,
+                  const char* src,
+                  apr_size_t srclen,
+                  apr_size_t *dstlen);
+#endif
diff --git a/include/chxj_chtml30.h b/include/chxj_chtml30.h
new file mode 100644 (file)
index 0000000..c62681c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_CHTM30_H__
+#define __CHXJ_CHTM30_H__
+
+/* #define DUMP_CHTML30 "" */
+#include "mod_chxj.h"
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _chtml30_t {
+    Doc*               doc;
+    char*              out;
+    int                out_len;
+
+    device_table_t*    spec;
+    mod_chxj_config*   conf;
+} chtml30_t;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char*
+chxj_exchange_chtml30(
+  request_rec*    r,
+  device_table_t* spec,
+  const char*     src,
+  apr_size_t      srclen,
+  apr_size_t*     dstlen);
+#endif
diff --git a/include/chxj_dump.h b/include/chxj_dump.h
new file mode 100644 (file)
index 0000000..b5b8d9d
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_DUMP_H__
+#define __CHXJ_DUMP_H__
+void chxj_dump_out(const char* title, const char* s, int slen);
+#endif
diff --git a/include/chxj_encoding.h b/include/chxj_encoding.h
new file mode 100644 (file)
index 0000000..71e1953
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_ENCODING_H__
+#define __CHXJ_ENCODING_H__
+
+#include "mod_chxj.h"
+
+#define DEFAULT_SERVER_SIDE_ENCODING "NONE"
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+extern char* chxj_encoding(request_rec *r, const char* src, apr_size_t* len);
+#endif
+
diff --git a/include/chxj_hdml.h b/include/chxj_hdml.h
new file mode 100644 (file)
index 0000000..7f04c41
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_HDML_H__
+#define __CHXJ_HDML_H__
+
+/*============================================================================*/
+/* The maximum number of form is up to ten.                                   */
+/*============================================================================*/
+#define MAX_FORM_COUNT  (10)
+#define MAX_RADIO_COUNT (10)
+#define MAX_RADIO_VALUE_COUNT (100)
+#define MAX_SUBMIT_BUTTON_COUNT (10)
+#define END_LINE        "\0"
+
+#include "mod_chxj.h"
+
+/*============================================================================*/
+/* Structure for HDML                                                         */
+/*============================================================================*/
+typedef struct _hdml_t {
+  Doc*    doc;
+  char*   out;
+  int     center;
+  int     in_center;
+  char*   card;
+  int     card_cnt;
+  apr_time_t   form_cnt;
+
+  /*--------------------------------------------------------------------------*/
+  /* If the title tag is found, it becomes ``1''.                             */
+  /*--------------------------------------------------------------------------*/
+  int     found_title;
+  /*--------------------------------------------------------------------------*/
+  /* Counter of pure form tag                                                 */
+  /*--------------------------------------------------------------------------*/
+  int     pure_form_cnt;
+
+  int     var_cnt[MAX_FORM_COUNT];
+  char*   postdata[MAX_FORM_COUNT];
+  /*------------------------------*/
+  /* max <input type="radio"> tag */
+  /*------------------------------*/
+  char*   radio_value_list[MAX_RADIO_COUNT][MAX_RADIO_VALUE_COUNT];
+  char*   radio_name_list[MAX_RADIO_COUNT];
+  int     radio_out_cnt[MAX_RADIO_COUNT];
+  char*   radio_checked_value[MAX_RADIO_COUNT];
+  /*---------------------------------*/
+  /* for <input type="submit"> tag   */
+  /*---------------------------------*/
+  char*   submit_button[MAX_SUBMIT_BUTTON_COUNT];
+
+  /*---------------------------------*/
+  /* for <input type="checkbox"> tag */
+  /*---------------------------------*/
+  int     has_checkbox;
+
+  char*   form_tmp;
+  char*   init_vars;
+  int     out_len;
+  int     card_len;
+
+  /*------------------------------*/
+  /* Counter for variable of HDML */
+  /*------------------------------*/
+  int     qs_cnt;
+  int     option_flag;
+  int     div_right_flag;
+  int     div_center_flag;
+  int     div_in_center;
+  int     hdml_a_flag;
+  int     hdml_br_flag;
+
+  int     hdml_end_flag;
+
+  device_table_t* spec;
+
+  mod_chxj_config*  conf;
+} hdml_t;
+/*============================================================================*/
+/* Prototype declaration.                                                     */
+/*============================================================================*/
+char* chxj_exchange_hdml(request_rec* r, device_table_t* spec, const char* src, apr_size_t srclen, apr_size_t* dstlen) ;
+char* qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len);
+char* qs_conv_istyle_to_format(request_rec* r, char* is);
+
+#endif
diff --git a/include/chxj_img_conv.h b/include/chxj_img_conv.h
new file mode 100644 (file)
index 0000000..f895a2d
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_IMG_CONV_H__
+#define __CHXJ_IMG_CONV_H__
+#include "mod_chxj.h"
+
+char* chxj_img_conv(request_rec* r, device_table_t* spec, const char* s);
+#endif
diff --git a/include/chxj_img_conv_format.h b/include/chxj_img_conv_format.h
new file mode 100644 (file)
index 0000000..c660ec6
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_IMG_CONV_FORMAT_H__
+#define __CHXJ_IMG_CONV_FORMAT_H__
+
+
+#define DEFAULT_IMAGE_CACHE_DIR "/tmp"
+
+
+int chxj_img_conv_format_handler(request_rec* r);
+char* chxj_exchange_image(request_rec *r, const char** src, apr_size_t* len);
+int chxj_trans_name(request_rec *r);
+
+
+#endif
+/*
+ * vim:ts=4 et
+ */
diff --git a/include/chxj_jhtml.h b/include/chxj_jhtml.h
new file mode 100644 (file)
index 0000000..b15bd8a
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_JHTML_H__
+#define __CHXJ_JHTML_H__
+
+/* #define DUMP_JHTML "" */
+#include "mod_chxj.h"
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _jhtml_t {
+    Doc* doc;
+    char* out;
+    int   out_len;
+
+    device_table_t* spec;
+    mod_chxj_config* conf;
+} jhtml_t;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char*
+chxj_exchange_jhtml(
+  request_rec* r,
+  device_table_t* spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen);
+#endif
diff --git a/include/chxj_load_device_data.h b/include/chxj_load_device_data.h
new file mode 100644 (file)
index 0000000..e19e555
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __LOAD_DEVICE_DATA_H__
+#define __LOAD_DEVICE_DATA_H__
+#include "mod_chxj.h"
+
+void chxj_load_device_data(Doc* doc, apr_pool_t *p, mod_chxj_config* conf);
+
+#endif
diff --git a/include/chxj_load_emoji_data.h b/include/chxj_load_emoji_data.h
new file mode 100644 (file)
index 0000000..2439bcd
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __LOAD_EMOJI_DATA_H__
+#define __LOAD_EMOJI_DATA_H__
+
+#define ESCAPE_CHAR_LT "&lt;"
+#define ESCAPE_CHAR_GT "&gt;"
+
+
+char* chxj_load_emoji_data( Doc* doc, apr_pool_t *p, mod_chxj_config* conf);
+
+#endif
diff --git a/include/chxj_qr_code.h b/include/chxj_qr_code.h
new file mode 100644 (file)
index 0000000..b8343f8
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_QR_CODE_H__
+#define __CHXJ_QR_CODE_H__
+
+#include "httpd.h"
+#include "qs_parse_string.h"
+
+typedef enum _qr_ver_t {
+  QR_VER_1=0,
+  QR_VER_2,
+  QR_VER_3,
+  QR_VER_4,
+  QR_VER_5,
+  QR_VER_6,
+  QR_VER_7,
+  QR_VER_8,
+  QR_VER_9,
+  QR_VER_10,
+  QR_VER_11,
+  QR_VER_12,
+  QR_VER_13,
+  QR_VER_14,
+  QR_VER_15,
+  QR_VER_16,
+  QR_VER_17,
+  QR_VER_18,
+  QR_VER_19,
+  QR_VER_20,
+  QR_VER_21,
+  QR_VER_22,
+  QR_VER_23,
+  QR_VER_24,
+  QR_VER_25,
+  QR_VER_26,
+  QR_VER_27,
+  QR_VER_28,
+  QR_VER_29,
+  QR_VER_30,
+  QR_VER_31,
+  QR_VER_32,
+  QR_VER_33,
+  QR_VER_34,
+  QR_VER_35,
+  QR_VER_36,
+  QR_VER_37,
+  QR_VER_38,
+  QR_VER_39,
+  QR_VER_40,
+} qr_ver_t;
+
+typedef enum _qr_level_t {
+  QR_LEVEL_L=0,
+  QR_LEVEL_M,
+  QR_LEVEL_Q,
+  QR_LEVEL_H,
+} qr_level_t;
+
+/*----------------------------------------------------------------------------*/
+/* Â¥Ã¢Â¡Â¼Â¥Ã‰                                                                     */
+/*----------------------------------------------------------------------------*/
+typedef enum _qr_mode_t {
+  QR_NUM_MODE = 0,
+  QR_ALPHA_MODE,
+  QR_8BIT_MODE,
+  QR_KANJI_MODE,
+  QR_ECI_MODE,
+  QR_FNC1_1_MODE,
+  QR_FNC1_2_MODE,
+  QR_STR_CAT_MODE,
+  QR_END_PTN_MODE,
+  QR_RSV1_MODE,
+  QR_RSV2_MODE,
+  QR_RSV3_MODE,
+  QR_RSV4_MODE,
+  QR_RSV5_MODE,
+  QR_RSV6_MODE,
+  QR_RSV7_MODE,
+} qr_mode_t;
+
+typedef enum _qr_code_found_t {
+  QR_NOT_FOUND = 0,
+  QR_FOUND,
+} qr_code_found_t;
+
+typedef enum _qr_mode_change_t {
+  QR_NOT_CHANGE = 0,
+  QR_CHANGE,
+} qr_mode_change_t;
+
+typedef struct _qr_code_t {
+  qr_code_found_t found;
+  qr_mode_change_t mode_change;
+
+  qr_ver_t     version;
+  qr_level_t   level;
+  qr_mode_t    mode;
+  request_rec* r;
+  Doc*         doc;
+  int          size;
+  char*        indata;
+} qr_code_t;
+
+int     chxj_qr_code_handler            (request_rec* r);
+int     chxj_qrcode_create_image_data   (qr_code_t* qrcode, char** img, size_t* img_len);
+void    chxj_qrcode_node_to_qrcode      (qr_code_t* qrcode, Node* root);
+char*   chxj_qr_code_blob_handler       (request_rec* r, const char* indata, size_t* len);
+
+#endif
diff --git a/include/chxj_specified_device.h b/include/chxj_specified_device.h
new file mode 100644 (file)
index 0000000..5f0bb53
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_SPECIFIED_DEVICE_H__
+#define __CHXJ_SPECIFIED_DEVICE_H__
+
+typedef enum _spec_type_t {
+  CHXJ_SPEC_UNKNOWN=0,
+  CHXJ_SPEC_Chtml_1_0,
+  CHXJ_SPEC_Chtml_2_0,
+  CHXJ_SPEC_Chtml_3_0,
+  CHXJ_SPEC_Chtml_4_0,
+  CHXJ_SPEC_Chtml_5_0,
+  CHXJ_SPEC_XHtml_Mobile_1_0,
+  CHXJ_SPEC_Hdml,
+  CHXJ_SPEC_Jhtml,
+  CHXJ_SPEC_HTML,
+} spec_type_t;
+
+#define CHXJ_PIC_OK                (0x01)
+#define CHXJ_PIC_NG                (0x00)
+
+
+typedef struct device_table_t {
+  struct device_table_t* next;
+  const char* device_id;
+  const char* device_name;
+  spec_type_t html_spec_type;
+  int width;
+  int heigh;
+  /*--------------------------------------------------------------------------*/
+  /* Walll Paper Size                                                         */
+  /*--------------------------------------------------------------------------*/
+  int wp_width;
+  int wp_heigh;
+  /*--------------------------------------------------------------------------*/
+  /* Cache Size                                                               */
+  /*--------------------------------------------------------------------------*/
+  int cache;
+  /*--------------------------------------------------------------------------*/
+  /* Correspondence image format                                              */
+  /* 1: It is possible to display it.                                         */
+  /* 0: It is not possible to display it.                                     */
+  /*--------------------------------------------------------------------------*/
+  int available_gif;
+  int available_jpeg;
+  int available_png;
+  int available_bmp2;
+  int available_bmp4;
+  /*--------------------------------------------------------------------------*/
+  /* Resolution                                                               */
+  /*--------------------------------------------------------------------------*/
+  int dpi_width;
+  int dpi_heigh;
+  /*--------------------------------------------------------------------------*/
+  /* Color number type                                                        */
+  /* 2       : 2        Colors                                                */
+  /* 4       : 4        Colors                                                */
+  /* 256     : 256      Colors                                                */
+  /* 4096    : 4096     Colors                                                */
+  /* 65536   : 65536    Colors                                                */
+  /* 262144  : 262144   Colors                                                */
+  /* 15680000: 15680000 over colors                                           */
+  /*--------------------------------------------------------------------------*/
+  int color;
+  char* emoji_type;
+} device_table_t;
+
+typedef struct device_table_list_t {
+  struct device_table_list_t* next;
+  char* pattern;
+  device_table_t* table;
+  device_table_t* tail;
+} device_table_list_t;
+
+device_table_t* chxj_specified_device(request_rec* r, const char* user_agent);
+
+#endif
diff --git a/include/chxj_str_util.h b/include/chxj_str_util.h
new file mode 100644 (file)
index 0000000..17e6201
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_STR_UTIL_H__
+#define __CHXJ_STR_UTIL_H__
+
+#include <string.h>
+
+int chxj_chk_numeric(const char* s);
+int chxj_atoi(const char* s);
+
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/include/chxj_tag_util.h b/include/chxj_tag_util.h
new file mode 100644 (file)
index 0000000..849a3b7
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_TAG_UTIL_H__
+#define __CHXJ_TAG_UTIL_H__
+
+#include "mod_chxj.h"
+
+/*----------------------------------------------------------------------------*/
+/* prototype declare                                                          */
+/*----------------------------------------------------------------------------*/
+char*    qs_get_value_attr     (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_checked_attr   (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_type_attr      (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_name_attr      (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_istyle_attr    (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_maxlength_attr (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_size_attr      (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_accesskey_attr (Doc* doc, Node* tag, request_rec* r);
+
+int      qs_is_checked_checkbox_attr(Doc* doc, Node* tag, request_rec* r);
+
+char*    qs_get_selected_value_text(Doc *doc, Node* node, request_rec* r);
+char*    qs_get_selected_value(Doc* doc, Node* node, request_rec* r);
+
+char*    qs_alloc_zero_byte_string(request_rec* r);
+char*    qs_trim_string(request_rec* r, char* s);
+
+int chxj_chxjif_is_mine(device_table_t* spec, Doc* doc, Node* tag);
+char* qs_get_destlang_attr(Doc* doc, Node* tag, request_rec* r);
+char* qs_get_parse_attr(Doc* doc, Node* tag, request_rec* r);
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/include/chxj_xhtml_mobile_1_0.h b/include/chxj_xhtml_mobile_1_0.h
new file mode 100644 (file)
index 0000000..725c9fb
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_XHTML_MOBILE_1_0_H__
+#define __CHXJ_XHTML_MOBILE_1_0_H__
+
+#include "mod_chxj.h"
+
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _xhtml_t {
+    Doc*               doc;
+    char*              out;
+    int                out_len;
+
+    device_table_t*    spec;
+    mod_chxj_config*   conf;
+} xhtml_t;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char* chxj_exchange_xhtml_mobile_1_0(request_rec* r, device_table_t* spec, const char* src, apr_size_t srclen, apr_size_t *dstlen);
+
+#endif
diff --git a/include/mod_chxj.h b/include/mod_chxj.h
new file mode 100644 (file)
index 0000000..6e72658
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __MOD_CHXJ_H__
+#define __MOD_CHXJ_H__
+
+
+#include <string.h>
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_protocol.h"
+#include "http_request.h"
+#include "http_log.h"
+#include "ap_config.h"
+#include "apr_strings.h"
+#include "apr_buckets.h"
+#include "apr_lib.h"
+#include "apr_tables.h"
+#include "apr_dso.h"
+#include "apr_general.h"
+#include "apr_pools.h"
+#include "util_filter.h"
+
+#include "qs_ignore_sp.h"
+#include "qs_log.h"
+#include "qs_malloc.h"
+#include "qs_parse_attr.h"
+#include "qs_parse_file.h"
+#include "qs_parse_string.h"
+#include "qs_parse_tag.h"
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+
+#include "config.h"
+#endif
+#ifdef HAVE_AP_REGEX_H
+#  include "ap_regex.h"
+#else
+#  include "pcreposix.h"
+#  include "pcre.h"
+#  if !defined(AP_REG_ASSERT)
+#    define AP_REG_ASSERT   REG_ASSERT
+#  endif
+#  if !defined(AP_REG_BADBR)
+#    define AP_REG_BADBR    REG_BADBR
+#  endif
+#  if !defined(AP_REG_BADPAT)
+#    define AP_REG_BADPAT   REG_BADPAT
+#  endif
+#  if !defined(AP_REG_BADRPT)
+#    define AP_REG_BADRPT   REG_BADRPT
+#  endif
+#  if !defined(AP_REG_EBRACE)
+#    define AP_REG_EBRACE   REG_EBRACE
+#  endif
+#  if !defined(AP_REG_EBRACK)
+#    define AP_REG_EBRACK   REG_EBRACK
+#  endif
+#  if !defined(AP_REG_ECOLLATE)
+#    define AP_REG_ECOLLATE REG_ECOLLATE
+#  endif
+#  if !defined(AP_REG_ECTYPE)
+#    define AP_REG_ECTYPE   REG_ECTYPE
+#  endif
+#  if !defined(AP_REG_EESCAPE)
+#    define AP_REG_EESCAPE  REG_EESCAPE
+#  endif
+#  if !defined(AP_REG_EMPTY)
+#    define AP_REG_EMPTY    REG_EMPTY
+#  endif
+#  if !defined(AP_REG_EPAREN)
+#    define AP_REG_EPAREN   REG_EPAREN
+#  endif
+#  if !defined(AP_REG_ERANGE)
+#    define AP_REG_ERANGE   REG_ERANGE
+#  endif
+#  if !defined(AP_REG_ESIZE)
+#    define AP_REG_ESIZE    REG_ESIZE
+#  endif
+#  if !defined(AP_REG_ESPACE)
+#    define AP_REG_ESPACE   REG_ESPACE
+#  endif
+#  if !defined(AP_REG_ESUBREG)
+#    define AP_REG_ESUBREG  REG_ESUBREG
+#  endif
+#  if !defined(AP_REG_INVARG)
+#    define AP_REG_INVARG   REG_INVARG
+#  endif
+#  if !defined(AP_REG_NOMATCH)
+#    define AP_REG_NOMATCH  REG_NOMATCH
+#  endif
+
+#  if !defined(AP_REG_ICASE)
+#    define AP_REG_ICASE    REG_ICASE
+#  endif
+#  if !defined(AP_REG_NEWLINE)
+#    define AP_REG_NEWLINE  REG_NEWLINE
+#  endif
+#  if !defined(AP_REG_NOTBOL)
+#    define AP_REG_NOTBOL   REG_NOTBOL
+#  endif
+#  if !defined(AP_REG_NOTEOL)
+#    define AP_REG_NOTEOL   REG_NOTEOL
+#  endif
+
+#  if !defined(AP_REG_EXTENDED)
+#    define AP_REG_EXTENDED REG_EXTENDED
+#  endif
+#  if !defined(AP_REG_NOSUB)
+#    define AP_REG_NOSUB    REG_NOSUB
+#  endif
+
+#  define ap_regex_t      regex_t
+#  define ap_regmatch_t   regmatch_t
+#endif
+
+
+#include "chxj_specified_device.h"
+
+
+#ifdef HAVE_APR_GLOBAL_MUTEX_H
+#  include "apr_global_mutex.h"
+#endif
+
+#ifdef HAVE_APR_SHM_H
+#  include "apr_shm.h"
+#endif
+
+
+typedef struct _imode_emoji_t {
+  char  hex1byte;
+  char  hex2byte;
+  char* string;
+  char *description;
+} imode_emoji_t;
+
+typedef struct _ezweb_emoji_t {
+  char* typeA;
+  char* typeB;
+  char* typeC;
+  char* typeD;
+} ezweb_emoji_t;
+
+typedef struct _jphone_emoji_t {
+  char* string;
+} jphone_emoji_t;
+
+typedef struct _emoji_t {
+  struct _emoji_t* next;
+  int no;
+  imode_emoji_t* imode;
+  ezweb_emoji_t* ezweb;
+  jphone_emoji_t* jphone;
+} emoji_t;
+
+typedef struct {
+  int                   image;
+
+  char*                 device_data_file;
+  char*                 emoji_data_file;
+
+  char*                 image_cache_dir;
+  char*                 image_copyright;
+  device_table_list_t*  devices;
+  emoji_t*              emoji;
+  emoji_t*              emoji_tail;
+  char*                 server_side_encoding;
+
+  char*                 dir; /* for LOG */
+
+} mod_chxj_config;
+
+typedef struct {
+  char       *pattern;
+  ap_regex_t *regexp;
+  int        flags;
+  int        action;
+  char       *encoding;
+} chxjconvrule_entry;
+
+#define CONVRULE_ENGINE_ON_BIT        (0x00000001)
+#define CONVRULE_ENGINE_OFF_BIT       (0x00000002)
+
+#define CONVRULE_ENGINE_ON_CMD        "EngineOn"
+#define CONVRULE_ENGINE_OFF_CMD       "EngineOff"
+
+#define CONVRULE_FLAG_NOTMATCH        (0x00000001)
+
+typedef struct {
+  apr_shm_t*          client_shm;
+  apr_global_mutex_t* client_lock;
+  char                client_lock_file_name[256];
+  apr_array_header_t *convrules;
+} mod_chxj_global_config;
+
+typedef struct {
+  unsigned int len;
+
+  apr_bucket_brigade *bb;
+
+  char* buffer;
+} mod_chxj_ctx;
+
+#include "chxj_tag_util.h"
+
+#define CHXJ_MOD_CONFIG_KEY   "chxj_module"
+
+#define HTTP_USER_AGENT       "User-Agent"
+
+module AP_MODULE_DECLARE_DATA chxj_module;
+
+#define CHXJ_IMG_ON     (1)
+#define CHXJ_IMG_OFF    (0)
+
+#define DBG(X,Y)  ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y))
+#define DBG1(X,Y,Za)  ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za))
+#define DBG2(X,Y,Za,Zb)  ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0,(X),(Y),(Za),(Zb))
+#define ERR(X,Y)  ap_log_rerror(APLOG_MARK,APLOG_ERR,0,(X),(Y))
+#define ERR1(X,Y,Za)  ap_log_rerror(APLOG_MARK,APLOG_ERR,0,(X),(Y),(Za))
+
+
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/include/qs_ignore_sp.h b/include/qs_ignore_sp.h
new file mode 100644 (file)
index 0000000..648e6e3
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_IGNORE_SP_H__
+#define __QS_IGNORE_SP_H__
+#include "qs_parse_string.h"
+
+int qs_ignore_sp(Doc* doc, const char*, int);
+int qs_ignore_sp_and_quote(Doc* doc, const char* s, int len) ;
+
+#endif
diff --git a/include/qs_log.h b/include/qs_log.h
new file mode 100644 (file)
index 0000000..b1d9bab
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_LOG_H__
+#define __QS_LOG_H__
+#include "qs_parse_string.h"
+
+#define QX_LOGMARK   __FILE__,__LINE__
+#define QX_LOG_DEBUG (0)
+#define QX_LOG_INFO  (1)
+#define QX_LOG_WARN  (2)
+#define QX_LOG_ERROR (3)
+#define QX_LOG_FATAL (4)
+
+
+#define QX_LOGGER_DEBUG(c)  qs_log(doc,QX_LOG_DEBUG,QX_LOGMARK,(c))
+#define QX_LOGGER_INFO(c)   qs_log(doc,QX_LOG_INFO,QX_LOGMARK, (c))
+#define QX_LOGGER_WARN(c)   qs_log(doc,QX_LOG_WARN,QX_LOGMARK, (c))
+#define QX_LOGGER_ERROR(c)  qs_log(doc,QX_LOG_ERROR,QX_LOGMARK, (c))
+#define QX_LOGGER_FATAL(c)  qs_log(doc,QX_LOG_FATAL,QX_LOGMARK,(c))
+#define QX_LOGGER_DEBUG_INT(x,y)  qs_log_int(doc,QX_LOG_DEBUG,QX_LOGMARK,(x),(y))
+
+void qs_log(Doc* doc, int log_level,const char* f, int l, char* msg);
+void qs_log_int(Doc* doc, int log_level,const char* f, int l, char* msg, int val);
+#endif
diff --git a/include/qs_malloc.h b/include/qs_malloc.h
new file mode 100644 (file)
index 0000000..e74032a
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_MALLOC_H__
+#define __QS_MALLOC_H__
+#include "qs_parse_string.h"
+
+void qs_init_malloc(Doc* doc);
+void qs_all_free(Doc* doc, const char* fname, int line);
+#endif
diff --git a/include/qs_parse_attr.h b/include/qs_parse_attr.h
new file mode 100644 (file)
index 0000000..a19ad12
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_ATTR_H__
+#define __QS_PARSE_ATTR_H__
+#include "qs_parse_string.h"
+
+Attr* qs_parse_attr(Doc* doc, const char*s, int len, int* newpos);
+Attr* qs_new_attr(Doc* doc);
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/include/qs_parse_file.h b/include/qs_parse_file.h
new file mode 100644 (file)
index 0000000..7575f41
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_FILE_H__
+#define __QS_PARSE_FILE_H__
+#include "qs_parse_string.h"
+
+/*
+ * Prototype Declare
+ */
+Node* qs_parse_file(Doc* doc, const char* filename) ;
+#endif
diff --git a/include/qs_parse_string.h b/include/qs_parse_string.h
new file mode 100644 (file)
index 0000000..bdc1070
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_STRING_H__
+#define __QS_PARSE_STRING_H__
+#include <httpd.h>
+/*
+#define DEBUG
+#define USE_LOG
+*/
+/**
+ * Max of memory allocation times.
+ */
+#define QX_ALLOC_MAX   (100*1024)
+
+/**
+ * It is judged whether it is the first byte of Japanese Shift_JIS "ZENKAKU KANJI". 
+ */
+#define is_sjis_kanji(c)  ((0x81 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0x9f)  \
+                          || (0xe0 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xfc))
+/**
+ * It is judged whether it is a byte of Japanese Shift_JIS "HANKAKU KANA". 
+ */
+#define is_sjis_kana(c)   ((0xa1 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xdf))
+
+/**
+ * It is judged whether it is a Japanese code part of EUC. 
+ */
+#define is_euc_kanji(c)   (0xa1 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xfe)
+
+/**
+ * It is judged whether it is a Japanese code part of EUC "KANA". 
+ */
+#define is_euc_kana(c)    (0x8e == (unsigned char)(c&0xff))
+
+/**
+ * True is returned for whitespace. 
+ */
+#define is_white_space(c)     (' ' == (unsigned char)(c&0xff)  \
+                           || '\t' == (unsigned char)(c&0xff) \
+                           || '\n' == (unsigned char)(c&0xff) \
+                           || '\r' == (unsigned char)(c&0xff))
+
+/**
+ * True is returned for the quotation mark. 
+ */
+#define is_quote(c)       ('\'' == (unsigned char)(c&0xff) \
+                         ||'"'  == (unsigned char)(c&0xff))
+
+/**
+ * It is judged whether the tag of the object has the child element. 
+ * The "<option>" tag has the child. Please write </ option >. 
+ */
+#define has_child(c)       ((strcasecmp(c, "base"     ) != 0) \
+                        &&  (strcasecmp(c, "meta"     ) != 0) \
+                        &&  (strcasecmp(c, "br"       ) != 0) \
+                        &&  (strcasecmp(c, "dt"       ) != 0) \
+                        &&  (strcasecmp(c, "dd"       ) != 0) \
+                        &&  (strcasecmp(c, "hr"       ) != 0) \
+                        &&  (strcasecmp(c, "img"      ) != 0) \
+                        &&  (strcasecmp(c, "input"    ) != 0) \
+                        &&  (strcasecmp(c, "p"        ) != 0) \
+                        &&  (strcasecmp(c, "plaintext") != 0) \
+                        &&  (strcasecmp(c, "?xml"     ) != 0) \
+                        &&  (strcasecmp(c, "!doctype" ) != 0) \
+                        &&  (strcasecmp(c, "link"     ) != 0) \
+                        &&  (strcasecmp(c, "!--"      ) != 0))
+
+/**
+ * It is judged whether the tag of the object has the child element. 
+ * The "<option>" tag has the child. Please write </ option >. 
+ */
+#define has_child_hdml(c)  ((strcasecmp(c, "center"     ) != 0) \
+                        &&  (strcasecmp(c, "br"         ) != 0) \
+                        &&  (strcasecmp(c, "action"     ) != 0) \
+                        &&  (strcasecmp(c, "!--"      ) != 0))
+
+/**
+ * The structure of the attribute is defined.
+ */
+typedef struct _attr {
+  struct _attr* next;
+  struct _node* parent;
+  char *name;
+  char *value;
+} Attr;
+
+/**
+ * The structure of the element is defined. 
+ */
+typedef struct _node {
+  struct _node* next;
+  struct _node* parent;
+  struct _node* child;
+  struct _node* child_tail;
+  struct _attr* attr;
+  struct _attr* attr_tail;
+  char* name;
+  char* value;
+  int   size;
+  char* otext;
+} Node;
+
+typedef struct pointer_table_t {
+  unsigned int address;
+  unsigned long size;
+  struct pointer_table_t* next;
+  struct pointer_table_t* prev;
+} Pointer_Table;
+
+
+typedef enum chxj_parse_mode_t {
+  PARSE_MODE_CHTML=0,
+  PARSE_MODE_NO_PARSE,
+} ParseMode_t;
+
+typedef struct _doc {
+  Node*         now_parent_node;
+  Node*         root_node;
+
+  int           do_init_flag;
+  unsigned long alloc_size;
+
+  Pointer_Table* pointer_table;
+  Pointer_Table* free_list_head;
+  Pointer_Table* free_list_tail;
+  Pointer_Table* allocated_list_head;
+  Pointer_Table* allocated_list_tail;
+
+  ParseMode_t    parse_mode;
+
+  apr_allocator_t* allocator;
+  apr_pool_t*      pool;
+
+#ifndef __NON_MOD_CHXJ__
+  request_rec* r;
+#endif
+} Doc;
+
+/*
+ * Prototype Declare
+ */
+Node* qs_init_root_node(Doc* doc);
+void qs_add_child_node(Doc* doc, Node*);
+void qs_free_node(Doc* doc, Node*);
+Node* qs_get_root(Doc* doc) ;
+Node* qs_parse_string(Doc* doc, const char* ss, int len);
+char* qs_get_node_value(Doc* doc,Node* node);
+char* qs_get_node_name(Doc* doc, Node* node) ;
+int qs_get_node_size(Doc* doc, Node* node) ;
+Node* qs_get_child_node(Doc* doc, Node* node) ;
+Node* qs_get_next_node(Doc* doc, Node* node) ;
+Attr* qs_get_attr(Doc* doc, Node* node) ;
+Attr* qs_get_next_attr(Doc* doc, Attr* attr) ;
+char* qs_get_attr_name(Doc* doc, Attr* attr) ;
+char* qs_get_attr_value(Doc* doc, Attr* attr) ;
+#endif
diff --git a/include/qs_parse_tag.h b/include/qs_parse_tag.h
new file mode 100644 (file)
index 0000000..f124c1d
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_TAG_H__
+#define __QS_PARSE_TAG_H__
+#include "qs_parse_string.h"
+
+Node* qs_parse_tag(Doc* doc, const char* s, int len) ;
+Node* qs_new_tag(Doc* doc);
+Node* qs_add_attr(Doc* doc, Node* node, Attr* attr);
+#endif
+/*
+ * vim:ts=2 et
+ */
+
index 2e6c231..fa01803 100644 (file)
@@ -28,8 +28,8 @@ libmod_chxj_la_SOURCES = mod_chxj.c \
     chxj_encoding.c
 
 
-libmod_chxj_la_CFLAGS = -Wall -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I@with_apache_header@ 
-CFLAGS = @CFLAGS@ -Wall -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I@with_apache_header@ 
+libmod_chxj_la_CFLAGS = -Wall -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@ 
+CFLAGS = @CFLAGS@ -Wall -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I../include -I@with_apache_header@ 
 
 lib_LTLIBRARIES = libmod_chxj.la