xref: /PHP-8.0/sapi/embed/php_embed.h (revision 5d6e923d)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
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: Edin Kadribasic <edink@php.net>                              |
14    +----------------------------------------------------------------------+
15 */
16 
17 #ifndef _PHP_EMBED_H_
18 #define _PHP_EMBED_H_
19 
20 #include <main/php.h>
21 #include <main/SAPI.h>
22 #include <main/php_main.h>
23 #include <main/php_variables.h>
24 #include <main/php_ini.h>
25 #include <zend_ini.h>
26 
27 #define PHP_EMBED_START_BLOCK(x,y) { \
28     php_embed_init(x, y); \
29     zend_first_try {
30 
31 #define PHP_EMBED_END_BLOCK() \
32   } zend_catch { \
33     /* int exit_status = EG(exit_status); */ \
34   } zend_end_try(); \
35   php_embed_shutdown(); \
36 }
37 
38 #ifndef PHP_WIN32
39     #define EMBED_SAPI_API SAPI_API
40 #else
41     #define EMBED_SAPI_API
42 #endif
43 
44 #ifdef ZTS
45 ZEND_TSRMLS_CACHE_EXTERN()
46 #endif
47 
48 BEGIN_EXTERN_C()
49 EMBED_SAPI_API int php_embed_init(int argc, char **argv);
50 EMBED_SAPI_API void php_embed_shutdown(void);
51 extern EMBED_SAPI_API sapi_module_struct php_embed_module;
52 END_EXTERN_C()
53 
54 
55 #endif /* _PHP_EMBED_H_ */
56