1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

Bugfixes for yesterdays revision.

This commit is contained in:
Mikael Djurfeldt 1998-05-12 21:41:44 +00:00
parent be0ea98851
commit 9c5d232c82

View file

@ -50,12 +50,6 @@
#include <readline/readline.h> #include <readline/readline.h>
#include <readline/history.h> #include <readline/history.h>
static SCM
apply (SCM a)
{
return scm_apply (SCM_CAR (a), SCM_CDR (a), SCM_EOL);
}
static int promptp; static int promptp;
static SCM input_port; static SCM input_port;
static SCM before_read; static SCM before_read;
@ -63,13 +57,10 @@ static SCM before_read;
static int static int
current_input_getc (FILE *in) current_input_getc (FILE *in)
{ {
SCM_STACKITEM mark;
SCM ans; SCM ans;
if (promptp && SCM_NIMP (before_read)) if (promptp && SCM_NIMP (before_read))
{ {
scm_internal_cwdr ((scm_catch_body_t) apply, scm_apply (before_read, SCM_EOL, SCM_EOL);
(void *) SCM_LIST1 (before_read),
scm_handle_by_throw, 0, &mark);
promptp = 0; promptp = 0;
} }
ans = scm_getc (input_port); ans = scm_getc (input_port);
@ -128,18 +119,18 @@ scm_readline (SCM text, SCM inp, SCM outp, SCM read_hook)
SCM_ARG1, SCM_ARG1,
s_readline); s_readline);
SCM_COERCE_SUBSTR (text); SCM_COERCE_SUBSTR (text);
if (SCM_UNBNDP (inp)) }
inp = scm_cur_inp; if (SCM_UNBNDP (inp))
else if (SCM_UNBNDP (outp)) inp = scm_cur_inp;
outp = scm_cur_outp; if (SCM_UNBNDP (outp))
else if (!(SCM_UNBNDP (read_hook) || SCM_FALSEP (read_hook))) outp = scm_cur_outp;
{ if (!(SCM_UNBNDP (read_hook) || SCM_FALSEP (read_hook)))
SCM_ASSERT (SCM_NFALSEP (scm_thunk_p (read_hook)), {
read_hook, SCM_ASSERT (SCM_NFALSEP (scm_thunk_p (read_hook)),
SCM_ARG2, read_hook,
s_readline); SCM_ARG2,
before_read = read_hook; s_readline);
} before_read = read_hook;
} }
if (!(SCM_NIMP (inp) && SCM_OPINFPORTP (inp))) if (!(SCM_NIMP (inp) && SCM_OPINFPORTP (inp)))
scm_misc_error (s_readline, scm_misc_error (s_readline,
@ -154,7 +145,6 @@ scm_readline (SCM text, SCM inp, SCM outp, SCM read_hook)
rl_instream = (FILE *) SCM_STREAM (inp); rl_instream = (FILE *) SCM_STREAM (inp);
rl_outstream = (FILE *) SCM_STREAM (outp); rl_outstream = (FILE *) SCM_STREAM (outp);
rl_initialize ();
return scm_internal_catch (SCM_BOOL_T, return scm_internal_catch (SCM_BOOL_T,
(scm_catch_body_t) internal_readline, (scm_catch_body_t) internal_readline,
(void *) text, (void *) text,
@ -206,7 +196,6 @@ SCM scm_readline_completion_function_var;
static char * static char *
completion_function (char *text, int continuep) completion_function (char *text, int continuep)
{ {
SCM_STACKITEM mark;
SCM compfunc = SCM_CDR (scm_readline_completion_function_var); SCM compfunc = SCM_CDR (scm_readline_completion_function_var);
SCM res; SCM res;
@ -216,11 +205,7 @@ completion_function (char *text, int continuep)
{ {
SCM t = scm_makfrom0str (text); SCM t = scm_makfrom0str (text);
SCM c = continuep ? SCM_BOOL_T : SCM_BOOL_F; SCM c = continuep ? SCM_BOOL_T : SCM_BOOL_F;
res = scm_internal_cwdr ((scm_catch_body_t) apply, res = scm_apply (compfunc, SCM_LIST2 (t, c), SCM_EOL);
(void *) SCM_LIST3 (compfunc, t, c),
scm_handle_by_throw,
0,
&mark);
if (SCM_FALSEP (res)) if (SCM_FALSEP (res))
return NULL; return NULL;