/***************************************************************************
                           dclib.h  -  description
                             -------------------
    begin                : Mon May 5 2003
    copyright            : (C) 2003 by Mathias Küster
    email                : mathen@users.berlios.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef DCLIB_H
#define DCLIB_H

/**
  *@author Mathias Küster
  */

#include <time.h>
#include <stdarg.h>
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif

/** init dclib from command line parameters */
DLL_EXPORT int dclibInit(int argc, char *argv[]);
/** get dclib start time */
DLL_EXPORT time_t dclibUptime();
/** get dclib version string */
DLL_EXPORT const char * dclibVersion();
/** get dclib verbose setting */
DLL_EXPORT int dclibVerbose();
/**  set dclib verbose */
DLL_EXPORT void setdclibVerbose( int n );

#ifdef WIN32
#define DPRINTF
#else
 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
 #define DPRINTF(...) if (dclibVerbose()) printf(__VA_ARGS__)
 #elif defined __GNUC__
 #define DPRINTF(args...) if (dclibVerbose()) printf(args)
 #else
 static int
 DPRINTF(const char *format,
         ...)
 { 
   int ret = 0;
   if (dclibVerbose()) {
     va_list args;
     va_start (args, format);
     ret = printf(format, args);
     va_end (args);
   }
   return ret;
 }
 #endif
#endif
#ifdef __cplusplus
}
#endif

#endif
