ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit 32d5d8c61ffbace91db0b9001424cfc153d798ca
parent c222ee527630159b3d1098d3fc1cca0fd971333b
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 14 Feb 2020 17:24:35 +0100

Define an array of function pointers to each loader.

Diffstat:
MCMakeLists.txt | 2+-
Msrc/ansilove.c | 1+
Asrc/types.c | 33+++++++++++++++++++++++++++++++++
Asrc/types.h | 19+++++++++++++++++++
4 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -34,7 +34,7 @@ find_path(ANSILOVE_INCLUDE_DIRS ansilove.h) find_library(ANSILOVE_LIBRARIES NAMES ansilove REQUIRED) include_directories(${ANSILOVE_INCLUDE_DIRS}) -set(SRC src/ansilove.c src/strtolower.c src/sauce.c) +set(SRC src/ansilove.c src/types.c src/strtolower.c src/sauce.c) if(NOT HAVE_PLEDGE) set (SRC ${SRC} compat/pledge.c) diff --git a/src/ansilove.c b/src/ansilove.c @@ -34,6 +34,7 @@ #include "fonts.h" #include "sauce.h" #include "strtolower.h" +#include "types.h" /* prototypes */ static void synopsis(void); diff --git a/src/types.c b/src/types.c @@ -0,0 +1,33 @@ +/* + * types.c + * Ansilove 4.0.7 + * https://www.ansilove.org + * + * Copyright (c) 2011-2020 Stefan Vogt, Brian Cassidy, and Frederic Cambus + * All rights reserved. + * + * Ansilove is licensed under the BSD 2-Clause License. + * See LICENSE file for details. + */ + +#include "ansilove.h" + +char *types[] = { + "ans", + "adf", + "bin", + "idf", + "pcb", + "tnd", + "xb", +}; + +int (*loaders[])(struct ansilove_ctx *, struct ansilove_options *) = { + ansilove_ansi, + ansilove_artworx, + ansilove_binary, + ansilove_icedraw, + ansilove_pcboard, + ansilove_tundra, + ansilove_xbin +}; diff --git a/src/types.h b/src/types.h @@ -0,0 +1,19 @@ +/* + * types.h + * Ansilove 4.0.7 + * https://www.ansilove.org + * + * Copyright (c) 2011-2020 Stefan Vogt, Brian Cassidy, and Frederic Cambus + * All rights reserved. + * + * Ansilove is licensed under the BSD 2-Clause License. + * See LICENSE file for details. + */ + +#ifndef TYPES_H +#define TYPES_H + +extern char *types[]; +extern int (*loaders[])(struct ansilove_ctx *, struct ansilove_options *); + +#endif /* TYPES_H */