PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/cpanel/ea-php73/root/usr/include/php/ext/mbstring/libmbfl/mbfl/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //opt/cpanel/ea-php73/root/usr/include/php/ext/mbstring/libmbfl/mbfl/mbfilter.h

/* charset=UTF-8
 * vim: encoding=utf-8:
 * */

/*
 * "streamable kanji code filter and converter"
 *
 * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
 *
 * This software is released under the GNU Lesser General Public License.
 * (Version 2.1, February 1999)
 * Please read the following detail of the licence (in japanese).
 *
 * ◆使用許諾æ¡ä»¶â—†
 *
 * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
 * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
 * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
 * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
 * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
 * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
 *
 * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
 * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
 * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
 * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
 *
 * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
 * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
 * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
 *     http://www.gnu.org/ --- GNUウェブサイト
 *     http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
 * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
 *
 * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
 * ã¯ã‚ã‚Šã¾ã›ã‚“。
 *
 * â—†ä¿è¨¼å†…容◆
 *
 * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
 * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
 * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
 * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
 * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
 * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
 * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
 * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
 * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
 * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
 *
 * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
 *
 * 〒102-0073
 * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
 * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
 * Phone: 03-3512-3655, Fax: 03-3512-3656
 * Email: sales@happysize.co.jp
 * Web: http://happysize.com/
 *
 * ◆著者◆
 *
 * 金本 茂 <sgk@happysize.co.jp>
 *
 * ◆履歴◆
 *
 * 1998/11/10 sgk implementation in C++
 * 1999/4/25  sgk Cã§æ›¸ããªãŠã—。
 * 1999/4/26  sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
 * 1999/6/??      Unicodeサãƒãƒ¼ãƒˆã€‚
 * 1999/6/22  sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
 *
 */

/*
 * Unicode support
 *
 * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
 * All rights reserved.
 *
 */

/*
 *
 * streamable kanji code filter and converter
 *    mbfl : Multi Byte FiLter Liblary
 *
 */

#ifndef MBFL_MBFILTER_H
#define MBFL_MBFILTER_H

#include "mbfl_defs.h"
#include "mbfl_consts.h"
#include "mbfl_allocators.h"
#include "mbfl_encoding.h"
#include "mbfl_language.h"
#include "mbfl_string.h"
#include "mbfl_convert.h"
#include "mbfl_ident.h"

/* Prefer local fix, otherwise need to include too much. */
#ifndef ssize_t
#if defined(_WIN64)
#define ssize_t __int64
#elif defined(_WIN32)
#define ssize_t __int32
#elif defined(__GNUC__) && __GNUC__ >= 4
#define ssize_t long
#endif
#endif

/*
 * version information
 */
#define MBFL_VERSION_MAJOR 1
#define MBFL_VERSION_MINOR 3
#define MBFL_VERSION_TEENY 2

/*
 * convert filter
 */
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3

/*
 * convenience macros
 */
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif

/*
 * buffering converter
 */
typedef struct _mbfl_buffer_converter mbfl_buffer_converter;

struct _mbfl_buffer_converter {
	mbfl_convert_filter *filter1;
	mbfl_convert_filter *filter2;
	mbfl_memory_device device;
	const mbfl_encoding *from;
	const mbfl_encoding *to;
};

MBFLAPI extern mbfl_buffer_converter * mbfl_buffer_converter_new(const mbfl_encoding *from, const mbfl_encoding *to, size_t buf_initsz);
MBFLAPI extern void mbfl_buffer_converter_delete(mbfl_buffer_converter *convd);
MBFLAPI extern void mbfl_buffer_converter_reset(mbfl_buffer_converter *convd);
MBFLAPI extern int mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode);
MBFLAPI extern int mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar);
MBFLAPI extern int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, size_t n);
MBFLAPI extern int mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string);
MBFLAPI extern int mbfl_buffer_converter_feed2(mbfl_buffer_converter *convd, mbfl_string *string, size_t *loc);
MBFLAPI extern int mbfl_buffer_converter_flush(mbfl_buffer_converter *convd);
MBFLAPI extern mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result);
MBFLAPI extern mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result);
MBFLAPI extern mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result);
MBFLAPI extern size_t mbfl_buffer_illegalchars(mbfl_buffer_converter *convd);

