1999-04-16 03:34:55 +02:00
|
|
|
/* callback.c -- functions to use readline as an X `callback' mechanism. */
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
This file is part of the GNU Readline Library (Readline), a library
|
|
|
|
for reading lines of text with interactive input and history editing.
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
Readline is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
1999-04-16 03:34:55 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
Readline is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
1999-04-16 03:34:55 +02:00
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#define READLINE_LIBRARY
|
|
|
|
|
|
|
|
#if defined (HAVE_CONFIG_H)
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "rlconf.h"
|
|
|
|
|
|
|
|
#if defined (READLINE_CALLBACKS)
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
# include <stdlib.h>
|
|
|
|
#else
|
|
|
|
# include "ansi_stdlib.h"
|
|
|
|
#endif
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
/* System-specific feature definitions and include files. */
|
|
|
|
#include "rldefs.h"
|
|
|
|
#include "readline.h"
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
#include "rlprivate.h"
|
2006-10-21 22:47:07 +02:00
|
|
|
#include "xmalloc.h"
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
/* Private data for callback registration functions. See comments in
|
|
|
|
rl_callback_read_char for more details. */
|
|
|
|
_rl_callback_func_t *_rl_callback_func = 0;
|
|
|
|
_rl_callback_generic_arg *_rl_callback_data = 0;
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
/* **************************************************************** */
|
|
|
|
/* */
|
2006-05-05 20:26:14 +02:00
|
|
|
/* Callback Readline Functions */
|
1999-04-16 03:34:55 +02:00
|
|
|
/* */
|
|
|
|
/* **************************************************************** */
|
|
|
|
|
|
|
|
/* Allow using readline in situations where a program may have multiple
|
|
|
|
things to handle at once, and dispatches them via select(). Call
|
|
|
|
rl_callback_handler_install() with the prompt and a function to call
|
|
|
|
whenever a complete line of input is ready. The user must then
|
|
|
|
call rl_callback_read_char() every time some input is available, and
|
|
|
|
rl_callback_read_char() will call the user's function with the complete
|
2015-07-25 21:41:05 +02:00
|
|
|
text read in at each end of line. The terminal is kept prepped and
|
|
|
|
signals handled all the time, except during calls to the user's function. */
|
1999-04-16 03:34:55 +02:00
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
rl_vcpfunc_t *rl_linefunc; /* user callback function */
|
1999-04-16 03:34:55 +02:00
|
|
|
static int in_handler; /* terminal_prepped and signals set? */
|
|
|
|
|
|
|
|
/* Make sure the terminal is set up, initialize readline, and prompt. */
|
|
|
|
static void
|
|
|
|
_rl_callback_newline ()
|
|
|
|
{
|
|
|
|
rl_initialize ();
|
|
|
|
|
|
|
|
if (in_handler == 0)
|
|
|
|
{
|
|
|
|
in_handler = 1;
|
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
if (rl_prep_term_function)
|
|
|
|
(*rl_prep_term_function) (_rl_meta_flag);
|
2015-07-25 21:41:05 +02:00
|
|
|
|
|
|
|
#if defined (HANDLE_SIGNALS)
|
|
|
|
rl_set_signals ();
|
|
|
|
#endif
|
1999-04-16 03:34:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
readline_internal_setup ();
|
2011-05-12 01:38:44 +02:00
|
|
|
RL_CHECK_SIGNALS ();
|
1999-04-16 03:34:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Install a readline handler, set up the terminal, and issue the prompt. */
|
|
|
|
void
|
|
|
|
rl_callback_handler_install (prompt, linefunc)
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
const char *prompt;
|
|
|
|
rl_vcpfunc_t *linefunc;
|
1999-04-16 03:34:55 +02:00
|
|
|
{
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
rl_set_prompt (prompt);
|
2006-05-05 20:26:14 +02:00
|
|
|
RL_SETSTATE (RL_STATE_CALLBACK);
|
1999-04-16 03:34:55 +02:00
|
|
|
rl_linefunc = linefunc;
|
|
|
|
_rl_callback_newline ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read one character, and dispatch to the handler if it ends the line. */
|
|
|
|
void
|
|
|
|
rl_callback_read_char ()
|
|
|
|
{
|
|
|
|
char *line;
|
2006-05-05 20:26:14 +02:00
|
|
|
int eof, jcode;
|
|
|
|
static procenv_t olevel;
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
if (rl_linefunc == NULL)
|
|
|
|
{
|
2011-05-12 01:38:44 +02:00
|
|
|
_rl_errmsg ("readline_callback_read_char() called with no handler!");
|
1999-04-16 03:34:55 +02:00
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t));
|
|
|
|
jcode = setjmp (_rl_top_level);
|
2006-05-05 20:26:14 +02:00
|
|
|
if (jcode)
|
|
|
|
{
|
|
|
|
(*rl_redisplay_function) ();
|
|
|
|
_rl_want_redisplay = 0;
|
2011-05-12 01:38:44 +02:00
|
|
|
memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t));
|
2015-07-25 21:41:05 +02:00
|
|
|
return;
|
2006-05-05 20:26:14 +02:00
|
|
|
}
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
do
|
2006-05-05 20:26:14 +02:00
|
|
|
{
|
2011-05-12 01:38:44 +02:00
|
|
|
RL_CHECK_SIGNALS ();
|
|
|
|
if (RL_ISSTATE (RL_STATE_ISEARCH))
|
|
|
|
{
|
|
|
|
eof = _rl_isearch_callback (_rl_iscxt);
|
|
|
|
if (eof == 0 && (RL_ISSTATE (RL_STATE_ISEARCH) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
|
|
|
|
rl_callback_read_char ();
|
2006-05-05 20:26:14 +02:00
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
return;
|
2011-05-12 01:38:44 +02:00
|
|
|
}
|
|
|
|
else if (RL_ISSTATE (RL_STATE_NSEARCH))
|
|
|
|
{
|
|
|
|
eof = _rl_nsearch_callback (_rl_nscxt);
|
2015-07-25 21:41:05 +02:00
|
|
|
return;
|
2011-05-12 01:38:44 +02:00
|
|
|
}
|
|
|
|
#if defined (VI_MODE)
|
|
|
|
else if (RL_ISSTATE (RL_STATE_VIMOTION))
|
|
|
|
{
|
|
|
|
eof = _rl_vi_domove_callback (_rl_vimvcxt);
|
|
|
|
/* Should handle everything, including cleanup, numeric arguments,
|
|
|
|
and turning off RL_STATE_VIMOTION */
|
|
|
|
if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
|
|
|
|
_rl_internal_char_cleanup ();
|
2006-05-05 20:26:14 +02:00
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
return;
|
2011-05-12 01:38:44 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else if (RL_ISSTATE (RL_STATE_NUMERICARG))
|
2006-05-05 20:26:14 +02:00
|
|
|
{
|
2011-05-12 01:38:44 +02:00
|
|
|
eof = _rl_arg_callback (_rl_argcxt);
|
|
|
|
if (eof == 0 && (RL_ISSTATE (RL_STATE_NUMERICARG) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING))
|
|
|
|
rl_callback_read_char ();
|
|
|
|
/* XXX - this should handle _rl_last_command_was_kill better */
|
|
|
|
else if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
|
|
|
|
_rl_internal_char_cleanup ();
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
return;
|
2006-05-05 20:26:14 +02:00
|
|
|
}
|
2011-05-12 01:38:44 +02:00
|
|
|
else if (RL_ISSTATE (RL_STATE_MULTIKEY))
|
2006-05-05 20:26:14 +02:00
|
|
|
{
|
2011-05-12 01:38:44 +02:00
|
|
|
eof = _rl_dispatch_callback (_rl_kscxt); /* For now */
|
|
|
|
while ((eof == -1 || eof == -2) && RL_ISSTATE (RL_STATE_MULTIKEY) && _rl_kscxt && (_rl_kscxt->flags & KSEQ_DISPATCHED))
|
|
|
|
eof = _rl_dispatch_callback (_rl_kscxt);
|
|
|
|
if (RL_ISSTATE (RL_STATE_MULTIKEY) == 0)
|
2006-05-05 20:26:14 +02:00
|
|
|
{
|
2011-05-12 01:38:44 +02:00
|
|
|
_rl_internal_char_cleanup ();
|
|
|
|
_rl_want_redisplay = 1;
|
2006-05-05 20:26:14 +02:00
|
|
|
}
|
|
|
|
}
|
2011-05-12 01:38:44 +02:00
|
|
|
else if (_rl_callback_func)
|
|
|
|
{
|
|
|
|
/* This allows functions that simply need to read an additional
|
|
|
|
character (like quoted-insert) to register a function to be
|
2015-07-25 21:41:05 +02:00
|
|
|
called when input is available. _rl_callback_data is simply a
|
2011-05-12 01:38:44 +02:00
|
|
|
pointer to a struct that has the argument count originally
|
|
|
|
passed to the registering function and space for any additional
|
|
|
|
parameters. */
|
|
|
|
eof = (*_rl_callback_func) (_rl_callback_data);
|
|
|
|
/* If the function `deregisters' itself, make sure the data is
|
|
|
|
cleaned up. */
|
|
|
|
if (_rl_callback_func == 0)
|
|
|
|
{
|
|
|
|
if (_rl_callback_data)
|
|
|
|
{
|
|
|
|
_rl_callback_data_dispose (_rl_callback_data);
|
|
|
|
_rl_callback_data = 0;
|
|
|
|
}
|
|
|
|
_rl_internal_char_cleanup ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
eof = readline_internal_char ();
|
2006-05-05 20:26:14 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
RL_CHECK_SIGNALS ();
|
|
|
|
if (rl_done == 0 && _rl_want_redisplay)
|
|
|
|
{
|
|
|
|
(*rl_redisplay_function) ();
|
|
|
|
_rl_want_redisplay = 0;
|
|
|
|
}
|
1999-04-16 03:34:55 +02:00
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
if (rl_done)
|
|
|
|
{
|
|
|
|
line = readline_internal_teardown (eof);
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
if (rl_deprep_term_function)
|
|
|
|
(*rl_deprep_term_function) ();
|
1999-04-16 03:34:55 +02:00
|
|
|
#if defined (HANDLE_SIGNALS)
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
rl_clear_signals ();
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
in_handler = 0;
|
|
|
|
(*rl_linefunc) (line);
|
|
|
|
|
|
|
|
/* If the user did not clear out the line, do it for him. */
|
|
|
|
if (rl_line_buffer[0])
|
|
|
|
_rl_init_line_state ();
|
|
|
|
|
|
|
|
/* Redisplay the prompt if readline_handler_{install,remove}
|
|
|
|
not called. */
|
|
|
|
if (in_handler == 0 && rl_linefunc)
|
|
|
|
_rl_callback_newline ();
|
|
|
|
}
|
1999-04-16 03:34:55 +02:00
|
|
|
}
|
2011-05-12 01:38:44 +02:00
|
|
|
while (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT));
|
1999-04-16 03:34:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove the handler, and make sure the terminal is in its normal state. */
|
|
|
|
void
|
|
|
|
rl_callback_handler_remove ()
|
|
|
|
{
|
|
|
|
rl_linefunc = NULL;
|
2006-05-05 20:26:14 +02:00
|
|
|
RL_UNSETSTATE (RL_STATE_CALLBACK);
|
2011-05-12 01:38:44 +02:00
|
|
|
RL_CHECK_SIGNALS ();
|
1999-04-16 03:34:55 +02:00
|
|
|
if (in_handler)
|
|
|
|
{
|
|
|
|
in_handler = 0;
|
2006-05-05 20:26:14 +02:00
|
|
|
if (rl_deprep_term_function)
|
|
|
|
(*rl_deprep_term_function) ();
|
1999-04-16 03:34:55 +02:00
|
|
|
#if defined (HANDLE_SIGNALS)
|
|
|
|
rl_clear_signals ();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
_rl_callback_generic_arg *
|
|
|
|
_rl_callback_data_alloc (count)
|
|
|
|
int count;
|
|
|
|
{
|
|
|
|
_rl_callback_generic_arg *arg;
|
|
|
|
|
|
|
|
arg = (_rl_callback_generic_arg *)xmalloc (sizeof (_rl_callback_generic_arg));
|
|
|
|
arg->count = count;
|
|
|
|
|
|
|
|
arg->i1 = arg->i2 = 0;
|
|
|
|
|
|
|
|
return arg;
|
|
|
|
}
|
|
|
|
|
2015-07-25 21:41:05 +02:00
|
|
|
void _rl_callback_data_dispose (arg)
|
2006-05-05 20:26:14 +02:00
|
|
|
_rl_callback_generic_arg *arg;
|
|
|
|
{
|
2011-05-12 01:38:44 +02:00
|
|
|
xfree (arg);
|
2006-05-05 20:26:14 +02:00
|
|
|
}
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#endif
|