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