Back to index

php5  5.3.10
zend_constants.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | Zend Engine                                                          |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 2.00 of the Zend license,     |
00008    | that is bundled with this package in the file LICENSE, and is        | 
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.zend.com/license/2_00.txt.                                |
00011    | If you did not receive a copy of the Zend license and are unable to  |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@zend.com so we can mail you a copy immediately.              |
00014    +----------------------------------------------------------------------+
00015    | Authors: Andi Gutmans <andi@zend.com>                                |
00016    |          Zeev Suraski <zeev@zend.com>                                |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: zend_constants.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef ZEND_CONSTANTS_H
00023 #define ZEND_CONSTANTS_H
00024 
00025 #include "zend_globals.h"
00026 
00027 #define CONST_CS                          (1<<0)                      /* Case Sensitive */
00028 #define CONST_PERSISTENT           (1<<1)                      /* Persistent */
00029 #define CONST_CT_SUBST                    (1<<2)                      /* Allow compile-time substitution */
00030 
00031 #define       PHP_USER_CONSTANT INT_MAX   /* a constant defined in user space */
00032 
00033 typedef struct _zend_constant {
00034        zval value;
00035        int flags;
00036        char *name;
00037        uint name_len;
00038        int module_number;
00039 } zend_constant;
00040 
00041 #define REGISTER_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
00042 #define REGISTER_DOUBLE_CONSTANT(name, dval, flags)  zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC)
00043 #define REGISTER_STRING_CONSTANT(name, str, flags)  zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC)
00044 #define REGISTER_STRINGL_CONSTANT(name, str, len, flags)  zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC)
00045 
00046 #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags)  zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC)
00047 #define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags)  zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC)
00048 #define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags)  zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC)
00049 #define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags)  zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC)
00050 
00051 #define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags)  zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC)
00052 #define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags)  zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC)
00053 #define REGISTER_MAIN_STRING_CONSTANT(name, str, flags)  zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC)
00054 #define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags)  zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), 0 TSRMLS_CC)
00055 
00056 BEGIN_EXTERN_C()
00057 void clean_module_constants(int module_number TSRMLS_DC);
00058 void free_zend_constant(zend_constant *c);
00059 int zend_startup_constants(TSRMLS_D);
00060 int zend_shutdown_constants(TSRMLS_D);
00061 void zend_register_standard_constants(TSRMLS_D);
00062 void clean_non_persistent_constants(TSRMLS_D);
00063 ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC);
00064 ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC);
00065 ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
00066 ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
00067 ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
00068 ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
00069 ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
00070 void zend_copy_constants(HashTable *target, HashTable *sourc);
00071 void copy_zend_constant(zend_constant *c);
00072 END_EXTERN_C()
00073 
00074 #define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
00075 
00076 #endif
00077 
00078 /*
00079  * Local variables:
00080  * tab-width: 4
00081  * c-basic-offset: 4
00082  * indent-tabs-mode: t
00083  * End:
00084  */