xref: /php-src/Zend/zend_globals_macros.h (revision 6335264c)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 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@php.net>                                 |
16    |          Zeev Suraski <zeev@php.net>                                 |
17    +----------------------------------------------------------------------+
18 */
19 
20 #ifndef ZEND_GLOBALS_MACROS_H
21 #define ZEND_GLOBALS_MACROS_H
22 
23 #include "zend_portability.h"
24 
25 typedef struct _zend_compiler_globals zend_compiler_globals;
26 typedef struct _zend_executor_globals zend_executor_globals;
27 typedef struct _zend_php_scanner_globals zend_php_scanner_globals;
28 typedef struct _zend_ini_scanner_globals zend_ini_scanner_globals;
29 
30 BEGIN_EXTERN_C()
31 
32 /* Compiler */
33 #ifdef ZTS
34 # define CG(v) ZEND_TSRMG_FAST(compiler_globals_offset, zend_compiler_globals *, v)
35 #else
36 # define CG(v) (compiler_globals.v)
37 extern ZEND_API struct _zend_compiler_globals compiler_globals;
38 #endif
39 ZEND_API int zendparse(void);
40 
41 
42 /* Executor */
43 #ifdef ZTS
44 # define EG(v) ZEND_TSRMG_FAST(executor_globals_offset, zend_executor_globals *, v)
45 #else
46 # define EG(v) (executor_globals.v)
47 extern ZEND_API zend_executor_globals executor_globals;
48 #endif
49 
50 /* Language Scanner */
51 #ifdef ZTS
52 # define LANG_SCNG(v) ZEND_TSRMG_FAST(language_scanner_globals_offset, zend_php_scanner_globals *, v)
53 extern ZEND_API ts_rsrc_id language_scanner_globals_id;
54 extern ZEND_API size_t language_scanner_globals_offset;
55 #else
56 # define LANG_SCNG(v) (language_scanner_globals.v)
57 extern ZEND_API zend_php_scanner_globals language_scanner_globals;
58 #endif
59 
60 
61 /* INI Scanner */
62 #ifdef ZTS
63 # define INI_SCNG(v) ZEND_TSRMG_FAST(ini_scanner_globals_offset, zend_ini_scanner_globals *, v)
64 extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
65 extern ZEND_API size_t ini_scanner_globals_offset;
66 #else
67 # define INI_SCNG(v) (ini_scanner_globals.v)
68 extern ZEND_API zend_ini_scanner_globals ini_scanner_globals;
69 #endif
70 
71 END_EXTERN_C()
72 
73 #endif /* ZEND_GLOBALS_MACROS_H */
74