xref: /PHP-7.3/sapi/embed/php_embed.h (revision 8d3f8ca1)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 The PHP Group                                |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author: Edin Kadribasic <edink@php.net>                              |
16    +----------------------------------------------------------------------+
17 */
18 
19 #ifndef _PHP_EMBED_H_
20 #define _PHP_EMBED_H_
21 
22 #include <main/php.h>
23 #include <main/SAPI.h>
24 #include <main/php_main.h>
25 #include <main/php_variables.h>
26 #include <main/php_ini.h>
27 #include <zend_ini.h>
28 
29 #define PHP_EMBED_START_BLOCK(x,y) { \
30     php_embed_init(x, y); \
31     zend_first_try {
32 
33 #define PHP_EMBED_END_BLOCK() \
34   } zend_catch { \
35     /* int exit_status = EG(exit_status); */ \
36   } zend_end_try(); \
37   php_embed_shutdown(); \
38 }
39 
40 #ifndef PHP_WIN32
41     #define EMBED_SAPI_API SAPI_API
42 #else
43     #define EMBED_SAPI_API
44 #endif
45 
46 #ifdef ZTS
47 ZEND_TSRMLS_CACHE_EXTERN()
48 #endif
49 
50 BEGIN_EXTERN_C()
51 EMBED_SAPI_API int php_embed_init(int argc, char **argv);
52 EMBED_SAPI_API void php_embed_shutdown(void);
53 extern EMBED_SAPI_API sapi_module_struct php_embed_module;
54 END_EXTERN_C()
55 
56 
57 #endif /* _PHP_EMBED_H_ */
58