Browse Source

fix busy waiting loop, when using editline

pre-master-46
rlar 16 years ago
parent
commit
a8c64094fc
  1. 9
      ChangeLog
  2. 4
      src/frontend/display.c
  3. 2
      src/frontend/parser/input.c
  4. 1
      src/frontend/plotting/x11.c
  5. 28
      src/main.c

9
ChangeLog

@ -1,3 +1,12 @@
2010-08-09 Robert Larice
* src/frontend/display.c ,
* src/frontend/parser/input.c ,
* src/frontend/plotting/x11.c ,
* src/main.c :
fix a busy waiting loop when using editline. rl_event_hook must block until
there is some work to do. (select on stdin and the X11 socket).
For non-X11, don't use rl_event_hook at all.
2010-08-09 Robert Larice
* src/spicelib/analysis/cktmapn.c :
bug fix, incorrect indirection level, yet without consequence,

4
src/frontend/display.c

@ -320,8 +320,8 @@ gen_Input(REQUEST *request, RESPONSE *response)
switch (request->option) {
case char_option:
response->reply.ch = inchar(request->fp);
response->option = request->option;
if (response)
response->option = request->option;
break;
default:
/* just ignore, since we don't want a million error messages */

2
src/frontend/parser/input.c

@ -57,6 +57,6 @@ input(FILE *fp)
request.option = char_option;
request.fp = fp;
Input(&request, &response);
return(response.reply.ch);
return(inchar(fp));
}

1
src/frontend/plotting/x11.c

@ -984,7 +984,6 @@ X11_Input(REQUEST *request, RESPONSE *response)
}
if (FD_ISSET (fileno(request->fp), &rfds)) {
response->reply.ch = inchar(request->fp);
goto out;
}

28
src/main.c

@ -162,12 +162,15 @@ static void app_rl_readlines(void);
static char * prompt(void);
#endif /* HAVE_GNUREADLINE || HAVE_BSDEDITLINE */
#ifndef X_DISPLAY_MISSING
#include "frontend/plotting/x11.h"
#ifdef HAVE_GNUREADLINE
static int rl_event_func(void) ;
static int app_event_func(void) ;
#endif /* HAVE_GNUREADLINE || HAVE_BSDEDITLINE */
#ifdef HAVE_BSDEDITLINE
static void rl_event_func(void) ;
static void app_event_func(void) ;
#endif /* HAVE_BSDEDITLINE */
#endif
static void show_help(void);
static void show_version(void);
@ -481,16 +484,18 @@ prompt(void)
}
#endif /* HAVE_GNUREADLINE || HAVE_BSDEDITLINE */
#ifndef X_DISPLAY_MISSING
#ifdef HAVE_GNUREADLINE
/* -------------------------------------------------------------------------- */
/* Process device events in Readline's hook since there is no where
else to do it now - AV */
static int
rl_event_func(void)
app_event_func(void)
/* called by GNU readline periodically to know what to do about keypresses */
{
static REQUEST reqst = { checkup_option, 0 };
Input(&reqst, NULL);
static REQUEST reqst = { char_option, 0 };
reqst.fp = rl_instream;
X11_Input(&reqst, NULL);
return 0;
}
#endif /* HAVE_GNUREADLINE */
@ -500,13 +505,15 @@ rl_event_func(void)
/* Process device events in Editline's hook.
similar to the readline function above but returns void */
static void
rl_event_func()
app_event_func(void)
/* called by GNU readline periodically to know what to do about keypresses */
{
static REQUEST reqst = { checkup_option, 0 };
Input(&reqst, NULL);
static REQUEST reqst = { char_option, 0 };
reqst.fp = rl_instream;
X11_Input(&reqst, NULL);
}
#endif /* HAVE_BSDEDITLINE */
#endif
/* -------------------------------------------------------------------------- */
/* This is the command processing loop for spice and nutmeg.
@ -532,7 +539,10 @@ app_rl_readlines(void)
rl_readline_name = application_name;
rl_instream = cp_in;
rl_outstream = cp_out;
rl_event_hook = rl_event_func;
#ifndef X_DISPLAY_MISSING
if(dispdev->Input == X11_Input)
rl_event_hook = app_event_func;
#endif
rl_catch_signals = 0; /* disable signal handling */
/* sjb - what to do for editline?

Loading…
Cancel
Save