/*
 * $Header: /home/gene/library/website/docsrc/httpxtran/src/RCS/debug.h,v 395.1 2008/04/20 17:25:51 gene Exp $
 *
 * Copyright (c) 2004--2006 Gene Michael Stover.  All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL GENE MICHAEL STOVER BE LIABLE FOR
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 * Except as contained in this notice, the name of Gene Michael Stover
 * shall not be used in advertising or otherwise to promote the sale, use
 * or other dealings in this Software without prior written authorization
 * from Gene Michael Stover.
 */

#if __cplusplus
extern "C" {
#endif

  /*
   * SOME DEBUGGING STOOF
   */
#define Trace(moo) DEBUG_Print (__FILE__, __LINE__, moo)

  /*
   * Enable or disable debugging output.  Default is disabled.
   * isEnabled = True enables debugging output.  isEnabled = False
   * disables it.
   */
  void DEBUG_Enable (BOOL isEnabled);

  /*
   */
  BOOL DEBUG_IsVerbose (void);

  /*
   * Print the message if debugging Is Verbose.
   */
  void DEBUG_Print (char file[], int line, char fmt[], ...);

  /*
   * Prints an appropriate error message, given the error number.
   * On Unix, the error number should be from errno.
   * On Winders, it should be a value that GetLastError() might
   * return.
   */
  void DEBUG_PrintError (char file[], int line, char moo[], long error);

  /*
   * It's appropriate to call this function like this:
   * DEBUG_PrintLastError (__FILE__, __LINE__,
   *                       "name-of-function-which-caused-error");
   *
   * Calls DEBUG_PrintError with an error number.
   * On Unix, the error number is from "errno".
   * On Windows, it's from GetLastError().
   */
  void DEBUG_PrintLastError (char file[], int line, char moo[]);

#if __cplusplus
}
#endif

/* --- end of file --- */
