Annotation of embedaddon/php/ext/intl/spoofchecker/spoofchecker_class.h, revision 1.1.1.2

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"
1.1.1.2 ! misho      25: #include "intl_data.h"
1.1       misho      26: 
                     27: #include <unicode/uspoof.h>
                     28: 
                     29: typedef struct {
                     30:        zend_object     zo;
                     31: 
                     32:        // error handling
                     33:        intl_error  err;
                     34: 
                     35:        // ICU Spoofchecker
                     36:        USpoofChecker*      uspoof;
                     37: } Spoofchecker_object;
                     38: 
                     39: #define SPOOFCHECKER_ERROR(co) (co)->err
                     40: #define SPOOFCHECKER_ERROR_P(co) &(SPOOFCHECKER_ERROR(co))
                     41: 
                     42: #define SPOOFCHECKER_ERROR_CODE(co)   INTL_ERROR_CODE(SPOOFCHECKER_ERROR(co))
                     43: #define SPOOFCHECKER_ERROR_CODE_P(co) &(INTL_ERROR_CODE(SPOOFCHECKER_ERROR(co)))
                     44: 
                     45: void spoofchecker_register_Spoofchecker_class(TSRMLS_D);
                     46: 
                     47: void spoofchecker_object_init(Spoofchecker_object* co TSRMLS_DC);
                     48: void spoofchecker_object_destroy(Spoofchecker_object* co TSRMLS_DC);
                     49: 
                     50: extern zend_class_entry *Spoofchecker_ce_ptr;
                     51: 
                     52: /* Auxiliary macros */
                     53: 
                     54: #define SPOOFCHECKER_METHOD_INIT_VARS       \
                     55:     zval*             object  = getThis();   \
                     56:     Spoofchecker_object*  co  = NULL;   \
                     57:     intl_error_reset(NULL TSRMLS_CC); \
                     58: 
1.1.1.2 ! misho      59: #define SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK      INTL_METHOD_FETCH_OBJECT(Spoofchecker, co)
        !            60: #define SPOOFCHECKER_METHOD_FETCH_OBJECT                                                       \
        !            61:        SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK;                                              \
        !            62:        if (co->uspoof == NULL) {                                                                               \
        !            63:                intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR,                     \
        !            64:                                "Found unconstructed Spoofchecker", 0 TSRMLS_CC);       \
        !            65:                RETURN_FALSE;                                                                                           \
        !            66:        }
1.1       misho      67: 
                     68: // Macro to check return value of a ucol_* function call.
                     69: #define SPOOFCHECKER_CHECK_STATUS(co, msg)                                        \
                     70:     intl_error_set_code(NULL, SPOOFCHECKER_ERROR_CODE(co) TSRMLS_CC);           \
                     71:     if (U_FAILURE(SPOOFCHECKER_ERROR_CODE(co))) {                                  \
                     72:         intl_errors_set_custom_msg(SPOOFCHECKER_ERROR_P(co), msg, 0 TSRMLS_CC); \
                     73:         RETURN_FALSE;                                                           \
                     74:     }                                                                           \
                     75: 
                     76: #endif // #ifndef SPOOFCHECKER_CLASS_H

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>