From 7337280e176567af98deeb2f57e25d7dd6399fcd Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 6 May 2020 22:21:22 -0400 Subject: [PATCH] ncplane_at_yx(): const ncplane argument --- CHANGELOG.md | 1 + USAGE.md | 2 +- doc/man/man3/notcurses_plane.3.md | 2 +- include/notcurses/notcurses.h | 5 +++-- python/src/notcurses/build_notcurses.py | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56dd144ff..91ad78203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ rearrangements of Notcurses. `ncplane` to an `ncvisual`. The source plane may contain only spaces, half blocks, and full blocks. This builds atop the new function `ncplane_rgba()`, which makes an RGBA flat array from an `ncplane`. + * The `ncplane` argument to `ncplane_at_yx()` is now `const`. * 1.3.3 (2020-04-26) * The `ncdplot` type has been added for plots based on `double`s rather than diff --git a/USAGE.md b/USAGE.md index 5ba744384..7f5e9a66b 100644 --- a/USAGE.md +++ b/USAGE.md @@ -718,7 +718,7 @@ int ncplane_at_cursor_cell(struct ncplane* n, cell* c); // Retrieve the current contents of the specified cell. The EGC is returned, or // NULL on error. This EGC must be free()d by the caller. The attrword and // channels are written to 'attrword' and 'channels', respectively. -char* ncplane_at_yx(struct ncplane* n, int y, int x, +char* ncplane_at_yx(const struct ncplane* n, int y, int x, uint32_t* attrword, uint64_t* channels); // Retrieve the current contents of the specified cell into 'c'. This cell is diff --git a/doc/man/man3/notcurses_plane.3.md b/doc/man/man3/notcurses_plane.3.md index 7a4d6e0f9..86f3fb4b4 100644 --- a/doc/man/man3/notcurses_plane.3.md +++ b/doc/man/man3/notcurses_plane.3.md @@ -46,7 +46,7 @@ notcurses_plane - operations on ncplanes **int ncplane_at_cursor_cell(struct ncplane* n, cell* c);** -**char* ncplane_at_yx(struct ncplane* n, int y, int x, uint32_t* attrword, uint64_t* channels);** +**char* ncplane_at_yx(const struct ncplane* n, int y, int x, uint32_t* attrword, uint64_t* channels);** **int ncplane_at_yx_cell(struct ncplane* n, int y, int x, cell* c);** diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index f0a02193a..6a780e9db 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -675,7 +675,8 @@ cell_strdup(const struct ncplane* n, const cell* c){ // Extract the three elements of a cell. static inline char* -cell_extract(const struct ncplane* n, const cell* c, uint32_t* attrword, uint64_t* channels){ +cell_extract(const struct ncplane* n, const cell* c, + uint32_t* attrword, uint64_t* channels){ if(attrword){ *attrword = c->attrword; } @@ -1166,7 +1167,7 @@ ncplane_at_cursor_cell(struct ncplane* n, cell* c){ // Retrieve the current contents of the specified cell. The EGC is returned, or // NULL on error. This EGC must be free()d by the caller. The attrword and // channels are written to 'attrword' and 'channels', respectively. -API char* ncplane_at_yx(struct ncplane* n, int y, int x, +API char* ncplane_at_yx(const struct ncplane* n, int y, int x, uint32_t* attrword, uint64_t* channels); // Retrieve the current contents of the specified cell into 'c'. This cell is diff --git a/python/src/notcurses/build_notcurses.py b/python/src/notcurses/build_notcurses.py index 9024697ec..1807cd0cd 100644 --- a/python/src/notcurses/build_notcurses.py +++ b/python/src/notcurses/build_notcurses.py @@ -139,7 +139,7 @@ struct ncplane* ncplane_below(struct ncplane* n); char* notcurses_at_yx(struct notcurses* nc, int yoff, int xoff, uint32_t* attrword, uint64_t* channels); char* ncplane_at_cursor(struct ncplane* n, uint32_t* attrword, uint64_t* channels); int ncplane_at_cursor_cell(struct ncplane* n, cell* c); -char* ncplane_at_yx(struct ncplane* n, int y, int x, uint32_t* attrword, uint64_t* channels); +char* ncplane_at_yx(const struct ncplane* n, int y, int x, uint32_t* attrword, uint64_t* channels); int ncplane_at_yx_cell(struct ncplane* n, int y, int x, cell* c); uint32_t* ncplane_rgba(const struct ncplane* nc, int begy, int begx, int leny, int lenx); void* ncplane_set_userptr(struct ncplane* n, void* opaque);