From 48ecccd284040b7490aeb0d3d2a24c6e378a0a16 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 2 Aug 2009 11:09:35 +0000 Subject: [PATCH] Make the libcaca color values an enum again. --- caca/caca.h | 52 +++++++++++++++++++++++++++++----------------------- caca/caca0.h | 38 ++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/caca/caca.h b/caca/caca.h index 4e5f8f7..c0764a6 100644 --- a/caca/caca.h +++ b/caca/caca.h @@ -67,29 +67,35 @@ typedef struct caca_event caca_event_t; * Colours and styles that can be used with caca_set_attr(). * * @{ */ -#define CACA_BLACK 0x00 /**< The colour index for black. */ -#define CACA_BLUE 0x01 /**< The colour index for blue. */ -#define CACA_GREEN 0x02 /**< The colour index for green. */ -#define CACA_CYAN 0x03 /**< The colour index for cyan. */ -#define CACA_RED 0x04 /**< The colour index for red. */ -#define CACA_MAGENTA 0x05 /**< The colour index for magenta. */ -#define CACA_BROWN 0x06 /**< The colour index for brown. */ -#define CACA_LIGHTGRAY 0x07 /**< The colour index for light gray. */ -#define CACA_DARKGRAY 0x08 /**< The colour index for dark gray. */ -#define CACA_LIGHTBLUE 0x09 /**< The colour index for blue. */ -#define CACA_LIGHTGREEN 0x0a /**< The colour index for light green. */ -#define CACA_LIGHTCYAN 0x0b /**< The colour index for light cyan. */ -#define CACA_LIGHTRED 0x0c /**< The colour index for light red. */ -#define CACA_LIGHTMAGENTA 0x0d /**< The colour index for light magenta. */ -#define CACA_YELLOW 0x0e /**< The colour index for yellow. */ -#define CACA_WHITE 0x0f /**< The colour index for white. */ -#define CACA_DEFAULT 0x10 /**< The output driver's default colour. */ -#define CACA_TRANSPARENT 0x20 /**< The transparent colour. */ - -#define CACA_BOLD 0x01 /**< The style mask for bold. */ -#define CACA_ITALICS 0x02 /**< The style mask for italics. */ -#define CACA_UNDERLINE 0x04 /**< The style mask for underline. */ -#define CACA_BLINK 0x08 /**< The style mask for blink. */ +enum caca_color +{ + CACA_BLACK = 0x00, /**< The colour index for black. */ + CACA_BLUE = 0x01, /**< The colour index for blue. */ + CACA_GREEN = 0x02, /**< The colour index for green. */ + CACA_CYAN = 0x03, /**< The colour index for cyan. */ + CACA_RED = 0x04, /**< The colour index for red. */ + CACA_MAGENTA = 0x05, /**< The colour index for magenta. */ + CACA_BROWN = 0x06, /**< The colour index for brown. */ + CACA_LIGHTGRAY = 0x07, /**< The colour index for light gray. */ + CACA_DARKGRAY = 0x08, /**< The colour index for dark gray. */ + CACA_LIGHTBLUE = 0x09, /**< The colour index for blue. */ + CACA_LIGHTGREEN = 0x0a, /**< The colour index for light green. */ + CACA_LIGHTCYAN = 0x0b, /**< The colour index for light cyan. */ + CACA_LIGHTRED = 0x0c, /**< The colour index for light red. */ + CACA_LIGHTMAGENTA = 0x0d, /**< The colour index for light magenta. */ + CACA_YELLOW = 0x0e, /**< The colour index for yellow. */ + CACA_WHITE = 0x0f, /**< The colour index for white. */ + CACA_DEFAULT = 0x10, /**< The output driver's default colour. */ + CACA_TRANSPARENT = 0x20, /**< The transparent colour. */ +}; + +enum caca_style +{ + CACA_BOLD = 0x01, /**< The style mask for bold. */ + CACA_ITALICS = 0x02, /**< The style mask for italics. */ + CACA_UNDERLINE = 0x04, /**< The style mask for underline. */ + CACA_BLINK = 0x08, /**< The style mask for blink. */ +}; /* @} */ /** \brief User event type enumeration. diff --git a/caca/caca0.h b/caca/caca0.h index 793f306..fd8470b 100644 --- a/caca/caca0.h +++ b/caca/caca0.h @@ -58,27 +58,25 @@ __extern caca_display_t *__caca0_dp; __extern unsigned char __caca0_fg; __extern unsigned char __caca0_bg; -/* These enums and macros changed names or values */ -enum caca_color -{ - CACA_COLOR_BLACK = CACA_BLACK, - CACA_COLOR_BLUE = CACA_BLUE, - CACA_COLOR_GREEN = CACA_GREEN, - CACA_COLOR_CYAN = CACA_CYAN, - CACA_COLOR_RED = CACA_RED, - CACA_COLOR_MAGENTA = CACA_MAGENTA, - CACA_COLOR_BROWN = CACA_BROWN, - CACA_COLOR_LIGHTGRAY = CACA_LIGHTGRAY, - CACA_COLOR_DARKGRAY = CACA_DARKGRAY, - CACA_COLOR_LIGHTBLUE = CACA_LIGHTBLUE, - CACA_COLOR_LIGHTGREEN = CACA_LIGHTGREEN, - CACA_COLOR_LIGHTCYAN = CACA_LIGHTCYAN, - CACA_COLOR_LIGHTRED = CACA_LIGHTRED, - CACA_COLOR_LIGHTMAGENTA = CACA_LIGHTMAGENTA, - CACA_COLOR_YELLOW = CACA_YELLOW, - CACA_COLOR_WHITE = CACA_WHITE, -}; +/* This enum still exists in libcaca 1.x, thus cannot be redefined */ +#define CACA_COLOR_BLACK CACA_BLACK +#define CACA_COLOR_BLUE CACA_BLUE +#define CACA_COLOR_GREEN CACA_GREEN +#define CACA_COLOR_CYAN CACA_CYAN +#define CACA_COLOR_RED CACA_RED +#define CACA_COLOR_MAGENTA CACA_MAGENTA +#define CACA_COLOR_BROWN CACA_BROWN +#define CACA_COLOR_LIGHTGRAY CACA_LIGHTGRAY +#define CACA_COLOR_DARKGRAY CACA_DARKGRAY +#define CACA_COLOR_LIGHTBLUE CACA_LIGHTBLUE +#define CACA_COLOR_LIGHTGREEN CACA_LIGHTGREEN +#define CACA_COLOR_LIGHTCYAN CACA_LIGHTCYAN +#define CACA_COLOR_LIGHTRED CACA_LIGHTRED +#define CACA_COLOR_LIGHTMAGENTA CACA_LIGHTMAGENTA +#define CACA_COLOR_YELLOW CACA_YELLOW +#define CACA_COLOR_WHITE CACA_WHITE +/* These enums and macros changed names or values */ enum caca_feature { CACA_BACKGROUND = 0x10,