2 Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 http://www.imagemagick.org/script/license.php
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.
16 MagickCore private application programming interface declarations.
18 #ifndef _MAGICKCORE_STUDIO_H
19 #define _MAGICKCORE_STUDIO_H
21 #if defined(__cplusplus) || defined(c_plusplus)
25 #if defined(WIN32) || defined(WIN64)
26 # define MAGICKCORE_WINDOWS_SUPPORT
28 # define MAGICKCORE_POSIX_SUPPORT
31 #define MAGICKCORE_IMPLEMENTATION 1
33 #if !defined(_MAGICKCORE_CONFIG_H)
34 # define _MAGICKCORE_CONFIG_H
35 # if !defined(vms) && !defined(macintosh)
36 # include "MagickCore/magick-config.h"
38 # include "magick-config.h"
40 #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
41 # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
43 #if defined(_magickcore_const) && !defined(const)
44 # define const _magickcore_const
46 #if defined(_magickcore_inline) && !defined(inline)
47 # define inline _magickcore_inline
49 #if defined(_magickcore_restrict) && !defined(restrict)
50 # define restrict _magickcore_restrict
52 # if defined(__cplusplus) || defined(c_plusplus)
57 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
58 # include "MagickCore/methods.h"
67 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
68 # include <sys/stat.h>
70 #if defined(MAGICKCORE_STDC_HEADERS)
74 # if defined(MAGICKCORE_HAVE_STDLIB_H)
78 #if defined(MAGICKCORE_HAVE_STRING_H)
79 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
84 #if defined(MAGICKCORE_HAVE_STRINGS_H)
87 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
88 # include <inttypes.h>
90 #if defined(MAGICKCORE_HAVE_STDINT_H)
93 #if defined(MAGICKCORE_HAVE_UNISTD_H)
96 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
97 #define _CRTDBG_MAP_ALLOC
99 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
101 # if !defined(MAGICKCORE_HAVE_STRERROR)
102 # define HAVE_STRERROR
116 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
117 # include <xlocale.h>
119 #if defined(MAGICKCORE_THREAD_SUPPORT)
120 # include <pthread.h>
121 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
122 # define MAGICKCORE_HAVE_WINTHREADS 1
125 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
126 # include <sys/syslimits.h>
128 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
129 # include <arm/limits.h>
132 #if defined(MAGICKCORE__OPENCL)
133 #if defined(MAGICKCORE_HAVE_CL_CL_H)
136 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
137 # include <OpenCL/cl.h>
139 # define MAGICKCORE_OPENCL_SUPPORT 1
142 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
144 # define MAGICKCORE_OPENMP_SUPPORT 1
147 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
148 ssize_t pread(int,void *,size_t,off_t);
151 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
152 ssize_t pwrite(int,const void *,size_t,off_t);
155 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
156 extern size_t strlcpy(char *,const char *,size_t);
159 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
160 extern int vsnprintf(char *,size_t,const char *,va_list);
163 #include "MagickCore/method-attribute.h"
165 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
166 # include <sys/types.h>
167 # include <sys/stat.h>
168 # if defined(MAGICKCORE_HAVE_FTIME)
169 # include <sys/timeb.h>
171 # if defined(MAGICKCORE_POSIX_SUPPORT)
172 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
173 # define dirent direct
174 # define NAMLEN(dirent) (dirent)->d_namlen
175 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
176 # include <sys/ndir.h>
178 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
179 # include <sys/dir.h>
181 # if defined(MAGICKCORE_HAVE_NDIR_H)
186 # define NAMLEN(dirent) strlen((dirent)->d_name)
188 # include <sys/wait.h>
191 # if !defined(S_ISDIR)
192 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
194 # if !defined(S_ISREG)
195 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
197 # include "MagickCore/magick-type.h"
198 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
199 # include <sys/time.h>
200 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
201 # include <sys/times.h>
203 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
204 # include <sys/resource.h>
206 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
207 # include <sys/mman.h>
213 # if defined(macintosh)
214 # if !defined(DISABLE_SIOUX)
216 # include <console.h>
220 # include "MagickCore/magick-type.h"
223 #if defined(S_IRUSR) && defined(S_IWUSR)
224 # define S_MODE (S_IRUSR | S_IWUSR)
225 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
226 # define S_MODE (_S_IREAD | _S_IWRITE)
231 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
232 # include "MagickCore/nt-base.h"
234 #if defined(macintosh)
235 # include "MagickCore/mac.h"
238 # include "MagickCore/vms.h"
248 Review these platform specific definitions.
250 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
251 # define DirectorySeparator "/"
252 # define DirectoryListSeparator ':'
253 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
255 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
256 # define X11_PREFERENCES_PATH "~/."
257 # define ProcessPendingEvents(text)
258 # define ReadCommandlLine(argc,argv)
259 # define SetNotifyHandlers
262 # define X11_APPLICATION_PATH "decw$system_defaults:"
263 # define DirectorySeparator ""
264 # define DirectoryListSeparator ';'
265 # define EditorOptions ""
267 # define IsBasenameSeparator(c) \
268 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
269 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
270 # define MAGICKCORE_CODER_PATH "sys$login:"
271 # define MAGICKCORE_FILTER_PATH "sys$login:"
272 # define MAGICKCORE_SHARE_PATH "sys$login:"
273 # define X11_PREFERENCES_PATH "decw$user_defaults:"
274 # define ProcessPendingEvents(text)
275 # define ReadCommandlLine(argc,argv)
276 # define SetNotifyHandlers
278 # if defined(__OS2__)
279 # define DirectorySeparator "\\"
280 # define DirectoryListSeparator ';'
281 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
283 # define IsBasenameSeparator(c) \
284 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
285 # define PreferencesDefaults "~\."
286 # define ProcessPendingEvents(text)
287 # define ReadCommandlLine(argc,argv)
288 # define SetNotifyHandlers
290 # if defined(macintosh)
291 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
292 # define DirectorySeparator ":"
293 # define DirectoryListSeparator ';'
294 # define EditorOptions ""
295 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
296 # define MAGICKCORE_LIBRARY_PATH ""
297 # define MAGICKCORE_CODER_PATH ""
298 # define MAGICKCORE_FILTER_PATH ""
299 # define MAGICKCORE_SHARE_PATH ""
300 # define X11_PREFERENCES_PATH "~/."
301 # if defined(DISABLE_SIOUX)
302 # define ReadCommandlLine(argc,argv)
303 # define SetNotifyHandlers \
304 SetFatalErrorHandler(MacFatalErrorHandler); \
305 SetErrorHandler(MACErrorHandler); \
306 SetWarningHandler(MACWarningHandler)
308 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
309 # define SetNotifyHandlers \
310 SetErrorHandler(MACErrorHandler); \
311 SetWarningHandler(MACWarningHandler)
314 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
315 # define DirectorySeparator "\\"
316 # define DirectoryListSeparator ';'
317 # define EditorOptions ""
318 # define IsBasenameSeparator(c) \
319 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
320 # define ProcessPendingEvents(text)
321 # if !defined(X11_PREFERENCES_PATH)
322 # define X11_PREFERENCES_PATH "~\\."
324 # define ReadCommandlLine(argc,argv)
325 # define SetNotifyHandlers \
326 SetErrorHandler(NTErrorHandler); \
327 SetWarningHandler(NTWarningHandler)
329 # define sleep(seconds) Sleep(seconds*1000)
330 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
331 # define HAVE_TIFFCONF_H
338 Define system symbols if not already defined.
340 #if !defined(STDIN_FILENO)
341 #define STDIN_FILENO 0x00
344 #if !defined(O_BINARY)
345 #define O_BINARY 0x00
348 #if !defined(PATH_MAX)
349 #define PATH_MAX 4096
352 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
353 # define MAGICKCORE_MODULES_SUPPORT
356 #if defined(_MAGICKMOD_)
357 # undef MAGICKCORE_BUILD_MODULES
358 # define MAGICKCORE_BUILD_MODULES
364 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
366 #if defined(__cplusplus) || defined(c_plusplus)