* docs/DEBUG.TXT: adding debugging support documentation
* src/base/ftdebug.c (ft_debug_init), builds/win32/ftdebug.c
(ft_debug_init), builds/amiga/src/ftdebug.c (ft_debug_init): changed the
syntax of the FT2_DEBUG environment variable used to control debugging
output (i.e. logging and error messages). It must now look like:
any:6 memory:4 io:3 or
any:6,memory:4,io:3 or
any:6;memory:4;io:3
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index 4c6bcc5..65c823d 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -86,7 +86,7 @@
#define FT_TRACE_DEF(x) #x ,
static const char* ft_trace_toggles[trace_count + 1] =
- {
+ {
#include FT_INTERNAL_TRACE_H
NULL
};
@@ -98,9 +98,9 @@
/* */
/* Initialize the tracing sub-system. This is done by retrieving the */
/* value of the "FT2_DEBUG" environment variable. It must be a list of */
- /* toggles, separated by spaces, `;' or `:'. Example: */
+ /* toggles, separated by spaces, `;' or `,'. Example: */
/* */
- /* "any=3 memory=6 stream=5" */
+ /* "any:3 memory:6 stream:5" */
/* */
/* This will request that all levels be set to 3, except the trace level */
/* for the memory and stream components which are set to 6 and 5, */
@@ -116,48 +116,48 @@
ft_debug_init( void )
{
const char* ft2_debug = getenv( "FT2_DEBUG" );
-
+
if ( ft2_debug )
{
const char* p = ft2_debug;
const char* q;
-
+
for ( ; *p; p++ )
{
/* skip leading whitespace and separators */
- if ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' || *p == '=' )
+ if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' )
continue;
-
- /* read toggle name, followed by '=' */
+
+ /* read toggle name, followed by ':' */
q = p;
- while ( *p && *p != '=' )
+ while ( *p && *p != ':' )
p++;
-
- if ( *p == '=' && p > q )
+
+ if ( *p == ':' && p > q )
{
int n, i, len = p - q;
int level = -1, found = -1;
-
+
for ( n = 0; n < trace_count; n++ )
{
const char* toggle = ft_trace_toggles[n];
-
+
for ( i = 0; i < len; i++ )
{
if ( toggle[i] != q[i] )
break;
}
-
+
if ( i == len && toggle[i] == 0 )
{
found = n;
break;
}
}
-
+
/* read level */
p++;
if ( *p )
@@ -166,7 +166,7 @@
if ( level < 0 || level > 6 )
level = -1;
}
-
+
if ( found >= 0 && level >= 0 )
{
if ( found == trace_any )