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