1 /* 2 +----------------------------------------------------------------------+ 3 | Yet Another Framework | 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 | Author: Xinchen Hui <laruence@php.net> | 14 +----------------------------------------------------------------------+ 15 */ 16 17 #ifndef PHP_YAF_APPLICATION_H 18 #define PHP_YAF_APPLICATION_H 19 20 #define YAF_APP_RUNNING (1<<0) 21 #define YAF_APP_FLAGS(a) YAF_VAR_FLAGS(a->dispatcher) 22 23 typedef struct { 24 zend_string *library; 25 zend_string *directory; 26 zend_string *bootstrap; 27 zend_string *base_uri; 28 zend_array *default_route; 29 zend_string *default_module; 30 zend_string *default_controller; 31 zend_string *default_action; 32 yaf_dispatcher_t dispatcher; 33 yaf_config_t config; 34 zend_string *ext; 35 zend_string *view_ext; 36 zend_string *env; 37 zend_array *modules; 38 unsigned int err_no; 39 zend_string *err_msg; 40 zend_array *properties; 41 zend_object std; 42 } yaf_application_object; 43 44 #define Z_YAFAPPOBJ(zv) ((php_yaf_application_fetch_object)(Z_OBJ(zv))) 45 #define Z_YAFAPPOBJ_P(zv) Z_YAFAPPOBJ(*(zv)) 46 php_yaf_application_fetch_object(zend_object * obj)47static zend_always_inline yaf_application_object *php_yaf_application_fetch_object(zend_object *obj) { 48 return (yaf_application_object *)((char*)(obj) - XtOffsetOf(yaf_application_object, std)); 49 } 50 51 extern zend_class_entry *yaf_application_ce; 52 53 int yaf_application_is_module_name(zend_string *name); 54 int yaf_application_is_module_name_str(const char *name, size_t len); 55 yaf_application_instance()56static zend_always_inline yaf_application_object *yaf_application_instance() { 57 if (Z_TYPE(YAF_G(app)) == IS_OBJECT) { 58 return Z_YAFAPPOBJ(YAF_G(app)); 59 } 60 return NULL; 61 } 62 63 YAF_STARTUP_FUNCTION(application); 64 #endif 65 66 /* 67 * Local variables: 68 * tab-width: 4 69 * c-basic-offset: 4 70 * End: 71 * vim600: noet sw=4 ts=4 fdm=marker 72 * vim<600: noet sw=4 ts=4 73 */ 74