Back to index

php5  5.3.10
zend_multibyte.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | Zend Engine                                                          |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 2.00 of the Zend license,     |
00008    | that is bundled with this package in the file LICENSE, and is        | 
00009    | available through the world-wide-web at                              |
00010    | http://www.zend.com/license/2_00.txt.                                |
00011    | If you did not receive a copy of the Zend license and are unable to  |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@zend.com so we can mail you a copy immediately.              |
00014    +----------------------------------------------------------------------+
00015    | Authors: Masaki Fujimoto <fujimoto@php.net>                          |
00016    |          Rui Hirokawa <hirokawa@php.net>                             |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: zend_multibyte.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef ZEND_MULTIBYTE_H
00023 #define ZEND_MULTIBYTE_H
00024 
00025 #ifdef ZEND_MULTIBYTE
00026 
00027 #define BOM_UTF32_BE "\x00\x00\xfe\xff"
00028 #define       BOM_UTF32_LE  "\xff\xfe\x00\x00"
00029 #define       BOM_UTF16_BE  "\xfe\xff"
00030 #define       BOM_UTF16_LE  "\xff\xfe"
00031 #define       BOM_UTF8             "\xef\xbb\xbf"
00032 
00033 typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length TSRMLS_DC);
00034 
00035 typedef char* (*zend_encoding_detector)(const unsigned char *string, size_t length, char *list TSRMLS_DC);
00036 
00037 typedef int (*zend_encoding_converter)(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const char *encoding_to, const char *encoding_from TSRMLS_DC);
00038 
00039 typedef size_t (*zend_encoding_oddlen)(const unsigned char *string, size_t length, const char *encoding TSRMLS_DC);
00040 
00041 typedef struct _zend_encoding {
00042        zend_encoding_filter input_filter;        /* escape input filter */
00043        zend_encoding_filter output_filter;              /* escape output filter */
00044        const char *name;                                /* encoding name */
00045        const char *(*aliases)[];                 /* encoding name aliases */
00046        zend_bool compatible;                                          /* flex compatible or not */
00047 } zend_encoding;
00048 
00049 
00050 /*
00051  * zend multibyte APIs
00052  */
00053 BEGIN_EXTERN_C()
00054 ZEND_API int zend_multibyte_set_script_encoding(const char *encoding_list,
00055 size_t encoding_list_size TSRMLS_DC);
00056 ZEND_API int zend_multibyte_set_internal_encoding(const char *encoding_name TSRMLS_DC);
00057 ZEND_API int zend_multibyte_set_functions(zend_encoding_detector encoding_detector, zend_encoding_converter encoding_converter, zend_encoding_oddlen encoding_oddlen TSRMLS_DC);
00058 ZEND_API int zend_multibyte_set_filter(zend_encoding *onetime_encoding TSRMLS_DC);
00059 ZEND_API zend_encoding* zend_multibyte_fetch_encoding(const char *encoding_name);
00060 ZEND_API size_t zend_multibyte_script_encoding_filter(unsigned char **to, size_t 
00061 *to_length, const unsigned char *from, size_t from_length TSRMLS_DC);
00062 ZEND_API size_t zend_multibyte_internal_encoding_filter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length TSRMLS_DC);
00063 
00064 /* in zend_language_scanner.l */
00065 ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, zend_encoding *old_encoding TSRMLS_DC);
00066 ZEND_API int zend_multibyte_yyinput(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC);
00067 ZEND_API int zend_multibyte_read_script(unsigned char *buf, size_t n TSRMLS_DC);
00068 END_EXTERN_C()
00069 
00070 #endif /* ZEND_MULTIBYTE */
00071 
00072 #endif /* ZEND_MULTIBYTE_H */
00073 
00074 /*
00075  * Local variables:
00076  * tab-width: 4
00077  * c-basic-offset: 4
00078  * End:
00079  * vim600: sw=4 ts=4 tw=78
00080  * vim<600: sw=4 ts=4 tw=78
00081  */