]> granicus.if.org Git - imagemagick/blob - magick/studio.h
06a722a8e603bce99bac75465f4eb8ad9f1059df
[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(__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
55 #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(MAGICKCORE_HAVE_SYS_STAT_H)
163 # include <sys/stat.h>
164 #endif
165 #if defined(MAGICKCORE_STDC_HEADERS)
166 # include <stdlib.h>
167 # include <stddef.h>
168 #else
169 # if defined(MAGICKCORE_HAVE_STDLIB_H)
170 #  include <stdlib.h>
171 # endif
172 #endif
173 #if defined(MAGICKCORE_HAVE_STRING_H)
174 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
175 #  include <memory.h>
176 # endif
177 # include <string.h>
178 #endif
179 #if defined(MAGICKCORE_HAVE_STRINGS_H)
180 # include <strings.h>
181 #endif
182 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
183 # include <inttypes.h>
184 #endif
185 #if defined(MAGICKCORE_HAVE_STDINT_H)
186 # include <stdint.h>
187 #endif
188 #if defined(MAGICKCORE_HAVE_UNISTD_H)
189 # include <unistd.h>
190 #endif
191 #if defined(__WINDOWS__) && defined(_DEBUG)
192 #define _CRTDBG_MAP_ALLOC
193 #endif
194 #if defined(__WINDOWS__)
195 # include <direct.h>
196 # if !defined(MAGICKCORE_HAVE_STRERROR)
197 #  define HAVE_STRERROR
198 # endif
199 #endif
200
201 #include <ctype.h>
202 #include <locale.h>
203 #include <errno.h>
204 #include <fcntl.h>
205 #include <math.h>
206 #include <time.h>
207 #include <limits.h>
208 #include <signal.h>
209 #include <assert.h>
210
211 #if defined(MAGICKCORE_HAVE_PTHREAD)
212 # include <pthread.h>
213 #elif defined(__WINDOWS__)
214 #  define MAGICKCORE_HAVE_WINTHREADS  1
215 #include <windows.h>
216 #endif
217 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
218 # include <sys/syslimits.h>
219 #endif
220 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
221 # include <arm/limits.h>
222 #endif
223
224 #if defined(MAGICKCORE__OPENCL)
225 #if defined(MAGICKCORE_HAVE_CL_CL_H)
226 #  include <CL/cl.h>
227 #endif
228 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
229 #  include <OpenCL/cl.h>
230 #endif
231 #  define MAGICKCORE_OPENCL_SUPPORT  1
232 #endif
233
234 #if defined(_OPENMP) && (_OPENMP >= 200203)
235 #  include <omp.h>
236 #  define MAGICKCORE_OPENMP_SUPPORT  1
237 #endif
238
239 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
240 ssize_t pread(int,void *,size_t,off_t);
241 #endif
242
243 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
244 ssize_t pwrite(int,const void *,size_t,off_t);
245 #endif
246
247 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
248 extern size_t strlcpy(char *,const char *,size_t);
249 #endif
250
251 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
252 extern int vsnprintf(char *,size_t,const char *,va_list);
253 #endif
254
255 #if !defined(magick_attribute)
256 #  if (defined(__GNUC__) && (__GNUC__ >= 3))
257 #    define magick_attribute  __attribute__
258 #  else
259 #    define magick_attribute(x)  /* nothing */
260 #  endif
261 #endif
262
263 #if !defined(magick_unused)
264 #  if (defined(__GNUC__) && (__GNUC__ >= 3))
265 #     define magick_unused(x)  magick_unused_ ## x __attribute__((unused))
266 #  elif defined(__LCLINT__)
267 #    define magick_unused(x) /*@unused@*/ x
268 #  else
269 #    define magick_unused(x) x
270 #  endif
271 #endif
272
273 #if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
274 # include <sys/types.h>
275 # include <sys/stat.h>
276 # if defined(MAGICKCORE_HAVE_FTIME)
277 # include <sys/timeb.h>
278 # endif
279 # if defined(MAGICKCORE_POSIX_SUPPORT)
280 #  if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
281 #   define dirent direct
282 #   define NAMLEN(dirent) (dirent)->d_namlen
283 #   if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
284 #    include <sys/ndir.h>
285 #   endif
286 #   if defined(MAGICKCORE_HAVE_SYS_DIR_H)
287 #    include <sys/dir.h>
288 #   endif
289 #   if defined(MAGICKCORE_HAVE_NDIR_H)
290 #    include <ndir.h>
291 #   endif
292 #  else
293 #   include <dirent.h>
294 #   define NAMLEN(dirent) strlen((dirent)->d_name)
295 #  endif
296 #  include <sys/wait.h>
297 #  include <pwd.h>
298 # endif
299 # if !defined(S_ISDIR)
300 #  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
301 # endif
302 # if !defined(S_ISREG)
303 #  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
304 # endif
305 # include "magick/magick-type.h"
306 # if !defined(__WINDOWS__)
307 #  include <sys/time.h>
308 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
309 #  include <sys/times.h>
310 # endif
311 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
312 #  include <sys/resource.h>
313 # endif
314 #endif
315 #else
316 # include <types.h>
317 # include <stat.h>
318 # if defined(macintosh)
319 #  if !defined(DISABLE_SIOUX)
320 #   include <SIOUX.h>
321 #   include <console.h>
322 #  endif
323 #  include <unix.h>
324 # endif
325 # include "magick/magick-type.h"
326 #endif
327
328 #if defined(S_IRUSR) && defined(S_IWUSR)
329 # define S_MODE (S_IRUSR | S_IWUSR)
330 #elif defined (__WINDOWS__)
331 # define S_MODE (_S_IREAD | _S_IWRITE)
332 #else
333 # define S_MODE  0600
334 #endif
335
336 #if defined(__WINDOWS__)
337 # include "magick/nt-base.h"
338 #endif
339 #if defined(macintosh)
340 # include "magick/mac.h"
341 #endif
342 #if defined(vms)
343 # include "magick/vms.h"
344 #endif
345
346 #undef HAVE_CONFIG_H
347 #undef gamma
348 #undef index
349 #undef pipe
350 #undef y1
351
352 /*
353   Review these platform specific definitions.
354 */
355 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
356 # define DirectorySeparator  "/"
357 # define DirectoryListSeparator  ':'
358 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
359 # define Exit  exit
360 # define IsBasenameSeparator(c)  ((c) == '/' ? MagickTrue : MagickFalse)
361 # define X11_PREFERENCES_PATH  "~/."
362 # define ProcessPendingEvents(text)
363 # define ReadCommandlLine(argc,argv)
364 # define SetNotifyHandlers
365 #else
366 # if defined(vms)
367 #  define X11_APPLICATION_PATH  "decw$system_defaults:"
368 #  define DirectorySeparator  ""
369 #  define DirectoryListSeparator  ';'
370 #  define EditorOptions  ""
371 #  define Exit  exit
372 #  define IsBasenameSeparator(c) \
373   (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
374 #  define MAGICKCORE_LIBRARY_PATH  "sys$login:"
375 #  define MAGICKCORE_CODER_PATH  "sys$login:"
376 #  define MAGICKCORE_FILTER_PATH  "sys$login:"
377 #  define MAGICKCORE_SHARE_PATH  "sys$login:"
378 #  define X11_PREFERENCES_PATH  "decw$user_defaults:"
379 #  define ProcessPendingEvents(text)
380 #  define ReadCommandlLine(argc,argv)
381 #  define SetNotifyHandlers
382 # endif
383 # if defined(__OS2__)
384 #   define DirectorySeparator  "\\"
385 #   define DirectoryListSeparator  ';'
386 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
387 # define Exit  exit
388 #  define IsBasenameSeparator(c) \
389   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
390 # define PreferencesDefaults  "~\."
391 # define ProcessPendingEvents(text)
392 # define ReadCommandlLine(argc,argv)
393 # define SetNotifyHandlers
394 #endif
395 # if defined(macintosh)
396 #  define X11_APPLICATION_PATH  "/usr/lib/X11/app-defaults/"
397 #  define DirectorySeparator  ":"
398 #  define DirectoryListSeparator  ';'
399 #  define EditorOptions ""
400 #  define IsBasenameSeparator(c)  ((c) == ':' ? MagickTrue : MagickFalse)
401 #  define MAGICKCORE_LIBRARY_PATH  ""
402 #  define MAGICKCORE_CODER_PATH  ""
403 #  define MAGICKCORE_FILTER_PATH  ""
404 #  define MAGICKCORE_SHARE_PATH  ""
405 #  define X11_PREFERENCES_PATH  "~/."
406 #  if defined(DISABLE_SIOUX)
407 #   define ReadCommandlLine(argc,argv)
408 #   define SetNotifyHandlers \
409      SetFatalErrorHandler(MacFatalErrorHandler); \
410      SetErrorHandler(MACErrorHandler); \
411      SetWarningHandler(MACWarningHandler)
412 #  else
413 #   define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
414 #   define SetNotifyHandlers \
415      SetErrorHandler(MACErrorHandler); \
416      SetWarningHandler(MACWarningHandler)
417 #  endif
418 # endif
419 # if defined(__WINDOWS__)
420 #  define DirectorySeparator  "\\"
421 #  define DirectoryListSeparator  ';'
422 #  define EditorOptions ""
423 #  define IsBasenameSeparator(c) \
424   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
425 #  define ProcessPendingEvents(text)
426 #  if !defined(X11_PREFERENCES_PATH)
427 #    define X11_PREFERENCES_PATH  "~\\."
428 #  endif
429 #  define ReadCommandlLine(argc,argv)
430 #  define SetNotifyHandlers \
431     SetErrorHandler(NTErrorHandler); \
432     SetWarningHandler(NTWarningHandler)
433 #  undef sleep
434 #  define sleep(seconds)  Sleep(seconds*1000)
435 #  if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
436 #    define HAVE_TIFFCONF_H
437 #  endif
438 # endif
439
440 #endif
441
442 /*
443   Define system symbols if not already defined.
444 */
445 #if !defined(STDIN_FILENO)
446 #define STDIN_FILENO  0x00
447 #endif
448
449 #if !defined(O_BINARY)
450 #define O_BINARY  0x00
451 #endif
452
453 #if !defined(PATH_MAX)
454 #define PATH_MAX  4096
455 #endif
456
457 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(__WINDOWS__) && defined(_DLL) && !defined(_LIB))
458 #  define MAGICKCORE_MODULES_SUPPORT
459 #endif
460
461 #if defined(_MAGICKMOD_)
462 # undef MAGICKCORE_BUILD_MODULES
463 # define MAGICKCORE_BUILD_MODULES
464 #endif
465
466 /*
467   I/O defines.
468 */
469 #if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
470 #define MagickSeek(file,offset,whence)  _lseeki64(file,offset,whence)
471 #define MagickTell(file)  _telli64(file)
472 #else
473 #define MagickSeek(file,offset,whence)  lseek(file,offset,whence)
474 #define MagickTell(file) tell(file)
475 #endif
476
477 /*
478   Magick defines.
479 */
480 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
481
482 #if defined(__cplusplus) || defined(c_plusplus)
483 }
484 #endif
485
486 #endif