#include "rlprivate.h"
#include "xmalloc.h"
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
-
/* **************************************************************** */
/* */
/* Hacking Keyboard Macros */
then it is a malloc ()'ed string where input is coming from. */
char *rl_executing_macro = (char *)NULL;
-/* Non-zero means to save keys that we dispatch on in a kbd macro. */
-int _rl_defining_kbd_macro = 0;
-
/* The offset in the above string to the next character to be read. */
static int executing_macro_index;
rl_executing_macro = (char *) NULL;
executing_macro_index = 0;
- _rl_defining_kbd_macro = 0;
RL_UNSETSTATE(RL_STATE_MACRODEF);
}
rl_start_kbd_macro (ignore1, ignore2)
int ignore1, ignore2;
{
- if (_rl_defining_kbd_macro)
+ if (RL_ISSTATE (RL_STATE_MACRODEF))
{
_rl_abort_internal ();
return -1;
else
current_macro_index = 0;
- _rl_defining_kbd_macro = 1;
RL_SETSTATE(RL_STATE_MACRODEF);
return 0;
}
rl_end_kbd_macro (count, ignore)
int count, ignore;
{
- if (_rl_defining_kbd_macro == 0)
+ if (RL_ISSTATE (RL_STATE_MACRODEF) == 0)
{
_rl_abort_internal ();
return -1;
current_macro_index -= rl_key_sequence_length - 1;
current_macro[current_macro_index] = '\0';
- _rl_defining_kbd_macro = 0;
RL_UNSETSTATE(RL_STATE_MACRODEF);
return (rl_call_last_kbd_macro (--count, 0));
if (current_macro == 0)
_rl_abort_internal ();
- if (_rl_defining_kbd_macro)
+ if (RL_ISSTATE (RL_STATE_MACRODEF))
{
rl_ding (); /* no recursive macros */
current_macro[--current_macro_index] = '\0'; /* erase this char */