/*****************************************************************************
 * FreeAdhocUDF - copyright (c) 2004 - 2009 adhoc dataservice GmbH
 * Christoph Theuring ct / Peter Mandrella pm / Georg Horn gh
 * <http://freeadhocudf.org> eMail <help@freeadhocudf.org>
 * based on FreeUDFLibC - copyright (c) 1999 Gregory Deatz
 *
 * File Name:   global.h
 * Description: This header contains the global prototype definitions
 *  
 * This file is part of FreeAdhocUDF.
 * FreeAdhocUDF 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 3 of the License, or
 * (at your option) any later version.
 *
 * FreeAdhocUDF 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 FreeAdhocUDF.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/

// ct 2008-11-18
// dirty trick to "patch" ibase.h from InterBase because they don't know Watcom
//#if defined(__WATCOMC__)
//#define __BORLANDC__
//#endif

#include "ibase.h"

//#if defined(__WATCOMC__)
//#undef __BORLANDC__
//#endif
// end dirty trick

#define LOC_STRING_SIZE 256
#define MAX_STRINGBUFFER_SIZE 32768

#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__WATCOMC__)
#define WINDOWS
#endif

// ct 2007-12-03 readded ib_util for ib_util_malloc 
#include "ib_util.h"
//#define MALLOC ib_util_malloc
// pm 2006-09-24
// Workaround for Firebird bug (buffer overflow):
// Firebird writes data after end of returned UDF data.
// Allocation of the string buffer maximum of >= 32762 Bytes
// for all strings solves this problem.
// n is dummy referenced to avoid "unused variable" warning.
// FB_API_VER is only defined in ibase.h of FireBird
#ifdef FB_API_VER
#define MALLOC(n) (ib_util_malloc((n) - (n) + MAX_STRINGBUFFER_SIZE))
#else
#define MALLOC ib_util_malloc
#endif

#ifndef M_PI
#define M_PI 3.141592654
#endif

#ifndef M_E
#define M_E 2.718281828
#endif
