]> git.mxchange.org Git - simgear.git/blobdiff - Debug/fg_debug.c
MSVC++ portability changes by Bernie Bright:
[simgear.git] / Debug / fg_debug.c
index dcbd98da1c03459b28a9f1068d67bb9c723720cf..ca236a3371264762236c001c4277782393a82ed1 100644 (file)
@@ -59,21 +59,22 @@ 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 },
+    { "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_AUTOPILOT", 0x00000800 },
 
     /* Do not edit below here, last entry should be null */
-    { "FG_ALL",     0xFFFFFFFF },
+    { "FG_ALL",       0xFFFFFFFF },
     { NULL, 0 } 
 };
 
@@ -87,10 +88,12 @@ void fgInitDebug( void ) {
     // 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" );
@@ -110,9 +113,11 @@ void fgInitDebug( void ) {
     // 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 );
@@ -120,12 +125,14 @@ void fgInitDebug( void ) {
                     "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 );
@@ -133,7 +140,7 @@ void fgInitDebug( void ) {
                     "fg_debug.c: Environment overrides default debug class (0x%08X)\n",
                     fg_DebugClass );
        }
-    }
+    /* } */
 
     FG_RELEASEDEBUGSEM;
 }
@@ -150,16 +157,25 @@ fgDebugClass fgDebugStrToClass( char *str ) {
     }
 
     /* Check for 0xXXXXXX notation */
-    if( (p = strstr( str, "0x")) ) {
+    p = strstr( str, "0x");
+    if( p ) {
        p++; p++;
        while (*p) {
-           if( (ph = strchr(hex,*p)) || (ph = strchr(hexl,*p)) ){
-               val <<= 4;
+           ph = strchr(hex,*p);
+           if ( ph ) {
+               val <<= 4;
                val += ph-hex;
                p++;
            } else {
-               // fprintf( stderr, "Error in hex string '%s'\n", str ); 
-               return FG_NONE;
+               ph = strchr(hexl,*p);
+               if ( ph ) {
+                   val <<= 4;
+                   val += ph-hex;
+                   p++;
+               } else {
+                   // fprintf( stderr, "Error in hex string '%s'\n", str ); 
+                   return FG_NONE;
+               }
            }
        }
     } else {
@@ -266,9 +282,18 @@ int fgPrintf( fgDebugClass dbg_class, fgDebugPriority prio, char *fmt, ... ) {
 
 
 /* $Log$
-/* Revision 1.1  1998/04/18 03:52:04  curt
-/* Moved to Lib directory and created a libDebug.
+/* Revision 1.4  1998/06/01 17:49:44  curt
+/* Rewrote a slightly ambiguous code fragment (contributed by Charlie Hotchkiss)
 /*
+ * Revision 1.3  1998/05/07 23:03:54  curt
+ * Added an entry for AUTOPILOT.
+ *
+ * Revision 1.2  1998/04/21 17:03:45  curt
+ * Prepairing for C++ integration.
+ *
+ * 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.
  *