strports.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef SCM_STRPORTS_H
  2. #define SCM_STRPORTS_H
  3. /* Copyright 1995-1996,2000-2002,2006,2008,2010-2011,2018
  4. Free Software Foundation, Inc.
  5. This file is part of Guile.
  6. Guile is free software: you can redistribute it and/or modify it
  7. under the terms of the GNU Lesser General Public License as published
  8. by the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Guile is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  13. License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with Guile. If not, see
  16. <https://www.gnu.org/licenses/>. */
  17. #include <libguile/error.h>
  18. #include <libguile/gc.h>
  19. #include <libguile/ports.h>
  20. #define SCM_STRPORTP(x) \
  21. (SCM_PORTP (x) && SCM_PORT_TYPE (x) == scm_string_port_type)
  22. #define SCM_OPSTRPORTP(x) (SCM_STRPORTP (x) && \
  23. (SCM_CELL_WORD_0 (x) & SCM_OPN))
  24. #define SCM_OPINSTRPORTP(x) (SCM_OPSTRPORTP (x) && \
  25. (SCM_CELL_WORD_0 (x) & SCM_RDNG))
  26. #define SCM_OPOUTSTRPORTP(x) (SCM_OPSTRPORTP (x) && \
  27. (SCM_CELL_WORD_0 (x) & SCM_WRTNG))
  28. #define SCM_VALIDATE_OPOUTSTRPORT(pos, port) \
  29. SCM_MAKE_VALIDATE_MSG (pos, port, OPOUTSTRPORTP, "open output string port")
  30. SCM_API scm_t_port_type *scm_string_port_type;
  31. SCM_API SCM scm_mkstrport (SCM pos, SCM str, long modes, const char * caller);
  32. SCM_API SCM scm_strport_to_string (SCM port);
  33. SCM_API SCM scm_object_to_string (SCM obj, SCM printer);
  34. SCM_API SCM scm_call_with_output_string (SCM proc);
  35. SCM_API SCM scm_call_with_input_string (SCM str, SCM proc);
  36. SCM_API SCM scm_open_input_string (SCM str);
  37. SCM_API SCM scm_open_output_string (void);
  38. SCM_API SCM scm_get_output_string (SCM port);
  39. SCM_API SCM scm_c_read_string (const char *expr);
  40. SCM_API SCM scm_c_eval_string (const char *expr);
  41. SCM_API SCM scm_c_eval_string_in_module (const char *expr, SCM module);
  42. SCM_API SCM scm_eval_string (SCM string);
  43. SCM_API SCM scm_eval_string_in_module (SCM string, SCM module);
  44. SCM_INTERNAL void scm_init_strports (void);
  45. #endif /* SCM_STRPORTS_H */