vports.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Copyright 1995-1996,1998-2003,2006,2009-2011,2013,2018,2023
  2. Free Software Foundation, Inc.
  3. This file is part of Guile.
  4. Guile is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Lesser General Public License as published
  6. by the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Guile is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  11. License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with Guile. If not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifdef HAVE_CONFIG_H
  16. # include <config.h>
  17. #endif
  18. #include "eval.h"
  19. #include "modules.h"
  20. #include "threads.h"
  21. #include "variable.h"
  22. #include "vports.h"
  23. static SCM make_soft_port_var;
  24. static void
  25. init_make_soft_port_var (void)
  26. {
  27. make_soft_port_var =
  28. scm_c_public_variable ("ice-9 soft-ports", "make-soft-port");
  29. }
  30. SCM
  31. scm_make_soft_port (SCM pv, SCM modes)
  32. {
  33. static scm_i_pthread_once_t once = SCM_I_PTHREAD_ONCE_INIT;
  34. scm_i_pthread_once (&once, init_make_soft_port_var);
  35. return scm_call_2 (scm_variable_ref (make_soft_port_var), pv, modes);
  36. }