2 Copyright 1999-2010 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 "magick/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(__cplusplus) || defined(c_plusplus)
52 #if defined(_magickcore_restrict) && !defined(restrict)
53 # define restrict _magickcore_restrict
61 #if defined(__BORLANDC__) && defined(_DLL)
62 # pragma message("BCBMagick lib DLL export interface")
67 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
68 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
71 # if defined(_MAGICKDLL_)
72 # if defined(_VISUALC_)
73 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
75 # if !defined(_MAGICKLIB_)
76 # define WandExport __declspec(dllimport)
77 # if defined(_VISUALC_)
78 # pragma message( "MagickWand lib DLL import interface" )
81 # define WandExport __declspec(dllexport)
82 # if defined(_VISUALC_)
83 # pragma message( "MagickWand lib DLL export interface" )
88 # if defined(_VISUALC_)
89 # pragma message( "MagickWand lib static interface" )
93 # if defined(_DLL) && !defined(_LIB)
94 # define ModuleExport __declspec(dllexport)
95 # if defined(_VISUALC_)
96 # pragma message( "MagickWand module DLL export interface" )
100 # if defined(_VISUALC_)
101 # pragma message( "MagickWand module static interface" )
105 # define WandGlobal __declspec(thread)
106 # if defined(_VISUALC_)
107 # pragma warning(disable : 4018)
108 # pragma warning(disable : 4068)
109 # pragma warning(disable : 4244)
110 # pragma warning(disable : 4142)
111 # pragma warning(disable : 4800)
112 # pragma warning(disable : 4786)
113 # pragma warning(disable : 4996)
117 # define ModuleExport
121 #if defined(__cplusplus) || defined(c_plusplus)
122 # define storage_class c_class
124 # define storage_class class
127 #define WandSignature 0xabacadabUL
128 #if !defined(MaxTextExtent)
129 # define MaxTextExtent 4096
134 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
135 # include <sys/stat.h>
137 #if defined(MAGICKCORE_STDC_HEADERS)
141 # if defined(MAGICKCORE_HAVE_STDLIB_H)
145 #if defined(MAGICKCORE_HAVE_STRING_H)
146 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
151 #if defined(MAGICKCORE_HAVE_STRINGS_H)
152 # include <strings.h>
154 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
155 # include <inttypes.h>
157 #if defined(MAGICKCORE_HAVE_STDINT_H)
160 #if defined(MAGICKCORE_HAVE_UNISTD_H)
163 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
164 #define _CRTDBG_MAP_ALLOC
166 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
168 # if !defined(MAGICKCORE_HAVE_STRERROR)
169 # define HAVE_STRERROR
173 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
174 #define _CRTDBG_MAP_ALLOC
176 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
178 # if !defined(MAGICKCORE_HAVE_STRERROR)
179 # define HAVE_STRERROR
193 #if defined(MAGICKCORE_THREAD_SUPPORT)
194 # include <pthread.h>
195 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
196 # define MAGICKCORE_HAVE_WINTHREADS 1
199 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
200 # include <sys/syslimits.h>
202 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
203 # include <arm/limits.h>
206 #if defined(MAGICKCORE__OPENCL)
207 #if defined(MAGICKCORE_HAVE_CL_CL_H)
210 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
211 # include <OpenCL/cl.h>
213 # define MAGICKCORE_OPENCL_SUPPORT 1
216 #if defined(_OPENMP) && (_OPENMP >= 200203)
218 # define MAGICKCORE_OPENMP_SUPPORT 1
221 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
222 ssize_t pread(int,void *,size_t,off_t);
225 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
226 ssize_t pwrite(int,const void *,size_t,off_t);
229 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
230 extern size_t strlcpy(char *,const char *,size_t);
233 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
234 extern int vsnprintf(char *,size_t,const char *,va_list);
237 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
238 # define wand_aligned(x) __attribute__((aligned(x)))
239 # define wand_attribute __attribute__
240 # define wand_unused(x) wand_unused_ ## x __attribute__((unused))
242 # define wand_aligned(x) /* nothing */
243 # define wand_attribute(x) /* nothing */
244 # define wand_unused(x) x
247 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
248 # include <sys/types.h>
249 # include <sys/stat.h>
250 # if defined(MAGICKCORE_HAVE_FTIME)
251 # include <sys/timeb.h>
253 # if defined(MAGICKCORE_POSIX_SUPPORT)
254 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
255 # define dirent direct
256 # define NAMLEN(dirent) (dirent)->d_namlen
257 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
258 # include <sys/ndir.h>
260 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
261 # include <sys/dir.h>
263 # if defined(MAGICKCORE_HAVE_NDIR_H)
268 # define NAMLEN(dirent) strlen((dirent)->d_name)
270 # include <sys/wait.h>
273 # if !defined(S_ISDIR)
274 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
276 # if !defined(S_ISREG)
277 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
279 # include "wand/MagickWand.h"
280 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
281 # include <sys/time.h>
282 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
283 # include <sys/times.h>
285 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
286 # include <sys/resource.h>
292 # if defined(macintosh)
293 # if !defined(DISABLE_SIOUX)
295 # include <console.h>
299 # include "wand/MagickWand.h"
302 #if defined(S_IRUSR) && defined(S_IWUSR)
303 # define S_MODE (S_IRUSR | S_IWUSR)
304 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
305 # define S_MODE (_S_IREAD | _S_IWRITE)
310 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
311 # include "magick/nt-base.h"
313 #if defined(macintosh)
314 # include "magick/mac.h"
317 # include "magick/vms.h"
327 Review these platform specific definitions.
329 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
330 # define DirectorySeparator "/"
331 # define DirectoryListSeparator ':'
332 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
334 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
335 # define X11_PREFERENCES_PATH "~/."
336 # define ProcessPendingEvents(text)
337 # define ReadCommandlLine(argc,argv)
338 # define SetNotifyHandlers
341 # define X11_APPLICATION_PATH "decw$system_defaults:"
342 # define DirectorySeparator ""
343 # define DirectoryListSeparator ';'
344 # define EditorOptions ""
346 # define IsBasenameSeparator(c) \
347 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
348 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
349 # define MAGICKCORE_CODER_PATH "sys$login:"
350 # define MAGICKCORE_FILTER_PATH "sys$login:"
351 # define MAGICKCORE_SHARE_PATH "sys$login:"
352 # define X11_PREFERENCES_PATH "decw$user_defaults:"
353 # define ProcessPendingEvents(text)
354 # define ReadCommandlLine(argc,argv)
355 # define SetNotifyHandlers
357 # if defined(__OS2__)
358 # define DirectorySeparator "\\"
359 # define DirectoryListSeparator ';'
360 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
362 # define IsBasenameSeparator(c) \
363 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
364 # define PreferencesDefaults "~\."
365 # define ProcessPendingEvents(text)
366 # define ReadCommandlLine(argc,argv)
367 # define SetNotifyHandlers
369 # if defined(macintosh)
370 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
371 # define DirectorySeparator ":"
372 # define DirectoryListSeparator ';'
373 # define EditorOptions ""
374 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
375 # define MAGICKCORE_LIBRARY_PATH ""
376 # define MAGICKCORE_CODER_PATH ""
377 # define MAGICKCORE_FILTER_PATH ""
378 # define MAGICKCORE_SHARE_PATH ""
379 # define X11_PREFERENCES_PATH "~/."
380 # if defined(DISABLE_SIOUX)
381 # define ReadCommandlLine(argc,argv)
382 # define SetNotifyHandlers \
383 SetFatalErrorHandler(MacFatalErrorHandler); \
384 SetErrorHandler(MACErrorHandler); \
385 SetWarningHandler(MACWarningHandler)
387 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
388 # define SetNotifyHandlers \
389 SetErrorHandler(MACErrorHandler); \
390 SetWarningHandler(MACWarningHandler)
393 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
394 # define DirectorySeparator "\\"
395 # define DirectoryListSeparator ';'
396 # define EditorOptions ""
397 # define IsBasenameSeparator(c) \
398 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
399 # define ProcessPendingEvents(text)
400 # if !defined(X11_PREFERENCES_PATH)
401 # define X11_PREFERENCES_PATH "~\\."
403 # define ReadCommandlLine(argc,argv)
404 # define SetNotifyHandlers \
405 SetErrorHandler(NTErrorHandler); \
406 SetWarningHandler(NTWarningHandler)
408 # define sleep(seconds) Sleep(seconds*1000)
409 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
410 # define HAVE_TIFFCONF_H
417 Define system symbols if not already defined.
419 #if !defined(STDIN_FILENO)
420 #define STDIN_FILENO 0x00
423 #if !defined(O_BINARY)
424 #define O_BINARY 0x00
427 #if !defined(PATH_MAX)
428 #define PATH_MAX 4096
434 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && !defined(__BORLANDC__)
435 #define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
436 #define MagickTell(file) _telli64(file)
438 #define MagickSeek(file,offset,whence) lseek(file,offset,whence)
439 #define MagickTell(file) tell(file)
442 #define ThrowWandFatalException(severity,tag,context) \
447 exception=AcquireExceptionInfo(); \
448 (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
450 CatchException(exception); \
451 exception=DestroyExceptionInfo(exception); \
454 #if defined(__cplusplus) || defined(c_plusplus)