8 #define USE_UTF8 (rz_cons_singleton()->use_utf8)
9 #define USE_UTF8_CURVY (rz_cons_singleton()->use_utf8_curvy)
11 #define W(y) rz_cons_canvas_write(c, y)
12 #define G(x, y) rz_cons_canvas_gotoxy(c, x, y)
15 return s &&
s[0] == 033 &&
s[1] ==
'[';
40 return ht_up_find(
c->attrs, loc,
NULL);
48 ht_up_update(
c->attrs, loc, (
void *)
c->attr);
50 ht_up_delete(
c->attrs, loc +
i);
63 while (*
p && *
p !=
'J' && *
p !=
'm' && *
p !=
'H') {
69 const int slen =
p -
s;
81 int i = 0, j = 0, fullwidths = 0;
82 while (
s[
i] &&
n > 0) {
83 if ((
s[
i] & 0xc0) != 0x80) {
92 return j + fullwidths;
96 int i = 0, fullwidths = 0;
97 while (
n > -1 &&
i < left &&
s[
i]) {
101 if ((
s[
i] & 0xc0) != 0x80) {
107 return n == -1 ?
i - 1 :
i;
115 int goback =
RZ_MAX(0, (buf_utf8_len - utf8_len));
116 int padding = (real_len - utf8_len) - goback;
119 if (padding > 0 &&
c->blen[
c->y] + padding >
c->bsize[
c->y]) {
120 int newsize =
RZ_MAX(
c->bsize[
c->y] * 1.5,
c->blen[
c->y] + padding);
121 char *newline =
realloc(
c->b[
c->y],
sizeof(*
c->b[
c->y]) * (newsize));
125 memset(newline +
c->bsize[
c->y], 0, newsize -
c->bsize[
c->y]);
126 c->b[
c->y] = newline;
127 c->bsize[
c->y] = newsize;
130 char *
start =
c->b[
c->y] +
c->x + goback;
140 c->blen[
c->y] += padding;
145 c->blen[
c->y] += padding;
156 for (y = 0; y <
c->h; y++) {
163 ht_up_free(
c->attrs);
169 HtUP *ht = (HtUP *)user;
170 ht_up_delete(ht,
key);
177 for (y = 0; y <
c->h; y++) {
207 if (
x >
c->blen[y] * 2) {
210 if (
x >=
c->blen[y]) {
214 if (x < c->blen[y] &&
x >= 0) {
224 if (
w < 1 ||
h < 1) {
249 for (
i = 0;
i <
h;
i++) {
273 for (j = 0; j <
i; j++) {
289 int left, slen, attr_len, piece_len;
290 int orig_x =
c->x, attr_x =
c->x;
301 if (piece_len == 0 && ch ==
'\0' && s_part ==
s) {
304 left =
c->blen[
c->y] -
c->x;
307 if (piece_len > left) {
309 if (utf8_piece_len >
c->w - attr_x) {
321 if (
G(
c->x -
c->sx,
c->y -
c->sy)) {
325 attr_len = slen <= 0 && s_part !=
s ? 1 : utf8_len;
326 if (attr_len > 0 && attr_x < c->blen[
c->y]) {
336 if (*
s ==
'\0' ||
c->y >=
c->h) {
354 int x, y, olen = 0, attr_x = 0;
355 bool is_first =
true;
357 for (y = 0; y <
c->h; y++) {
358 olen +=
c->blen[y] + 1;
370 for (y = 0; y <
c->h; y++) {
376 for (
x = 0;
x <
c->blen[y];
x++) {
377 if ((
c->b[y][
x] & 0xc0) != 0x80) {
380 size_t len = strlen(atr);
389 if (!
c->b[y][
x] ||
c->b[y][
x] ==
'\n') {
395 size_t rune_len = strlen(rune);
396 memcpy(o + olen, rune, rune_len + 1);
399 o[olen++] =
c->b[y][
x];
402 while (olen > 0 && o[olen - 1] ==
' ') {
433 if (!
c ||
w < 0 ||
h <= 0) {
436 int *newblen =
realloc(
c->blen,
sizeof *
c->blen *
h);
442 int *newbsize =
realloc(
c->bsize,
sizeof *
c->bsize *
h);
448 char **newb =
realloc(
c->b,
sizeof *
c->b *
h);
455 char *newline =
NULL;
456 for (
i = 0;
i <
h;
i++) {
466 for (j = 0; j <=
i; j++) {
469 ht_up_free(
c->attrs);
507 int roundcorners = 0;
513 row[0] = roundcorners ?
'.' : tl_corner[0];
515 memset(row + 1, hline[0],
w - 2);
518 row[
w - 1] = roundcorners ?
'.' : tr_corner[0];
526 row_ptr += x_mod -
x;
531 if (
G(x_mod, y +
h - 1)) {
532 row[0] = roundcorners ?
'\'' : bl_corner[0];
533 row[
w - 1] = roundcorners ?
'\'' : br_corner[0];
536 for (
i = 1;
i <
h - 1;
i++) {
540 if (
G(
x +
w - 1, y +
i)) {
562 for (
i = 0;
i <
h;
i++) {
RZ_API void rz_cons_canvas_print_region(RzConsCanvas *c)
static const char * set_attr(RzConsCanvas *c, const char *s)
static int __getAnsiPiece(const char *p, char *chr)
static bool __expandLine(RzConsCanvas *c, int real_len, int utf8_len)
static const char * __attributeAt(RzConsCanvas *c, int loc)
static int __getUtf8Length2(const char *s, int n, int left)
static void __stampAttribute(RzConsCanvas *c, int loc, int length)
static void attribute_free_kv(HtUPKv *kv)
static bool attribute_delete_cb(void *user, const ut64 key, const void *value)
RZ_API void rz_cons_canvas_print(RzConsCanvas *c)
RZ_API RZ_OWN char * rz_cons_canvas_to_string(RzConsCanvas *c)
static int __getUtf8Length(const char *s, int n)
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)
static bool __isAnsiSequence(const char *s)
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(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 const char * rz_cons_get_rune(const ut8 ch)
RZ_API void rz_cons_strcat(const char *str)
RZ_API void rz_cons_break_pop(void)
RZ_API void rz_cons_break_push(RzConsBreak cb, void *user)
RZ_API bool rz_cons_is_breaked(void)
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 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
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 length
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
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")
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
#define RUNECODESTR_CURVE_CORNER_TL
#define RUNECODESTR_LINE_HORIZ
#define RUNECODESTR_CORNER_BL
#define RUNECODESTR_CORNER_TL
#define RUNECODESTR_CORNER_BR
#define RUNECODESTR_CURVE_CORNER_BL
#define RUNECODESTR_CORNER_TR
#define RUNECODESTR_CURVE_CORNER_TR
#define RUNECODESTR_CURVE_CORNER_BR
#define RUNECODESTR_LINE_VERT
#define RZ_STR_ISNOTEMPTY(x)
RZ_API bool rz_str_char_fullwidth(const char *s, size_t left)
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...
#define RZ_STR_ISEMPTY(x)
RZ_API size_t rz_str_nlen(const char *s, size_t n)
RZ_API const char * rz_str_constpool_get(RzStrConstPool *pool, const char *str)
RZ_API void rz_str_constpool_fini(RzStrConstPool *pool)
RZ_API bool rz_str_constpool_init(RzStrConstPool *pool)
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
RZ_API void rz_strbuf_fini(RzStrBuf *sb)
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API void rz_strbuf_free(RzStrBuf *sb)
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API void rz_strbuf_init(RzStrBuf *sb)
RZ_API bool rz_strbuf_append_n(RzStrBuf *sb, const char *s, size_t l)
#define RZ_BETWEEN(x, y, z)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()