"Marco Maggi" <[EMAIL PROTECTED]> writes:

>   So: is it mandatory to organise SCM values in the
> client data in a list and write the mark function to
> return the cons cells? That is the at the first invocation
> of the mark function we return the first cell and at
> subsequent invocations we return the cdr?

No.  If your client structure has n SCM slots, e.g.

struct client_data {
  int a;
  SCM b;
  char *c;
  SCM d;
  SCM e;
  float f[4];
  ...
}

your mark function just needs to call scm_gc_mark for each SCM:

client_mark (...)
{
  /* get client data pointer, then ... */
  scm_gc_mark (data->b);
  scm_gc_mark (data->d);
  scm_gc_mark (data->e);
  return SCM_BOOL_F;
}

If any of these SCMs is a compound object, scm_gc_mark will do the
recursion itself.

Did you try the documentation on this?  That should be easier than
trying to work it out from the code!  The relevant node is called
"Garbage Collecting Smobs".

      Neil



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to