1// -*- C++ -*- 2//============================================================================================== 3// 4// This file is part of LiDIA --- a library for computational number theory 5// 6// Copyright (c) 1994--2001 the LiDIA Group. All rights reserved. 7// 8// See http://www.informatik.tu-darmstadt.de/TI/LiDIA/ 9// 10//---------------------------------------------------------------------------------------------- 11// 12// $Id$ 13// 14// Author : Thomas Papanikolaou, Safuat Hamdy 15// Changes : See CVS log 16// 17//============================================================================================== 18 19 20#ifndef LIDIA_LIDIA_H_GUARD_ 21#define LIDIA_LIDIA_H_GUARD_ 22 23 24#undef LIDIA_MAJOR_VERSION 25#undef LIDIA_MINOR_VERSION 26#undef LIDIA_PATCH_VERSION 27 28 29// <cstddef> canonically defines NULL and size_t 30#include <cstddef> 31#include <cstdlib> 32#include <climits> 33 34 35#define C_STDIO 36 37// <iostream> is used almost everywhere 38#include <iostream> 39#ifdef C_STDIO 40# include <cstdio> 41#endif 42 43 44#define LIDIA_ARITH_GMP 0x100 45#define LIDIA_ARITH_CLN 0x101 46#define LIDIA_ARITH_LIBI 0x102 47#define LIDIA_ARITH_PIOLOGIE 0x103 48//#define LIDIA_ARITH_FREELIP 0x104 49//#define LIDIA_ARITH_OPENSSL 0x105 50 51 52// 53// set LIDIA_ARITHMETIC to one of the above values 54// 55#undef LIDIA_ARITHMETIC 56 57// safety belt 58#if !defined LIDIA_ARITHMETIC || LIDIA_ARITHMETIC == 0 59# error LiDIA arithmetic not defined or improperly set! 60#endif 61 62 63// 64// Set to 1 if the arithmetic interface inlines the underlying arithmetic routines. 65// 66#undef INLINE_INTERFACE 67 68 69// 70// some compiler characteristics (at configuration time) 71// 72 73// The number of bytes in a short. 74#undef SIZEOF_SHORT 75 76// The number of bytes in a int. 77#undef SIZEOF_INT 78 79// The number of bytes in a long. 80#undef SIZEOF_LONG 81 82// The number of bytes in a double. 83#undef SIZEOF_DOUBLE 84 85// Define, if words are big endian. 86#undef WORDS_BIGENDIAN 87 88// Define if <strstream> shall be used instead of <sstream> 89#undef OSSTREAM_USE_STRSTREAM 90 91 92#if defined(__hpux) && !defined(__GNUC__) 93# define HAVE_HP_UX_CC 94# define LIDIA_NO_SF_BIGINT 95#endif 96 97 98// Define if you want error handling via exceptions 99#undef LIDIA_EXCEPTIONS 100 101// Define if you want namespaces. 102#undef LIDIA_NAMESPACE 103 104// if name spaces are not wanted, define LiDIA to be <empty> 105#ifndef LIDIA_NAMESPACE 106# define LiDIA 107#endif 108 109 110 111#ifdef LIDIA_NAMESPACE 112namespace LiDIA { 113#endif 114 115 116 117enum { 118 BITS_PER_CHAR = CHAR_BIT, 119 HIGH_BIT_UCHAR = (1UL << (BITS_PER_CHAR - 1)), 120 121 BITS_PER_SHORT = BITS_PER_CHAR * SIZEOF_SHORT, 122 HIGH_BIT_USHORT = (1UL << (BITS_PER_SHORT - 1)), 123 124 BITS_PER_INT = BITS_PER_CHAR * SIZEOF_INT, 125 HIGH_BIT_UINT = (1UL << (BITS_PER_INT - 1)), 126 127 BITS_PER_LONG = BITS_PER_CHAR * SIZEOF_LONG, 128 HIGH_BIT_ULONG = (1UL << (BITS_PER_LONG - 1)), 129 130 BITS_PER_DOUBLE = BITS_PER_CHAR * SIZEOF_DOUBLE 131}; 132 133 134 135// 136// these are the types for machine integers 137// define sizetify to longify if lidia_size_t == long 138// 139 140typedef int lidia_size_t; 141#define sizetify intify 142 143typedef long sdigit; 144// typedef unsigned long udigit; 145 146 147 148#ifdef LIDIA_NAMESPACE 149} // end of namespace LiDIA 150#endif 151 152 153 154// 155// Debug handling for templates 156// 157 158#ifndef LIDIA_DEBUG_LIMIT 159# define LIDIA_DEBUG_LIMIT -1000 160#endif 161#define LDBL_VECTOR (LIDIA_DEBUG_LIMIT + 0) 162#define LDBL_UNIPOL (LIDIA_DEBUG_LIMIT + 50) 163#define LDBL_UNIPOW (LIDIA_DEBUG_LIMIT + 100) 164#define LDBL_MATRIX (LIDIA_DEBUG_LIMIT + 150) 165 166 167 168// 169// include LiDIA system files 170// 171 172#include <LiDIA/warning.h> 173#include <LiDIA/error.h> 174#include <LiDIA/debug.h> 175#include <LiDIA/memory.h> 176 177 178 179// 180// The maximal number of characters of which the 181// operating system is able to put in one line. 182// 183 184#ifndef LIDIA_CHARS_PER_LINE 185# define LIDIA_CHARS_PER_LINE 0 186#endif 187 188 189 190// 191// LiDIA macros 192// 193 194#ifndef LIDIA_MACROS 195# define LIDIA_MACROS 196#endif 197 198#define lidia_rint(x) (floor((x)+0.5)) 199 200#if (defined(__hpux) && !defined(__STDC__)) 201# define __STDC__ 202#endif 203 204#if defined(__STDC__) || defined (_MSC_VER) 205# define LIDIA_CONCAT2(a,b) a##b 206# define LIDIA_CONCAT3(a,b,c) a##b##c 207# define LIDIA_CONCAT4(a,b,c,d) a##b##c##d 208#else 209# define LIDIA_CONCAT2(a,b) a/**/b 210# define LIDIA_CONCAT3(a,b,c) a/**/b/**/c 211# define LIDIA_CONCAT4(a,b,c,d) a/**/b/**/c/**/d 212#endif 213 214 215 216#endif // LIDIA_LIDIA_H_GUARD_ 217