summaryrefslogtreecommitdiff
path: root/libguile/struct.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-01-23 16:41:28 +0100
committerLudovic Courtès <ludo@gnu.org>2010-01-23 16:41:28 +0100
commit696ac4dfcc4e48c95df8935fc3640377c5df18fb (patch)
treede573efad6db27c1e4bf31e9905a4c6f3f325709 /libguile/struct.c
parent01e74380f6170b5cb1105e5df9a368ab257420ef (diff)
downloadguile-696ac4dfcc4e48c95df8935fc3640377c5df18fb.tar.gz
Slightly improve comments and style in `struct.c'.
* libguile/struct.c (scm_i_struct_inherit_vtable_magic): Comment. Punctuate comments within the body, have them follow GCS. (scm_make_vtable_vtable): Clarify comments.
Diffstat (limited to 'libguile/struct.c')
-rw-r--r--libguile/struct.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libguile/struct.c b/libguile/struct.c
index 5b748095e..6340a700c 100644
--- a/libguile/struct.c
+++ b/libguile/struct.c
@@ -208,6 +208,8 @@ set_vtable_layout_flags (SCM vtable)
}
}
+/* Have OBJ, a newly created vtable, inherit flags from VTABLE. VTABLE is a
+ vtable-vtable and OBJ is an instance of VTABLE. */
void
scm_i_struct_inherit_vtable_magic (SCM vtable, SCM obj)
#define FUNC_NAME "%inherit-vtable-magic"
@@ -218,19 +220,18 @@ scm_i_struct_inherit_vtable_magic (SCM vtable, SCM obj)
Both of these questions also imply a certain layout of the structure. So
instead of checking the layout at runtime, what we do is pre-verify the
layout -- so that at runtime we can just check the applicable flag and
- dispatch directly to the Scheme procedure in slot 0.
- */
+ dispatch directly to the Scheme procedure in slot 0. */
SCM olayout;
- /* verify that obj is a valid vtable */
+ /* Verify that OBJ is a valid vtable. */
if (scm_is_false (scm_symbol_p (SCM_VTABLE_LAYOUT (obj))))
scm_misc_error (FUNC_NAME, "invalid layout for new vtable",
scm_list_1 (SCM_VTABLE_LAYOUT (obj)));
set_vtable_layout_flags (obj);
- /* if obj's vtable is compatible with the required vtable (class) layout, it
- is a metaclass */
+ /* If OBJ's vtable is compatible with the required vtable (class) layout, it
+ is a metaclass. */
olayout = scm_symbol_to_string (SCM_VTABLE_LAYOUT (obj));
if (scm_is_true (scm_leq_p (scm_string_length (required_vtable_fields),
scm_string_length (olayout)))
@@ -241,8 +242,8 @@ scm_i_struct_inherit_vtable_magic (SCM vtable, SCM obj)
scm_string_length (required_vtable_fields))))
SCM_SET_VTABLE_FLAGS (obj, SCM_VTABLE_FLAG_VTABLE);
- /* finally if obj is an applicable class, verify that its vtable is
- compatible with the required applicable layout */
+ /* Finally, if OBJ is an applicable class, verify that its vtable is
+ compatible with the required applicable layout. */
if (SCM_VTABLE_FLAG_IS_SET (vtable, SCM_VTABLE_FLAG_SETTER_VTABLE))
{
if (scm_is_false (scm_string_eq (olayout, required_applicable_with_setter_fields,
@@ -576,11 +577,8 @@ SCM_DEFINE (scm_make_vtable_vtable, "make-vtable-vtable", 2, 0, 1,
"@end lisp")
#define FUNC_NAME s_scm_make_vtable_vtable
{
- SCM fields;
- SCM layout;
- size_t basic_size;
- size_t n_tail, i, n_init;
- SCM obj;
+ SCM fields, layout, obj;
+ size_t basic_size, n_tail, i, n_init;
long ilen;
scm_t_bits *v;
@@ -611,11 +609,13 @@ SCM_DEFINE (scm_make_vtable_vtable, "make-vtable-vtable", 2, 0, 1,
SCM_CRITICAL_SECTION_START;
obj = scm_i_alloc_struct (NULL, basic_size + n_tail);
- /* magic magic magic */
- SCM_SET_CELL_WORD_0 (obj, (scm_t_bits)SCM_STRUCT_DATA (obj) | scm_tc3_struct);
+ /* Make it so that the vtable of OBJ is itself. */
+ SCM_SET_CELL_WORD_0 (obj, (scm_t_bits) SCM_STRUCT_DATA (obj) | scm_tc3_struct);
SCM_CRITICAL_SECTION_END;
+
scm_struct_init (obj, layout, n_tail, n_init, v);
SCM_SET_VTABLE_FLAGS (obj, SCM_VTABLE_FLAG_VTABLE);
+
return obj;
}
#undef FUNC_NAME