Annotation of embedaddon/php/ext/intl/spoofchecker/spoofchecker_class.h, revision 1.1
1.1 ! misho 1: /*
! 2: +----------------------------------------------------------------------+
! 3: | PHP Version 5 |
! 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: Scott MacVicar <scottmac@php.net> |
! 14: +----------------------------------------------------------------------+
! 15: */
! 16:
! 17: #ifndef SPOOFCHECKER_CLASS_H
! 18: #define SPOOFCHECKER_CLASS_H
! 19:
! 20: #include <php.h>
! 21:
! 22: #include "intl_common.h"
! 23: #include "spoofchecker_create.h"
! 24: #include "intl_error.h"
! 25:
! 26: #include <unicode/uspoof.h>
! 27:
! 28: typedef struct {
! 29: zend_object zo;
! 30:
! 31: // error handling
! 32: intl_error err;
! 33:
! 34: // ICU Spoofchecker
! 35: USpoofChecker* uspoof;
! 36: } Spoofchecker_object;
! 37:
! 38: #define SPOOFCHECKER_ERROR(co) (co)->err
! 39: #define SPOOFCHECKER_ERROR_P(co) &(SPOOFCHECKER_ERROR(co))
! 40:
! 41: #define SPOOFCHECKER_ERROR_CODE(co) INTL_ERROR_CODE(SPOOFCHECKER_ERROR(co))
! 42: #define SPOOFCHECKER_ERROR_CODE_P(co) &(INTL_ERROR_CODE(SPOOFCHECKER_ERROR(co)))
! 43:
! 44: void spoofchecker_register_Spoofchecker_class(TSRMLS_D);
! 45:
! 46: void spoofchecker_object_init(Spoofchecker_object* co TSRMLS_DC);
! 47: void spoofchecker_object_destroy(Spoofchecker_object* co TSRMLS_DC);
! 48:
! 49: extern zend_class_entry *Spoofchecker_ce_ptr;
! 50:
! 51: /* Auxiliary macros */
! 52:
! 53: #define SPOOFCHECKER_METHOD_INIT_VARS \
! 54: zval* object = getThis(); \
! 55: Spoofchecker_object* co = NULL; \
! 56: intl_error_reset(NULL TSRMLS_CC); \
! 57:
! 58: #define SPOOFCHECKER_METHOD_FETCH_OBJECT \
! 59: co = (Spoofchecker_object *) zend_object_store_get_object(object TSRMLS_CC); \
! 60: intl_error_reset(SPOOFCHECKER_ERROR_P(co) TSRMLS_CC); \
! 61:
! 62: // Macro to check return value of a ucol_* function call.
! 63: #define SPOOFCHECKER_CHECK_STATUS(co, msg) \
! 64: intl_error_set_code(NULL, SPOOFCHECKER_ERROR_CODE(co) TSRMLS_CC); \
! 65: if (U_FAILURE(SPOOFCHECKER_ERROR_CODE(co))) { \
! 66: intl_errors_set_custom_msg(SPOOFCHECKER_ERROR_P(co), msg, 0 TSRMLS_CC); \
! 67: RETURN_FALSE; \
! 68: } \
! 69:
! 70: #endif // #ifndef SPOOFCHECKER_CLASS_H
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>