v8js_v8object_class.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2013 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | http://www.opensource.org/licenses/mit-license.php MIT License |
  8. +----------------------------------------------------------------------+
  9. | Author: Jani Taskinen <[email protected]> |
  10. | Author: Patrick Reilly <[email protected]> |
  11. +----------------------------------------------------------------------+
  12. */
  13. #ifndef V8JS_V8OBJECT_CLASS_H
  14. #define V8JS_V8OBJECT_CLASS_H
  15. /* {{{ Object container */
  16. struct v8js_v8object {
  17. v8::Persistent<v8::Value> v8obj;
  18. int flags;
  19. struct v8js_ctx *ctx;
  20. HashTable *properties;
  21. zend_object std;
  22. };
  23. /* }}} */
  24. /* {{{ Generator container */
  25. struct v8js_v8generator {
  26. zval value;
  27. bool primed;
  28. bool done;
  29. struct v8js_v8object v8obj;
  30. };
  31. /* }}} */
  32. extern zend_class_entry *php_ce_v8object;
  33. extern zend_class_entry *php_ce_v8function;
  34. extern zend_class_entry *php_ce_v8generator;
  35. /* Create PHP V8 object */
  36. void v8js_v8object_create(zval *, v8::Handle<v8::Value>, int, v8::Isolate * TSRMLS_DC);
  37. static inline v8js_v8object *v8js_v8object_fetch_object(zend_object *obj) {
  38. return (v8js_v8object *)((char *)obj - XtOffsetOf(struct v8js_v8object, std));
  39. }
  40. #define Z_V8JS_V8OBJECT_OBJ_P(zv) v8js_v8object_fetch_object(Z_OBJ_P(zv));
  41. static inline v8js_v8generator *v8js_v8generator_fetch_object(zend_object *obj) {
  42. return (v8js_v8generator *)((char *)obj - XtOffsetOf(struct v8js_v8generator, v8obj.std));
  43. }
  44. #define Z_V8JS_V8GENERATOR_OBJ_P(zv) v8js_v8generator_fetch_object(Z_OBJ_P(zv));
  45. PHP_MINIT_FUNCTION(v8js_v8object_class);
  46. #endif /* V8JS_V8OBJECT_CLASS_H */
  47. /*
  48. * Local variables:
  49. * tab-width: 4
  50. * c-basic-offset: 4
  51. * End:
  52. * vim600: noet sw=4 ts=4 fdm=marker
  53. * vim<600: noet sw=4 ts=4
  54. */