add notcurses_debug() #594

dankamongmen/speedy-blend
nick black 4 years ago
parent 3e1c9c05d4
commit 9f16034d02

@ -2842,6 +2842,10 @@ API char* ncreader_contents(const struct ncreader* n);
// UTF-8 input will be heap-duplicated and written to 'contents'.
API void ncreader_destroy(struct ncreader* n, char** contents);
// Dump selected notcurses state to the supplied 'debugfp'. Output is freeform,
// and subject to change. It includes geometry of all planes.
API void notcurses_debug(struct notcurses* nc, FILE* debugfp);
#undef API
#ifdef __cplusplus

@ -0,0 +1,14 @@
#include "internal.h"
void notcurses_debug(notcurses* nc, FILE* debugfp){
const ncplane* n = nc->top;
int planeidx = 0;
fprintf(debugfp, "********************* notcurses debug state *********************\n");
while(n){
fprintf(debugfp, "%04d off y: %3d x: %3d geom y: %3d x: %3d %s\n",
planeidx, n->y, n->x, n->leny, n->lenx,
n == notcurses_stdplane_const(nc) ? "std" : " ");
n = n->z;
}
fprintf(debugfp, "*****************************************************************\n");
}
Loading…
Cancel
Save