php_embed.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. | https://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. #ifndef _PHP_EMBED_H_
  17. #define _PHP_EMBED_H_
  18. #include <main/php.h>
  19. #include <main/SAPI.h>
  20. #include <main/php_main.h>
  21. #include <main/php_variables.h>
  22. #include <main/php_ini.h>
  23. #include <zend_ini.h>
  24. #define PHP_EMBED_START_BLOCK(x,y) { \
  25. php_embed_init(x, y); \
  26. zend_first_try {
  27. #define PHP_EMBED_END_BLOCK() \
  28. } zend_catch { \
  29. /* int exit_status = EG(exit_status); */ \
  30. } zend_end_try(); \
  31. php_embed_shutdown(); \
  32. }
  33. #ifndef PHP_WIN32
  34. #define EMBED_SAPI_API SAPI_API
  35. #else
  36. #define EMBED_SAPI_API
  37. #endif
  38. #ifdef ZTS
  39. ZEND_TSRMLS_CACHE_EXTERN()
  40. #endif
  41. BEGIN_EXTERN_C()
  42. EMBED_SAPI_API int php_embed_init(int argc, char **argv);
  43. EMBED_SAPI_API void php_embed_shutdown(void);
  44. extern EMBED_SAPI_API sapi_module_struct php_embed_module;
  45. END_EXTERN_C()
  46. #endif /* _PHP_EMBED_H_ */