/***********************************************************************
	libgutenfetch - Library to support development of applications which
					query and fetch electronic texts from project gutenberg.

    Copyright (C) 2001, 2002, 2003 Russell Francis 

    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.

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	Last updated on $Date: 2004/03/21 05:14:48 $ by $Author: johntabularasa $.
***********************************************************************/
#ifndef STDDEFS_H
#define STDDEFS_H

#if defined(WINNT) || defined(__WIN__) || defined(__WIN) || defined(_WIN_)
#	define WIN32
#endif

#ifdef HAVE_CONFIG_H
	#include "config.h"
#endif
#include "gettext.h"
#ifdef HAVE_UNISTD_H
	#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
	#include <stdlib.h>
#endif	

#define NOP	;

#define TRUE  1
#define FALSE 0

#define MIN(x, y)		(x < y) ? (x) : (y)
#define MAX(x, y)		(x > y) ? (x) : (y)

#ifdef WIN32
#	define DIR_SEPARATOR	"\\"
#else
#	define DIR_SEPARATOR	"/"
#endif

#ifndef NULL
#	define NULL 0
#endif

#define FREE_NULL(x)	if(x!=NULL){free(x);x=NULL;}
#define _(x)			gettext(x)
#define BLOCK_SIZE		getpagesize()

/* Assert.h work-arounds */
#ifndef HAVE_ASSERT_H
#	define ASSERTION_STRING	"Assertion failed: "
#	define assert(x) if(!(x)){fprintf(stderr,"%s%s,%d\n",ASSERTION_STRING,__FILE__,__LINE__);exit(-1);}
#endif

#if (HAVE_ALLOCA != 1)
#	define alloca(x) malloc(x)
#	define alloca_free(x) free(x)
#else
/*	define alloca_free() as a nop on machines which have alloca */
#	define alloca_free(x) NOP
#endif /* (HAVE_ALLOCA != 1) */

#endif



syntax highlighted by Code2HTML, v. 0.9.1