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