php_incomplete_class.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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: Sascha Schumann <sascha@schumann.cx> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_INCOMPLETE_CLASS_H
  19. #define PHP_INCOMPLETE_CLASS_H
  20. #include "ext/standard/basic_functions.h"
  21. #define PHP_IC_ENTRY \
  22. BG(incomplete_class)
  23. #define PHP_SET_CLASS_ATTRIBUTES(struc) \
  24. /* OBJECTS_FIXME: Fix for new object model */ \
  25. if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \
  26. class_name = php_lookup_class_name(struc); \
  27. if (!class_name) { \
  28. class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
  29. } \
  30. incomplete_class = 1; \
  31. } else { \
  32. class_name = zend_string_copy(Z_OBJCE_P(struc)->name); \
  33. }
  34. #define PHP_CLEANUP_CLASS_ATTRIBUTES() \
  35. zend_string_release_ex(class_name, 0)
  36. #define PHP_CLASS_ATTRIBUTES \
  37. zend_string *class_name; \
  38. zend_bool incomplete_class ZEND_ATTRIBUTE_UNUSED = 0
  39. #define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
  40. #define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. PHPAPI zend_class_entry *php_create_incomplete_class(void);
  45. PHPAPI zend_string *php_lookup_class_name(zval *object);
  46. PHPAPI void php_store_class_name(zval *object, const char *name, size_t len);
  47. #ifdef __cplusplus
  48. };
  49. #endif
  50. #endif