This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Use of SCM_CHARS in continuations.h


Hi!

In continuations.h there are the following definitions:

#define SCM_JMPBUF(x) (((scm_contregs *)SCM_CHARS(x))->jmpbuf)
#define SCM_SETJMPBUF(z, x) SCM_SETCDR (z, (SCM) x)
#define SCM_DYNENV(x) (((scm_contregs *)SCM_CHARS(x))->dynenv)
#define SCM_THROW_VALUE(x) (((scm_contregs *)SCM_CHARS(x))->throw_value)
#define SCM_BASE(x) (((scm_contregs *)SCM_CHARS(x))->base)
#define SCM_SEQ(x) (((scm_contregs *)SCM_CHARS(x))->seq)
#define SCM_DFRAME(x) (((scm_contregs *)SCM_CHARS(x))->dframe)

It looks like SCM_CHARS is used as a replacement for SCM_CDR, or in
this case better SCM_CELL_WORD_1.  Also, I find it quite irritating that
the macros JMPBUF and SETJMPBUF are not symmetrical.  I suggest (as a
start, the names could all need some improvement I think):

#define SCM_CONTREGS(x)         ((scm_contregs *) SCM_CELL_WORD_1 (x))
#define SCM_SET_CONTREGS(x, r)  (SCM_SET_CELL_WORD_1 (x, (scm_bits_t) r))
#define SCM_SETJMPBUF(x, r)     (SCM_SET_CONTREGS (x, r)) /* deprecated */

#define SCM_JMPBUF(x)           ((SCM_CONTREGS (x))->jmpbuf)
#define SCM_DYNENV(x)           ((SCM_CONTREGS (x))->dynenv)
#define SCM_THROW_VALUE(x)      ((SCM_CONTREGS (x))->throw_value)
#define SCM_BASE(x)             ((SCM_CONTREGS (x))->base)
#define SCM_SEQ(x)              ((SCM_CONTREGS (x))->seq)
#define SCM_DFRAME(x)           ((SCM_CONTREGS (x))->dframe)

Best regards
Dirk Herrmann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]