2 Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 https://www.imagemagick.org/script/license.php
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.
16 MagickCore private application programming interface declarations.
18 #ifndef MAGICKCORE_STUDIO_H
19 #define MAGICKCORE_STUDIO_H
21 #if defined(__cplusplus) || defined(c_plusplus)
25 #if defined(WIN32) || defined(WIN64)
26 # define MAGICKCORE_WINDOWS_SUPPORT
28 # define MAGICKCORE_POSIX_SUPPORT
31 #define MAGICKCORE_IMPLEMENTATION 1
33 #if !defined(MAGICKCORE_CONFIG_H)
34 # define MAGICKCORE_CONFIG_H
35 #include "MagickCore/magick-config.h"
36 # if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
37 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
39 #if defined(_magickcore_const) && !defined(const)
40 # define const _magickcore_const
42 #if defined(_magickcore_inline) && !defined(inline)
43 # define inline _magickcore_inline
45 # if defined(__cplusplus) || defined(c_plusplus)
50 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
51 # include "MagickCore/methods.h"
60 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
61 # include <sys/stat.h>
63 #if defined(MAGICKCORE_STDC_HEADERS)
67 # if defined(MAGICKCORE_HAVE_STDLIB_H)
71 #if !defined(magick_restrict)
72 # if !defined(_magickcore_restrict)
73 # define magick_restrict restrict
75 # define magick_restrict _magickcore_restrict
78 #if defined(MAGICKCORE_HAVE_STRING_H)
79 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
84 #if defined(MAGICKCORE_HAVE_STRINGS_H)
87 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
88 # include <inttypes.h>
90 #if defined(MAGICKCORE_HAVE_STDINT_H)
93 #if defined(MAGICKCORE_HAVE_UNISTD_H)
96 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
97 #define _CRTDBG_MAP_ALLOC
99 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
101 #if !defined(__CYGWIN__)
104 # if !defined(MAGICKCORE_HAVE_STRERROR)
105 # define HAVE_STRERROR
119 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
120 # include <xlocale.h>
122 #if defined(MAGICKCORE_THREAD_SUPPORT)
123 # include <pthread.h>
125 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
126 #if !defined(__CYGWIN__)
127 #include <winsock2.h>
128 #include <ws2tcpip.h>
131 #pragma comment (lib, "ws2_32.lib")
133 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
134 # include <sys/syslimits.h>
136 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
137 # include <arm/limits.h>
140 #if defined(MAGICKCORE__OPENCL)
141 #if defined(MAGICKCORE_HAVE_CL_CL_H)
144 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
145 # include <OpenCL/cl.h>
147 # define MAGICKCORE_OPENCL_SUPPORT 1
150 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
152 # define MAGICKCORE_OPENMP_SUPPORT 1
155 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
156 ssize_t pread(int,void *,size_t,off_t);
159 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
160 ssize_t pwrite(int,const void *,size_t,off_t);
163 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
164 extern size_t strlcpy(char *,const char *,size_t);
167 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
168 extern int vsnprintf(char *,size_t,const char *,va_list);
171 #include "MagickCore/method-attribute.h"
173 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
174 # include <sys/types.h>
175 # include <sys/stat.h>
176 # if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
177 # include <sys/timeb.h>
179 # if defined(MAGICKCORE_POSIX_SUPPORT)
180 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
181 # define dirent direct
182 # define NAMLEN(dirent) (dirent)->d_namlen
183 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
184 # include <sys/ndir.h>
186 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
187 # include <sys/dir.h>
189 # if defined(MAGICKCORE_HAVE_NDIR_H)
194 # define NAMLEN(dirent) strlen((dirent)->d_name)
196 # include <sys/wait.h>
199 # if !defined(S_ISDIR)
200 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
202 # if !defined(S_ISREG)
203 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
205 # include "MagickCore/magick-type.h"
206 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
207 # include <sys/time.h>
208 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
209 # include <sys/times.h>
211 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
212 # include <sys/resource.h>
214 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
215 # include <sys/mman.h>
217 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
218 # include <sys/sendfile.h>
224 # if defined(macintosh)
225 # if !defined(DISABLE_SIOUX)
227 # include <console.h>
231 # include "MagickCore/magick-type.h"
234 #if defined(S_IRUSR) && defined(S_IWUSR)
235 # define S_MODE (S_IRUSR | S_IWUSR)
236 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
237 # define S_MODE (_S_IREAD | _S_IWRITE)
242 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
243 # include "MagickCore/nt-base.h"
246 # include "MagickCore/vms.h"
256 Review these platform specific definitions.
258 #if defined(MAGICKCORE_POSIX_SUPPORT) && !( defined(__OS2__) || defined( vms ) )
259 # define DirectorySeparator "/"
260 # define DirectoryListSeparator ':'
261 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
263 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
264 # define X11_PREFERENCES_PATH "~/."
265 # define ProcessPendingEvents(text)
266 # define ReadCommandlLine(argc,argv)
267 # define SetNotifyHandlers
270 # define X11_APPLICATION_PATH "decw$system_defaults:"
271 # define DirectorySeparator ""
272 # define DirectoryListSeparator ';'
273 # define EditorOptions ""
275 # define IsBasenameSeparator(c) \
276 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
277 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
278 # define MAGICKCORE_SHARE_PATH "sys$login:"
279 # define X11_PREFERENCES_PATH "decw$user_defaults:"
280 # define ProcessPendingEvents(text)
281 # define ReadCommandlLine(argc,argv)
282 # define SetNotifyHandlers
284 # if defined(__OS2__)
285 # define DirectorySeparator "\\"
286 # define DirectoryListSeparator ';'
287 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
289 # define IsBasenameSeparator(c) \
290 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
291 # define PreferencesDefaults "~\."
292 # define ProcessPendingEvents(text)
293 # define ReadCommandlLine(argc,argv)
294 # define SetNotifyHandlers
296 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
297 # define DirectorySeparator "\\"
298 # define DirectoryListSeparator ';'
299 # define EditorOptions ""
300 # define IsBasenameSeparator(c) \
301 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
302 # define ProcessPendingEvents(text)
303 # if !defined(X11_PREFERENCES_PATH)
304 # define X11_PREFERENCES_PATH "~\\."
306 # define ReadCommandlLine(argc,argv)
307 # define SetNotifyHandlers \
308 SetErrorHandler(NTErrorHandler); \
309 SetWarningHandler(NTWarningHandler)
310 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
311 # define HAVE_TIFFCONF_H
318 Define system symbols if not already defined.
320 #if !defined(STDIN_FILENO)
321 #define STDIN_FILENO 0x00
324 #if !defined(O_BINARY)
325 #define O_BINARY 0x00
328 #if !defined(PATH_MAX)
329 #define PATH_MAX 4096
332 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
333 # define MAGICKCORE_MODULES_SUPPORT
336 #if defined(_MAGICKMOD_)
337 # undef MAGICKCORE_BUILD_MODULES
338 # define MAGICKCORE_BUILD_MODULES
344 #define MagickMaxRecursionDepth 600
345 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
346 #if defined(_MSC_VER)
347 # define DisableMSCWarning(nr) __pragma(warning(push)) \
348 __pragma(warning(disable:nr))
349 # define RestoreMSCWarning __pragma(warning(pop))
351 # define DisableMSCWarning(nr)
352 # define RestoreMSCWarning
355 #if defined(__cplusplus) || defined(c_plusplus)