MagickCore  6.8.9
studio.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2014 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 #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(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 <direct.h>
101 # include <io.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 <windows.h>
125 #endif
126 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
127 # include <sys/syslimits.h>
128 #endif
129 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
130 # include <arm/limits.h>
131 #endif
132 
133 #if defined(MAGICKCORE__OPENCL)
134 #if defined(MAGICKCORE_HAVE_CL_CL_H)
135 # include <CL/cl.h>
136 #endif
137 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
138 # include <OpenCL/cl.h>
139 #endif
140 # define MAGICKCORE_OPENCL_SUPPORT 1
141 #endif
142 
143 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
144 # include <omp.h>
145 # define MAGICKCORE_OPENMP_SUPPORT 1
146 #endif
147 
148 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
149 ssize_t pread(int,void *,size_t,off_t);
150 #endif
151 
152 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
153 ssize_t pwrite(int,const void *,size_t,off_t);
154 #endif
155 
156 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
157 extern size_t strlcpy(char *,const char *,size_t);
158 #endif
159 
160 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
161 extern int vsnprintf(char *,size_t,const char *,va_list);
162 #endif
163 
164 #include "magick/method-attribute.h"
165 
166 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
167 # include <sys/types.h>
168 # include <sys/stat.h>
169 # if defined(MAGICKCORE_HAVE_FTIME)
170 # include <sys/timeb.h>
171 # endif
172 # if defined(MAGICKCORE_POSIX_SUPPORT)
173 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
174 # define dirent direct
175 # define NAMLEN(dirent) (dirent)->d_namlen
176 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
177 # include <sys/ndir.h>
178 # endif
179 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
180 # include <sys/dir.h>
181 # endif
182 # if defined(MAGICKCORE_HAVE_NDIR_H)
183 # include <ndir.h>
184 # endif
185 # else
186 # include <dirent.h>
187 # define NAMLEN(dirent) strlen((dirent)->d_name)
188 # endif
189 # include <sys/wait.h>
190 # include <pwd.h>
191 # endif
192 # if !defined(S_ISDIR)
193 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
194 # endif
195 # if !defined(S_ISREG)
196 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
197 # endif
198 # include "magick/magick-type.h"
199 # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
200 # include <sys/time.h>
201 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
202 # include <sys/times.h>
203 # endif
204 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
205 # include <sys/resource.h>
206 # endif
207 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
208 # include <sys/mman.h>
209 # endif
210 #endif
211 #else
212 # include <types.h>
213 # include <stat.h>
214 # if defined(macintosh)
215 # if !defined(DISABLE_SIOUX)
216 # include <SIOUX.h>
217 # include <console.h>
218 # endif
219 # include <unix.h>
220 # endif
221 # include "magick/magick-type.h"
222 #endif
223 
224 #if defined(S_IRUSR) && defined(S_IWUSR)
225 # define S_MODE (S_IRUSR | S_IWUSR)
226 #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
227 # define S_MODE (_S_IREAD | _S_IWRITE)
228 #else
229 # define S_MODE 0600
230 #endif
231 
232 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
233 # include "magick/nt-base.h"
234 #endif
235 #if defined(macintosh)
236 # include "magick/mac.h"
237 #endif
238 #if defined(vms)
239 # include "magick/vms.h"
240 #endif
241 
242 #undef HAVE_CONFIG_H
243 #undef gamma
244 #undef index
245 #undef pipe
246 #undef y1
247 
248 /*
249  Review these platform specific definitions.
250 */
251 #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
252 # define DirectorySeparator "/"
253 # define DirectoryListSeparator ':'
254 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
255 # define Exit exit
256 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
257 # define X11_PREFERENCES_PATH "~/."
258 # define ProcessPendingEvents(text)
259 # define ReadCommandlLine(argc,argv)
260 # define SetNotifyHandlers
261 #else
262 # if defined(vms)
263 # define X11_APPLICATION_PATH "decw$system_defaults:"
264 # define DirectorySeparator ""
265 # define DirectoryListSeparator ';'
266 # define EditorOptions ""
267 # define Exit exit
268 # define IsBasenameSeparator(c) \
269  (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
270 # define MAGICKCORE_LIBRARY_PATH "sys$login:"
271 # define MAGICKCORE_SHARE_PATH "sys$login:"
272 # define X11_PREFERENCES_PATH "decw$user_defaults:"
273 # define ProcessPendingEvents(text)
274 # define ReadCommandlLine(argc,argv)
275 # define SetNotifyHandlers
276 # endif
277 # if defined(__OS2__)
278 # define DirectorySeparator "\\"
279 # define DirectoryListSeparator ';'
280 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
281 # define Exit exit
282 # define IsBasenameSeparator(c) \
283  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
284 # define PreferencesDefaults "~\."
285 # define ProcessPendingEvents(text)
286 # define ReadCommandlLine(argc,argv)
287 # define SetNotifyHandlers
288 #endif
289 # if defined(macintosh)
290 # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
291 # define DirectorySeparator ":"
292 # define DirectoryListSeparator ';'
293 # define EditorOptions ""
294 # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
295 # define MAGICKCORE_LIBRARY_PATH ""
296 # define MAGICKCORE_SHARE_PATH ""
297 # define X11_PREFERENCES_PATH "~/."
298 # if defined(DISABLE_SIOUX)
299 # define ReadCommandlLine(argc,argv)
300 # define SetNotifyHandlers \
301  SetFatalErrorHandler(MacFatalErrorHandler); \
302  SetErrorHandler(MACErrorHandler); \
303  SetWarningHandler(MACWarningHandler)
304 # else
305 # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
306 # define SetNotifyHandlers \
307  SetErrorHandler(MACErrorHandler); \
308  SetWarningHandler(MACWarningHandler)
309 # endif
310 # endif
311 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
312 # define DirectorySeparator "\\"
313 # define DirectoryListSeparator ';'
314 # define EditorOptions ""
315 # define IsBasenameSeparator(c) \
316  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
317 # define ProcessPendingEvents(text)
318 # if !defined(X11_PREFERENCES_PATH)
319 # define X11_PREFERENCES_PATH "~\\."
320 # endif
321 # define ReadCommandlLine(argc,argv)
322 # define SetNotifyHandlers \
323  SetErrorHandler(NTErrorHandler); \
324  SetWarningHandler(NTWarningHandler)
325 # undef sleep
326 # define sleep(seconds) Sleep(seconds*1000)
327 # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
328 # define HAVE_TIFFCONF_H
329 # endif
330 # endif
331 
332 #endif
333 
334 /*
335  Define system symbols if not already defined.
336 */
337 #if !defined(STDIN_FILENO)
338 #define STDIN_FILENO 0x00
339 #endif
340 
341 #if !defined(O_BINARY)
342 #define O_BINARY 0x00
343 #endif
344 
345 #if !defined(PATH_MAX)
346 #define PATH_MAX 4096
347 #endif
348 
349 #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
350 # define MAGICKCORE_MODULES_SUPPORT
351 #endif
352 
353 #if defined(_MAGICKMOD_)
354 # undef MAGICKCORE_BUILD_MODULES
355 # define MAGICKCORE_BUILD_MODULES
356 #endif
357 
358 /*
359  Magick defines.
360 */
361 #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
362 #if defined(_MSC_VER)
363 # define DisableMSCWarning(nr) __pragma(warning(push)) \
364  __pragma(warning(disable:nr))
365 # define RestoreMSCWarning __pragma(warning(pop))
366 #else
367 # define DisableMSCWarning(nr)
368 # define RestoreMSCWarning
369 #endif
370 
371 #if defined(__cplusplus) || defined(c_plusplus)
372 }
373 #endif
374 
375 #endif