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