| 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Guile Reference Manual. |
| 3 | @c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004 |
| 4 | @c Free Software Foundation, Inc. |
| 5 | @c See the file guile.texi for copying conditions. |
| 6 | |
| 7 | |
| 8 | @node The SCM Type |
| 9 | @section The SCM Type |
| 10 | |
| 11 | Guile represents all Scheme values with the single C type @code{SCM}. |
| 12 | For an introduction to this topic, @xref{Dynamic Types}. |
| 13 | |
| 14 | @deftp {C Type} SCM |
| 15 | @code{SCM} is the user level abstract C type that is used to represent |
| 16 | all of Guile's Scheme objects, no matter what the Scheme object type is. |
| 17 | No C operation except assignment is guaranteed to work with variables of |
| 18 | type @code{SCM}, so you should only use macros and functions to work |
| 19 | with @code{SCM} values. Values are converted between C data types and |
| 20 | the @code{SCM} type with utility functions and macros. |
| 21 | @end deftp |
| 22 | @cindex SCM data type |
| 23 | |
| 24 | @deftp {C Type} scm_t_bits |
| 25 | @code{scm_t_bits} is an unsigned integral data type that is guaranteed |
| 26 | to be large enough to hold all information that is required to |
| 27 | represent any Scheme object. While this data type is mostly used to |
| 28 | implement Guile's internals, the use of this type is also necessary to |
| 29 | write certain kinds of extensions to Guile. |
| 30 | @end deftp |
| 31 | |
| 32 | @deftp {C Type} scm_t_signed_bits |
| 33 | This is a signed integral type of the same size as @code{scm_t_bits}. |
| 34 | @end deftp |
| 35 | |
| 36 | @deftypefn {C Macro} scm_t_bits SCM_UNPACK (SCM @var{x}) |
| 37 | Transforms the @code{SCM} value @var{x} into its representation as an |
| 38 | integral type. Only after applying @code{SCM_UNPACK} it is possible to |
| 39 | access the bits and contents of the @code{SCM} value. |
| 40 | @end deftypefn |
| 41 | |
| 42 | @deftypefn {C Macro} SCM SCM_PACK (scm_t_bits @var{x}) |
| 43 | Takes a valid integral representation of a Scheme object and transforms |
| 44 | it into its representation as a @code{SCM} value. |
| 45 | @end deftypefn |