MFB (made mbstring compile on windows again).

This commit is contained in:
Edin Kadribasic 2002-11-13 23:11:14 +00:00
parent 9d04acdaaa
commit 1eddce79dd
7 changed files with 62 additions and 52 deletions

View File

@ -415,8 +415,8 @@ php_mb_parse_encoding_list(const char *value, int value_length, int **return_lis
}
/* }}} */
/* {{{ PHPAPI php_mb_check_encoding_list */
PHPAPI int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC) {
/* {{{ MBSTRING_API php_mb_check_encoding_list */
MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC) {
return php_mb_parse_encoding_list(encoding_list, strlen(encoding_list), NULL, NULL, 0);
}
/* }}} */
@ -1525,9 +1525,9 @@ SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
#define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0)
#define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0)
/* {{{ SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
/* {{{ MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
* http input processing */
SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data)
{
char *res = NULL, *separator=NULL;
const char *c_var;
@ -2458,8 +2458,8 @@ PHP_FUNCTION(mb_strimwidth)
}
/* }}} */
/* {{{ PHPAPI char *php_mb_convert_encoding() */
PHPAPI char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC)
/* {{{ MBSTRING_API char *php_mb_convert_encoding() */
MBSTRING_API char * php_mb_convert_encoding(char *input, size_t length, char *_to_encoding, char *_from_encodings, size_t *output_len TSRMLS_DC)
{
mbfl_string string, result, *ret;
enum mbfl_no_encoding from_encoding, to_encoding;
@ -3495,15 +3495,15 @@ PHP_FUNCTION(mb_get_info)
}
/* }}} */
/* {{{ PHPAPI int php_mb_encoding_translation() */
PHPAPI int php_mb_encoding_translation(TSRMLS_D)
/* {{{ MBSTRING_API int php_mb_encoding_translation() */
MBSTRING_API int php_mb_encoding_translation(TSRMLS_D)
{
return MBSTRG(encoding_translation);
}
/* }}} */
/* {{{ PHPAPI size_t php_mb_mbchar_bytes_ex() */
PHPAPI size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc)
/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes_ex() */
MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc)
{
if (enc != NULL) {
if (enc->flag & MBFL_ENCTYPE_MBCS) {
@ -3520,16 +3520,16 @@ PHPAPI size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc)
}
/* }}} */
/* {{{ PHPAPI size_t php_mb_mbchar_bytes() */
PHPAPI size_t php_mb_mbchar_bytes(const char *s TSRMLS_DC)
/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes() */
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s TSRMLS_DC)
{
return php_mb_mbchar_bytes_ex(s,
mbfl_no2encoding(MBSTRG(internal_encoding)));
}
/* }}} */
/* {{{ PHPAPI char *php_mb_safe_strrchr_ex() */
PHPAPI 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_ex() */
MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, size_t nbytes, const mbfl_encoding *enc)
{
register const char *p = s;
char *last=NULL;
@ -3560,24 +3560,24 @@ PHPAPI char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, size_t nbytes
}
/* }}} */
/* {{{ PHPAPI char *php_mb_safe_strrchr() */
PHPAPI char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nbytes TSRMLS_DC)
/* {{{ MBSTRING_API char *php_mb_safe_strrchr() */
MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nbytes TSRMLS_DC)
{
return php_mb_safe_strrchr_ex(s, c, nbytes,
mbfl_no2encoding(MBSTRG(internal_encoding)));
}
/* }}} */
/* {{{ PHPAPI char *php_mb_strrchr() */
PHPAPI char *php_mb_strrchr(const char *s, char c TSRMLS_DC)
/* {{{ MBSTRING_API char *php_mb_strrchr() */
MBSTRING_API char *php_mb_strrchr(const char *s, char c TSRMLS_DC)
{
return php_mb_safe_strrchr(s, c, -1 TSRMLS_CC);
}
/* }}} */
#ifdef ZEND_MULTIBYTE
/* {{{ PHPAPI int php_mb_set_zend_encoding() */
PHPAPI int php_mb_set_zend_encoding(TSRMLS_D)
/* {{{ MBSTRING_API int php_mb_set_zend_encoding() */
MBSTRING_API int php_mb_set_zend_encoding(TSRMLS_D)
{
/* 'd better use mbfl_memory_device? */
char *name, *list = NULL;

View File

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D ZTS=1 /D "COMPILE_DL_MBSTRING" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "_MBCS" /D "_USRDLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D MBSTRING_EXPORTS=1 /D HAVE_MBSTRING=1 /D HAVE_MBREGEX=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "MBSTRING_EXPORTS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MBSTRING=1 /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "MBSTRING_EXPORTS" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_MBSTRING" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D MBSTRING_EXPORTS=1 /D HAVE_MBSTRING=1 /D HAVE_MBREGEX=1 /D HAVE_MBSTR_CN=1 /D HAVE_MBSTR_JA=1 /D HAVE_MBSTR_KR=1 /D HAVE_MBSTR_RU=1 /D HAVE_MBSTR_TW=1 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
@ -92,6 +92,10 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\html_entities.c
# End Source File
# Begin Source File
SOURCE=.\mbfilter.c
# End Source File
# Begin Source File
@ -130,10 +134,6 @@ SOURCE=.\php_mbregex.c
SOURCE=.\php_unicode.c
# End Source File
# Begin Source File
SOURCE=.\html_entities.c
# End Source File
# End Group
# Begin Group "Header Files"
@ -199,6 +199,5 @@ SOURCE=.\unicode_table_kr.h
SOURCE=.\unicode_table_tw.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -49,10 +49,21 @@
#ifdef COMPILE_DL_MBSTRING
#undef HAVE_MBSTRING
#define HAVE_MBSTRING 1
#undef PHPAPI
#define PHPAPI
#undef MBSTRING_API
#define MBSTRING_API
#endif
#ifdef PHP_WIN32
#undef MBSTRING_API
#ifdef MBSTRING_EXPORTS
#define MBSTRING_API __declspec(dllexport)
#else
#define MBSTRING_API __declspec(dllimport)
#endif
#endif
#if HAVE_MBSTRING
#include "mbfilter.h"
@ -107,23 +118,23 @@ PHP_FUNCTION(mb_decode_numericentity);
PHP_FUNCTION(mb_send_mail);
PHP_FUNCTION(mb_get_info);
PHPAPI int php_mb_encoding_translation(TSRMLS_D);
MBSTRING_API int php_mb_encoding_translation(TSRMLS_D);
PHPAPI char *php_mb_safe_strrchr_ex(const char *s, unsigned int c,
MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c,
size_t nbytes, const mbfl_encoding *enc);
PHPAPI char *php_mb_safe_strrchr(const char *s, unsigned int c,
MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c,
size_t nbytes TSRMLS_DC);
PHPAPI char *php_mb_strrchr(const char *s, char c TSRMLS_DC);
MBSTRING_API char *php_mb_strrchr(const char *s, char c TSRMLS_DC);
PHPAPI char * php_mb_convert_encoding(char *input, size_t length,
MBSTRING_API char * php_mb_convert_encoding(char *input, size_t length,
char *_to_encoding,
char *_from_encodings,
size_t *output_len TSRMLS_DC);
PHPAPI int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC);
MBSTRING_API int php_mb_check_encoding_list(const char *encoding_list TSRMLS_DC);
PHPAPI size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc);
PHPAPI size_t php_mb_mbchar_bytes(const char *s 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);
ZEND_BEGIN_MODULE_GLOBALS(mbstring)
@ -178,7 +189,7 @@ struct mb_overload_def {
#endif
#ifdef ZEND_MULTIBYTE
PHPAPI int php_mb_set_zend_encoding(TSRMLS_D);
MBSTRING_API int php_mb_set_zend_encoding(TSRMLS_D);
char* php_mb_encoding_detector(const char *string, int length, char *list
TSRMLS_DC);
int php_mb_encoding_converter(char **to, int *to_length, const char *from,
@ -188,7 +199,7 @@ int php_mb_oddlen(const char *string, int length, const char *encoding TSRMLS_DC
#endif /* ZEND_MULTIBYTE */
SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler);
SAPI_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
MBSTRING_API SAPI_TREAT_DATA_FUNC(mbstr_treat_data);
#else /* HAVE_MBSTRING */

View File

@ -1027,7 +1027,7 @@ PHP_FUNCTION(mb_ereg_search_setpos)
/* }}} */
/* {{{ php_mb_regex_set_options */
PHPAPI int php_mb_regex_set_options( int options TSRMLS_DC)
int php_mb_regex_set_options( int options TSRMLS_DC)
{
int prev_opt = MBSTRG(regex_default_options);
MBSTRG(regex_default_options) = options;
@ -1036,7 +1036,7 @@ PHPAPI int php_mb_regex_set_options( int options TSRMLS_DC)
/* }}} */
/* {{{ php_mb_regex_set_options_by_string */
PHPAPI int php_mb_regex_set_options_by_string( const char *opt_str, int len TSRMLS_DC)
int php_mb_regex_set_options_by_string( const char *opt_str, int len TSRMLS_DC)
{
int new_opt = 0;
_php_mb_regex_init_options( opt_str, len, &new_opt, NULL);

View File

@ -26,7 +26,7 @@
#include "php.h"
#include "zend.h"
#include "mbregex.h"
/* {{{ PHP_MBREGEX_GLOBALS */
#define PHP_MBREGEX_GLOBALS \
int default_mbctype; \
@ -42,9 +42,9 @@
#define PHP_MBREGEX_MAXCACHE 50
PHPAPI int php_mb_regex_name2mbctype(const char *pname);
PHPAPI int php_mb_regex_set_options(int options TSRMLS_DC);
PHPAPI int php_mb_regex_set_options_by_string(const char *optstr, int len TSRMLS_DC);
int php_mb_regex_name2mbctype(const char *pname);
int php_mb_regex_set_options(int options TSRMLS_DC);
int php_mb_regex_set_options_by_string(const char *optstr, int len TSRMLS_DC);
PHP_FUNCTION(mb_regex_encoding);
PHP_FUNCTION(mb_ereg);

View File

@ -96,7 +96,7 @@ static int prop_lookup(unsigned long code, unsigned long n)
}
PHPAPI int php_unicode_is_prop(unsigned long code, unsigned long mask1,
MBSTRING_API int php_unicode_is_prop(unsigned long code, unsigned long mask1,
unsigned long mask2)
{
unsigned long i;
@ -142,7 +142,7 @@ static unsigned long case_lookup(unsigned long code, long l, long r, int field)
return code;
}
PHPAPI unsigned long php_unicode_toupper(unsigned long code)
MBSTRING_API unsigned long php_unicode_toupper(unsigned long code)
{
int field;
long l, r;
@ -168,7 +168,7 @@ PHPAPI unsigned long php_unicode_toupper(unsigned long code)
return case_lookup(code, l, r, field);
}
PHPAPI unsigned long php_unicode_tolower(unsigned long code)
MBSTRING_API unsigned long php_unicode_tolower(unsigned long code)
{
int field;
long l, r;
@ -194,7 +194,7 @@ PHPAPI unsigned long php_unicode_tolower(unsigned long code)
return case_lookup(code, l, r, field);
}
PHPAPI unsigned long php_unicode_totitle(unsigned long code)
MBSTRING_API unsigned long php_unicode_totitle(unsigned long code)
{
int field;
long l, r;
@ -239,7 +239,7 @@ PHPAPI unsigned long php_unicode_totitle(unsigned long code)
((unsigned char*)(ptr))[3] = (v ) & 0xff;\
}
PHPAPI char *php_unicode_convert_case(int case_mode, char *srcstr, size_t srclen, size_t *ret_len,
MBSTRING_API char *php_unicode_convert_case(int case_mode, char *srcstr, size_t srclen, size_t *ret_len,
char *src_encoding TSRMLS_DC)
{
char *unicode, *newstr;

View File

@ -101,9 +101,9 @@
#define UC_PI 0x00008000 /* Punctuation, Initial */
#define UC_PF 0x00010000 /* Punctuation, Final */
PHPAPI int php_unicode_is_prop(unsigned long code, unsigned long mask1,
MBSTRING_API int php_unicode_is_prop(unsigned long code, unsigned long mask1,
unsigned long mask2);
PHPAPI char *php_unicode_convert_case(int case_mode, char *srcstr, size_t srclen, size_t *retlen,
MBSTRING_API char *php_unicode_convert_case(int case_mode, char *srcstr, size_t srclen, size_t *retlen,
char *src_encoding TSRMLS_DC);
#define PHP_UNICODE_CASE_UPPER 0