MagickWand  7.1.0
studio.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.org/script/license.php
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  MagickWand private application programming interface declarations.
17 */
18 #ifndef MAGICKWAND_STUDIO_H
19 #define MAGICKWAND_STUDIO_H
20 
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24 
25 #if defined(WIN32) || defined(WIN64)
26 # define MAGICKWAND_WINDOWS_SUPPORT
27 #else
28 # define MAGICKWAND_POSIX_SUPPORT
29 #endif
30 
31 #define MAGICKWAND_IMPLEMENTATION 1
32 
33 #if !defined(MAGICKWAND_CONFIG_H)
34 # define MAGICKWAND_CONFIG_H
35 # include "MagickCore/magick-config.h"
36 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
37 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
38 #endif
39 #if defined(_magickcore_const) && !defined(const)
40 # define const _magickcore_const
41 #endif
42 #if defined(_magickcore_inline) && !defined(inline)
43 # define inline _magickcore_inline
44 #endif
45 # if defined(__cplusplus) || defined(c_plusplus)
46 # undef inline
47 # endif
48 #endif
49 
50 #if !defined(const)
51 # define STDC
52 #endif
53 
54 #include <stdarg.h>
55 #include <stdio.h>
56 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
57 # include <sys/stat.h>
58 #endif
59 #if defined(MAGICKCORE_STDC_HEADERS)
60 # include <stdlib.h>
61 # include <stddef.h>
62 #else
63 # if defined(MAGICKCORE_HAVE_STDLIB_H)
64 # include <stdlib.h>
65 # endif
66 #endif
67 #if !defined(magick_restrict)
68 # if !defined(_magickcore_restrict)
69 # define magick_restrict restrict
70 # else
71 # define magick_restrict _magickcore_restrict
72 # endif
73 #endif
74 #if defined(MAGICKCORE_HAVE_STRING_H)
75 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
76 # include <memory.h>
77 # endif
78 # include <string.h>
79 #endif
80 #if defined(MAGICKCORE_HAVE_STRINGS_H)
81 # include <strings.h>
82 #endif
83 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
84 # include <inttypes.h>
85 #endif
86 #if defined(MAGICKCORE_HAVE_STDINT_H)
87 # include <stdint.h>
88 #endif
89 #if defined(MAGICKCORE_HAVE_UNISTD_H)
90 # include <unistd.h>
91 #endif
92 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
93 #define _CRTDBG_MAP_ALLOC
94 #endif
95 
96 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
97 #define _CRTDBG_MAP_ALLOC
98 #endif
99 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
100 # include <io.h>
101 #if !defined(__CYGWIN__)
102 # include <direct.h>
103 #endif
104 # if !defined(MAGICKCORE_HAVE_STRERROR)
105 # define HAVE_STRERROR
106 # endif
107 #endif
108 
109 #include <ctype.h>
110 #include <locale.h>
111 #include <errno.h>
112 #include <fcntl.h>
113 #include <math.h>
114 #include <time.h>
115 #include <limits.h>
116 #include <signal.h>
117 #include <assert.h>
118 
119 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
120 # include <xlocale.h>
121 #endif
122 #if defined(MAGICKCORE_THREAD_SUPPORT)
123 # include <pthread.h>
124 #endif
125 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
126 # include <sys/syslimits.h>
127 #endif
128 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
129 # include <arm/limits.h>
130 #endif
131 
132 #if defined(MAGICKCORE__OPENCL)
133 #if defined(MAGICKCORE_HAVE_CL_CL_H)
134 # include <CL/cl.h>
135 #endif
136 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
137 # include <OpenCL/cl.h>
138 #endif
139 # define MAGICKCORE_OPENCL_SUPPORT 1
140 #endif
141 
142 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
143 # include <omp.h>
144 # define MAGICKCORE_OPENMP_SUPPORT 1
145 #endif
146 
147 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
148 ssize_t pread(int,void *,size_t,off_t);
149 #endif
150 
151 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
152 ssize_t pwrite(int,const void *,size_t,off_t);
153 #endif
154 
155 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
156 extern size_t strlcpy(char *,const char *,size_t);
157 #endif
158 
159 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
160 extern int vsnprintf(char *,size_t,const char *,va_list);
161 #endif
162 
164 
165 #if defined(MAGICKWAND_WINDOWS_SUPPORT) || defined(MAGICKWAND_POSIX_SUPPORT)
166 # include <sys/types.h>
167 # include <sys/stat.h>
168 # if defined(MAGICKWAND_POSIX_SUPPORT)
169 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
170 # define dirent direct
171 # define NAMLEN(dirent) (dirent)->d_namlen
172 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
173 # include <sys/ndir.h>
174 # endif
175 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
176 # include <sys/dir.h>
177 # endif
178 # if defined(MAGICKCORE_HAVE_NDIR_H)
179 # include <ndir.h>
180 # endif
181 # else
182 # include <dirent.h>
183 # define NAMLEN(dirent) strlen((dirent)->d_name)
184 # endif
185 # include <sys/wait.h>
186 # include <pwd.h>
187 # endif
188 # if !defined(S_ISDIR)
189 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
190 # endif
191 # if !defined(S_ISREG)
192 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
193 # endif
194 # include "MagickWand/MagickWand.h"
195 # if !defined(MAGICKWAND_WINDOWS_SUPPORT)
196 # include <sys/time.h>
197 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
198 # include <sys/times.h>
199 # endif
200 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
201 # include <sys/resource.h>
202 # endif
203 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
204 # include <sys/mman.h>
205 # endif
206 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
207 # include <sys/sendfile.h>
208 # endif
209 #endif
210 #else
211 # include <types.h>
212 # include <stat.h>
213 # if defined(macintosh)
214 # if !defined(DISABLE_SIOUX)
215 # include <SIOUX.h>
216 # include <console.h>
217 # endif
218 # include <unix.h>
219 # endif
220 #endif
221 
222 #if defined(S_IRUSR) && defined(S_IWUSR)
223 # define S_MODE (S_IRUSR | S_IWUSR)
224 #elif defined (MAGICKWAND_WINDOWS_SUPPORT)
225 # define S_MODE (_S_IREAD | _S_IWRITE)
226 #else
227 # define S_MODE 0600
228 #endif
229 
230 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
231 # include "MagickCore/nt-base.h"
232 #endif
233 
234 #undef HAVE_CONFIG_H
235 #undef gamma
236 #undef index
237 #undef pipe
238 #undef y1
239 
240 /*
241  Review these platform specific definitions.
242 */
243 #if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__)
244 # define DirectorySeparator "/"
245 # define DirectoryListSeparator ':'
246 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
247 # define Exit exit
248 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
249 # define X11_PREFERENCES_PATH "~/."
250 # define ProcessPendingEvents(text)
251 # define ReadCommandlLine(argc,argv)
252 # define SetNotifyHandlers
253 #else
254 # if defined(__OS2__)
255 # define DirectorySeparator "\\"
256 # define DirectoryListSeparator ';'
257 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
258 # define Exit exit
259 # define IsBasenameSeparator(c) \
260  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
261 # define PreferencesDefaults "~\."
262 # define ProcessPendingEvents(text)
263 # define ReadCommandlLine(argc,argv)
264 # define SetNotifyHandlers
265 #endif
266 # if defined(MAGICKWAND_WINDOWS_SUPPORT)
267 # define DirectorySeparator "\\"
268 # define DirectoryListSeparator ';'
269 # define EditorOptions ""
270 # define IsBasenameSeparator(c) \
271  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
272 # define ProcessPendingEvents(text)
273 # if !defined(X11_PREFERENCES_PATH)
274 # define X11_PREFERENCES_PATH "~\\."
275 # endif
276 # define ReadCommandlLine(argc,argv)
277 # define SetNotifyHandlers \
278  SetErrorHandler(NTErrorHandler); \
279  SetWarningHandler(NTWarningHandler)
280 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
281 # define HAVE_TIFFCONF_H
282 # endif
283 # endif
284 
285 #endif
286 
287 /*
288  Define system symbols if not already defined.
289 */
290 #if !defined(STDIN_FILENO)
291 #define STDIN_FILENO 0x00
292 #endif
293 
294 #if !defined(O_BINARY)
295 #define O_BINARY 0x00
296 #endif
297 
298 #if !defined(PATH_MAX)
299 #define PATH_MAX 4096
300 #endif
301 
302 /*
303  Magick defines.
304 */
305 #define MAGICK_SSIZE_MAX (SSIZE_MAX)
306 #define MAGICK_SSIZE_MIN (-(SSIZE_MAX)-1)
307 #if defined(_MSC_VER)
308 # define DisableMSCWarning(nr) __pragma(warning(push)) \
309  __pragma(warning(disable:nr))
310 # define RestoreMSCWarning __pragma(warning(pop))
311 #else
312 # define DisableMSCWarning(nr)
313 # define RestoreMSCWarning
314 #endif
315 
316 #if defined(__cplusplus) || defined(c_plusplus)
317 }
318 #endif
319 
320 #endif