MagickCore  6.9.10
Convert, Edit, Or Compose Bitmap Images
studio.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2018 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.
6  obtain a copy of the License at
7 
8  https://www.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  MagickCore private application programming interface declarations.
17 */
18 #ifndef MAGICKCORE_STUDIO_H
19 #define MAGICKCORE_STUDIO_H
20 
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24 
25 #if defined(WIN32) || defined(WIN64)
26 # define MAGICKCORE_WINDOWS_SUPPORT
27 #else
28 # define MAGICKCORE_POSIX_SUPPORT
29 #endif
30 
31 #define MAGICKCORE_IMPLEMENTATION 1
32 
33 #if !defined(MAGICKCORE_CONFIG_H)
34 # define MAGICKCORE_CONFIG_H
35 # if !defined(vms) && !defined(macintosh)
36 # include "magick/magick-config.h"
37 # else
38 # include "magick-config.h"
39 # endif
40 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
41 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
42 #endif
43 #if defined(_magickcore_const) && !defined(const)
44 # define const _magickcore_const
45 #endif
46 #if defined(_magickcore_inline) && !defined(inline)
47 # define inline _magickcore_inline
48 #endif
49 # if defined(__cplusplus) || defined(c_plusplus)
50 # undef inline
51 # endif
52 #endif
53 
54 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
55 # include "magick/methods.h"
56 #endif
57 
58 #if !defined(const)
59 # define STDC
60 #endif
61 
62 #include <stdarg.h>
63 #include <stdio.h>
64 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
65 # include <sys/stat.h>
66 #endif
67 #if defined(MAGICKCORE_STDC_HEADERS)
68 # include <stdlib.h>
69 # include <stddef.h>
70 #else
71 # if defined(MAGICKCORE_HAVE_STDLIB_H)
72 # include <stdlib.h>
73 # endif
74 #endif
75 #if !defined(magick_restrict)
76 # if !defined(_magickcore_restrict)
77 # define magick_restrict restrict
78 # else
79 # define magick_restrict _magickcore_restrict
80 # endif
81 #endif
82 #if defined(MAGICKCORE_HAVE_STRING_H)
83 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
84 # include <memory.h>
85 # endif
86 # include <string.h>
87 #endif
88 #if defined(MAGICKCORE_HAVE_STRINGS_H)
89 # include <strings.h>
90 #endif
91 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
92 # include <inttypes.h>
93 #endif
94 #if defined(MAGICKCORE_HAVE_STDINT_H)
95 # include <stdint.h>
96 #endif
97 #if defined(MAGICKCORE_HAVE_UNISTD_H)
98 # include <unistd.h>
99 #endif
100 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
101 #define _CRTDBG_MAP_ALLOC
102 #endif
103 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
104 # include <io.h>
105 #if !defined(__CYGWIN__)
106 # include <direct.h>
107 #endif
108 # if !defined(MAGICKCORE_HAVE_STRERROR)
109 # define HAVE_STRERROR
110 # endif
111 #endif
112 
113 #include <ctype.h>
114 #include <locale.h>
115 #include <errno.h>
116 #include <fcntl.h>
117 #include <math.h>
118 #include <time.h>
119 #include <limits.h>
120 #include <signal.h>
121 #include <assert.h>
122 
123 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
124 # include <xlocale.h>
125 #endif
126 #if defined(MAGICKCORE_THREAD_SUPPORT)
127 # include <pthread.h>
128 #endif
129 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
130 #if !defined(__CYGWIN__)
131 #include <winsock2.h>
132 #include <ws2tcpip.h>
133 #endif
134 #include <windows.h>
135 #pragma comment (lib, "ws2_32.lib")
136 #endif
137 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
138 # include <sys/syslimits.h>
139 #endif
140 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
141 # include <arm/limits.h>
142 #endif
143 
144 #if defined(MAGICKCORE__OPENCL) && !defined(MAGICK_PIXEL_RGBA)
145 #if defined(MAGICKCORE_HAVE_CL_CL_H)
146 # include <CL/cl.h>
147 #endif
148 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
149 # include <OpenCL/cl.h>
150 #endif
151 # define MAGICKCORE_OPENCL_SUPPORT 1
152 #endif
153 
154 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
155 # include <omp.h>
156 # define MAGICKCORE_OPENMP_SUPPORT 1
157 #endif
158 
159 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
160 ssize_t pread(int,void *,size_t,off_t);
161 #endif
162 
163 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
164 ssize_t pwrite(int,const void *,size_t,off_t);
165 #endif
166 
167 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
168 extern size_t strlcpy(char *,const char *,size_t);
169 #endif
170 
171 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
172 extern int vsnprintf(char *,size_t,const char *,va_list);
173 #endif
174 
175 #include "magick/method-attribute.h"
176 
177 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
178 # include <sys/types.h>
179 # include <sys/stat.h>
180 # if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
181 # include <sys/timeb.h>
182 # endif
183 # if defined(MAGICKCORE_POSIX_SUPPORT)
184 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
185 # define dirent direct
186 # define NAMLEN(dirent) (dirent)->d_namlen
187 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
188 # include <sys/ndir.h>
189 # endif
190 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
191 # include <sys/dir.h>
192 # endif
193 # if defined(MAGICKCORE_HAVE_NDIR_H)
194 # include <ndir.h>
195 # endif
196 # else
197 # include <dirent.h>
198 # define NAMLEN(dirent) strlen((dirent)->d_name)
199 # endif
200 # include <sys/wait.h>
201 # include <pwd.h>
202 # endif
203 # if !defined(S_ISDIR)
204 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
205 # endif
206 # if !defined(S_ISREG)
207 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
208 # endif
209 # include "magick/magick-type.h"
210 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
211 # include <sys/time.h>
212 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
213 # include <sys/times.h>
214 # endif
215 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
216 # include <sys/resource.h>
217 # endif
218 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
219 # include <sys/mman.h>
220 # endif
221 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
222 # include <sys/sendfile.h>
223 # endif
224 #endif
225 #else
226 # include <types.h>
227 # include <stat.h>
228 # if defined(macintosh)
229 # if !defined(DISABLE_SIOUX)
230 # include <SIOUX.h>
231 # include <console.h>
232 # endif
233 # include <unix.h>
234 # endif
235 # include "magick/magick-type.h"
236 #endif
237 
238 #if defined(S_IRUSR) && defined(S_IWUSR)
239 # define S_MODE (S_IRUSR | S_IWUSR)
240 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
241 # define S_MODE (_S_IREAD | _S_IWRITE)
242 #else
243 # define S_MODE 0600
244 #endif
245 
246 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
247 # include "magick/nt-base.h"
248 #endif
249 #if defined(macintosh)
250 # include "magick/mac.h"
251 #endif
252 #if defined(vms)
253 # include "magick/vms.h"
254 #endif
255 
256 #undef HAVE_CONFIG_H
257 #undef gamma
258 #undef index
259 #undef pipe
260 #undef y1
261 
262 /*
263  Review these platform specific definitions.
264 */
265 #if ( defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__) ) && !defined( __VMS )
266 # define DirectorySeparator "/"
267 # define DirectoryListSeparator ':'
268 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
269 # define Exit exit
270 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
271 # define X11_PREFERENCES_PATH "~/."
272 # define ProcessPendingEvents(text)
273 # define ReadCommandlLine(argc,argv)
274 # define SetNotifyHandlers
275 #else
276 # if defined(vms)
277 # define X11_APPLICATION_PATH "decw$system_defaults:"
278 # define DirectorySeparator ""
279 # define DirectoryListSeparator ';'
280 # define EditorOptions ""
281 # define Exit exit
282 # define IsBasenameSeparator(c) \
283  (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
284 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
285 # define MAGICKCORE_SHARE_PATH "sys$login:"
286 # define X11_PREFERENCES_PATH "decw$user_defaults:"
287 # define ProcessPendingEvents(text)
288 # define ReadCommandlLine(argc,argv)
289 # define SetNotifyHandlers
290 # endif
291 # if defined(__OS2__)
292 # define DirectorySeparator "\\"
293 # define DirectoryListSeparator ';'
294 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
295 # define Exit exit
296 # define IsBasenameSeparator(c) \
297  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
298 # define PreferencesDefaults "~\."
299 # define ProcessPendingEvents(text)
300 # define ReadCommandlLine(argc,argv)
301 # define SetNotifyHandlers
302 #endif
303 # if defined(macintosh)
304 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
305 # define DirectorySeparator ":"
306 # define DirectoryListSeparator ';'
307 # define EditorOptions ""
308 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
309 # define MAGICKCORE_LIBRARY_PATH ""
310 # define MAGICKCORE_SHARE_PATH ""
311 # define X11_PREFERENCES_PATH "~/."
312 # if defined(DISABLE_SIOUX)
313 # define ReadCommandlLine(argc,argv)
314 # define SetNotifyHandlers \
315  SetFatalErrorHandler(MacFatalErrorHandler); \
316  SetErrorHandler(MACErrorHandler); \
317  SetWarningHandler(MACWarningHandler)
318 # else
319 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
320 # define SetNotifyHandlers \
321  SetErrorHandler(MACErrorHandler); \
322  SetWarningHandler(MACWarningHandler)
323 # endif
324 # endif
325 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
326 # define DirectorySeparator "\\"
327 # define DirectoryListSeparator ';'
328 # define EditorOptions ""
329 # define IsBasenameSeparator(c) \
330  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
331 # define ProcessPendingEvents(text)
332 # if !defined(X11_PREFERENCES_PATH)
333 # define X11_PREFERENCES_PATH "~\\."
334 # endif
335 # define ReadCommandlLine(argc,argv)
336 # define SetNotifyHandlers \
337  SetErrorHandler(NTErrorHandler); \
338  SetWarningHandler(NTWarningHandler)
339 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
340 # define HAVE_TIFFCONF_H
341 # endif
342 # endif
343 
344 #endif
345 
346 /*
347  Define system symbols if not already defined.
348 */
349 #if !defined(STDIN_FILENO)
350 #define STDIN_FILENO 0x00
351 #endif
352 
353 #if !defined(O_BINARY)
354 #define O_BINARY 0x00
355 #endif
356 
357 #if !defined(PATH_MAX)
358 #define PATH_MAX 4096
359 #endif
360 
361 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
362 # define MAGICKCORE_MODULES_SUPPORT
363 #endif
364 
365 #if defined(_MAGICKMOD_)
366 # undef MAGICKCORE_BUILD_MODULES
367 # define MAGICKCORE_BUILD_MODULES
368 #endif
369 
370 /*
371  Magick defines.
372 */
373 #define MagickMaxRecursionDepth 600
374 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
375 #if defined(_MSC_VER)
376 # define DisableMSCWarning(nr) __pragma(warning(push)) \
377  __pragma(warning(disable:nr))
378 # define RestoreMSCWarning __pragma(warning(pop))
379 #else
380 # define DisableMSCWarning(nr)
381 # define RestoreMSCWarning
382 #endif
383 
384 #if defined(__cplusplus) || defined(c_plusplus)
385 }
386 #endif
387 
388 #endif