From b978f58985f1027e743dc73195ca1d627654d3d2 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 21 Aug 2021 18:43:13 -0400 Subject: [PATCH] stop supporting/advertising renderfp #2081 --- USAGE.md | 11 ++++------- doc/man/man1/notcurses-demo.1.md | 2 +- doc/man/man3/notcurses_init.3.md | 1 - include/notcurses/notcurses.h | 4 +--- python/notcurses/context.c | 16 +--------------- rust/README.md | 1 - rust/src/lib.rs | 1 - rust/src/notcurses/methods.rs | 1 - src/demo/demo.c | 30 ++---------------------------- src/lib/internal.h | 1 - src/lib/notcurses.c | 1 - src/lib/render.c | 3 --- 12 files changed, 9 insertions(+), 63 deletions(-) diff --git a/USAGE.md b/USAGE.md index 59ce6631a..a7062be30 100644 --- a/USAGE.md +++ b/USAGE.md @@ -126,9 +126,6 @@ typedef struct notcurses_options { // the environment variable TERM is used. Failure to open the terminal // definition will result in failure to initialize Notcurses. const char* termtype; - // If non-NULL, notcurses_render() will write each rendered frame to this - // FILE* in addition to outfp. This is used primarily for debugging. - FILE* renderfp; // Progressively higher log levels result in more logging to stderr. By // default, nothing is printed to stderr once fullscreen service begins. ncloglevel_e loglevel; @@ -172,10 +169,10 @@ Setting `loglevel` to a value higher than `NCLOGLEVEL_SILENT` will cause diagnostics to be printed to `stderr`: you could ensure `stderr` is redirected if you make use of this functionality. -It's probably wise to export `NCOPTION_NO_ALTERNATE_SCREEN` to the user (e.g. via -command line option or environment variable). Developers and motivated users -might appreciate the ability to manipulate `loglevel` and `renderfp`. The -remaining options are typically of use only to application authors. +It's probably wise to export `NCOPTION_NO_ALTERNATE_SCREEN` to the user (e.g. +via command line option or environment variable). Motivated users might +appreciate the ability to manipulate `loglevel`. The remaining options are +typically of use only to application authors. The Notcurses API draws almost entirely into the virtual buffers of `ncplane`s. Only upon a call to `notcurses_render` will the visible terminal display be diff --git a/doc/man/man1/notcurses-demo.1.md b/doc/man/man1/notcurses-demo.1.md index 8bbea6d43..3f5d987a4 100644 --- a/doc/man/man1/notcurses-demo.1.md +++ b/doc/man/man1/notcurses-demo.1.md @@ -9,7 +9,7 @@ notcurses-demo - Show off some Notcurses features # SYNOPSIS **notcurses-demo** [**-h**|**--help**] [**-p** ***path***] [**-d** ***delaymult***] - [**-l** ***loglevel***] [**-f** ***renderfile***] [**-J** ***jsonfile***] [**-m** ***margins***] + [**-l** ***loglevel***] [**-J** ***jsonfile***] [**-m** ***margins***] [**-V**|**--version**] [**-kc**] ***demospec*** # DESCRIPTION diff --git a/doc/man/man3/notcurses_init.3.md b/doc/man/man3/notcurses_init.3.md index a6989ecb7..89523c859 100644 --- a/doc/man/man3/notcurses_init.3.md +++ b/doc/man/man3/notcurses_init.3.md @@ -34,7 +34,6 @@ typedef enum { typedef struct notcurses_options { const char* termtype; - FILE* renderfp; ncloglevel_e loglevel; int margin_t, margin_r, margin_b, margin_l; uint64_t flags; // from NCOPTION_* bits diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 7b889cc91..acd5f8028 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -898,9 +898,7 @@ typedef struct notcurses_options { // the environment variable TERM is used. Failure to open the terminal // definition will result in failure to initialize notcurses. const char* termtype; - // If non-NULL, notcurses_render() will write each rendered frame to this - // FILE* in addition to outfp. This is used primarily for debugging. - FILE* renderfp; + FILE* renderfp; // deprecated, must be NULL, will be removed for ABI3 FIXME // Progressively higher log levels result in more logging to stderr. By // default, nothing is printed to stderr once fullscreen service begins. ncloglevel_e loglevel; diff --git a/python/notcurses/context.c b/python/notcurses/context.c index e9923fb0b..25745ef68 100644 --- a/python/notcurses/context.c +++ b/python/notcurses/context.c @@ -82,7 +82,7 @@ Notcurses_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) GNU_PY_CHECK_BOOL(PyArg_ParseTupleAndKeywords(args, kwds, "|O!sO!isO!O!O!O!K", keywords, &PyLong_Type, &main_fd_object, - &term_type, &PyLong_Type, &render_fd_object, &log_level, + &term_type, &PyLong_Type, &log_level, &margins_str, &PyLong_Type, &margin_top, &PyLong_Type, &margin_right, &PyLong_Type, &margin_bottom, &PyLong_Type, &margin_left, &flags)); @@ -91,20 +91,6 @@ Notcurses_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) options.termtype = term_type; - if (NULL != render_fd_object) - { - long render_fd = GNU_PY_LONG_CHECK(render_fd_object); - - FILE *renderfp = fdopen((int)render_fd, "w"); - if (NULL == renderfp) - { - PyErr_SetString(PyExc_ValueError, "Failed to open render file descriptor."); - return NULL; - } - - options.renderfp = renderfp; - } - options.loglevel = (ncloglevel_e)log_level; if (NULL != margins_str) diff --git a/rust/README.md b/rust/README.md index 9f3bade84..cc6710a99 100644 --- a/rust/README.md +++ b/rust/README.md @@ -67,7 +67,6 @@ use libnotcurses_sys::*; fn main() { let options = ffi::notcurses_options { termtype: null(), - renderfp: null_mut(), loglevel: 0, margin_t: 0, margin_r: 0, diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 30522b859..3f8b64825 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -73,7 +73,6 @@ //! fn main() { //! let options = ffi::notcurses_options { //! termtype: null(), -//! renderfp: null_mut(), //! loglevel: 0, //! margin_t: 0, //! margin_r: 0, diff --git a/rust/src/notcurses/methods.rs b/rust/src/notcurses/methods.rs index 04223a25a..51440ddaf 100644 --- a/rust/src/notcurses/methods.rs +++ b/rust/src/notcurses/methods.rs @@ -68,7 +68,6 @@ impl NcOptions { ) -> Self { Self { termtype: null(), - renderfp: null_mut(), loglevel, margin_t: margin_t as i32, margin_r: margin_r as i32, diff --git a/src/demo/demo.c b/src/demo/demo.c index 1a54d6cb4..282a2c859 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -132,7 +132,7 @@ usage(const char* exe, int status){ if(n) ncdirect_set_fg_rgb8(n, 0x80, 0xff, 0x80); fprintf(out, "%s ", exe); const char* options[] = { "-hVkc", "-m margins", "-p path", "-l loglevel", - "-d mult", "-J jsonfile", "-f renderfile", "demospec", + "-d mult", "-J jsonfile", "demospec", NULL }; for(const char** op = options ; *op ; ++op){ usage_option(out, n, *op); @@ -145,7 +145,6 @@ usage(const char* exe, int status){ "-k", "keep screen; do not switch to alternate", "-d", "delay multiplier (non-negative float)", "-J", "emit JSON summary to file", - "-f", "render to file (in addition to stdout)", "-c", "constant PRNG seed, useful for benchmarking", "-m", "margin, or 4 comma-separated margins", NULL @@ -243,7 +242,6 @@ ext_demos(struct notcurses* nc, const char* spec){ static const char* handle_opts(int argc, char** argv, notcurses_options* opts, FILE** json_output){ bool constant_seed = false; - char *renderfile = NULL; *json_output = NULL; int c; const struct option longopts[] = { @@ -252,7 +250,7 @@ handle_opts(int argc, char** argv, notcurses_options* opts, FILE** json_output){ { .name = NULL, .has_arg = 0, .flag = NULL, .val = 0, }, }; int lidx; - while((c = getopt_long(argc, argv, "VhckJ:l:r:d:f:p:m:", longopts, &lidx)) != EOF){ + while((c = getopt_long(argc, argv, "VhckJ:l:d:p:m:", longopts, &lidx)) != EOF){ switch(c){ case 'h': usage(*argv, EXIT_SUCCESS); @@ -297,21 +295,9 @@ handle_opts(int argc, char** argv, notcurses_options* opts, FILE** json_output){ case 'k': opts->flags |= NCOPTION_NO_ALTERNATE_SCREEN; break; - case 'f': - if(opts->renderfp){ - fprintf(stderr, "-f may only be supplied once\n"); - usage(*argv, EXIT_FAILURE); - } - if((opts->renderfp = fopen(optarg, "wb")) == NULL){ - usage(*argv, EXIT_FAILURE); - } - break; case 'p': datadir = optarg; break; - case 'r': - renderfile = optarg; - break; case 'd':{ float f; if(sscanf(optarg, "%f", &f) != 1){ @@ -334,13 +320,6 @@ handle_opts(int argc, char** argv, notcurses_options* opts, FILE** json_output){ if(!constant_seed){ srand(time(NULL)); // a classic blunder lol } - if(renderfile){ - opts->renderfp = fopen(renderfile, "wb"); - if(opts->renderfp == NULL){ - fprintf(stderr, "Error opening %s for write\n", renderfile); - usage(*argv, EXIT_FAILURE); - } - } if(optind < argc - 1){ fprintf(stderr, "Extra argument: %s\n", argv[optind + 1]); usage(*argv, EXIT_FAILURE); @@ -588,11 +567,6 @@ int main(int argc, char** argv){ if(notcurses_stop(nc)){ return EXIT_FAILURE; } - if(nopts.renderfp){ - if(fclose(nopts.renderfp)){ - fprintf(stderr, "Warning: error closing renderfile\n"); - } - } struct ncdirect* ncd = ncdirect_init(NULL, stdout, 0); if(!ncd){ return EXIT_FAILURE; diff --git a/src/lib/internal.h b/src/lib/internal.h index 7b82d2d68..56e813a0a 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -365,7 +365,6 @@ typedef struct notcurses { ncstats stashed_stats; // retain across a context reset, for closing banner FILE* ttyfp; // FILE* for writing rasterized data - FILE* renderfp; // debugging FILE* to which renderings are written tinfo tcache; // terminfo cache pthread_mutex_t pilelock; // guards pile list, locks resize in render bool suppress_banner; // from notcurses_options diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 66e43c2cc..5030a6258 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1099,7 +1099,6 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){ reset_stats(&ret->stats.s); reset_stats(&ret->stashed_stats); ret->ttyfp = outfp; - ret->renderfp = opts->renderfp; memset(&ret->rstate, 0, sizeof(ret->rstate)); memset(&ret->palette_damage, 0, sizeof(ret->palette_damage)); memset(&ret->palette, 0, sizeof(ret->palette)); diff --git a/src/lib/render.c b/src/lib/render.c index 1af14b762..4e055f17b 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -1266,9 +1266,6 @@ raster_and_write(notcurses* nc, ncpile* p, fbuf* f){ unblock_signals(&oldmask); rasterize_sprixels_post(nc, p); //fprintf(stderr, "%lu/%lu %lu/%lu %lu/%lu %d\n", nc->stats.defaultelisions, nc->stats.defaultemissions, nc->stats.fgelisions, nc->stats.fgemissions, nc->stats.bgelisions, nc->stats.bgemissions, ret); - if(nc->renderfp){ - fprintf(nc->renderfp, "%s\n", (const char*)nc->rstate.f.buf); - } if(ret < 0){ return ret; }