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(WIN32) || defined(WIN64)
26 # define MAGICKCORE_WINDOWS_SUPPORT
28 # define MAGICKCORE_POSIX_SUPPORT
31 #define MAGICKCORE_IMPLEMENTATION 1
33 #if !defined(_MAGICKCORE_CONFIG_H)
34 # define _MAGICKCORE_CONFIG_H
35 # if !defined(vms) && !defined(macintosh)
36 # include "magick/magick-config.h"
38 # include "magick-config.h"
40 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
41 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
43 #if defined(_magickcore_const) && !defined(const)
44 # define const _magickcore_const
46 #if defined(_magickcore_inline) && !defined(inline)
47 # define inline _magickcore_inline
49 # if defined(__cplusplus) || defined(c_plusplus)
52 #if defined(_magickcore_restrict) && !defined(restrict)
53 # define restrict _magickcore_restrict
57 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
58 # include "magick/methods.h"
65 #if defined(__BORLANDC__) && defined(_DLL)
66 # pragma message("BCBMagick lib DLL export interface")
69 # define MAGICKCORE_MODULES_SUPPORT
70 # undef MAGICKCORE_BUILD_MODULES
73 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
74 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
77 # if defined(_MAGICKDLL_)
78 # if defined(_VISUALC_)
79 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
81 # if !defined(_MAGICKLIB_)
82 # define MagickExport __declspec(dllimport)
83 # if defined(_VISUALC_)
84 # pragma message( "MagickCore lib DLL import interface" )
87 # define MagickExport __declspec(dllexport)
88 # if defined(_VISUALC_)
89 # pragma message( "MagickCore lib DLL export interface" )
94 # if defined(_VISUALC_)
95 # pragma message( "MagickCore lib static interface" )
99 # if defined(_DLL) && !defined(_LIB)
100 # define ModuleExport __declspec(dllexport)
101 # if defined(_VISUALC_)
102 # pragma message( "MagickCore module DLL export interface" )
105 # define ModuleExport
106 # if defined(_VISUALC_)
107 # pragma message( "MagickCore module static interface" )
111 # define MagickGlobal __declspec(thread)
112 # if defined(_VISUALC_)
113 # pragma warning(disable : 4018)
114 # pragma warning(disable : 4068)
115 # pragma warning(disable : 4244)
116 # pragma warning(disable : 4142)
117 # pragma warning(disable : 4800)
118 # pragma warning(disable : 4786)
119 # pragma warning(disable : 4996)
122 # define MagickExport
123 # define ModuleExport
124 # define MagickGlobal
127 #define MagickSignature 0xabacadabUL
128 #if !defined(MaxTextExtent)
129 # define MaxTextExtent 4096
134 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
135 # include <sys/stat.h>
137 #if defined(MAGICKCORE_STDC_HEADERS)
141 # if defined(MAGICKCORE_HAVE_STDLIB_H)
145 #if defined(MAGICKCORE_HAVE_STRING_H)
146 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
151 #if defined(MAGICKCORE_HAVE_STRINGS_H)
152 # include <strings.h>
154 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
155 # include <inttypes.h>
157 #if defined(MAGICKCORE_HAVE_STDINT_H)
160 #if defined(MAGICKCORE_HAVE_UNISTD_H)
163 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
164 #define _CRTDBG_MAP_ALLOC
166 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
168 # if !defined(MAGICKCORE_HAVE_STRERROR)
169 # define HAVE_STRERROR
183 #if defined(MAGICKCORE_THREAD_SUPPORT)
184 # include <pthread.h>
185 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
186 # define MAGICKCORE_HAVE_WINTHREADS 1
189 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
190 # include <sys/syslimits.h>
192 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
193 # include <arm/limits.h>
196 #if defined(MAGICKCORE__OPENCL)
197 #if defined(MAGICKCORE_HAVE_CL_CL_H)
200 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
201 # include <OpenCL/cl.h>
203 # define MAGICKCORE_OPENCL_SUPPORT 1
206 #if defined(_OPENMP) && (_OPENMP >= 200203)
208 # define MAGICKCORE_OPENMP_SUPPORT 1
211 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
212 ssize_t pread(int,void *,size_t,off_t);
215 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
216 ssize_t pwrite(int,const void *,size_t,off_t);
219 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
220 extern size_t strlcpy(char *,const char *,size_t);
223 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
224 extern int vsnprintf(char *,size_t,const char *,va_list);
227 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
228 # define magick_aligned(x) __attribute__((aligned(x)))
229 # define magick_attribute __attribute__
230 # define magick_unused(x) magick_unused_ ## x __attribute__((unused))
232 # define magick_aligned(x) /* nothing */
233 # define magick_attribute(x) /* nothing */
234 # define magick_unused(x) x
237 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
238 # include <sys/types.h>
239 # include <sys/stat.h>
240 # if defined(MAGICKCORE_HAVE_FTIME)
241 # include <sys/timeb.h>
243 # if defined(MAGICKCORE_POSIX_SUPPORT)
244 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
245 # define dirent direct
246 # define NAMLEN(dirent) (dirent)->d_namlen
247 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
248 # include <sys/ndir.h>
250 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
251 # include <sys/dir.h>
253 # if defined(MAGICKCORE_HAVE_NDIR_H)
258 # define NAMLEN(dirent) strlen((dirent)->d_name)
260 # include <sys/wait.h>
263 # if !defined(S_ISDIR)
264 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
266 # if !defined(S_ISREG)
267 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
269 # include "magick/magick-type.h"
270 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
271 # include <sys/time.h>
272 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
273 # include <sys/times.h>
275 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
276 # include <sys/resource.h>
282 # if defined(macintosh)
283 # if !defined(DISABLE_SIOUX)
285 # include <console.h>
289 # include "magick/magick-type.h"
292 #if defined(S_IRUSR) && defined(S_IWUSR)
293 # define S_MODE (S_IRUSR | S_IWUSR)
294 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
295 # define S_MODE (_S_IREAD | _S_IWRITE)
300 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
301 # include "magick/nt-base.h"
303 #if defined(macintosh)
304 # include "magick/mac.h"
307 # include "magick/vms.h"
317 Review these platform specific definitions.
319 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
320 # define DirectorySeparator "/"
321 # define DirectoryListSeparator ':'
322 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
324 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
325 # define X11_PREFERENCES_PATH "~/."
326 # define ProcessPendingEvents(text)
327 # define ReadCommandlLine(argc,argv)
328 # define SetNotifyHandlers
331 # define X11_APPLICATION_PATH "decw$system_defaults:"
332 # define DirectorySeparator ""
333 # define DirectoryListSeparator ';'
334 # define EditorOptions ""
336 # define IsBasenameSeparator(c) \
337 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
338 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
339 # define MAGICKCORE_CODER_PATH "sys$login:"
340 # define MAGICKCORE_FILTER_PATH "sys$login:"
341 # define MAGICKCORE_SHARE_PATH "sys$login:"
342 # define X11_PREFERENCES_PATH "decw$user_defaults:"
343 # define ProcessPendingEvents(text)
344 # define ReadCommandlLine(argc,argv)
345 # define SetNotifyHandlers
347 # if defined(__OS2__)
348 # define DirectorySeparator "\\"
349 # define DirectoryListSeparator ';'
350 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
352 # define IsBasenameSeparator(c) \
353 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
354 # define PreferencesDefaults "~\."
355 # define ProcessPendingEvents(text)
356 # define ReadCommandlLine(argc,argv)
357 # define SetNotifyHandlers
359 # if defined(macintosh)
360 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
361 # define DirectorySeparator ":"
362 # define DirectoryListSeparator ';'
363 # define EditorOptions ""
364 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
365 # define MAGICKCORE_LIBRARY_PATH ""
366 # define MAGICKCORE_CODER_PATH ""
367 # define MAGICKCORE_FILTER_PATH ""
368 # define MAGICKCORE_SHARE_PATH ""
369 # define X11_PREFERENCES_PATH "~/."
370 # if defined(DISABLE_SIOUX)
371 # define ReadCommandlLine(argc,argv)
372 # define SetNotifyHandlers \
373 SetFatalErrorHandler(MacFatalErrorHandler); \
374 SetErrorHandler(MACErrorHandler); \
375 SetWarningHandler(MACWarningHandler)
377 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
378 # define SetNotifyHandlers \
379 SetErrorHandler(MACErrorHandler); \
380 SetWarningHandler(MACWarningHandler)
383 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
384 # define DirectorySeparator "\\"
385 # define DirectoryListSeparator ';'
386 # define EditorOptions ""
387 # define IsBasenameSeparator(c) \
388 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
389 # define ProcessPendingEvents(text)
390 # if !defined(X11_PREFERENCES_PATH)
391 # define X11_PREFERENCES_PATH "~\\."
393 # define ReadCommandlLine(argc,argv)
394 # define SetNotifyHandlers \
395 SetErrorHandler(NTErrorHandler); \
396 SetWarningHandler(NTWarningHandler)
398 # define sleep(seconds) Sleep(seconds*1000)
399 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
400 # define HAVE_TIFFCONF_H
407 Define system symbols if not already defined.
409 #if !defined(STDIN_FILENO)
410 #define STDIN_FILENO 0x00
413 #if !defined(O_BINARY)
414 #define O_BINARY 0x00
417 #if !defined(PATH_MAX)
418 #define PATH_MAX 4096
421 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
422 # define MAGICKCORE_MODULES_SUPPORT
425 #if defined(_MAGICKMOD_)
426 # undef MAGICKCORE_BUILD_MODULES
427 # define MAGICKCORE_BUILD_MODULES
433 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && !defined(__BORLANDC__)
434 #define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
435 #define MagickTell(file) _telli64(file)
437 #define MagickSeek(file,offset,whence) lseek(file,offset,whence)
438 #define MagickTell(file) tell(file)
444 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
446 #if defined(__cplusplus) || defined(c_plusplus)