1 | // -*- C++ -*- |
---|
2 | /*************************************************************************** |
---|
3 | * blitz/blitz.h Includes all the important header files |
---|
4 | * |
---|
5 | * $Id: blitz.h,v 1.14 2005/05/18 23:35:55 julianc Exp $ |
---|
6 | * |
---|
7 | * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License |
---|
11 | * as published by the Free Software Foundation; either version 2 |
---|
12 | * of the License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * Suggestions: blitz-dev@oonumerics.org |
---|
20 | * Bugs: blitz-bugs@oonumerics.org |
---|
21 | * |
---|
22 | * For more information, please see the Blitz++ Home Page: |
---|
23 | * http://oonumerics.org/blitz/ |
---|
24 | * |
---|
25 | ***************************************************************************/ |
---|
26 | |
---|
27 | #ifndef BZ_BLITZ_H |
---|
28 | #define BZ_BLITZ_H |
---|
29 | |
---|
30 | /* |
---|
31 | * These symbols allow use of the IEEE and System V math libraries |
---|
32 | * (libm.a and libmsaa.a) on some platforms. |
---|
33 | */ |
---|
34 | |
---|
35 | #ifdef BZ_ENABLE_XOPEN_SOURCE |
---|
36 | #ifndef _ALL_SOURCE |
---|
37 | #define _ALL_SOURCE |
---|
38 | #endif |
---|
39 | #ifndef _XOPEN_SOURCE |
---|
40 | #define _XOPEN_SOURCE |
---|
41 | #endif |
---|
42 | #ifndef _XOPEN_SOURCE_EXTENDED |
---|
43 | #define _XOPEN_SOURCE_EXTENDED 1 |
---|
44 | #endif |
---|
45 | #endif |
---|
46 | |
---|
47 | #include <blitz/compiler.h> // Compiler-specific directives |
---|
48 | #include <blitz/tuning.h> // Performance tuning |
---|
49 | #include <blitz/tau.h> // Profiling |
---|
50 | |
---|
51 | #include <string> |
---|
52 | #include <stdio.h> // sprintf, etc. |
---|
53 | |
---|
54 | #ifdef BZ_HAVE_STD |
---|
55 | #include <iostream> |
---|
56 | #include <iomanip> |
---|
57 | #else |
---|
58 | #include <iostream.h> |
---|
59 | #include <iomanip.h> |
---|
60 | #endif |
---|
61 | |
---|
62 | #ifdef BZ_MATH_FN_IN_NAMESPACE_STD |
---|
63 | #include <cmath> |
---|
64 | #else |
---|
65 | #include <math.h> |
---|
66 | #endif |
---|
67 | |
---|
68 | #ifdef BZ_HAVE_COMPLEX |
---|
69 | #include <complex> |
---|
70 | #endif |
---|
71 | |
---|
72 | #define BZ_THROW // Needed in <blitz/numinquire.h> |
---|
73 | |
---|
74 | BZ_NAMESPACE(blitz) |
---|
75 | |
---|
76 | #ifdef BZ_HAVE_STD |
---|
77 | BZ_USING_NAMESPACE(std) |
---|
78 | #endif |
---|
79 | |
---|
80 | #ifdef BZ_GENERATE_GLOBAL_INSTANCES |
---|
81 | #define _bz_global |
---|
82 | #define BZ_GLOBAL_INIT(X) =X |
---|
83 | #else |
---|
84 | #define _bz_global extern |
---|
85 | #define BZ_GLOBAL_INIT(X) |
---|
86 | #endif |
---|
87 | |
---|
88 | BZ_NAMESPACE_END |
---|
89 | |
---|
90 | /* |
---|
91 | * Thread safety issues. |
---|
92 | * Compiling with -pthread under gcc, or -mt under solaris, |
---|
93 | * should automatically turn on BZ_THREADSAFE. |
---|
94 | */ |
---|
95 | #ifdef _REENTRANT |
---|
96 | #ifndef BZ_THREADSAFE |
---|
97 | #define BZ_THREADSAFE |
---|
98 | #endif |
---|
99 | #endif |
---|
100 | |
---|
101 | /* |
---|
102 | * Which mutex implementation should be used for synchronizing |
---|
103 | * reference counts. Currently only one option -- pthreads. |
---|
104 | */ |
---|
105 | #ifdef BZ_THREADSAFE |
---|
106 | #define BZ_THREADSAFE_USE_PTHREADS |
---|
107 | #endif |
---|
108 | |
---|
109 | #ifdef BZ_THREADSAFE_USE_PTHREADS |
---|
110 | #include <pthread.h> |
---|
111 | |
---|
112 | #define BZ_MUTEX_DECLARE(name) mutable pthread_mutex_t name; |
---|
113 | #define BZ_MUTEX_INIT(name) pthread_mutex_init(&name,NULL); |
---|
114 | #define BZ_MUTEX_LOCK(name) pthread_mutex_lock(&name); |
---|
115 | #define BZ_MUTEX_UNLOCK(name) pthread_mutex_unlock(&name); |
---|
116 | #define BZ_MUTEX_DESTROY(name) pthread_mutex_destroy(&name); |
---|
117 | #else |
---|
118 | #define BZ_MUTEX_DECLARE(name) |
---|
119 | #define BZ_MUTEX_INIT(name) |
---|
120 | #define BZ_MUTEX_LOCK(name) |
---|
121 | #define BZ_MUTEX_UNLOCK(name) |
---|
122 | #define BZ_MUTEX_DESTROY(name) |
---|
123 | #endif |
---|
124 | |
---|
125 | #include <blitz/bzdebug.h> // Debugging macros |
---|
126 | |
---|
127 | #endif // BZ_BLITZ_H |
---|