api-scm.texi 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. @node The SCM Type
  7. @section The SCM Type
  8. Guile represents all Scheme values with the single C type @code{SCM}.
  9. For an introduction to this topic, @xref{Dynamic Types}.
  10. @deftp {C Type} SCM
  11. @code{SCM} is the user level abstract C type that is used to represent
  12. all of Guile's Scheme objects, no matter what the Scheme object type is.
  13. No C operation except assignment is guaranteed to work with variables of
  14. type @code{SCM}, so you should only use macros and functions to work
  15. with @code{SCM} values. Values are converted between C data types and
  16. the @code{SCM} type with utility functions and macros.
  17. @end deftp
  18. @cindex SCM data type
  19. @deftp {C Type} scm_t_bits
  20. @code{scm_t_bits} is an unsigned integral data type that is guaranteed
  21. to be large enough to hold all information that is required to
  22. represent any Scheme object. While this data type is mostly used to
  23. implement Guile's internals, the use of this type is also necessary to
  24. write certain kinds of extensions to Guile.
  25. @end deftp
  26. @deftp {C Type} scm_t_signed_bits
  27. This is a signed integral type of the same size as @code{scm_t_bits}.
  28. @end deftp
  29. @deftypefn {C Macro} scm_t_bits SCM_UNPACK (SCM @var{x})
  30. Transforms the @code{SCM} value @var{x} into its representation as an
  31. integral type. Only after applying @code{SCM_UNPACK} it is possible to
  32. access the bits and contents of the @code{SCM} value.
  33. @end deftypefn
  34. @deftypefn {C Macro} SCM SCM_PACK (scm_t_bits @var{x})
  35. Takes a valid integral representation of a Scheme object and transforms
  36. it into its representation as a @code{SCM} value.
  37. @end deftypefn