12 #define I rz_cons_singleton()
41 for (
i = 0;
i <
sizeof(xpos) - 1;
i++) {
43 if (ch ==
';' || ch ==
'M') {
49 for (
i = 0;
i <
sizeof(ypos) - 1;
i++) {
51 if (ch ==
';' || ch ==
'M') {
84 ch = bCtrl ?
'J' :
'j';
87 ch = bCtrl ?
'L' :
'l';
90 ch = bCtrl ?
'K' :
'k';
93 ch = bCtrl ?
'H' :
'h';
103 return I->mouse_event && (
ut8)ch ==
UT8_MAX ? 0 : ch;
113 case 0x16: ch =
'J';
break;
114 case 0x10: ch =
'k';
break;
115 case 0x0e: ch =
'j';
break;
116 case 0x06: ch =
'l';
break;
117 case 0x02: ch =
'h';
break;
132 #if defined(__HAIKU__)
135 ch = 0xf1 + (ch & 0xf);
140 if (ch <
'A' || ch ==
'[') {
144 ch = 0xf1 + (ch & 0xf);
164 if (ch >=
'0' && ch <=
'9') {
179 }
while (ch !=
'M' && ch !=
'm');
180 int nvel = atoi(vel);
216 }
else if (ch ==
'7') {
225 }
while (ch2 !=
'M');
290 case 'A': ch =
'K';
break;
291 case 'B': ch =
'J';
break;
292 case 'C': ch =
'L';
break;
293 case 'D': ch =
'H';
break;
303 case 'A': ch =
'K';
break;
304 case 'B': ch =
'J';
break;
305 case 'C': ch =
'L';
break;
306 case 'D': ch =
'H';
break;
320 case 'A': ch =
'k';
break;
321 case 'B': ch =
'j';
break;
322 case 'C': ch =
'l';
break;
327 case 'a': ch =
'K';
break;
328 case 'b': ch =
'J';
break;
329 case 'c': ch =
'L';
break;
330 case 'd': ch =
'H';
break;
366 fwrite(
p, strlen(
p), 1, stdout);
377 if (feof(cons->
fdin)) {
397 rz_cons_print(
"\n--press any key--\n");
407 static int __cons_readchar_w32(
ut32 usec) {
414 INPUT_RECORD irInBuf = { 0 };
415 CONSOLE_SCREEN_BUFFER_INFO
info = { 0 };
416 bool mouse_enabled =
I->mouse;
417 bool click_n_drag =
false;
420 h = GetStdHandle(STD_INPUT_HANDLE);
421 GetConsoleMode(
h, &
mode);
422 DWORD newmode = ENABLE_WINDOW_INPUT;
424 newmode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
427 SetConsoleMode(
h, newmode);
431 if (WaitForSingleObject(
h, usec) == WAIT_TIMEOUT) {
437 ret = ReadFile(
h, &ch, 1, &
out,
NULL);
443 ret = ReadConsoleInputW(
h, &irInBuf, 1, &
out);
447 if (irInBuf.EventType == MENU_EVENT || irInBuf.EventType == FOCUS_EVENT) {
453 if (irInBuf.EventType == MOUSE_EVENT) {
454 if (irInBuf.Event.MouseEvent.dwEventFlags == MOUSE_MOVED) {
455 if (irInBuf.Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED) {
460 if (irInBuf.Event.MouseEvent.dwEventFlags == MOUSE_WHEELED) {
461 if (irInBuf.Event.MouseEvent.dwButtonState & 0xFF000000) {
462 ch = bCtrl ?
'J' :
'j';
464 ch = bCtrl ?
'K' :
'k';
468 switch (irInBuf.Event.MouseEvent.dwButtonState) {
469 case FROM_LEFT_1ST_BUTTON_PRESSED:
470 GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &
info);
471 int rel_y = irInBuf.Event.MouseEvent.dwMousePosition.Y -
info.srWindow.Top;
479 rz_cons_set_click(irInBuf.Event.MouseEvent.dwMousePosition.X + 1, irInBuf.Event.MouseEvent.dwMousePosition.Y + 1);
483 if (irInBuf.EventType == KEY_EVENT) {
484 if (irInBuf.Event.KeyEvent.bKeyDown) {
485 bCtrl = irInBuf.Event.KeyEvent.dwControlKeyState & LEFT_CTRL_PRESSED;
486 if (irInBuf.Event.KeyEvent.uChar.UnicodeChar) {
487 char *
tmp = rz_utf16_to_utf8_l(&irInBuf.Event.KeyEvent.uChar.UnicodeChar, 1);
494 switch (irInBuf.Event.KeyEvent.wVirtualKeyCode) {
501 ch = irInBuf.Event.KeyEvent.wVirtualKeyCode;
550 if (irInBuf.EventType == WINDOW_BUFFER_SIZE_EVENT) {
555 SetConsoleMode(
h,
mode);
572 tv.tv_usec = 1000 * usec;
581 return __cons_readchar_w32(usec);
586 char *res = (
len +
I->input->readbuffer_length > 0) ?
realloc(
I->input->readbuffer,
len +
I->input->readbuffer_length) :
NULL;
588 I->input->readbuffer = res;
589 memmove(
I->input->readbuffer +
I->input->readbuffer_length,
str,
len);
590 I->input->readbuffer_length +=
len;
598 I->input->readbuffer_length = 0;
602 I->input->bufactive = active;
610 if (
I->input->readbuffer_length <= 0) {
613 *ch = *
I->input->readbuffer;
614 I->input->readbuffer_length--;
615 memmove(
I->input->readbuffer,
I->input->readbuffer + 1,
I->input->readbuffer_length);
627 return __cons_readchar_w32(0);
641 rz_signal_sigmask(0,
NULL, &sigmask);
644 if (errno ==
EBADF) {
645 eprintf(
"rz_cons_readchar (): EBADF\n");
659 if (
I->input->bufactive) {
675 vfprintf(stderr, fmt, ap);
680 if (
read(0,
buf + 1, 1) == 1) {
687 if (
key ==
'\n' ||
key ==
'\r') {
RzBinInfo * info(RzBinFile *bf)
const lzma_allocator const uint8_t size_t uint8_t * out
RZ_API void rz_cons_set_raw(bool is_raw)
RZ_API bool rz_cons_enable_mouse(const bool enable)
RZ_API RzCons * rz_cons_singleton(void)
RZ_API void * rz_cons_sleep_begin(void)
RZ_API int rz_cons_printf(const char *format,...)
RZ_API bool rz_cons_is_interactive(void)
RZ_API void rz_cons_show_cursor(int cursor)
RZ_API void rz_cons_set_click(int x, int y)
RZ_API void rz_cons_flush(void)
RZ_API void rz_cons_sleep_end(void *user)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval tv
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * realloc(void *ptr, size_t size)
RZ_API void rz_line_set_prompt(const char *prompt)
RZ_API RZ_OWN char * rz_line_get_prompt(void)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set readfds
static static fork const void static count static fd const char const char static newpath char char argv
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz select
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
@ RZ_VIRT_TERM_MODE_COMPLETE
All the sequences goes through VT (Windows Terminal, mintty, all OSs)
#define RZ_STR_ISNOTEMPTY(x)
RZ_API RZ_BORROW char * rz_str_trim_tail(RZ_NONNULL char *str)
Removes whitespace characters (space, tab, newline etc.) from the end of a string and replaces them w...
RZ_API bool rz_sys_stop(void)
Send SIGTSTP signal to every process in this process group.
static struct sockaddr static addrlen static backlog const void msg
RzConsPrintablePalette pal
int(* user_fgets)(char *buf, int len, void *user)
int def(FILE *source, FILE *dest, int level)
int read(izstream &zs, T *x, Items items)