php_incomplete_class.h 2.2 KB

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