2 Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 http://www.imagemagick.org/script/license.php
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.
16 MagickCore private application programming interface declarations.
18 #ifndef _MAGICKCORE_STUDIO_H
19 #define _MAGICKCORE_STUDIO_H
21 #if defined(__cplusplus) || defined(c_plusplus)
25 #if defined(__CYGWIN32__)
26 # if !defined(__CYGWIN__)
27 # define __CYGWIN__ __CYGWIN32__
31 #if defined(_WIN32) || defined(WIN32)
32 # if !defined(__WINDOWS__)
34 # define __WINDOWS__ _WIN32
37 # define __WINDOWS__ WIN32
43 #if defined(_WIN64) || defined(WIN64)
44 # if !defined(__WINDOWS__)
46 # define __WINDOWS__ _WIN64
49 # define __WINDOWS__ WIN64
55 #if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
56 # define MAGICKCORE_POSIX_SUPPORT
59 #define MAGICKCORE_IMPLEMENTATION 1
61 #if !defined(_MAGICKCORE_CONFIG_H)
62 # define _MAGICKCORE_CONFIG_H
63 # if !defined(vms) && !defined(macintosh)
64 # include "magick/magick-config.h"
66 # include "magick-config.h"
68 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
69 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
71 #if defined(_magickcore_const) && !defined(const)
72 # define const _magickcore_const
74 #if defined(_magickcore_inline) && !defined(inline)
75 # define inline _magickcore_inline
77 # if defined(__cplusplus) || defined(c_plusplus)
80 #if defined(_magickcore_restrict) && !defined(restrict)
81 # define restrict _magickcore_restrict
85 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
86 # include "magick/methods.h"
93 #if defined(__BORLANDC__) && defined(_DLL)
94 # pragma message("BCBMagick lib DLL export interface")
97 # define MAGICKCORE_MODULES_SUPPORT
98 # undef MAGICKCORE_BUILD_MODULES
101 #if defined(__WINDOWS__)
102 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
105 # if defined(_MAGICKDLL_)
106 # if defined(_VISUALC_)
107 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
109 # if !defined(_MAGICKLIB_)
110 # define MagickExport __declspec(dllimport)
111 # if defined(_VISUALC_)
112 # pragma message( "MagickCore lib DLL import interface" )
115 # define MagickExport __declspec(dllexport)
116 # if defined(_VISUALC_)
117 # pragma message( "MagickCore lib DLL export interface" )
121 # define MagickExport
122 # if defined(_VISUALC_)
123 # pragma message( "MagickCore lib static interface" )
127 # if defined(_DLL) && !defined(_LIB)
128 # define ModuleExport __declspec(dllexport)
129 # if defined(_VISUALC_)
130 # pragma message( "MagickCore module DLL export interface" )
133 # define ModuleExport
134 # if defined(_VISUALC_)
135 # pragma message( "MagickCore module static interface" )
139 # define MagickGlobal __declspec(thread)
140 # if defined(_VISUALC_)
141 # pragma warning(disable : 4018)
142 # pragma warning(disable : 4068)
143 # pragma warning(disable : 4244)
144 # pragma warning(disable : 4142)
145 # pragma warning(disable : 4800)
146 # pragma warning(disable : 4786)
147 # pragma warning(disable : 4996)
150 # define MagickExport
151 # define ModuleExport
152 # define MagickGlobal
155 #define MagickSignature 0xabacadabUL
156 #if !defined(MaxTextExtent)
157 # define MaxTextExtent 4096
162 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
163 # include <sys/stat.h>
165 #if defined(MAGICKCORE_STDC_HEADERS)
169 # if defined(MAGICKCORE_HAVE_STDLIB_H)
173 #if defined(MAGICKCORE_HAVE_STRING_H)
174 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
179 #if defined(MAGICKCORE_HAVE_STRINGS_H)
180 # include <strings.h>
182 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
183 # include <inttypes.h>
185 #if defined(MAGICKCORE_HAVE_STDINT_H)
188 #if defined(MAGICKCORE_HAVE_UNISTD_H)
191 #if defined(__WINDOWS__) && defined(_DEBUG)
192 #define _CRTDBG_MAP_ALLOC
194 #if defined(__WINDOWS__)
196 # if !defined(MAGICKCORE_HAVE_STRERROR)
197 # define HAVE_STRERROR
211 #if defined(MAGICKCORE_HAVE_PTHREAD)
212 # include <pthread.h>
213 #elif defined(__WINDOWS__)
214 # define MAGICKCORE_HAVE_WINTHREADS 1
217 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
218 # include <sys/syslimits.h>
220 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
221 # include <arm/limits.h>
224 #if defined(MAGICKCORE__OPENCL)
225 #if defined(MAGICKCORE_HAVE_CL_CL_H)
228 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
229 # include <OpenCL/cl.h>
231 # define MAGICKCORE_OPENCL_SUPPORT 1
234 #if defined(_OPENMP) && (_OPENMP >= 200203)
236 # define MAGICKCORE_OPENMP_SUPPORT 1
239 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
240 ssize_t pread(int,void *,size_t,off_t);
243 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
244 ssize_t pwrite(int,const void *,size_t,off_t);
247 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
248 extern size_t strlcpy(char *,const char *,size_t);
251 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
252 extern int vsnprintf(char *,size_t,const char *,va_list);
255 #if !defined(magick_attribute)
256 # if (defined(__GNUC__) && (__GNUC__ >= 3))
257 # define magick_attribute __attribute__
259 # define magick_attribute(x) /* nothing */
263 #if !defined(magick_unused)
264 # if (defined(__GNUC__) && (__GNUC__ >= 3))
265 # define magick_unused(x) magick_unused_ ## x __attribute__((unused))
266 # elif defined(__LCLINT__)
267 # define magick_unused(x) /*@unused@*/ x
269 # define magick_unused(x) x
273 #if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
274 # include <sys/types.h>
275 # include <sys/stat.h>
276 # if defined(MAGICKCORE_HAVE_FTIME)
277 # include <sys/timeb.h>
279 # if defined(MAGICKCORE_POSIX_SUPPORT)
280 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
281 # define dirent direct
282 # define NAMLEN(dirent) (dirent)->d_namlen
283 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
284 # include <sys/ndir.h>
286 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
287 # include <sys/dir.h>
289 # if defined(MAGICKCORE_HAVE_NDIR_H)
294 # define NAMLEN(dirent) strlen((dirent)->d_name)
296 # include <sys/wait.h>
299 # if !defined(S_ISDIR)
300 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
302 # if !defined(S_ISREG)
303 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
305 # include "magick/magick-type.h"
306 # if !defined(__WINDOWS__)
307 # include <sys/time.h>
308 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
309 # include <sys/times.h>
311 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
312 # include <sys/resource.h>
318 # if defined(macintosh)
319 # if !defined(DISABLE_SIOUX)
321 # include <console.h>
325 # include "magick/magick-type.h"
328 #if defined(S_IRUSR) && defined(S_IWUSR)
329 # define S_MODE (S_IRUSR | S_IWUSR)
330 #elif defined (__WINDOWS__)
331 # define S_MODE (_S_IREAD | _S_IWRITE)
336 #if defined(__WINDOWS__)
337 # include "magick/nt-base.h"
339 #if defined(macintosh)
340 # include "magick/mac.h"
343 # include "magick/vms.h"
353 Review these platform specific definitions.
355 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
356 # define DirectorySeparator "/"
357 # define DirectoryListSeparator ':'
358 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
360 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
361 # define X11_PREFERENCES_PATH "~/."
362 # define ProcessPendingEvents(text)
363 # define ReadCommandlLine(argc,argv)
364 # define SetNotifyHandlers
367 # define X11_APPLICATION_PATH "decw$system_defaults:"
368 # define DirectorySeparator ""
369 # define DirectoryListSeparator ';'
370 # define EditorOptions ""
372 # define IsBasenameSeparator(c) \
373 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
374 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
375 # define MAGICKCORE_CODER_PATH "sys$login:"
376 # define MAGICKCORE_FILTER_PATH "sys$login:"
377 # define MAGICKCORE_SHARE_PATH "sys$login:"
378 # define X11_PREFERENCES_PATH "decw$user_defaults:"
379 # define ProcessPendingEvents(text)
380 # define ReadCommandlLine(argc,argv)
381 # define SetNotifyHandlers
383 # if defined(__OS2__)
384 # define DirectorySeparator "\\"
385 # define DirectoryListSeparator ';'
386 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
388 # define IsBasenameSeparator(c) \
389 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
390 # define PreferencesDefaults "~\."
391 # define ProcessPendingEvents(text)
392 # define ReadCommandlLine(argc,argv)
393 # define SetNotifyHandlers
395 # if defined(macintosh)
396 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
397 # define DirectorySeparator ":"
398 # define DirectoryListSeparator ';'
399 # define EditorOptions ""
400 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
401 # define MAGICKCORE_LIBRARY_PATH ""
402 # define MAGICKCORE_CODER_PATH ""
403 # define MAGICKCORE_FILTER_PATH ""
404 # define MAGICKCORE_SHARE_PATH ""
405 # define X11_PREFERENCES_PATH "~/."
406 # if defined(DISABLE_SIOUX)
407 # define ReadCommandlLine(argc,argv)
408 # define SetNotifyHandlers \
409 SetFatalErrorHandler(MacFatalErrorHandler); \
410 SetErrorHandler(MACErrorHandler); \
411 SetWarningHandler(MACWarningHandler)
413 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
414 # define SetNotifyHandlers \
415 SetErrorHandler(MACErrorHandler); \
416 SetWarningHandler(MACWarningHandler)
419 # if defined(__WINDOWS__)
420 # define DirectorySeparator "\\"
421 # define DirectoryListSeparator ';'
422 # define EditorOptions ""
423 # define IsBasenameSeparator(c) \
424 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
425 # define ProcessPendingEvents(text)
426 # if !defined(X11_PREFERENCES_PATH)
427 # define X11_PREFERENCES_PATH "~\\."
429 # define ReadCommandlLine(argc,argv)
430 # define SetNotifyHandlers \
431 SetErrorHandler(NTErrorHandler); \
432 SetWarningHandler(NTWarningHandler)
434 # define sleep(seconds) Sleep(seconds*1000)
435 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
436 # define HAVE_TIFFCONF_H
443 Define system symbols if not already defined.
445 #if !defined(STDIN_FILENO)
446 #define STDIN_FILENO 0x00
449 #if !defined(O_BINARY)
450 #define O_BINARY 0x00
453 #if !defined(PATH_MAX)
454 #define PATH_MAX 4096
457 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(__WINDOWS__) && defined(_DLL) && !defined(_LIB))
458 # define MAGICKCORE_MODULES_SUPPORT
461 #if defined(_MAGICKMOD_)
462 # undef MAGICKCORE_BUILD_MODULES
463 # define MAGICKCORE_BUILD_MODULES
469 #if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
470 #define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
471 #define MagickTell(file) _telli64(file)
473 #define MagickSeek(file,offset,whence) lseek(file,offset,whence)
474 #define MagickTell(file) tell(file)
480 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
482 #if defined(__cplusplus) || defined(c_plusplus)