2 Copyright 1999-2011 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 MagickWand private application programming interface declarations.
18 #ifndef _MAGICKWAND_STUDIO_H
19 #define _MAGICKWAND_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 MAGICKWAND_IMPLEMENTATION 1
33 #if !defined(_MAGICKWAND_CONFIG_H)
34 # define _MAGICKWAND_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)
61 #if defined(__BORLANDC__) && defined(_DLL)
62 # pragma message("BCBMagick lib DLL export interface")
67 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
69 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
72 # if defined(_MAGICKDLL_)
73 # if defined(_VISUALC_)
74 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
76 # if !defined(_MAGICKLIB_)
77 # if defined(__GNUC__)
78 # define WandExport __attribute__ ((dllimport))
80 # define WandExport __declspec(dllimport)
82 # if defined(_VISUALC_)
83 # pragma message( "MagickWand lib DLL import interface" )
86 # if defined(__GNUC__)
87 # define WandExport __attribute__ ((dllexport))
89 # define WandExport __declspec(dllexport)
91 # if defined(_VISUALC_)
92 # pragma message( "MagickWand lib DLL export interface" )
97 # if defined(_VISUALC_)
98 # pragma message( "MagickWand lib static interface" )
102 # if defined(_DLL) && !defined(_LIB)
103 # define ModuleExport __declspec(dllexport)
104 # if defined(_VISUALC_)
105 # pragma message( "MagickWand module DLL export interface" )
108 # define ModuleExport
109 # if defined(_VISUALC_)
110 # pragma message( "MagickWand module static interface" )
114 # define WandGlobal __declspec(thread)
115 # if defined(_VISUALC_)
116 # pragma warning(disable : 4018)
117 # pragma warning(disable : 4068)
118 # pragma warning(disable : 4244)
119 # pragma warning(disable : 4142)
120 # pragma warning(disable : 4800)
121 # pragma warning(disable : 4786)
122 # pragma warning(disable : 4996)
126 # define WandExport __attribute__ ((visibility ("default")))
127 # define WandPrivate __attribute__ ((visibility ("hidden")))
135 #if defined(__cplusplus) || defined(c_plusplus)
136 # define storage_class c_class
138 # define storage_class class
141 #define WandSignature 0xabacadabUL
142 #if !defined(MaxTextExtent)
143 # define MaxTextExtent 4096
148 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
149 # include <sys/stat.h>
151 #if defined(MAGICKCORE_STDC_HEADERS)
155 # if defined(MAGICKCORE_HAVE_STDLIB_H)
159 #if defined(MAGICKCORE_HAVE_STRING_H)
160 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
165 #if defined(MAGICKCORE_HAVE_STRINGS_H)
166 # include <strings.h>
168 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
169 # include <inttypes.h>
171 #if defined(MAGICKCORE_HAVE_STDINT_H)
174 #if defined(MAGICKCORE_HAVE_UNISTD_H)
177 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
178 #define _CRTDBG_MAP_ALLOC
180 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
182 # if !defined(MAGICKCORE_HAVE_STRERROR)
183 # define HAVE_STRERROR
187 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
188 #define _CRTDBG_MAP_ALLOC
190 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
192 # if !defined(MAGICKCORE_HAVE_STRERROR)
193 # define HAVE_STRERROR
207 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
208 # include <xlocale.h>
210 #if defined(MAGICKCORE_THREAD_SUPPORT)
211 # include <pthread.h>
212 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
213 # define MAGICKCORE_HAVE_WINTHREADS 1
216 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
217 # include <sys/syslimits.h>
219 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
220 # include <arm/limits.h>
223 #if defined(MAGICKCORE__OPENCL)
224 #if defined(MAGICKCORE_HAVE_CL_CL_H)
227 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
228 # include <OpenCL/cl.h>
230 # define MAGICKCORE_OPENCL_SUPPORT 1
233 #if defined(_OPENMP) && (_OPENMP >= 200203)
235 # define MAGICKCORE_OPENMP_SUPPORT 1
238 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
239 ssize_t pread(int,void *,size_t,off_t);
242 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
243 ssize_t pwrite(int,const void *,size_t,off_t);
246 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
247 extern size_t strlcpy(char *,const char *,size_t);
250 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
251 extern int vsnprintf(char *,size_t,const char *,va_list);
254 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
255 # define wand_aligned(x) __attribute__((aligned(x)))
256 # define wand_attribute __attribute__
257 # define wand_unused(x) wand_unused_ ## x __attribute__((unused))
259 # define wand_aligned(x) /* nothing */
260 # define wand_attribute(x) /* nothing */
261 # define wand_unused(x) x
264 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
265 # include <sys/types.h>
266 # include <sys/stat.h>
267 # if defined(MAGICKCORE_HAVE_FTIME)
268 # include <sys/timeb.h>
270 # if defined(MAGICKCORE_POSIX_SUPPORT)
271 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
272 # define dirent direct
273 # define NAMLEN(dirent) (dirent)->d_namlen
274 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
275 # include <sys/ndir.h>
277 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
278 # include <sys/dir.h>
280 # if defined(MAGICKCORE_HAVE_NDIR_H)
285 # define NAMLEN(dirent) strlen((dirent)->d_name)
287 # include <sys/wait.h>
290 # if !defined(S_ISDIR)
291 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
293 # if !defined(S_ISREG)
294 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
296 # include "MagickWand/MagickWand.h"
297 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
298 # include <sys/time.h>
299 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
300 # include <sys/times.h>
302 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
303 # include <sys/resource.h>
309 # if defined(macintosh)
310 # if !defined(DISABLE_SIOUX)
312 # include <console.h>
316 # include "MagickWand/MagickWand.h"
319 #if defined(S_IRUSR) && defined(S_IWUSR)
320 # define S_MODE (S_IRUSR | S_IWUSR)
321 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
322 # define S_MODE (_S_IREAD | _S_IWRITE)
327 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
328 # include "MagickCore/nt-base.h"
330 #if defined(macintosh)
331 # include "MagickCore/mac.h"
334 # include "MagickCore/vms.h"
344 Review these platform specific definitions.
346 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
347 # define DirectorySeparator "/"
348 # define DirectoryListSeparator ':'
349 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
351 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
352 # define X11_PREFERENCES_PATH "~/."
353 # define ProcessPendingEvents(text)
354 # define ReadCommandlLine(argc,argv)
355 # define SetNotifyHandlers
358 # define X11_APPLICATION_PATH "decw$system_defaults:"
359 # define DirectorySeparator ""
360 # define DirectoryListSeparator ';'
361 # define EditorOptions ""
363 # define IsBasenameSeparator(c) \
364 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
365 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
366 # define MAGICKCORE_CODER_PATH "sys$login:"
367 # define MAGICKCORE_FILTER_PATH "sys$login:"
368 # define MAGICKCORE_SHARE_PATH "sys$login:"
369 # define X11_PREFERENCES_PATH "decw$user_defaults:"
370 # define ProcessPendingEvents(text)
371 # define ReadCommandlLine(argc,argv)
372 # define SetNotifyHandlers
374 # if defined(__OS2__)
375 # define DirectorySeparator "\\"
376 # define DirectoryListSeparator ';'
377 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
379 # define IsBasenameSeparator(c) \
380 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
381 # define PreferencesDefaults "~\."
382 # define ProcessPendingEvents(text)
383 # define ReadCommandlLine(argc,argv)
384 # define SetNotifyHandlers
386 # if defined(macintosh)
387 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
388 # define DirectorySeparator ":"
389 # define DirectoryListSeparator ';'
390 # define EditorOptions ""
391 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
392 # define MAGICKCORE_LIBRARY_PATH ""
393 # define MAGICKCORE_CODER_PATH ""
394 # define MAGICKCORE_FILTER_PATH ""
395 # define MAGICKCORE_SHARE_PATH ""
396 # define X11_PREFERENCES_PATH "~/."
397 # if defined(DISABLE_SIOUX)
398 # define ReadCommandlLine(argc,argv)
399 # define SetNotifyHandlers \
400 SetFatalErrorHandler(MacFatalErrorHandler); \
401 SetErrorHandler(MACErrorHandler); \
402 SetWarningHandler(MACWarningHandler)
404 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
405 # define SetNotifyHandlers \
406 SetErrorHandler(MACErrorHandler); \
407 SetWarningHandler(MACWarningHandler)
410 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
411 # define DirectorySeparator "\\"
412 # define DirectoryListSeparator ';'
413 # define EditorOptions ""
414 # define IsBasenameSeparator(c) \
415 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
416 # define ProcessPendingEvents(text)
417 # if !defined(X11_PREFERENCES_PATH)
418 # define X11_PREFERENCES_PATH "~\\."
420 # define ReadCommandlLine(argc,argv)
421 # define SetNotifyHandlers \
422 SetErrorHandler(NTErrorHandler); \
423 SetWarningHandler(NTWarningHandler)
425 # define sleep(seconds) Sleep(seconds*1000)
426 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
427 # define HAVE_TIFFCONF_H
434 Define system symbols if not already defined.
436 #if !defined(STDIN_FILENO)
437 #define STDIN_FILENO 0x00
440 #if !defined(O_BINARY)
441 #define O_BINARY 0x00
444 #if !defined(PATH_MAX)
445 #define PATH_MAX 4096
451 #define ThrowWandFatalException(severity,tag,context) \
456 exception=AcquireExceptionInfo(); \
457 (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
459 CatchException(exception); \
460 exception=DestroyExceptionInfo(exception); \
463 #if defined(__cplusplus) || defined(c_plusplus)