MagickWand  7.1.0
Convert, Edit, Or Compose Bitmap Images
studio.h
1 /*
2  Copyright @ 1999 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. You may
6  obtain a copy of the License at
7 
8  https://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  MagickWand private application programming interface declarations.
17 */
18 #ifndef MAGICKWAND_STUDIO_H
19 #define MAGICKWAND_STUDIO_H
20 
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24 
25 #if defined(WIN32) || defined(WIN64)
26 # define MAGICKWAND_WINDOWS_SUPPORT
27 #else
28 # define MAGICKWAND_POSIX_SUPPORT
29 #endif
30 
31 #define MAGICKWAND_IMPLEMENTATION 1
32 
33 #if !defined(MAGICKWAND_CONFIG_H)
34 # define MAGICKWAND_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 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(const)
51 # define STDC
52 #endif
53 
54 /* Define to 1 if assertions should be disabled. */
55 #if defined(MAGICKCORE_NDEBUG)
56 #define NDEBUG 1
57 #endif
58 
59 #include <stdarg.h>
60 #include <stdio.h>
61 #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
62 # include <sys/stat.h>
63 #endif
64 #if defined(MAGICKCORE_STDC_HEADERS)
65 # include <stdlib.h>
66 # include <stddef.h>
67 #else
68 # if defined(MAGICKCORE_HAVE_STDLIB_H)
69 # include <stdlib.h>
70 # endif
71 #endif
72 #if !defined(magick_restrict)
73 # if !defined(_magickcore_restrict)
74 # define magick_restrict restrict
75 # else
76 # define magick_restrict _magickcore_restrict
77 # endif
78 #endif
79 #if defined(MAGICKCORE_HAVE_STRING_H)
80 # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
81 # include <memory.h>
82 # endif
83 # include <string.h>
84 #endif
85 #if defined(MAGICKCORE_HAVE_STRINGS_H)
86 # include <strings.h>
87 #endif
88 #if defined(MAGICKCORE_HAVE_INTTYPES_H)
89 # include <inttypes.h>
90 #endif
91 #if defined(MAGICKCORE_HAVE_STDINT_H)
92 # include <stdint.h>
93 #endif
94 #if defined(MAGICKCORE_HAVE_UNISTD_H)
95 # include <unistd.h>
96 #endif
97 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
98 #define _CRTDBG_MAP_ALLOC
99 #endif
100 
101 #if defined(MAGICKWAND_WINDOWS_SUPPORT) && defined(_DEBUG)
102 #define _CRTDBG_MAP_ALLOC
103 #endif
104 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
105 # include <io.h>
106 #if !defined(__CYGWIN__)
107 # include <direct.h>
108 #endif
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 #endif
130 #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
131 # include <sys/syslimits.h>
132 #endif
133 #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
134 # include <arm/limits.h>
135 #endif
136 
137 #if defined(MAGICKCORE_HAVE_CL_CL_H)
138 # include <CL/cl.h>
139 # define MAGICKCORE_OPENCL_SUPPORT 1
140 #endif
141 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
142 # include <OpenCL/cl.h>
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 "MagickWand/method-attribute.h"
168 
169 #if defined(MAGICKWAND_WINDOWS_SUPPORT) || defined(MAGICKWAND_POSIX_SUPPORT)
170 # include <sys/types.h>
171 # include <sys/stat.h>
172 # if defined(MAGICKWAND_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 "MagickWand/MagickWand.h"
199 # if !defined(MAGICKWAND_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 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
211 # include <sys/sendfile.h>
212 # endif
213 #endif
214 #else
215 # include <types.h>
216 # include <stat.h>
217 #endif
218 
219 #if defined(S_IRUSR) && defined(S_IWUSR)
220 # define S_MODE (S_IRUSR | S_IWUSR)
221 #elif defined (MAGICKWAND_WINDOWS_SUPPORT)
222 # define S_MODE (_S_IREAD | _S_IWRITE)
223 #else
224 # define S_MODE 0600
225 #endif
226 
227 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
228 # include "MagickCore/nt-base.h"
229 #endif
230 
231 #undef HAVE_CONFIG_H
232 #undef gamma
233 #undef index
234 #undef pipe
235 #undef y1
236 
237 /*
238  Review these platform specific definitions.
239 */
240 #if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__)
241 # define DirectorySeparator "/"
242 # define DirectoryListSeparator ':'
243 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
244 # define Exit exit
245 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
246 # define X11_PREFERENCES_PATH "~/."
247 # define ProcessPendingEvents(text)
248 # define ReadCommandlLine(argc,argv)
249 # define SetNotifyHandlers
250 #else
251 # if 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) \
257  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
258 # define PreferencesDefaults "~\."
259 # define ProcessPendingEvents(text)
260 # define ReadCommandlLine(argc,argv)
261 # define SetNotifyHandlers
262 #endif
263 # if defined(MAGICKWAND_WINDOWS_SUPPORT)
264 # define DirectorySeparator "\\"
265 # define DirectoryListSeparator ';'
266 # define EditorOptions ""
267 # define IsBasenameSeparator(c) \
268  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
269 # define ProcessPendingEvents(text)
270 # if !defined(X11_PREFERENCES_PATH)
271 # define X11_PREFERENCES_PATH "~\\."
272 # endif
273 # define ReadCommandlLine(argc,argv)
274 # define SetNotifyHandlers \
275  SetErrorHandler(NTErrorHandler); \
276  SetWarningHandler(NTWarningHandler)
277 # endif
278 
279 #endif
280 
281 /*
282  Define system symbols if not already defined.
283 */
284 #if !defined(STDIN_FILENO)
285 #define STDIN_FILENO 0x00
286 #endif
287 
288 #if !defined(O_BINARY)
289 #define O_BINARY 0x00
290 #endif
291 
292 #if !defined(PATH_MAX)
293 #define PATH_MAX 4096
294 #endif
295 
296 /*
297  Magick defines.
298 */
299 #define MAGICK_SSIZE_MAX (SSIZE_MAX)
300 #define MAGICK_SSIZE_MIN (-(SSIZE_MAX)-1)
301 #if defined(_MSC_VER)
302 # define DisableMSCWarning(nr) __pragma(warning(push)) \
303  __pragma(warning(disable:nr))
304 # define RestoreMSCWarning __pragma(warning(pop))
305 #else
306 # define DisableMSCWarning(nr)
307 # define RestoreMSCWarning
308 #endif
309 
310 #if defined(__cplusplus) || defined(c_plusplus)
311 }
312 #endif
313 
314 #endif