/**
* Like strlen but do not count ESC sequences.
*/
- static unsigned print_len(const char *s);
+ static int print_len(const char *s);
static char esc_prompt[];
+ static void (*wait_for_input)();
public:
static bool short_mode;
#include "keycodes.h"
#include "jdb_prompt_ext.h"
#include "jdb_screen.h"
+#include "processor.h"
bool Jdb_core::short_mode = true;
int Jdb_core::next_char = -1;
char Jdb_core::esc_prompt[32] = JDB_ANSI_COLOR(green);
Jdb_core::Input_fmt *Jdb_core::_fmt_list[26];
+void (*Jdb_core::wait_for_input)();
PUBLIC static
bool
}
IMPLEMENT
-unsigned Jdb_core::print_len(const char *s)
+int Jdb_core::print_len(const char *s)
{
- unsigned l = 0;
+ int l = 0;
while (*s)
{
if (s[0] == '\033' && s[1] == '[')
return 0;
if (x >= 'A' && x <= 'Z')
- snprintf(esc_prompt, sizeof(esc_prompt) - 1, "\033[%d;%dm", pc, 1);
+ snprintf(esc_prompt, sizeof(esc_prompt) - 1, "\033[%u;%dm", pc, 1);
else
- snprintf(esc_prompt, sizeof(esc_prompt) - 1, "\033[%dm", pc);
+ snprintf(esc_prompt, sizeof(esc_prompt) - 1, "\033[%um", pc);
return 1;
}
IMPLEMENT
-int Jdb_core::getchar( void )
+int Jdb_core::getchar()
{
if (next_char != -1)
{
next_char = -1;
return c;
}
-
- return Kconsole::console()->getchar();
+
+ int c;
+
+ while (1)
+ {
+ c = Kconsole::console()->getchar(false);
+ if (c != -1)
+ return c;
+
+ if (wait_for_input)
+ wait_for_input();
+ else
+ Proc::pause();
+ }
}
PUBLIC static
return *(str++);
}
-PRIVATE static inline
+PUBLIC static inline NEEDS[<cstdio>]
void
Jdb_core::cmd_putchar(int c)
{ if (short_mode) putchar(c); }
while(*f && *f!='%')
++f;
- putnstr( f1, (f-f1) );
+ if (short_mode)
+ putnstr( f1, (f-f1) );
if(*(f++))
{
if (line++ > Jdb_screen::height()-3)
{
putstr("--- CR: line, SPACE: page, ESC: abort ---");
- int a = Kconsole::console()->getchar();
+ int a = getchar();
putstr("\r\033[K");
switch (a)