/*
 * encoding detector
 */
typedef struct _mbfl_encoding_detector mbfl_encoding_detector;

struct _mbfl_encoding_detector {
	mbfl_identify_filter **filter_list;
	int filter_list_size;
	int strict;
};

MBFLAPI extern mbfl_encoding_detector * mbfl_encoding_detector_new(const mbfl_encoding **elist, int elistsz, int strict);
MBFLAPI extern void mbfl_encoding_detector_delete(mbfl_encoding_detector *identd);
MBFLAPI extern int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string);
MBFLAPI extern const mbfl_encoding *mbfl_encoding_detector_judge(mbfl_encoding_detector *identd);


/*
 * encoding converter
 */
MBFLAPI extern mbfl_string *
mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, const mbfl_encoding *toenc);


/*
 * identify encoding
 */
MBFLAPI extern const mbfl_encoding *
mbfl_identify_encoding(mbfl_string *string, const mbfl_encoding **elist, int elistsz, int strict);

/* Lengths -1 through -16 are reserved for error return values */
static inline int mbfl_is_error(size_t len) {
	return len >= (size_t) -16;
}

/*
 * strlen
 */
MBFLAPI extern size_t
mbfl_strlen(mbfl_string *string);

/*
 * oddlen
 */
MBFLAPI extern size_t
mbfl_oddlen(mbfl_string *string);

/*
 * strpos
 */
MBFLAPI extern size_t
mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, ssize_t offset, int reverse);

/*
 * substr_count
 */
MBFLAPI extern size_t
mbfl_substr_count(mbfl_string *haystack, mbfl_string *needle);

/*
 * If specified as length, the substr until the end of the string is taken.
 */
#define MBFL_SUBSTR_UNTIL_END ((size_t) -1)

/*
 * substr
 */
MBFLAPI extern mbfl_string *
mbfl_substr(mbfl_string *string, mbfl_string *result, size_t from, size_t length);

/*
 * strcut
 */
MBFLAPI extern mbfl_string *
mbfl_strcut(mbfl_string *string, mbfl_string *result, size_t from, size_t length);

/*
 *  strwidth
 */
MBFLAPI extern size_t
mbfl_strwidth(mbfl_string *string);

/*
 *  strimwidth
 */
MBFLAPI extern mbfl_string *
mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, size_t from, size_t width);

/*
 * MIME header encode
 */
struct mime_header_encoder_data;	/* forward declaration */

MBFLAPI extern struct mime_header_encoder_data *
mime_header_encoder_new(
    const mbfl_encoding *incode,
    const mbfl_encoding *outcode,
    const mbfl_encoding *encoding);

MBFLAPI extern void
mime_header_encoder_delete(struct mime_header_encoder_data *pe);

MBFLAPI extern int
mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe);

MBFLAPI extern mbfl_string *
mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result);

MBFLAPI extern mbfl_string *
mbfl_mime_header_encode(
    mbfl_string *string, mbfl_string *result,
    const mbfl_encoding *outcode,
    const mbfl_encoding *encoding,
    const char *linefeed,
    int indent);

/*
 * MIME header decode
 */
struct mime_header_decoder_data;	/* forward declaration */

MBFLAPI extern struct mime_header_decoder_data *
mime_header_decoder_new(const mbfl_encoding *outcode);

MBFLAPI extern void
mime_header_decoder_delete(struct mime_header_decoder_data *pd);

MBFLAPI extern int
mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd);

MBFLAPI extern mbfl_string *
mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result);

MBFLAPI extern mbfl_string *
mbfl_mime_header_decode(
    mbfl_string *string,
    mbfl_string *result,
    const mbfl_encoding *outcode);

/*
 * convert HTML numeric entity
 */
MBFLAPI extern mbfl_string *
mbfl_html_numeric_entity(mbfl_string *string, mbfl_string *result, int *convmap, int mapsize, int type);

/*
 * convert of harfwidth and fullwidth for japanese
 */
MBFLAPI extern mbfl_string *
mbfl_ja_jp_hantozen(mbfl_string *string, mbfl_string *result, int mode);

#endif	/* MBFL_MBFILTER_H */