blob: ba9775dd5f78c9a846240bf50078e4b2c4046d68 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2 Copyright 1999-2009 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.
6 obtain a copy of the License at
7
8 http://www.imagemagick.org/script/license.php
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 MagickWand private application programming interface declarations.
17*/
18#ifndef _MAGICKWAND_STUDIO_H
19#define _MAGICKWAND_STUDIO_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#if defined(__CYGWIN32__)
26# if !defined(__CYGWIN__)
27# define __CYGWIN__ __CYGWIN32__
28# endif
29#endif
30
31#if defined(_WIN32) || defined(WIN32)
32# if !defined(__WINDOWS__)
33# if defined(_WIN32)
34# define __WINDOWS__ _WIN32
35# else
36# if defined(WIN32)
37# define __WINDOWS__ WIN32
38# endif
39# endif
40# endif
41#endif
42
43#if defined(_WIN64) || defined(WIN64)
44# if !defined(__WINDOWS__)
45# if defined(_WIN64)
46# define __WINDOWS__ _WIN64
47# else
48# if defined(WIN64)
49# define __WINDOWS__ WIN64
50# endif
51# endif
52# endif
53#endif
54
cristy3ed852e2009-09-05 21:47:34 +000055#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
56# define MAGICKCORE_POSIX_SUPPORT
57#endif
58
59#define MAGICKWAND_IMPLEMENTATION 1
60
61#if !defined(_MAGICKWAND_CONFIG_H)
62# define _MAGICKWAND_CONFIG_H
63# if !defined(vms) && !defined(macintosh)
64# include "magick/magick-config.h"
65# else
66# include "magick-config.h"
67# endif
68#if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
69# define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
70#endif
71#if defined(_magickcore_const) && !defined(const)
72# define const _magickcore_const
73#endif
74#if defined(_magickcore_inline) && !defined(inline)
75# define inline _magickcore_inline
76#endif
77# if defined(__cplusplus) || defined(c_plusplus)
78# undef inline
79# endif
80#if defined(_magickcore_restrict) && !defined(__restrict)
81# define __restrict _magickcore_restrict
82#endif
83#endif
84
85#if !defined(const)
86# define STDC
87#endif
88
89#if defined(__BORLANDC__) && defined(_DLL)
90# pragma message("BCBMagick lib DLL export interface")
91# define _MAGICKDLL_
92# define _MAGICKLIB_
93#endif
94
95#if defined(__WINDOWS__)
96# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
97# define _MAGICKDLL_
98# endif
99# if defined(_MAGICKDLL_)
100# if defined(_VISUALC_)
101# pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
102# endif
103# if !defined(_MAGICKLIB_)
104# define WandExport __declspec(dllimport)
105# if defined(_VISUALC_)
106# pragma message( "MagickWand lib DLL import interface" )
107# endif
108# else
109# define WandExport __declspec(dllexport)
110# if defined(_VISUALC_)
111# pragma message( "MagickWand lib DLL export interface" )
112# endif
113# endif
114# else
115# define WandExport
116# if defined(_VISUALC_)
117# pragma message( "MagickWand lib static interface" )
118# endif
119# endif
120
121# if defined(_DLL) && !defined(_LIB)
122# define ModuleExport __declspec(dllexport)
123# if defined(_VISUALC_)
124# pragma message( "MagickWand module DLL export interface" )
125# endif
126# else
127# define ModuleExport
128# if defined(_VISUALC_)
129# pragma message( "MagickWand module static interface" )
130# endif
131
132# endif
133# define WandGlobal __declspec(thread)
134# if defined(_VISUALC_)
135# pragma warning(disable : 4018)
136# pragma warning(disable : 4068)
137# pragma warning(disable : 4244)
138# pragma warning(disable : 4142)
139# pragma warning(disable : 4800)
140# pragma warning(disable : 4786)
141# pragma warning(disable : 4996)
142# endif
143#else
144# define WandExport
145# define ModuleExport
146# define WandGlobal
147#endif
148
149#if defined(__cplusplus) || defined(c_plusplus)
150# define storage_class c_class
151#else
152# define storage_class class
153#endif
154
155#define WandSignature 0xabacadabUL
156#if !defined(MaxTextExtent)
157# define MaxTextExtent 4096
158#endif
159
160#include <stdarg.h>
161#include <stdio.h>
162#if defined(__WINDOWS__) && defined(_DEBUG)
163#define _CRTDBG_MAP_ALLOC
164#endif
165#include <stdlib.h>
166#if !defined(__WINDOWS__)
167# include <unistd.h>
168#else
169# include <direct.h>
170# if !defined(MAGICKCORE_HAVE_STRERROR)
171# define HAVE_STRERROR
172# endif
173#endif
174
175#if defined(MAGICKCORE_HAVE_STRINGS_H)
176# include <strings.h>
177#endif
178#include <string.h>
179#include <ctype.h>
180#include <locale.h>
181#include <errno.h>
182#include <fcntl.h>
183#include <math.h>
184#include <time.h>
185#include <limits.h>
186#include <signal.h>
187#include <assert.h>
188
189#if defined(MAGICKCORE_HAVE_PTHREAD)
190# include <pthread.h>
191#elif defined(__WINDOWS__)
cristyfe092d82009-10-11 04:00:45 +0000192# define MAGICKCORE_HAVE_WINTHREADS 1
cristy3ed852e2009-09-05 21:47:34 +0000193#include <windows.h>
194#endif
195#if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
196# include <sys/syslimits.h>
197#endif
198#if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
199# include <arm/limits.h>
200#endif
201
cristy07425aa2009-09-20 22:59:24 +0000202#if defined(HAVE_CL_CL_H)
203# include <CL/cl.h>
204# define MAGICKCORE_OPENCL_SUPPORT 1
205#endif
206
207#if defined(HAVE_OPENCL_CL_H)
208# include <OpenCL/cl.h>
209# define MAGICKCORE_OPENCL_SUPPORT 1
210#endif
211
cristy3ed852e2009-09-05 21:47:34 +0000212#if defined(_OPENMP) && (_OPENMP >= 200203)
213# include <omp.h>
cristyb28d6472009-10-17 20:13:35 +0000214# define MAGICKCORE_OPENMP_SUPPORT 1
cristy3ed852e2009-09-05 21:47:34 +0000215#endif
216
217#if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
218ssize_t pread(int,void *,size_t,off_t);
219#endif
220
221#if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
222ssize_t pwrite(int,const void *,size_t,off_t);
223#endif
224
225#if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
226extern size_t strlcpy(char *,const char *,size_t);
227#endif
228
229#if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
230extern int vsnprintf(char *,size_t,const char *,va_list);
231#endif
232
233#if !defined(wand_attribute)
234# if !defined(__GNUC__)
235# define wand_attribute(x) /* nothing */
236# else
237# define wand_attribute __attribute__
238# endif
239#endif
240
241#if !defined(wand_unused)
242# if defined(__GNUC__)
243# define wand_unused(x) wand_unused_ ## x __attribute__((unused))
244# elif defined(__LCLINT__)
245# define wand_unused(x) /*@unused@*/ x
246# else
247# define wand_unused(x) x
248# endif
249#endif
250
251#if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
252# include <sys/types.h>
253# include <sys/stat.h>
254# if defined(MAGICKCORE_HAVE_FTIME)
255# include <sys/timeb.h>
256# endif
257# if defined(MAGICKCORE_POSIX_SUPPORT)
258# if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
259# define dirent direct
260# define NAMLEN(dirent) (dirent)->d_namlen
261# if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
262# include <sys/ndir.h>
263# endif
264# if defined(MAGICKCORE_HAVE_SYS_DIR_H)
265# include <sys/dir.h>
266# endif
267# if defined(MAGICKCORE_HAVE_NDIR_H)
268# include <ndir.h>
269# endif
270# else
271# include <dirent.h>
272# define NAMLEN(dirent) strlen((dirent)->d_name)
273# endif
274# include <sys/wait.h>
275# include <pwd.h>
276# endif
277# if !defined(S_ISDIR)
278# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
279# endif
280# if !defined(S_ISREG)
281# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
282# endif
283# include "wand/MagickWand.h"
284# if !defined(__WINDOWS__)
285# include <sys/time.h>
286# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
287# include <sys/times.h>
288# endif
289# if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
290# include <sys/resource.h>
291# endif
292#endif
293#else
294# include <types.h>
295# include <stat.h>
296# if defined(macintosh)
297# if !defined(DISABLE_SIOUX)
298# include <SIOUX.h>
299# include <console.h>
300# endif
301# include <unix.h>
302# endif
303# include "wand/MagickWand.h"
304#endif
305
306#if defined(S_IRUSR) && defined(S_IWUSR)
307# define S_MODE (S_IRUSR | S_IWUSR)
308#elif defined (__WINDOWS__)
309# define S_MODE (_S_IREAD | _S_IWRITE)
310#else
311# define S_MODE 0600
312#endif
313
314#if defined(__WINDOWS__)
315# include "magick/nt-base.h"
316#endif
317#if defined(macintosh)
318# include "magick/mac.h"
319#endif
320#if defined(vms)
321# include "magick/vms.h"
322#endif
323
324#undef HAVE_CONFIG_H
325#undef gamma
326#undef index
327#undef pipe
328#undef y1
329
330/*
331 Review these platform specific definitions.
332*/
333#if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
334# define DirectorySeparator "/"
335# define DirectoryListSeparator ':'
336# define EditorOptions " -title \"Edit Image Comment\" -e vi"
337# define Exit exit
338# define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
339# define X11_PREFERENCES_PATH "~/."
340# define ProcessPendingEvents(text)
341# define ReadCommandlLine(argc,argv)
342# define SetNotifyHandlers
343#else
344# if defined(vms)
345# define X11_APPLICATION_PATH "decw$system_defaults:"
346# define DirectorySeparator ""
347# define DirectoryListSeparator ';'
348# define EditorOptions ""
349# define Exit exit
350# define IsBasenameSeparator(c) \
351 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
352# define MAGICKCORE_LIBRARY_PATH "sys$login:"
353# define MAGICKCORE_CODER_PATH "sys$login:"
354# define MAGICKCORE_FILTER_PATH "sys$login:"
355# define MAGICKCORE_SHARE_PATH "sys$login:"
356# define X11_PREFERENCES_PATH "decw$user_defaults:"
357# define ProcessPendingEvents(text)
358# define ReadCommandlLine(argc,argv)
359# define SetNotifyHandlers
360# endif
361# if defined(__OS2__)
362# define DirectorySeparator "\\"
363# define DirectoryListSeparator ';'
364# define EditorOptions " -title \"Edit Image Comment\" -e vi"
365# define Exit exit
366# define IsBasenameSeparator(c) \
367 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
368# define PreferencesDefaults "~\."
369# define ProcessPendingEvents(text)
370# define ReadCommandlLine(argc,argv)
371# define SetNotifyHandlers
372#endif
373# if defined(macintosh)
374# define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
375# define DirectorySeparator ":"
376# define DirectoryListSeparator ';'
377# define EditorOptions ""
378# define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
379# define MAGICKCORE_LIBRARY_PATH ""
380# define MAGICKCORE_CODER_PATH ""
381# define MAGICKCORE_FILTER_PATH ""
382# define MAGICKCORE_SHARE_PATH ""
383# define X11_PREFERENCES_PATH "~/."
384# if defined(DISABLE_SIOUX)
385# define ReadCommandlLine(argc,argv)
386# define SetNotifyHandlers \
387 SetFatalErrorHandler(MacFatalErrorHandler); \
388 SetErrorHandler(MACErrorHandler); \
389 SetWarningHandler(MACWarningHandler)
390# else
391# define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
392# define SetNotifyHandlers \
393 SetErrorHandler(MACErrorHandler); \
394 SetWarningHandler(MACWarningHandler)
395# endif
396# endif
397# if defined(__WINDOWS__)
398# define DirectorySeparator "\\"
399# define DirectoryListSeparator ';'
400# define EditorOptions ""
401# define IsBasenameSeparator(c) \
402 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
403# define ProcessPendingEvents(text)
404# if !defined(X11_PREFERENCES_PATH)
405# define X11_PREFERENCES_PATH "~\\."
406# endif
407# define ReadCommandlLine(argc,argv)
408# define SetNotifyHandlers \
409 SetErrorHandler(NTErrorHandler); \
410 SetWarningHandler(NTWarningHandler)
411# undef sleep
412# define sleep(seconds) Sleep(seconds*1000)
413# if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
414# define HAVE_TIFFCONF_H
415# endif
416# endif
417
418#endif
419
420/*
421 Define system symbols if not already defined.
422*/
423#if !defined(STDIN_FILENO)
424#define STDIN_FILENO 0x00
425#endif
426
427#if !defined(O_BINARY)
428#define O_BINARY 0x00
429#endif
430
cristy104cea82009-10-25 02:26:51 +0000431#if !defined(PATH_MAX)
432#define PATH_MAX 4096
433#endif
434
cristy3ed852e2009-09-05 21:47:34 +0000435/*
436 I/O defines.
437*/
438#if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
439#define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
440#define MagickTell(file) _telli64(file)
441#else
442#define MagickSeek(file,offset,whence) lseek(file,offset,whence)
443#define MagickTell(file) tell(file)
444#endif
445
446#define ThrowWandFatalException(severity,tag,context) \
447{ \
448 ExceptionInfo \
449 *exception; \
450 \
451 exception=AcquireExceptionInfo(); \
452 (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
453 "`%s'",context); \
454 CatchException(exception); \
455 exception=DestroyExceptionInfo(exception); \
456}
457
458#if defined(__cplusplus) || defined(c_plusplus)
459}
460#endif
461
462#endif