/*
 *  ZThreads, a platform-independant, multithreading and 
 *  synchroniation library
 *
 *  Copyright (C) 2000-2002, Eric Crahen, See LGPL.TXT for details
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 *  SUNY @ Buffalo, hereby disclaims all copyright interest in the
 *  ZThreads library written by Eric Crahen
 */

#ifndef __ZTTHREADCONFIG_H__
#define __ZTTHREADCONFIG_H__

// Install a simple debugging macro
#ifndef NDEBUG

#include <assert.h>
#include <stdio.h>

// ZTDEBUG("format", value, ...) - display messages in debug mode
#define ZTDEBUG printf

#ifdef _WIN32
#define ZTCHECK(x) assert(x != 0)
#else
// ZTCHECK - assert success (0) in debug mode, or execute w/o check 
#define ZTCHECK(x) assert(x == 0)
#endif


#define ZTLIST(x) { \
  printf("%08X:", (int)&x);\
  for(WaiterList::iterator i = x.begin(); i != x.end(); i++)\
    printf("%04X ", (int)*i);\
  printf("\n");\
}

#else

inline void _ZNOTHING(...) {}

#define ZTLIST _ZNOTHING
#define ZTDEBUG _ZNOTHING
#define ZTCHECK(x) x 

#endif


// Configure the namespace
#ifndef ZTHREAD_NAMESPACE
#define ZTHREAD_NAMESPACE ZThread
#endif

// Clear the API macros to start with
#undef EXPLICIT_TEMPLATE
#undef ZTHREAD_API

#if defined(_WIN32)

#define WIN32_LEAN_AND_MEAN
#define HAVE_FTIME

#pragma warning(disable:4275)
#pragma warning(disable:4290) 
#pragma warning(disable:4786)
#pragma warning(disable:4251)


#endif

// Define the DLL interface for windows shared libraries
#if defined(_WIN32) && !defined(ZTHREAD_STATIC)

#ifdef ZTHREAD_EXPORTS 

#undef ZTHREAD_API
#undef EXPLICIT_TEMPLATE

#define ZTHREAD_API __declspec(dllexport)
#define EXPLICIT_TEMPLATE(X) template class __declspec( dllexport ) X; 

#else

#define ZTHREAD_API __declspec(dllimport)
#define EXPLICIT_TEMPLATE(X) template class __declspec( dllimport ) X; 

#endif // ZTHREAD_EXPORTS 
#else

// Set the API macros to null for POSIX & static builds
#define ZTHREAD_API
#define EXPLICIT_TEMPLATE(X)

#endif

#endif // __ZTHREAD_H__


