From bb190ddbba216251f2a8490adf9feadf0dbb7104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 25 Jan 2010 23:43:41 +0100 Subject: [PATCH] Add ASCII art representing the basic struct layout. * libguile/struct.h: Add ASCII art version of the basic struct layout as shown in Andy's diagrams. --- libguile/struct.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/libguile/struct.h b/libguile/struct.h index 012d9b6e7..374a5ce74 100644 --- a/libguile/struct.h +++ b/libguile/struct.h @@ -33,9 +33,37 @@ in turn means we need support for changing the "class" (vtable) of an "instance" (struct). This necessitates some indirection and trickery. - I would like to write this all up here, but for now: + To summarize, structs are laid out this way: + + .-------. + | | + .----------------+---v------------- - + | vtable | data | slot0 | slot1 | + `----------------+----------------- - + | .-------. + | | | + .---v------------+---v------------- - + | vtable | data | slot0 | slot1 | + `----------------+----------------- - + | + v + + ... + .-------. + | | | + .---v------------+---v------------- - + .-| vtable | data | slot0 | slot1 | + | `----------------+----------------- - + | ^ + `-----' + + The DATA indirection (which corresponds to `SCM_STRUCT_DATA ()') is necessary + to implement class redefinition. + + For more details, see: http://wingolog.org/archives/2009/11/09/class-redefinition-in-guile + */ /* All vtables have the following fields. */