1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | http://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: Stanislav Malyshev <stas@zend.com> | 14 +----------------------------------------------------------------------+ 15 */ 16 17 #ifndef MSG_FORMAT_CLASS_H 18 #define MSG_FORMAT_CLASS_H 19 20 #include <php.h> 21 22 #include <unicode/uconfig.h> 23 24 #include "../intl_common.h" 25 #include "../intl_error.h" 26 #include "../intl_data.h" 27 28 #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48 29 # define MSG_FORMAT_QUOTE_APOS 1 30 #endif 31 32 #include "msgformat_data.h" 33 34 typedef struct { 35 msgformat_data mf_data; 36 zend_object zo; 37 } MessageFormatter_object; 38 39 php_intl_messageformatter_fetch_object(zend_object * obj)40static inline MessageFormatter_object *php_intl_messageformatter_fetch_object(zend_object *obj) { 41 return (MessageFormatter_object *)((char*)(obj) - XtOffsetOf(MessageFormatter_object, zo)); 42 } 43 #define Z_INTL_MESSAGEFORMATTER_P(zv) php_intl_messageformatter_fetch_object(Z_OBJ_P(zv)) 44 45 void msgformat_register_class( void ); 46 extern zend_class_entry *MessageFormatter_ce_ptr; 47 48 /* Auxiliary macros */ 49 50 #define MSG_FORMAT_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(MessageFormatter, mfo) 51 #define MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(INTL_MESSAGEFORMATTER, mfo) 52 #define MSG_FORMAT_METHOD_FETCH_OBJECT \ 53 MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \ 54 if (MSG_FORMAT_OBJECT(mfo) == NULL) { \ 55 intl_errors_set(&mfo->mf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \ 56 "Found unconstructed MessageFormatter", 0); \ 57 RETURN_FALSE; \ 58 } 59 60 #define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf 61 62 #endif // #ifndef MSG_FORMAT_CLASS_H 63