Annotation of embedaddon/php/ext/mbstring/libmbfl/mbfl/mbfilter.h, revision 1.1

1.1     ! misho       1: /* charset=UTF-8
        !             2:  * vim: encoding=utf-8:
        !             3:  * */
        !             4: 
        !             5: /*
        !             6:  * "streamable kanji code filter and converter"
        !             7:  *
        !             8:  * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
        !             9:  *
        !            10:  * This software is released under the GNU Lesser General Public License.
        !            11:  * (Version 2.1, February 1999)
        !            12:  * Please read the following detail of the licence (in japanese).
        !            13:  *
        !            14:  * ◆使用許諾条件◆
        !            15:  *
        !            16:  * このソフトウェアは株式会社ハッピーサイズによって開発されました。株式会社ハッ
        !            17:  * ピーサイズは、著作権法および万国著作権条約の定めにより、このソフトウェアに関
        !            18:  * するすべての権利を留保する権利を持ち、ここに行使します。株式会社ハッピーサイ
        !            19:  * ズは以下に明記した条件に従って、このソフトウェアを使用する排他的ではない権利
        !            20:  * をお客様に許諾します。何人たりとも、以下の条件に反してこのソフトウェアを使用
        !            21:  * することはできません。
        !            22:  *
        !            23:  * このソフトウェアを「GNU Lesser General Public License (Version 2.1, February
        !            24:  * 1999)」に示された条件で使用することを、全ての方に許諾します。「GNU Lesser
        !            25:  * General Public License」を満たさない使用には、株式会社ハッピーサイズから書面
        !            26:  * による許諾を得る必要があります。
        !            27:  *
        !            28:  * 「GNU Lesser General Public License」の全文は以下のウェブページから取得でき
        !            29:  * ます。「GNU Lesser General Public License」とは、これまでLibrary General
        !            30:  * Public Licenseと呼ばれていたものです。
        !            31:  *     http://www.gnu.org/ --- GNUウェブサイト
        !            32:  *     http://www.gnu.org/copyleft/lesser.html --- ライセンス文面
        !            33:  * このライセンスの内容がわからない方、守れない方には使用を許諾しません。
        !            34:  *
        !            35:  * しかしながら、当社とGNUプロジェクトとの特定の関係を示唆または主張するもので
        !            36:  * はありません。
        !            37:  *
        !            38:  * ◆保証内容◆
        !            39:  *
        !            40:  * このソフトウェアは、期待された動作・機能・性能を持つことを目標として設計され
        !            41:  * 開発されていますが、これを保証するものではありません。このソフトウェアは「こ
        !            42:  * のまま」の状態で提供されており、たとえばこのソフトウェアの有用性ないし特定の
        !            43:  * 目的に合致することといった、何らかの保証内容が、明示されたり暗黙に示されてい
        !            44:  * る場合であっても、その保証は無効です。このソフトウェアを使用した結果ないし使
        !            45:  * 用しなかった結果によって、直接あるいは間接に受けた身体的な傷害、財産上の損害
        !            46:  * 、データの損失あるいはその他の全ての損害については、その損害の可能性が使用者
        !            47:  * 、当社あるいは第三者によって警告されていた場合であっても、当社はその損害の賠
        !            48:  * 償および補填を行いません。この規定は他の全ての、書面上または書面に無い保証・
        !            49:  * 契約・規定に優先します。
        !            50:  *
        !            51:  * ◆著作権者の連絡先および使用条件についての問い合わせ先◆
        !            52:  *
        !            53:  * 〒102-0073
        !            54:  * 東京都千代田区九段北1-13-5日本地所第一ビル4F
        !            55:  * 株式会社ハッピーサイズ
        !            56:  * Phone: 03-3512-3655, Fax: 03-3512-3656
        !            57:  * Email: sales@happysize.co.jp
        !            58:  * Web: http://happysize.com/
        !            59:  *
        !            60:  * ◆著者◆
        !            61:  *
        !            62:  * 金本 茂 <sgk@happysize.co.jp>
        !            63:  *
        !            64:  * ◆履歴◆
        !            65:  *
        !            66:  * 1998/11/10 sgk implementation in C++
        !            67:  * 1999/4/25  sgk Cで書きなおし。
        !            68:  * 1999/4/26  sgk 入力フィルタを実装。漢字コードを推定しながらフィルタを追加。
        !            69:  * 1999/6/??      Unicodeサポート。
        !            70:  * 1999/6/22  sgk ライセンスをLGPLに変更。
        !            71:  *
        !            72:  */
        !            73: 
        !            74: /* 
        !            75:  * Unicode support
        !            76:  *
        !            77:  * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
        !            78:  * All rights reserved.
        !            79:  *
        !            80:  */
        !            81: 
        !            82: /*
        !            83:  *
        !            84:  * streamable kanji code filter and converter
        !            85:  *    mbfl : Multi Byte FiLter Liblary
        !            86:  *
        !            87:  */
        !            88: 
        !            89: #ifndef MBFL_MBFILTER_H
        !            90: #define MBFL_MBFILTER_H
        !            91: 
        !            92: #include "mbfl_defs.h"
        !            93: #include "mbfl_consts.h"
        !            94: #include "mbfl_allocators.h"
        !            95: #include "mbfl_encoding.h"
        !            96: #include "mbfl_language.h"
        !            97: #include "mbfl_string.h"
        !            98: #include "mbfl_convert.h"
        !            99: #include "mbfl_ident.h"
        !           100: 
        !           101: /*
        !           102:  * version information
        !           103:  */
        !           104: #define MBFL_VERSION_MAJOR 1
        !           105: #define MBFL_VERSION_MINOR 1
        !           106: #define MBFL_VERSION_TEENY 0
        !           107: 
        !           108: /*
        !           109:  * convert filter
        !           110:  */
        !           111: #define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0
        !           112: #define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1
        !           113: #define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
        !           114: #define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
        !           115: 
        !           116: /*
        !           117:  * buffering converter
        !           118:  */
        !           119: typedef struct _mbfl_buffer_converter mbfl_buffer_converter;
        !           120: 
        !           121: struct _mbfl_buffer_converter {
        !           122:        mbfl_convert_filter *filter1;
        !           123:        mbfl_convert_filter *filter2;
        !           124:        mbfl_memory_device device;
        !           125:        const mbfl_encoding *from;
        !           126:        const mbfl_encoding *to;
        !           127: };
        !           128: 
        !           129: MBFLAPI extern mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz);
        !           130: MBFLAPI extern void mbfl_buffer_converter_delete(mbfl_buffer_converter *convd);
        !           131: MBFLAPI extern void mbfl_buffer_converter_reset(mbfl_buffer_converter *convd);
        !           132: MBFLAPI extern int mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode);
        !           133: MBFLAPI extern int mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar);
        !           134: MBFLAPI extern int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n);
        !           135: MBFLAPI extern int mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string);
        !           136: MBFLAPI extern int mbfl_buffer_converter_flush(mbfl_buffer_converter *convd);
        !           137: MBFLAPI extern mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result);
        !           138: MBFLAPI extern mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result);
        !           139: MBFLAPI extern mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result);
        !           140: MBFLAPI extern int mbfl_buffer_illegalchars(mbfl_buffer_converter *convd);
        !           141: 
        !           142: /*
        !           143:  * encoding detector
        !           144:  */
        !           145: typedef struct _mbfl_encoding_detector mbfl_encoding_detector;
        !           146: 
        !           147: struct _mbfl_encoding_detector {
        !           148:        mbfl_identify_filter **filter_list;
        !           149:        int filter_list_size;
        !           150:        int strict;
        !           151: };
        !           152: 
        !           153: MBFLAPI extern mbfl_encoding_detector * mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int elistsz, int strict);
        !           154: MBFLAPI extern void mbfl_encoding_detector_delete(mbfl_encoding_detector *identd);
        !           155: MBFLAPI extern int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string);
        !           156: MBFLAPI extern enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd);
        !           157: 
        !           158: 
        !           159: /*
        !           160:  * encoding converter
        !           161:  */
        !           162: MBFLAPI extern mbfl_string *
        !           163: mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, enum mbfl_no_encoding toenc);
        !           164: 
        !           165: 
        !           166: /*
        !           167:  * identify encoding
        !           168:  */
        !           169: MBFLAPI extern const mbfl_encoding *
        !           170: mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int elistsz, int strict);
        !           171: 
        !           172: MBFLAPI extern const char *
        !           173: mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int elistsz, int strict);
        !           174: 
        !           175: MBFLAPI extern enum mbfl_no_encoding
        !           176: mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int elistsz, int strict);
        !           177: 
        !           178: /*
        !           179:  * strlen
        !           180:  */
        !           181: MBFLAPI extern int
        !           182: mbfl_strlen(mbfl_string *string);
        !           183: 
        !           184: /*
        !           185:  * oddlen
        !           186:  */
        !           187: MBFLAPI extern int
        !           188: mbfl_oddlen(mbfl_string *string);
        !           189: 
        !           190: /*
        !           191:  * strpos
        !           192:  */
        !           193: MBFLAPI extern int
        !           194: mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, int offset, int reverse);
        !           195: 
        !           196: 
        !           197: /*
        !           198:  * substr_count
        !           199:  */
        !           200: MBFLAPI extern int
        !           201: mbfl_substr_count(mbfl_string *haystack, mbfl_string *needle);
        !           202: 
        !           203: /*
        !           204:  * substr
        !           205:  */
        !           206: MBFLAPI extern mbfl_string *
        !           207: mbfl_substr(mbfl_string *string, mbfl_string *result, int from, int length);
        !           208: 
        !           209: /*
        !           210:  * strcut
        !           211:  */
        !           212: MBFLAPI extern mbfl_string *
        !           213: mbfl_strcut(mbfl_string *string, mbfl_string *result, int from, int length);
        !           214: 
        !           215: /*
        !           216:  *  strwidth
        !           217:  */
        !           218: MBFLAPI extern int
        !           219: mbfl_strwidth(mbfl_string *string);
        !           220: 
        !           221: /*
        !           222:  *  strimwidth
        !           223:  */
        !           224: MBFLAPI extern mbfl_string *
        !           225: mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, int from, int width);
        !           226: 
        !           227: /*
        !           228:  * MIME header encode
        !           229:  */
        !           230: struct mime_header_encoder_data;       /* forward declaration */
        !           231: 
        !           232: MBFLAPI extern struct mime_header_encoder_data *
        !           233: mime_header_encoder_new(
        !           234:     enum mbfl_no_encoding incode,
        !           235:     enum mbfl_no_encoding outcode,
        !           236:     enum mbfl_no_encoding encoding);
        !           237: 
        !           238: MBFLAPI extern void
        !           239: mime_header_encoder_delete(struct mime_header_encoder_data *pe);
        !           240: 
        !           241: MBFLAPI extern int
        !           242: mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe);
        !           243: 
        !           244: MBFLAPI extern mbfl_string *
        !           245: mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result);
        !           246: 
        !           247: MBFLAPI extern mbfl_string *
        !           248: mbfl_mime_header_encode(
        !           249:     mbfl_string *string, mbfl_string *result,
        !           250:     enum mbfl_no_encoding outcode,
        !           251:     enum mbfl_no_encoding encoding,
        !           252:     const char *linefeed,
        !           253:     int indent);
        !           254: 
        !           255: /*
        !           256:  * MIME header decode
        !           257:  */
        !           258: struct mime_header_decoder_data;       /* forward declaration */
        !           259: 
        !           260: MBFLAPI extern struct mime_header_decoder_data *
        !           261: mime_header_decoder_new(enum mbfl_no_encoding outcode);
        !           262: 
        !           263: MBFLAPI extern void
        !           264: mime_header_decoder_delete(struct mime_header_decoder_data *pd);
        !           265: 
        !           266: MBFLAPI extern int
        !           267: mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd);
        !           268: 
        !           269: MBFLAPI extern mbfl_string *
        !           270: mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result);
        !           271: 
        !           272: MBFLAPI extern mbfl_string *
        !           273: mbfl_mime_header_decode(
        !           274:     mbfl_string *string,
        !           275:     mbfl_string *result,
        !           276:     enum mbfl_no_encoding outcode);
        !           277: 
        !           278: /*
        !           279:  * convert HTML numeric entity
        !           280:  */
        !           281: MBFLAPI extern mbfl_string *
        !           282: mbfl_html_numeric_entity(mbfl_string *string, mbfl_string *result, int *convmap, int mapsize, int type);
        !           283: 
        !           284: /*
        !           285:  * convert of harfwidth and fullwidth for japanese
        !           286:  */
        !           287: MBFLAPI extern mbfl_string *
        !           288: mbfl_ja_jp_hantozen(mbfl_string *string, mbfl_string *result, int mode);
        !           289: 
        !           290: #endif /* MBFL_MBFILTER_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>