* prolog, pure guile scheme cont
@ 2010-07-07 19:50 stefan
0 siblings, 0 replies; 2+ messages in thread
From: stefan @ 2010-07-07 19:50 UTC (permalink / raw)
To: guile-devel
Hey,
I just read the code for prompts and aborts.
So I had a problem with making prompts work effectivily due to the
need to have two versions of a single prompt live at the same time
e.g. a Cut and the Next prompt that share the same tag. This does not
work if one reads the code. On the other hand defining a Cut tag prompt
and a Next tag prompt is not an elegant solution and is probably
expensive. So, I'll turn over to c and will try to hack
scm_at_abort and friends.
Have fun
/Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
* prolog, pure guile scheme cont
@ 2010-07-08 20:48 stefan
0 siblings, 0 replies; 2+ messages in thread
From: stefan @ 2010-07-08 20:48 UTC (permalink / raw)
To: guile-devel
Ok,
Streamlined the repo/unify-iso further. It is pretty self contained although
a bit hacky because I have an absolute path in umatch that has to be
corrected.
Anyway this code clocks at 10x the faster but rude code I have in the master
branch. I'm pretty sure that We shuold be able to make that 5x. Anyway it's a
starting point for having a prolog running with guile that are unintrusive.
Did some research about prompting.
I have a fix for the issue I mensioned in previous mail.
I don't know the generality of the fix. but it works by defining two public
functions in control.c, e.g.
/*
We send an id instead of the tag to the g-abort! and the usual args, the id
beeing essential the adress of the prompt data
*/
SCM_DEFINE (scm_at_generation_abort, "@g-abort", 2, 0, 0, (SCM id, SCM args),
"Abort to the nearest prompt with secific id @var{id}.")
#define FUNC_NAME s_scm_at_generation_abort
{
SCM *argv;
size_t i, n;
SCM_VALIDATE_LIST_COPYLEN (SCM_ARG2, args, n);
argv = alloca (sizeof (SCM)*n);
for (i = 0; i < n; i++, args = scm_cdr (args))
argv[i] = scm_car (args);
scm_c_g_abort (scm_the_vm (), id, n, argv, -1);
/* Oh, what, you're still here? The abort must have been reinstated.
Actually,
that's quite impossible, given that we're already in C-land here, so...
abort! */
abort ();
}
#undef FUNC_NAME
/*
where the search for the prompt is done by...
if (SCM_PROMPT_P (elt)
&& ((((scm_t_bits) SCM_PROMPT_REGISTERS(elt)) | 2) == SCM_UNPACK(id)))
{
prompt = elt;
break;
}
*/
/*
Kind of hacky. from a defined prompt it returns the identity info.
*/
SCM_DEFINE (prompt_generation_id, "@prompt-gid", 1, 0, 0, (SCM tag),
"Return a generation id for a prompt")
#define FUNC_NAME s_prompt_generation_id
{
SCM winds;
/* Search the wind list for an appropriate prompt.
"Waiter, please bring us the wind list." */
for (winds = scm_i_dynwinds ();
scm_is_pair (winds);
winds = SCM_CDR (winds))
{
SCM elt = SCM_CAR (winds);
if (SCM_PROMPT_P (elt) && scm_is_eq (SCM_PROMPT_TAG (elt), tag))
{
return SCM_PACK((((scm_t_bits) SCM_PROMPT_REGISTERS(elt)) | 2));
}
}
printf("did not find prompt!\n");
return SCM_BOOL_F;
}
#undef FUNC_NAME
Cheers
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-08 20:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-07 19:50 prolog, pure guile scheme cont stefan
-- strict thread matches above, loose matches on Subject: below --
2010-07-08 20:48 stefan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).