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 <sys/types.h>
#ifdefined (HAVE_UNISTD_H) # include <unistd.h> /* for _POSIX_VERSION */ #endif/* HAVE_UNISTD_H */
#ifdefined (HAVE_STDLIB_H) # include <stdlib.h> #else # include "ansi_stdlib.h" #endif/* HAVE_STDLIB_H */
#include <stdio.h>
/* System-specific feature definitions and include files. */ #include"rldefs.h"
/* Some standard library routines. */ #include"readline.h" #include"history.h"
/* The currently executing macro string. If this is non-zero,
then it is a malloc ()'ed string where input is coming from. */ char *rl_executing_macro = (char *)NULL;
/* The offset in the above string to the next character to be read. */ staticint executing_macro_index;
/* The current macro string being built. Characters get stuffed
in here by add_macro_char (). */ staticchar *current_macro = (char *)NULL;
/* The size of the buffer allocated to current_macro. */ staticint current_macro_size;
/* The index at which characters are being added to current_macro. */ staticint current_macro_index;
/* A structure used to save nested macro strings.
It is a linked list of string/index for each saved macro. */ struct saved_macro { struct saved_macro *next; char *string; int sindex;
};
/* The list of saved macros. */ staticstruct saved_macro *macro_list = (struct saved_macro *)NULL;
/* Set up to read subsequent input from STRING.
STRING is free ()'ed when we are done with it. */ void
_rl_with_macro_input (string) char *string;
{
_rl_push_executing_macro ();
rl_executing_macro = string;
executing_macro_index = 0;
RL_SETSTATE(RL_STATE_MACROINPUT);
}
/* Return the next character available from a macro, or 0 if
there are no macro characters. */ int
_rl_next_macro_key ()
{ int c;
/* Discard the current macro, replacing it with the one
on the top of the stack of saved macros. */ void
_rl_pop_executing_macro ()
{ struct saved_macro *macro;
/* Begin defining a keyboard macro. Keystrokesarerecordedastheyareexecuted. Endthedefinitionwithrl_end_kbd_macro(). Ifanumericargumentwasexplicitlytyped,thenappendthis definitiontotheendoftheexistingmacro,andstartby
re-executing the existing macro. */ int
rl_start_kbd_macro (ignore1, ignore2) int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
{ if (RL_ISSTATE (RL_STATE_MACRODEF))
{
_rl_abort_internal (); return -1;
}
if (rl_explicit_arg)
{ if (current_macro)
_rl_with_macro_input (savestring (current_macro));
} else
current_macro_index = 0;
RL_SETSTATE(RL_STATE_MACRODEF); return0;
}
/* Stop defining a keyboard macro. Anumericargumentsaystoexecutethemacrorightnow,
that many times, counting the definition as the first time. */ int
rl_end_kbd_macro (count, ignore) int count, ignore __attribute__((unused));
{ if (RL_ISSTATE (RL_STATE_MACRODEF) == 0)
{
_rl_abort_internal (); return -1;
}
/* Execute the most recently defined keyboard macro.
COUNT says how many times to execute it. */ int
rl_call_last_kbd_macro (count, ignore) int count, ignore __attribute__((unused));
{ if (current_macro == 0)
_rl_abort_internal ();
if (RL_ISSTATE (RL_STATE_MACRODEF))
{
rl_ding (); /* no recursive macros */
current_macro[--current_macro_index] = '\0'; /* erase this char */ return0;
}
while (count--)
_rl_with_macro_input (savestring (current_macro)); return0;
}
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.