cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
Cristy | f6ff9ea | 2016-12-05 09:53:35 -0500 | [diff] [blame] | 2 | Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3 | dedicated to making software imaging solutions freely available. |
| 4 | |
| 5 | You may not use this file except in compliance with the License. |
| 6 | obtain a copy of the License at |
| 7 | |
Cristy | f19d414 | 2017-04-24 11:34:30 -0400 | [diff] [blame^] | 8 | https://www.imagemagick.org/script/license.php |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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 | */ |
Cristy | 83bceaa | 2016-06-03 20:39:35 -0400 | [diff] [blame] | 18 | #ifndef MAGICKWAND_STUDIO_H |
| 19 | #define MAGICKWAND_STUDIO_H |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 20 | |
| 21 | #if defined(__cplusplus) || defined(c_plusplus) |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
cristy | 0157aea | 2010-04-24 21:12:18 +0000 | [diff] [blame] | 25 | #if defined(WIN32) || defined(WIN64) |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 26 | # define MAGICKWAND_WINDOWS_SUPPORT |
cristy | 0157aea | 2010-04-24 21:12:18 +0000 | [diff] [blame] | 27 | #else |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 28 | # define MAGICKWAND_POSIX_SUPPORT |
cristy | 0157aea | 2010-04-24 21:12:18 +0000 | [diff] [blame] | 29 | #endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 30 | |
| 31 | #define MAGICKWAND_IMPLEMENTATION 1 |
| 32 | |
Cristy | 83bceaa | 2016-06-03 20:39:35 -0400 | [diff] [blame] | 33 | #if !defined(MAGICKWAND_CONFIG_H) |
| 34 | # define MAGICKWAND_CONFIG_H |
Cristy | 6ed46be | 2015-09-06 05:36:11 -0400 | [diff] [blame] | 35 | # include "MagickCore/magick-config.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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 |
cristy | ba56db5 | 2011-05-20 02:08:11 +0000 | [diff] [blame] | 45 | # if defined(__cplusplus) || defined(c_plusplus) |
| 46 | # undef inline |
| 47 | # endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 48 | #endif |
| 49 | |
| 50 | #if !defined(const) |
| 51 | # define STDC |
| 52 | #endif |
| 53 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 54 | #if defined(__cplusplus) || defined(c_plusplus) |
| 55 | # define storage_class c_class |
| 56 | #else |
| 57 | # define storage_class class |
| 58 | #endif |
| 59 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 60 | #include <stdarg.h> |
| 61 | #include <stdio.h> |
cristy | a0b81c3 | 2010-01-22 02:54:33 +0000 | [diff] [blame] | 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 |
dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame] | 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 |
cristy | 0f6fc2d | 2015-05-30 00:49:11 +0000 | [diff] [blame] | 79 | #endif |
cristy | a0b81c3 | 2010-01-22 02:54:33 +0000 | [diff] [blame] | 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 |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 98 | #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 99 | #define _CRTDBG_MAP_ALLOC |
| 100 | #endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 101 | |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 102 | #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG) |
cristy | a0b81c3 | 2010-01-22 02:54:33 +0000 | [diff] [blame] | 103 | #define _CRTDBG_MAP_ALLOC |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 104 | #endif |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 105 | #if defined(MAGICKWAND_WINDOWS_SUPPORT) |
cristy | d912343 | 2012-10-17 12:30:20 +0000 | [diff] [blame] | 106 | # include <io.h> |
cristy | a0b81c3 | 2010-01-22 02:54:33 +0000 | [diff] [blame] | 107 | # include <direct.h> |
| 108 | # if !defined(MAGICKCORE_HAVE_STRERROR) |
| 109 | # define HAVE_STRERROR |
| 110 | # endif |
| 111 | #endif |
| 112 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 113 | #include <ctype.h> |
| 114 | #include <locale.h> |
| 115 | #include <errno.h> |
| 116 | #include <fcntl.h> |
| 117 | #include <math.h> |
| 118 | #include <time.h> |
| 119 | #include <limits.h> |
| 120 | #include <signal.h> |
| 121 | #include <assert.h> |
| 122 | |
cristy | 38d73d6 | 2011-05-19 01:55:37 +0000 | [diff] [blame] | 123 | #if defined(MAGICKCORE_HAVE_XLOCALE_H) |
| 124 | # include <xlocale.h> |
| 125 | #endif |
cristy | 55bf91c | 2010-09-24 00:29:41 +0000 | [diff] [blame] | 126 | #if defined(MAGICKCORE_THREAD_SUPPORT) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 127 | # include <pthread.h> |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 128 | #endif |
| 129 | #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H) |
| 130 | # include <sys/syslimits.h> |
| 131 | #endif |
| 132 | #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H) |
| 133 | # include <arm/limits.h> |
| 134 | #endif |
| 135 | |
cristy | 1579d81 | 2010-01-22 15:45:14 +0000 | [diff] [blame] | 136 | #if defined(MAGICKCORE__OPENCL) |
cristy | fe2e68f | 2010-01-09 19:16:03 +0000 | [diff] [blame] | 137 | #if defined(MAGICKCORE_HAVE_CL_CL_H) |
cristy | 07425aa | 2009-09-20 22:59:24 +0000 | [diff] [blame] | 138 | # include <CL/cl.h> |
cristy | 07425aa | 2009-09-20 22:59:24 +0000 | [diff] [blame] | 139 | #endif |
cristy | fe2e68f | 2010-01-09 19:16:03 +0000 | [diff] [blame] | 140 | #if defined(MAGICKCORE_HAVE_OPENCL_CL_H) |
cristy | 07425aa | 2009-09-20 22:59:24 +0000 | [diff] [blame] | 141 | # include <OpenCL/cl.h> |
cristy | 99cc300 | 2010-01-21 14:50:11 +0000 | [diff] [blame] | 142 | #endif |
cristy | 07425aa | 2009-09-20 22:59:24 +0000 | [diff] [blame] | 143 | # define MAGICKCORE_OPENCL_SUPPORT 1 |
| 144 | #endif |
| 145 | |
cristy | bffe7d3 | 2012-01-20 01:46:17 +0000 | [diff] [blame] | 146 | #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__)) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 147 | # include <omp.h> |
cristy | b28d647 | 2009-10-17 20:13:35 +0000 | [diff] [blame] | 148 | # define MAGICKCORE_OPENMP_SUPPORT 1 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 149 | #endif |
| 150 | |
| 151 | #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD |
| 152 | ssize_t pread(int,void *,size_t,off_t); |
| 153 | #endif |
| 154 | |
| 155 | #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE |
| 156 | ssize_t pwrite(int,const void *,size_t,off_t); |
| 157 | #endif |
| 158 | |
| 159 | #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY |
| 160 | extern size_t strlcpy(char *,const char *,size_t); |
| 161 | #endif |
| 162 | |
| 163 | #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF |
| 164 | extern int vsnprintf(char *,size_t,const char *,va_list); |
| 165 | #endif |
| 166 | |
cristy | e7139e0 | 2012-02-29 12:42:18 +0000 | [diff] [blame] | 167 | #include "MagickWand/method-attribute.h" |
| 168 | |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 169 | #if defined(MAGICKWAND_WINDOWS_SUPPORT) || defined(MAGICKWAND_POSIX_SUPPORT) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 170 | # include <sys/types.h> |
| 171 | # include <sys/stat.h> |
Cristy | 4bb3ba9 | 2016-04-24 14:28:07 -0400 | [diff] [blame] | 172 | # if defined(MAGICKCORE_HAVE_SYS_TIMEB_H) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 173 | # include <sys/timeb.h> |
| 174 | # endif |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 175 | # if defined(MAGICKWAND_POSIX_SUPPORT) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 176 | # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H) |
| 177 | # define dirent direct |
| 178 | # define NAMLEN(dirent) (dirent)->d_namlen |
| 179 | # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) |
| 180 | # include <sys/ndir.h> |
| 181 | # endif |
| 182 | # if defined(MAGICKCORE_HAVE_SYS_DIR_H) |
| 183 | # include <sys/dir.h> |
| 184 | # endif |
| 185 | # if defined(MAGICKCORE_HAVE_NDIR_H) |
| 186 | # include <ndir.h> |
| 187 | # endif |
| 188 | # else |
| 189 | # include <dirent.h> |
| 190 | # define NAMLEN(dirent) strlen((dirent)->d_name) |
| 191 | # endif |
| 192 | # include <sys/wait.h> |
| 193 | # include <pwd.h> |
| 194 | # endif |
| 195 | # if !defined(S_ISDIR) |
| 196 | # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) |
| 197 | # endif |
| 198 | # if !defined(S_ISREG) |
| 199 | # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) |
| 200 | # endif |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 201 | # include "MagickWand/MagickWand.h" |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 202 | # if !defined(MAGICKWAND_WINDOWS_SUPPORT) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 203 | # include <sys/time.h> |
| 204 | # if defined(MAGICKCORE_HAVE_SYS_TIMES_H) |
| 205 | # include <sys/times.h> |
| 206 | # endif |
| 207 | # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H) |
| 208 | # include <sys/resource.h> |
| 209 | # endif |
cristy | 58945e4 | 2012-09-04 14:33:54 +0000 | [diff] [blame] | 210 | # if defined(MAGICKCORE_HAVE_SYS_MMAN_H) |
| 211 | # include <sys/mman.h> |
| 212 | # endif |
cristy | 66988ab | 2015-05-30 17:20:38 +0000 | [diff] [blame] | 213 | # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H) |
| 214 | # include <sys/sendfile.h> |
| 215 | # endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 216 | #endif |
| 217 | #else |
| 218 | # include <types.h> |
| 219 | # include <stat.h> |
| 220 | # if defined(macintosh) |
| 221 | # if !defined(DISABLE_SIOUX) |
| 222 | # include <SIOUX.h> |
| 223 | # include <console.h> |
| 224 | # endif |
| 225 | # include <unix.h> |
| 226 | # endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 227 | #endif |
| 228 | |
| 229 | #if defined(S_IRUSR) && defined(S_IWUSR) |
| 230 | # define S_MODE (S_IRUSR | S_IWUSR) |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 231 | #elif defined (MAGICKWAND_WINDOWS_SUPPORT) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 232 | # define S_MODE (_S_IREAD | _S_IWRITE) |
| 233 | #else |
| 234 | # define S_MODE 0600 |
| 235 | #endif |
| 236 | |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 237 | #if defined(MAGICKWAND_WINDOWS_SUPPORT) |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 238 | # include "MagickCore/nt-base.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 239 | #endif |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 240 | |
| 241 | #undef HAVE_CONFIG_H |
| 242 | #undef gamma |
| 243 | #undef index |
| 244 | #undef pipe |
| 245 | #undef y1 |
| 246 | |
| 247 | /* |
| 248 | Review these platform specific definitions. |
| 249 | */ |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 250 | #if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 251 | # define DirectorySeparator "/" |
| 252 | # define DirectoryListSeparator ':' |
| 253 | # define EditorOptions " -title \"Edit Image Comment\" -e vi" |
| 254 | # define Exit exit |
| 255 | # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse) |
| 256 | # define X11_PREFERENCES_PATH "~/." |
| 257 | # define ProcessPendingEvents(text) |
| 258 | # define ReadCommandlLine(argc,argv) |
| 259 | # define SetNotifyHandlers |
| 260 | #else |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 261 | # if defined(__OS2__) |
| 262 | # define DirectorySeparator "\\" |
| 263 | # define DirectoryListSeparator ';' |
| 264 | # define EditorOptions " -title \"Edit Image Comment\" -e vi" |
| 265 | # define Exit exit |
| 266 | # define IsBasenameSeparator(c) \ |
| 267 | (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse) |
| 268 | # define PreferencesDefaults "~\." |
| 269 | # define ProcessPendingEvents(text) |
| 270 | # define ReadCommandlLine(argc,argv) |
| 271 | # define SetNotifyHandlers |
| 272 | #endif |
cristy | 8711081 | 2013-04-03 00:40:44 +0000 | [diff] [blame] | 273 | # if defined(MAGICKWAND_WINDOWS_SUPPORT) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 274 | # define DirectorySeparator "\\" |
| 275 | # define DirectoryListSeparator ';' |
| 276 | # define EditorOptions "" |
| 277 | # define IsBasenameSeparator(c) \ |
| 278 | (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse) |
| 279 | # define ProcessPendingEvents(text) |
| 280 | # if !defined(X11_PREFERENCES_PATH) |
| 281 | # define X11_PREFERENCES_PATH "~\\." |
| 282 | # endif |
| 283 | # define ReadCommandlLine(argc,argv) |
| 284 | # define SetNotifyHandlers \ |
| 285 | SetErrorHandler(NTErrorHandler); \ |
| 286 | SetWarningHandler(NTWarningHandler) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 287 | # if !defined(MAGICKCORE_HAVE_TIFFCONF_H) |
| 288 | # define HAVE_TIFFCONF_H |
| 289 | # endif |
| 290 | # endif |
| 291 | |
| 292 | #endif |
| 293 | |
| 294 | /* |
| 295 | Define system symbols if not already defined. |
| 296 | */ |
| 297 | #if !defined(STDIN_FILENO) |
| 298 | #define STDIN_FILENO 0x00 |
| 299 | #endif |
| 300 | |
| 301 | #if !defined(O_BINARY) |
| 302 | #define O_BINARY 0x00 |
| 303 | #endif |
| 304 | |
cristy | 104cea8 | 2009-10-25 02:26:51 +0000 | [diff] [blame] | 305 | #if !defined(PATH_MAX) |
| 306 | #define PATH_MAX 4096 |
| 307 | #endif |
| 308 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 309 | /* |
dirk | 93b02b7 | 2013-11-16 16:03:36 +0000 | [diff] [blame] | 310 | Magick defines. |
| 311 | */ |
| 312 | #if defined(_MSC_VER) |
| 313 | # define DisableMSCWarning(nr) __pragma(warning(push)) \ |
| 314 | __pragma(warning(disable:nr)) |
| 315 | # define RestoreMSCWarning __pragma(warning(pop)) |
| 316 | #else |
| 317 | # define DisableMSCWarning(nr) |
| 318 | # define RestoreMSCWarning |
| 319 | #endif |
| 320 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 321 | #if defined(__cplusplus) || defined(c_plusplus) |
| 322 | } |
| 323 | #endif |
| 324 | |
| 325 | #endif |