// -*-C++-*- 

/*  inc/platform/Win32Platform.hpp  */

/*
 * Author: Philogelos A. <Philogelos@yahoo.com>
 * Maintainer: Philogelos A.
 * Keywords: C++, library, containers
 *
 * Copyright (C) 1998 Philogelos A.
 *
 * This file is part of Quercus Robusta.
 *
 * Quercus Robusta is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This software 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 Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this software; see the file COPYING.LIB.  If not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 */



#ifndef __WIN32PLATFORM_HPP__
#define __WIN32PLATFORM_HPP__

/* $Id$ */

/* #define USE_WIN32 */


#if defined( WANT_USE_WIN32 )
#define USE_WIN32
#elif defined( UNWANT_USE_WIN32 )
#if defined( USE_WIN32 )
#undef USE_WIN32
#endif
#endif


#if defined( USE_WIN32 )

/* nonstandard extension used : nameless struct/union */
#pragma warning( disable : 4201 )
#include <windows.h>
#pragma warning( default: 4201 )

#undef interface
/** Marks interface (ie, type). */
#define interface    class

#include "ANSICPlatform.hpp"
#include "Object.hpp"
#include "defines.h"

#define MODULE_NAME_LENGTH   255
#define ERROR_MESSAGE_LENGTH 1024
#define SYSTEM_CMD_LENGTH    1024
#define CONSOLE_WIDTH	     80
#define CONSOLE_HEIGHT       900

#if defined( DEBUGGER_COMMAND )
#undef DEBUGGER_COMMAND
#endif
#define DEBUGGER_COMMAND "MSDEV -p "


#if defined( WANT_MODULE_NAME_LENGTH )
#define MODULE_NAME_LENGTH WANT_MODULE_NAME_LENGTH
#endif

#if defined( WANT_ERROR_MESSAGE_LENGTH )
#define ERROR_MESSAGE_LENGTH WANT_ERROR_MESSAGE_LENGTH
#endif

#if defined( WANT_SYSTEM_CMD_LENGTH )
#define SYSTEM_CMD_LENGTH WANT_SYSTEM_CMD_LENGTH
#endif

#if defined( WANT_DEBUGGER_COMMAND )
#define DEBUGGER_COMMAND WANT_DEBUGGER_COMMAND
#endif

#if defined( WANT_LOG_BUFFER_SIZE )
#define LOG_BUFFER_SIZE WANT_LOG_BUFFER_SIZE
#endif

#if defined( WANT_CONSOLE_WIDTH )
#define CONSOLE_WIDTH WANT_CONSOLE_WIDTH
#endif

#if defined( WANT_CONSOLE_HEIGHT )
#define CONSOLE_HEIGHT WANT_CONSOLE_HEIGHT
#endif

class Mutex;
class Thread;

/**

   @author Philogelos
   @created
*/
class Win32Object : public virtual Object
{
public: Win32Object( HANDLE handle );
public: virtual ~Win32Object();

public: HANDLE getHandle() const;
public: void setHandle( HANDLE aHandle );
		
protected: HANDLE handle;
};

class Win32Platform : public ANSICPlatform,
					  public virtual Object
{

/**
*/
public: Win32Platform();

/**
*/
public: virtual ~Win32Platform();

public: virtual void rawErrorVPrintf( const char * format, va_list raw );

public: virtual char *getErrorDescription( int errCode );
public: virtual void exitImmediate( long status );
  
public: static void *allocateMemoryBootstrapWin32( Index aSize );
public: static void  deallocateMemoryBootstrapWin32( void *aPointer );

public: virtual void suicide() NORETURN;
public: virtual void attachDebugger();

public: virtual void setImageName( const char *aName );
public: virtual const char *getImageName() const;

public: virtual char *getTimeStampString();
public: virtual char *getNL() const;

/**
*/
public:  virtual boolean equals( const Top *anOther ) const;

/**
*/
public:  virtual Top *clone() const;

public:  virtual String  toString() const;
/**
*/
public:  virtual String  getClassName() const;

protected: const char *imageName;
};

/* USE_WIN32 */
#endif

/* $Log$ */

/* __WIN32PLATFORM_HPP__ */
#endif
