]> granicus.if.org Git - imagemagick/blob - magick/studio.h
(no commit message)
[imagemagick] / magick / 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 "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(_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 "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_XLOCALE_H)
184 # include <xlocale.h>
185 #endif
186 #if defined(MAGICKCORE_THREAD_SUPPORT)
187 # include <pthread.h>
188 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
189 #  define MAGICKCORE_HAVE_WINTHREADS  1
190 #include <windows.h>
191 #endif
192 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
193 # include <sys/syslimits.h>
194 #endif
195 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
196 # include <arm/limits.h>
197 #endif
198
199 #if defined(MAGICKCORE__OPENCL)
200 #if defined(MAGICKCORE_HAVE_CL_CL_H)
201 #  include <CL/cl.h>
202 #endif
203 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
204 #  include <OpenCL/cl.h>
205 #endif
206 #  define MAGICKCORE_OPENCL_SUPPORT  1
207 #endif
208
209 #if defined(_OPENMP) && (_OPENMP >= 200203)
210 #  include <omp.h>
211 #  define MAGICKCORE_OPENMP_SUPPORT  1
212 #endif
213
214 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
215 ssize_t pread(int,void *,size_t,off_t);
216 #endif
217
218 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
219 ssize_t pwrite(int,const void *,size_t,off_t);
220 #endif
221
222 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
223 extern size_t strlcpy(char *,const char *,size_t);
224 #endif
225
226 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
227 extern int vsnprintf(char *,size_t,const char *,va_list);
228 #endif
229
230 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
231 #  define magick_aligned(x)  __attribute__((aligned(x)))
232 #  define magick_attribute  __attribute__
233 #  define magick_unused(x)  magick_unused_ ## x __attribute__((unused))
234 #else
235 #  define magick_aligned(x)  /* nothing */
236 #  define magick_attribute(x)  /* nothing */
237 #  define magick_unused(x) x
238 #endif
239
240 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
241 # include <sys/types.h>
242 # include <sys/stat.h>
243 # if defined(MAGICKCORE_HAVE_FTIME)
244 # include <sys/timeb.h>
245 # endif
246 # if defined(MAGICKCORE_POSIX_SUPPORT)
247 #  if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
248 #   define dirent direct
249 #   define NAMLEN(dirent) (dirent)->d_namlen
250 #   if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
251 #    include <sys/ndir.h>
252 #   endif
253 #   if defined(MAGICKCORE_HAVE_SYS_DIR_H)
254 #    include <sys/dir.h>
255 #   endif
256 #   if defined(MAGICKCORE_HAVE_NDIR_H)
257 #    include <ndir.h>
258 #   endif
259 #  else
260 #   include <dirent.h>
261 #   define NAMLEN(dirent) strlen((dirent)->d_name)
262 #  endif
263 #  include <sys/wait.h>
264 #  include <pwd.h>
265 # endif
266 # if !defined(S_ISDIR)
267 #  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
268 # endif
269 # if !defined(S_ISREG)
270 #  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
271 # endif
272 # include "magick/magick-type.h"
273 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
274 #  include <sys/time.h>
275 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
276 #  include <sys/times.h>
277 # endif
278 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
279 #  include <sys/resource.h>
280 # endif
281 #endif
282 #else
283 # include <types.h>
284 # include <stat.h>
285 # if defined(macintosh)
286 #  if !defined(DISABLE_SIOUX)
287 #   include <SIOUX.h>
288 #   include <console.h>
289 #  endif
290 #  include <unix.h>
291 # endif
292 # include "magick/magick-type.h"
293 #endif
294
295 #if defined(S_IRUSR) && defined(S_IWUSR)
296 # define S_MODE (S_IRUSR | S_IWUSR)
297 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
298 # define S_MODE (_S_IREAD | _S_IWRITE)
299 #else
300 # define S_MODE  0600
301 #endif
302
303 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
304 # include "magick/nt-base.h"
305 #endif
306 #if defined(macintosh)
307 # include "magick/mac.h"
308 #endif
309 #if defined(vms)
310 # include "magick/vms.h"
311 #endif
312
313 #undef HAVE_CONFIG_H
314 #undef gamma
315 #undef index
316 #undef pipe
317 #undef y1
318
319 /*
320   Review these platform specific definitions.
321 */
322 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
323 # define DirectorySeparator  "/"
324 # define DirectoryListSeparator  ':'
325 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
326 # define Exit  exit
327 # define IsBasenameSeparator(c)  ((c) == '/' ? MagickTrue : MagickFalse)
328 # define X11_PREFERENCES_PATH  "~/."
329 # define ProcessPendingEvents(text)
330 # define ReadCommandlLine(argc,argv)
331 # define SetNotifyHandlers
332 #else
333 # if defined(vms)
334 #  define X11_APPLICATION_PATH  "decw$system_defaults:"
335 #  define DirectorySeparator  ""
336 #  define DirectoryListSeparator  ';'
337 #  define EditorOptions  ""
338 #  define Exit  exit
339 #  define IsBasenameSeparator(c) \
340   (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
341 #  define MAGICKCORE_LIBRARY_PATH  "sys$login:"
342 #  define MAGICKCORE_CODER_PATH  "sys$login:"
343 #  define MAGICKCORE_FILTER_PATH  "sys$login:"
344 #  define MAGICKCORE_SHARE_PATH  "sys$login:"
345 #  define X11_PREFERENCES_PATH  "decw$user_defaults:"
346 #  define ProcessPendingEvents(text)
347 #  define ReadCommandlLine(argc,argv)
348 #  define SetNotifyHandlers
349 # endif
350 # if defined(__OS2__)
351 #   define DirectorySeparator  "\\"
352 #   define DirectoryListSeparator  ';'
353 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
354 # define Exit  exit
355 #  define IsBasenameSeparator(c) \
356   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
357 # define PreferencesDefaults  "~\."
358 # define ProcessPendingEvents(text)
359 # define ReadCommandlLine(argc,argv)
360 # define SetNotifyHandlers
361 #endif
362 # if defined(macintosh)
363 #  define X11_APPLICATION_PATH  "/usr/lib/X11/app-defaults/"
364 #  define DirectorySeparator  ":"
365 #  define DirectoryListSeparator  ';'
366 #  define EditorOptions ""
367 #  define IsBasenameSeparator(c)  ((c) == ':' ? MagickTrue : MagickFalse)
368 #  define MAGICKCORE_LIBRARY_PATH  ""
369 #  define MAGICKCORE_CODER_PATH  ""
370 #  define MAGICKCORE_FILTER_PATH  ""
371 #  define MAGICKCORE_SHARE_PATH  ""
372 #  define X11_PREFERENCES_PATH  "~/."
373 #  if defined(DISABLE_SIOUX)
374 #   define ReadCommandlLine(argc,argv)
375 #   define SetNotifyHandlers \
376      SetFatalErrorHandler(MacFatalErrorHandler); \
377      SetErrorHandler(MACErrorHandler); \
378      SetWarningHandler(MACWarningHandler)
379 #  else
380 #   define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
381 #   define SetNotifyHandlers \
382      SetErrorHandler(MACErrorHandler); \
383      SetWarningHandler(MACWarningHandler)
384 #  endif
385 # endif
386 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
387 #  define DirectorySeparator  "\\"
388 #  define DirectoryListSeparator  ';'
389 #  define EditorOptions ""
390 #  define IsBasenameSeparator(c) \
391   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
392 #  define ProcessPendingEvents(text)
393 #  if !defined(X11_PREFERENCES_PATH)
394 #    define X11_PREFERENCES_PATH  "~\\."
395 #  endif
396 #  define ReadCommandlLine(argc,argv)
397 #  define SetNotifyHandlers \
398     SetErrorHandler(NTErrorHandler); \
399     SetWarningHandler(NTWarningHandler)
400 #  undef sleep
401 #  define sleep(seconds)  Sleep(seconds*1000)
402 #  if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
403 #    define HAVE_TIFFCONF_H
404 #  endif
405 # endif
406
407 #endif
408
409 /*
410   Define system symbols if not already defined.
411 */
412 #if !defined(STDIN_FILENO)
413 #define STDIN_FILENO  0x00
414 #endif
415
416 #if !defined(O_BINARY)
417 #define O_BINARY  0x00
418 #endif
419
420 #if !defined(PATH_MAX)
421 #define PATH_MAX  4096
422 #endif
423
424 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
425 #  define MAGICKCORE_MODULES_SUPPORT
426 #endif
427
428 #if defined(_MAGICKMOD_)
429 # undef MAGICKCORE_BUILD_MODULES
430 # define MAGICKCORE_BUILD_MODULES
431 #endif
432
433 /*
434   Magick defines.
435 */
436 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
437
438 #if defined(__cplusplus) || defined(c_plusplus)
439 }
440 #endif
441
442 #endif