|
MagickWand
6.7.5
|
00001 /* 00002 Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization 00003 dedicated to making software imaging solutions freely available. 00004 00005 You may not use this file except in compliance with the License. 00006 obtain a copy of the License at 00007 00008 http://www.imagemagick.org/script/license.php 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 00016 MagickWand private application programming interface declarations. 00017 */ 00018 #ifndef _MAGICKWAND_STUDIO_H 00019 #define _MAGICKWAND_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 MAGICKWAND_IMPLEMENTATION 1 00032 00033 #if !defined(_MAGICKWAND_CONFIG_H) 00034 # define _MAGICKWAND_CONFIG_H 00035 # if !defined(vms) && !defined(macintosh) 00036 # include "MagickCore/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(_magickcore_restrict) && !defined(restrict) 00050 # define restrict _magickcore_restrict 00051 #endif 00052 # if defined(__cplusplus) || defined(c_plusplus) 00053 # undef inline 00054 # endif 00055 #endif 00056 00057 #if !defined(const) 00058 # define STDC 00059 #endif 00060 00061 #if defined(__BORLANDC__) && defined(_DLL) 00062 # pragma message("BCBMagick lib DLL export interface") 00063 # define _MAGICKDLL_ 00064 # define _MAGICKLIB_ 00065 #endif 00066 00067 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) 00068 # define WandPrivate 00069 # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB) 00070 # define _MAGICKDLL_ 00071 # endif 00072 # if defined(_MAGICKDLL_) 00073 # if defined(_VISUALC_) 00074 # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */ 00075 # endif 00076 # if !defined(_MAGICKLIB_) 00077 # if defined(__GNUC__) 00078 # define WandExport __attribute__ ((dllimport)) 00079 # else 00080 # define WandExport __declspec(dllimport) 00081 # endif 00082 # if defined(_VISUALC_) 00083 # pragma message( "MagickWand lib DLL import interface" ) 00084 # endif 00085 # else 00086 # if defined(__GNUC__) 00087 # define WandExport __attribute__ ((dllexport)) 00088 # else 00089 # define WandExport __declspec(dllexport) 00090 # endif 00091 # if defined(_VISUALC_) 00092 # pragma message( "MagickWand lib DLL export interface" ) 00093 # endif 00094 # endif 00095 # else 00096 # define WandExport 00097 # if defined(_VISUALC_) 00098 # pragma message( "MagickWand lib static interface" ) 00099 # endif 00100 # endif 00101 00102 # if defined(_DLL) && !defined(_LIB) 00103 # define ModuleExport __declspec(dllexport) 00104 # if defined(_VISUALC_) 00105 # pragma message( "MagickWand module DLL export interface" ) 00106 # endif 00107 # else 00108 # define ModuleExport 00109 # if defined(_VISUALC_) 00110 # pragma message( "MagickWand module static interface" ) 00111 # endif 00112 00113 # endif 00114 # define WandGlobal __declspec(thread) 00115 # if defined(_VISUALC_) 00116 # pragma warning(disable : 4018) 00117 # pragma warning(disable : 4068) 00118 # pragma warning(disable : 4244) 00119 # pragma warning(disable : 4142) 00120 # pragma warning(disable : 4800) 00121 # pragma warning(disable : 4786) 00122 # pragma warning(disable : 4996) 00123 # endif 00124 #else 00125 # if __GNUC__ >= 4 00126 # define WandExport __attribute__ ((visibility ("default"))) 00127 # define WandPrivate __attribute__ ((visibility ("hidden"))) 00128 # else 00129 # define WandExport 00130 # define WandPrivate 00131 # endif 00132 # define WandGlobal 00133 #endif 00134 00135 #if defined(__cplusplus) || defined(c_plusplus) 00136 # define storage_class c_class 00137 #else 00138 # define storage_class class 00139 #endif 00140 00141 #define WandSignature 0xabacadabUL 00142 #if !defined(MaxTextExtent) 00143 # define MaxTextExtent 4096 00144 #endif 00145 00146 #include <stdarg.h> 00147 #include <stdio.h> 00148 #if defined(MAGICKCORE_HAVE_SYS_STAT_H) 00149 # include <sys/stat.h> 00150 #endif 00151 #if defined(MAGICKCORE_STDC_HEADERS) 00152 # include <stdlib.h> 00153 # include <stddef.h> 00154 #else 00155 # if defined(MAGICKCORE_HAVE_STDLIB_H) 00156 # include <stdlib.h> 00157 # endif 00158 #endif 00159 #if defined(MAGICKCORE_HAVE_STRING_H) 00160 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H) 00161 # include <memory.h> 00162 # endif 00163 # include <string.h> 00164 #endif 00165 #if defined(MAGICKCORE_HAVE_STRINGS_H) 00166 # include <strings.h> 00167 #endif 00168 #if defined(MAGICKCORE_HAVE_INTTYPES_H) 00169 # include <inttypes.h> 00170 #endif 00171 #if defined(MAGICKCORE_HAVE_STDINT_H) 00172 # include <stdint.h> 00173 #endif 00174 #if defined(MAGICKCORE_HAVE_UNISTD_H) 00175 # include <unistd.h> 00176 #endif 00177 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG) 00178 #define _CRTDBG_MAP_ALLOC 00179 #endif 00180 #if defined(MAGICKCORE_WINDOWS_SUPPORT) 00181 # include <direct.h> 00182 # if !defined(MAGICKCORE_HAVE_STRERROR) 00183 # define HAVE_STRERROR 00184 # endif 00185 #endif 00186 00187 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG) 00188 #define _CRTDBG_MAP_ALLOC 00189 #endif 00190 #if defined(MAGICKCORE_WINDOWS_SUPPORT) 00191 # include <direct.h> 00192 # if !defined(MAGICKCORE_HAVE_STRERROR) 00193 # define HAVE_STRERROR 00194 # endif 00195 #endif 00196 00197 #include <ctype.h> 00198 #include <locale.h> 00199 #include <errno.h> 00200 #include <fcntl.h> 00201 #include <math.h> 00202 #include <time.h> 00203 #include <limits.h> 00204 #include <signal.h> 00205 #include <assert.h> 00206 00207 #if defined(MAGICKCORE_HAVE_XLOCALE_H) 00208 # include <xlocale.h> 00209 #endif 00210 #if defined(MAGICKCORE_THREAD_SUPPORT) 00211 # include <pthread.h> 00212 #elif defined(MAGICKCORE_WINDOWS_SUPPORT) 00213 # define MAGICKCORE_HAVE_WINTHREADS 1 00214 #include <windows.h> 00215 #endif 00216 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H) 00217 # include <sys/syslimits.h> 00218 #endif 00219 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H) 00220 # include <arm/limits.h> 00221 #endif 00222 00223 #if defined(MAGICKCORE__OPENCL) 00224 #if defined(MAGICKCORE_HAVE_CL_CL_H) 00225 # include <CL/cl.h> 00226 #endif 00227 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H) 00228 # include <OpenCL/cl.h> 00229 #endif 00230 # define MAGICKCORE_OPENCL_SUPPORT 1 00231 #endif 00232 00233 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__)) 00234 # include <omp.h> 00235 # define MAGICKCORE_OPENMP_SUPPORT 1 00236 #endif 00237 00238 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD 00239 ssize_t pread(int,void *,size_t,off_t); 00240 #endif 00241 00242 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE 00243 ssize_t pwrite(int,const void *,size_t,off_t); 00244 #endif 00245 00246 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY 00247 extern size_t strlcpy(char *,const char *,size_t); 00248 #endif 00249 00250 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF 00251 extern int vsnprintf(char *,size_t,const char *,va_list); 00252 #endif 00253 00254 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__) 00255 # define wand_aligned(x) __attribute__((aligned(x))) 00256 # define wand_attribute __attribute__ 00257 # define wand_unused(x) wand_unused_ ## x __attribute__((unused)) 00258 #else 00259 # define wand_aligned(x) /* nothing */ 00260 # define wand_attribute(x) /* nothing */ 00261 # define wand_unused(x) x 00262 #endif 00263 00264 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT) 00265 # include <sys/types.h> 00266 # include <sys/stat.h> 00267 # if defined(MAGICKCORE_HAVE_FTIME) 00268 # include <sys/timeb.h> 00269 # endif 00270 # if defined(MAGICKCORE_POSIX_SUPPORT) 00271 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H) 00272 # define dirent direct 00273 # define NAMLEN(dirent) (dirent)->d_namlen 00274 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) 00275 # include <sys/ndir.h> 00276 # endif 00277 # if defined(MAGICKCORE_HAVE_SYS_DIR_H) 00278 # include <sys/dir.h> 00279 # endif 00280 # if defined(MAGICKCORE_HAVE_NDIR_H) 00281 # include <ndir.h> 00282 # endif 00283 # else 00284 # include <dirent.h> 00285 # define NAMLEN(dirent) strlen((dirent)->d_name) 00286 # endif 00287 # include <sys/wait.h> 00288 # include <pwd.h> 00289 # endif 00290 # if !defined(S_ISDIR) 00291 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) 00292 # endif 00293 # if !defined(S_ISREG) 00294 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) 00295 # endif 00296 # include "MagickWand/MagickWand.h" 00297 # if !defined(MAGICKCORE_WINDOWS_SUPPORT) 00298 # include <sys/time.h> 00299 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H) 00300 # include <sys/times.h> 00301 # endif 00302 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H) 00303 # include <sys/resource.h> 00304 # endif 00305 #endif 00306 #else 00307 # include <types.h> 00308 # include <stat.h> 00309 # if defined(macintosh) 00310 # if !defined(DISABLE_SIOUX) 00311 # include <SIOUX.h> 00312 # include <console.h> 00313 # endif 00314 # include <unix.h> 00315 # endif 00316 # include "MagickWand/MagickWand.h" 00317 #endif 00318 00319 #if defined(S_IRUSR) && defined(S_IWUSR) 00320 # define S_MODE (S_IRUSR | S_IWUSR) 00321 #elif defined (MAGICKCORE_WINDOWS_SUPPORT) 00322 # define S_MODE (_S_IREAD | _S_IWRITE) 00323 #else 00324 # define S_MODE 0600 00325 #endif 00326 00327 #if defined(MAGICKCORE_WINDOWS_SUPPORT) 00328 # include "MagickCore/nt-base.h" 00329 #endif 00330 #if defined(macintosh) 00331 # include "MagickCore/mac.h" 00332 #endif 00333 #if defined(vms) 00334 # include "MagickCore/vms.h" 00335 #endif 00336 00337 #undef HAVE_CONFIG_H 00338 #undef gamma 00339 #undef index 00340 #undef pipe 00341 #undef y1 00342 00343 /* 00344 Review these platform specific definitions. 00345 */ 00346 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__) 00347 # define DirectorySeparator "/" 00348 # define DirectoryListSeparator ':' 00349 # define EditorOptions " -title \"Edit Image Comment\" -e vi" 00350 # define Exit exit 00351 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse) 00352 # define X11_PREFERENCES_PATH "~/." 00353 # define ProcessPendingEvents(text) 00354 # define ReadCommandlLine(argc,argv) 00355 # define SetNotifyHandlers 00356 #else 00357 # if defined(vms) 00358 # define X11_APPLICATION_PATH "decw$system_defaults:" 00359 # define DirectorySeparator "" 00360 # define DirectoryListSeparator ';' 00361 # define EditorOptions "" 00362 # define Exit exit 00363 # define IsBasenameSeparator(c) \ 00364 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse) 00365 # define MAGICKCORE_LIBRARY_PATH "sys$login:" 00366 # define MAGICKCORE_CODER_PATH "sys$login:" 00367 # define MAGICKCORE_FILTER_PATH "sys$login:" 00368 # define MAGICKCORE_SHARE_PATH "sys$login:" 00369 # define X11_PREFERENCES_PATH "decw$user_defaults:" 00370 # define ProcessPendingEvents(text) 00371 # define ReadCommandlLine(argc,argv) 00372 # define SetNotifyHandlers 00373 # endif 00374 # if defined(__OS2__) 00375 # define DirectorySeparator "\\" 00376 # define DirectoryListSeparator ';' 00377 # define EditorOptions " -title \"Edit Image Comment\" -e vi" 00378 # define Exit exit 00379 # define IsBasenameSeparator(c) \ 00380 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse) 00381 # define PreferencesDefaults "~\." 00382 # define ProcessPendingEvents(text) 00383 # define ReadCommandlLine(argc,argv) 00384 # define SetNotifyHandlers 00385 #endif 00386 # if defined(macintosh) 00387 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/" 00388 # define DirectorySeparator ":" 00389 # define DirectoryListSeparator ';' 00390 # define EditorOptions "" 00391 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse) 00392 # define MAGICKCORE_LIBRARY_PATH "" 00393 # define MAGICKCORE_CODER_PATH "" 00394 # define MAGICKCORE_FILTER_PATH "" 00395 # define MAGICKCORE_SHARE_PATH "" 00396 # define X11_PREFERENCES_PATH "~/." 00397 # if defined(DISABLE_SIOUX) 00398 # define ReadCommandlLine(argc,argv) 00399 # define SetNotifyHandlers \ 00400 SetFatalErrorHandler(MacFatalErrorHandler); \ 00401 SetErrorHandler(MACErrorHandler); \ 00402 SetWarningHandler(MACWarningHandler) 00403 # else 00404 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion); 00405 # define SetNotifyHandlers \ 00406 SetErrorHandler(MACErrorHandler); \ 00407 SetWarningHandler(MACWarningHandler) 00408 # endif 00409 # endif 00410 # if defined(MAGICKCORE_WINDOWS_SUPPORT) 00411 # define DirectorySeparator "\\" 00412 # define DirectoryListSeparator ';' 00413 # define EditorOptions "" 00414 # define IsBasenameSeparator(c) \ 00415 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse) 00416 # define ProcessPendingEvents(text) 00417 # if !defined(X11_PREFERENCES_PATH) 00418 # define X11_PREFERENCES_PATH "~\\." 00419 # endif 00420 # define ReadCommandlLine(argc,argv) 00421 # define SetNotifyHandlers \ 00422 SetErrorHandler(NTErrorHandler); \ 00423 SetWarningHandler(NTWarningHandler) 00424 # undef sleep 00425 # define sleep(seconds) Sleep(seconds*1000) 00426 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H) 00427 # define HAVE_TIFFCONF_H 00428 # endif 00429 # endif 00430 00431 #endif 00432 00433 /* 00434 Define system symbols if not already defined. 00435 */ 00436 #if !defined(STDIN_FILENO) 00437 #define STDIN_FILENO 0x00 00438 #endif 00439 00440 #if !defined(O_BINARY) 00441 #define O_BINARY 0x00 00442 #endif 00443 00444 #if !defined(PATH_MAX) 00445 #define PATH_MAX 4096 00446 #endif 00447 00448 /* 00449 Exception defines. 00450 */ 00451 #define ThrowWandFatalException(severity,tag,context) \ 00452 { \ 00453 ExceptionInfo \ 00454 *fatal_exception; \ 00455 \ 00456 fatal_exception=AcquireExceptionInfo(); \ 00457 (void) ThrowMagickException(fatal_exception,GetMagickModule(),severity,tag, \ 00458 "`%s'",(context)); \ 00459 CatchException(fatal_exception); \ 00460 fatal_exception=DestroyExceptionInfo(fatal_exception); \ 00461 } 00462 00463 #if defined(__cplusplus) || defined(c_plusplus) 00464 } 00465 #endif 00466 00467 #endif