source: ImageMagick/trunk/MagickWand/studio.h @ 6885

Revision 6885, 12.8 KB checked in by cristy, 15 months ago (diff)
Line 
1/*
2  Copyright 1999-2012 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(WIN32) || defined(WIN64)
26#  define MAGICKCORE_WINDOWS_SUPPORT
27#else
28#  define MAGICKCORE_POSIX_SUPPORT
29#endif
30
31#define MAGICKWAND_IMPLEMENTATION  1
32
33#if !defined(_MAGICKWAND_CONFIG_H)
34# define _MAGICKWAND_CONFIG_H
35# if !defined(vms) && !defined(macintosh)
36#  include "MagickCore/magick-config.h"
37# else
38#  include "magick-config.h"
39# endif
40#if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
41# define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
42#endif
43#if defined(_magickcore_const) && !defined(const)
44# define const _magickcore_const
45#endif
46#if defined(_magickcore_inline) && !defined(inline)
47# define inline _magickcore_inline
48#endif
49#if defined(_magickcore_restrict) && !defined(restrict)
50# define restrict  _magickcore_restrict
51#endif
52# if defined(__cplusplus) || defined(c_plusplus)
53#  undef inline
54# endif
55#endif
56
57#if !defined(const)
58#  define STDC
59#endif
60
61#if defined(__BORLANDC__) && defined(_DLL)
62#  pragma message("BCBMagick lib DLL export interface")
63#  define _MAGICKDLL_
64#  define _MAGICKLIB_
65#endif
66
67#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__)
68# define WandPrivate
69# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
70#  define _MAGICKDLL_
71# endif
72# if defined(_MAGICKDLL_)
73#  if defined(_VISUALC_)
74#   pragma warning( disable: 4273 )  /* Disable the dll linkage warnings */
75#  endif
76#  if !defined(_MAGICKLIB_)
77#   if defined(__GNUC__)
78#    define WandExport __attribute__ ((__dllimport__))
79#   else
80#    define WandExport __declspec(dllimport)
81#   endif
82#   if defined(_VISUALC_)
83#    pragma message( "MagickWand lib DLL import interface" )
84#   endif
85#  else
86#   if defined(__GNUC__)
87#    define WandExport __attribute__ ((__dllexport__))
88#   else
89#    define WandExport __declspec(dllexport)
90#   endif
91#   if defined(_VISUALC_)
92#    pragma message( "MagickWand lib DLL export interface" )
93#   endif
94#  endif
95# else
96#  define WandExport
97#  if defined(_VISUALC_)
98#   pragma message( "MagickWand lib static interface" )
99#  endif
100# endif
101
102# if defined(_DLL) && !defined(_LIB)
103#  define ModuleExport  __declspec(dllexport)
104#  if defined(_VISUALC_)
105#   pragma message( "MagickWand module DLL export interface" )
106#  endif
107# else
108#  define ModuleExport
109#  if defined(_VISUALC_)
110#   pragma message( "MagickWand module static interface" )
111#  endif
112
113# endif
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)
123# endif
124#else
125# if __GNUC__ >= 4
126#  define WandExport __attribute__ ((__visibility__ ("default")))
127#  define WandPrivate  __attribute__ ((__visibility__ ("hidden")))
128# else
129#   define WandExport
130#   define WandPrivate
131# endif
132# define WandGlobal
133#endif
134
135#if defined(__cplusplus) || defined(c_plusplus)
136# define storage_class  c_class
137#else
138# define storage_class  class
139#endif
140
141#define WandSignature  0xabacadabUL
142#if !defined(MaxTextExtent)
143# define MaxTextExtent  4096
144#endif
145
146#include <stdarg.h>
147#include <stdio.h>
148#if defined(MAGICKCORE_HAVE_SYS_STAT_H)
149# include <sys/stat.h>
150#endif
151#if defined(MAGICKCORE_STDC_HEADERS)
152# include <stdlib.h>
153# include <stddef.h>
154#else
155# if defined(MAGICKCORE_HAVE_STDLIB_H)
156#  include <stdlib.h>
157# endif
158#endif
159#if defined(MAGICKCORE_HAVE_STRING_H)
160# if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
161#  include <memory.h>
162# endif
163# include <string.h>
164#endif
165#if defined(MAGICKCORE_HAVE_STRINGS_H)
166# include <strings.h>
167#endif
168#if defined(MAGICKCORE_HAVE_INTTYPES_H)
169# include <inttypes.h>
170#endif
171#if defined(MAGICKCORE_HAVE_STDINT_H)
172# include <stdint.h>
173#endif
174#if defined(MAGICKCORE_HAVE_UNISTD_H)
175# include <unistd.h>
176#endif
177#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
178#define _CRTDBG_MAP_ALLOC
179#endif
180#if defined(MAGICKCORE_WINDOWS_SUPPORT)
181# include <direct.h>
182# if !defined(MAGICKCORE_HAVE_STRERROR)
183#  define HAVE_STRERROR
184# endif
185#endif
186
187#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
188#define _CRTDBG_MAP_ALLOC
189#endif
190#if defined(MAGICKCORE_WINDOWS_SUPPORT)
191# include <direct.h>
192# if !defined(MAGICKCORE_HAVE_STRERROR)
193#  define HAVE_STRERROR
194# endif
195#endif
196
197#include <ctype.h>
198#include <locale.h>
199#include <errno.h>
200#include <fcntl.h>
201#include <math.h>
202#include <time.h>
203#include <limits.h>
204#include <signal.h>
205#include <assert.h>
206
207#if defined(MAGICKCORE_HAVE_XLOCALE_H)
208# include <xlocale.h>
209#endif
210#if defined(MAGICKCORE_THREAD_SUPPORT)
211# include <pthread.h>
212#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
213#  define MAGICKCORE_HAVE_WINTHREADS  1
214#include <windows.h>
215#endif
216#if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
217# include <sys/syslimits.h>
218#endif
219#if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
220# include <arm/limits.h>
221#endif
222
223#if defined(MAGICKCORE__OPENCL)
224#if defined(MAGICKCORE_HAVE_CL_CL_H)
225#  include <CL/cl.h>
226#endif
227#if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
228#  include <OpenCL/cl.h>
229#endif
230#  define MAGICKCORE_OPENCL_SUPPORT  1
231#endif
232
233#if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
234#  include <omp.h>
235#  define MAGICKCORE_OPENMP_SUPPORT  1
236#endif
237
238#if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
239ssize_t pread(int,void *,size_t,off_t);
240#endif
241
242#if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
243ssize_t pwrite(int,const void *,size_t,off_t);
244#endif
245
246#if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
247extern size_t strlcpy(char *,const char *,size_t);
248#endif
249
250#if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
251extern int vsnprintf(char *,size_t,const char *,va_list);
252#endif
253
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__))
258#else
259#  define wand_aligned(x)  /* nothing */
260#  define wand_attribute(x)  /* nothing */
261#  define wand_unused(x) x
262#endif
263
264#if defined(MAGICKCORE_HAVE___ALLOC_SIZE__)
265#  define wand_alloc_size(x)  __attribute__((__alloc_size__(x)))
266#  define wand_alloc_sizes(x,y)  __attribute__((__alloc_size__(x,y)))
267#  define wand_cold  __attribute__((__cold__))
268#  define wand_hot  __attribute__((__hot__))
269#else
270#  define wand_alloc_size(x)  /* nothing */
271#  define wand_alloc_sizes(x,y)  /* nothing */
272#  define wand_cold
273#  define wand_hot
274#endif
275
276#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
277# include <sys/types.h>
278# include <sys/stat.h>
279# if defined(MAGICKCORE_HAVE_FTIME)
280# include <sys/timeb.h>
281# endif
282# if defined(MAGICKCORE_POSIX_SUPPORT)
283#  if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
284#   define dirent direct
285#   define NAMLEN(dirent) (dirent)->d_namlen
286#   if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
287#    include <sys/ndir.h>
288#   endif
289#   if defined(MAGICKCORE_HAVE_SYS_DIR_H)
290#    include <sys/dir.h>
291#   endif
292#   if defined(MAGICKCORE_HAVE_NDIR_H)
293#    include <ndir.h>
294#   endif
295#  else
296#   include <dirent.h>
297#   define NAMLEN(dirent) strlen((dirent)->d_name)
298#  endif
299#  include <sys/wait.h>
300#  include <pwd.h>
301# endif
302# if !defined(S_ISDIR)
303#  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
304# endif
305# if !defined(S_ISREG)
306#  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
307# endif
308# include "MagickWand/MagickWand.h"
309# if !defined(MAGICKCORE_WINDOWS_SUPPORT)
310#  include <sys/time.h>
311# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
312#  include <sys/times.h>
313# endif
314# if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
315#  include <sys/resource.h>
316# endif
317#endif
318#else
319# include <types.h>
320# include <stat.h>
321# if defined(macintosh)
322#  if !defined(DISABLE_SIOUX)
323#   include <SIOUX.h>
324#   include <console.h>
325#  endif
326#  include <unix.h>
327# endif
328# include "MagickWand/MagickWand.h"
329#endif
330
331#if defined(S_IRUSR) && defined(S_IWUSR)
332# define S_MODE (S_IRUSR | S_IWUSR)
333#elif defined (MAGICKCORE_WINDOWS_SUPPORT)
334# define S_MODE (_S_IREAD | _S_IWRITE)
335#else
336# define S_MODE  0600
337#endif
338
339#if defined(MAGICKCORE_WINDOWS_SUPPORT)
340# include "MagickCore/nt-base.h"
341#endif
342#if defined(macintosh)
343# include "MagickCore/mac.h"
344#endif
345#if defined(vms)
346# include "MagickCore/vms.h"
347#endif
348
349#undef HAVE_CONFIG_H
350#undef gamma
351#undef index
352#undef pipe
353#undef y1
354
355/*
356  Review these platform specific definitions.
357*/
358#if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
359# define DirectorySeparator  "/"
360# define DirectoryListSeparator  ':'
361# define EditorOptions  " -title \"Edit Image Comment\" -e vi"
362# define Exit  exit
363# define IsBasenameSeparator(c)  ((c) == '/' ? MagickTrue : MagickFalse)
364# define X11_PREFERENCES_PATH  "~/."
365# define ProcessPendingEvents(text)
366# define ReadCommandlLine(argc,argv)
367# define SetNotifyHandlers
368#else
369# if defined(vms)
370#  define X11_APPLICATION_PATH  "decw$system_defaults:"
371#  define DirectorySeparator  ""
372#  define DirectoryListSeparator  ';'
373#  define EditorOptions  ""
374#  define Exit  exit
375#  define IsBasenameSeparator(c) \
376  (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
377#  define MAGICKCORE_LIBRARY_PATH  "sys$login:"
378#  define MAGICKCORE_CODER_PATH  "sys$login:"
379#  define MAGICKCORE_FILTER_PATH  "sys$login:"
380#  define MAGICKCORE_SHARE_PATH  "sys$login:"
381#  define X11_PREFERENCES_PATH  "decw$user_defaults:"
382#  define ProcessPendingEvents(text)
383#  define ReadCommandlLine(argc,argv)
384#  define SetNotifyHandlers
385# endif
386# if defined(__OS2__)
387#   define DirectorySeparator  "\\"
388#   define DirectoryListSeparator  ';'
389# define EditorOptions  " -title \"Edit Image Comment\" -e vi"
390# define Exit  exit
391#  define IsBasenameSeparator(c) \
392  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
393# define PreferencesDefaults  "~\."
394# define ProcessPendingEvents(text)
395# define ReadCommandlLine(argc,argv)
396# define SetNotifyHandlers
397#endif
398# if defined(macintosh)
399#  define X11_APPLICATION_PATH  "/usr/lib/X11/app-defaults/"
400#  define DirectorySeparator  ":"
401#  define DirectoryListSeparator  ';'
402#  define EditorOptions ""
403#  define IsBasenameSeparator(c)  ((c) == ':' ? MagickTrue : MagickFalse)
404#  define MAGICKCORE_LIBRARY_PATH  ""
405#  define MAGICKCORE_CODER_PATH  ""
406#  define MAGICKCORE_FILTER_PATH  ""
407#  define MAGICKCORE_SHARE_PATH  ""
408#  define X11_PREFERENCES_PATH  "~/."
409#  if defined(DISABLE_SIOUX)
410#   define ReadCommandlLine(argc,argv)
411#   define SetNotifyHandlers \
412     SetFatalErrorHandler(MacFatalErrorHandler); \
413     SetErrorHandler(MACErrorHandler); \
414     SetWarningHandler(MACWarningHandler)
415#  else
416#   define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
417#   define SetNotifyHandlers \
418     SetErrorHandler(MACErrorHandler); \
419     SetWarningHandler(MACWarningHandler)
420#  endif
421# endif
422# if defined(MAGICKCORE_WINDOWS_SUPPORT)
423#  define DirectorySeparator  "\\"
424#  define DirectoryListSeparator  ';'
425#  define EditorOptions ""
426#  define IsBasenameSeparator(c) \
427  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
428#  define ProcessPendingEvents(text)
429#  if !defined(X11_PREFERENCES_PATH)
430#    define X11_PREFERENCES_PATH  "~\\."
431#  endif
432#  define ReadCommandlLine(argc,argv)
433#  define SetNotifyHandlers \
434    SetErrorHandler(NTErrorHandler); \
435    SetWarningHandler(NTWarningHandler)
436#  undef sleep
437#  define sleep(seconds)  Sleep(seconds*1000)
438#  if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
439#    define HAVE_TIFFCONF_H
440#  endif
441# endif
442
443#endif
444
445/*
446  Define system symbols if not already defined.
447*/
448#if !defined(STDIN_FILENO)
449#define STDIN_FILENO  0x00
450#endif
451
452#if !defined(O_BINARY)
453#define O_BINARY  0x00
454#endif
455
456#if !defined(PATH_MAX)
457#define PATH_MAX  4096
458#endif
459
460/*
461  Exception defines.
462*/
463#define ThrowWandFatalException(severity,tag,context) \
464{ \
465  ExceptionInfo \
466    *fatal_exception; \
467 \
468  fatal_exception=AcquireExceptionInfo(); \
469  (void) ThrowMagickException(fatal_exception,GetMagickModule(),severity,tag, \
470    "`%s'",(context)); \
471  CatchException(fatal_exception); \
472  fatal_exception=DestroyExceptionInfo(fatal_exception); \
473}
474
475#if defined(__cplusplus) || defined(c_plusplus)
476}
477#endif
478
479#endif
Note: See TracBrowser for help on using the repository browser.