mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-22 23:31:26 +00:00
Keep RCons.strcat defines for backward compat ##api
This commit is contained in:
parent
7a2b40a9fd
commit
f570ac99ab
@ -269,7 +269,7 @@ R_API void r_cons_printat(const char *str, int x, char y) {
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_cons_strcat_justify(const char *str, int j, char c) {
|
||||
R_API void r_cons_print_justify(const char *str, int j, char c) {
|
||||
int i, o, len;
|
||||
for (o = i = len = 0; str[i]; i++, len++) {
|
||||
if (str[i] == '\n') {
|
||||
@ -291,7 +291,48 @@ R_API void r_cons_strcat_justify(const char *str, int j, char c) {
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_cons_strcat_at(const char *_str, int x, char y, int w, int h) {
|
||||
|
||||
#if 0
|
||||
// TODO: review and remove
|
||||
R_API void r_cons_print_at(char *s, int x, int y, int w, int h) {
|
||||
if (w < 0) {
|
||||
w = 0;
|
||||
}
|
||||
if (h < 0) {
|
||||
h = 0;
|
||||
}
|
||||
while (s) {
|
||||
int pos = 0;
|
||||
int ochar = s[pos];
|
||||
char *n = strchr (s, '\n');
|
||||
if (n) {
|
||||
*n = 0;
|
||||
if (w && r_str_ansi_len (s) > w) {
|
||||
const char *p = r_str_ansi_chrn (s, w);
|
||||
if (p) {
|
||||
pos = p - s;
|
||||
ochar = s[pos];
|
||||
s[pos] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
r_cons_gotoxy (x, y);
|
||||
r_cons_printf ("%s", s);
|
||||
if (n) {
|
||||
s[pos] = ochar;
|
||||
*n = '\n';
|
||||
s = n + 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (h && y > h) {
|
||||
break;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
R_API void r_cons_print_at(const char *_str, int x, char y, int w, int h) {
|
||||
int i, o, len;
|
||||
int cols = 0;
|
||||
int rows = 0;
|
||||
@ -1213,44 +1254,6 @@ R_API void r_cons_visual_flush(void) {
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_cons_print_at(char *s, int x, int y, int w, int h) {
|
||||
if (w < 0) {
|
||||
w = 0;
|
||||
}
|
||||
if (h < 0) {
|
||||
h = 0;
|
||||
}
|
||||
while (s) {
|
||||
int pos = 0;
|
||||
int ochar = s[pos];
|
||||
char *n = strchr (s, '\n');
|
||||
if (n) {
|
||||
*n = 0;
|
||||
if (w && r_str_ansi_len (s) > w) {
|
||||
const char *p = r_str_ansi_chrn (s, w);
|
||||
if (p) {
|
||||
pos = p - s;
|
||||
ochar = s[pos];
|
||||
s[pos] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
r_cons_gotoxy (x, y);
|
||||
r_cons_printf ("%s", s);
|
||||
if (n) {
|
||||
s[pos] = ochar;
|
||||
*n = '\n';
|
||||
s = n + 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (h && y > h) {
|
||||
break;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_cons_print_fps(int col) {
|
||||
int fps = 0, w = r_cons_get_size (NULL);
|
||||
fps = 0;
|
||||
@ -1958,7 +1961,7 @@ R_API void r_cons_column(int c) {
|
||||
b[C->buffer_len] = 0;
|
||||
r_cons_reset ();
|
||||
// align current buffer N chars right
|
||||
r_cons_strcat_justify (b, c, 0);
|
||||
r_cons_print_justify (b, c, 0);
|
||||
r_cons_gotoxy (0, 0);
|
||||
free (b);
|
||||
}
|
||||
|
@ -1534,7 +1534,7 @@ static void cmd_print_gadget(RCore *core, const char *_input) {
|
||||
r_list_foreach (core->gadgets, iter, g) {
|
||||
char *res = r_core_cmd_str (core, g->cmd);
|
||||
if (res) {
|
||||
r_cons_strcat_at (res, g->x, g->y, g->w, g->h);
|
||||
r_cons_print_at (res, g->x, g->y, g->w, g->h);
|
||||
free (res);
|
||||
}
|
||||
}
|
||||
|
@ -2364,7 +2364,7 @@ static void ds_show_comments_right(RDisasmState *ds) {
|
||||
r_cons_print (ds->pal_comment);
|
||||
}
|
||||
r_cons_print (" ; ");
|
||||
r_cons_strcat_justify (item->comment, mycols, ';');
|
||||
r_cons_print_justify (item->comment, mycols, ';');
|
||||
ds_newline (ds);
|
||||
if (ds->show_color) {
|
||||
ds_print_color_reset (ds);
|
||||
@ -5580,7 +5580,7 @@ static void ds_print_comments_right(RDisasmState *ds) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//r_cons_strcat_justify (comment, strlen (ds->refline) + 5, ';');
|
||||
// r_cons_print_justify (comment, strlen (ds->refline) + 5, ';');
|
||||
ds_print_color_reset (ds);
|
||||
R_FREE (ds->comment);
|
||||
}
|
||||
|
@ -1849,7 +1849,7 @@ R_API int r_core_visual_view_rop(RCore *core) {
|
||||
// get comment
|
||||
char *output = r_core_cmd_strf (core, "piu 10 @ 0x%08"PFMT64x, addr + delta);
|
||||
if (output) {
|
||||
r_cons_strcat_at (output, 0, 10, scr_w, 10);
|
||||
r_cons_print_at (output, 0, 10, scr_w, 10);
|
||||
free (output);
|
||||
}
|
||||
}
|
||||
|
@ -248,17 +248,17 @@ R_API int __core_visual_view_graph_update(RCore *core, RCoreVisualViewGraph *sta
|
||||
|
||||
char *title = r_str_newf ("[r2-visual-browser] addr=0x%08"PFMT64x" faddr=0x%08"PFMT64x, status->addr, status->fcn ? status->fcn->addr : 0);
|
||||
if (title) {
|
||||
r_cons_strcat_at (title, 0, 0, w - 1, 2);
|
||||
r_cons_print_at (title, 0, 0, w - 1, 2);
|
||||
free (title);
|
||||
}
|
||||
r_cons_strcat_at (xrefsColstr, 0, 2, colw, colh);
|
||||
r_cons_strcat_at (mainColstr, colx, 2, colw*2, colh);
|
||||
r_cons_strcat_at (refsColstr, colx * 2, 2, colw, colh);
|
||||
r_cons_print_at (xrefsColstr, 0, 2, colw, colh);
|
||||
r_cons_print_at (mainColstr, colx, 2, colw*2, colh);
|
||||
r_cons_print_at (refsColstr, colx * 2, 2, colw, colh);
|
||||
|
||||
char *output = r_core_cmd_strf (core, "pd %d @e:asm.flags=0@ 0x%08"PFMT64x"; pds 256 @ 0x%08"PFMT64x,
|
||||
32, status->addr, status->addr);
|
||||
int disy = colh + 2;
|
||||
r_cons_strcat_at (output, 10, disy, w, h - disy);
|
||||
r_cons_print_at (output, 10, disy, w, h - disy);
|
||||
free (output);
|
||||
r_cons_flush ();
|
||||
|
||||
|
@ -51,12 +51,12 @@ R_API int __core_visual_view_zigns_update(RCore *core, RCoreVisualViewZigns *sta
|
||||
|
||||
char *title = r_str_newf ("[r2-visual-signatures] 0x%08"PFMT64x" 0x%08"PFMT64x, status->addr, status->faddr);
|
||||
if (title) {
|
||||
r_cons_strcat_at (title, 0, 0, w - 1, 2);
|
||||
r_cons_print_at (title, 0, 0, w - 1, 2);
|
||||
free (title);
|
||||
}
|
||||
r_cons_strcat_at (col0str, 0, 2, colw, colh);
|
||||
r_cons_print_at (col0str, 0, 2, colw, colh);
|
||||
r_list_free (col0);
|
||||
r_cons_flush();
|
||||
r_cons_flush ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -908,20 +908,24 @@ R_API void r_cons_set_utf8(bool b);
|
||||
R_API void r_cons_grep(const char *grep);
|
||||
|
||||
/* output */
|
||||
// DEPRECATE R2_600
|
||||
|
||||
#define r_cons_strcat r_cons_print
|
||||
#define r_cons_strcat_at r_cons_print_at
|
||||
#define r_cons_strcat_justify r_cons_print_justify
|
||||
|
||||
R_API int r_cons_printf(const char *format, ...) R_PRINTF_CHECK(1, 2);
|
||||
R_API void r_cons_printf_list(const char *format, va_list ap);
|
||||
R_API void r_cons_print(const char *str);
|
||||
R_API void r_cons_strcat_at(const char *str, int x, char y, int w, int h);
|
||||
R_API void r_cons_print_at(const char *str, int x, char y, int w, int h);
|
||||
R_API void r_cons_println(const char* str);
|
||||
|
||||
R_API void r_cons_strcat_justify(const char *str, int j, char c);
|
||||
R_API void r_cons_print_justify(const char *str, int j, char c);
|
||||
R_API void r_cons_printat(const char *str, int x, char y);
|
||||
R_API int r_cons_write(const char *str, int len);
|
||||
R_API void r_cons_newline(void);
|
||||
R_API void r_cons_filter(void);
|
||||
R_API void r_cons_flush(void);
|
||||
R_API char *r_cons_drain(void);
|
||||
R_API void r_cons_print_at(char *s, int x, int y, int w, int h);
|
||||
R_API void r_cons_print_fps(int col);
|
||||
R_API void r_cons_last(void);
|
||||
R_API int r_cons_less_str(const char *str, const char *exitkeys);
|
||||
|
Loading…
x
Reference in New Issue
Block a user