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