mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
stop supporting/advertising renderfp #2081
This commit is contained in:
parent
eae4453ea7
commit
b978f58985
11
USAGE.md
11
USAGE.md
@ -126,9 +126,6 @@ typedef struct notcurses_options {
|
|||||||
// the environment variable TERM is used. Failure to open the terminal
|
// the environment variable TERM is used. Failure to open the terminal
|
||||||
// definition will result in failure to initialize Notcurses.
|
// definition will result in failure to initialize Notcurses.
|
||||||
const char* termtype;
|
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
|
// Progressively higher log levels result in more logging to stderr. By
|
||||||
// default, nothing is printed to stderr once fullscreen service begins.
|
// default, nothing is printed to stderr once fullscreen service begins.
|
||||||
ncloglevel_e loglevel;
|
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
|
diagnostics to be printed to `stderr`: you could ensure `stderr` is redirected
|
||||||
if you make use of this functionality.
|
if you make use of this functionality.
|
||||||
|
|
||||||
It's probably wise to export `NCOPTION_NO_ALTERNATE_SCREEN` to the user (e.g. via
|
It's probably wise to export `NCOPTION_NO_ALTERNATE_SCREEN` to the user (e.g.
|
||||||
command line option or environment variable). Developers and motivated users
|
via command line option or environment variable). Motivated users might
|
||||||
might appreciate the ability to manipulate `loglevel` and `renderfp`. The
|
appreciate the ability to manipulate `loglevel`. The remaining options are
|
||||||
remaining options are typically of use only to application authors.
|
typically of use only to application authors.
|
||||||
|
|
||||||
The Notcurses API draws almost entirely into the virtual buffers of `ncplane`s.
|
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
|
Only upon a call to `notcurses_render` will the visible terminal display be
|
||||||
|
@ -9,7 +9,7 @@ notcurses-demo - Show off some Notcurses features
|
|||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**notcurses-demo** [**-h**|**--help**] [**-p** ***path***] [**-d** ***delaymult***]
|
**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***
|
[**-V**|**--version**] [**-kc**] ***demospec***
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
@ -34,7 +34,6 @@ typedef enum {
|
|||||||
|
|
||||||
typedef struct notcurses_options {
|
typedef struct notcurses_options {
|
||||||
const char* termtype;
|
const char* termtype;
|
||||||
FILE* renderfp;
|
|
||||||
ncloglevel_e loglevel;
|
ncloglevel_e loglevel;
|
||||||
int margin_t, margin_r, margin_b, margin_l;
|
int margin_t, margin_r, margin_b, margin_l;
|
||||||
uint64_t flags; // from NCOPTION_* bits
|
uint64_t flags; // from NCOPTION_* bits
|
||||||
|
@ -898,9 +898,7 @@ typedef struct notcurses_options {
|
|||||||
// the environment variable TERM is used. Failure to open the terminal
|
// the environment variable TERM is used. Failure to open the terminal
|
||||||
// definition will result in failure to initialize notcurses.
|
// definition will result in failure to initialize notcurses.
|
||||||
const char* termtype;
|
const char* termtype;
|
||||||
// If non-NULL, notcurses_render() will write each rendered frame to this
|
FILE* renderfp; // deprecated, must be NULL, will be removed for ABI3 FIXME
|
||||||
// FILE* in addition to outfp. This is used primarily for debugging.
|
|
||||||
FILE* renderfp;
|
|
||||||
// Progressively higher log levels result in more logging to stderr. By
|
// Progressively higher log levels result in more logging to stderr. By
|
||||||
// default, nothing is printed to stderr once fullscreen service begins.
|
// default, nothing is printed to stderr once fullscreen service begins.
|
||||||
ncloglevel_e loglevel;
|
ncloglevel_e loglevel;
|
||||||
|
@ -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,
|
GNU_PY_CHECK_BOOL(PyArg_ParseTupleAndKeywords(args, kwds, "|O!sO!isO!O!O!O!K", keywords,
|
||||||
&PyLong_Type, &main_fd_object,
|
&PyLong_Type, &main_fd_object,
|
||||||
&term_type, &PyLong_Type, &render_fd_object, &log_level,
|
&term_type, &PyLong_Type, &log_level,
|
||||||
&margins_str,
|
&margins_str,
|
||||||
&PyLong_Type, &margin_top, &PyLong_Type, &margin_right, &PyLong_Type, &margin_bottom, &PyLong_Type, &margin_left,
|
&PyLong_Type, &margin_top, &PyLong_Type, &margin_right, &PyLong_Type, &margin_bottom, &PyLong_Type, &margin_left,
|
||||||
&flags));
|
&flags));
|
||||||
@ -91,20 +91,6 @@ Notcurses_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
|
|||||||
|
|
||||||
options.termtype = term_type;
|
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;
|
options.loglevel = (ncloglevel_e)log_level;
|
||||||
|
|
||||||
if (NULL != margins_str)
|
if (NULL != margins_str)
|
||||||
|
@ -67,7 +67,6 @@ use libnotcurses_sys::*;
|
|||||||
fn main() {
|
fn main() {
|
||||||
let options = ffi::notcurses_options {
|
let options = ffi::notcurses_options {
|
||||||
termtype: null(),
|
termtype: null(),
|
||||||
renderfp: null_mut(),
|
|
||||||
loglevel: 0,
|
loglevel: 0,
|
||||||
margin_t: 0,
|
margin_t: 0,
|
||||||
margin_r: 0,
|
margin_r: 0,
|
||||||
|
@ -73,7 +73,6 @@
|
|||||||
//! fn main() {
|
//! fn main() {
|
||||||
//! let options = ffi::notcurses_options {
|
//! let options = ffi::notcurses_options {
|
||||||
//! termtype: null(),
|
//! termtype: null(),
|
||||||
//! renderfp: null_mut(),
|
|
||||||
//! loglevel: 0,
|
//! loglevel: 0,
|
||||||
//! margin_t: 0,
|
//! margin_t: 0,
|
||||||
//! margin_r: 0,
|
//! margin_r: 0,
|
||||||
|
@ -68,7 +68,6 @@ impl NcOptions {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
termtype: null(),
|
termtype: null(),
|
||||||
renderfp: null_mut(),
|
|
||||||
loglevel,
|
loglevel,
|
||||||
margin_t: margin_t as i32,
|
margin_t: margin_t as i32,
|
||||||
margin_r: margin_r as i32,
|
margin_r: margin_r as i32,
|
||||||
|
@ -132,7 +132,7 @@ usage(const char* exe, int status){
|
|||||||
if(n) ncdirect_set_fg_rgb8(n, 0x80, 0xff, 0x80);
|
if(n) ncdirect_set_fg_rgb8(n, 0x80, 0xff, 0x80);
|
||||||
fprintf(out, "%s ", exe);
|
fprintf(out, "%s ", exe);
|
||||||
const char* options[] = { "-hVkc", "-m margins", "-p path", "-l loglevel",
|
const char* options[] = { "-hVkc", "-m margins", "-p path", "-l loglevel",
|
||||||
"-d mult", "-J jsonfile", "-f renderfile", "demospec",
|
"-d mult", "-J jsonfile", "demospec",
|
||||||
NULL };
|
NULL };
|
||||||
for(const char** op = options ; *op ; ++op){
|
for(const char** op = options ; *op ; ++op){
|
||||||
usage_option(out, n, *op);
|
usage_option(out, n, *op);
|
||||||
@ -145,7 +145,6 @@ usage(const char* exe, int status){
|
|||||||
"-k", "keep screen; do not switch to alternate",
|
"-k", "keep screen; do not switch to alternate",
|
||||||
"-d", "delay multiplier (non-negative float)",
|
"-d", "delay multiplier (non-negative float)",
|
||||||
"-J", "emit JSON summary to file",
|
"-J", "emit JSON summary to file",
|
||||||
"-f", "render to file (in addition to stdout)",
|
|
||||||
"-c", "constant PRNG seed, useful for benchmarking",
|
"-c", "constant PRNG seed, useful for benchmarking",
|
||||||
"-m", "margin, or 4 comma-separated margins",
|
"-m", "margin, or 4 comma-separated margins",
|
||||||
NULL
|
NULL
|
||||||
@ -243,7 +242,6 @@ ext_demos(struct notcurses* nc, const char* spec){
|
|||||||
static const char*
|
static const char*
|
||||||
handle_opts(int argc, char** argv, notcurses_options* opts, FILE** json_output){
|
handle_opts(int argc, char** argv, notcurses_options* opts, FILE** json_output){
|
||||||
bool constant_seed = false;
|
bool constant_seed = false;
|
||||||
char *renderfile = NULL;
|
|
||||||
*json_output = NULL;
|
*json_output = NULL;
|
||||||
int c;
|
int c;
|
||||||
const struct option longopts[] = {
|
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, },
|
{ .name = NULL, .has_arg = 0, .flag = NULL, .val = 0, },
|
||||||
};
|
};
|
||||||
int lidx;
|
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){
|
switch(c){
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(*argv, EXIT_SUCCESS);
|
usage(*argv, EXIT_SUCCESS);
|
||||||
@ -297,21 +295,9 @@ handle_opts(int argc, char** argv, notcurses_options* opts, FILE** json_output){
|
|||||||
case 'k':
|
case 'k':
|
||||||
opts->flags |= NCOPTION_NO_ALTERNATE_SCREEN;
|
opts->flags |= NCOPTION_NO_ALTERNATE_SCREEN;
|
||||||
break;
|
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':
|
case 'p':
|
||||||
datadir = optarg;
|
datadir = optarg;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
|
||||||
renderfile = optarg;
|
|
||||||
break;
|
|
||||||
case 'd':{
|
case 'd':{
|
||||||
float f;
|
float f;
|
||||||
if(sscanf(optarg, "%f", &f) != 1){
|
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){
|
if(!constant_seed){
|
||||||
srand(time(NULL)); // a classic blunder lol
|
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){
|
if(optind < argc - 1){
|
||||||
fprintf(stderr, "Extra argument: %s\n", argv[optind + 1]);
|
fprintf(stderr, "Extra argument: %s\n", argv[optind + 1]);
|
||||||
usage(*argv, EXIT_FAILURE);
|
usage(*argv, EXIT_FAILURE);
|
||||||
@ -588,11 +567,6 @@ int main(int argc, char** argv){
|
|||||||
if(notcurses_stop(nc)){
|
if(notcurses_stop(nc)){
|
||||||
return EXIT_FAILURE;
|
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);
|
struct ncdirect* ncd = ncdirect_init(NULL, stdout, 0);
|
||||||
if(!ncd){
|
if(!ncd){
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -365,7 +365,6 @@ typedef struct notcurses {
|
|||||||
ncstats stashed_stats; // retain across a context reset, for closing banner
|
ncstats stashed_stats; // retain across a context reset, for closing banner
|
||||||
|
|
||||||
FILE* ttyfp; // FILE* for writing rasterized data
|
FILE* ttyfp; // FILE* for writing rasterized data
|
||||||
FILE* renderfp; // debugging FILE* to which renderings are written
|
|
||||||
tinfo tcache; // terminfo cache
|
tinfo tcache; // terminfo cache
|
||||||
pthread_mutex_t pilelock; // guards pile list, locks resize in render
|
pthread_mutex_t pilelock; // guards pile list, locks resize in render
|
||||||
bool suppress_banner; // from notcurses_options
|
bool suppress_banner; // from notcurses_options
|
||||||
|
@ -1099,7 +1099,6 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){
|
|||||||
reset_stats(&ret->stats.s);
|
reset_stats(&ret->stats.s);
|
||||||
reset_stats(&ret->stashed_stats);
|
reset_stats(&ret->stashed_stats);
|
||||||
ret->ttyfp = outfp;
|
ret->ttyfp = outfp;
|
||||||
ret->renderfp = opts->renderfp;
|
|
||||||
memset(&ret->rstate, 0, sizeof(ret->rstate));
|
memset(&ret->rstate, 0, sizeof(ret->rstate));
|
||||||
memset(&ret->palette_damage, 0, sizeof(ret->palette_damage));
|
memset(&ret->palette_damage, 0, sizeof(ret->palette_damage));
|
||||||
memset(&ret->palette, 0, sizeof(ret->palette));
|
memset(&ret->palette, 0, sizeof(ret->palette));
|
||||||
|
@ -1266,9 +1266,6 @@ raster_and_write(notcurses* nc, ncpile* p, fbuf* f){
|
|||||||
unblock_signals(&oldmask);
|
unblock_signals(&oldmask);
|
||||||
rasterize_sprixels_post(nc, p);
|
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);
|
//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){
|
if(ret < 0){
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user