php-src/ext/mbstring/mbstring.h

234 lines
7.5 KiB
C
Raw Normal View History

2001-05-01 09:52:55 +08:00
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
2001-05-01 09:52:55 +08:00
+----------------------------------------------------------------------+
2007-12-31 15:17:19 +08:00
| Copyright (c) 1997-2008 The PHP Group |
2001-05-01 09:52:55 +08:00
+----------------------------------------------------------------------+
2006-01-01 20:51:34 +08:00
| This source file is subject to version 3.01 of the PHP license, |
2001-05-01 09:52:55 +08:00
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
2006-01-01 20:51:34 +08:00
| http://www.php.net/license/3_01.txt |
2001-05-01 09:52:55 +08:00
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
2002-02-28 16:29:35 +08:00
| Author: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> |
2001-05-01 09:52:55 +08:00
+----------------------------------------------------------------------+
*/
/* $Id$ */
/*
* PHP 4 Multibyte String module "mbstring" (currently only for Japanese)
2001-05-01 09:52:55 +08:00
*
* History:
* 2000.5.19 Release php-4.0RC2_jstring-1.0
* 2001.4.1 Release php4_jstring-1.0.91
* 2001.4.30 Release php4-jstring-1.1 (contribute to The PHP Group)
* 2001.5.1 Renamed from jstring to mbstring (hirokawa@php.net)
*/
/*
* PHP3 Internationalization support program.
*
* Copyright (c) 1999,2000 by the PHP3 internationalization team.
* All rights reserved.
*
* See README_PHP3-i18n-ja for more detail.
*
* Authors:
* Hironori Sato <satoh@jpnnet.com>
* Shigeru Kanemoto <sgk@happysize.co.jp>
* Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
*/
#ifndef _MBSTRING_H
#define _MBSTRING_H
#ifdef COMPILE_DL_MBSTRING
#undef HAVE_MBSTRING
#define HAVE_MBSTRING 1
#endif
#ifdef PHP_WIN32
# undef MBSTRING_API
# ifdef MBSTRING_EXPORTS
# define MBSTRING_API __declspec(dllexport)
# elif defined(COMPILE_DL_MBSTRING)
# define MBSTRING_API __declspec(dllimport)
# else
# define MBSTRING_API /* nothing special */
# endif
#elif defined(__GNUC__) && __GNUC__ >= 4
# undef MBSTRING_API
# define MBSTRING_API __attribute__ ((visibility("default")))
#else
# undef MBSTRING_API
# define MBSTRING_API /* nothing special */
2001-05-01 09:52:55 +08:00
#endif
2001-05-01 09:52:55 +08:00
#if HAVE_MBSTRING
#include "libmbfl/mbfl/mbfilter.h"
#include "SAPI.h"
2001-05-01 09:52:55 +08:00
#define PHP_MBSTRING_API 20021024
2002-04-05 09:23:22 +08:00
2001-05-01 09:52:55 +08:00
extern zend_module_entry mbstring_module_entry;
#define mbstring_module_ptr &mbstring_module_entry
PHP_MINIT_FUNCTION(mbstring);
PHP_MSHUTDOWN_FUNCTION(mbstring);
PHP_RINIT_FUNCTION(mbstring);
PHP_RSHUTDOWN_FUNCTION(mbstring);
2001-05-01 09:52:55 +08:00
PHP_MINFO_FUNCTION(mbstring);
/* functions in php_unicode.c */
PHP_FUNCTION(mb_convert_case);
PHP_FUNCTION(mb_strtoupper);
PHP_FUNCTION(mb_strtolower);
2001-05-01 09:52:55 +08:00
/* php function registration */
PHP_FUNCTION(mb_language);
PHP_FUNCTION(mb_internal_encoding);
PHP_FUNCTION(mb_http_input);
PHP_FUNCTION(mb_http_output);
PHP_FUNCTION(mb_detect_order);
PHP_FUNCTION(mb_substitute_character);
PHP_FUNCTION(mb_preferred_mime_name);
PHP_FUNCTION(mb_parse_str);
PHP_FUNCTION(mb_output_handler);
PHP_FUNCTION(mb_strlen);
PHP_FUNCTION(mb_strpos);
PHP_FUNCTION(mb_strrpos);
2006-05-30 23:43:09 +08:00
PHP_FUNCTION(mb_stripos);
PHP_FUNCTION(mb_strripos);
2006-05-30 23:45:35 +08:00
PHP_FUNCTION(mb_strstr);
PHP_FUNCTION(mb_strrchr);
2006-05-30 23:47:53 +08:00
PHP_FUNCTION(mb_stristr);
PHP_FUNCTION(mb_strrichr);
PHP_FUNCTION(mb_substr_count);
PHP_FUNCTION(mb_substr);
PHP_FUNCTION(mb_strcut);
PHP_FUNCTION(mb_strwidth);
PHP_FUNCTION(mb_strimwidth);
PHP_FUNCTION(mb_convert_encoding);
PHP_FUNCTION(mb_detect_encoding);
PHP_FUNCTION(mb_list_encodings);
PHP_FUNCTION(mb_list_encodings_alias_names);
PHP_FUNCTION(mb_list_mime_names);
PHP_FUNCTION(mb_convert_kana);
PHP_FUNCTION(mb_encode_mimeheader);
PHP_FUNCTION(mb_decode_mimeheader);
PHP_FUNCTION(mb_convert_variables);
PHP_FUNCTION(mb_encode_numericentity);
PHP_FUNCTION(mb_decode_numericentity);
PHP_FUNCTION(mb_send_mail);
PHP_FUNCTION(mb_get_info);
2006-03-21 15:56:28 +08:00
PHP_FUNCTION(mb_check_encoding);
2001-05-01 09:52:55 +08:00
MBSTRING_API int php_mb_encoding_translation(TSRMLS_D);
MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c,
size_t nbytes, const mbfl_encoding *enc);
MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c,
size_t nbytes TSRMLS_DC);
MBSTRING_API char *php_mb_strrchr(const char *s, char c TSRMLS_DC);
2008-07-24 21:46:50 +08:00
MBSTRING_API char * php_mb_convert_encoding(const char *input, size_t length,
const char *_to_encoding,
const char *_from_encodings,
size_t *output_len TSRMLS_DC);
MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC);
MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc);
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s TSRMLS_DC);
MBSTRING_API size_t php_mb_gpc_mbchar_bytes(const char *s TSRMLS_DC);
MBSTRING_API int php_mb_encoding_detector_ex(const char *arg_string, int arg_length,
char *arg_list TSRMLS_DC);
MBSTRING_API int php_mb_encoding_converter_ex(char **str, int *len, const char *encoding_to,
const char *encoding_from TSRMLS_DC);
MBSTRING_API int php_mb_gpc_encoding_converter(char **str, int *len, int num, const char *encoding_to, const char *encoding_from TSRMLS_DC);
2003-07-03 23:30:14 +08:00
MBSTRING_API int php_mb_gpc_encoding_detector(char **arg_string, int *arg_length, int num, char *arg_list TSRMLS_DC);
2008-07-24 21:46:50 +08:00
MBSTRING_API int php_mb_stripos(int mode, const char *old_haystack, unsigned int old_haystack_len, const char *old_needle, unsigned int old_needle_len, unsigned int offset, const char *from_encoding TSRMLS_DC);
2006-05-30 23:43:09 +08:00
2001-05-01 09:52:55 +08:00
ZEND_BEGIN_MODULE_GLOBALS(mbstring)
enum mbfl_no_language language;
enum mbfl_no_encoding internal_encoding;
enum mbfl_no_encoding current_internal_encoding;
#ifdef ZEND_MULTIBYTE
enum mbfl_no_encoding *script_encoding_list;
int script_encoding_list_size;
#endif /* ZEND_MULTIBYTE */
enum mbfl_no_encoding http_output_encoding;
enum mbfl_no_encoding current_http_output_encoding;
enum mbfl_no_encoding http_input_identify;
enum mbfl_no_encoding http_input_identify_get;
enum mbfl_no_encoding http_input_identify_post;
enum mbfl_no_encoding http_input_identify_cookie;
enum mbfl_no_encoding http_input_identify_string;
enum mbfl_no_encoding *http_input_list;
2001-05-01 09:52:55 +08:00
int http_input_list_size;
enum mbfl_no_encoding *detect_order_list;
2001-05-01 09:52:55 +08:00
int detect_order_list_size;
enum mbfl_no_encoding *current_detect_order_list;
2001-05-01 09:52:55 +08:00
int current_detect_order_list_size;
2003-09-27 01:41:52 +08:00
enum mbfl_no_encoding *default_detect_order_list;
int default_detect_order_list_size;
2001-05-01 09:52:55 +08:00
int filter_illegal_mode;
int filter_illegal_substchar;
int current_filter_illegal_mode;
int current_filter_illegal_substchar;
2003-05-12 21:28:06 +08:00
long func_overload;
zend_bool encoding_translation;
long strict_detection;
long illegalchars;
2001-05-01 09:52:55 +08:00
mbfl_buffer_converter *outconv;
void *http_output_conv_mimetypes;
#if HAVE_MBREGEX
struct _zend_mb_regex_globals *mb_regex_globals;
#endif
2002-04-26 18:13:45 +08:00
ZEND_END_MODULE_GLOBALS(mbstring)
2001-05-01 09:52:55 +08:00
#define MB_OVERLOAD_MAIL 1
#define MB_OVERLOAD_STRING 2
#define MB_OVERLOAD_REGEX 4
struct mb_overload_def {
int type;
char *orig_func;
char *ovld_func;
char *save_func;
};
2001-05-01 09:52:55 +08:00
#ifdef ZTS
#define MBSTRG(v) TSRMG(mbstring_globals_id, zend_mbstring_globals *, v)
2001-05-01 09:52:55 +08:00
#else
#define MBSTRG(v) (mbstring_globals.v)
#endif
#else /* HAVE_MBSTRING */
#define mbstring_module_ptr NULL
#endif /* HAVE_MBSTRING */
#define phpext_mbstring_ptr mbstring_module_ptr
#endif /* _MBSTRING_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/