/* * This file is part of Pimple. * * Copyright (c) 2014 Fabien Potencier * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is furnished * to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef PHP_PIMPLE_H #define PHP_PIMPLE_H extern zend_module_entry pimple_module_entry; #define phpext_pimple_ptr &pimple_module_entry #ifdef PHP_WIN32 # define PHP_PIMPLE_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 # define PHP_PIMPLE_API __attribute__ ((visibility("default"))) #else # define PHP_PIMPLE_API #endif #ifdef ZTS #include "TSRM.h" #endif #define PIMPLE_VERSION "3.2.3-DEV" #define PIMPLE_NS "Pimple" #define PSR_CONTAINER_NS "Psr\\Container" #define PIMPLE_EXCEPTION_NS "Pimple\\Exception" #define PIMPLE_DEFAULT_ZVAL_CACHE_NUM 5 #define PIMPLE_DEFAULT_ZVAL_VALUES_NUM 10 #define PIMPLE_DEPRECATE do { \ int er = EG(error_reporting); \ EG(error_reporting) = 0;\ php_error(E_DEPRECATED, "The Pimple C extension is deprecated since version 3.1 and will be removed in 4.0."); \ EG(error_reporting) = er; \ } while (0); zend_module_entry *get_module(void); PHP_MINIT_FUNCTION(pimple); PHP_MINFO_FUNCTION(pimple); PHP_METHOD(FrozenServiceException, __construct); PHP_METHOD(InvalidServiceIdentifierException, __construct); PHP_METHOD(UnknownIdentifierException, __construct); PHP_METHOD(Pimple, __construct); PHP_METHOD(Pimple, factory); PHP_METHOD(Pimple, protect); PHP_METHOD(Pimple, raw); PHP_METHOD(Pimple, extend); PHP_METHOD(Pimple, keys); PHP_METHOD(Pimple, register); PHP_METHOD(Pimple, offsetSet); PHP_METHOD(Pimple, offsetUnset); PHP_METHOD(Pimple, offsetGet); PHP_METHOD(Pimple, offsetExists); PHP_METHOD(PimpleClosure, invoker); typedef struct _pimple_bucket_value { zval *value; /* Must be the first element */ zval *raw; zend_object_handle handle_num; enum { PIMPLE_IS_PARAM = 0, PIMPLE_IS_SERVICE = 2 } type; zend_bool initialized; zend_fcall_info_cache fcc; } pimple_bucket_value; typedef struct _pimple_object { zend_object zobj; HashTable values; HashTable factories; HashTable protected; } pimple_object; typedef struct _pimple_closure_object { zend_object zobj; zval *callable; zval *factory; } pimple_closure_object; static const char sensiolabs_logo[] = ""; static void pimple_exception_call_parent_constructor(zval *this_ptr, const char *format, const char *arg1 TSRMLS_DC); static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC); static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC); static void pimple_bucket_dtor(pimple_bucket_value *bucket); static void pimple_free_bucket(pimple_bucket_value *bucket); static zval *pimple_object_read_dimension(zval *object, zval *offset, int type TSRMLS_DC); static void pimple_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC); static int pimple_object_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC); static void pimple_object_unset_dimension(zval *object, zval *offset TSRMLS_DC); static zend_object_value pimple_object_create(zend_class_entry *ce TSRMLS_DC); static void pimple_free_object_storage(pimple_object *obj TSRMLS_DC); static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC); static zend_object_value pimple_closure_object_create(zend_class_entry *ce TSRMLS_DC); static zend_function *pimple_closure_get_constructor(zval * TSRMLS_DC); static int pimple_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC); #ifdef ZTS #define PIMPLE_G(v) TSRMG(pimple_globals_id, zend_pimple_globals *, v) #else #define PIMPLE_G(v) (pimple_globals.v) #endif #endif /* PHP_PIMPLE_H */