summaryrefslogtreecommitdiffstats
path: root/src/core/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/debug.c')
-rw-r--r--src/core/debug.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/debug.c b/src/core/debug.c
index 2161f9731..7ded47089 100644
--- a/src/core/debug.c
+++ b/src/core/debug.c
@@ -119,13 +119,24 @@ void dbg_hex_dump_da ( unsigned long dispaddr, const void *data,
}
/**
+ * Base message stream colour
+ *
+ * We default to using 31 (red foreground) as the base colour.
+ */
+#ifndef DBGCOL_MIN
+#define DBGCOL_MIN 31
+#endif
+
+/**
* Maximum number of separately coloured message streams
*
* Six is the realistic maximum; there are 8 basic ANSI colours, one
* of which will be the terminal default and one of which will be
* invisible on the terminal because it matches the background colour.
*/
-#define NUM_AUTO_COLOURS 6
+#ifndef DBGCOL_MAX
+#define DBGCOL_MAX ( DBGCOL_MIN + 6 - 1 )
+#endif
/** A colour assigned to an autocolourised debug message stream */
struct autocolour {
@@ -142,7 +153,7 @@ struct autocolour {
* @ret colour Colour ID
*/
static int dbg_autocolour ( unsigned long stream ) {
- static struct autocolour acs[NUM_AUTO_COLOURS];
+ static struct autocolour acs[ DBGCOL_MAX - DBGCOL_MIN + 1 ];
static unsigned long use;
unsigned int i;
unsigned int oldest;
@@ -180,7 +191,7 @@ static int dbg_autocolour ( unsigned long stream ) {
*/
void dbg_autocolourise ( unsigned long stream ) {
dbg_printf ( "\033[%dm",
- ( stream ? ( 31 + dbg_autocolour ( stream ) ) : 0 ) );
+ ( stream ? ( DBGCOL_MIN + dbg_autocolour ( stream ) ) :0));
}
/**