1 /*--------------------------------------------------------------------
2  *
3  *	Copyright (c) 1991-2021 by the GMT Team (https://www.generic-mapping-tools.org/team.html)
4  *	See LICENSE.TXT file for copying and redistribution conditions.
5  *
6  *	This program is free software; you can redistribute it and/or modify
7  *	it under the terms of the GNU Lesser General Public License as published by
8  *	the Free Software Foundation; version 3 or any later version.
9  *
10  *	This program is distributed in the hope that it will be useful,
11  *	but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *	GNU Lesser General Public License for more details.
14  *
15  *	Contact info: www.generic-mapping-tools.org
16  *--------------------------------------------------------------------*/
17 /*
18  * gmt_dev.h is the main include file for the main development of gmt.
19  * It includes the API (gmt.h) and contains lower-level definitions
20  * for several of the structures and parameters used by all libraries.
21  * It also includes all of the other include files that are needed.
22  *
23  * Author:	Paul Wessel
24  * Date:	01-AUG-2011
25  * Version:	6 API
26  */
27 
28 /*!
29  * \file gmt_dev.h
30  * \brief Main include file for the main development of gmt.
31  */
32 
33 /* Note on data type:  GMT will generally use double precision for
34  * all floating point values except for grids which are held in single
35  * precision floats.  All integer values are standard int (presumably
36  * 32-bit) except for quantities that may be very large, such as
37  * counters of data records, which will be declared as uint64_t, and
38  * variables that holds allocated number of bytes and similar, which
39  * will be declared as size_t.  Occasionally, arrays of integer values
40  * will be stored in smaller memory containers such as short int of
41  * unsigned/signed char when the program logic places limits on their
42  * possible ranges (e.g., true/false variables).
43  */
44 
45 #pragma once
46 #ifndef GMT_DEV_H
47 #define GMT_DEV_H
48 
49 #ifdef __cplusplus	/* Basic C++ support */
50 extern "C" {
51 #endif
52 
53 /* Note: GMT functions will sometimes have arguments that are unused by design, i.e., to ensure that
54  * a family of functions have the same number and type of arguments so that pointers to these functions
55  * can be passed, even though in some cases not all arguments are used.  These will result in compiler
56  * warnings [-Wunused-variable]. To suppress those (and only those), we can define gmt_M_unused as this:
57  */
58 
59 #define gmt_M_unused(x) (void)(x)
60 
61 /* and then call gmt_M_unused() on all such variables at the beginning of a routine. For example:
62  * bool func (int x) { gmt_M_unused(x); return(true); }
63  * This should work for all compilers, GCC and others.
64  * Just grep for gmt_M_unused to see where these situations occur.
65  */
66 
67 /* Because gcc does not support some features in clang AND due to bugs in os/base.h we must add these,
68  * see http://stackoverflow.com/questions/26527077/compiling-with-accelerate-framework-on-osx-yosemite */
69 
70 #ifdef __APPLE__
71     /* Apple Xcode expects _Nullable to be defined but it is not if gcc */
72 #   ifndef _Nullable
73 #       define _Nullable
74 #   endif
75 #   ifndef __clang__
76 #       ifndef __has_extension
77 #           define __has_extension(x) 0
78 #       endif
79 #       define vImage_Utilities_h
80 #       define vImage_CVUtilities_h
81 #   endif
82 #endif
83 
84 /* Avoid some annoying warnings from MS Visual Studio */
85 #ifdef _MSC_VER
86 #	pragma warning( disable : 4091 )	/* 'static ': ignored on left of 'XXX' when no variable is declared */
87 #	pragma warning( disable : 4244 )	/* conversion from 'uint64_t' to '::size_t', possible loss of data */
88 #endif
89 
90 /* CMake definitions: This must be first! */
91 #include "gmt_config.h"
92 
93 #if defined(HAVE_GLIB_GTHREAD) || defined(_OPENMP)
94 /* This means we should enable the -x+a|[-]<ncores> common option */
95 #define GMT_MP_ENABLED
96 #endif
97 
98 /* Declaration modifiers for DLL support (MSC et al) */
99 #include "declspec.h"
100 
101 /* Declaration for PSL */
102 #include "postscriptlight.h"
103 
104 /*--------------------------------------------------------------------
105  *      SYSTEM HEADER FILES
106  *--------------------------------------------------------------------*/
107 
108 #include <stdio.h>
109 #include <stdlib.h>
110 #include <string.h>
111 
112 #include <float.h>
113 #include <math.h>
114 #include <limits.h>
115 #include <errno.h>
116 
117 #include <time.h>
118 
119 #ifdef EXPORT_GMTLIB
120 /* Used to export everything so external environments can do unit tests */
121 #	define GMT_LOCAL EXTERN_MSC
122 #else
123 /* Used to restrict the scope of a function to the file it was declared in */
124 #	define GMT_LOCAL static
125 #endif
126 
127 #include "gmt_common_math.h" /* Shared math functions */
128 #include "gmt.h"             /* All GMT high-level API */
129 #include "gmt_private.h"     /* API declaration needed by libraries */
130 #include "gmt_hidden.h"      /* Hidden bookkeeping structure for API containers */
131 
132 struct GMT_CTRL; /* forward declaration of GMT_CTRL */
133 
134 #include "gmt_notposix.h"       /* Non-POSIX extensions */
135 
136 #include "gmt_constants.h"      /* All basic constant definitions */
137 #include "gmt_modern.h"         /* Modern mode constant definitions */
138 #include "gmt_macros.h"         /* All basic macros definitions */
139 #include "gmt_dimensions.h"     /* Constant definitions created by configure */
140 #include "gmt_time.h"           /* Declarations of structures for dealing with time */
141 #include "gmt_texture.h"        /* Declarations of structures for dealing with pen, fill, etc. */
142 #include "gmt_defaults.h"       /* Declarations of structure for GMT default settings */
143 #include "gmt_psl.h"            /* Declarations of structure for GMT PostScript settings */
144 #include "gmt_hash.h"           /* Declarations of structure for GMT hashing */
145 
146 #ifdef HAVE_GDAL
147 #	include "gmt_gdalread.h"      /* GDAL support */
148 #endif
149 
150 #include "gmt_common.h"         /* For holding the GMT common option settings */
151 #include "gmt_fft.h"            /* Structures and enums used by programs needing FFTs */
152 #include "gmt_nan.h"            /* Machine-dependent macros for making and testing NaNs */
153 #include "gmt_error.h"          /* Only contains error codes */
154 #include "gmt_synopsis.h"       /* Only contains macros for synopsis lines */
155 #include "gmt_version.h"        /* Only contains the current GMT version number */
156 #include "gmt_project.h"        /* Define GMT->current.proj and GMT->current.map.frame structures */
157 #include "gmt_grd.h"            /* Define grd file header structure */
158 #include "gmt_grdio.h"          /* Defines function pointers for grd i/o operations */
159 #include "gmt_io.h"             /* Defines structures and macros for table i/o */
160 #include "gmt_shore.h"          /* Defines structures used when reading shore database */
161 #include "gmt_dcw.h"            /* Defines structure and functions used when using DCW polygons */
162 #include "gmt_symbol.h"         /* Custom symbol functions */
163 #include "gmt_contour.h"        /* Contour label structure and functions */
164 #include "gmt_decorate.h"       /* Decorated line structure */
165 #include "gmt_plot.h"           /* extern functions defined in gmt_plot.c */
166 #include "gmt_memory.h"         /* extern functions defined in gmt_M_memory.c */
167 #include "gmt_types.h"          /* GMT type declarations */
168 #include "gmt_remote.h"         /* GMT remote dataset structure */
169 
170 #ifdef _OPENMP                  /* Using open MP parallelization */
171 #include <omp.h>
172 #endif
173 
174 #include "gmt_prototypes.h"     /* All GMT low-level API */
175 #include "gmt_common_string.h"  /* All code shared between GMT and PSL */
176 
177 #ifndef NO_SIGHANDLER
178 /* Include signal declarations */
179 #include "gmt_common_sighandler.h"
180 #endif
181 
182 #include "gmt_mb.h"		/* GMT redefines for MB-system compatibility */
183 
184 /* If GLIBC compatible qsort_r is not available */
185 #ifndef HAVE_QSORT_R_GLIBC
186 #	include "compat/qsort.h"
187 #endif
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif  /* !GMT_DEV_H */
194