From 20bf1ae2d4b13cdea68fde6ccbe41e14ade7960e Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 27 Sep 2020 16:46:39 -0400 Subject: [PATCH] nctablet_ncplane() -> nctablet_plane() --- NEWS.md | 1 + USAGE.md | 4 ++-- doc/man/man3/notcurses_reel.3.md | 2 +- include/notcurses/notcurses.h | 4 ++-- python/src/notcurses/build_notcurses.py | 2 +- src/demo/reel.c | 6 +++--- src/lib/reel.c | 2 +- src/libcpp/Tablet.cc | 2 +- tests/reel.cpp | 22 +++++++++++----------- 9 files changed, 23 insertions(+), 22 deletions(-) diff --git a/NEWS.md b/NEWS.md index 147f66a62..7efaa8295 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ rearrangements of Notcurses. * 1.7.5 (not yet released) * `ncreel_destroy()` now returns `void` rather than `int`. + * `nctablet_ncplane()` has been renamed `nctablet_plane()`. * 1.7.4 (2020-09-20) * All `_rgb_clipped()` functions have been renamed `_rgb8_clipped()`, to diff --git a/USAGE.md b/USAGE.md index cc7e42f1b..041758b05 100644 --- a/USAGE.md +++ b/USAGE.md @@ -2045,8 +2045,8 @@ void ncreel_destroy(struct ncreel* nr); // Returns a pointer to a user pointer associated with this nctablet. void* nctablet_userptr(struct nctablet* t); -// Access the ncplane associated with this nctablet, if one exists. -struct ncplane* nctablet_ncplane(struct nctablet* t); +// Access the ncplane associated with nctablet 't', if one exists. +struct ncplane* nctablet_plane(struct nctablet* t); ``` ### ncreel examples diff --git a/doc/man/man3/notcurses_reel.3.md b/doc/man/man3/notcurses_reel.3.md index a8f3cd551..1da882052 100644 --- a/doc/man/man3/notcurses_reel.3.md +++ b/doc/man/man3/notcurses_reel.3.md @@ -58,7 +58,7 @@ typedef struct ncreel_options { **void* nctablet_userptr(struct nctablet* t);** -**struct ncplane* nctablet_ncplane(struct nctablet* t);** +**struct ncplane* nctablet_plane(struct nctablet* t);** # DESCRIPTION diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 034b7d300..cf651827a 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -2540,8 +2540,8 @@ API void ncreel_destroy(struct ncreel* nr); // Returns a pointer to a user pointer associated with this nctablet. API void* nctablet_userptr(struct nctablet* t); -// Access the ncplane associated with this nctablet, if one exists. -API struct ncplane* nctablet_ncplane(struct nctablet* t); +// Access the ncplane associated with nctablet 't', if one exists. +API struct ncplane* nctablet_plane(struct nctablet* t); // The number of columns is one fewer, as the STRLEN expressions must leave // an extra byte open in case 'ยต' (U+00B5, 0xC2 0xB5) shows up. PREFIXCOLUMNS diff --git a/python/src/notcurses/build_notcurses.py b/python/src/notcurses/build_notcurses.py index 7bc128337..6b2afc8cc 100644 --- a/python/src/notcurses/build_notcurses.py +++ b/python/src/notcurses/build_notcurses.py @@ -339,7 +339,7 @@ struct nctablet* ncreel_next(struct ncreel* pr); struct nctablet* ncreel_prev(struct ncreel* pr); void ncreel_destroy(struct ncreel* pr); void* nctablet_userptr(struct nctablet* t); -struct ncplane* nctablet_ncplane(struct nctablet* t); +struct ncplane* nctablet_plane(struct nctablet* t); int ncplane_polyfill_yx(struct ncplane* n, int y, int x, const cell* c); int ncplane_gradient(struct ncplane* n, const char* egc, uint32_t styles, uint64_t ul, uint64_t ur, uint64_t ll, uint64_t lr, int ystop, int xstop); int ncplane_highgradient(struct ncplane* n, uint32_t ul, uint32_t ur, uint32_t ll, uint32_t lr, int ystop, int xstop); diff --git a/src/demo/reel.c b/src/demo/reel.c index e59384081..865d2dafd 100644 --- a/src/demo/reel.c +++ b/src/demo/reel.c @@ -88,7 +88,7 @@ tabletdraw(struct ncplane* w, int maxy, tabletctx* tctx, unsigned rgb){ static int drawcb(struct nctablet* t, bool drawfromtop){ - struct ncplane* p = nctablet_ncplane(t); + struct ncplane* p = nctablet_plane(t); tabletctx* tctx = nctablet_userptr(t); if(tctx == NULL){ return -1; @@ -137,9 +137,9 @@ tablet_thread(void* vtabletctx){ } pthread_mutex_unlock(&tctx->lock); pthread_mutex_lock(&renderlock); - if(nctablet_ncplane(tctx->t)){ + if(nctablet_plane(tctx->t)){ ncreel_redraw(tctx->pr); - struct ncplane* tplane = nctablet_ncplane(tctx->t); + struct ncplane* tplane = nctablet_plane(tctx->t); if(tplane){ demo_render(ncplane_notcurses(tplane)); } diff --git a/src/lib/reel.c b/src/lib/reel.c index 77ba105bd..6b92274f4 100644 --- a/src/lib/reel.c +++ b/src/lib/reel.c @@ -710,7 +710,7 @@ validate_ncreel_opts(ncplane* n, const ncreel_options* ropts){ return true; } -ncplane* nctablet_ncplane(nctablet* t){ +ncplane* nctablet_plane(nctablet* t){ return t->cbp; } diff --git a/src/libcpp/Tablet.cc b/src/libcpp/Tablet.cc index 2fa5e39d4..744db9e9e 100644 --- a/src/libcpp/Tablet.cc +++ b/src/libcpp/Tablet.cc @@ -32,5 +32,5 @@ void NcTablet::unmap_tablet (NcTablet *p) noexcept Plane* NcTablet::get_plane () const noexcept { - return Plane::map_plane (nctablet_ncplane (_tablet)); + return Plane::map_plane (nctablet_plane (_tablet)); } diff --git a/tests/reel.cpp b/tests/reel.cpp index ed4a7292b..c4a6bc84c 100644 --- a/tests/reel.cpp +++ b/tests/reel.cpp @@ -51,7 +51,7 @@ auto ncreel_validate(const ncreel* n) -> bool { } auto panelcb(struct nctablet* t, bool toptobottom) -> int { - CHECK(nctablet_ncplane(t)); + CHECK(nctablet_plane(t)); CHECK(!nctablet_userptr(t)); CHECK(toptobottom); // FIXME verify geometry is as expected @@ -272,7 +272,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(0, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 7; } @@ -284,7 +284,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(1, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 7; } @@ -296,7 +296,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(2, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 7; } @@ -308,7 +308,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(3, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 7; } @@ -320,7 +320,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(4, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 7; } @@ -350,7 +350,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(-1, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 5; } @@ -362,7 +362,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(1, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 5; } @@ -374,7 +374,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(2, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 5; } @@ -386,7 +386,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(3, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 5; } @@ -398,7 +398,7 @@ TEST_CASE("Reels") { for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){ CHECK_LE(4, order[n]); int y; - ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr); + ncplane_yx(ncplane_parent(nctablet_plane(tabs[n])), &y, nullptr); CHECK(y == expectedy); expectedy += 5; }