From 1dfcb826a6b1f75b4fb520dfd8ae7cecd8194f51 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 15 Jun 2020 00:18:43 -0400 Subject: [PATCH] skeleton of mojibake demo #689 --- doc/man/man1/notcurses-demo.1.md | 3 ++- src/demo/demo.c | 4 ++-- src/demo/demo.h | 1 + src/demo/mojibake.c | 8 ++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 src/demo/mojibake.c diff --git a/doc/man/man1/notcurses-demo.1.md b/doc/man/man1/notcurses-demo.1.md index 78e0205a4..656ba1410 100644 --- a/doc/man/man1/notcurses-demo.1.md +++ b/doc/man/man1/notcurses-demo.1.md @@ -33,6 +33,7 @@ The demonstrations include (see NOTES below): * (i)ntro—a setting of tone * (j)ungle—low-bandwidth color cycling reveals ancient ruins * (l)uigi—a dashing Apennine plumber in a world of fire +* (m)ojibake—a selection of market-price emoji * (n)ormal—a normal map of a friend, with effects * (o)utro—a message of hope from the library's author * (q)rcode—quick response codes (from ISO/IEC 18004:2015) @@ -72,7 +73,7 @@ At any time, press 'q' to quit. The demo is best run in at least an 80x45 termin **-V**: Print the program name and version, and exit with success. demospec: Select which demos to run, and what order to run them in. The -default is **ixeaydthnbcgrwuvlsfjqo**. See above for a list of demos. +default is **ixeaydthnbcmgrwuvlsfjqo**. See above for a list of demos. Default margins are all 0, and thus the full screen will be rendered. Using **-m**, margins can be supplied. Provide a single number to set all four margins diff --git a/src/demo/demo.c b/src/demo/demo.c index 0ed63d725..f7f4978a6 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -19,7 +19,7 @@ static int democount; static demoresult* results; static char *datadir = NOTCURSES_SHARE; -static const char DEFAULT_DEMO[] = "ixeaydthnbcgrwuvlsfjqo"; +static const char DEFAULT_DEMO[] = "ixeaydthnbcmgrwuvlsfjqo"; atomic_bool interrupted = ATOMIC_VAR_INIT(false); // checked following demos, whether aborted, failed, or otherwise @@ -85,7 +85,7 @@ static struct { { "jungle", jungle_demo, true, }, { NULL, NULL, false, }, // FIXME { "luigi", luigi_demo, true, }, - { NULL, NULL, false, }, // mojibake + { "mojibake", mojibake_demo, false, }, { "normal", normal_demo, false, }, { "outro", outro, false, }, { NULL, NULL, false, }, // pango diff --git a/src/demo/demo.h b/src/demo/demo.h index 679d24db4..283db5615 100644 --- a/src/demo/demo.h +++ b/src/demo/demo.h @@ -45,6 +45,7 @@ int fallin_demo(struct notcurses* nc); int highcontrast_demo(struct notcurses* nc); int jungle_demo(struct notcurses* nc); int yield_demo(struct notcurses* nc); +int mojibake_demo(struct notcurses* nc); int normal_demo(struct notcurses* nc); int sliding_puzzle_demo(struct notcurses* nc); int view_demo(struct notcurses* nc); diff --git a/src/demo/mojibake.c b/src/demo/mojibake.c new file mode 100644 index 000000000..52f88173d --- /dev/null +++ b/src/demo/mojibake.c @@ -0,0 +1,8 @@ +#include "demo.h" + +int mojibake_demo(struct notcurses* nc){ + if(!notcurses_canutf8(nc)){ + return 0; + } + return 0; +}