1 #ifndef SCM_VALUES_H
2 #define SCM_VALUES_H
3 
4 /* Copyright 2000-2001,2006,2008,2012,2018
5      Free Software Foundation, Inc.
6 
7    This file is part of Guile.
8 
9    Guile is free software: you can redistribute it and/or modify it
10    under the terms of the GNU Lesser General Public License as published
11    by the Free Software Foundation, either version 3 of the License, or
12    (at your option) any later version.
13 
14    Guile is distributed in the hope that it will be useful, but WITHOUT
15    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17    License for more details.
18 
19    You should have received a copy of the GNU Lesser General Public
20    License along with Guile.  If not, see
21    <https://www.gnu.org/licenses/>.  */
22 
23 
24 
25 #include "libguile/gc.h"
26 
27 static inline int
scm_is_values(SCM x)28 scm_is_values (SCM x)
29 {
30   return SCM_HAS_TYP7 (x, scm_tc7_values);
31 }
32 
33 #ifdef BUILDING_LIBGUILE
34 static inline size_t
scm_i_nvalues(SCM x)35 scm_i_nvalues (SCM x)
36 {
37   return SCM_CELL_WORD_0 (x) >> 8;
38 }
39 
40 static inline SCM
scm_i_value_ref(SCM x,size_t n)41 scm_i_value_ref (SCM x, size_t n)
42 {
43   return SCM_CELL_OBJECT (x, n+1);
44 }
45 #endif
46 
47 #define SCM_VALUESP(x) (scm_is_values (x))
48 
49 SCM_INTERNAL void scm_i_extract_values_2 (SCM obj, SCM *p1, SCM *p2);
50 
51 SCM_API SCM scm_values (SCM args);
52 SCM_API SCM scm_c_values (SCM *base, size_t n);
53 SCM_API SCM scm_values_2 (SCM a, SCM b);
54 SCM_API SCM scm_values_3 (SCM a, SCM b, SCM c);
55 SCM_API size_t scm_c_nvalues (SCM obj);
56 SCM_API SCM scm_c_value_ref (SCM obj, size_t idx);
57 SCM_INTERNAL void scm_init_values (void);
58 
59 #endif  /* SCM_VALUES_H */
60