root/ext/intl/calendar/calendar_class.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. php_intl_calendar_fetch_object

   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: Gustavo Lopes <cataphract@php.net>                          |
  14    +----------------------------------------------------------------------+
  15  */
  16 
  17 #ifndef CALENDAR_CLASS_H
  18 #define CALENDAR_CLASS_H
  19 
  20 //redefinition of inline in PHP headers causes problems, so include this before
  21 #include <math.h>
  22 
  23 #include <php.h>
  24 #include "intl_error.h"
  25 #include "intl_data.h"
  26 
  27 #ifndef USE_CALENDAR_POINTER
  28 typedef void Calendar;
  29 #endif
  30 
  31 typedef struct {
  32         //      error handling
  33         intl_error  err;
  34 
  35         // ICU calendar
  36         Calendar*       ucal;
  37 
  38         zend_object     zo;
  39 } Calendar_object;
  40 
  41 static inline Calendar_object *php_intl_calendar_fetch_object(zend_object *obj) {
  42         return (Calendar_object *)((char*)(obj) - XtOffsetOf(Calendar_object, zo));
  43 }
  44 #define Z_INTL_CALENDAR_P(zv) php_intl_calendar_fetch_object(Z_OBJ_P(zv))
  45 
  46 #define CALENDAR_ERROR(co)              (co)->err
  47 #define CALENDAR_ERROR_P(co)    &(CALENDAR_ERROR(co))
  48 
  49 #define CALENDAR_ERROR_CODE(co)         INTL_ERROR_CODE(CALENDAR_ERROR(co))
  50 #define CALENDAR_ERROR_CODE_P(co)       &(INTL_ERROR_CODE(CALENDAR_ERROR(co)))
  51 
  52 #define CALENDAR_METHOD_INIT_VARS                       INTL_METHOD_INIT_VARS(Calendar, co)
  53 #define CALENDAR_METHOD_FETCH_OBJECT_NO_CHECK   INTL_METHOD_FETCH_OBJECT(INTL_CALENDAR, co)
  54 #define CALENDAR_METHOD_FETCH_OBJECT \
  55         CALENDAR_METHOD_FETCH_OBJECT_NO_CHECK; \
  56         if (co->ucal == NULL) \
  57         { \
  58                 intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlCalendar", 0); \
  59                 RETURN_FALSE; \
  60         }
  61 
  62 void calendar_object_create(zval *object, Calendar *calendar);
  63 
  64 Calendar *calendar_fetch_native_calendar(zval *object);
  65 
  66 void calendar_object_construct(zval *object, Calendar *calendar);
  67 
  68 void calendar_register_IntlCalendar_class(void);
  69 
  70 extern zend_class_entry *Calendar_ce_ptr,
  71                                                 *GregorianCalendar_ce_ptr;
  72 
  73 extern zend_object_handlers Calendar_handlers;
  74 
  75 #endif /* #ifndef CALENDAR_CLASS_H */

/* [<][>][^][v][top][bottom][index][help] */