From 32500239ac3198651a9f8d6427324ad776fb66a3 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 14 Apr 2021 10:30:22 -0400 Subject: [PATCH] cell_extract() -> nccell_extract() --- NEWS.md | 2 +- include/ncpp/Plane.hh | 2 +- include/notcurses/notcurses.h | 10 ++++++++-- src/lib/notcurses.c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 70e0631d3..a47103b11 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,7 +6,7 @@ rearrangements of Notcurses. function `nccell_extended_gcluster()`, which the former now wraps. It will be removed in ABI3. The same treatment has been applied to `cell_load_egc32()`, `cell_load_char()`, `cellcmp()`, `cell_init()`, - `cell_load()`, and `cell_prime()`. + `cell_extract()`, `cell_load()`, and `cell_prime()`. * 2.2.6 (2021-04-12) * `ncplane_rgba()` has been deprecated in favor of the new function diff --git a/include/ncpp/Plane.hh b/include/ncpp/Plane.hh index f6ae371e5..f83ef3bbd 100644 --- a/include/ncpp/Plane.hh +++ b/include/ncpp/Plane.hh @@ -1198,7 +1198,7 @@ namespace ncpp char* extract (Cell const& cell, uint16_t *stylemask = nullptr, uint64_t *channels = nullptr) { - return cell_extract (plane, cell, stylemask, channels); + return nccell_extract (plane, cell, stylemask, channels); } // FIXME these can except if fed a sprixel, right (returns NULL)? diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 9d98ea19f..f70942206 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -828,8 +828,8 @@ cell_strdup(const struct ncplane* n, const nccell* c){ // Extract the three elements of a nccell. static inline char* -cell_extract(const struct ncplane* n, const nccell* c, - uint16_t* stylemask, uint64_t* channels){ +nccell_extract(const struct ncplane* n, const nccell* c, + uint16_t* stylemask, uint64_t* channels){ if(stylemask){ *stylemask = c->stylemask; } @@ -839,6 +839,12 @@ cell_extract(const struct ncplane* n, const nccell* c, return nccell_strdup(n, c); } +__attribute__ ((deprecated)) static inline char* +cell_extract(const struct ncplane* n, const nccell* c, + uint16_t* stylemask, uint64_t* channels){ + return nccell_extract(n, c, stylemask, channels); +} + // Returns true if the two nccells are distinct EGCs, attributes, or channels. // The actual egcpool index needn't be the same--indeed, the planes needn't even // be the same. Only the expanded EGC must be equal. The EGC must be bit-equal; diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 5b875b0b4..ef65ddf97 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -154,7 +154,7 @@ char* ncplane_at_cursor(ncplane* n, uint16_t* stylemask, uint64_t* channels){ char* ncplane_at_yx(const ncplane* n, int y, int x, uint16_t* stylemask, uint64_t* channels){ if(y < n->leny && x < n->lenx){ if(y >= 0 && x >= 0){ - return cell_extract(n, &n->fb[nfbcellidx(n, y, x)], stylemask, channels); + return nccell_extract(n, &n->fb[nfbcellidx(n, y, x)], stylemask, channels); } } return NULL;