studio.h revision 66988abda13e6b91586a74dff40d581b0fb0e31e
1/*
2  Copyright 1999-2015 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 MAGICKWAND_WINDOWS_SUPPORT
27#else
28#  define MAGICKWAND_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(__cplusplus) || defined(c_plusplus)
50#  undef inline
51# endif
52#endif
53
54#if !defined(const)
55#  define STDC
56#endif
57
58#if defined(__cplusplus) || defined(c_plusplus)
59# define storage_class  c_class
60#else
61# define storage_class  class
62#endif
63
64#include <stdarg.h>
65#include <stdio.h>
66#if defined(MAGICKCORE_HAVE_SYS_STAT_H)
67# include <sys/stat.h>
68#endif
69#if defined(MAGICKCORE_STDC_HEADERS)
70# include <stdlib.h>
71# include <stddef.h>
72#else
73# if defined(MAGICKCORE_HAVE_STDLIB_H)
74#  include <stdlib.h>
75# endif
76#endif
77#if defined(_magickcore_restrict) && !defined(restrict)
78# define restrict  _magickcore_restrict
79#endif
80#if defined(MAGICKCORE_HAVE_STRING_H)
81# if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
82#  include <memory.h>
83# endif
84# include <string.h>
85#endif
86#if defined(MAGICKCORE_HAVE_STRINGS_H)
87# include <strings.h>
88#endif
89#if defined(MAGICKCORE_HAVE_INTTYPES_H)
90# include <inttypes.h>
91#endif
92#if defined(MAGICKCORE_HAVE_STDINT_H)
93# include <stdint.h>
94#endif
95#if defined(MAGICKCORE_HAVE_UNISTD_H)
96# include <unistd.h>
97#endif
98#if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
99#define _CRTDBG_MAP_ALLOC
100#endif
101
102#if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
103#define _CRTDBG_MAP_ALLOC
104#endif
105#if defined(MAGICKWAND_WINDOWS_SUPPORT)
106# include <io.h>
107# include <direct.h>
108# if !defined(MAGICKCORE_HAVE_STRERROR)
109#  define HAVE_STRERROR
110# endif
111#endif
112
113#include <ctype.h>
114#include <locale.h>
115#include <errno.h>
116#include <fcntl.h>
117#include <math.h>
118#include <time.h>
119#include <limits.h>
120#include <signal.h>
121#include <assert.h>
122
123#if defined(MAGICKCORE_HAVE_XLOCALE_H)
124# include <xlocale.h>
125#endif
126#if defined(MAGICKCORE_THREAD_SUPPORT)
127# include <pthread.h>
128#elif defined(MAGICKWAND_WINDOWS_SUPPORT)
129#  define MAGICKCORE_HAVE_WINTHREADS  1
130#include <windows.h>
131#endif
132#if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
133# include <sys/syslimits.h>
134#endif
135#if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
136# include <arm/limits.h>
137#endif
138
139#if defined(MAGICKCORE__OPENCL)
140#if defined(MAGICKCORE_HAVE_CL_CL_H)
141#  include <CL/cl.h>
142#endif
143#if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
144#  include <OpenCL/cl.h>
145#endif
146#  define MAGICKCORE_OPENCL_SUPPORT  1
147#endif
148
149#if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
150#  include <omp.h>
151#  define MAGICKCORE_OPENMP_SUPPORT  1
152#endif
153
154#if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
155ssize_t pread(int,void *,size_t,off_t);
156#endif
157
158#if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
159ssize_t pwrite(int,const void *,size_t,off_t);
160#endif
161
162#if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
163extern size_t strlcpy(char *,const char *,size_t);
164#endif
165
166#if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
167extern int vsnprintf(char *,size_t,const char *,va_list);
168#endif
169
170#include "MagickWand/method-attribute.h"
171
172#if defined(MAGICKWAND_WINDOWS_SUPPORT) || defined(MAGICKWAND_POSIX_SUPPORT)
173# include <sys/types.h>
174# include <sys/stat.h>
175# if defined(MAGICKCORE_HAVE_FTIME)
176# include <sys/timeb.h>
177# endif
178# if defined(MAGICKWAND_POSIX_SUPPORT)
179#  if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
180#   define dirent direct
181#   define NAMLEN(dirent) (dirent)->d_namlen
182#   if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
183#    include <sys/ndir.h>
184#   endif
185#   if defined(MAGICKCORE_HAVE_SYS_DIR_H)
186#    include <sys/dir.h>
187#   endif
188#   if defined(MAGICKCORE_HAVE_NDIR_H)
189#    include <ndir.h>
190#   endif
191#  else
192#   include <dirent.h>
193#   define NAMLEN(dirent) strlen((dirent)->d_name)
194#  endif
195#  include <sys/wait.h>
196#  include <pwd.h>
197# endif
198# if !defined(S_ISDIR)
199#  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
200# endif
201# if !defined(S_ISREG)
202#  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
203# endif
204# include "MagickWand/MagickWand.h"
205# if !defined(MAGICKWAND_WINDOWS_SUPPORT)
206#  include <sys/time.h>
207# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
208#  include <sys/times.h>
209# endif
210# if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
211#  include <sys/resource.h>
212# endif
213# if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
214#  include <sys/mman.h>
215# endif
216# if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
217#  include <sys/sendfile.h>
218# endif
219#endif
220#else
221# include <types.h>
222# include <stat.h>
223# if defined(macintosh)
224#  if !defined(DISABLE_SIOUX)
225#   include <SIOUX.h>
226#   include <console.h>
227#  endif
228#  include <unix.h>
229# endif
230#endif
231
232#if defined(S_IRUSR) && defined(S_IWUSR)
233# define S_MODE (S_IRUSR | S_IWUSR)
234#elif defined (MAGICKWAND_WINDOWS_SUPPORT)
235# define S_MODE (_S_IREAD | _S_IWRITE)
236#else
237# define S_MODE  0600
238#endif
239
240#if defined(MAGICKWAND_WINDOWS_SUPPORT)
241# include "MagickCore/nt-base.h"
242#endif
243#if defined(macintosh)
244# include "MagickCore/mac.h"
245#endif
246#if defined(vms)
247# include "MagickCore/vms.h"
248#endif
249
250#undef HAVE_CONFIG_H
251#undef gamma
252#undef index
253#undef pipe
254#undef y1
255
256/*
257  Review these platform specific definitions.
258*/
259#if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__)
260# define DirectorySeparator  "/"
261# define DirectoryListSeparator  ':'
262# define EditorOptions  " -title \"Edit Image Comment\" -e vi"
263# define Exit  exit
264# define IsBasenameSeparator(c)  ((c) == '/' ? MagickTrue : MagickFalse)
265# define X11_PREFERENCES_PATH  "~/."
266# define ProcessPendingEvents(text)
267# define ReadCommandlLine(argc,argv)
268# define SetNotifyHandlers
269#else
270# if defined(vms)
271#  define X11_APPLICATION_PATH  "decw$system_defaults:"
272#  define DirectorySeparator  ""
273#  define DirectoryListSeparator  ';'
274#  define EditorOptions  ""
275#  define Exit  exit
276#  define IsBasenameSeparator(c) \
277  (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
278#  define MAGICKCORE_LIBRARY_PATH  "sys$login:"
279#  define MAGICKCORE_SHARE_PATH  "sys$login:"
280#  define X11_PREFERENCES_PATH  "decw$user_defaults:"
281#  define ProcessPendingEvents(text)
282#  define ReadCommandlLine(argc,argv)
283#  define SetNotifyHandlers
284# endif
285# if defined(__OS2__)
286#   define DirectorySeparator  "\\"
287#   define DirectoryListSeparator  ';'
288# define EditorOptions  " -title \"Edit Image Comment\" -e vi"
289# define Exit  exit
290#  define IsBasenameSeparator(c) \
291  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
292# define PreferencesDefaults  "~\."
293# define ProcessPendingEvents(text)
294# define ReadCommandlLine(argc,argv)
295# define SetNotifyHandlers
296#endif
297# if defined(macintosh)
298#  define X11_APPLICATION_PATH  "/usr/lib/X11/app-defaults/"
299#  define DirectorySeparator  ":"
300#  define DirectoryListSeparator  ';'
301#  define EditorOptions ""
302#  define IsBasenameSeparator(c)  ((c) == ':' ? MagickTrue : MagickFalse)
303#  define MAGICKCORE_LIBRARY_PATH  ""
304#  define MAGICKCORE_SHARE_PATH  ""
305#  define X11_PREFERENCES_PATH  "~/."
306#  if defined(DISABLE_SIOUX)
307#   define ReadCommandlLine(argc,argv)
308#   define SetNotifyHandlers \
309     SetFatalErrorHandler(MacFatalErrorHandler); \
310     SetErrorHandler(MACErrorHandler); \
311     SetWarningHandler(MACWarningHandler)
312#  else
313#   define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
314#   define SetNotifyHandlers \
315     SetErrorHandler(MACErrorHandler); \
316     SetWarningHandler(MACWarningHandler)
317#  endif
318# endif
319# if defined(MAGICKWAND_WINDOWS_SUPPORT)
320#  define DirectorySeparator  "\\"
321#  define DirectoryListSeparator  ';'
322#  define EditorOptions ""
323#  define IsBasenameSeparator(c) \
324  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
325#  define ProcessPendingEvents(text)
326#  if !defined(X11_PREFERENCES_PATH)
327#    define X11_PREFERENCES_PATH  "~\\."
328#  endif
329#  define ReadCommandlLine(argc,argv)
330#  define SetNotifyHandlers \
331    SetErrorHandler(NTErrorHandler); \
332    SetWarningHandler(NTWarningHandler)
333#  undef sleep
334#  define sleep(seconds)  Sleep(seconds*1000)
335#  if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
336#    define HAVE_TIFFCONF_H
337#  endif
338# endif
339
340#endif
341
342/*
343  Define system symbols if not already defined.
344*/
345#if !defined(STDIN_FILENO)
346#define STDIN_FILENO  0x00
347#endif
348
349#if !defined(O_BINARY)
350#define O_BINARY  0x00
351#endif
352
353#if !defined(PATH_MAX)
354#define PATH_MAX  4096
355#endif
356
357/*
358  Magick defines.
359*/
360#if defined(_MSC_VER)
361# define DisableMSCWarning(nr) __pragma(warning(push)) \
362  __pragma(warning(disable:nr))
363# define RestoreMSCWarning __pragma(warning(pop))
364#else
365# define DisableMSCWarning(nr)
366# define RestoreMSCWarning
367#endif
368
369#if defined(__cplusplus) || defined(c_plusplus)
370}
371#endif
372
373#endif
374