]> granicus.if.org Git - imagemagick/blob - MagickCore/studio.h
(no commit message)
[imagemagick] / MagickCore / studio.h
1 /*
2   Copyright 1999-2015 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(__cplusplus) || defined(c_plusplus)
50 #  undef inline
51 # endif
52 #endif
53
54 #if defined(MAGICKCORE_NAMESPACE_PREFIX)
55 # include "MagickCore/methods.h"
56 #endif
57
58 #if !defined(const)
59 #  define STDC
60 #endif
61
62 #include <stdarg.h>
63 #include <stdio.h>
64 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
65 # include <sys/stat.h>
66 #endif
67 #if defined(MAGICKCORE_STDC_HEADERS)
68 # include <stdlib.h>
69 # include <stddef.h>
70 #else
71 # if defined(MAGICKCORE_HAVE_STDLIB_H)
72 #  include <stdlib.h>
73 # endif
74 #endif
75 #if defined(_magickcore_restrict) && !defined(restrict)
76 # define restrict  _magickcore_restrict
77 #endif
78 #if defined(MAGICKCORE_HAVE_STRING_H)
79 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
80 #  include <memory.h>
81 # endif
82 # include <string.h>
83 #endif
84 #if defined(MAGICKCORE_HAVE_STRINGS_H)
85 # include <strings.h>
86 #endif
87 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
88 # include <inttypes.h>
89 #endif
90 #if defined(MAGICKCORE_HAVE_STDINT_H)
91 # include <stdint.h>
92 #endif
93 #if defined(MAGICKCORE_HAVE_UNISTD_H)
94 # include <unistd.h>
95 #endif
96 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
97 #define _CRTDBG_MAP_ALLOC
98 #endif
99 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
100 # include <io.h>
101 # include <direct.h>
102 # if !defined(MAGICKCORE_HAVE_STRERROR)
103 #  define HAVE_STRERROR
104 # endif
105 #endif
106
107 #include <ctype.h>
108 #include <locale.h>
109 #include <errno.h>
110 #include <fcntl.h>
111 #include <math.h>
112 #include <time.h>
113 #include <limits.h>
114 #include <signal.h>
115 #include <assert.h>
116
117 #if defined(MAGICKCORE_HAVE_XLOCALE_H)
118 # include <xlocale.h>
119 #endif
120 #if defined(MAGICKCORE_THREAD_SUPPORT)
121 # include <pthread.h>
122 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
123 #  define MAGICKCORE_HAVE_WINTHREADS  1
124 #include <winsock2.h>
125 #include <ws2tcpip.h>
126 #include <windows.h>
127 #pragma comment (lib, "ws2_32.lib")
128 #endif
129 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
130 # include <sys/syslimits.h>
131 #endif
132 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
133 # include <arm/limits.h>
134 #endif
135
136 #if defined(MAGICKCORE__OPENCL)
137 #if defined(MAGICKCORE_HAVE_CL_CL_H)
138 #  include <CL/cl.h>
139 #endif
140 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
141 #  include <OpenCL/cl.h>
142 #endif
143 #  define MAGICKCORE_OPENCL_SUPPORT  1
144 #endif
145
146 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
147 #  include <omp.h>
148 #  define MAGICKCORE_OPENMP_SUPPORT  1
149 #endif
150
151 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
152 ssize_t pread(int,void *,size_t,off_t);
153 #endif
154
155 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
156 ssize_t pwrite(int,const void *,size_t,off_t);
157 #endif
158
159 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
160 extern size_t strlcpy(char *,const char *,size_t);
161 #endif
162
163 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
164 extern int vsnprintf(char *,size_t,const char *,va_list);
165 #endif
166
167 #include "MagickCore/method-attribute.h"
168
169 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
170 # include <sys/types.h>
171 # include <sys/stat.h>
172 # if defined(MAGICKCORE_HAVE_FTIME)
173 # include <sys/timeb.h>
174 # endif
175 # if defined(MAGICKCORE_POSIX_SUPPORT)
176 #  if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
177 #   define dirent direct
178 #   define NAMLEN(dirent) (dirent)->d_namlen
179 #   if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
180 #    include <sys/ndir.h>
181 #   endif
182 #   if defined(MAGICKCORE_HAVE_SYS_DIR_H)
183 #    include <sys/dir.h>
184 #   endif
185 #   if defined(MAGICKCORE_HAVE_NDIR_H)
186 #    include <ndir.h>
187 #   endif
188 #  else
189 #   include <dirent.h>
190 #   define NAMLEN(dirent) strlen((dirent)->d_name)
191 #  endif
192 #  include <sys/wait.h>
193 #  include <pwd.h>
194 # endif
195 # if !defined(S_ISDIR)
196 #  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
197 # endif
198 # if !defined(S_ISREG)
199 #  define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
200 # endif
201 # include "MagickCore/magick-type.h"
202 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
203 #  include <sys/time.h>
204 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
205 #  include <sys/times.h>
206 # endif
207 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
208 #  include <sys/resource.h>
209 # endif
210 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
211 #  include <sys/mman.h>
212 # endif
213 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
214 #  include <sys/sendfile.h>
215 # endif
216 #endif
217 #else
218 # include <types.h>
219 # include <stat.h>
220 # if defined(macintosh)
221 #  if !defined(DISABLE_SIOUX)
222 #   include <SIOUX.h>
223 #   include <console.h>
224 #  endif
225 #  include <unix.h>
226 # endif
227 # include "MagickCore/magick-type.h"
228 #endif
229
230 #if defined(S_IRUSR) && defined(S_IWUSR)
231 # define S_MODE (S_IRUSR | S_IWUSR)
232 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
233 # define S_MODE (_S_IREAD | _S_IWRITE)
234 #else
235 # define S_MODE  0600
236 #endif
237
238 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
239 # include "MagickCore/nt-base.h"
240 #endif
241 #if defined(macintosh)
242 # include "MagickCore/mac.h"
243 #endif
244 #if defined(vms)
245 # include "MagickCore/vms.h"
246 #endif
247
248 #undef HAVE_CONFIG_H
249 #undef gamma
250 #undef index
251 #undef pipe
252 #undef y1
253
254 /*
255   Review these platform specific definitions.
256 */
257 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
258 # define DirectorySeparator  "/"
259 # define DirectoryListSeparator  ':'
260 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
261 # define Exit  exit
262 # define IsBasenameSeparator(c)  ((c) == '/' ? MagickTrue : MagickFalse)
263 # define X11_PREFERENCES_PATH  "~/."
264 # define ProcessPendingEvents(text)
265 # define ReadCommandlLine(argc,argv)
266 # define SetNotifyHandlers
267 #else
268 # if defined(vms)
269 #  define X11_APPLICATION_PATH  "decw$system_defaults:"
270 #  define DirectorySeparator  ""
271 #  define DirectoryListSeparator  ';'
272 #  define EditorOptions  ""
273 #  define Exit  exit
274 #  define IsBasenameSeparator(c) \
275   (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
276 #  define MAGICKCORE_LIBRARY_PATH  "sys$login:"
277 #  define MAGICKCORE_SHARE_PATH  "sys$login:"
278 #  define X11_PREFERENCES_PATH  "decw$user_defaults:"
279 #  define ProcessPendingEvents(text)
280 #  define ReadCommandlLine(argc,argv)
281 #  define SetNotifyHandlers
282 # endif
283 # if defined(__OS2__)
284 #   define DirectorySeparator  "\\"
285 #   define DirectoryListSeparator  ';'
286 # define EditorOptions  " -title \"Edit Image Comment\" -e vi"
287 # define Exit  exit
288 #  define IsBasenameSeparator(c) \
289   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
290 # define PreferencesDefaults  "~\."
291 # define ProcessPendingEvents(text)
292 # define ReadCommandlLine(argc,argv)
293 # define SetNotifyHandlers
294 #endif
295 # if defined(macintosh)
296 #  define X11_APPLICATION_PATH  "/usr/lib/X11/app-defaults/"
297 #  define DirectorySeparator  ":"
298 #  define DirectoryListSeparator  ';'
299 #  define EditorOptions ""
300 #  define IsBasenameSeparator(c)  ((c) == ':' ? MagickTrue : MagickFalse)
301 #  define MAGICKCORE_LIBRARY_PATH  ""
302 #  define MAGICKCORE_SHARE_PATH  ""
303 #  define X11_PREFERENCES_PATH  "~/."
304 #  if defined(DISABLE_SIOUX)
305 #   define ReadCommandlLine(argc,argv)
306 #   define SetNotifyHandlers \
307      SetFatalErrorHandler(MacFatalErrorHandler); \
308      SetErrorHandler(MACErrorHandler); \
309      SetWarningHandler(MACWarningHandler)
310 #  else
311 #   define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
312 #   define SetNotifyHandlers \
313      SetErrorHandler(MACErrorHandler); \
314      SetWarningHandler(MACWarningHandler)
315 #  endif
316 # endif
317 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
318 #  define DirectorySeparator  "\\"
319 #  define DirectoryListSeparator  ';'
320 #  define EditorOptions ""
321 #  define IsBasenameSeparator(c) \
322   (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
323 #  define ProcessPendingEvents(text)
324 #  if !defined(X11_PREFERENCES_PATH)
325 #    define X11_PREFERENCES_PATH  "~\\."
326 #  endif
327 #  define ReadCommandlLine(argc,argv)
328 #  define SetNotifyHandlers \
329     SetErrorHandler(NTErrorHandler); \
330     SetWarningHandler(NTWarningHandler)
331 #  undef sleep
332 #  define sleep(seconds)  Sleep(seconds*1000)
333 #  if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
334 #    define HAVE_TIFFCONF_H
335 #  endif
336 # endif
337
338 #endif
339
340 /*
341   Define system symbols if not already defined.
342 */
343 #if !defined(STDIN_FILENO)
344 #define STDIN_FILENO  0x00
345 #endif
346
347 #if !defined(O_BINARY)
348 #define O_BINARY  0x00
349 #endif
350
351 #if !defined(PATH_MAX)
352 #define PATH_MAX  4096
353 #endif
354
355 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
356 #  define MAGICKCORE_MODULES_SUPPORT
357 #endif
358
359 #if defined(_MAGICKMOD_)
360 # undef MAGICKCORE_BUILD_MODULES
361 # define MAGICKCORE_BUILD_MODULES
362 #endif
363
364 /*
365   Magick defines.
366 */
367 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
368 #if defined(_MSC_VER)
369 # define DisableMSCWarning(nr) __pragma(warning(push)) \
370   __pragma(warning(disable:nr))
371 # define RestoreMSCWarning __pragma(warning(pop))
372 #else
373 # define DisableMSCWarning(nr)
374 # define RestoreMSCWarning
375 #endif
376
377 #if defined(__cplusplus) || defined(c_plusplus)
378 }
379 #endif
380
381 #endif