gv_php_init.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. #include <php.h>
  11. #undef PACKAGE_BUGREPORT
  12. #undef PACKAGE_NAME
  13. #undef PACKAGE_STRING
  14. #undef PACKAGE_TARNAME
  15. #undef PACKAGE_VERSION
  16. #include <gvc/gvc.h>
  17. #include <gvc/gvplugin.h>
  18. #include <gvc/gvcjob.h>
  19. #include <gvc/gvcint.h>
  20. #include "gv_channel.h"
  21. static size_t gv_string_writer (GVJ_t *job, const char *s, size_t len)
  22. {
  23. (void)job;
  24. return PHPWRITE(s, len);
  25. }
  26. static size_t gv_channel_writer (GVJ_t *job, const char *s, size_t len)
  27. {
  28. (void)job;
  29. return PHPWRITE(s, len);
  30. }
  31. void gv_string_writer_init(GVC_t *gvc)
  32. {
  33. gvc->write_fn = gv_string_writer;
  34. }
  35. void gv_channel_writer_init(GVC_t *gvc)
  36. {
  37. gvc->write_fn = gv_channel_writer;
  38. }
  39. void gv_writer_reset (GVC_t *gvc) {gvc->write_fn = NULL;}