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