php_embed.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 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. #ifndef _PHP_EMBED_H_
  20. #define _PHP_EMBED_H_
  21. #include <main/php.h>
  22. #include <main/SAPI.h>
  23. #include <main/php_main.h>
  24. #include <main/php_variables.h>
  25. #include <main/php_ini.h>
  26. #include <zend_ini.h>
  27. #ifdef ZTS
  28. #define PTSRMLS_D void ****ptsrm_ls
  29. #define PTSRMLS_DC , PTSRMLS_D
  30. #define PTSRMLS_C &tsrm_ls
  31. #define PTSRMLS_CC , PTSRMLS_C
  32. #define PHP_EMBED_START_BLOCK(x,y) { \
  33. void ***tsrm_ls; \
  34. php_embed_init(x, y PTSRMLS_CC); \
  35. zend_first_try {
  36. #else
  37. #define PTSRMLS_D
  38. #define PTSRMLS_DC
  39. #define PTSRMLS_C
  40. #define PTSRMLS_CC
  41. #define PHP_EMBED_START_BLOCK(x,y) { \
  42. php_embed_init(x, y); \
  43. zend_first_try {
  44. #endif
  45. #define PHP_EMBED_END_BLOCK() \
  46. } zend_catch { \
  47. /* int exit_status = EG(exit_status); */ \
  48. } zend_end_try(); \
  49. php_embed_shutdown(TSRMLS_C); \
  50. }
  51. #ifndef PHP_WIN32
  52. #define EMBED_SAPI_API SAPI_API
  53. #else
  54. #define EMBED_SAPI_API
  55. #endif
  56. BEGIN_EXTERN_C()
  57. EMBED_SAPI_API int php_embed_init(int argc, char **argv PTSRMLS_DC);
  58. EMBED_SAPI_API void php_embed_shutdown(TSRMLS_D);
  59. extern EMBED_SAPI_API sapi_module_struct php_embed_module;
  60. END_EXTERN_C()
  61. #endif /* _PHP_EMBED_H_ */