2001-05-23 15:26:42 +02:00
|
|
|
/*
|
|
|
|
* PROGRAM: JRD access method
|
|
|
|
* MODULE: common.h
|
|
|
|
* DESCRIPTION: Common descriptions for all GDS programs
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Interbase Public
|
|
|
|
* License Version 1.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy
|
|
|
|
* of the License at http://www.Inprise.com/IPL.html
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an
|
|
|
|
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
|
|
|
* or implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code was created by Inprise Corporation
|
|
|
|
* and its predecessors. Portions created by Inprise Corporation are
|
|
|
|
* Copyright (C) Inprise Corporation.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
* Contributor(s): ______________________________________.
|
2001-07-10 19:35:13 +02:00
|
|
|
*
|
|
|
|
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
|
|
|
* conditionals, as the engine now fully supports
|
|
|
|
* readonly databases.
|
2002-02-16 02:58:24 +01:00
|
|
|
*
|
2002-10-28 05:57:07 +01:00
|
|
|
* 2001.11.20 Ann Harrison - make 64bitio.h conditional on not windows.
|
|
|
|
*
|
2002-02-16 06:06:17 +01:00
|
|
|
* 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
|
|
|
|
* - MAC ("MAC", "MAC_AUX" and "MAC_CP" defines)
|
|
|
|
* - EPSON, XENIX, DELTA, IMP, NCR3000, M88K
|
|
|
|
* - NT Power PC and HP9000 s300
|
2002-02-16 03:21:35 +01:00
|
|
|
*
|
2002-06-29 15:03:13 +02:00
|
|
|
* 2002.04.16 Paul Beach - HP10 and unistd.h
|
2002-10-28 05:42:54 +01:00
|
|
|
*
|
|
|
|
* 2002.10.27 Sean Leyne - Completed removal of obsolete "DG_X86" port
|
2002-10-28 05:57:07 +01:00
|
|
|
* 2002.10.27 Sean Leyne - Code Cleanup, removed obsolete "UNIXWARE" port
|
2002-10-28 06:19:52 +01:00
|
|
|
* 2002.10.27 Sean Leyne - Code Cleanup, removed obsolete "Ultrix" port
|
2002-10-28 05:42:54 +01:00
|
|
|
*
|
2002-10-29 03:45:09 +01:00
|
|
|
* 2002.10.28 Sean Leyne - Completed removal of obsolete "DGUX" port
|
2002-10-29 04:17:45 +01:00
|
|
|
* 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "DecOSF" port
|
2002-10-29 04:31:20 +01:00
|
|
|
* 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "SGI" port
|
2002-10-29 03:45:09 +01:00
|
|
|
*
|
2002-10-30 07:40:58 +01:00
|
|
|
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
|
|
|
|
*
|
2002-10-31 06:06:02 +01:00
|
|
|
* 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define
|
|
|
|
*
|
2001-05-23 15:26:42 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef JRD_COMMON_H
|
|
|
|
#define JRD_COMMON_H
|
|
|
|
|
2003-08-06 18:30:49 +02:00
|
|
|
#include "firebird.h"
|
|
|
|
|
2001-07-29 19:42:23 +02:00
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
2001-07-12 07:46:06 +02:00
|
|
|
|
2009-07-21 10:58:28 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
// for _POSIX_THREADS test below
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(_POSIX_THREADS) && _POSIX_THREADS >= 200112L
|
|
|
|
// above check is generally true. However, we use pthreads on some platforms
|
|
|
|
// where _POSIX_THREADS is defined to "1" or not even defined at all!
|
|
|
|
#define USE_POSIX_THREADS
|
|
|
|
#endif
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../include/fb_macros.h"
|
2001-07-29 19:42:23 +02:00
|
|
|
#include "../include/fb_types.h"
|
|
|
|
|
2001-07-10 19:35:13 +02:00
|
|
|
/*
|
2004-09-25 12:28:09 +02:00
|
|
|
do not use links in source code to maintain platform neutrality
|
2001-05-23 15:26:42 +02:00
|
|
|
*/
|
|
|
|
|
2008-01-16 09:31:31 +01:00
|
|
|
#ifdef SUPERSERVER
|
|
|
|
#define SWEEP_THREAD
|
|
|
|
#define GARBAGE_THREAD
|
2004-08-21 09:55:35 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-20 15:45:45 +01:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifdef SUPERSERVER
|
2002-06-29 15:03:13 +02:00
|
|
|
#define FB_ARCHITECTURE isc_info_db_class_server_access
|
|
|
|
#else
|
|
|
|
#define FB_ARCHITECTURE isc_info_db_class_classic_access
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
2001-07-12 07:46:06 +02:00
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* Linux platforms
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifdef LINUX
|
|
|
|
#define QUADFORMAT "ll"
|
|
|
|
#define QUADCONST(n) (n##LL)
|
2004-01-21 08:18:30 +01:00
|
|
|
|
|
|
|
// SLONG is a 32-bit integer on 64-bit platforms
|
2004-05-19 01:38:37 +02:00
|
|
|
//#if SIZEOF_LONG == 4
|
|
|
|
//#define SLONGFORMAT "ld"
|
|
|
|
//#define ULONGFORMAT "lu"
|
|
|
|
//#define XLONGFORMAT "lX"
|
|
|
|
//#define xLONGFORMAT "lx"
|
|
|
|
//#endif
|
2003-04-13 10:21:49 +02:00
|
|
|
|
|
|
|
|
2003-08-20 11:35:00 +02:00
|
|
|
//format for __LINE__
|
|
|
|
#define LINEFORMAT "d"
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
|
|
|
#define IEEE
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-01-12 07:58:27 +01:00
|
|
|
#ifdef AMD64
|
2006-10-24 17:13:57 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_amd64 /* 66 */
|
2008-10-06 18:57:39 +02:00
|
|
|
|
|
|
|
// on buggy kernels ERESTARTNOHAND (==514) may be returned instead of EINTR
|
|
|
|
// use value '514' instead of ERESTARTNOHAND cause it's not present in std includes
|
|
|
|
// in theory such error codes should never be seen outside kernel
|
|
|
|
#define SYSCALL_INTERRUPTED(err) (((err) == EINTR) || ((err) == 514)) /* pjpg 20001102 */
|
|
|
|
|
2004-01-12 07:58:27 +01:00
|
|
|
#endif
|
|
|
|
|
2006-10-23 13:48:32 +02:00
|
|
|
#ifdef PPC
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_ppc /* 69 next higher unique number, See you later */
|
|
|
|
#endif
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifdef i386
|
2004-05-04 21:16:43 +02:00
|
|
|
#define I386
|
2006-10-24 17:13:57 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_i386 /* 60 */
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif /* i386 */
|
|
|
|
|
2008-04-15 16:14:57 +02:00
|
|
|
#ifdef ARM
|
2008-04-18 03:37:44 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_arm // 75
|
2008-04-15 16:14:57 +02:00
|
|
|
#endif /* ARM */
|
|
|
|
|
2003-10-11 01:56:57 +02:00
|
|
|
#ifdef sparc
|
2003-10-12 16:21:14 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_sparc /* 65 */
|
2007-10-05 16:37:33 +02:00
|
|
|
#define RISC_ALIGNMENT
|
2003-10-11 01:56:57 +02:00
|
|
|
#endif /* sparc */
|
|
|
|
|
2007-04-01 12:04:28 +02:00
|
|
|
#ifdef MIPSEL
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_mipsel /* 71 */
|
|
|
|
#endif /* mipsel */
|
|
|
|
|
2008-01-17 13:36:08 +01:00
|
|
|
#ifdef MIPS
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_mips /* 72 */
|
|
|
|
#endif /* mips */
|
|
|
|
|
2008-05-22 17:02:59 +02:00
|
|
|
#ifdef IA64
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_ia64 // 76
|
|
|
|
#define RISC_ALIGNMENT
|
|
|
|
#endif // IA64
|
|
|
|
|
2009-07-21 10:58:28 +02:00
|
|
|
#ifndef USE_POSIX_THREADS
|
|
|
|
// force pthread detection on Linux for distros that do not provide
|
|
|
|
// POSIX thread compatability
|
|
|
|
#define USE_POSIX_THREADS
|
|
|
|
#endif
|
|
|
|
|
2009-07-21 15:39:58 +02:00
|
|
|
#ifdef S390X
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_linux_s390x // 78
|
|
|
|
#endif // S390X
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif /* LINUX */
|
|
|
|
|
2002-06-29 15:03:13 +02:00
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* Darwin Platforms
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2002-02-16 02:58:24 +01:00
|
|
|
#ifdef DARWIN
|
2004-05-19 01:38:37 +02:00
|
|
|
// EKU: obsolete, replaced by _FILE_OFFSET_BITS
|
|
|
|
//#ifndef UNIX_64_BIT_IO
|
|
|
|
//#define UNIX_64_BIT_IO
|
|
|
|
//#endif
|
|
|
|
//
|
2003-08-20 11:35:00 +02:00
|
|
|
//format for __LINE__
|
|
|
|
#define LINEFORMAT "d"
|
|
|
|
|
2004-05-19 01:38:37 +02:00
|
|
|
//#define SLONGFORMAT "ld"
|
|
|
|
//#define ULONGFORMAT "lu"
|
|
|
|
//#define XLONGFORMAT "lX"
|
|
|
|
//#define xLONGFORMAT "lx"
|
2003-04-09 10:57:09 +02:00
|
|
|
|
2008-11-05 12:26:23 +01:00
|
|
|
//#define FB_ALIGNMENT 4
|
|
|
|
//#define FB_DOUBLE_ALIGN 4
|
2004-05-24 01:28:06 +02:00
|
|
|
//#define BSD_UNIX
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
2008-12-05 01:56:15 +01:00
|
|
|
#ifdef __ppc__
|
2008-06-09 14:02:59 +02:00
|
|
|
#define powerpc
|
2007-03-09 11:32:58 +01:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_darwin_ppc /* 63 */
|
|
|
|
#endif
|
|
|
|
#ifdef i386
|
|
|
|
#define I386
|
2007-06-11 16:21:33 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_darwin_x86 /* 70 */
|
2007-03-09 11:32:58 +01:00
|
|
|
#endif
|
2008-01-18 15:12:26 +01:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define DARWIN64
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_darwin_x64 /* 73 */
|
|
|
|
#endif
|
2008-06-09 14:02:59 +02:00
|
|
|
#ifdef __ppc64__
|
|
|
|
#define DARWINPPC64
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_darwin_ppc64 /* 77 */
|
|
|
|
#endif
|
2001-07-12 07:46:06 +02:00
|
|
|
#define IEEE
|
|
|
|
#define QUADCONST(n) (n##LL)
|
|
|
|
#define QUADFORMAT "q"
|
2007-12-27 12:56:04 +01:00
|
|
|
#define MAP_ANON
|
2001-07-12 07:46:06 +02:00
|
|
|
|
2009-01-21 14:04:36 +01:00
|
|
|
#define API_ROUTINE __attribute__((visibility("default")))
|
|
|
|
#define API_ROUTINE_VARARG API_ROUTINE
|
|
|
|
#define INTERNAL_API_ROUTINE API_ROUTINE
|
|
|
|
#define FB_EXPORTED __attribute__((visibility("default")))
|
2009-08-05 09:36:19 +02:00
|
|
|
|
|
|
|
#define O_DIRECT F_NOCACHE
|
2001-07-12 07:46:06 +02:00
|
|
|
#endif /* Darwin Platforms */
|
|
|
|
|
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* FreeBSD for Intel platforms
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifdef FREEBSD
|
|
|
|
|
2004-05-19 01:38:37 +02:00
|
|
|
// EKU: obsolete, replaced by _FILE_OFFSET_BITS
|
|
|
|
//#ifndef UNIX_64_BIT_IO
|
|
|
|
//#define UNIX_64_BIT_IO
|
|
|
|
//#endif
|
|
|
|
//
|
2002-10-12 06:16:32 +02:00
|
|
|
|
2008-11-05 12:26:23 +01:00
|
|
|
//#define FB_ALIGNMENT 4
|
|
|
|
//#define FB_DOUBLE_ALIGN 4
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
|
|
|
#define IEEE
|
2006-03-15 18:32:33 +01:00
|
|
|
|
|
|
|
#ifdef AMD64
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_freebsd_amd64 /* 67 */
|
|
|
|
#else
|
2004-05-04 21:16:43 +02:00
|
|
|
#define I386
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_freebsd /* 61 */
|
2006-03-15 18:32:33 +01:00
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#define QUADFORMAT "ll"
|
|
|
|
#define QUADCONST(n) (n##LL)
|
|
|
|
#define NO_NFS /* no MTAB_OPEN or MTAB_CLOSE in isc_file.c */
|
|
|
|
|
2009-07-21 10:58:28 +02:00
|
|
|
#ifndef USE_POSIX_THREADS
|
|
|
|
// force pthread detection on FREEBSD
|
|
|
|
#define USE_POSIX_THREADS
|
|
|
|
#endif
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif /* FREEBSD */
|
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* NetBSD
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifdef NETBSD
|
|
|
|
|
|
|
|
#if defined(__i386__)
|
2008-11-05 12:26:23 +01:00
|
|
|
//#define FB_ALIGNMENT 4
|
|
|
|
//#define FB_DOUBLE_ALIGN 4
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define IEEE
|
|
|
|
#define I386
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_netbsd /* 62 */
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#define QUADFORMAT "ll"
|
|
|
|
#define QUADCONST(n) (n##LL)
|
|
|
|
#else /* !__i386__ */
|
|
|
|
#error Please add support for other ports
|
|
|
|
#endif
|
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
2001-05-23 15:26:42 +02:00
|
|
|
#define NO_NFS /* no MTAB_OPEN or MTAB_CLOSE in isc_file.c */
|
|
|
|
|
|
|
|
#endif /* NETBSD */
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* SUN platforms--the 386i is obsolete
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-04-10 12:29:13 +02:00
|
|
|
#ifdef __sun
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#ifdef SOLARIS
|
|
|
|
|
|
|
|
/* Define the following only on platforms whose standard I/O
|
|
|
|
* implementation is so weak that we wouldn't be able to fopen
|
|
|
|
* a file whose underlying file descriptor would be > 255.
|
|
|
|
* Hey, we're not running on PDP-11's any more: would it kill you
|
|
|
|
* to use a short instead of a char to hold the fileno? :-(
|
|
|
|
*/
|
2008-12-05 01:56:15 +01:00
|
|
|
|
2002-09-25 08:22:43 +02:00
|
|
|
/* Why we (solarises) need to rewrite old BSD stdio
|
2008-12-05 01:56:15 +01:00
|
|
|
so many times I suggest stdIO from
|
|
|
|
http://www.research.att.com/sw/tools/sfio/
|
|
|
|
*/
|
2002-12-29 16:23:46 +01:00
|
|
|
/* Need to use full sfio not just stdio emulation to fix
|
|
|
|
file descriptor number limit. nmcc Dec2002
|
|
|
|
*/
|
2008-12-30 18:58:30 +01:00
|
|
|
#ifndef SFIO
|
2003-02-19 05:08:09 +01:00
|
|
|
#error "need to use SFIO"
|
2002-09-25 08:22:43 +02:00
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2008-12-30 18:58:30 +01:00
|
|
|
// this function is normally defined in stdio.h, but is missing in SFIO's h-file
|
2008-12-31 21:22:10 +01:00
|
|
|
extern "C" int remove(const char* path);
|
2008-12-30 18:58:30 +01:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* The following define is the prefix to go in front of a "d" or "u"
|
2004-04-29 00:43:34 +02:00
|
|
|
format item in a printf() format string, to indicate that the argument
|
2007-11-12 15:26:44 +01:00
|
|
|
is an SINT64 or FB_UINT64. */
|
2001-05-23 15:26:42 +02:00
|
|
|
#define QUADFORMAT "ll"
|
|
|
|
/* The following macro creates a quad-sized constant, possibly one
|
|
|
|
which is too large to fit in a long int. */
|
|
|
|
#define QUADCONST(n) (n##LL)
|
|
|
|
|
2009-07-21 10:58:28 +02:00
|
|
|
#ifndef USE_POSIX_THREADS
|
|
|
|
#if defined(_POSIX_THREADS) && _POSIX_THREADS >= 1L
|
|
|
|
// Solaris 9 has _POSIX_THREADS = 1L
|
|
|
|
// Solaris 10 has _POSIX_THREADS >= 200112L
|
|
|
|
#define USE_POSIX_THREADS
|
|
|
|
#endif
|
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-04-10 12:29:13 +02:00
|
|
|
#endif // SOLARIS
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
|
|
|
#define IEEE
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-04-10 12:29:13 +02:00
|
|
|
#ifdef __sparc
|
2008-11-05 12:26:23 +01:00
|
|
|
//#define FB_ALIGNMENT 4
|
|
|
|
//#define FB_DOUBLE_ALIGN 8
|
2006-03-09 10:42:53 +01:00
|
|
|
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_isc_sun4 /* 30 */
|
2007-10-05 16:37:33 +02:00
|
|
|
#define RISC_ALIGNMENT
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-04-10 12:29:13 +02:00
|
|
|
#elif defined (__i386)
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_isc_sun_386i /* 32 */
|
2009-04-10 12:29:13 +02:00
|
|
|
|
|
|
|
#elif defined (__amd64)
|
2008-04-25 11:42:19 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_sun_amd64 /* 74 */
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-04-10 12:29:13 +02:00
|
|
|
#else
|
|
|
|
#error What is IMPLEMENTATION for this Solaris platform????
|
|
|
|
#endif
|
2002-09-11 13:30:50 +02:00
|
|
|
|
2009-04-10 12:29:13 +02:00
|
|
|
#endif // __sun
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* HP/UX platforms
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2007-11-17 11:26:09 +01:00
|
|
|
#ifdef HPUX
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
2004-05-24 01:28:06 +02:00
|
|
|
//#define CURSES_KEYPAD
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2008-11-05 12:26:23 +01:00
|
|
|
//#define FB_ALIGNMENT 8
|
|
|
|
//#define FB_DOUBLE_ALIGN 8
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_isc_hp_ux /* 31 */
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-07-23 10:58:26 +02:00
|
|
|
#if defined (__HP_aCC)
|
|
|
|
// aCC error, __thread can be used only with C-like structs
|
|
|
|
#undef HAVE___THREAD
|
|
|
|
#endif
|
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define IEEE
|
2002-06-29 15:03:13 +02:00
|
|
|
// 16-Apr-2002 HP10 in unistd.h Paul Beach
|
2004-11-24 10:22:07 +01:00
|
|
|
//#define setreuid(ruid, euid) setresuid (ruid, euid, -1)
|
|
|
|
//#define setregid(rgid, egid) setresgid (rgid, egid, -1)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* The following define is the prefix to go in front of a "d" or "u"
|
2004-04-29 00:43:34 +02:00
|
|
|
format item in a printf() format string, to indicate that the argument
|
2007-11-12 15:26:44 +01:00
|
|
|
is an SINT64 or FB_UINT64. */
|
2001-05-23 15:26:42 +02:00
|
|
|
#define QUADFORMAT "ll"
|
|
|
|
/* The following macro creates a quad-sized constant, possibly one
|
|
|
|
which is too large to fit in a long int. */
|
2009-07-28 14:28:26 +02:00
|
|
|
#define QUADCONST(n) (n)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-07-21 10:58:28 +02:00
|
|
|
#ifndef USE_POSIX_THREADS
|
|
|
|
// HPUX v B.11.23 does not have _POSIX_THREADS defined, their implementation
|
|
|
|
// is incomplete, but good enough for us
|
|
|
|
#define USE_POSIX_THREADS
|
|
|
|
#endif
|
|
|
|
|
2007-10-05 16:37:33 +02:00
|
|
|
#define RISC_ALIGNMENT
|
|
|
|
|
2007-11-17 11:26:09 +01:00
|
|
|
#endif /* HPUX */
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* IBM AIX RS/6000 and IBM AIX PowerPC
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#ifdef _AIX /* IBM AIX */
|
|
|
|
#ifndef _POWER /* IBM RS/6000 */
|
|
|
|
#define AIX
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
2004-05-24 01:28:06 +02:00
|
|
|
//#define CURSES_KEYPAD
|
2008-11-05 12:26:23 +01:00
|
|
|
//*#define FB_ALIGNMENT 4
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_isc_rt_aix /* 35 */
|
2004-05-04 21:16:43 +02:00
|
|
|
#define IEEE
|
2001-05-23 15:26:42 +02:00
|
|
|
#define SYSCALL_INTERRUPTED(err) (((err) == EINTR) || ((err) == ERESTART)) /* pjpg 20001102 */
|
|
|
|
#else /* AIX PowerPC */
|
|
|
|
#define AIX_PPC
|
2004-05-04 21:16:43 +02:00
|
|
|
#define UNIX
|
2004-05-24 01:28:06 +02:00
|
|
|
//#define CURSES_KEYPAD
|
2008-11-05 12:26:23 +01:00
|
|
|
//#define FB_ALIGNMENT 4
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_isc_rt_aix /* 35 */
|
2004-05-04 21:16:43 +02:00
|
|
|
#define IEEE
|
2001-05-23 15:26:42 +02:00
|
|
|
#define SYSCALL_INTERRUPTED(err) (((err) == EINTR) || ((err) == ERESTART)) /* pjpg 20001102 */
|
|
|
|
|
|
|
|
#define QUADFORMAT "ll" /* TMC 081700 */
|
|
|
|
#define QUADCONST(n) (n##LL) /* TMC 081700 */
|
|
|
|
|
|
|
|
#endif /* IBM PowerPC */
|
2002-09-11 13:30:50 +02:00
|
|
|
|
2008-12-24 15:17:55 +01:00
|
|
|
// AIX does not pass autoconf's test for mmap() correctness,
|
|
|
|
// but we do not use flag (MAP_FIXED) that fails.
|
|
|
|
#define HAVE_MMAP
|
|
|
|
|
|
|
|
// autoconf test AC_SYS_LARGEFILE defines _LARGE_FILES for AIX builds.
|
|
|
|
// But, in <standards.h>, _LARGE_FILE_API is defined, leading to conflict
|
|
|
|
// in 32-bit builds. Only one of these macros should be defined.
|
|
|
|
#undef _LARGE_FILE_API
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif /* IBM AIX */
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2008-12-05 01:56:15 +01:00
|
|
|
* Windows NT
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2002-11-14 14:40:04 +01:00
|
|
|
#ifdef WIN_NT
|
2003-09-13 20:35:39 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#define NO_NFS
|
|
|
|
|
2008-08-27 14:20:47 +02:00
|
|
|
#define SYS_ERR Arg::Windows
|
2008-08-30 05:14:08 +02:00
|
|
|
//#define SLONGFORMAT "ld"
|
|
|
|
//#define ULONGFORMAT "lu"
|
2004-05-19 01:38:37 +02:00
|
|
|
//#define XLONGFORMAT "lX"
|
|
|
|
//#define xLONGFORMAT "lx"
|
2003-08-20 11:35:00 +02:00
|
|
|
|
|
|
|
//format for __LINE__
|
|
|
|
#define LINEFORMAT "d"
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* The following define is the prefix to go in front of a "d" or "u"
|
2004-04-29 00:43:34 +02:00
|
|
|
format item in a printf() format string, to indicate that the argument
|
2007-11-12 15:26:44 +01:00
|
|
|
is an SINT64 or FB_UINT64. */
|
2001-05-23 15:26:42 +02:00
|
|
|
#define QUADFORMAT "I64"
|
|
|
|
/* The following macro creates a quad-sized constant, possibly one
|
|
|
|
which is too large to fit in a long int. The Microsoft compiler does
|
|
|
|
not permit the LL suffix which some other platforms require, but it
|
|
|
|
handles numbers up to the largest 64-bit integer correctly without such
|
|
|
|
a suffix, so the macro definition is trivial. */
|
2007-02-28 12:21:43 +01:00
|
|
|
#ifdef __GNUC__ // needed for gcc 3.3.1
|
2003-11-16 11:31:33 +01:00
|
|
|
#define QUADCONST(n) (n##LL)
|
|
|
|
#else
|
2001-05-23 15:26:42 +02:00
|
|
|
#define QUADCONST(n) (n)
|
2003-11-16 11:31:33 +01:00
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2006-10-30 13:40:24 +01:00
|
|
|
#ifdef AMD64
|
|
|
|
#define IMPLEMENTATION isc_info_db_impl_winnt_amd64 /* 68 */
|
|
|
|
#else
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifndef I386
|
|
|
|
#define I386
|
|
|
|
#endif
|
2002-06-29 15:03:13 +02:00
|
|
|
#define IMPLEMENTATION isc_info_db_impl_isc_winnt_x86 /* 50 */
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
2004-05-04 21:16:43 +02:00
|
|
|
#define IEEE
|
2001-05-23 15:26:42 +02:00
|
|
|
#define API_ROUTINE __stdcall
|
|
|
|
#define API_ROUTINE_VARARG __cdecl
|
|
|
|
#define CLIB_ROUTINE __cdecl
|
|
|
|
|
2002-11-14 14:40:04 +01:00
|
|
|
#ifndef MAXPATHLEN
|
|
|
|
#ifdef MAX_PATH
|
|
|
|
#define MAXPATHLEN MAX_PATH
|
|
|
|
#else
|
|
|
|
#define MAXPATHLEN 260
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2004-05-05 23:55:13 +02:00
|
|
|
#define ERRNO GetLastError()
|
|
|
|
#define INET_ERRNO WSAGetLastError()
|
|
|
|
#define H_ERRNO WSAGetLastError()
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif /* WIN_NT */
|
|
|
|
|
|
|
|
|
2003-02-12 03:26:44 +01:00
|
|
|
/*****************************************************
|
2003-02-13 07:12:52 +01:00
|
|
|
* UNIX
|
2003-02-12 03:26:44 +01:00
|
|
|
*****************************************************/
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifdef UNIX
|
2004-05-04 21:16:43 +02:00
|
|
|
#define NO_CHECKSUM
|
2008-08-27 14:20:47 +02:00
|
|
|
#define SYS_ERR Arg::Unix
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif /* UNIX */
|
|
|
|
|
2004-05-05 23:55:13 +02:00
|
|
|
#ifndef SYS_ERR
|
2008-08-27 14:20:47 +02:00
|
|
|
#define SYS_ERR Arg::Unix
|
2004-05-05 23:55:13 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ERRNO
|
|
|
|
#define ERRNO errno
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef INET_ERRNO
|
|
|
|
#define INET_ERRNO errno
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef H_ERRNO
|
|
|
|
#define H_ERRNO h_errno
|
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* various declaration modifiers */
|
|
|
|
|
|
|
|
#ifndef API_ROUTINE
|
|
|
|
#define API_ROUTINE
|
|
|
|
#define API_ROUTINE_VARARG
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CLIB_ROUTINE
|
|
|
|
#define CLIB_ROUTINE
|
|
|
|
#endif
|
|
|
|
|
2009-01-22 08:35:00 +01:00
|
|
|
#ifndef FB_EXPORTED
|
|
|
|
#define FB_EXPORTED
|
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* alignment macros */
|
|
|
|
|
|
|
|
#ifndef OLD_ALIGNMENT
|
|
|
|
#ifdef I386
|
|
|
|
/* Using internal alignment optimal for 386 processor and above
|
|
|
|
*/
|
2008-11-05 12:26:23 +01:00
|
|
|
//#define FB_ALIGNMENT 4
|
|
|
|
//#define FB_DOUBLE_ALIGN 8
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2008-11-05 12:26:23 +01:00
|
|
|
#ifndef FB_ALIGNMENT
|
|
|
|
//#define FB_ALIGNMENT 2
|
|
|
|
#error must define FB_ALIGNMENT for your system
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SHIFTLONG
|
|
|
|
/* Number of shifts needed to convert between char and LONG */
|
|
|
|
#define SHIFTLONG 2
|
|
|
|
#define BITS_PER_LONG 32
|
|
|
|
#endif
|
|
|
|
|
2008-11-05 12:26:23 +01:00
|
|
|
#ifndef FB_DOUBLE_ALIGN
|
|
|
|
//#define FB_DOUBLE_ALIGN 4
|
|
|
|
#error must define FB_DOUBLE_ALIGN for your system
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* common return values */
|
|
|
|
|
|
|
|
#ifndef FINI_OK
|
|
|
|
#define FINI_OK 0
|
|
|
|
#define FINI_ERROR 1
|
|
|
|
#define STARTUP_ERROR 2 /* this is also used in iscguard.h, make sure these match */
|
|
|
|
#endif
|
|
|
|
|
2001-07-12 07:46:06 +02:00
|
|
|
#ifndef TRUE
|
2001-05-23 15:26:42 +02:00
|
|
|
#define TRUE 1
|
2001-07-12 07:46:06 +02:00
|
|
|
#endif
|
|
|
|
#ifndef FALSE
|
2001-05-23 15:26:42 +02:00
|
|
|
#define FALSE 0
|
2001-07-12 07:46:06 +02:00
|
|
|
#endif
|
2002-11-14 09:33:08 +01:00
|
|
|
#define FB_SUCCESS 0
|
|
|
|
#define FB_FAILURE 1
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2002-11-18 08:57:43 +01:00
|
|
|
/* sys/paramh.h : compatibility purposes */
|
|
|
|
#ifndef NOFILE
|
|
|
|
#define NOFILE 20
|
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* data type definitions */
|
|
|
|
|
|
|
|
#ifndef ISC_TIMESTAMP_DEFINED
|
|
|
|
typedef SLONG ISC_DATE;
|
|
|
|
typedef ULONG ISC_TIME;
|
2004-05-24 19:31:47 +02:00
|
|
|
struct ISC_TIMESTAMP
|
2001-05-23 15:26:42 +02:00
|
|
|
{
|
|
|
|
ISC_DATE timestamp_date;
|
|
|
|
ISC_TIME timestamp_time;
|
2004-05-24 19:31:47 +02:00
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
#define ISC_TIMESTAMP_DEFINED
|
|
|
|
#endif /* ISC_TIMESTAMP_DEFINED */
|
|
|
|
|
|
|
|
#define GDS_DATE ISC_DATE
|
|
|
|
#define GDS_TIME ISC_TIME
|
|
|
|
#define GDS_TIMESTAMP ISC_TIMESTAMP
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef BLOB_PTR
|
|
|
|
#define BLOB_PTR UCHAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-12-24 03:51:06 +01:00
|
|
|
#ifndef SLONGFORMAT
|
2004-01-27 19:19:42 +01:00
|
|
|
#if SIZEOF_LONG == 4
|
|
|
|
#define SLONGFORMAT "ld"
|
|
|
|
#define ULONGFORMAT "lu"
|
|
|
|
#define XLONGFORMAT "lX"
|
|
|
|
#define xLONGFORMAT "lx"
|
|
|
|
#else
|
2001-12-24 03:51:06 +01:00
|
|
|
#define SLONGFORMAT "d"
|
2003-04-01 13:24:18 +02:00
|
|
|
#define ULONGFORMAT "u"
|
2003-04-09 10:57:09 +02:00
|
|
|
#define XLONGFORMAT "X"
|
|
|
|
#define xLONGFORMAT "x"
|
2001-12-24 03:51:06 +01:00
|
|
|
#endif
|
2004-01-27 19:19:42 +01:00
|
|
|
#endif
|
2001-12-24 03:51:06 +01:00
|
|
|
|
2009-08-04 12:42:18 +02:00
|
|
|
// Shortcuts to make it easier to convert code using SLONGFORMAT/ULONGFORMAT
|
|
|
|
#define UQUADFORMAT QUADFORMAT"u"
|
|
|
|
#define SQUADFORMAT QUADFORMAT"d"
|
|
|
|
|
|
|
|
// format for size_t
|
|
|
|
#ifndef SIZEFORMAT
|
|
|
|
#if (SIZEOF_SIZE_T == 8)
|
|
|
|
#define SIZEFORMAT UQUADFORMAT
|
|
|
|
#else
|
|
|
|
#define SIZEFORMAT ULONGFORMAT
|
|
|
|
#endif
|
|
|
|
#endif // SIZEFORMAT
|
|
|
|
|
|
|
|
// format for __LINE__
|
2003-08-20 11:35:00 +02:00
|
|
|
#ifndef LINEFORMAT
|
2009-04-03 12:49:07 +02:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define LINEFORMAT "d"
|
|
|
|
#else
|
2003-08-20 11:35:00 +02:00
|
|
|
#define LINEFORMAT "ld"
|
2009-04-03 12:49:07 +02:00
|
|
|
#endif // __GNUC__
|
2003-08-20 11:35:00 +02:00
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-08-04 12:42:18 +02:00
|
|
|
// format for OS handles
|
2009-08-04 13:32:17 +02:00
|
|
|
#if defined(WIN_NT) && (SIZEOF_VOID_P == 8)
|
|
|
|
#define HANDLEFORMAT SQUADFORMAT
|
2009-08-02 12:47:45 +02:00
|
|
|
#else
|
2009-08-02 16:23:19 +02:00
|
|
|
#define HANDLEFORMAT SLONGFORMAT
|
2009-08-02 12:47:45 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* conditional compilation macros */
|
|
|
|
|
|
|
|
/* MAX and MIN for datatypes */
|
|
|
|
|
|
|
|
#define MAX_UCHAR ((UCHAR)0xFF)
|
|
|
|
#define MIN_UCHAR 0x00
|
|
|
|
|
|
|
|
#define MAX_SCHAR 0x7F
|
2004-12-08 06:58:41 +01:00
|
|
|
#define MIN_SCHAR (-MAX_SCHAR - 1)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#define MAX_USHORT ((USHORT)0xFFFF)
|
|
|
|
#define MIN_USHORT 0x0000
|
|
|
|
|
|
|
|
#define MAX_SSHORT 0x7FFF
|
2004-12-08 06:58:41 +01:00
|
|
|
#define MIN_SSHORT (-MAX_SSHORT - 1)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#define MAX_ULONG ((ULONG)0xFFFFFFFF)
|
|
|
|
#define MIN_ULONG 0x00000000
|
|
|
|
|
|
|
|
#define MAX_SLONG 0x7FFFFFFF
|
2004-12-08 06:58:41 +01:00
|
|
|
#define MIN_SLONG (-MAX_SLONG - 1)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2007-11-12 15:26:44 +01:00
|
|
|
#define MAX_UINT64 ((FB_UINT64) QUADCONST(0xFFFFFFFFFFFFFFFF))
|
2001-05-23 15:26:42 +02:00
|
|
|
#define MIN_UINT64 QUADCONST(0x0000000000000000)
|
|
|
|
|
|
|
|
#define MAX_SINT64 QUADCONST(0x7FFFFFFFFFFFFFFF)
|
2004-12-08 06:58:41 +01:00
|
|
|
#define MIN_SINT64 (-MAX_SINT64 - 1)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* commonly used macros */
|
|
|
|
|
|
|
|
#ifndef MAX
|
2004-11-24 10:22:07 +01:00
|
|
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
#ifndef MIN
|
2004-11-24 10:22:07 +01:00
|
|
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
2004-12-25 10:44:03 +01:00
|
|
|
#define UPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c))
|
|
|
|
#define LOWWER(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* UPPER7 & LOWWER7 are to be used when the data is known to
|
|
|
|
be 7-bit ASCII, eg: internal data, OS data. NOT user data. */
|
|
|
|
|
2004-12-25 10:44:03 +01:00
|
|
|
#define UPPER7(c) (((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c))
|
|
|
|
#define LOWWER7(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#ifndef ROUNDUP
|
2004-11-24 10:22:07 +01:00
|
|
|
#define ROUNDUP(n, b) (((n) + (b) - 1) & ~((b) - 1))
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
#define ROUNDUP_LONG(len) ROUNDUP (len, sizeof (SLONG))
|
|
|
|
|
|
|
|
#define JRD_BUGCHK 15 /* facility code for bugcheck messages */
|
|
|
|
#ifndef OFFSET
|
2004-11-24 10:22:07 +01:00
|
|
|
#define OFFSET(struct, fld) ((size_t) &((struct) NULL)->fld)
|
|
|
|
#define OFFSETA(struct, fld) ((size_t) ((struct) NULL)->fld)
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ODS_ALIGNMENT
|
|
|
|
#define ODS_ALIGNMENT 4
|
|
|
|
#endif
|
|
|
|
|
2004-10-25 03:18:37 +02:00
|
|
|
#ifndef FORMAT_ALIGNMENT
|
|
|
|
// Alignment for items in record format. Used for databases after ODS11.
|
|
|
|
// Always 64-bit to ensure ODS compatibility with 64-bit versions of the engine
|
|
|
|
#define FORMAT_ALIGNMENT 8
|
|
|
|
#endif
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#ifndef SYSCALL_INTERRUPTED
|
|
|
|
#define SYSCALL_INTERRUPTED(err) ((err) == EINTR)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* data movement and allocation macros */
|
|
|
|
|
2008-01-16 09:31:31 +01:00
|
|
|
#define MOVE_CLEAR(to, length) memset(to, 0, (size_t) (length))
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-08 22:23:46 +02:00
|
|
|
// This macros are used to workaround shortage of standard conformance
|
|
|
|
// in Microsoft compilers. They could be replaced with normal procedure
|
|
|
|
// and generic macro if MSVC would support C99-style __VA_ARGS__
|
|
|
|
#define DEFINE_TRACE_ROUTINE(routine) void routine(const char* message, ...)
|
|
|
|
|
2003-10-07 09:24:25 +02:00
|
|
|
#ifdef HAVE_VSNPRINTF
|
2004-11-24 10:22:07 +01:00
|
|
|
#define VSNPRINTF(a, b, c, d) vsnprintf(a, b, c, d)
|
2003-10-07 09:24:25 +02:00
|
|
|
#else
|
2004-11-24 10:22:07 +01:00
|
|
|
#define VSNPRINTF(a, b, c, d) vsprintf(a, c, d)
|
2003-10-07 09:24:25 +02:00
|
|
|
#endif
|
|
|
|
|
2004-03-09 01:17:07 +01:00
|
|
|
#ifdef HAVE_SNPRINTF
|
|
|
|
#define SNPRINTF snprintf
|
|
|
|
#else
|
|
|
|
#define SNPRINTF(buffer, length, ...) sprintf(buffer, __VA_ARGS__)
|
|
|
|
#endif
|
|
|
|
|
2003-09-08 22:23:46 +02:00
|
|
|
#define IMPLEMENT_TRACE_ROUTINE(routine, subsystem) \
|
2008-05-23 15:27:47 +02:00
|
|
|
void routine(const char* message, ...) \
|
|
|
|
{ \
|
2003-09-08 22:23:46 +02:00
|
|
|
static const char name_facility[] = subsystem ","; \
|
|
|
|
char buffer[1000]; \
|
|
|
|
strcpy(buffer, name_facility); \
|
2003-10-07 11:55:59 +02:00
|
|
|
char *ptr = buffer + sizeof(name_facility) - 1; \
|
2003-09-08 22:23:46 +02:00
|
|
|
va_list params; \
|
|
|
|
va_start(params, message); \
|
2003-10-07 11:55:59 +02:00
|
|
|
VSNPRINTF(ptr, sizeof(buffer) - sizeof(name_facility), message, params); \
|
2003-09-08 22:23:46 +02:00
|
|
|
va_end(params); \
|
|
|
|
gds__trace(buffer); \
|
|
|
|
}
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#ifdef DEV_BUILD
|
|
|
|
|
2001-07-10 19:35:13 +02:00
|
|
|
/* Define any debugging symbols and macros here. This
|
2001-05-23 15:26:42 +02:00
|
|
|
ifdef will be executed during development builds. */
|
|
|
|
|
2003-09-08 22:23:46 +02:00
|
|
|
#define TRACE(msg) gds__trace (msg)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#ifndef DEV_REPORT
|
2003-10-28 14:43:45 +01:00
|
|
|
#define DEV_REPORT(msg) gds__log (msg)
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef BREAKPOINT
|
|
|
|
#define BREAKPOINT(x) GDS_breakpoint(x)
|
|
|
|
// fwd. decl. the function itself
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
void GDS_breakpoint(int);
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* DEV_BUILD */
|
|
|
|
|
|
|
|
#ifndef DEV_BUILD
|
2003-09-08 22:23:46 +02:00
|
|
|
#ifndef DEV_REPORT
|
2001-05-23 15:26:42 +02:00
|
|
|
#define DEV_REPORT(msg) gds__log (msg)
|
2003-09-08 22:23:46 +02:00
|
|
|
#endif
|
|
|
|
#ifndef BREAKPOINT
|
2001-05-23 15:26:42 +02:00
|
|
|
#define BREAKPOINT(x) /* nothing */
|
2003-09-08 22:23:46 +02:00
|
|
|
#endif
|
|
|
|
#ifndef TRACE
|
2001-05-23 15:26:42 +02:00
|
|
|
#define TRACE(msg) /* nothing */
|
2003-09-08 22:23:46 +02:00
|
|
|
#endif
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* commonly used buffer sizes for dynamic buffer allocation */
|
|
|
|
|
|
|
|
#define BUFFER_XLARGE 2048
|
|
|
|
#define BUFFER_LARGE 1024
|
|
|
|
#define BUFFER_MEDIUM 512
|
|
|
|
#define BUFFER_SMALL 256
|
|
|
|
#define BUFFER_TINY 128
|
|
|
|
|
2002-06-29 15:03:13 +02:00
|
|
|
/* The default lseek offset type. Changed from nothing to (off_t) to correctly support 64 bit IO */
|
2001-07-12 07:46:06 +02:00
|
|
|
#ifndef LSEEK_OFFSET_CAST
|
2002-06-29 15:03:13 +02:00
|
|
|
#define LSEEK_OFFSET_CAST (off_t)
|
2001-07-12 07:46:06 +02:00
|
|
|
#endif
|
|
|
|
|
2007-04-15 17:57:12 +02:00
|
|
|
#define STRINGIZE_AUX(x) #x
|
|
|
|
#define STRINGIZE(x) STRINGIZE_AUX(x)
|
|
|
|
|
2007-04-19 11:19:11 +02:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define CONST64(a) (a##i64)
|
|
|
|
#else
|
2007-04-25 16:03:45 +02:00
|
|
|
#define CONST64(a) (a##LL)
|
2007-04-19 11:19:11 +02:00
|
|
|
#endif
|
|
|
|
|
2008-12-05 01:56:15 +01:00
|
|
|
// 30 Dec 2002. Nickolay Samofatov
|
2008-06-24 15:07:12 +02:00
|
|
|
// This needs to be checked for all supported platforms
|
|
|
|
// The simpliest way to check it is to issue from correct client:
|
|
|
|
// declare external function abs2 double precision
|
|
|
|
// returns double precision by value
|
|
|
|
// entry_point 'IB_UDF_abs' module_name 'ib_udf';
|
|
|
|
// select abs2(2.0 / 3.0) from rdb$database;
|
|
|
|
// It will return big strange value in case of invalid define
|
|
|
|
|
|
|
|
// ASF: Currently, all little-endian are FB_SWAP_DOUBLE and big-endian aren't.
|
|
|
|
// AP: Define it for your hardware correctly in case your CPU do not follow mentioned rule.
|
|
|
|
// The follwoing lines are kept for reference only.
|
|
|
|
//#if defined(i386) || defined(I386) || defined(_M_IX86) || defined(AMD64) || defined(ARM) || defined(MIPSEL) || defined(DARWIN64) || defined(IA64)
|
|
|
|
//#define FB_SWAP_DOUBLE 1
|
|
|
|
//#elif defined(sparc) || defined(PowerPC) || defined(PPC) || defined(__ppc__) || defined(HPUX) || defined(MIPS) || defined(__ppc64__)
|
|
|
|
//#define FB_SWAP_DOUBLE 0
|
|
|
|
//#else
|
|
|
|
//#error "Define FB_SWAP_DOUBLE for your platform correctly !"
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
#ifndef FB_SWAP_DOUBLE
|
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
#define FB_SWAP_DOUBLE 0
|
|
|
|
#else
|
|
|
|
#define FB_SWAP_DOUBLE 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Commonly used indices to access parts of double in correct order.
|
|
|
|
#if FB_SWAP_DOUBLE
|
|
|
|
#define FB_LONG_DOUBLE_FIRST 1
|
|
|
|
#define FB_LONG_DOUBLE_SECOND 0
|
|
|
|
#else
|
|
|
|
#define FB_LONG_DOUBLE_FIRST 0
|
|
|
|
#define FB_LONG_DOUBLE_SECOND 1
|
|
|
|
#endif
|
|
|
|
|
2007-04-19 11:19:11 +02:00
|
|
|
|
2009-07-07 12:25:50 +02:00
|
|
|
// switch name and state table. This structure should be used in all
|
|
|
|
// command line tools to facilitate parsing options.
|
2008-05-23 15:27:47 +02:00
|
|
|
struct in_sw_tab_t
|
|
|
|
{
|
2001-05-23 15:26:42 +02:00
|
|
|
int in_sw;
|
|
|
|
int in_spb_sw;
|
2003-12-31 06:36:12 +01:00
|
|
|
const TEXT* in_sw_name;
|
2009-07-07 12:25:50 +02:00
|
|
|
SINT64 in_sw_value; // alice specific field
|
|
|
|
SINT64 in_sw_requires; // alice specific field
|
|
|
|
SINT64 in_sw_incompatibilities; // alice specific field
|
2008-05-23 15:27:47 +02:00
|
|
|
bool in_sw_state;
|
2001-05-23 15:26:42 +02:00
|
|
|
USHORT in_sw_msg;
|
|
|
|
USHORT in_sw_min_length;
|
2004-10-07 11:42:03 +02:00
|
|
|
const TEXT* in_sw_text;
|
2009-07-07 12:25:50 +02:00
|
|
|
int in_sw_optype; // burp specific field for now.
|
|
|
|
// Some compilers may produce warnings because I only initialized this field in gbak
|
2003-12-31 06:36:12 +01:00
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2002-09-11 13:30:50 +02:00
|
|
|
#ifndef HAVE_WORKING_VFORK
|
|
|
|
#define vfork fork
|
2002-08-27 13:47:12 +02:00
|
|
|
#endif
|
2002-03-11 17:34:08 +01:00
|
|
|
|
2003-12-31 06:36:12 +01:00
|
|
|
|
2004-01-28 12:14:52 +01:00
|
|
|
static const TEXT FB_SHORT_MONTHS[][4] =
|
2003-12-31 06:36:12 +01:00
|
|
|
{
|
|
|
|
"Jan", "Feb", "Mar",
|
|
|
|
"Apr", "May", "Jun",
|
|
|
|
"Jul", "Aug", "Sep",
|
|
|
|
"Oct", "Nov", "Dec",
|
2004-01-28 12:14:52 +01:00
|
|
|
"\0"
|
2003-12-31 06:36:12 +01:00
|
|
|
};
|
|
|
|
|
2009-04-03 12:49:07 +02:00
|
|
|
static const TEXT* const FB_LONG_MONTHS_UPPER[] =
|
2003-12-31 06:36:12 +01:00
|
|
|
{
|
|
|
|
"JANUARY",
|
|
|
|
"FEBRUARY",
|
|
|
|
"MARCH",
|
|
|
|
"APRIL",
|
|
|
|
"MAY",
|
|
|
|
"JUNE",
|
|
|
|
"JULY",
|
|
|
|
"AUGUST",
|
|
|
|
"SEPTEMBER",
|
|
|
|
"OCTOBER",
|
|
|
|
"NOVEMBER",
|
|
|
|
"DECEMBER",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2002-08-27 13:47:12 +02:00
|
|
|
#endif /* JRD_COMMON_H */
|
2003-12-31 06:36:12 +01:00
|
|
|
|