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