promises.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef SCM_PROMISES_H
  2. #define SCM_PROMISES_H
  3. /* Copyright 1995-1996,1998-2004,2008-2009,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/smob.h"
  18. /* {Promises}
  19. */
  20. #define SCM_F_PROMISE_COMPUTED (1L << 0)
  21. #define SCM_PROMISE_COMPUTED_P(promise) \
  22. (SCM_F_PROMISE_COMPUTED & SCM_SMOB_FLAGS (promise))
  23. #define SCM_SET_PROMISE_COMPUTED(promise) \
  24. SCM_SET_SMOB_FLAGS ((promise), SCM_F_PROMISE_COMPUTED)
  25. #define SCM_PROMISE_MUTEX SCM_SMOB_OBJECT_2
  26. #define SCM_PROMISE_DATA SCM_SMOB_OBJECT
  27. #define SCM_SET_PROMISE_DATA SCM_SET_SMOB_OBJECT
  28. SCM_API scm_t_bits scm_tc16_promise;
  29. SCM_API SCM scm_make_promise (SCM thunk);
  30. SCM_API SCM scm_force (SCM x);
  31. SCM_API SCM scm_promise_p (SCM x);
  32. SCM_INTERNAL void scm_init_promises (void);
  33. #endif /* SCM_PROMISES_H */