00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MAGICKCORE_STUDIO_H
00019 #define MAGICKCORE_STUDIO_H
00020
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024
00025 #if defined(WIN32) || defined(WIN64)
00026 # define MAGICKCORE_WINDOWS_SUPPORT
00027 #else
00028 # define MAGICKCORE_POSIX_SUPPORT
00029 #endif
00030
00031 #define MAGICKCORE_IMPLEMENTATION 1
00032
00033 #if !defined(MAGICKCORE_CONFIG_H)
00034 # define MAGICKCORE_CONFIG_H
00035 # if !defined(vms) && !defined(macintosh)
00036 # include "magick/magick-config.h"
00037 # else
00038 # include "magick-config.h"
00039 # endif
00040 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
00041 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
00042 #endif
00043 #if defined(_magickcore_const) && !defined(const)
00044 # define const _magickcore_const
00045 #endif
00046 #if defined(_magickcore_inline) && !defined(inline)
00047 # define inline _magickcore_inline
00048 #endif
00049 # if defined(__cplusplus) || defined(c_plusplus)
00050 # undef inline
00051 # endif
00052 #endif
00053
00054 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
00055 # include "magick/methods.h"
00056 #endif
00057
00058 #if !defined(const)
00059 # define STDC
00060 #endif
00061
00062 #include <stdarg.h>
00063 #include <stdio.h>
00064 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
00065 # include <sys/stat.h>
00066 #endif
00067 #if defined(MAGICKCORE_STDC_HEADERS)
00068 # include <stdlib.h>
00069 # include <stddef.h>
00070 #else
00071 # if defined(MAGICKCORE_HAVE_STDLIB_H)
00072 # include <stdlib.h>
00073 # endif
00074 #endif
00075 #if !defined(magick_restrict)
00076 # if !defined(_magickcore_restrict)
00077 # define magick_restrict restrict
00078 # else
00079 # define magick_restrict _magickcore_restrict
00080 # endif
00081 #endif
00082 #if defined(MAGICKCORE_HAVE_STRING_H)
00083 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
00084 # include <memory.h>
00085 # endif
00086 # include <string.h>
00087 #endif
00088 #if defined(MAGICKCORE_HAVE_STRINGS_H)
00089 # include <strings.h>
00090 #endif
00091 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
00092 # include <inttypes.h>
00093 #endif
00094 #if defined(MAGICKCORE_HAVE_STDINT_H)
00095 # include <stdint.h>
00096 #endif
00097 #if defined(MAGICKCORE_HAVE_UNISTD_H)
00098 # include <unistd.h>
00099 #endif
00100 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
00101 #define _CRTDBG_MAP_ALLOC
00102 #endif
00103 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
00104 # include <io.h>
00105 #if !defined(__CYGWIN__)
00106 # include <direct.h>
00107 #endif
00108 # if !defined(MAGICKCORE_HAVE_STRERROR)
00109 # define HAVE_STRERROR
00110 # endif
00111 #endif
00112
00113 #include <ctype.h>
00114 #include <locale.h>
00115 #include <errno.h>
00116 #include <fcntl.h>
00117 #include <math.h>
00118 #include <time.h>
00119 #include <limits.h>
00120 #include <signal.h>
00121 #include <assert.h>
00122
00123 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
00124 # include <xlocale.h>
00125 #endif
00126 #if defined(MAGICKCORE_THREAD_SUPPORT)
00127 # include <pthread.h>
00128 #endif
00129 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
00130 #if !defined(__CYGWIN__)
00131 #include <winsock2.h>
00132 #include <ws2tcpip.h>
00133 #endif
00134 #include <windows.h>
00135 #pragma comment (lib, "ws2_32.lib")
00136 #endif
00137 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
00138 # include <sys/syslimits.h>
00139 #endif
00140 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
00141 # include <arm/limits.h>
00142 #endif
00143
00144 #if defined(MAGICKCORE__OPENCL) && !defined(MAGICK_PIXEL_RGBA)
00145 #if defined(MAGICKCORE_HAVE_CL_CL_H)
00146 # include <CL/cl.h>
00147 #endif
00148 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
00149 # include <OpenCL/cl.h>
00150 #endif
00151 # define MAGICKCORE_OPENCL_SUPPORT 1
00152 #endif
00153
00154 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
00155 # include <omp.h>
00156 # define MAGICKCORE_OPENMP_SUPPORT 1
00157 #endif
00158
00159 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
00160 ssize_t pread(int,void *,size_t,off_t);
00161 #endif
00162
00163 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
00164 ssize_t pwrite(int,const void *,size_t,off_t);
00165 #endif
00166
00167 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
00168 extern size_t strlcpy(char *,const char *,size_t);
00169 #endif
00170
00171 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
00172 extern int vsnprintf(char *,size_t,const char *,va_list);
00173 #endif
00174
00175 #include "magick/method-attribute.h"
00176
00177 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
00178 # include <sys/types.h>
00179 # include <sys/stat.h>
00180 # if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
00181 # include <sys/timeb.h>
00182 # endif
00183 # if defined(MAGICKCORE_POSIX_SUPPORT)
00184 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
00185 # define dirent direct
00186 # define NAMLEN(dirent) (dirent)->d_namlen
00187 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
00188 # include <sys/ndir.h>
00189 # endif
00190 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
00191 # include <sys/dir.h>
00192 # endif
00193 # if defined(MAGICKCORE_HAVE_NDIR_H)
00194 # include <ndir.h>
00195 # endif
00196 # else
00197 # include <dirent.h>
00198 # define NAMLEN(dirent) strlen((dirent)->d_name)
00199 # endif
00200 # include <sys/wait.h>
00201 # include <pwd.h>
00202 # endif
00203 # if !defined(S_ISDIR)
00204 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
00205 # endif
00206 # if !defined(S_ISREG)
00207 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
00208 # endif
00209 # include "magick/magick-type.h"
00210 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
00211 # include <sys/time.h>
00212 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
00213 # include <sys/times.h>
00214 # endif
00215 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
00216 # include <sys/resource.h>
00217 # endif
00218 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
00219 # include <sys/mman.h>
00220 # endif
00221 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
00222 # include <sys/sendfile.h>
00223 # endif
00224 #endif
00225 #else
00226 # include <types.h>
00227 # include <stat.h>
00228 # if defined(macintosh)
00229 # if !defined(DISABLE_SIOUX)
00230 # include <SIOUX.h>
00231 # include <console.h>
00232 # endif
00233 # include <unix.h>
00234 # endif
00235 # include "magick/magick-type.h"
00236 #endif
00237
00238 #if defined(S_IRUSR) && defined(S_IWUSR)
00239 # define S_MODE (S_IRUSR | S_IWUSR)
00240 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
00241 # define S_MODE (_S_IREAD | _S_IWRITE)
00242 #else
00243 # define S_MODE 0600
00244 #endif
00245
00246 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
00247 # include "magick/nt-base.h"
00248 #endif
00249 #if defined(macintosh)
00250 # include "magick/mac.h"
00251 #endif
00252 #if defined(vms)
00253 # include "magick/vms.h"
00254 #endif
00255
00256 #undef HAVE_CONFIG_H
00257 #undef gamma
00258 #undef index
00259 #undef pipe
00260 #undef y1
00261
00262
00263
00264
00265 #if ( defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__) ) && !defined( __VMS )
00266 # define DirectorySeparator "/"
00267 # define DirectoryListSeparator ':'
00268 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
00269 # define Exit exit
00270 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
00271 # define X11_PREFERENCES_PATH "~/."
00272 # define ProcessPendingEvents(text)
00273 # define ReadCommandlLine(argc,argv)
00274 # define SetNotifyHandlers
00275 #else
00276 # if defined(vms)
00277 # define X11_APPLICATION_PATH "decw$system_defaults:"
00278 # define DirectorySeparator ""
00279 # define DirectoryListSeparator ';'
00280 # define EditorOptions ""
00281 # define Exit exit
00282 # define IsBasenameSeparator(c) \
00283 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
00284 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
00285 # define MAGICKCORE_SHARE_PATH "sys$login:"
00286 # define X11_PREFERENCES_PATH "decw$user_defaults:"
00287 # define ProcessPendingEvents(text)
00288 # define ReadCommandlLine(argc,argv)
00289 # define SetNotifyHandlers
00290 # endif
00291 # if defined(__OS2__)
00292 # define DirectorySeparator "\\"
00293 # define DirectoryListSeparator ';'
00294 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
00295 # define Exit exit
00296 # define IsBasenameSeparator(c) \
00297 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
00298 # define PreferencesDefaults "~\."
00299 # define ProcessPendingEvents(text)
00300 # define ReadCommandlLine(argc,argv)
00301 # define SetNotifyHandlers
00302 #endif
00303 # if defined(macintosh)
00304 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
00305 # define DirectorySeparator ":"
00306 # define DirectoryListSeparator ';'
00307 # define EditorOptions ""
00308 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
00309 # define MAGICKCORE_LIBRARY_PATH ""
00310 # define MAGICKCORE_SHARE_PATH ""
00311 # define X11_PREFERENCES_PATH "~/."
00312 # if defined(DISABLE_SIOUX)
00313 # define ReadCommandlLine(argc,argv)
00314 # define SetNotifyHandlers \
00315 SetFatalErrorHandler(MacFatalErrorHandler); \
00316 SetErrorHandler(MACErrorHandler); \
00317 SetWarningHandler(MACWarningHandler)
00318 # else
00319 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
00320 # define SetNotifyHandlers \
00321 SetErrorHandler(MACErrorHandler); \
00322 SetWarningHandler(MACWarningHandler)
00323 # endif
00324 # endif
00325 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
00326 # define DirectorySeparator "\\"
00327 # define DirectoryListSeparator ';'
00328 # define EditorOptions ""
00329 # define IsBasenameSeparator(c) \
00330 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
00331 # define ProcessPendingEvents(text)
00332 # if !defined(X11_PREFERENCES_PATH)
00333 # define X11_PREFERENCES_PATH "~\\."
00334 # endif
00335 # define ReadCommandlLine(argc,argv)
00336 # define SetNotifyHandlers \
00337 SetErrorHandler(NTErrorHandler); \
00338 SetWarningHandler(NTWarningHandler)
00339 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
00340 # define HAVE_TIFFCONF_H
00341 # endif
00342 # endif
00343
00344 #endif
00345
00346
00347
00348
00349 #if !defined(STDIN_FILENO)
00350 #define STDIN_FILENO 0x00
00351 #endif
00352
00353 #if !defined(O_BINARY)
00354 #define O_BINARY 0x00
00355 #endif
00356
00357 #if !defined(PATH_MAX)
00358 #define PATH_MAX 4096
00359 #endif
00360
00361 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
00362 # define MAGICKCORE_MODULES_SUPPORT
00363 #endif
00364
00365 #if defined(_MAGICKMOD_)
00366 # undef MAGICKCORE_BUILD_MODULES
00367 # define MAGICKCORE_BUILD_MODULES
00368 #endif
00369
00370
00371
00372
00373 #define MagickMaxRecursionDepth 600
00374 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
00375 #if defined(_MSC_VER)
00376 # define DisableMSCWarning(nr) __pragma(warning(push)) \
00377 __pragma(warning(disable:nr))
00378 # define RestoreMSCWarning __pragma(warning(pop))
00379 #else
00380 # define DisableMSCWarning(nr)
00381 # define RestoreMSCWarning
00382 #endif
00383
00384 #if defined(__cplusplus) || defined(c_plusplus)
00385 }
00386 #endif
00387
00388 #endif