MagickWand  7.0.11
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(MAGICKCORE_HAVE_SYS_TIMEB_H)
169 # include <sys/timeb.h>
170 # endif
171 # if defined(MAGICKWAND_POSIX_SUPPORT)
172 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
173 # define dirent direct
174 # define NAMLEN(dirent) (dirent)->d_namlen
175 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
176 # include <sys/ndir.h>
177 # endif
178 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
179 # include <sys/dir.h>
180 # endif
181 # if defined(MAGICKCORE_HAVE_NDIR_H)
182 # include <ndir.h>
183 # endif
184 # else
185 # include <dirent.h>
186 # define NAMLEN(dirent) strlen((dirent)->d_name)
187 # endif
188 # include <sys/wait.h>
189 # include <pwd.h>
190 # endif
191 # if !defined(S_ISDIR)
192 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
193 # endif
194 # if !defined(S_ISREG)
195 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
196 # endif
197 # include "MagickWand/MagickWand.h"
198 # if !defined(MAGICKWAND_WINDOWS_SUPPORT)
199 # include <sys/time.h>
200 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
201 # include <sys/times.h>
202 # endif
203 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
204 # include <sys/resource.h>
205 # endif
206 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
207 # include <sys/mman.h>
208 # endif
209 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
210 # include <sys/sendfile.h>
211 # endif
212 #endif
213 #else
214 # include <types.h>
215 # include <stat.h>
216 # if defined(macintosh)
217 # if !defined(DISABLE_SIOUX)
218 # include <SIOUX.h>
219 # include <console.h>
220 # endif
221 # include <unix.h>
222 # endif
223 #endif
224 
225 #if defined(S_IRUSR) && defined(S_IWUSR)
226 # define S_MODE (S_IRUSR | S_IWUSR)
227 #elif defined (MAGICKWAND_WINDOWS_SUPPORT)
228 # define S_MODE (_S_IREAD | _S_IWRITE)
229 #else
230 # define S_MODE 0600
231 #endif
232 
233 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
234 # include "MagickCore/nt-base.h"
235 #endif
236 
237 #undef HAVE_CONFIG_H
238 #undef gamma
239 #undef index
240 #undef pipe
241 #undef y1
242 
243 /*
244  Review these platform specific definitions.
245 */
246 #if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__)
247 # define DirectorySeparator "/"
248 # define DirectoryListSeparator ':'
249 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
250 # define Exit exit
251 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
252 # define X11_PREFERENCES_PATH "~/."
253 # define ProcessPendingEvents(text)
254 # define ReadCommandlLine(argc,argv)
255 # define SetNotifyHandlers
256 #else
257 # if defined(__OS2__)
258 # define DirectorySeparator "\\"
259 # define DirectoryListSeparator ';'
260 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
261 # define Exit exit
262 # define IsBasenameSeparator(c) \
263  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
264 # define PreferencesDefaults "~\."
265 # define ProcessPendingEvents(text)
266 # define ReadCommandlLine(argc,argv)
267 # define SetNotifyHandlers
268 #endif
269 # if defined(MAGICKWAND_WINDOWS_SUPPORT)
270 # define DirectorySeparator "\\"
271 # define DirectoryListSeparator ';'
272 # define EditorOptions ""
273 # define IsBasenameSeparator(c) \
274  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
275 # define ProcessPendingEvents(text)
276 # if !defined(X11_PREFERENCES_PATH)
277 # define X11_PREFERENCES_PATH "~\\."
278 # endif
279 # define ReadCommandlLine(argc,argv)
280 # define SetNotifyHandlers \
281  SetErrorHandler(NTErrorHandler); \
282  SetWarningHandler(NTWarningHandler)
283 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
284 # define HAVE_TIFFCONF_H
285 # endif
286 # endif
287 
288 #endif
289 
290 /*
291  Define system symbols if not already defined.
292 */
293 #if !defined(STDIN_FILENO)
294 #define STDIN_FILENO 0x00
295 #endif
296 
297 #if !defined(O_BINARY)
298 #define O_BINARY 0x00
299 #endif
300 
301 #if !defined(PATH_MAX)
302 #define PATH_MAX 4096
303 #endif
304 
305 /*
306  Magick defines.
307 */
308 #define MAGICK_SSIZE_MAX (SSIZE_MAX)
309 #define MAGICK_SSIZE_MIN (-(SSIZE_MAX)-1)
310 #if defined(_MSC_VER)
311 # define DisableMSCWarning(nr) __pragma(warning(push)) \
312  __pragma(warning(disable:nr))
313 # define RestoreMSCWarning __pragma(warning(pop))
314 #else
315 # define DisableMSCWarning(nr)
316 # define RestoreMSCWarning
317 #endif
318 
319 #if defined(__cplusplus) || defined(c_plusplus)
320 }
321 #endif
322 
323 #endif