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/license/
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(WIN32) || defined(WIN64) || defined(_WIN32_WINNT)
22# define MAGICKCORE_WINDOWS_SUPPORT
23#else
24# define MAGICKCORE_POSIX_SUPPORT
25#endif
26
27#define MAGICKCORE_IMPLEMENTATION 1
28
29#if !defined(MAGICKCORE_CONFIG_H)
30# define MAGICKCORE_CONFIG_H
31# if !defined(vms) && !defined(macintosh)
32# include "magick/magick-config.h"
33# else
34# include "magick-config.h"
35# endif
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(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
51# include <omp.h>
52# define MAGICKCORE_OPENMP_SUPPORT 1
53#endif
54
55#if defined(__cplusplus) || defined(c_plusplus)
56extern "C" {
57#endif
58
59#if defined(MAGICKCORE_NAMESPACE_PREFIX)
60# include "magick/methods.h"
61#endif
62
63#if !defined(const)
64# define STDC
65#endif
66
67/* Define to 1 if assertions should be disabled. */
68#if defined(MAGICKCORE_NDEBUG)
69#define NDEBUG 1
70#endif
71
72#include <stdarg.h>
73#include <stdio.h>
74#if defined(MAGICKCORE_HAVE_SYS_STAT_H)
75# include <sys/stat.h>
76#endif
77#if defined(MAGICKCORE_STDC_HEADERS)
78# include <stdlib.h>
79# include <stddef.h>
80#else
81# if defined(MAGICKCORE_HAVE_STDLIB_H)
82# include <stdlib.h>
83# endif
84#endif
85#if !defined(magick_restrict)
86# if !defined(_magickcore_restrict)
87# define magick_restrict restrict
88# else
89# define magick_restrict _magickcore_restrict
90# endif
91#endif
92#if defined(MAGICKCORE_HAVE_STRING_H)
93# if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
94# include <memory.h>
95# endif
96# include <string.h>
97#endif
98#if defined(MAGICKCORE_HAVE_STRINGS_H)
99# include <strings.h>
100#endif
101#if defined(MAGICKCORE_HAVE_INTTYPES_H)
102# include <inttypes.h>
103#endif
104#if defined(MAGICKCORE_HAVE_STDINT_H)
105# include <stdint.h>
106#endif
107#if defined(MAGICKCORE_HAVE_UNISTD_H)
108# include <unistd.h>
109#endif
110#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
111#define _CRTDBG_MAP_ALLOC
112#endif
113#if defined(MAGICKCORE_WINDOWS_SUPPORT)
114# include <io.h>
115#if !defined(__CYGWIN__)
116# include <direct.h>
117#endif
118# if !defined(MAGICKCORE_HAVE_STRERROR)
119# define HAVE_STRERROR
120# endif
121#endif
122
123#include <ctype.h>
124#include <locale.h>
125#include <errno.h>
126#include <fcntl.h>
127#include <math.h>
128#include <time.h>
129#include <limits.h>
130#include <signal.h>
131#include <assert.h>
132
133#if defined(MAGICKCORE_HAVE_XLOCALE_H)
134# include <xlocale.h>
135#endif
136#if defined(MAGICKCORE_THREAD_SUPPORT)
137# include <pthread.h>
138#endif
139#if defined(MAGICKCORE_WINDOWS_SUPPORT)
140#if !defined(__CYGWIN__)
141#include <winsock2.h>
142#include <ws2tcpip.h>
143#endif
144#include <windows.h>
145#ifdef _MSC_VER
146#pragma comment (lib, "ws2_32.lib")
147#endif
148#endif
149#if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
150# include <sys/syslimits.h>
151#endif
152#if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
153# include <arm/limits.h>
154#endif
155
156#if defined(MAGICKCORE_HAVE_CL_CL_H) && !defined(MAGICK_PIXEL_RGBA)
157# define MAGICKCORE_OPENCL_SUPPORT 1
158#endif
159#if defined(MAGICKCORE_HAVE_OPENCL_CL_H) && !defined(MAGICK_PIXEL_RGBA)
160# define MAGICKCORE_OPENCL_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 (MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__)
246# define P_MODE (_S_IREAD | _S_IWRITE)
247# define S_MODE (_S_IREAD | _S_IWRITE)
248#elif defined(MAGICKCORE_POSIX_SUPPORT)
249# define P_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
250# define S_MODE (S_IRUSR | S_IWUSR)
251#else
252# define P_MODE 0666
253# define S_MODE 0600
254#endif
255
256#if defined(MAGICKCORE_WINDOWS_SUPPORT)
257# include "magick/nt-base.h"
258#endif
259#if defined(macintosh)
260# include "magick/mac.h"
261#endif
262#if defined(vms)
263# include "magick/vms.h"
264#endif
265
266#undef HAVE_CONFIG_H
267#undef gamma
268#undef index
269#undef pipe
270#undef y1
271
272/*
273 Review these platform specific definitions.
274*/
275#if ( defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__) ) && !defined( __VMS )
276# define DirectorySeparator "/"
277# define DirectoryListSeparator ':'
278# define EditorOptions " -title \"Edit Image Comment\" -e vi"
279# define Exit exit
280# define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
281# define X11_PREFERENCES_PATH "~/."
282# define ProcessPendingEvents(text)
283# define ReadCommandlLine(argc,argv)
284# define SetNotifyHandlers
285#else
286# if defined(vms)
287# define X11_APPLICATION_PATH "decw$system_defaults:"
288# define DirectorySeparator ""
289# define DirectoryListSeparator ';'
290# define EditorOptions ""
291# define Exit exit
292# define IsBasenameSeparator(c) \
293 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
294# define MAGICKCORE_LIBRARY_ABSOLUTE_PATH "sys$login:"
295# define MAGICKCORE_SHARE_PATH "sys$login:"
296# define X11_PREFERENCES_PATH "decw$user_defaults:"
297# define ProcessPendingEvents(text)
298# define ReadCommandlLine(argc,argv)
299# define SetNotifyHandlers
300# endif
301# if defined(__OS2__)
302# define DirectorySeparator "\\"
303# define DirectoryListSeparator ';'
304# define EditorOptions " -title \"Edit Image Comment\" -e vi"
305# define Exit exit
306# define IsBasenameSeparator(c) \
307 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
308# define PreferencesDefaults "~\."
309# define ProcessPendingEvents(text)
310# define ReadCommandlLine(argc,argv)
311# define SetNotifyHandlers
312#endif
313# if defined(macintosh)
314# define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
315# define DirectorySeparator ":"
316# define DirectoryListSeparator ';'
317# define EditorOptions ""
318# define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
319# define MAGICKCORE_LIBRARY_ABSOLUTE_PATH ""
320# define MAGICKCORE_SHARE_PATH ""
321# define X11_PREFERENCES_PATH "~/."
322# if defined(DISABLE_SIOUX)
323# define ReadCommandlLine(argc,argv)
324# define SetNotifyHandlers \
325 SetFatalErrorHandler(MacFatalErrorHandler); \
326 SetErrorHandler(MACErrorHandler); \
327 SetWarningHandler(MACWarningHandler)
328# else
329# define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
330# define SetNotifyHandlers \
331 SetErrorHandler(MACErrorHandler); \
332 SetWarningHandler(MACWarningHandler)
333# endif
334# endif
335# if defined(MAGICKCORE_WINDOWS_SUPPORT)
336# define DirectorySeparator "\\"
337# define DirectoryListSeparator ';'
338# define EditorOptions ""
339# define IsBasenameSeparator(c) \
340 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
341# define ProcessPendingEvents(text)
342# if !defined(X11_PREFERENCES_PATH)
343# define X11_PREFERENCES_PATH "~\\."
344# endif
345# define ReadCommandlLine(argc,argv)
346# define SetNotifyHandlers \
347 SetErrorHandler(NTErrorHandler); \
348 SetWarningHandler(NTWarningHandler)
349# if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
350# define HAVE_TIFFCONF_H
351# endif
352# endif
353
354#endif
355
356/*
357 Define system symbols if not already defined.
358*/
359#if !defined(STDIN_FILENO)
360#define STDIN_FILENO 0x00
361#endif
362
363#if !defined(O_BINARY)
364#define O_BINARY 0x00
365#endif
366
367#if !defined(PATH_MAX)
368#define PATH_MAX 4096
369#endif
370
371#if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
372# define MAGICKCORE_MODULES_SUPPORT
373#endif
374
375#if defined(_MAGICKMOD_)
376# undef MAGICKCORE_BUILD_MODULES
377# define MAGICKCORE_BUILD_MODULES
378#endif
379
380/*
381 Magick defines.
382*/
383#define MagickMaxRecursionDepth 600
384#define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
385#if defined(_MSC_VER)
386# define DisableMSCWarning(nr) __pragma(warning(push)) \
387 __pragma(warning(disable:nr))
388# define RestoreMSCWarning __pragma(warning(pop))
389#else
390# define DisableMSCWarning(nr)
391# define RestoreMSCWarning
392#endif
393
394#if defined(__cplusplus) || defined(c_plusplus)
395}
396#endif
397
398#endif