1 /* 2 Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization 3 dedicated to making software imaging solutions freely available. 4 5 You may not use this file except in compliance with the License. You may 6 obtain a copy of the License at 7 8 https://imagemagick.org/script/license.php 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 16 MagickWand private application programming interface declarations. 17 */ 18 #ifndef MAGICKWAND_STUDIO_H 19 #define MAGICKWAND_STUDIO_H 20 21 #if defined(__cplusplus) || defined(c_plusplus) 22 extern "C" { 23 #endif 24 25 #if defined(WIN32) || defined(WIN64) 26 # define MAGICKWAND_WINDOWS_SUPPORT 27 #else 28 # define MAGICKWAND_POSIX_SUPPORT 29 #endif 30 31 #define MAGICKWAND_IMPLEMENTATION 1 32 33 #if !defined(MAGICKWAND_CONFIG_H) 34 # define MAGICKWAND_CONFIG_H 35 # include "MagickCore/magick-config.h" 36 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS) 37 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS 38 #endif 39 #if defined(_magickcore_const) && !defined(const) 40 # define const _magickcore_const 41 #endif 42 #if defined(_magickcore_inline) && !defined(inline) 43 # define inline _magickcore_inline 44 #endif 45 # if defined(__cplusplus) || defined(c_plusplus) 46 # undef inline 47 # endif 48 #endif 49 50 #if !defined(const) 51 # define STDC 52 #endif 53 54 #if defined(__cplusplus) || defined(c_plusplus) 55 # define storage_class c_class 56 #else 57 # define storage_class class 58 #endif 59 60 #include <stdarg.h> 61 #include <stdio.h> 62 #if defined(MAGICKCORE_HAVE_SYS_STAT_H) 63 # include <sys/stat.h> 64 #endif 65 #if defined(MAGICKCORE_STDC_HEADERS) 66 # include <stdlib.h> 67 # include <stddef.h> 68 #else 69 # if defined(MAGICKCORE_HAVE_STDLIB_H) 70 # include <stdlib.h> 71 # endif 72 #endif 73 #if !defined(magick_restrict) 74 # if !defined(_magickcore_restrict) 75 # define magick_restrict restrict 76 # else 77 # define magick_restrict _magickcore_restrict 78 # endif 79 #endif 80 #if defined(MAGICKCORE_HAVE_STRING_H) 81 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H) 82 # include <memory.h> 83 # endif 84 # include <string.h> 85 #endif 86 #if defined(MAGICKCORE_HAVE_STRINGS_H) 87 # include <strings.h> 88 #endif 89 #if defined(MAGICKCORE_HAVE_INTTYPES_H) 90 # include <inttypes.h> 91 #endif 92 #if defined(MAGICKCORE_HAVE_STDINT_H) 93 # include <stdint.h> 94 #endif 95 #if defined(MAGICKCORE_HAVE_UNISTD_H) 96 # include <unistd.h> 97 #endif 98 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG) 99 #define _CRTDBG_MAP_ALLOC 100 #endif 101 102 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG) 103 #define _CRTDBG_MAP_ALLOC 104 #endif 105 #if defined(MAGICKWAND_WINDOWS_SUPPORT) 106 # include <io.h> 107 #if !defined(__CYGWIN__) 108 # include <direct.h> 109 #endif 110 # if !defined(MAGICKCORE_HAVE_STRERROR) 111 # define HAVE_STRERROR 112 # endif 113 #endif 114 115 #include <ctype.h> 116 #include <locale.h> 117 #include <errno.h> 118 #include <fcntl.h> 119 #include <math.h> 120 #include <time.h> 121 #include <limits.h> 122 #include <signal.h> 123 #include <assert.h> 124 125 #if defined(MAGICKCORE_HAVE_XLOCALE_H) 126 # include <xlocale.h> 127 #endif 128 #if defined(MAGICKCORE_THREAD_SUPPORT) 129 # include <pthread.h> 130 #endif 131 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H) 132 # include <sys/syslimits.h> 133 #endif 134 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H) 135 # include <arm/limits.h> 136 #endif 137 138 #if defined(MAGICKCORE__OPENCL) 139 #if defined(MAGICKCORE_HAVE_CL_CL_H) 140 # include <CL/cl.h> 141 #endif 142 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H) 143 # include <OpenCL/cl.h> 144 #endif 145 # define MAGICKCORE_OPENCL_SUPPORT 1 146 #endif 147 148 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__)) 149 # include <omp.h> 150 # define MAGICKCORE_OPENMP_SUPPORT 1 151 #endif 152 153 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD 154 ssize_t pread(int,void *,size_t,off_t); 155 #endif 156 157 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE 158 ssize_t pwrite(int,const void *,size_t,off_t); 159 #endif 160 161 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY 162 extern size_t strlcpy(char *,const char *,size_t); 163 #endif 164 165 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF 166 extern int vsnprintf(char *,size_t,const char *,va_list); 167 #endif 168 169 #include "MagickWand/method-attribute.h" 170 171 #if defined(MAGICKWAND_WINDOWS_SUPPORT) || defined(MAGICKWAND_POSIX_SUPPORT) 172 # include <sys/types.h> 173 # include <sys/stat.h> 174 # if defined(MAGICKCORE_HAVE_SYS_TIMEB_H) 175 # include <sys/timeb.h> 176 # endif 177 # if defined(MAGICKWAND_POSIX_SUPPORT) 178 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H) 179 # define dirent direct 180 # define NAMLEN(dirent) (dirent)->d_namlen 181 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) 182 # include <sys/ndir.h> 183 # endif 184 # if defined(MAGICKCORE_HAVE_SYS_DIR_H) 185 # include <sys/dir.h> 186 # endif 187 # if defined(MAGICKCORE_HAVE_NDIR_H) 188 # include <ndir.h> 189 # endif 190 # else 191 # include <dirent.h> 192 # define NAMLEN(dirent) strlen((dirent)->d_name) 193 # endif 194 # include <sys/wait.h> 195 # include <pwd.h> 196 # endif 197 # if !defined(S_ISDIR) 198 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) 199 # endif 200 # if !defined(S_ISREG) 201 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) 202 # endif 203 # include "MagickWand/MagickWand.h" 204 # if !defined(MAGICKWAND_WINDOWS_SUPPORT) 205 # include <sys/time.h> 206 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H) 207 # include <sys/times.h> 208 # endif 209 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H) 210 # include <sys/resource.h> 211 # endif 212 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H) 213 # include <sys/mman.h> 214 # endif 215 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H) 216 # include <sys/sendfile.h> 217 # endif 218 #endif 219 #else 220 # include <types.h> 221 # include <stat.h> 222 # if defined(macintosh) 223 # if !defined(DISABLE_SIOUX) 224 # include <SIOUX.h> 225 # include <console.h> 226 # endif 227 # include <unix.h> 228 # endif 229 #endif 230 231 #if defined(S_IRUSR) && defined(S_IWUSR) 232 # define S_MODE (S_IRUSR | S_IWUSR) 233 #elif defined (MAGICKWAND_WINDOWS_SUPPORT) 234 # define S_MODE (_S_IREAD | _S_IWRITE) 235 #else 236 # define S_MODE 0600 237 #endif 238 239 #if defined(MAGICKWAND_WINDOWS_SUPPORT) 240 # include "MagickCore/nt-base.h" 241 #endif 242 243 #undef HAVE_CONFIG_H 244 #undef gamma 245 #undef index 246 #undef pipe 247 #undef y1 248 249 /* 250 Review these platform specific definitions. 251 */ 252 #if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__) 253 # define DirectorySeparator "/" 254 # define DirectoryListSeparator ':' 255 # define EditorOptions " -title \"Edit Image Comment\" -e vi" 256 # define Exit exit 257 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse) 258 # define X11_PREFERENCES_PATH "~/." 259 # define ProcessPendingEvents(text) 260 # define ReadCommandlLine(argc,argv) 261 # define SetNotifyHandlers 262 #else 263 # if defined(__OS2__) 264 # define DirectorySeparator "\\" 265 # define DirectoryListSeparator ';' 266 # define EditorOptions " -title \"Edit Image Comment\" -e vi" 267 # define Exit exit 268 # define IsBasenameSeparator(c) \ 269 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse) 270 # define PreferencesDefaults "~\." 271 # define ProcessPendingEvents(text) 272 # define ReadCommandlLine(argc,argv) 273 # define SetNotifyHandlers 274 #endif 275 # if defined(MAGICKWAND_WINDOWS_SUPPORT) 276 # define DirectorySeparator "\\" 277 # define DirectoryListSeparator ';' 278 # define EditorOptions "" 279 # define IsBasenameSeparator(c) \ 280 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse) 281 # define ProcessPendingEvents(text) 282 # if !defined(X11_PREFERENCES_PATH) 283 # define X11_PREFERENCES_PATH "~\\." 284 # endif 285 # define ReadCommandlLine(argc,argv) 286 # define SetNotifyHandlers \ 287 SetErrorHandler(NTErrorHandler); \ 288 SetWarningHandler(NTWarningHandler) 289 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H) 290 # define HAVE_TIFFCONF_H 291 # endif 292 # endif 293 294 #endif 295 296 /* 297 Define system symbols if not already defined. 298 */ 299 #if !defined(STDIN_FILENO) 300 #define STDIN_FILENO 0x00 301 #endif 302 303 #if !defined(O_BINARY) 304 #define O_BINARY 0x00 305 #endif 306 307 #if !defined(PATH_MAX) 308 #define PATH_MAX 4096 309 #endif 310 311 /* 312 Magick defines. 313 */ 314 #if defined(_MSC_VER) 315 # define DisableMSCWarning(nr) __pragma(warning(push)) \ 316 __pragma(warning(disable:nr)) 317 # define RestoreMSCWarning __pragma(warning(pop)) 318 #else 319 # define DisableMSCWarning(nr) 320 # define RestoreMSCWarning 321 #endif 322 323 #if defined(__cplusplus) || defined(c_plusplus) 324 } 325 #endif 326 327 #endif 328