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(__CYGWIN32__)
00026 # if !defined(__CYGWIN__)
00027 # define __CYGWIN__ __CYGWIN32__
00028 # endif
00029 #endif
00030
00031 #if defined(_WIN32) || defined(WIN32)
00032 # if !defined(__WINDOWS__)
00033 # if defined(_WIN32)
00034 # define __WINDOWS__ _WIN32
00035 # else
00036 # if defined(WIN32)
00037 # define __WINDOWS__ WIN32
00038 # endif
00039 # endif
00040 # endif
00041 #endif
00042
00043 #if defined(_WIN64) || defined(WIN64)
00044 # if !defined(__WINDOWS__)
00045 # if defined(_WIN64)
00046 # define __WINDOWS__ _WIN64
00047 # else
00048 # if defined(WIN64)
00049 # define __WINDOWS__ WIN64
00050 # endif
00051 # endif
00052 # endif
00053 #endif
00054
00055 #if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
00056 # define MAGICKCORE_POSIX_SUPPORT
00057 #endif
00058
00059 #define MAGICKCORE_IMPLEMENTATION 1
00060
00061 #if !defined(_MAGICKCORE_CONFIG_H)
00062 # define _MAGICKCORE_CONFIG_H
00063 # if !defined(vms) && !defined(macintosh)
00064 # include "magick/magick-config.h"
00065 # else
00066 # include "magick-config.h"
00067 # endif
00068 # if defined(__cplusplus) || defined(c_plusplus)
00069 # undef inline
00070 # endif
00071 #endif
00072
00073 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
00074 # include "magick/methods.h"
00075 #endif
00076
00077 #if !defined(const)
00078 # define STDC
00079 #endif
00080
00081 #if defined(__BORLANDC__) && defined(_DLL)
00082 # pragma message("BCBMagick lib DLL export interface")
00083 # define _MAGICKDLL_
00084 # define _MAGICKLIB_
00085 # define MAGICKCORE_MODULES_SUPPORT
00086 # undef MAGICKCORE_BUILD_MODULES
00087 #endif
00088
00089 #if defined(__WINDOWS__)
00090 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
00091 # define _MAGICKDLL_
00092 # endif
00093 # if defined(_MAGICKDLL_)
00094 # if defined(_VISUALC_)
00095 # pragma warning( disable: 4273 )
00096 # endif
00097 # if !defined(_MAGICKLIB_)
00098 # define MagickExport __declspec(dllimport)
00099 # if defined(_VISUALC_)
00100 # pragma message( "MagickCore lib DLL import interface" )
00101 # endif
00102 # else
00103 # define MagickExport __declspec(dllexport)
00104 # if defined(_VISUALC_)
00105 # pragma message( "MagickCore lib DLL export interface" )
00106 # endif
00107 # endif
00108 # else
00109 # define MagickExport
00110 # if defined(_VISUALC_)
00111 # pragma message( "MagickCore lib static interface" )
00112 # endif
00113 # endif
00114
00115 # if defined(_DLL) && !defined(_LIB)
00116 # define ModuleExport __declspec(dllexport)
00117 # if defined(_VISUALC_)
00118 # pragma message( "MagickCore module DLL export interface" )
00119 # endif
00120 # else
00121 # define ModuleExport
00122 # if defined(_VISUALC_)
00123 # pragma message( "MagickCore module static interface" )
00124 # endif
00125
00126 # endif
00127 # define MagickGlobal __declspec(thread)
00128 # if defined(_VISUALC_)
00129 # pragma warning(disable : 4018)
00130 # pragma warning(disable : 4068)
00131 # pragma warning(disable : 4244)
00132 # pragma warning(disable : 4142)
00133 # pragma warning(disable : 4800)
00134 # pragma warning(disable : 4786)
00135 # pragma warning(disable : 4996)
00136 # endif
00137 #else
00138 # define MagickExport
00139 # define ModuleExport
00140 # define MagickGlobal
00141 #endif
00142
00143 #define MagickSignature 0xabacadabUL
00144 #if !defined(MaxTextExtent)
00145 # define MaxTextExtent 4096
00146 #endif
00147
00148 #include <stdarg.h>
00149 #include <stdio.h>
00150 #if defined(__WINDOWS__) && defined(_DEBUG)
00151 #define _CRTDBG_MAP_ALLOC
00152 #endif
00153 #include <stdlib.h>
00154 #if !defined(__WINDOWS__)
00155 # include <unistd.h>
00156 #else
00157 # include <direct.h>
00158 # if !defined(MAGICKCORE_HAVE_STRERROR)
00159 # define HAVE_STRERROR
00160 # endif
00161 #endif
00162
00163 #if defined(MAGICKCORE_HAVE_STRINGS_H)
00164 # include <strings.h>
00165 #endif
00166 #include <string.h>
00167 #include <ctype.h>
00168 #include <locale.h>
00169 #include <errno.h>
00170 #include <fcntl.h>
00171 #include <math.h>
00172 #include <time.h>
00173 #include <limits.h>
00174 #include <signal.h>
00175 #include <assert.h>
00176
00177 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
00178 ssize_t pread(int,void *,size_t,off_t);
00179 #endif
00180
00181 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
00182 ssize_t pwrite(int,const void *,size_t,off_t);
00183 #endif
00184
00185 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
00186 extern size_t strlcpy(char *,const char *,size_t);
00187 #endif
00188
00189 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
00190 extern int vsnprintf(char *,size_t,const char *,va_list);
00191 #endif
00192
00193 #if !defined(magick_attribute)
00194 # if !defined(__GNUC__)
00195 # define magick_attribute(x)
00196 # else
00197 # define magick_attribute __attribute__
00198 # endif
00199 #endif
00200
00201 #if !defined(magick_unused)
00202 # if defined(__GNUC__)
00203 # define magick_unused(x) magick_unused_ ## x __attribute__((unused))
00204 # elif defined(__LCLINT__)
00205 # define magick_unused(x) x
00206 # else
00207 # define magick_unused(x) x
00208 # endif
00209 #endif
00210
00211 #if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
00212 # include <sys/types.h>
00213 # include <sys/stat.h>
00214 # if defined(MAGICKCORE_HAVE_FTIME)
00215 # include <sys/timeb.h>
00216 # endif
00217 # if defined(MAGICKCORE_POSIX_SUPPORT)
00218 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
00219 # define dirent direct
00220 # define NAMLEN(dirent) (dirent)->d_namlen
00221 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
00222 # include <sys/ndir.h>
00223 # endif
00224 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
00225 # include <sys/dir.h>
00226 # endif
00227 # if defined(MAGICKCORE_HAVE_NDIR_H)
00228 # include <ndir.h>
00229 # endif
00230 # else
00231 # include <dirent.h>
00232 # define NAMLEN(dirent) strlen((dirent)->d_name)
00233 # endif
00234 # include <sys/wait.h>
00235 # include <pwd.h>
00236 # endif
00237 # if !defined(S_ISDIR)
00238 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
00239 # endif
00240 # if !defined(S_ISREG)
00241 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
00242 # endif
00243 # include "magick/magick-type.h"
00244 # if !defined(__WINDOWS__)
00245 # include <sys/time.h>
00246 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
00247 # include <sys/times.h>
00248 # endif
00249 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
00250 # include <sys/resource.h>
00251 # endif
00252 #endif
00253 #else
00254 # include <types.h>
00255 # include <stat.h>
00256 # if defined(macintosh)
00257 # if !defined(DISABLE_SIOUX)
00258 # include <SIOUX.h>
00259 # include <console.h>
00260 # endif
00261 # include <unix.h>
00262 # endif
00263 # include "magick/magick-type.h"
00264 #endif
00265
00266 #if defined(S_IRUSR) && defined(S_IWUSR)
00267 # define S_MODE (S_IRUSR | S_IWUSR)
00268 #elif defined (__WINDOWS__)
00269 # define S_MODE (_S_IREAD | _S_IWRITE)
00270 #else
00271 # define S_MODE 0600
00272 #endif
00273
00274 #if defined(__WINDOWS__)
00275 # include "magick/nt-base.h"
00276 #endif
00277 #if defined(macintosh)
00278 # include "magick/mac.h"
00279 #endif
00280 #if defined(vms)
00281 # include "magick/vms.h"
00282 #endif
00283
00284 #undef index
00285 #undef pipe
00286
00287
00288
00289
00290 #if defined(MAGICKCORE_POSIX_SUPPORT)
00291 # define DirectorySeparator "/"
00292 # define DirectoryListSeparator ':'
00293 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
00294 # define Exit exit
00295 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
00296 # define X11_PREFERENCES_PATH "~/."
00297 # define ProcessPendingEvents(text)
00298 # define ReadCommandlLine(argc,argv)
00299 # define SetNotifyHandlers
00300 #else
00301 # if defined(vms)
00302 # define X11_APPLICATION_PATH "decw$system_defaults:"
00303 # define DirectorySeparator ""
00304 # define DirectoryListSeparator ';'
00305 # define EditorOptions ""
00306 # define Exit exit
00307 # define IsBasenameSeparator(c) \
00308 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
00309 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
00310 # define MAGICKCORE_CODER_PATH "sys$login:"
00311 # define MAGICKCORE_FILTER_PATH "sys$login:"
00312 # define MAGICKCORE_SHARE_PATH "sys$login:"
00313 # define X11_PREFERENCES_PATH "decw$user_defaults:"
00314 # define ProcessPendingEvents(text)
00315 # define ReadCommandlLine(argc,argv)
00316 # define SetNotifyHandlers
00317 # endif
00318 # if defined(macintosh)
00319 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
00320 # define DirectorySeparator ":"
00321 # define DirectoryListSeparator ';'
00322 # define EditorOptions ""
00323 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
00324 # define MAGICKCORE_LIBRARY_PATH ""
00325 # define MAGICKCORE_CODER_PATH ""
00326 # define MAGICKCORE_FILTER_PATH ""
00327 # define MAGICKCORE_SHARE_PATH ""
00328 # define X11_PREFERENCES_PATH "~/."
00329 # if defined(DISABLE_SIOUX)
00330 # define ReadCommandlLine(argc,argv)
00331 # define SetNotifyHandlers \
00332 SetFatalErrorHandler(MacFatalErrorHandler); \
00333 SetErrorHandler(MACErrorHandler); \
00334 SetWarningHandler(MACWarningHandler)
00335 # else
00336 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
00337 # define SetNotifyHandlers \
00338 SetErrorHandler(MACErrorHandler); \
00339 SetWarningHandler(MACWarningHandler)
00340 # endif
00341 # endif
00342 # if defined(__WINDOWS__)
00343 # define DirectorySeparator "\\"
00344 # define DirectoryListSeparator ';'
00345 # define EditorOptions ""
00346 # define IsBasenameSeparator(c) \
00347 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
00348 # define ProcessPendingEvents(text)
00349 # if !defined(X11_PREFERENCES_PATH)
00350 # define X11_PREFERENCES_PATH "~\\."
00351 # endif
00352 # define ReadCommandlLine(argc,argv)
00353 # define SetNotifyHandlers \
00354 SetErrorHandler(NTErrorHandler); \
00355 SetWarningHandler(NTWarningHandler)
00356 # undef sleep
00357 # define sleep(seconds) Sleep(seconds*1000)
00358 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
00359 # define HAVE_TIFFCONF_H
00360 # endif
00361 # endif
00362
00363 #endif
00364
00365
00366
00367
00368 #if !defined(STDIN_FILENO)
00369 #define STDIN_FILENO 0x00
00370 #endif
00371
00372 #if !defined(O_BINARY)
00373 #define O_BINARY 0x00
00374 #endif
00375
00376 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(__WINDOWS__) && defined(_DLL) && !defined(_LIB))
00377 # define MAGICKCORE_MODULES_SUPPORT
00378 #endif
00379
00380 #if defined(_MAGICKMOD_)
00381 # undef MAGICKCORE_BUILD_MODULES
00382 # define MAGICKCORE_BUILD_MODULES
00383 #endif
00384
00385
00386
00387
00388 #if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
00389 #define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
00390 #define MagickTell(file) _telli64(file)
00391 #else
00392 #define MagickSeek(file,offset,whence) lseek(file,offset,whence)
00393 #define MagickTell(file) tell(file)
00394 #endif
00395
00396
00397
00398
00399 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
00400
00401 #if defined(__cplusplus) || defined(c_plusplus)
00402 }
00403 #endif
00404
00405 #endif