// -*-C++-*- 

/*  inc/platform/ANSICPlatform.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 __ANSICPLATFORM_HPP__
#define __ANSICPLATFORM_HPP__

/* $Id$ */

#include "platform/Platform.hpp"
#include "defines.h"

class OutOfMemory;
class InvalidArgument;
/**

   @author Philogelos
   @created
*/
abstract class ANSICPlatform : public Platform
{

  /**
	*/
public: ANSICPlatform();

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


public: virtual void sprintf( char *s, const char * format, /* args */ ...) 
  PRINTF_ALIKE( 3, 4 );
public: virtual void vsprintf( char *s, const char *format, va_list raw );
public: virtual Index printfLength( const char * format, /* args */ ...) 
  PRINTF_ALIKE( 2, 3 );
public: virtual Index vprintfLength( const char * format, va_list raw );

public: virtual void rawErrorPrintf( const char * format, /* args */ ... ) 
  PRINTF_ALIKE( 2, 3 );
public: virtual void rawErrorVPrintf( const char * format, va_list raw );

public: virtual char  *strcpy( char *dst, const char *src );
public: virtual int    strcmp( const char *s1, const char *s2 );
public: virtual Index  strlen( const char *s );
public: virtual char  *strcat( char *dst, const char *src );
public: virtual char  *strchr( const char *s, int c );
public: virtual long   strtol( const char *str, char **endptr, int base ) THROWS( InvalidArgument * );

public: virtual int   memcmp( void *s1, const void *s2, Index n );
public: virtual void *memchr( const void *s, int c, Index n );
public: virtual void *memcpy( void *s1, const void *s2, Index n );
public: virtual void *memset( void *s, int c, Index n );

public: virtual void *allocateMemory( Index aSize );
public: virtual void  deallocateMemory( void *aPointer );

public: static void *allocateMemoryBootstrapANSI( Index aSize );
public: static void  deallocateMemoryBootstrapANSI( void *aPointer );

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

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

public:  static OutOfMemory *getOutOfMemory();

protected: Index callsNum;

/** Instance of OutOfMemory allocated in advance and thrown when 
	malloc failes. 

	Hopefully, we shall have enough memory to allocate static
	variables.
*/
protected: static OutOfMemory *outOfMemoryException;
};

/* $Log$ */

/* __ANSICPLATFORM_HPP__ */
#endif