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 #ifdef _MSC_VER
00136 #pragma comment (lib, "ws2_32.lib")
00137 #endif
00138 #endif
00139 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
00140 # include <sys/syslimits.h>
00141 #endif
00142 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
00143 # include <arm/limits.h>
00144 #endif
00145
00146 #if defined(MAGICKCORE__OPENCL) && !defined(MAGICK_PIXEL_RGBA)
00147 #if defined(MAGICKCORE_HAVE_CL_CL_H)
00148 # include <CL/cl.h>
00149 #endif
00150 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
00151 # include <OpenCL/cl.h>
00152 #endif
00153 # define MAGICKCORE_OPENCL_SUPPORT 1
00154 #endif
00155
00156 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
00157 # include <omp.h>
00158 # define MAGICKCORE_OPENMP_SUPPORT 1
00159 #endif
00160
00161 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
00162 ssize_t pread(int,void *,size_t,off_t);
00163 #endif
00164
00165 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
00166 ssize_t pwrite(int,const void *,size_t,off_t);
00167 #endif
00168
00169 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
00170 extern size_t strlcpy(char *,const char *,size_t);
00171 #endif
00172
00173 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
00174 extern int vsnprintf(char *,size_t,const char *,va_list);
00175 #endif
00176
00177 #include "magick/method-attribute.h"
00178
00179 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
00180 # include <sys/types.h>
00181 # include <sys/stat.h>
00182 # if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
00183 # include <sys/timeb.h>
00184 # endif
00185 # if defined(MAGICKCORE_POSIX_SUPPORT)
00186 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
00187 # define dirent direct
00188 # define NAMLEN(dirent) (dirent)->d_namlen
00189 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
00190 # include <sys/ndir.h>
00191 # endif
00192 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
00193 # include <sys/dir.h>
00194 # endif
00195 # if defined(MAGICKCORE_HAVE_NDIR_H)
00196 # include <ndir.h>
00197 # endif
00198 # else
00199 # include <dirent.h>
00200 # define NAMLEN(dirent) strlen((dirent)->d_name)
00201 # endif
00202 # include <sys/wait.h>
00203 # include <pwd.h>
00204 # endif
00205 # if !defined(S_ISDIR)
00206 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
00207 # endif
00208 # if !defined(S_ISREG)
00209 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
00210 # endif
00211 # include "magick/magick-type.h"
00212 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
00213 # include <sys/time.h>
00214 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
00215 # include <sys/times.h>
00216 # endif
00217 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
00218 # include <sys/resource.h>
00219 # endif
00220 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
00221 # include <sys/mman.h>
00222 # endif
00223 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
00224 # include <sys/sendfile.h>
00225 # endif
00226 # if defined(MAGICKCORE_HAVE_SYS_SOCKET_H)
00227 # include <sys/socket.h>
00228 # endif
00229 # if defined(MAGICKCORE_HAVE_SYS_UIO_H)
00230 # include <sys/uio.h>
00231 # endif
00232 #endif
00233 #else
00234 # include <types.h>
00235 # include <stat.h>
00236 # if defined(macintosh)
00237 # if !defined(DISABLE_SIOUX)
00238 # include <SIOUX.h>
00239 # include <console.h>
00240 # endif
00241 # include <unix.h>
00242 # endif
00243 # include "magick/magick-type.h"
00244 #endif
00245
00246 #if defined(S_IRUSR) && defined(S_IWUSR)
00247 # define S_MODE (S_IRUSR | S_IWUSR)
00248 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
00249 # define S_MODE (_S_IREAD | _S_IWRITE)
00250 #else
00251 # define S_MODE 0600
00252 #endif
00253
00254 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
00255 # include "magick/nt-base.h"
00256 #endif
00257 #if defined(macintosh)
00258 # include "magick/mac.h"
00259 #endif
00260 #if defined(vms)
00261 # include "magick/vms.h"
00262 #endif
00263
00264 #undef HAVE_CONFIG_H
00265 #undef gamma
00266 #undef index
00267 #undef pipe
00268 #undef y1
00269
00270
00271
00272
00273 #if ( defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__) ) && !defined( __VMS )
00274 # define DirectorySeparator "/"
00275 # define DirectoryListSeparator ':'
00276 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
00277 # define Exit exit
00278 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
00279 # define X11_PREFERENCES_PATH "~/."
00280 # define ProcessPendingEvents(text)
00281 # define ReadCommandlLine(argc,argv)
00282 # define SetNotifyHandlers
00283 #else
00284 # if defined(vms)
00285 # define X11_APPLICATION_PATH "decw$system_defaults:"
00286 # define DirectorySeparator ""
00287 # define DirectoryListSeparator ';'
00288 # define EditorOptions ""
00289 # define Exit exit
00290 # define IsBasenameSeparator(c) \
00291 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
00292 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
00293 # define MAGICKCORE_SHARE_PATH "sys$login:"
00294 # define X11_PREFERENCES_PATH "decw$user_defaults:"
00295 # define ProcessPendingEvents(text)
00296 # define ReadCommandlLine(argc,argv)
00297 # define SetNotifyHandlers
00298 # endif
00299 # if defined(__OS2__)
00300 # define DirectorySeparator "\\"
00301 # define DirectoryListSeparator ';'
00302 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
00303 # define Exit exit
00304 # define IsBasenameSeparator(c) \
00305 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
00306 # define PreferencesDefaults "~\."
00307 # define ProcessPendingEvents(text)
00308 # define ReadCommandlLine(argc,argv)
00309 # define SetNotifyHandlers
00310 #endif
00311 # if defined(macintosh)
00312 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
00313 # define DirectorySeparator ":"
00314 # define DirectoryListSeparator ';'
00315 # define EditorOptions ""
00316 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
00317 # define MAGICKCORE_LIBRARY_PATH ""
00318 # define MAGICKCORE_SHARE_PATH ""
00319 # define X11_PREFERENCES_PATH "~/."
00320 # if defined(DISABLE_SIOUX)
00321 # define ReadCommandlLine(argc,argv)
00322 # define SetNotifyHandlers \
00323 SetFatalErrorHandler(MacFatalErrorHandler); \
00324 SetErrorHandler(MACErrorHandler); \
00325 SetWarningHandler(MACWarningHandler)
00326 # else
00327 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
00328 # define SetNotifyHandlers \
00329 SetErrorHandler(MACErrorHandler); \
00330 SetWarningHandler(MACWarningHandler)
00331 # endif
00332 # endif
00333 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
00334 # define DirectorySeparator "\\"
00335 # define DirectoryListSeparator ';'
00336 # define EditorOptions ""
00337 # define IsBasenameSeparator(c) \
00338 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
00339 # define ProcessPendingEvents(text)
00340 # if !defined(X11_PREFERENCES_PATH)
00341 # define X11_PREFERENCES_PATH "~\\."
00342 # endif
00343 # define ReadCommandlLine(argc,argv)
00344 # define SetNotifyHandlers \
00345 SetErrorHandler(NTErrorHandler); \
00346 SetWarningHandler(NTWarningHandler)
00347 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
00348 # define HAVE_TIFFCONF_H
00349 # endif
00350 # endif
00351
00352 #endif
00353
00354
00355
00356
00357 #if !defined(STDIN_FILENO)
00358 #define STDIN_FILENO 0x00
00359 #endif
00360
00361 #if !defined(O_BINARY)
00362 #define O_BINARY 0x00
00363 #endif
00364
00365 #if !defined(PATH_MAX)
00366 #define PATH_MAX 4096
00367 #endif
00368
00369 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
00370 # define MAGICKCORE_MODULES_SUPPORT
00371 #endif
00372
00373 #if defined(_MAGICKMOD_)
00374 # undef MAGICKCORE_BUILD_MODULES
00375 # define MAGICKCORE_BUILD_MODULES
00376 #endif
00377
00378
00379
00380
00381 #define MagickMaxRecursionDepth 600
00382 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
00383 #if defined(_MSC_VER)
00384 # define DisableMSCWarning(nr) __pragma(warning(push)) \
00385 __pragma(warning(disable:nr))
00386 # define RestoreMSCWarning __pragma(warning(pop))
00387 #else
00388 # define DisableMSCWarning(nr)
00389 # define RestoreMSCWarning
00390 #endif
00391
00392 #if defined(__cplusplus) || defined(c_plusplus)
00393 }
00394 #endif
00395
00396 #endif