summaryrefslogtreecommitdiff
path: root/libguile/struct.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/struct.c')
-rw-r--r--libguile/struct.c187
1 files changed, 85 insertions, 102 deletions
diff --git a/libguile/struct.c b/libguile/struct.c
index a920179e3..f70039fb0 100644
--- a/libguile/struct.c
+++ b/libguile/struct.c
@@ -68,16 +68,15 @@ SCM scm_struct_table;
SCM_DEFINE (scm_make_struct_layout, "make-struct-layout", 1, 0, 0,
(SCM fields),
-"Return a new structure layout object.
-
-@var{fields} must be a read-only string made up of pairs of characters
-strung together. The first character of each pair describes a field
-type, the second a field protection. Allowed types are 'p' for
-GC-protected Scheme data, 'u' for unprotected binary data, and 's' for
-fields that should point to the structure itself. Allowed protections
-are 'w' for mutable fields, 'r' for read-only fields, and 'o' for opaque
-fields. The last field protection specification may be capitalized to
-indicate that the field is a tail-array.")
+ "Return a new structure layout object.\n\n"
+ "@var{fields} must be a read-only string made up of pairs of characters\n"
+ "strung together. The first character of each pair describes a field\n"
+ "type, the second a field protection. Allowed types are 'p' for\n"
+ "GC-protected Scheme data, 'u' for unprotected binary data, and 's' for\n"
+ "fields that should point to the structure itself. Allowed protections\n"
+ "are 'w' for mutable fields, 'r' for read-only fields, and 'o' for opaque \n"
+ "fields. The last field protection specification may be capitalized to\n"
+ "indicate that the field is a tail-array.")
#define FUNC_NAME s_scm_make_struct_layout
{
SCM new_sym;
@@ -242,7 +241,7 @@ scm_struct_init (SCM handle, int tail_elts, SCM inits)
SCM_DEFINE (scm_struct_p, "struct?", 1, 0, 0,
(SCM x),
-"Return #t iff @var{obj} is a structure object, else #f.")
+ "Return #t iff @var{obj} is a structure object, else #f.")
#define FUNC_NAME s_scm_struct_p
{
return SCM_BOOL(SCM_STRUCTP (x));
@@ -251,7 +250,7 @@ SCM_DEFINE (scm_struct_p, "struct?", 1, 0, 0,
SCM_DEFINE (scm_struct_vtable_p, "struct-vtable?", 1, 0, 0,
(SCM x),
-"Return #t iff obj is a vtable structure.")
+ "Return #t iff obj is a vtable structure.")
#define FUNC_NAME s_scm_struct_vtable_p
{
SCM layout;
@@ -369,19 +368,16 @@ scm_struct_free_entity (SCM *vtable, SCM *data)
SCM_DEFINE (scm_make_struct, "make-struct", 2, 0, 1,
(SCM vtable, SCM tail_array_size, SCM init),
-"Create a new structure.
-
-@var{type} must be a vtable structure (@xref{Vtables}).
-
-@var{tail-elts} must be a non-negative integer. If the layout
-specification indicated by @var{type} includes a tail-array,
-this is the number of elements allocated to that array.
-
-The @var{inits} are optional arguments describing how successive fields
-of the structure should be initialized. Only fields with protection 'r'
-or 'w' can be initialized -- fields of protection 's' are automatically
-initialized to point to the new structure itself; fields of protection 'o'
-can not be initialized by Scheme programs.")
+ "Create a new structure.\n\n"
+ "@var{type} must be a vtable structure (@xref{Vtables}).\n\n"
+ "@var{tail-elts} must be a non-negative integer. If the layout\n"
+ "specification indicated by @var{type} includes a tail-array,\n"
+ "this is the number of elements allocated to that array.\n\n"
+ "The @var{inits} are optional arguments describing how successive fields\n"
+ "of the structure should be initialized. Only fields with protection 'r'\n"
+ "or 'w' can be initialized -- fields of protection 's' are automatically\n"
+ "initialized to point to the new structure itself; fields of protection 'o'\n"
+ "can not be initialized by Scheme programs.")
#define FUNC_NAME s_scm_make_struct
{
SCM layout;
@@ -422,71 +418,60 @@ can not be initialized by Scheme programs.")
SCM_DEFINE (scm_make_vtable_vtable, "make-vtable-vtable", 2, 0, 1,
(SCM extra_fields, SCM tail_array_size, SCM init),
-"Return a new, self-describing vtable structure.
-
-@var{new-fields} is a layout specification describing fields
-of the resulting structure beginning at the position bound to
-@code{vtable-offset-user}.
-
-@var{tail-size} specifies the size of the tail-array (if any) of
-this vtable.
-
-@var{inits} initializes the fields of the vtable. Minimally, one
-initializer must be provided: the layout specification for instances
-of the type this vtable will describe. If a second initializer is
-provided, it will be interpreted as a print call-back function.
-
-@example
-;;; loading ,a...
-(define x
- (make-vtable-vtable (make-struct-layout (quote pw))
- 0
- 'foo))
-
-(struct? x)
-@result{} #t
-(struct-vtable? x)
-@result{} #t
-(eq? x (struct-vtable x))
-@result{} #t
-(struct-ref x vtable-offset-user)
-@result{} foo
-(struct-ref x 0)
-@result{} pruosrpwpw
-
-
-(define y
- (make-struct x
- 0
- (make-struct-layout (quote pwpwpw))
- 'bar))
-
-(struct? y)
-@result{} #t
-(struct-vtable? y)
-@result{} #t
-(eq? x y)
-@result{} ()
-(eq? x (struct-vtable y))
-@result{} #t
-(struct-ref y 0)
-@result{} pwpwpw
-(struct-ref y vtable-offset-user)
-@result{} bar
-
-
-(define z (make-struct y 0 'a 'b 'c))
-
-(struct? z)
-@result{} #t
-(struct-vtable? z)
-@result{} ()
-(eq? y (struct-vtable z))
-@result{} #t
-(map (lambda (n) (struct-ref z n)) '(0 1 2))
-@result{} (a b c)
-@end example
-")
+ "Return a new, self-describing vtable structure.\n\n"
+ "@var{new-fields} is a layout specification describing fields\n"
+ "of the resulting structure beginning at the position bound to\n"
+ "@code{vtable-offset-user}.\n\n"
+ "@var{tail-size} specifies the size of the tail-array (if any) of\n"
+ "this vtable.\n\n"
+ "@var{inits} initializes the fields of the vtable. Minimally, one\n"
+ "initializer must be provided: the layout specification for instances\n"
+ "of the type this vtable will describe. If a second initializer is\n"
+ "provided, it will be interpreted as a print call-back function.\n\n"
+ "@example\n"
+ ";;; loading ,a...\n"
+ "(define x\n"
+ " (make-vtable-vtable (make-struct-layout (quote pw))\n"
+ " 0\n"
+ " 'foo))\n\n"
+ "(struct? x)\n"
+ "@result{} #t\n"
+ "(struct-vtable? x)\n"
+ "@result{} #t\n"
+ "(eq? x (struct-vtable x))\n"
+ "@result{} #t\n"
+ "(struct-ref x vtable-offset-user)\n"
+ "@result{} foo\n"
+ "(struct-ref x 0)\n"
+ "@result{} pruosrpwpw\n\n\n"
+ "(define y\n"
+ " (make-struct x\n"
+ " 0\n"
+ " (make-struct-layout (quote pwpwpw))\n"
+ " 'bar))\n\n"
+ "(struct? y)\n"
+ "@result{} #t\n"
+ "(struct-vtable? y)\n"
+ "@result{} #t\n"
+ "(eq? x y)\n"
+ "@result{} ()\n"
+ "(eq? x (struct-vtable y))\n"
+ "@result{} #t\n"
+ "(struct-ref y 0)\n"
+ "@result{} pwpwpw\n"
+ "(struct-ref y vtable-offset-user)\n"
+ "@result{} bar\n\n\n"
+ "(define z (make-struct y 0 'a 'b 'c))\n\n"
+ "(struct? z)\n"
+ "@result{} #t\n"
+ "(struct-vtable? z)\n"
+ "@result{} ()\n"
+ "(eq? y (struct-vtable z))\n"
+ "@result{} #t\n"
+ "(map (lambda (n) (struct-ref z n)) '(0 1 2))\n"
+ "@result{} (a b c)\n"
+ "@end example\n"
+ "")
#define FUNC_NAME s_scm_make_vtable_vtable
{
SCM fields;
@@ -524,13 +509,11 @@ provided, it will be interpreted as a print call-back function.
SCM_DEFINE (scm_struct_ref, "struct-ref", 2, 0, 0,
(SCM handle, SCM pos),
-"@deffnx primitive struct-set! struct n value
-Access (or modify) the @var{n}th field of @var{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.")
+ "@deffnx primitive struct-set! struct n value\n"
+ "Access (or modify) the @var{n}th field of @var{struct}.\n\n"
+ "If the field is of type 'p', then it can be set to an arbitrary value.\n\n"
+ "If the field is of type 'u', then it can only be set to a non-negative\n"
+ "integer value small enough to fit in one machine word.")
#define FUNC_NAME s_scm_struct_ref
{
SCM answer = SCM_UNDEFINED;
@@ -609,7 +592,7 @@ integer value small enough to fit in one machine word.")
SCM_DEFINE (scm_struct_set_x, "struct-set!", 3, 0, 0,
(SCM handle, SCM pos, SCM val),
-"")
+ "")
#define FUNC_NAME s_scm_struct_set_x
{
SCM * data;
@@ -683,7 +666,7 @@ SCM_DEFINE (scm_struct_set_x, "struct-set!", 3, 0, 0,
SCM_DEFINE (scm_struct_vtable, "struct-vtable", 1, 0, 0,
(SCM handle),
-"Return the vtable structure that describes the type of @var{struct}.")
+ "Return the vtable structure that describes the type of @var{struct}.")
#define FUNC_NAME s_scm_struct_vtable
{
SCM_VALIDATE_STRUCT (1,handle);
@@ -694,7 +677,7 @@ SCM_DEFINE (scm_struct_vtable, "struct-vtable", 1, 0, 0,
SCM_DEFINE (scm_struct_vtable_tag, "struct-vtable-tag", 1, 0, 0,
(SCM handle),
-"")
+ "")
#define FUNC_NAME s_scm_struct_vtable_tag
{
SCM_VALIDATE_VTABLE (1,handle);
@@ -733,7 +716,7 @@ scm_struct_create_handle (SCM obj)
SCM_DEFINE (scm_struct_vtable_name, "struct-vtable-name", 1, 0, 0,
(SCM vtable),
-"")
+ "")
#define FUNC_NAME s_scm_struct_vtable_name
{
SCM_VALIDATE_VTABLE (1,vtable);
@@ -743,7 +726,7 @@ SCM_DEFINE (scm_struct_vtable_name, "struct-vtable-name", 1, 0, 0,
SCM_DEFINE (scm_set_struct_vtable_name_x, "set-struct-vtable-name!", 2, 0, 0,
(SCM vtable, SCM name),
-"")
+ "")
#define FUNC_NAME s_scm_set_struct_vtable_name_x
{
SCM_VALIDATE_VTABLE (1,vtable);