From 54ed51df78f47aee68d673c656519ecfd8512559 Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 18 Oct 2008 21:31:45 +0000 Subject: [PATCH] Port powerpipo to the unified libcaca 0.99.beta15 API. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/powerpipo/trunk@2986 92316355-f0b4-4df1-b90c-862c8a59935f --- configure.ac | 4 ++-- src/main.c | 44 ++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 87a8f6a..7aef693 100644 --- a/configure.ac +++ b/configure.ac @@ -26,10 +26,10 @@ if test "$build" != "$host" -a "${PKG_CONFIG_LIBDIR}" = ""; then fi CACA="no" -PKG_CHECK_MODULES(CACA, caca >= 0.99.beta9, +PKG_CHECK_MODULES(CACA, caca >= 0.99.beta15, [CACA="yes"], [AC_MSG_RESULT(no) - AC_MSG_ERROR([you need libcaca version 0.99.beta9 or later])]) + AC_MSG_ERROR([you need libcaca version 0.99.beta15 or later])]) # Optimizations CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" diff --git a/src/main.c b/src/main.c index d664ea6..896b70c 100644 --- a/src/main.c +++ b/src/main.c @@ -16,19 +16,19 @@ #include -#include +#include #include -static void do_page(cucul_canvas_t *, int); -static void runtoilet(cucul_canvas_t *, char const *, char const *); +static void do_page(caca_canvas_t *, int); +static void runtoilet(caca_canvas_t *, char const *, char const *); int main(int argc, char *argv[]) { caca_display_t *dp; - cucul_canvas_t *cv; + caca_canvas_t *cv; int page = 0, npages = 10, changed = 1; - cv = cucul_create_canvas(0, 0); + cv = caca_create_canvas(0, 0); dp = caca_create_display(cv); if(!dp) @@ -78,71 +78,71 @@ int main(int argc, char *argv[]) end: caca_free_display(dp); - cucul_free_canvas(cv); + caca_free_canvas(cv); return 0; } -static void do_page(cucul_canvas_t *cv, int page) +static void do_page(caca_canvas_t *cv, int page) { char str[BUFSIZ]; - cucul_canvas_t *tmp; + caca_canvas_t *tmp; - cucul_clear_canvas(cv); - tmp = cucul_create_canvas(0, 0); + caca_clear_canvas(cv); + tmp = caca_create_canvas(0, 0); if(page < 1) goto end; sprintf(str, "\x1b[33;93m» \x1b[37;97mEfficient presentations"); runtoilet(tmp, "-f smmono12", str); - cucul_blit(cv, 4, 0, tmp, NULL); + caca_blit(cv, 4, 0, tmp, NULL); if(page < 2) goto end; sprintf(str, "\x1b[32;92m» \x1b[37;97mWhy text mode?"); runtoilet(tmp, "-f smmono9", str); - cucul_blit(cv, 11, 9, tmp, NULL); + caca_blit(cv, 11, 9, tmp, NULL); if(page < 3) goto end; sprintf(str, "\x1b[32;92m» \x1b[37;97mExample: \x1b[34mp\x1b[35mo\x1b[36mw\x1b[32me\x1b[31mr\x1b[34mp\x1b[35mi\x1b[36mp\x1b[32mo\x1b[37m™"); runtoilet(tmp, "-f smmono9", str); - cucul_blit(cv, 11, 16, tmp, NULL); + caca_blit(cv, 11, 16, tmp, NULL); if(page < 4) goto end; sprintf(str, "\x1b[33;93m» \x1b[37;97mAdvanced stuff"); runtoilet(tmp, "-f smmono12", str); - cucul_blit(cv, 4, 24, tmp, NULL); + caca_blit(cv, 4, 24, tmp, NULL); if(page < 5) goto end; sprintf(str, "\x1b[32;92m» \x1b[37;97mTransition effects"); runtoilet(tmp, "-f smmono9", str); - cucul_blit(cv, 11, 34, tmp, NULL); + caca_blit(cv, 11, 34, tmp, NULL); if(page < 6) goto end; sprintf(str, "\x1b[32;92m» \x1b[37;97mColor filters"); runtoilet(tmp, "-f smmono9 --gay", str); - cucul_blit(cv, 11, 41, tmp, NULL); + caca_blit(cv, 11, 41, tmp, NULL); if(page < 7) goto end; sprintf(str, "\x1b[32;92m» \x1b[37;97mPictures and movies"); runtoilet(tmp, "-f smmono9", str); - cucul_blit(cv, 11, 48, tmp, NULL); + caca_blit(cv, 11, 48, tmp, NULL); if(page < 8) goto end; sprintf(str, "\x1b[32;92m» \x1b[37;97mEmbedded applications"); runtoilet(tmp, "-f smmono9", str); - cucul_blit(cv, 11, 55, tmp, NULL); + caca_blit(cv, 11, 55, tmp, NULL); end: - cucul_printf(cv, 0, 0, "page %i", page); + caca_printf(cv, 0, 0, "page %i", page); } /* Warning: quotes are not safe */ -static void runtoilet(cucul_canvas_t *cv, char const *options, char const *str) +static void runtoilet(caca_canvas_t *cv, char const *options, char const *str) { char buf[BUFSIZ], cmd[BUFSIZ]; FILE *f; int ret; - cucul_set_canvas_size(cv, 0, 0); + caca_set_canvas_size(cv, 0, 0); sprintf(cmd, "toilet -w 1000 %s '%s'", options, str); f = popen(cmd, "r"); @@ -153,7 +153,7 @@ static void runtoilet(cucul_canvas_t *cv, char const *options, char const *str) if(ret <= 0) return; - ret = cucul_import_memory(cv, buf, ret, "utf8"); + ret = caca_import_memory(cv, buf, ret, "utf8"); if(ret <= 0) return; }