MagickCore  6.9.9
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 <direct.h>
105 # include <io.h>
106 # if !defined(MAGICKCORE_HAVE_STRERROR)
107 # define HAVE_STRERROR
108 # endif
109 #endif
110 
111 #include <ctype.h>
112 #include <locale.h>
113 #include <errno.h>
114 #include <fcntl.h>
115 #include <math.h>
116 #include <time.h>
117 #include <limits.h>
118 #include <signal.h>
119 #include <assert.h>
120 
121 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
122 # include <xlocale.h>
123 #endif
124 #if defined(MAGICKCORE_THREAD_SUPPORT)
125 # include <pthread.h>
126 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
127 #include <winsock2.h>
128 #include <ws2tcpip.h>
129 #include <windows.h>
130 #pragma comment (lib, "ws2_32.lib")
131 #endif
132 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
133 # include <sys/syslimits.h>
134 #endif
135 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
136 # include <arm/limits.h>
137 #endif
138 
139 #if defined(MAGICKCORE__OPENCL) && !defined(MAGICK_PIXEL_RGBA)
140 #if defined(MAGICKCORE_HAVE_CL_CL_H)
141 # include <CL/cl.h>
142 #endif
143 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
144 # include <OpenCL/cl.h>
145 #endif
146 # define MAGICKCORE_OPENCL_SUPPORT 1
147 #endif
148 
149 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
150 # include <omp.h>
151 # define MAGICKCORE_OPENMP_SUPPORT 1
152 #endif
153 
154 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
155 ssize_t pread(int,void *,size_t,off_t);
156 #endif
157 
158 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
159 ssize_t pwrite(int,const void *,size_t,off_t);
160 #endif
161 
162 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
163 extern size_t strlcpy(char *,const char *,size_t);
164 #endif
165 
166 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
167 extern int vsnprintf(char *,size_t,const char *,va_list);
168 #endif
169 
170 #include "magick/method-attribute.h"
171 
172 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
173 # include <sys/types.h>
174 # include <sys/stat.h>
175 # if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
176 # include <sys/timeb.h>
177 # endif
178 # if defined(MAGICKCORE_POSIX_SUPPORT)
179 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
180 # define dirent direct
181 # define NAMLEN(dirent) (dirent)->d_namlen
182 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
183 # include <sys/ndir.h>
184 # endif
185 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
186 # include <sys/dir.h>
187 # endif
188 # if defined(MAGICKCORE_HAVE_NDIR_H)
189 # include <ndir.h>
190 # endif
191 # else
192 # include <dirent.h>
193 # define NAMLEN(dirent) strlen((dirent)->d_name)
194 # endif
195 # include <sys/wait.h>
196 # include <pwd.h>
197 # endif
198 # if !defined(S_ISDIR)
199 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
200 # endif
201 # if !defined(S_ISREG)
202 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
203 # endif
204 # include "magick/magick-type.h"
205 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
206 # include <sys/time.h>
207 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
208 # include <sys/times.h>
209 # endif
210 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
211 # include <sys/resource.h>
212 # endif
213 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
214 # include <sys/mman.h>
215 # endif
216 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
217 # include <sys/sendfile.h>
218 # endif
219 #endif
220 #else
221 # include <types.h>
222 # include <stat.h>
223 # if defined(macintosh)
224 # if !defined(DISABLE_SIOUX)
225 # include <SIOUX.h>
226 # include <console.h>
227 # endif
228 # include <unix.h>
229 # endif
230 # include "magick/magick-type.h"
231 #endif
232 
233 #if defined(S_IRUSR) && defined(S_IWUSR)
234 # define S_MODE (S_IRUSR | S_IWUSR)
235 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
236 # define S_MODE (_S_IREAD | _S_IWRITE)
237 #else
238 # define S_MODE 0600
239 #endif
240 
241 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
242 # include "magick/nt-base.h"
243 #endif
244 #if defined(macintosh)
245 # include "magick/mac.h"
246 #endif
247 #if defined(vms)
248 # include "magick/vms.h"
249 #endif
250 
251 #undef HAVE_CONFIG_H
252 #undef gamma
253 #undef index
254 #undef pipe
255 #undef y1
256 
257 /*
258  Review these platform specific definitions.
259 */
260 #if ( defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__) ) && !defined( __VMS )
261 # define DirectorySeparator "/"
262 # define DirectoryListSeparator ':'
263 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
264 # define Exit exit
265 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
266 # define X11_PREFERENCES_PATH "~/."
267 # define ProcessPendingEvents(text)
268 # define ReadCommandlLine(argc,argv)
269 # define SetNotifyHandlers
270 #else
271 # if defined(vms)
272 # define X11_APPLICATION_PATH "decw$system_defaults:"
273 # define DirectorySeparator ""
274 # define DirectoryListSeparator ';'
275 # define EditorOptions ""
276 # define Exit exit
277 # define IsBasenameSeparator(c) \
278  (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
279 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
280 # define MAGICKCORE_SHARE_PATH "sys$login:"
281 # define X11_PREFERENCES_PATH "decw$user_defaults:"
282 # define ProcessPendingEvents(text)
283 # define ReadCommandlLine(argc,argv)
284 # define SetNotifyHandlers
285 # endif
286 # if defined(__OS2__)
287 # define DirectorySeparator "\\"
288 # define DirectoryListSeparator ';'
289 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
290 # define Exit exit
291 # define IsBasenameSeparator(c) \
292  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
293 # define PreferencesDefaults "~\."
294 # define ProcessPendingEvents(text)
295 # define ReadCommandlLine(argc,argv)
296 # define SetNotifyHandlers
297 #endif
298 # if defined(macintosh)
299 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
300 # define DirectorySeparator ":"
301 # define DirectoryListSeparator ';'
302 # define EditorOptions ""
303 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
304 # define MAGICKCORE_LIBRARY_PATH ""
305 # define MAGICKCORE_SHARE_PATH ""
306 # define X11_PREFERENCES_PATH "~/."
307 # if defined(DISABLE_SIOUX)
308 # define ReadCommandlLine(argc,argv)
309 # define SetNotifyHandlers \
310  SetFatalErrorHandler(MacFatalErrorHandler); \
311  SetErrorHandler(MACErrorHandler); \
312  SetWarningHandler(MACWarningHandler)
313 # else
314 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
315 # define SetNotifyHandlers \
316  SetErrorHandler(MACErrorHandler); \
317  SetWarningHandler(MACWarningHandler)
318 # endif
319 # endif
320 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
321 # define DirectorySeparator "\\"
322 # define DirectoryListSeparator ';'
323 # define EditorOptions ""
324 # define IsBasenameSeparator(c) \
325  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
326 # define ProcessPendingEvents(text)
327 # if !defined(X11_PREFERENCES_PATH)
328 # define X11_PREFERENCES_PATH "~\\."
329 # endif
330 # define ReadCommandlLine(argc,argv)
331 # define SetNotifyHandlers \
332  SetErrorHandler(NTErrorHandler); \
333  SetWarningHandler(NTWarningHandler)
334 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
335 # define HAVE_TIFFCONF_H
336 # endif
337 # endif
338 
339 #endif
340 
341 /*
342  Define system symbols if not already defined.
343 */
344 #if !defined(STDIN_FILENO)
345 #define STDIN_FILENO 0x00
346 #endif
347 
348 #if !defined(O_BINARY)
349 #define O_BINARY 0x00
350 #endif
351 
352 #if !defined(PATH_MAX)
353 #define PATH_MAX 4096
354 #endif
355 
356 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
357 # define MAGICKCORE_MODULES_SUPPORT
358 #endif
359 
360 #if defined(_MAGICKMOD_)
361 # undef MAGICKCORE_BUILD_MODULES
362 # define MAGICKCORE_BUILD_MODULES
363 #endif
364 
365 /*
366  Magick defines.
367 */
368 #define MagickMaxRecursionDepth 1024
369 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
370 #if defined(_MSC_VER)
371 # define DisableMSCWarning(nr) __pragma(warning(push)) \
372  __pragma(warning(disable:nr))
373 # define RestoreMSCWarning __pragma(warning(pop))
374 #else
375 # define DisableMSCWarning(nr)
376 # define RestoreMSCWarning
377 #endif
378 
379 #if defined(__cplusplus) || defined(c_plusplus)
380 }
381 #endif
382 
383 #endif