Moved to Lib directory and created a libDebug.

This commit is contained in:
curt 1998-04-18 03:52:03 +00:00
parent 875560b8dc
commit 28a6ec8065
4 changed files with 754 additions and 0 deletions

7
Debug/Makefile.am Normal file
View File

@ -0,0 +1,7 @@
libdir = ${exec_prefix}/lib
lib_LTLIBRARIES = libDebug.la
libDebug_la_SOURCES = fg_debug.c fg_debug.h
INCLUDES += -I$(top_builddir)

319
Debug/Makefile.in Normal file
View File

@ -0,0 +1,319 @@
# Makefile.in generated automatically by automake 1.2h from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
CC = @CC@
CXX = @CXX@
LD = @LD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
NM = @NM@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
libdir = ${exec_prefix}/lib
lib_LTLIBRARIES = libDebug.la
libDebug_la_SOURCES = fg_debug.c fg_debug.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../Include/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(lib_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I../../Include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
libDebug_la_LDFLAGS =
libDebug_la_LIBADD =
libDebug_la_OBJECTS = fg_debug.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
DEP_FILES = .deps/fg_debug.P
SOURCES = $(libDebug_la_SOURCES)
OBJECTS = $(libDebug_la_OBJECTS)
all: Makefile $(LTLIBRARIES)
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu Lib/Debug/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-libLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libDebug.la: $(libDebug_la_OBJECTS) $(libDebug_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libDebug_la_LDFLAGS) $(libDebug_la_OBJECTS) $(libDebug_la_LIBADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = Lib/Debug
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Lib/Debug/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
maintainer-clean-depend:
-rm -rf .deps
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
@-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
< .deps/$(*F).p > .deps/$(*F).P
@-rm -f .deps/$(*F).p
info:
dvi:
check: all
$(MAKE)
installcheck:
install-exec: install-libLTLIBRARIES
@$(NORMAL_INSTALL)
install-data:
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall: uninstall-libLTLIBRARIES
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
$(mkinstalldirs) $(DATADIR)$(libdir)
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-libLTLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
clean: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
clean-depend clean-generic mostlyclean
distclean: distclean-libLTLIBRARIES distclean-compile distclean-libtool \
distclean-tags distclean-depend distclean-generic clean
-rm -f config.status
-rm -f libtool
maintainer-clean: maintainer-clean-libLTLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-depend \
maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
distclean-compile clean-compile maintainer-clean-compile \
mostlyclean-libtool distclean-libtool clean-libtool \
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info dvi \
installcheck install-exec install-data install uninstall all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
INCLUDES += -I$(top_builddir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

285
Debug/fg_debug.c Normal file
View File

@ -0,0 +1,285 @@
/* -*- Mode: C++ -*-
*
* fg_debug.c -- Flight Gear debug utility functions
*
* Written by Paul Bleisch, started January 1998.
*
* Copyright (C) 1998 Paul Bleisch, pbleisch@acm.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
* (Log is kept at end of this file)
**************************************************************************/
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <Include/cmdargs.h> // Line to command line arguments
#include "fg_debug.h"
static int fg_DebugSem = 1;
fgDebugClass fg_DebugClass = FG_NONE; // Need visibility for
fgDebugPriority fg_DebugPriority = FG_INFO; // command line processing.
static fgDebugCallback fg_DebugCallback = NULL;
FILE *fg_DebugOutput = NULL; // Visibility needed for command line processor.
// This can be set to a FILE from the command
// line. If not, it will be set to stderr.
/* TODO: Actually make this thing thread safe */
#ifdef USETHREADS
#define FG_GRABDEBUGSEM while( --fg_DebugSem < 0 ) { fg_DebugSem++; }
#define FG_RELEASEDEBUGSEM fg_DebugSem++;
#else
#define FG_GRABDEBUGSEM
#define FG_RELEASEDEBUGSEM
#endif
/* Used for convienence initialization from env variables.
*/
static struct {
char *str;
fgDebugClass dbg_class;
} fg_DebugClasses[] = {
{ "FG_NONE", 0x00000000 },
{ "FG_TERRAIN", 0x00000001 },
{ "FG_ASTRO", 0x00000002 },
{ "FG_FLIGHT", 0x00000004 },
{ "FG_INPUT", 0x00000008 },
{ "FG_GL", 0x00000010 },
{ "FG_VIEW", 0x00000020 },
{ "FG_COCKPIT", 0x00000040 },
{ "FG_GENERAL", 0x00000080 },
{ "FG_MATH", 0x00000100 },
{ "FG_EVENT", 0x00000200 },
{ "FG_AIRCRAFT",0x00000400 },
/* Do not edit below here, last entry should be null */
{ "FG_ALL", 0xFFFFFFFF },
{ NULL, 0 }
};
static fgDebugClass fgDebugStrToClass( char *str );
/* fgInitDebug =============================================================*/
void fgInitDebug( void ) {
char *pszClass, *pszPrio, *pszFile;
// Support for log file/alt debug output via command line, environment or
// reasonable default.
if( strlen( logArgbuf ) > 3) { // First check for command line option
// Assumed that we will append.
fg_DebugOutput = fopen(logArgbuf, "a+" );
}
if( !fg_DebugOutput ) { // If not set on command line, environment?
pszFile = getenv( "FG_DEBUGFILE" );
if( pszFile ) { // There is such an environmental variable.
fg_DebugOutput = fopen( pszFile, "a+" );
}
}
if( !fg_DebugOutput ) { // If neither command line nor environment
fg_DebugOutput = stderr; // then we use the fallback position
}
FG_GRABDEBUGSEM;
fg_DebugSem = fg_DebugSem; /* shut up GCC */
// Test command line option overridge of debug priority. If the value
// is in range (properly optioned) the we will override both defaults
// and the environmental value.
if ((priorityArgValue >= FG_BULK) && (priorityArgValue <= FG_ABORT)) {
fg_DebugPriority = priorityArgValue;
} else { // Either not set or out of range. We will not warn the user.
pszPrio = getenv( "FG_DEBUGPRIORITY" );
if( pszPrio ) {
fg_DebugPriority = atoi( pszPrio );
fprintf( stderr,
"fg_debug.c: Environment overrides default debug priority (%d)\n",
fg_DebugPriority );
}
}
if ((debugArgValue >= FG_ALL) && (debugArgValue < FG_UNDEFD)) {
fg_DebugPriority = priorityArgValue;
} else { // Either not set or out of range. We will not warn the user.
pszClass = getenv( "FG_DEBUGCLASS" );
if( pszClass ) {
fg_DebugClass = fgDebugStrToClass( pszClass );
fprintf( stderr,
"fg_debug.c: Environment overrides default debug class (0x%08X)\n",
fg_DebugClass );
}
}
FG_RELEASEDEBUGSEM;
}
/* fgDebugStrToClass ======================================================*/
fgDebugClass fgDebugStrToClass( char *str ) {
char *hex = "0123456789ABCDEF";
char *hexl = "0123456789abcdef";
char *pt, *p, *ph, ps = 1;
unsigned int val = 0, i;
if( str == NULL ) {
return 0;
}
/* Check for 0xXXXXXX notation */
if( (p = strstr( str, "0x")) ) {
p++; p++;
while (*p) {
if( (ph = strchr(hex,*p)) || (ph = strchr(hexl,*p)) ){
val <<= 4;
val += ph-hex;
p++;
} else {
// fprintf( stderr, "Error in hex string '%s'\n", str );
return FG_NONE;
}
}
} else {
/* Must be in string format */
p = str;
ps = 1;
while( ps ) {
while( *p && (*p==' ' || *p=='\t') ) p++; /* remove whitespace */
pt = p; /* mark token */
while( *p && (*p!='|') ) p++; /* find OR or EOS */
ps = *p; /* save value at p so we can attempt to be bounds safe */
*p++ = 0; /* terminate token */
/* determine value for token */
i=0;
while( fg_DebugClasses[i].str &&
strncmp( fg_DebugClasses[i].str, pt,
strlen(fg_DebugClasses[i].str)) ) i++;
if( fg_DebugClasses[i].str == NULL ) {
fprintf( stderr,
"fg_debug.c: Could not find message class '%s'\n",
pt );
} else {
val |= fg_DebugClasses[i].dbg_class;
}
}
}
return (fgDebugClass)val;
}
/* fgSetDebugOutput =======================================================*/
void fgSetDebugOutput( FILE *out ) {
FG_GRABDEBUGSEM;
fflush( fg_DebugOutput );
fg_DebugOutput = out;
FG_RELEASEDEBUGSEM;
}
/* fgSetDebugLevels =======================================================*/
void fgSetDebugLevels( fgDebugClass dbg_class, fgDebugPriority prio ) {
FG_GRABDEBUGSEM;
fg_DebugClass = dbg_class;
fg_DebugPriority = prio;
FG_RELEASEDEBUGSEM;
}
/* fgRegisterDebugCallback ================================================*/
fgDebugCallback fgRegisterDebugCallback( fgDebugCallback callback ) {
fgDebugCallback old;
FG_GRABDEBUGSEM;
old = fg_DebugCallback;
fg_DebugCallback = callback;
FG_RELEASEDEBUGSEM;
return old;
}
/* fgPrintf ===============================================================*/
int fgPrintf( fgDebugClass dbg_class, fgDebugPriority prio, char *fmt, ... ) {
char szOut[1024+1];
va_list ap;
int ret = 0;
// If no action to take, then don't bother with the semaphore
// activity Slight speed benefit.
// printf("dbg_class = %d fg_DebugClass = %d\n", dbg_class, fg_DebugClass);
// printf("prio = %d fg_DebugPriority = %d\n", prio, fg_DebugPriority);
if( !(dbg_class & fg_DebugClass) ) {
// Failed to match a specific debug class
if ( prio < fg_DebugPriority ) {
// priority is less than requested
// "ret" is zero anyway. But we might think about changing
// it upon some error condition?
return ret;
}
}
FG_GRABDEBUGSEM;
/* ret = vsprintf( szOut, fmt, (&fmt+1)); (but it didn't work, thus ... */
va_start (ap, fmt);
ret = vsprintf( szOut, fmt, ap);
va_end (ap);
if( fg_DebugCallback!=NULL && fg_DebugCallback(dbg_class, prio, szOut) ) {
FG_RELEASEDEBUGSEM;
return ret;
} else {
fprintf( fg_DebugOutput, szOut );
FG_RELEASEDEBUGSEM;
if( prio == FG_EXIT ) {
exit(0);
} else if( prio == FG_ABORT ) {
abort();
}
}
return ret;
}
/* $Log$
/* Revision 1.1 1998/04/18 03:52:04 curt
/* Moved to Lib directory and created a libDebug.
/*
* Revision 1.10 1998/03/14 00:31:21 curt
* Beginning initial terrain texturing experiments.
*
* Revision 1.9 1998/03/09 22:44:58 curt
* Modified so that you can specify FG_DEBUGCLASS ***or*** FG_DEBUG_PRIORITY
*
* Revision 1.8 1998/03/09 22:11:00 curt
* Processed through the format-o-matic.
*
* Revision 1.7 1998/02/16 13:39:43 curt
* Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
* tiles to occasionally be missing.
*
*/

143
Debug/fg_debug.h Normal file
View File

@ -0,0 +1,143 @@
/* -*- Mode: C++ -*-
*
* fg_debug.h -- Flight Gear debug utility functions
*
* Written by Paul Bleisch, started January 1998.
*
* Copyright (C) 1998 Paul Bleisch, pbleisch@acm.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* (Log is kept at end of this file)
**************************************************************************/
#ifndef _FG_DEBUG_H
#define _FG_DEBUG_H
#include <stdio.h>
/* NB: To add a dbg_class, add it here, and add it to the structure in
fg_debug.c */
typedef enum {
FG_NONE = 0x00000000,
FG_TERRAIN = 0x00000001,
FG_ASTRO = 0x00000002,
FG_FLIGHT = 0x00000004,
FG_INPUT = 0x00000008,
FG_GL = 0x00000010,
FG_VIEW = 0x00000020,
FG_COCKPIT = 0x00000040,
FG_GENERAL = 0x00000080,
FG_MATH = 0x00000100,
FG_EVENT = 0x00000200,
FG_AIRCRAFT= 0x00000400,
FG_UNDEFD = 0x00001000, // For range checking
FG_ALL = 0xFFFFFFFF
} fgDebugClass;
/* NB: To add a priority, add it here. */
typedef enum {
FG_BULK, /* For frequent messages */
FG_DEBUG, /* Less frequent debug type messages */
FG_INFO, /* Informatory messages */
FG_WARN, /* Possible impending problem */
FG_ALERT, /* Very possible impending problem */
FG_EXIT, /* Problem (no core) */
FG_ABORT /* Abandon ship (core) */
} fgDebugPriority;
/* Initialize the debuggin stuff. */
void fgInitDebug( void );
/* fgPrintf
Expects:
class fgDebugClass mask for this message.
prio fgDebugPriority of this message.
fmt printf like string format
... var args for fmt
Returns:
number of items in fmt handled.
This function works like the standard C library function printf() with
the addition of message classes and priorities (see fgDebugClasses
and fgDebugPriorities). These additions allow us to classify messages
and disable sets of messages at runtime. Only messages with a prio
greater than or equal to fg_DebugPriority and in the current debug class
(fg_DebugClass) are printed.
*/
int fgPrintf( fgDebugClass dbg_class, fgDebugPriority prio, char *fmt, ... );
/* fgSetDebugLevels()
Expects:
dbg_class Bitmask representing classes to display.
prio Minimum priority of messages to display.
*/
void fgSetDebugLevels( fgDebugClass dbg_class, fgDebugPriority prio );
/* fgSetDebugOutput()
Expects:
file A FILE* to a stream to send messages to.
It is assumed the file stream is open and writable. The system
defaults to stderr. The current stream is flushed but not
closed.
*/
void fgSetDebugOutput( FILE *out );
/* fgRegisterDebugCallback
Expects:
callback A function that takes parameters as defined by the
fgDebugCallback type.
Returns:
a pointer to the previously registered callback (if any)
Install a user defined debug log callback. This callback is called w
whenever fgPrintf is called. The parameters passed to the callback are
defined above by fgDebugCallback. outstr is the string that is to be
printed. If callback returns nonzero, it is assumed that the message
was handled fully by the callback and **fgPrintf need do no further
processing of the message.** Only one callback may be installed at a
time.
*/
//typedef int (*fgDebugCallback)(fgDebugClass, fgDebugPriority, char *outstr);
//fgDebugCallback fgRegisterDebugCallback( fgDebugCallback callback );
typedef int (*fgDebugCallback)( int DebugClass, int DebugPriority, char *outstr);
fgDebugCallback fgRegisterDebugCallback( fgDebugCallback callback );
// Leave these alone. Access intended for fg_debug and command line processing.
//
extern fgDebugClass fg_DebugClass;
extern fgDebugPriority fg_DebugPriority;
extern FILE * fg_DebugOutput;
#endif /* _FG_DEBUG_H */