TheGNUGeneralPublicLicenseisoftenshippedwithGNUsoftware,and isgenerallykeptinafilecalledCOPYINGorLICENSE.Ifyoudonot haveacopyofthelicense,writetotheFreeSoftwareFoundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ #define READLINE_LIBRARY
#ifdefined (HAVE_CONFIG_H) # include "config_readline.h" #endif
#include"rlconf.h"
#ifdefined (READLINE_CALLBACKS)
#include <sys/types.h>
#ifdef HAVE_STDLIB_H # include <stdlib.h> #else # include "ansi_stdlib.h" #endif
#include <stdio.h>
/* System-specific feature definitions and include files. */ #include"rldefs.h" #include"readline.h" #include"rlprivate.h" #include"xmalloc.h"
/* 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;
/* Allow using readline in situations where a program may have multiple thingstohandleatonce,anddispatchesthemviaselect().Call rl_callback_handler_install()withthepromptandafunctiontocall wheneveracompletelineofinputisready.Theusermustthen callrl_callback_read_char()everytimesomeinputisavailable,and rl_callback_read_char()willcalltheuser'sfunctionwiththecomplete textreadinateachendofline.Theterminaliskeptpreppedand
signals handled all the time, except during calls to the user's function. */
rl_vcpfunc_t *rl_linefunc; /* user callback function */ staticint in_handler; /* terminal_prepped and signals set? */
/* Make sure the terminal is set up, initialize readline, and prompt. */ staticvoid
_rl_callback_newline ()
{
rl_initialize ();
if (in_handler == 0)
{
in_handler = 1;
if (rl_prep_term_function)
(*rl_prep_term_function) (_rl_meta_flag);
/* Install a readline handler, set up the terminal, and issue the prompt. */ void
rl_callback_handler_install (prompt, linefunc) constchar *prompt;
rl_vcpfunc_t *linefunc;
{
rl_set_prompt (prompt);
RL_SETSTATE (RL_STATE_CALLBACK);
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; int eof, jcode; static procenv_t olevel;
if (rl_linefunc == NULL)
{
fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n");
abort ();
}
/* 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 ();
}
} while (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT));
}
/* Remove the handler, and make sure the terminal is in its normal state. */ void
rl_callback_handler_remove ()
{
rl_linefunc = NULL;
RL_UNSETSTATE (RL_STATE_CALLBACK); if (in_handler)
{
in_handler = 0; if (rl_deprep_term_function)
(*rl_deprep_term_function) (); #ifdefined (HANDLE_SIGNALS)
rl_clear_signals (); #endif
}
}
_rl_callback_generic_arg *
_rl_callback_data_alloc (count) int count;
{
_rl_callback_generic_arg *arg;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.