1: /*
2: +----------------------------------------------------------------------+
3: | Zend Engine |
4: +----------------------------------------------------------------------+
5: | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
6: +----------------------------------------------------------------------+
7: | This source file is subject to version 2.00 of the Zend license, |
8: | that is bundled with this package in the file LICENSE, and is |
9: | available through the world-wide-web at the following url: |
10: | http://www.zend.com/license/2_00.txt. |
11: | If you did not receive a copy of the Zend license and are unable to |
12: | obtain it through the world-wide-web, please send a note to |
13: | license@zend.com so we can mail you a copy immediately. |
14: +----------------------------------------------------------------------+
15: | Authors: Andi Gutmans <andi@zend.com> |
16: | Zeev Suraski <zeev@zend.com> |
17: +----------------------------------------------------------------------+
18: */
19:
20: /* $Id: zend_constants.h,v 1.1.1.4 2014/06/15 20:04:03 misho Exp $ */
21:
22: #ifndef ZEND_CONSTANTS_H
23: #define ZEND_CONSTANTS_H
24:
25: #include "zend_globals.h"
26:
27: #define CONST_CS (1<<0) /* Case Sensitive */
28: #define CONST_PERSISTENT (1<<1) /* Persistent */
29: #define CONST_CT_SUBST (1<<2) /* Allow compile-time substitution */
30:
31: #define PHP_USER_CONSTANT INT_MAX /* a constant defined in user space */
32:
33: typedef struct _zend_constant {
34: zval value;
35: int flags;
36: char *name;
37: uint name_len;
38: int module_number;
39: } zend_constant;
40:
41: #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
42: #define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC)
43: #define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC)
44: #define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC)
45:
46: #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)
47: #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)
48: #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)
49: #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)
50:
51: #define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC)
52: #define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC)
53: #define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC)
54: #define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), 0 TSRMLS_CC)
55:
56: BEGIN_EXTERN_C()
57: void clean_module_constants(int module_number TSRMLS_DC);
58: void free_zend_constant(zend_constant *c);
59: int zend_startup_constants(TSRMLS_D);
60: int zend_shutdown_constants(TSRMLS_D);
61: void zend_register_standard_constants(TSRMLS_D);
62: void clean_non_persistent_constants(TSRMLS_D);
63: ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC);
64: ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC);
65: ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC);
66: ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC);
67: ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC);
68: ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
69: ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
70: void zend_copy_constants(HashTable *target, HashTable *sourc);
71: void copy_zend_constant(zend_constant *c);
72: zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRMLS_DC);
73: END_EXTERN_C()
74:
75: #define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
76:
77: #endif
78:
79: /*
80: * Local variables:
81: * tab-width: 4
82: * c-basic-offset: 4
83: * indent-tabs-mode: t
84: * End:
85: */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>