27 #include <sys/types.h>
32 #include <sys/ioctl.h>
34 #include <sys/socket.h>
41 #define CONS_MAX_USER 102400
42 #define CONS_BUFSZ 0x4f00
43 #define STR_IS_NULL(x) (!x || !x[0])
46 #define CONS_PALETTE_SIZE 22
47 #define CONS_COLORS_SIZE 21
49 #define RZ_CONS_GREP_WORDS 10
50 #define RZ_CONS_GREP_WORD_SIZE 64
51 #define RZ_CONS_GREP_TOKENS 64
55 #define RZ_CONS_CMD_DEPTH 100
105 RZ_CONS_PAL_0x00 = 0,
143 RZ_CONS_PAL_AI_WRITE,
146 RZ_CONS_PAL_AI_ASCII,
147 RZ_CONS_PAL_AI_UNMAP,
148 RZ_CONS_PAL_GUI_CFLOW,
149 RZ_CONS_PAL_GUI_DATAOFFSET,
150 RZ_CONS_PAL_GUI_BACKGROUND,
151 RZ_CONS_PAL_GUI_ALT_BACKGROUND,
152 RZ_CONS_PAL_GUI_BORDER,
154 RZ_CONS_PAL_GRAPH_BOX,
155 RZ_CONS_PAL_GRAPH_BOX2,
156 RZ_CONS_PAL_GRAPH_BOX3,
157 RZ_CONS_PAL_GRAPH_BOX4,
158 RZ_CONS_PAL_GRAPH_TRUE,
159 RZ_CONS_PAL_GRAPH_FALSE,
160 RZ_CONS_PAL_GRAPH_TRUFAE,
161 RZ_CONS_PAL_GRAPH_TRACED,
162 RZ_CONS_PAL_GRAPH_CURRENT,
348 #define CONS_MAX_ATTR_SZ 16
367 #define RUNECODE_MIN 0xc8
368 #define RUNECODE_LINE_VERT 0xc8
369 #define RUNECODE_LINE_CROSS 0xc9
370 #define RUNECODE_CORNER_BR 0xca
371 #define RUNECODE_CORNER_BL 0xcb
372 #define RUNECODE_ARROW_RIGHT 0xcc
373 #define RUNECODE_ARROW_LEFT 0xcd
374 #define RUNECODE_LINE_HORIZ 0xce
375 #define RUNECODE_CORNER_TL 0xcf
376 #define RUNECODE_CORNER_TR 0xd0
377 #define RUNECODE_LINE_UP 0xd1
378 #define RUNECODE_CURVE_CORNER_TL 0xd2
379 #define RUNECODE_CURVE_CORNER_TR 0xd3
380 #define RUNECODE_CURVE_CORNER_BR 0xd4
381 #define RUNECODE_CURVE_CORNER_BL 0xd5
382 #define RUNECODE_MAX 0xd6
384 #define RUNECODESTR_MIN 0xc8
385 #define RUNECODESTR_LINE_VERT "\xc8"
386 #define RUNECODESTR_LINE_CROSS "\xc9"
387 #define RUNECODESTR_CORNER_BR "\xca"
388 #define RUNECODESTR_CORNER_BL "\xcb"
389 #define RUNECODESTR_ARROW_RIGHT "\xcc"
390 #define RUNECODESTR_ARROW_LEFT "\xcd"
391 #define RUNECODESTR_LINE_HORIZ "\xce"
392 #define RUNECODESTR_CORNER_TL "\xcf"
393 #define RUNECODESTR_CORNER_TR "\xd0"
394 #define RUNECODESTR_LINE_UP "\xd1"
395 #define RUNECODESTR_CURVE_CORNER_TL "\xd2"
396 #define RUNECODESTR_CURVE_CORNER_TR "\xd3"
397 #define RUNECODESTR_CURVE_CORNER_BR "\xd4"
398 #define RUNECODESTR_CURVE_CORNER_BL "\xd5"
399 #define RUNECODESTR_MAX 0xd5
401 #define RUNE_LINE_VERT "│"
402 #define RUNE_LINE_CROSS "┼"
403 #define RUNE_LINE_HORIZ "─"
404 #define RUNE_LINE_UP "↑"
405 #define RUNE_CORNER_BR "┘"
406 #define RUNE_CORNER_BL "└"
407 #define RUNE_CORNER_TL "┌"
408 #define RUNE_CORNER_TR "┐"
409 #define RUNE_ARROW_RIGHT "ᐳ"
410 #define RUNE_ARROW_LEFT "ᐸ"
411 #define RUNE_ARROW_UP "ᐱ"
412 #define RUNE_ARROW_DOWN "ᐯ"
413 #define RUNE_CURVE_CORNER_TL "╭"
414 #define RUNE_CURVE_CORNER_TR "╮"
415 #define RUNE_CURVE_CORNER_BR "╯"
416 #define RUNE_CURVE_CORNER_BL "╰"
417 #define RUNE_LONG_LINE_HORIZ "―"
418 #define UTF_CIRCLE "\u25EF"
419 #define UTF_BLOCK "\u2588"
422 #define UTF8_POLICE_CARS_REVOLVING_LIGHT "🚨"
423 #define UTF8_WHITE_HEAVY_CHECK_MARK "✅"
424 #define UTF8_SEE_NO_EVIL_MONKEY "🙈"
425 #define UTF8_SKULL_AND_CROSSBONES "☠"
426 #define UTF8_KEYBOARD "⌨"
427 #define UTF8_LEFT_POINTING_MAGNIFYING_GLASS "🔍"
428 #define UTF8_DOOR "🚪"
431 #define UTF8_VS16 "\xef\xb8\x8f"
433 typedef char *(*RzConsEditorCallback)(
void *core,
const char *
file,
const char *
str);
436 typedef void *(*RzConsSleepBeginCallback)(
void *core);
499 #define HUD_BUF_SIZE 512
536 struct termios term_raw, term_buf;
538 unsigned long term_raw, term_buf, term_xterm;
539 unsigned long old_input_mode, old_output_mode;
578 #define RZ_CONS_KEY_F1 0xf1
579 #define RZ_CONS_KEY_F2 0xf2
580 #define RZ_CONS_KEY_F3 0xf3
581 #define RZ_CONS_KEY_F4 0xf4
582 #define RZ_CONS_KEY_F5 0xf5
583 #define RZ_CONS_KEY_F6 0xf6
584 #define RZ_CONS_KEY_F7 0xf7
585 #define RZ_CONS_KEY_F8 0xf8
586 #define RZ_CONS_KEY_F9 0xf9
587 #define RZ_CONS_KEY_F10 0xfa
588 #define RZ_CONS_KEY_F11 0xfb
589 #define RZ_CONS_KEY_F12 0xfc
591 #define RZ_CONS_KEY_ESC 0x1b
593 #define RZ_CONS_CLEAR_LINE "\x1b[2K\r"
594 #define RZ_CONS_CLEAR_SCREEN "\x1b[2J\r"
595 #define RZ_CONS_CLEAR_FROM_CURSOR_TO_END "\x1b[0J\r"
597 #define RZ_CONS_CURSOR_SAVE "\x1b[s"
598 #define RZ_CONS_CURSOR_RESTORE "\x1b[u"
599 #define RZ_CONS_GET_CURSOR_POSITION "\x1b[6n"
600 #define RZ_CONS_CURSOR_UP "\x1b[A"
601 #define RZ_CONS_CURSOR_DOWN "\x1b[B"
602 #define RZ_CONS_CURSOR_RIGHT "\x1b[C"
603 #define RZ_CONS_CURSOR_LEFT "\x1b[D"
605 #define Color_BLINK "\x1b[5m"
606 #define Color_INVERT "\x1b[7m"
607 #define Color_INVERT_RESET "\x1b[27m"
615 #define Color_RESET_TERMINAL "\x1b" \
616 "c\x1b(K\x1b[0m\x1b[J\x1b[?25h"
617 #define Color_RESET "\x1b[0m"
618 #define Color_RESET_NOBG "\x1b[27;22;24;25;28;39m"
619 #define Color_RESET_BG "\x1b[49m"
620 #define Color_RESET_ALL "\x1b[0m\x1b[49m"
621 #define Color_BLACK "\x1b[30m"
622 #define Color_BGBLACK "\x1b[40m"
623 #define Color_RED "\x1b[31m"
624 #define Color_BGRED "\x1b[41m"
625 #define Color_WHITE "\x1b[37m"
626 #define Color_BGWHITE "\x1b[47m"
627 #define Color_GREEN "\x1b[32m"
628 #define Color_BGGREEN "\x1b[42m"
629 #define Color_MAGENTA "\x1b[35m"
630 #define Color_BGMAGENTA "\x1b[45m"
631 #define Color_YELLOW "\x1b[33m"
632 #define Color_BGYELLOW "\x1b[43m"
633 #define Color_CYAN "\x1b[36m"
634 #define Color_BGCYAN "\x1b[46m"
635 #define Color_BLUE "\x1b[34m"
636 #define Color_BGBLUE "\x1b[44m"
637 #define Color_GRAY "\x1b[90m"
638 #define Color_BGGRAY "\x1b[100m"
640 #define Color_BBLACK Color_GRAY
641 #define Color_BBGBLACK Color_BGGRAY
642 #define Color_BRED "\x1b[91m"
643 #define Color_BBGRED "\x1b[101m"
644 #define Color_BWHITE "\x1b[97m"
645 #define Color_BBGWHITE "\x1b[107m"
646 #define Color_BGREEN "\x1b[92m"
647 #define Color_BBGGREEN "\x1b[102m"
648 #define Color_BMAGENTA "\x1b[95m"
649 #define Color_BBGMAGENTA "\x1b[105m"
650 #define Color_BYELLOW "\x1b[93m"
651 #define Color_BBGYELLOW "\x1b[103m"
652 #define Color_BCYAN "\x1b[96m"
653 #define Color_BBGCYAN "\x1b[106m"
654 #define Color_BBLUE "\x1b[94m"
655 #define Color_BBGBLUE "\x1b[104m"
657 #if defined(_MSC_VER) || (defined(__GNUC__) && __GNUC__ < 5)
658 #define RZCOLOR(a, r, g, b, bgr, bgg, bgb, id16) \
659 { 0, a, r, g, b, bgr, bgg, bgb, id16 }
661 #define RZCOLOR(a, r, g, b, bgr, bgg, bgb, id16) \
662 (RzColor) { 0, a, r, g, b, bgr, bgg, bgb, id16 }
664 #define RzColor_NULL RZCOLOR(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -1)
666 #define RzColor_BLACK RZCOLOR(ALPHA_FG, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0)
667 #define RzColor_BGBLACK RZCOLOR(ALPHA_BG, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0)
668 #define RzColor_RED RZCOLOR(ALPHA_FG, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 1)
669 #define RzColor_BGRED RZCOLOR(ALPHA_BG, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 1)
670 #define RzColor_WHITE RZCOLOR(ALPHA_FG, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 7)
671 #define RzColor_BGWHITE RZCOLOR(ALPHA_BG, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 7)
672 #define RzColor_GREEN RZCOLOR(ALPHA_FG, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 2)
673 #define RzColor_BGGREEN RZCOLOR(ALPHA_BG, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 2)
674 #define RzColor_MAGENTA RZCOLOR(ALPHA_FG, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 5)
675 #define RzColor_BGMAGENTA RZCOLOR(ALPHA_BG, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 5)
676 #define RzColor_YELLOW RZCOLOR(ALPHA_FG, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 3)
677 #define RzColor_BGYELLOW RZCOLOR(ALPHA_BG, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 3)
678 #define RzColor_CYAN RZCOLOR(ALPHA_FG, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 6)
679 #define RzColor_BGCYAN RZCOLOR(ALPHA_BG, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 6)
680 #define RzColor_BLUE RZCOLOR(ALPHA_FG, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 4)
681 #define RzColor_BGBLUE RZCOLOR(ALPHA_BG, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 4)
682 #define RzColor_BBLACK RZCOLOR(ALPHA_FG, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 8)
683 #define RzColor_BBGBLACK RZCOLOR(ALPHA_BG, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 8)
684 #define RzColor_BRED RZCOLOR(ALPHA_FG, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 9)
685 #define RzColor_BBGRED RZCOLOR(ALPHA_BG, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 9)
686 #define RzColor_BWHITE RZCOLOR(ALPHA_FG, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 15)
687 #define RzColor_BBGWHITE RZCOLOR(ALPHA_BG, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 15)
688 #define RzColor_BGREEN RZCOLOR(ALPHA_FG, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 10)
689 #define RzColor_BBGGREEN RZCOLOR(ALPHA_BG, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 10)
690 #define RzColor_BMAGENTA RZCOLOR(ALPHA_FG, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 13)
691 #define RzColor_BBGMAGENTA RZCOLOR(ALPHA_BG, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 13)
692 #define RzColor_BYELLOW RZCOLOR(ALPHA_FG, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 11)
693 #define RzColor_BBGYELLOW RZCOLOR(ALPHA_BG, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 11)
694 #define RzColor_BCYAN RZCOLOR(ALPHA_FG, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 14)
695 #define RzColor_BBGCYAN RZCOLOR(ALPHA_BG, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 14)
696 #define RzColor_BBLUE RZCOLOR(ALPHA_FG, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 12)
697 #define RzColor_BBGBLUE RZCOLOR(ALPHA_BG, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 12)
702 #define RzColor_BLACK RZCOLOR(ALPHA_FG, 12, 12, 12, 0x00, 0x00, 0x00, 0)
703 #define RzColor_BGBLACK RZCOLOR(ALPHA_BG, 12, 12, 12, 0x00, 0x00, 0x00, 0)
704 #define RzColor_RED RZCOLOR(ALPHA_FG, 197, 15, 31, 0x00, 0x00, 0x00, 1)
705 #define RzColor_BGRED RZCOLOR(ALPHA_BG, 197, 15, 31, 0x00, 0x00, 0x00, 1)
706 #define RzColor_WHITE RZCOLOR(ALPHA_FG, 204, 204, 204, 0x00, 0x00, 0x00, 7)
707 #define RzColor_BGWHITE RZCOLOR(ALPHA_BG, 204, 204, 204, 0x00, 0x00, 0x00, 7)
708 #define RzColor_GREEN RZCOLOR(ALPHA_FG, 19, 161, 14, 0x00, 0x00, 0x00, 2)
709 #define RzColor_BGGREEN RZCOLOR(ALPHA_BG, 19, 161, 14, 0x00, 0x00, 0x00, 2)
710 #define RzColor_MAGENTA RZCOLOR(ALPHA_FG, 136, 23, 152, 0x00, 0x00, 0x00, 5)
711 #define RzColor_BGMAGENTA RZCOLOR(ALPHA_BG, 136, 23, 152, 0x00, 0x00, 0x00, 5)
712 #define RzColor_YELLOW RZCOLOR(ALPHA_FG, 193, 156, 0, 0x00, 0x00, 0x00, 3)
713 #define RzColor_BGYELLOW RZCOLOR(ALPHA_BG, 193, 156, 0, 0x00, 0x00, 0x00, 3)
714 #define RzColor_CYAN RZCOLOR(ALPHA_FG, 58, 150, 221, 0x00, 0x00, 0x00, 6)
715 #define RzColor_BGCYAN RZCOLOR(ALPHA_BG, 58, 150, 221, 0x00, 0x00, 0x00, 6)
716 #define RzColor_BLUE RZCOLOR(ALPHA_FG, 0, 55, 218, 0x00, 0x00, 0x00, 4)
717 #define RzColor_BGBLUE RZCOLOR(ALPHA_BG, 0, 55, 218, 0x00, 0x00, 0x00, 4)
718 #define RzColor_BBLACK RZCOLOR(ALPHA_FG, 118, 118, 118, 0x00, 0x00, 0x00, 8)
719 #define RzColor_BBGBLACK RZCOLOR(ALPHA_BG, 118, 118, 118, 0x00, 0x00, 0x00, 8)
720 #define RzColor_BRED RZCOLOR(ALPHA_FG, 231, 72, 86, 0x00, 0x00, 0x00, 9)
721 #define RzColor_BBGRED RZCOLOR(ALPHA_BG, 231, 72, 86, 0x00, 0x00, 0x00, 9)
722 #define RzColor_BWHITE RZCOLOR(ALPHA_FG, 242, 242, 242, 0x00, 0x00, 0x00, 15)
723 #define RzColor_BBGWHITE RZCOLOR(ALPHA_BG, 242, 242, 242, 0x00, 0x00, 0x00, 15)
724 #define RzColor_BGREEN RZCOLOR(ALPHA_FG, 22, 198, 12, 0x00, 0x00, 0x00, 10)
725 #define RzColor_BBGGREEN RZCOLOR(ALPHA_BG, 22, 198, 12, 0x00, 0x00, 0x00, 10)
726 #define RzColor_BMAGENTA RZCOLOR(ALPHA_FG, 180, 0, 158, 0x00, 0x00, 0x00, 13)
727 #define RzColor_BBGMAGENTA RZCOLOR(ALPHA_BG, 180, 0, 158, 0x00, 0x00, 0x00, 13)
728 #define RzColor_BYELLOW RZCOLOR(ALPHA_FG, 249, 241, 165, 0x00, 0x00, 0x00, 11)
729 #define RzColor_BBGYELLOW RZCOLOR(ALPHA_BG, 249, 241, 165, 0x00, 0x00, 0x00, 11)
730 #define RzColor_BCYAN RZCOLOR(ALPHA_FG, 97, 214, 214, 0x00, 0x00, 0x00, 14)
731 #define RzColor_BBGCYAN RZCOLOR(ALPHA_BG, 97, 214, 214, 0x00, 0x00, 0x00, 14)
732 #define RzColor_BBLUE RZCOLOR(ALPHA_FG, 59, 120, 255, 0x00, 0x00, 0x00, 12)
733 #define RzColor_BBGBLUE RZCOLOR(ALPHA_BG, 59, 120, 255, 0x00, 0x00, 0x00, 12)
735 #define RzColor_GRAY RzColor_BBLACK
736 #define RzColor_BGGRAY RzColor_BBGBLACK
738 #define Colors_PLAIN \
740 Color_BLACK, Color_RED, Color_WHITE, \
741 Color_GREEN, Color_MAGENTA, Color_YELLOW, \
742 Color_CYAN, Color_BLUE, Color_GRAY \
783 #define DOT_STYLE_NORMAL 0
784 #define DOT_STYLE_CONDITIONAL 1
785 #define DOT_STYLE_BACKEDGE 2
802 #define ARROW_RIGHT 8
831 typedef void (*RzConsBreak)(
void *);
852 RZ_API void rz_cons_w32_clear(
void);
853 RZ_API void rz_cons_w32_gotoxy(
int fd,
int x,
int y);
854 RZ_API int rz_cons_w32_print(
const char *ptr,
int len,
bool vmode);
857 RZ_API int rz_cons_win_vhprintf(
unsigned long hdl,
bool vmode,
const char *fmt, va_list ap);
900 #define rz_cons_print(x) rz_cons_strcat(x)
991 #define RZ_LINE_BUFSIZE 4096
992 #define RZ_LINE_HISTSIZE 256
994 #define RZ_EDGES_X_INC 4
996 #define RZ_SELWIDGET_MAXH 15
997 #define RZ_SELWIDGET_MAXW 30
998 #define RZ_SELWIDGET_DIR_UP 0
999 #define RZ_SELWIDGET_DIR_DOWN 1
1084 typedef char *(*RzLineEditorCb)(
void *core,
const char *
str);
1137 typedef int(RzLineReadCallback)(
void *user,
const char *
line);
1162 #define RZ_CONS_INVERT(x, y) (y ? (x ? Color_INVERT : Color_INVERT_RESET) : (x ? "[" : "]"))
1242 static inline void cfmakeraw(
struct termios *tm) {
RZ_API void rz_cons_canvas_print_region(RzConsCanvas *c)
RZ_API void rz_cons_canvas_print(RzConsCanvas *c)
RZ_API RZ_OWN char * rz_cons_canvas_to_string(RzConsCanvas *c)
RZ_API void rz_cons_canvas_write(RzConsCanvas *c, const char *s)
RZ_API bool rz_cons_canvas_gotoxy(RzConsCanvas *c, int x, int y)
RZ_API void rz_cons_canvas_fill(RzConsCanvas *c, int x, int y, int w, int h, char ch)
RZ_API int rz_cons_canvas_resize(RzConsCanvas *c, int w, int h)
RZ_API void rz_cons_canvas_line(RzConsCanvas *c, int x, int y, int x2, int y2, RzCanvasLineStyle *style)
RZ_API void rz_cons_canvas_clear(RzConsCanvas *c)
RZ_API RzConsCanvas * rz_cons_canvas_new(int w, int h)
RZ_API void rz_cons_canvas_box(RzConsCanvas *c, int x, int y, int w, int h, const char *color)
RZ_API void rz_cons_canvas_free(RzConsCanvas *c)
RZ_API void rz_cons_canvas_line_square_defined(RzConsCanvas *c, int x, int y, int x2, int y2, RzCanvasLineStyle *style, int bendpoint, int isvert)
RZ_API void rz_cons_canvas_line_square(RzConsCanvas *c, int x, int y, int x2, int y2, RzCanvasLineStyle *style)
RZ_API void rz_cons_canvas_line_diagonal(RzConsCanvas *c, int x, int y, int x2, int y2, RzCanvasLineStyle *style)
RZ_API void rz_cons_canvas_line_back_edge(RzConsCanvas *c, int x, int y, int x2, int y2, RzCanvasLineStyle *style, int ybendpoint1, int xbendpoint, int ybendpoint2, int isvert)
RZ_API void rz_cons_pipe_close(int fd)
RZ_API int rz_cons_pipe_open(const char *file, int fdn, int append)
RZ_API void rz_cons_break_clear(void)
RZ_API int rz_cons_get_buffer_len(void)
RZ_API void rz_cons_set_utf8(bool b)
RZ_API void rz_cons_zero(void)
RZ_API void rz_cons_filter(void)
RZ_API bool rz_cons_default_context_is_interactive(void)
RZ_API void rz_cons_memset(char ch, int len)
RZ_API void rz_cons_last(void)
RZ_API void rz_cons_clear00(void)
RZ_API void rz_cons_break_timeout(int timeout)
RZ_API bool rz_cons_set_cup(bool enable)
RZ_API void rz_cons_breakword(RZ_NULLABLE const char *s)
RZ_API void rz_cons_set_raw(bool is_raw)
RZ_API bool rz_cons_drop(int n)
RZ_API int rz_cons_get_size(int *rows)
RZ_API RZ_OWN char * rz_cons_get_buffer_dup(void)
Return a newly allocated buffer containing what's currently in RzCons buffer.
RZ_API void rz_cons_context_free(RzConsContext *context)
RZ_API int rz_cons_memcat(const char *str, int len)
RZ_API const char * rz_cons_get_rune(const ut8 ch)
RZ_API void rz_cons_set_last_interactive(void)
RZ_API RzConsContext * rz_cons_context_new(RZ_NULLABLE RzConsContext *parent)
RZ_API void rz_cons_enable_highlight(const bool enable)
RZ_API void rz_cons_visual_write(char *buffer)
RZ_API void rz_cons_set_title(const char *str)
RZ_API void rz_cons_context_reset(void)
RZ_API bool rz_cons_enable_mouse(const bool enable)
RZ_API void rz_cons_column(int c)
RZ_API RzCons * rz_cons_singleton(void)
RZ_API char * rz_cons_lastline_utf8_ansi_len(int *len)
RZ_API void rz_cons_clear_line(int std_err)
RZ_API void rz_cons_context_break(RzConsContext *context)
RZ_API void rz_cons_strcat(const char *str)
RZ_API void rz_cons_newline(void)
RZ_API void rz_cons_highlight(const char *word)
RZ_API void * rz_cons_sleep_begin(void)
RZ_API void rz_cons_break_pop(void)
RZ_API char * rz_cons_lastline(int *len)
RZ_API void rz_cons_strcat_justify(const char *str, int j, char c)
RZ_API void rz_cons_bind(RzConsBind *bind)
RZ_API void rz_cons_break_push(RzConsBreak cb, void *user)
RZ_API void rz_cons_set_interactive(bool x)
RZ_API RzCons * rz_cons_new(void)
RZ_API int rz_cons_printf(const char *format,...)
RZ_API void rz_cons_reset_colors(void)
RZ_API void rz_cons_echo(const char *msg)
RZ_API void rz_cons_chop(void)
RZ_API void rz_cons_color(int fg, int r, int g, int b)
RZ_API const char * rz_cons_get_buffer(void)
Return the current RzCons buffer.
RZ_API void rz_cons_printf_list(const char *format, va_list ap)
RZ_API void rz_cons_invert(int set, int color)
RZ_API void rz_cons_clear_buffer(void)
RZ_API int rz_cons_get_cur_line(void)
RZ_API bool rz_cons_is_interactive(void)
RZ_API void rz_cons_context_break_pop(RzConsContext *context, bool sig)
RZ_API void rz_cons_cmd_help(const char *help[], bool use_color)
RZ_API bool rz_cons_isatty(void)
RZ_API int rz_cons_get_cursor(RZ_NONNULL int *rows)
Calculates the aproximated x,y coordinates of the cursor before flushing.
RZ_API void rz_cons_visual_flush(void)
RZ_API void rz_cons_strcat_at(const char *_str, int x, char y, int w, int h)
RZ_API bool rz_cons_get_click(int *x, int *y)
RZ_API void rz_cons_goto_origin_reset(void)
RZ_API char * rz_cons_swap_ground(const char *col)
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 RzColor rz_cons_color_random(ut8 alpha)
RZ_API int rz_cons_eof(void)
RZ_API void rz_cons_fill_line(void)
RZ_API void rz_cons_break_end(void)
RZ_API void rz_cons_context_load(RzConsContext *context)
RZ_API bool rz_cons_is_breaked(void)
RZ_API void rz_cons_println(const char *str)
RZ_API void rz_cons_context_break_push(RzConsContext *context, RzConsBreak cb, void *user, bool sig)
RZ_API void rz_cons_set_flush(bool flush)
Set whether RzCons should flush content to screen or not.
RZ_API void rz_cons_sleep_end(void *user)
RZ_API void rz_cons_gotoxy(int x, int y)
RZ_API void rz_cons_clear(void)
RZ_API int rz_cons_get_column(void)
RZ_API bool rz_cons_context_is_main(void)
RZ_API void rz_cons_reset(void)
RZ_API RzCons * rz_cons_free(void)
RZ_API void rz_cons_pop(void)
RZ_API void rz_cons_push(void)
RZ_API bool rz_cons_is_utf8(void)
static static fork const void static count static fd const char const char static newpath const char static path const char path
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 static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
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 cmd
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 int rz_line_dietline_init(void)
RZ_API int rz_line_hist_cmd_down(RzLine *line)
RZ_API const char * rz_line_readline(void)
RZ_API int rz_line_hist_cmd_up(RzLine *line)
RZ_API int rz_line_hist_list(void)
RZ_API void rz_line_autocomplete(void)
RZ_API void rz_line_hist_free(void)
RZ_API int rz_line_hist_load(RZ_NONNULL const char *path)
Load the history of commands from path.
RZ_API const char * rz_line_readline_cb(RzLineReadCallback cb, void *user)
RZ_API int rz_line_set_hist_callback(RzLine *line, RzLineHistoryUpCb up, RzLineHistoryDownCb down)
RZ_API const char * rz_line_hist_get(int n)
RZ_API int rz_line_hist_add(const char *line)
RZ_API int rz_line_hist_save(RZ_NONNULL const char *path)
Save the history of commands executed until now to file path.
RZ_API void rz_cons_grep_help(void)
RZ_API char * rz_cons_grep_strip(char *cmd, const char *quotestr)
RZ_API void rz_cons_grep_parsecmd(char *cmd, const char *quotestr)
RZ_API int rz_cons_grep_line(char *buf, int len)
RZ_API void rz_cons_grep_process(char *grep)
RZ_API void rz_cons_grep(const char *grep)
RZ_API void rz_cons_grepbuf(void)
RZ_API char * rz_cons_html_filter(const char *ptr, int *newlen)
RZ_API void rz_cons_message(RZ_NONNULL const char *msg)
RZ_API char * rz_cons_hud_path(const char *path, int dir)
RZ_API char * rz_cons_hud_file(const char *f)
RZ_API char * rz_cons_hud(RzList *list, const char *prompt)
RZ_API char * rz_cons_hud_string(const char *s)
RZ_API int rz_cons_less_str(const char *str, const char *exitkeys)
RZ_API void rz_cons_less(void)
static void list(RzEgg *egg)
RZ_API RzLine * rz_line_singleton(void)
RZ_API void rz_line_set_prompt(const char *prompt)
RZ_API void rz_line_completion_push(RzLineCompletion *completion, const char *str)
RZ_API RZ_OWN char * rz_line_get_prompt(void)
RZ_API void rz_line_clipboard_push(const char *str)
RZ_API void rz_line_completion_set(RzLineCompletion *completion, int argc, const char **argv)
RZ_API void rz_line_ns_completion_result_free(RzLineNSCompletionResult *res)
RZ_API RzLine * rz_line_new(void)
RZ_API RzLineNSCompletionResult * rz_line_ns_completion_result_new(size_t start, size_t end, const char *end_string)
RZ_API void rz_line_completion_fini(RzLineCompletion *completion)
RZ_API void rz_line_ns_completion_result_add(RzLineNSCompletionResult *res, const char *option)
RZ_API void rz_line_completion_clear(RzLineCompletion *completion)
RZ_API void rz_line_completion_init(RzLineCompletion *completion, size_t args_limit)
RZ_API void rz_line_ns_completion_result_propose(RzLineNSCompletionResult *res, const char *option, const char *cur, size_t cur_len)
Add a new option to the list of possible autocomplete-able value if it matches the given string.
RZ_API void rz_line_free(void)
static static fork const void static count static fd const char const char static newpath char char argv
RZ_API RzColor rz_cons_pal_get(const char *key)
RZ_API void rz_cons_pal_show(void)
RZ_API void rz_cons_pal_free(RzConsContext *ctx)
RZ_API void rz_cons_pal_update_event(void)
RZ_API int rz_cons_pal_set(const char *key, const char *val)
RZ_API const char * rz_cons_pal_get_name(int index)
RZ_API void rz_cons_pal_list(int rad, const char *arg)
RZ_API char * rz_cons_rainbow_get(int idx, int last, bool bg)
RZ_API void rz_cons_pal_init(RzConsContext *ctx)
RZ_API void rz_cons_rainbow_free(RzConsContext *ctx)
RZ_API RzColor rz_cons_pal_get_i(int index)
RZ_API int rz_cons_pal_len(void)
RZ_API char * rz_cons_pal_parse(const char *str, RzColor *outcol)
RZ_API void rz_cons_rainbow_new(RzConsContext *ctx, int sz)
RZ_API void rz_cons_pal_random(void)
RZ_API void rz_cons_pal_copy(RzConsContext *dst, RzConsContext *src)
RZ_API void rz_cons_rgb_init(void)
RZ_API char * rz_cons_rgb_str_mode(RzConsColorMode mode, char *outstr, size_t sz, const RzColor *rcolor)
RZ_API int rz_cons_rgb_parse(const char *p, ut8 *r, ut8 *g, ut8 *b, ut8 *a)
RZ_API char * rz_cons_rgb_str_off(char *outstr, size_t sz, ut64 off)
RZ_API char * rz_cons_rgb_str(char *outstr, size_t sz, const RzColor *rcolor)
RZ_API char * rz_cons_rgb_tostring(ut8 r, ut8 g, ut8 b)
int(* RzLineHistoryUpCb)(RzLine *line)
@ RZ_VIRT_TERM_MODE_COMPLETE
All the sequences goes through VT (Windows Terminal, mintty, all OSs)
@ RZ_VIRT_TERM_MODE_OUTPUT_ONLY
Windows only: Use console c api for input, but output on VT (Windows >= 10)
@ RZ_VIRT_TERM_MODE_DISABLE
Windows only: Use console c api for everything (Windows <= 8)
void(* RzConsQueueTaskOneshot)(void *core, void *task, void *user)
RZ_LIB_VERSION_HEADER(rz_cons)
void(* RzConsFlush)(void)
int(* RzConsGetSize)(int *rows)
int(* RzLineCompletionCb)(RzLineCompletion *completion, RzLineBuffer *buf, RzLinePromptType prompt_type, void *user)
struct rz_cons_context_t RzConsContext
int(* RzConsGetCursor)(RZ_NONNULL int *rows)
struct rz_cons_bind_t RzConsBind
void(* RzConsEvent)(void *)
struct rz_selection_widget_t RzSelWidget
void(* RzConsFunctionKey)(void *core, int fkey)
struct rz_hud_t RzLineHud
RzLineNSCompletionResult *(* RzLineNSCompletionCb)(RzLineBuffer *buf, RzLinePromptType prompt_type, void *user)
struct rz_line_hist_t RzLineHistory
struct rz_cons_input_context_t RzConsInputContext
struct rz_panels_t RzPanels
struct rz_panels_root_t RzPanelsRoot
@ PANEL_LAYOUT_DEFAULT_DYNAMIC
@ PANEL_LAYOUT_DEFAULT_STATIC
int(* RzPanelsMenuCallback)(void *user)
struct rz_cons_canvas_line_style_t RzCanvasLineStyle
void(* RzConsGrepCallback)(const char *grep)
struct rz_cons_grep_t RzConsGrep
void *(* RzConsSleepBeginCallback)(void *core)
struct rz_panels_menu_item RzPanelsMenuItem
struct rz_line_buffer_t RzLineBuffer
struct rz_cons_canvas_t RzConsCanvas
#define RZ_CONS_GREP_WORDS
int(* RzLineHistoryDownCb)(RzLine *line)
#define RZ_CONS_GREP_TOKENS
struct rz_cons_palette_t RzConsPalette
int(* RzConsClickCallback)(void *core, int x, int y)
struct rz_cons_printable_palette_t RzConsPrintablePalette
struct rz_line_ns_completion_result_t RzLineNSCompletionResult
bool(* RzConsIsBreaked)(void)
void(* RzConsSleepEndCallback)(void *core, void *user)
#define RZ_CONS_GREP_WORD_SIZE
struct rz_panels_menu_t RzPanelsMenu
char *(* RzLineEditorCb)(void *core, const char *str)
char *(* RzConsEditorCallback)(void *core, const char *file, const char *str)
@ RZ_CONS_PAL_SEEK_PREVIOUS
void(* RzConsBreakCallback)(void *core)
void(* RzLogCallback)(const char *output, const char *funcname, const char *filename, ut32 lineno, RzLogLevel level, const char *tag, const char *fmtstr,...) RZ_PRINTF_CHECK(7
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
#define RZ_PRINTF_CHECK(fmt, dots)
static struct sockaddr static addrlen static backlog const void msg
RzConsIsBreaked is_breaked
RzConsGetCursor get_cursor
RzConsGrepCallback cb_grep
RzConsEvent event_interrupt
RzConsPrintablePalette pal
void * event_interrupt_data
RzLogCallback log_callback
int tokens[RZ_CONS_GREP_TOKENS]
char strings[RZ_CONS_GREP_WORDS][RZ_CONS_GREP_WORD_SIZE]
RzColor gui_alt_background
char * gui_alt_background
RzConsSleepBeginCallback cb_sleep_begin
bool show_autocomplete_widget
RzConsSleepEndCallback cb_sleep_end
RzConsBreakCallback cb_break
RzConsQueueTaskOneshot cb_task_oneshot
RzConsClickCallback cb_click
RzConsEditorCallback cb_editor
RZ_DEPRECATE bool newline
RzConsFunctionKey cb_fkey
RzConsInputContext * input
int(* user_fgets)(char *buf, int len, void *user)
char data[RZ_LINE_BUFSIZE]
size_t start
First byte that was considered for autocompletion. Everything before this will be left intact.
const char * end_string
String to place after the only option available is autocompleted. By default a space is used.
HtPP * options_ht
Hash table to keep track of duplicated autocompletion suggestions.
size_t end
Last byte that was considered for autocompletion. Everything after this will be left intact.
RzPVector options
Vector of options that can be used for autocompletion.
void * run_user
User data that can be passed to the callback.
RzLineNSCompletionCb run
Callback function that is called when autocompletion is required. (e.g. TAB is pressed)
int(* hist_up)(void *user)
RzListIter * sdbshell_hist_iter
RzLineCompletion completion
RzLinePromptType prompt_type
RzLineHistoryDownCb cb_history_down
int(* hist_down)(void *user)
RzLineHistoryUpCb cb_history_up
RzLineNSCompletion ns_completion
RzConsFunctionKey cb_fkey
RzPanelsRootState root_state
RzPanelsMenu * panels_menu
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]
int def(FILE *source, FILE *dest, int level)