]> 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 #endif
219 #else
220 # include <types.h>
221 # include <stat.h>
222 # if defined(macintosh)
223 #  if !defined(DISABLE_SIOUX)
224 #   include <SIOUX.h>
225 #   include <console.h>
226 #  endif
227 #  include <unix.h>
228 # endif
229 #endif
230
231 #if defined(S_IRUSR) && defined(S_IWUSR)
232 # define S_MODE (S_IRUSR | S_IWUSR)
233 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
234 # define S_MODE (_S_IREAD | _S_IWRITE)
235 #else
236 # define S_MODE  0600
237 #endif
238
239 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
240 # include "MagickCore/nt-base.h"
241 #endif
242 #if defined(macintosh)
243 # include "MagickCore/mac.h"
244 #endif
245 #if defined(vms)
246 # include "MagickCore/vms.h"
247 #endif
248
249 #undef HAVE_CONFIG_H
250 #undef gamma
251 #undef index
252 #undef pipe
253 #undef y1
254
255 /*
256   Review these platform specific definitions.
257 */
258 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
259 # define DirectorySeparator  "/"
260 # define DirectoryListSeparator  ':'
261 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
262 # define Exit  exit
263 # define IsBasenameSeparator(c)  ((c) == '/' ? MagickTrue : MagickFalse)
264 # define X11_PREFERENCES_PATH  "~/."
265 # define ProcessPendingEvents(text)
266 # define ReadCommandlLine(argc,argv)
267 # define SetNotifyHandlers
268 #else
269 # if defined(vms)
270 #  define X11_APPLICATION_PATH  "decw$system_defaults:"
271 #  define DirectorySeparator  ""
272 #  define DirectoryListSeparator  ';'
273 #  define EditorOptions  ""
274 #  define Exit  exit
275 #  define IsBasenameSeparator(c) \
276   (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
277 #  define MAGICKCORE_LIBRARY_PATH  "sys$login:"
278 #  define MAGICKCORE_CODER_PATH  "sys$login:"
279 #  define MAGICKCORE_FILTER_PATH  "sys$login:"
280 #  define MAGICKCORE_SHARE_PATH  "sys$login:"
281 #  define X11_PREFERENCES_PATH  "decw$user_defaults:"
282 #  define ProcessPendingEvents(text)
283 #  define ReadCommandlLine(argc,argv)
284 #  define SetNotifyHandlers
285 # endif
286 # if defined(__OS2__)
287 #   define DirectorySeparator  "\\"
288 #   define DirectoryListSeparator  ';'
289 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
290 # define Exit  exit
291 #  define IsBasenameSeparator(c) \
292   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
293 # define PreferencesDefaults  "~\."
294 # define ProcessPendingEvents(text)
295 # define ReadCommandlLine(argc,argv)
296 # define SetNotifyHandlers
297 #endif
298 # if defined(macintosh)
299 #  define X11_APPLICATION_PATH  "/usr/lib/X11/app-defaults/"
300 #  define DirectorySeparator  ":"
301 #  define DirectoryListSeparator  ';'
302 #  define EditorOptions ""
303 #  define IsBasenameSeparator(c)  ((c) == ':' ? MagickTrue : MagickFalse)
304 #  define MAGICKCORE_LIBRARY_PATH  ""
305 #  define MAGICKCORE_CODER_PATH  ""
306 #  define MAGICKCORE_FILTER_PATH  ""
307 #  define MAGICKCORE_SHARE_PATH  ""
308 #  define X11_PREFERENCES_PATH  "~/."
309 #  if defined(DISABLE_SIOUX)
310 #   define ReadCommandlLine(argc,argv)
311 #   define SetNotifyHandlers \
312      SetFatalErrorHandler(MacFatalErrorHandler); \
313      SetErrorHandler(MACErrorHandler); \
314      SetWarningHandler(MACWarningHandler)
315 #  else
316 #   define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
317 #   define SetNotifyHandlers \
318      SetErrorHandler(MACErrorHandler); \
319      SetWarningHandler(MACWarningHandler)
320 #  endif
321 # endif
322 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
323 #  define DirectorySeparator  "\\"
324 #  define DirectoryListSeparator  ';'
325 #  define EditorOptions ""
326 #  define IsBasenameSeparator(c) \
327   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
328 #  define ProcessPendingEvents(text)
329 #  if !defined(X11_PREFERENCES_PATH)
330 #    define X11_PREFERENCES_PATH  "~\\."
331 #  endif
332 #  define ReadCommandlLine(argc,argv)
333 #  define SetNotifyHandlers \
334     SetErrorHandler(NTErrorHandler); \
335     SetWarningHandler(NTWarningHandler)
336 #  undef sleep
337 #  define sleep(seconds)  Sleep(seconds*1000)
338 #  if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
339 #    define HAVE_TIFFCONF_H
340 #  endif
341 # endif
342
343 #endif
344
345 /*
346   Define system symbols if not already defined.
347 */
348 #if !defined(STDIN_FILENO)
349 #define STDIN_FILENO  0x00
350 #endif
351
352 #if !defined(O_BINARY)
353 #define O_BINARY  0x00
354 #endif
355
356 #if !defined(PATH_MAX)
357 #define PATH_MAX  4096
358 #endif
359
360 /*
361   Exception defines.
362 */
363 #define ThrowWandFatalException(severity,tag,context) \
364 { \
365   ExceptionInfo \
366     *fatal_exception; \
367  \
368   fatal_exception=AcquireExceptionInfo(); \
369   (void) ThrowMagickException(fatal_exception,GetMagickModule(),severity,tag, \
370     "'%s'",(context)); \
371   CatchException(fatal_exception); \
372   fatal_exception=DestroyExceptionInfo(fatal_exception); \
373 }
374
375 #if defined(__cplusplus) || defined(c_plusplus)
376 }
377 #endif
378
379 #endif