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