blob: a9e3465d11e2f5a80a239ca172affd99a91a797e [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2 Copyright 1999-2009 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.
6 obtain a copy of the License at
7
8 http://www.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 MagickCore private application programming interface declarations.
17*/
18#ifndef _MAGICKCORE_STUDIO_H
19#define _MAGICKCORE_STUDIO_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#if defined(__CYGWIN32__)
26# if !defined(__CYGWIN__)
27# define __CYGWIN__ __CYGWIN32__
28# endif
29#endif
30
31#if defined(_WIN32) || defined(WIN32)
32# if !defined(__WINDOWS__)
33# if defined(_WIN32)
34# define __WINDOWS__ _WIN32
35# else
36# if defined(WIN32)
37# define __WINDOWS__ WIN32
38# endif
39# endif
40# endif
41#endif
42
43#if defined(_WIN64) || defined(WIN64)
44# if !defined(__WINDOWS__)
45# if defined(_WIN64)
46# define __WINDOWS__ _WIN64
47# else
48# if defined(WIN64)
49# define __WINDOWS__ WIN64
50# endif
51# endif
52# endif
53#endif
54
cristy3ed852e2009-09-05 21:47:34 +000055#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
56# define MAGICKCORE_POSIX_SUPPORT
57#endif
58
59#define MAGICKCORE_IMPLEMENTATION 1
60
61#if !defined(_MAGICKCORE_CONFIG_H)
62# define _MAGICKCORE_CONFIG_H
63# if !defined(vms) && !defined(macintosh)
64# include "magick/magick-config.h"
65# else
66# include "magick-config.h"
67# endif
68#if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
69# define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
70#endif
71#if defined(_magickcore_const) && !defined(const)
72# define const _magickcore_const
73#endif
74#if defined(_magickcore_inline) && !defined(inline)
75# define inline _magickcore_inline
76#endif
77# if defined(__cplusplus) || defined(c_plusplus)
78# undef inline
79# endif
80#if defined(_magickcore_restrict) && !defined(__restrict)
81# define __restrict _magickcore_restrict
82#endif
83#endif
84
85#if defined(MAGICKCORE_NAMESPACE_PREFIX)
86# include "magick/methods.h"
87#endif
88
89#if !defined(const)
90# define STDC
91#endif
92
93#if defined(__BORLANDC__) && defined(_DLL)
94# pragma message("BCBMagick lib DLL export interface")
95# define _MAGICKDLL_
96# define _MAGICKLIB_
97# define MAGICKCORE_MODULES_SUPPORT
98# undef MAGICKCORE_BUILD_MODULES
99#endif
100
101#if defined(__WINDOWS__)
102# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
103# define _MAGICKDLL_
104# endif
105# if defined(_MAGICKDLL_)
106# if defined(_VISUALC_)
107# pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
108# endif
109# if !defined(_MAGICKLIB_)
110# define MagickExport __declspec(dllimport)
111# if defined(_VISUALC_)
112# pragma message( "MagickCore lib DLL import interface" )
113# endif
114# else
115# define MagickExport __declspec(dllexport)
116# if defined(_VISUALC_)
117# pragma message( "MagickCore lib DLL export interface" )
118# endif
119# endif
120# else
121# define MagickExport
122# if defined(_VISUALC_)
123# pragma message( "MagickCore lib static interface" )
124# endif
125# endif
126
127# if defined(_DLL) && !defined(_LIB)
128# define ModuleExport __declspec(dllexport)
129# if defined(_VISUALC_)
130# pragma message( "MagickCore module DLL export interface" )
131# endif
132# else
133# define ModuleExport
134# if defined(_VISUALC_)
135# pragma message( "MagickCore module static interface" )
136# endif
137
138# endif
139# define MagickGlobal __declspec(thread)
140# if defined(_VISUALC_)
141# pragma warning(disable : 4018)
142# pragma warning(disable : 4068)
143# pragma warning(disable : 4244)
144# pragma warning(disable : 4142)
145# pragma warning(disable : 4800)
146# pragma warning(disable : 4786)
147# pragma warning(disable : 4996)
148# endif
149#else
150# define MagickExport
151# define ModuleExport
152# define MagickGlobal
153#endif
154
155#define MagickSignature 0xabacadabUL
156#if !defined(MaxTextExtent)
157# define MaxTextExtent 4096
158#endif
159
160#include <stdarg.h>
161#include <stdio.h>
162#if defined(__WINDOWS__) && defined(_DEBUG)
163#define _CRTDBG_MAP_ALLOC
164#endif
165#include <stdlib.h>
166#if !defined(__WINDOWS__)
167# include <unistd.h>
168#else
169# include <direct.h>
170# if !defined(MAGICKCORE_HAVE_STRERROR)
171# define HAVE_STRERROR
172# endif
173#endif
174
175#if defined(MAGICKCORE_HAVE_STRINGS_H)
176# include <strings.h>
177#endif
178#include <string.h>
179#include <ctype.h>
180#include <locale.h>
181#include <errno.h>
182#include <fcntl.h>
183#include <math.h>
184#include <time.h>
185#include <limits.h>
186#include <signal.h>
187#include <assert.h>
188
189#if defined(MAGICKCORE_HAVE_PTHREAD)
190# include <pthread.h>
191#elif defined(__WINDOWS__)
192# define MAGICKORE_HAVE_WINTHREADS 1
193#include <windows.h>
194#endif
195#if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
196# include <sys/syslimits.h>
197#endif
198#if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
199# include <arm/limits.h>
200#endif
201
cristy07425aa2009-09-20 22:59:24 +0000202#if defined(HAVE_CL_CL_H)
203# include <CL/cl.h>
204# define MAGICKCORE_OPENCL_SUPPORT 1
205#endif
206
207#if defined(HAVE_OPENCL_CL_H)
208# include <OpenCL/cl.h>
209# define MAGICKCORE_OPENCL_SUPPORT 1
210#endif
211
cristy3ed852e2009-09-05 21:47:34 +0000212#if defined(_OPENMP) && (_OPENMP >= 200203)
213# include <omp.h>
cristy3ed852e2009-09-05 21:47:34 +0000214#endif
215
216#if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
217ssize_t pread(int,void *,size_t,off_t);
218#endif
219
220#if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
221ssize_t pwrite(int,const void *,size_t,off_t);
222#endif
223
224#if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
225extern size_t strlcpy(char *,const char *,size_t);
226#endif
227
228#if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
229extern int vsnprintf(char *,size_t,const char *,va_list);
230#endif
231
232#if !defined(magick_attribute)
233# if !defined(__GNUC__)
234# define magick_attribute(x) /* nothing */
235# else
236# define magick_attribute __attribute__
237# endif
238#endif
239
240#if !defined(magick_unused)
241# if defined(__GNUC__)
242# define magick_unused(x) magick_unused_ ## x __attribute__((unused))
243# elif defined(__LCLINT__)
244# define magick_unused(x) /*@unused@*/ x
245# else
246# define magick_unused(x) x
247# endif
248#endif
249
250#if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
251# include <sys/types.h>
252# include <sys/stat.h>
253# if defined(MAGICKCORE_HAVE_FTIME)
254# include <sys/timeb.h>
255# endif
256# if defined(MAGICKCORE_POSIX_SUPPORT)
257# if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
258# define dirent direct
259# define NAMLEN(dirent) (dirent)->d_namlen
260# if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
261# include <sys/ndir.h>
262# endif
263# if defined(MAGICKCORE_HAVE_SYS_DIR_H)
264# include <sys/dir.h>
265# endif
266# if defined(MAGICKCORE_HAVE_NDIR_H)
267# include <ndir.h>
268# endif
269# else
270# include <dirent.h>
271# define NAMLEN(dirent) strlen((dirent)->d_name)
272# endif
273# include <sys/wait.h>
274# include <pwd.h>
275# endif
276# if !defined(S_ISDIR)
277# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
278# endif
279# if !defined(S_ISREG)
280# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
281# endif
282# include "magick/magick-type.h"
283# if !defined(__WINDOWS__)
284# include <sys/time.h>
285# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
286# include <sys/times.h>
287# endif
288# if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
289# include <sys/resource.h>
290# endif
291#endif
292#else
293# include <types.h>
294# include <stat.h>
295# if defined(macintosh)
296# if !defined(DISABLE_SIOUX)
297# include <SIOUX.h>
298# include <console.h>
299# endif
300# include <unix.h>
301# endif
302# include "magick/magick-type.h"
303#endif
304
305#if defined(S_IRUSR) && defined(S_IWUSR)
306# define S_MODE (S_IRUSR | S_IWUSR)
307#elif defined (__WINDOWS__)
308# define S_MODE (_S_IREAD | _S_IWRITE)
309#else
310# define S_MODE 0600
311#endif
312
313#if defined(__WINDOWS__)
314# include "magick/nt-base.h"
315#endif
316#if defined(macintosh)
317# include "magick/mac.h"
318#endif
319#if defined(vms)
320# include "magick/vms.h"
321#endif
322
323#undef HAVE_CONFIG_H
324#undef gamma
325#undef index
326#undef pipe
327#undef y1
328
329/*
330 Review these platform specific definitions.
331*/
332#if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
333# define DirectorySeparator "/"
334# define DirectoryListSeparator ':'
335# define EditorOptions " -title \"Edit Image Comment\" -e vi"
336# define Exit exit
337# define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
338# define X11_PREFERENCES_PATH "~/."
339# define ProcessPendingEvents(text)
340# define ReadCommandlLine(argc,argv)
341# define SetNotifyHandlers
342#else
343# if defined(vms)
344# define X11_APPLICATION_PATH "decw$system_defaults:"
345# define DirectorySeparator ""
346# define DirectoryListSeparator ';'
347# define EditorOptions ""
348# define Exit exit
349# define IsBasenameSeparator(c) \
350 (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
351# define MAGICKCORE_LIBRARY_PATH "sys$login:"
352# define MAGICKCORE_CODER_PATH "sys$login:"
353# define MAGICKCORE_FILTER_PATH "sys$login:"
354# define MAGICKCORE_SHARE_PATH "sys$login:"
355# define X11_PREFERENCES_PATH "decw$user_defaults:"
356# define ProcessPendingEvents(text)
357# define ReadCommandlLine(argc,argv)
358# define SetNotifyHandlers
359# endif
360# if defined(__OS2__)
361# define DirectorySeparator "\\"
362# define DirectoryListSeparator ';'
363# define EditorOptions " -title \"Edit Image Comment\" -e vi"
364# define Exit exit
365# define IsBasenameSeparator(c) \
366 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
367# define PreferencesDefaults "~\."
368# define ProcessPendingEvents(text)
369# define ReadCommandlLine(argc,argv)
370# define SetNotifyHandlers
371#endif
372# if defined(macintosh)
373# define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
374# define DirectorySeparator ":"
375# define DirectoryListSeparator ';'
376# define EditorOptions ""
377# define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
378# define MAGICKCORE_LIBRARY_PATH ""
379# define MAGICKCORE_CODER_PATH ""
380# define MAGICKCORE_FILTER_PATH ""
381# define MAGICKCORE_SHARE_PATH ""
382# define X11_PREFERENCES_PATH "~/."
383# if defined(DISABLE_SIOUX)
384# define ReadCommandlLine(argc,argv)
385# define SetNotifyHandlers \
386 SetFatalErrorHandler(MacFatalErrorHandler); \
387 SetErrorHandler(MACErrorHandler); \
388 SetWarningHandler(MACWarningHandler)
389# else
390# define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
391# define SetNotifyHandlers \
392 SetErrorHandler(MACErrorHandler); \
393 SetWarningHandler(MACWarningHandler)
394# endif
395# endif
396# if defined(__WINDOWS__)
397# define DirectorySeparator "\\"
398# define DirectoryListSeparator ';'
399# define EditorOptions ""
400# define IsBasenameSeparator(c) \
401 (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
402# define ProcessPendingEvents(text)
403# if !defined(X11_PREFERENCES_PATH)
404# define X11_PREFERENCES_PATH "~\\."
405# endif
406# define ReadCommandlLine(argc,argv)
407# define SetNotifyHandlers \
408 SetErrorHandler(NTErrorHandler); \
409 SetWarningHandler(NTWarningHandler)
410# undef sleep
411# define sleep(seconds) Sleep(seconds*1000)
412# if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
413# define HAVE_TIFFCONF_H
414# endif
415# endif
416
417#endif
418
419/*
420 Define system symbols if not already defined.
421*/
422#if !defined(STDIN_FILENO)
423#define STDIN_FILENO 0x00
424#endif
425
426#if !defined(O_BINARY)
427#define O_BINARY 0x00
428#endif
429
430#if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(__WINDOWS__) && defined(_DLL) && !defined(_LIB))
431# define MAGICKCORE_MODULES_SUPPORT
432#endif
433
434#if defined(_MAGICKMOD_)
435# undef MAGICKCORE_BUILD_MODULES
436# define MAGICKCORE_BUILD_MODULES
437#endif
438
439/*
440 I/O defines.
441*/
442#if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
443#define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
444#define MagickTell(file) _telli64(file)
445#else
446#define MagickSeek(file,offset,whence) lseek(file,offset,whence)
447#define MagickTell(file) tell(file)
448#endif
449
450/*
451 Magick defines.
452*/
453#define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
454
455#if defined(__cplusplus) || defined(c_plusplus)
456}
457#endif
458
459#endif