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