DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(guile.info.gz) Structure Basics

Info Catalog (guile.info.gz) Structure Layout (guile.info.gz) Structures (guile.info.gz) Vtables
 
 22.5.3 Structure Basics
 -----------------------
 
 This section describes the basic procedures for creating and accessing
 structures.
 
  -- Scheme Procedure: make-struct vtable tail_array_size . init
  -- C Function: scm_make_struct (vtable, tail_array_size, init)
      Create a new structure.
 
      TYPE must be a vtable structure ( Vtables).
 
      TAIL-ELTS must be a non-negative integer.  If the layout
      specification indicated by TYPE includes a tail-array, this is the
      number of elements allocated to that array.
 
      The INIT1, ... are optional arguments describing how successive
      fields of the structure should be initialized.  Only fields with
      protection 'r' or 'w' can be initialized, except for fields of
      type 's', which are automatically initialized to point to the new
      structure itself; fields with protection 'o' can not be
      initialized by Scheme programs.
 
      If fewer optional arguments than initializable fields are supplied,
      fields of type 'p' get default value #f while fields of type 'u'
      are initialized to 0.
 
      Structs are currently the basic representation for record-like data
      structures in Guile.  The plan is to eventually replace them with a
      new representation which will at the same time be easier to use and
      more powerful.
 
      For more information, see the documentation for
      `make-vtable-vtable'.
 
  -- Scheme Procedure: struct? x
  -- C Function: scm_struct_p (x)
      Return `#t' iff X is a structure object, else `#f'.
 
  -- Scheme Procedure: struct-ref handle pos
  -- Scheme Procedure: struct-set! struct n value
  -- C Function: scm_struct_ref (handle, pos)
  -- C Function: scm_struct_set_x (struct, n, value)
      Access (or modify) the Nth field of STRUCT.
 
      If the field is of type 'p', then it can be set to an arbitrary
      value.
 
      If the field is of type 'u', then it can only be set to a
      non-negative integer value small enough to fit in one machine word.
 
Info Catalog (guile.info.gz) Structure Layout (guile.info.gz) Structures (guile.info.gz) Vtables
automatically generated byinfo2html