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