2 Copyright 1999-2012 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 http://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 # if !defined(vms) && !defined(macintosh)
36 # include "MagickCore/magick-config.h"
38 # include "magick-config.h"
40 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
41 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
43 #if defined(_magickcore_const) && !defined(const)
44 # define const _magickcore_const
46 #if defined(_magickcore_inline) && !defined(inline)
47 # define inline _magickcore_inline
49 #if defined(_magickcore_restrict) && !defined(restrict)
50 # define restrict _magickcore_restrict
52 # if defined(__cplusplus) || defined(c_plusplus)
57 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
58 # include "MagickCore/methods.h"
65 #if defined(__BORLANDC__) && defined(_DLL)
66 # pragma message("BCBMagick lib DLL export interface")
69 # define MAGICKCORE_MODULES_SUPPORT
70 # undef MAGICKCORE_BUILD_MODULES
73 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
74 # define MagickPrivate
75 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
78 # if defined(_MAGICKDLL_)
79 # if defined(_VISUALC_)
80 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
82 # if !defined(_MAGICKLIB_)
83 # if defined(__GNUC__)
84 # define MagickExport __attribute__ ((dllimport))
86 # define MagickExport __declspec(dllimport)
88 # if defined(_VISUALC_)
89 # pragma message( "MagickCore lib DLL import interface" )
92 # if defined(__GNUC__)
93 # define MagickExport __attribute__ ((dllexport))
95 # define MagickExport __declspec(dllexport)
97 # if defined(_VISUALC_)
98 # pragma message( "MagickCore lib DLL export interface" )
102 # define MagickExport
103 # if defined(_VISUALC_)
104 # pragma message( "MagickCore lib static interface" )
108 # if defined(_DLL) && !defined(_LIB)
109 # if defined(__GNUC__)
110 # define ModuleExport __attribute__ ((dllexport))
112 # define ModuleExport __declspec(dllexport)
114 # if defined(_VISUALC_)
115 # pragma message( "MagickCore module DLL export interface" )
118 # define ModuleExport
119 # if defined(_VISUALC_)
120 # pragma message( "MagickCore module static interface" )
124 # define MagickGlobal __declspec(thread)
125 # if defined(_VISUALC_)
126 # pragma warning(disable : 4018)
127 # pragma warning(disable : 4068)
128 # pragma warning(disable : 4244)
129 # pragma warning(disable : 4142)
130 # pragma warning(disable : 4800)
131 # pragma warning(disable : 4786)
132 # pragma warning(disable : 4996)
136 # define MagickExport __attribute__ ((visibility ("default")))
137 # define MagickPrivate __attribute__ ((visibility ("hidden")))
139 # define MagickExport
140 # define MagickPrivate
142 # define ModuleExport MagickExport
143 # define MagickGlobal
146 #define MagickSignature 0xabacadabUL
147 #if !defined(MaxTextExtent)
148 # define MaxTextExtent 4096
153 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
154 # include <sys/stat.h>
156 #if defined(MAGICKCORE_STDC_HEADERS)
160 # if defined(MAGICKCORE_HAVE_STDLIB_H)
164 #if defined(MAGICKCORE_HAVE_STRING_H)
165 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
170 #if defined(MAGICKCORE_HAVE_STRINGS_H)
171 # include <strings.h>
173 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
174 # include <inttypes.h>
176 #if defined(MAGICKCORE_HAVE_STDINT_H)
179 #if defined(MAGICKCORE_HAVE_UNISTD_H)
182 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
183 #define _CRTDBG_MAP_ALLOC
185 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
187 # if !defined(MAGICKCORE_HAVE_STRERROR)
188 # define HAVE_STRERROR
202 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
203 # include <xlocale.h>
205 #if defined(MAGICKCORE_THREAD_SUPPORT)
206 # include <pthread.h>
207 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
208 # define MAGICKCORE_HAVE_WINTHREADS 1
211 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
212 # include <sys/syslimits.h>
214 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
215 # include <arm/limits.h>
218 #if defined(MAGICKCORE__OPENCL)
219 #if defined(MAGICKCORE_HAVE_CL_CL_H)
222 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
223 # include <OpenCL/cl.h>
225 # define MAGICKCORE_OPENCL_SUPPORT 1
228 #if defined(_OPENMP) && (_OPENMP >= 200203)
230 # define MAGICKCORE_OPENMP_SUPPORT 1
233 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
234 ssize_t pread(int,void *,size_t,off_t);
237 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
238 ssize_t pwrite(int,const void *,size_t,off_t);
241 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
242 extern size_t strlcpy(char *,const char *,size_t);
245 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
246 extern int vsnprintf(char *,size_t,const char *,va_list);
249 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
250 # define magick_aligned(x) __attribute__((aligned(x)))
251 # define magick_attribute __attribute__
252 # define magick_unused(x) magick_unused_ ## x __attribute__((unused))
254 # define magick_aligned(x) /* nothing */
255 # define magick_attribute(x) /* nothing */
256 # define magick_unused(x) x
259 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
260 # include <sys/types.h>
261 # include <sys/stat.h>
262 # if defined(MAGICKCORE_HAVE_FTIME)
263 # include <sys/timeb.h>
265 # if defined(MAGICKCORE_POSIX_SUPPORT)
266 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
267 # define dirent direct
268 # define NAMLEN(dirent) (dirent)->d_namlen
269 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
270 # include <sys/ndir.h>
272 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
273 # include <sys/dir.h>
275 # if defined(MAGICKCORE_HAVE_NDIR_H)
280 # define NAMLEN(dirent) strlen((dirent)->d_name)
282 # include <sys/wait.h>
285 # if !defined(S_ISDIR)
286 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
288 # if !defined(S_ISREG)
289 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
291 # include "MagickCore/magick-type.h"
292 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
293 # include <sys/time.h>
294 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
295 # include <sys/times.h>
297 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
298 # include <sys/resource.h>
304 # if defined(macintosh)
305 # if !defined(DISABLE_SIOUX)
307 # include <console.h>
311 # include "MagickCore/magick-type.h"
314 #if defined(S_IRUSR) && defined(S_IWUSR)
315 # define S_MODE (S_IRUSR | S_IWUSR)
316 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
317 # define S_MODE (_S_IREAD | _S_IWRITE)
322 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
323 # include "MagickCore/nt-base.h"
325 #if defined(macintosh)
326 # include "MagickCore/mac.h"
329 # include "MagickCore/vms.h"
339 Review these platform specific definitions.
341 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
342 # define DirectorySeparator "/"
343 # define DirectoryListSeparator ':'
344 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
346 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
347 # define X11_PREFERENCES_PATH "~/."
348 # define ProcessPendingEvents(text)
349 # define ReadCommandlLine(argc,argv)
350 # define SetNotifyHandlers
353 # define X11_APPLICATION_PATH "decw$system_defaults:"
354 # define DirectorySeparator ""
355 # define DirectoryListSeparator ';'
356 # define EditorOptions ""
358 # define IsBasenameSeparator(c) \
359 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
360 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
361 # define MAGICKCORE_CODER_PATH "sys$login:"
362 # define MAGICKCORE_FILTER_PATH "sys$login:"
363 # define MAGICKCORE_SHARE_PATH "sys$login:"
364 # define X11_PREFERENCES_PATH "decw$user_defaults:"
365 # define ProcessPendingEvents(text)
366 # define ReadCommandlLine(argc,argv)
367 # define SetNotifyHandlers
369 # if defined(__OS2__)
370 # define DirectorySeparator "\\"
371 # define DirectoryListSeparator ';'
372 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
374 # define IsBasenameSeparator(c) \
375 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
376 # define PreferencesDefaults "~\."
377 # define ProcessPendingEvents(text)
378 # define ReadCommandlLine(argc,argv)
379 # define SetNotifyHandlers
381 # if defined(macintosh)
382 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
383 # define DirectorySeparator ":"
384 # define DirectoryListSeparator ';'
385 # define EditorOptions ""
386 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
387 # define MAGICKCORE_LIBRARY_PATH ""
388 # define MAGICKCORE_CODER_PATH ""
389 # define MAGICKCORE_FILTER_PATH ""
390 # define MAGICKCORE_SHARE_PATH ""
391 # define X11_PREFERENCES_PATH "~/."
392 # if defined(DISABLE_SIOUX)
393 # define ReadCommandlLine(argc,argv)
394 # define SetNotifyHandlers \
395 SetFatalErrorHandler(MacFatalErrorHandler); \
396 SetErrorHandler(MACErrorHandler); \
397 SetWarningHandler(MACWarningHandler)
399 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
400 # define SetNotifyHandlers \
401 SetErrorHandler(MACErrorHandler); \
402 SetWarningHandler(MACWarningHandler)
405 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
406 # define DirectorySeparator "\\"
407 # define DirectoryListSeparator ';'
408 # define EditorOptions ""
409 # define IsBasenameSeparator(c) \
410 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
411 # define ProcessPendingEvents(text)
412 # if !defined(X11_PREFERENCES_PATH)
413 # define X11_PREFERENCES_PATH "~\\."
415 # define ReadCommandlLine(argc,argv)
416 # define SetNotifyHandlers \
417 SetErrorHandler(NTErrorHandler); \
418 SetWarningHandler(NTWarningHandler)
420 # define sleep(seconds) Sleep(seconds*1000)
421 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
422 # define HAVE_TIFFCONF_H
429 Define system symbols if not already defined.
431 #if !defined(STDIN_FILENO)
432 #define STDIN_FILENO 0x00
435 #if !defined(O_BINARY)
436 #define O_BINARY 0x00
439 #if !defined(PATH_MAX)
440 #define PATH_MAX 4096
443 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
444 # define MAGICKCORE_MODULES_SUPPORT
447 #if defined(_MAGICKMOD_)
448 # undef MAGICKCORE_BUILD_MODULES
449 # define MAGICKCORE_BUILD_MODULES
455 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
457 #if defined(__cplusplus) || defined(c_plusplus)