values.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef SCM_VALUES_H
  2. #define SCM_VALUES_H
  3. /* Copyright 2000-2001,2006,2008,2012,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/gc.h"
  18. static inline int
  19. scm_is_values (SCM x)
  20. {
  21. return SCM_HAS_TYP7 (x, scm_tc7_values);
  22. }
  23. #ifdef BUILDING_LIBGUILE
  24. static inline size_t
  25. scm_i_nvalues (SCM x)
  26. {
  27. return SCM_CELL_WORD_0 (x) >> 8;
  28. }
  29. static inline SCM
  30. scm_i_value_ref (SCM x, size_t n)
  31. {
  32. return SCM_CELL_OBJECT (x, n+1);
  33. }
  34. #endif
  35. #define SCM_VALUESP(x) (scm_is_values (x))
  36. SCM_INTERNAL void scm_i_extract_values_2 (SCM obj, SCM *p1, SCM *p2);
  37. SCM_API SCM scm_values (SCM args);
  38. SCM_API SCM scm_c_values (SCM *base, size_t n);
  39. SCM_API SCM scm_values_2 (SCM a, SCM b);
  40. SCM_API SCM scm_values_3 (SCM a, SCM b, SCM c);
  41. SCM_API size_t scm_c_nvalues (SCM obj);
  42. SCM_API SCM scm_c_value_ref (SCM obj, size_t idx);
  43. SCM_INTERNAL void scm_init_values (void);
  44. #endif /* SCM_VALUES_H */