xref: /PHP-7.1/sapi/embed/php_embed.h (revision ccd4716e)
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 /* $Id$ */
19 
20 #ifndef _PHP_EMBED_H_
21 #define _PHP_EMBED_H_
22 
23 #include <main/php.h>
24 #include <main/SAPI.h>
25 #include <main/php_main.h>
26 #include <main/php_variables.h>
27 #include <main/php_ini.h>
28 #include <zend_ini.h>
29 
30 #define PHP_EMBED_START_BLOCK(x,y) { \
31     php_embed_init(x, y); \
32     zend_first_try {
33 
34 #define PHP_EMBED_END_BLOCK() \
35   } zend_catch { \
36     /* int exit_status = EG(exit_status); */ \
37   } zend_end_try(); \
38   php_embed_shutdown(); \
39 }
40 
41 #ifndef PHP_WIN32
42     #define EMBED_SAPI_API SAPI_API
43 #else
44     #define EMBED_SAPI_API
45 #endif
46 
47 #ifdef ZTS
48 ZEND_TSRMLS_CACHE_EXTERN()
49 #endif
50 
51 BEGIN_EXTERN_C()
52 EMBED_SAPI_API int php_embed_init(int argc, char **argv);
53 EMBED_SAPI_API void php_embed_shutdown(void);
54 extern EMBED_SAPI_API sapi_module_struct php_embed_module;
55 END_EXTERN_C()
56 
57 
58 #endif /* _PHP_EMBED_H_ */
59