]> granicus.if.org Git - imagemagick/blob - MagickWand/studio.h
Removed 3 redundant lines of code from coders/png.c
[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(__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 # 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)
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
239 ssize_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
243 ssize_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
247 extern 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
251 extern 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_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
265 # include <sys/types.h>
266 # include <sys/stat.h>
267 # if defined(MAGICKCORE_HAVE_FTIME)
268 # include <sys/timeb.h>
269 # endif
270 # if defined(MAGICKCORE_POSIX_SUPPORT)
271 #  if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
272 #   define dirent direct
273 #   define NAMLEN(dirent) (dirent)->d_namlen
274 #   if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
275 #    include <sys/ndir.h>
276 #   endif
277 #   if defined(MAGICKCORE_HAVE_SYS_DIR_H)
278 #    include <sys/dir.h>
279 #   endif
280 #   if defined(MAGICKCORE_HAVE_NDIR_H)
281 #    include <ndir.h>
282 #   endif
283 #  else
284 #   include <dirent.h>
285 #   define NAMLEN(dirent) strlen((dirent)->d_name)
286 #  endif
287 #  include <sys/wait.h>
288 #  include <pwd.h>
289 # endif
290 # if !defined(S_ISDIR)
291 #  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
292 # endif
293 # if !defined(S_ISREG)
294 #  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
295 # endif
296 # include "MagickWand/MagickWand.h"
297 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
298 #  include <sys/time.h>
299 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
300 #  include <sys/times.h>
301 # endif
302 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
303 #  include <sys/resource.h>
304 # endif
305 #endif
306 #else
307 # include <types.h>
308 # include <stat.h>
309 # if defined(macintosh)
310 #  if !defined(DISABLE_SIOUX)
311 #   include <SIOUX.h>
312 #   include <console.h>
313 #  endif
314 #  include <unix.h>
315 # endif
316 # include "MagickWand/MagickWand.h"
317 #endif
318
319 #if defined(S_IRUSR) && defined(S_IWUSR)
320 # define S_MODE (S_IRUSR | S_IWUSR)
321 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
322 # define S_MODE (_S_IREAD | _S_IWRITE)
323 #else
324 # define S_MODE  0600
325 #endif
326
327 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
328 # include "MagickCore/nt-base.h"
329 #endif
330 #if defined(macintosh)
331 # include "MagickCore/mac.h"
332 #endif
333 #if defined(vms)
334 # include "MagickCore/vms.h"
335 #endif
336
337 #undef HAVE_CONFIG_H
338 #undef gamma
339 #undef index
340 #undef pipe
341 #undef y1
342
343 /*
344   Review these platform specific definitions.
345 */
346 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
347 # define DirectorySeparator  "/"
348 # define DirectoryListSeparator  ':'
349 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
350 # define Exit  exit
351 # define IsBasenameSeparator(c)  ((c) == '/' ? MagickTrue : MagickFalse)
352 # define X11_PREFERENCES_PATH  "~/."
353 # define ProcessPendingEvents(text)
354 # define ReadCommandlLine(argc,argv)
355 # define SetNotifyHandlers
356 #else
357 # if defined(vms)
358 #  define X11_APPLICATION_PATH  "decw$system_defaults:"
359 #  define DirectorySeparator  ""
360 #  define DirectoryListSeparator  ';'
361 #  define EditorOptions  ""
362 #  define Exit  exit
363 #  define IsBasenameSeparator(c) \
364   (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
365 #  define MAGICKCORE_LIBRARY_PATH  "sys$login:"
366 #  define MAGICKCORE_CODER_PATH  "sys$login:"
367 #  define MAGICKCORE_FILTER_PATH  "sys$login:"
368 #  define MAGICKCORE_SHARE_PATH  "sys$login:"
369 #  define X11_PREFERENCES_PATH  "decw$user_defaults:"
370 #  define ProcessPendingEvents(text)
371 #  define ReadCommandlLine(argc,argv)
372 #  define SetNotifyHandlers
373 # endif
374 # if defined(__OS2__)
375 #   define DirectorySeparator  "\\"
376 #   define DirectoryListSeparator  ';'
377 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
378 # define Exit  exit
379 #  define IsBasenameSeparator(c) \
380   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
381 # define PreferencesDefaults  "~\."
382 # define ProcessPendingEvents(text)
383 # define ReadCommandlLine(argc,argv)
384 # define SetNotifyHandlers
385 #endif
386 # if defined(macintosh)
387 #  define X11_APPLICATION_PATH  "/usr/lib/X11/app-defaults/"
388 #  define DirectorySeparator  ":"
389 #  define DirectoryListSeparator  ';'
390 #  define EditorOptions ""
391 #  define IsBasenameSeparator(c)  ((c) == ':' ? MagickTrue : MagickFalse)
392 #  define MAGICKCORE_LIBRARY_PATH  ""
393 #  define MAGICKCORE_CODER_PATH  ""
394 #  define MAGICKCORE_FILTER_PATH  ""
395 #  define MAGICKCORE_SHARE_PATH  ""
396 #  define X11_PREFERENCES_PATH  "~/."
397 #  if defined(DISABLE_SIOUX)
398 #   define ReadCommandlLine(argc,argv)
399 #   define SetNotifyHandlers \
400      SetFatalErrorHandler(MacFatalErrorHandler); \
401      SetErrorHandler(MACErrorHandler); \
402      SetWarningHandler(MACWarningHandler)
403 #  else
404 #   define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
405 #   define SetNotifyHandlers \
406      SetErrorHandler(MACErrorHandler); \
407      SetWarningHandler(MACWarningHandler)
408 #  endif
409 # endif
410 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
411 #  define DirectorySeparator  "\\"
412 #  define DirectoryListSeparator  ';'
413 #  define EditorOptions ""
414 #  define IsBasenameSeparator(c) \
415   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
416 #  define ProcessPendingEvents(text)
417 #  if !defined(X11_PREFERENCES_PATH)
418 #    define X11_PREFERENCES_PATH  "~\\."
419 #  endif
420 #  define ReadCommandlLine(argc,argv)
421 #  define SetNotifyHandlers \
422     SetErrorHandler(NTErrorHandler); \
423     SetWarningHandler(NTWarningHandler)
424 #  undef sleep
425 #  define sleep(seconds)  Sleep(seconds*1000)
426 #  if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
427 #    define HAVE_TIFFCONF_H
428 #  endif
429 # endif
430
431 #endif
432
433 /*
434   Define system symbols if not already defined.
435 */
436 #if !defined(STDIN_FILENO)
437 #define STDIN_FILENO  0x00
438 #endif
439
440 #if !defined(O_BINARY)
441 #define O_BINARY  0x00
442 #endif
443
444 #if !defined(PATH_MAX)
445 #define PATH_MAX  4096
446 #endif
447
448 /*
449   Exception defines.
450 */
451 #define ThrowWandFatalException(severity,tag,context) \
452 { \
453   ExceptionInfo \
454     *exception; \
455  \
456   exception=AcquireExceptionInfo(); \
457   (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
458     "`%s'",context); \
459   CatchException(exception); \
460   exception=DestroyExceptionInfo(exception); \
461 }
462
463 #if defined(__cplusplus) || defined(c_plusplus)
464 }
465 #endif
466
467 #endif