1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00

* async.h: kill the scm_async_t struct. having a heap cell

pretending to be a C struct is not helthy, and is not needed here
anyway, as asyncs happily fit in one heap cell.

* async.c: reflect the fact that asyncs are now represented by
single heap cell each.
This commit is contained in:
Michael Livshin 2000-04-04 20:07:11 +00:00
parent 873c35ee82
commit 843e4e9d17
3 changed files with 49 additions and 51 deletions

View file

@ -1,3 +1,12 @@
2000-04-04 Michael Livshin <mlivshin@bigfoot.com>
* async.h: kill the scm_async_t struct. having a heap cell
pretending to be a C struct is not helthy, and is not needed here
anyway, as asyncs happily fit in one heap cell.
* async.c: reflect the fact that asyncs are now represented by
single heap cell each.
2000-04-04 Gary Houston <ghouston@arglist.com> 2000-04-04 Gary Houston <ghouston@arglist.com>
* error.c (scm_syserror): save errno before doing anything else, * error.c (scm_syserror): save errno before doing anything else,

View file

@ -122,11 +122,8 @@ scm_asyncs_pending ()
pos = scm_asyncs; pos = scm_asyncs;
while (pos != SCM_EOL) while (pos != SCM_EOL)
{ {
SCM a; SCM a = SCM_CAR (pos);
struct scm_async * it; if (SCM_ASYNC_GOT_IT (a))
a = SCM_CAR (pos);
it = SCM_ASYNC (a);
if (it->got_it)
return 1; return 1;
pos = SCM_CDR (pos); pos = SCM_CDR (pos);
} }
@ -286,9 +283,7 @@ scm_async_click ()
static SCM static SCM
mark_async (SCM obj) mark_async (SCM obj)
{ {
struct scm_async * it; return SCM_ASYNC_THUNK (obj);
it = SCM_ASYNC (obj);
return it->thunk;
} }
@ -298,7 +293,7 @@ SCM_DEFINE (scm_async, "async", 1, 0, 0,
"") "")
#define FUNC_NAME s_scm_async #define FUNC_NAME s_scm_async
{ {
SCM_RETURN_NEWSMOB2 (scm_tc16_async, 0, SCM_UNPACK (thunk)); SCM_RETURN_NEWSMOB (scm_tc16_async, SCM_UNPACK (thunk));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -324,12 +319,11 @@ SCM_DEFINE (scm_async_mark, "async-mark", 1, 0, 0,
"") "")
#define FUNC_NAME s_scm_async_mark #define FUNC_NAME s_scm_async_mark
{ {
struct scm_async * it; SCM_VALIDATE_ASYNC (1,a);
SCM_VALIDATE_ASYNC_COPY (1,a,it);
#ifdef GUILE_OLD_ASYNC_CLICK #ifdef GUILE_OLD_ASYNC_CLICK
it->got_it = 1; SCM_SET_ASYNC_GOT_IT (a, 1);
#else #else
scm_asyncs_pending_p = it->got_it = 1; SCM_SET_ASYNC_GOT_IT (a, scm_asyncs_pending_p = 1);
#endif #endif
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
} }
@ -341,15 +335,14 @@ SCM_DEFINE (scm_system_async_mark, "system-async-mark", 1, 0, 0,
"") "")
#define FUNC_NAME s_scm_system_async_mark #define FUNC_NAME s_scm_system_async_mark
{ {
struct scm_async *it; SCM_VALIDATE_ASYNC (1, a);
SCM_VALIDATE_ASYNC_COPY (1, a, it);
SCM_REDEFER_INTS; SCM_REDEFER_INTS;
#ifdef GUILE_OLD_ASYNC_CLICK #ifdef GUILE_OLD_ASYNC_CLICK
it->got_it = 1; SCM_SET_ASYNC_GOT_IT (a, 1);
scm_async_rate = 1 + scm_async_rate - scm_async_clock; scm_async_rate = 1 + scm_async_rate - scm_async_clock;
scm_async_clock = 1; scm_async_clock = 1;
#else #else
scm_asyncs_pending_p = it->got_it = 1; SCM_SET_ASYNC_GOT_IT (a, scm_asyncs_pending_p = 1);
#endif #endif
SCM_REALLOW_INTS; SCM_REALLOW_INTS;
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
@ -371,15 +364,14 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
while (! SCM_NULLP (list_of_a)) while (! SCM_NULLP (list_of_a))
{ {
SCM a; SCM a;
struct scm_async * it;
SCM_VALIDATE_CONS (1, list_of_a); SCM_VALIDATE_CONS (1, list_of_a);
a = SCM_CAR (list_of_a); a = SCM_CAR (list_of_a);
SCM_VALIDATE_ASYNC_COPY (SCM_ARG1,a,it); SCM_VALIDATE_ASYNC (SCM_ARG1,a);
scm_mask_ints = 1; scm_mask_ints = 1;
if (it->got_it) if (SCM_ASYNC_GOT_IT (a))
{ {
it->got_it = 0; SCM_SET_ASYNC_GOT_IT (a, 0);
scm_apply (it->thunk, SCM_EOL, SCM_EOL); scm_apply (SCM_ASYNC_THUNK (a), SCM_EOL, SCM_EOL);
} }
scm_mask_ints = 0; scm_mask_ints = 0;
list_of_a = SCM_CDR (list_of_a); list_of_a = SCM_CDR (list_of_a);

View file

@ -52,13 +52,10 @@
#define SCM_ASYNCP(X) (SCM_NIMP(X) && (scm_tc16_async == SCM_GCTYP16 (X))) #define SCM_ASYNCP(X) (SCM_NIMP(X) && (scm_tc16_async == SCM_GCTYP16 (X)))
#define SCM_ASYNC(X) ((struct scm_async *) &SCM_CDR (X))
struct scm_async #define SCM_ASYNC_GOT_IT(X) (SCM_CELL_WORD_0 (X) >> 16)
{ #define SCM_SET_ASYNC_GOT_IT(X, V) (SCM_SET_CELL_WORD_0 (X, (SCM_CELL_WORD_0 (X) & ((1 << 16) - 1)) | ((V) << 16)))
scm_bits_t got_it; /* needs to be delivered? */ #define SCM_ASYNC_THUNK(X) SCM_CELL_OBJECT_1 (X)
SCM thunk; /* the handler. */
};