MagickWand  7.1.1-43
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 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
101 # include <io.h>
102 #if !defined(__CYGWIN__)
103 # include <direct.h>
104 #endif
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 #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_HAVE_CL_CL_H)
134 # define MAGICKCORE_OPENCL_SUPPORT 1
135 #endif
136 #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
137 # define MAGICKCORE_OPENCL_SUPPORT 1
138 #endif
139 
140 #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
141 # include <omp.h>
142 # define MAGICKCORE_OPENMP_SUPPORT 1
143 #endif
144 
145 #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
146 ssize_t pread(int,void *,size_t,off_t);
147 #endif
148 
149 #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
150 ssize_t pwrite(int,const void *,size_t,off_t);
151 #endif
152 
153 #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
154 extern size_t strlcpy(char *,const char *,size_t);
155 #endif
156 
157 #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
158 extern int vsnprintf(char *,size_t,const char *,va_list);
159 #endif
160 
161 #include "MagickWand/method-attribute.h"
162 
163 #if defined(MAGICKWAND_WINDOWS_SUPPORT) || defined(MAGICKWAND_POSIX_SUPPORT)
164 # include <sys/types.h>
165 # include <sys/stat.h>
166 # if defined(MAGICKWAND_POSIX_SUPPORT)
167 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
168 # define dirent direct
169 # define NAMLEN(dirent) (dirent)->d_namlen
170 # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
171 # include <sys/ndir.h>
172 # endif
173 # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
174 # include <sys/dir.h>
175 # endif
176 # if defined(MAGICKCORE_HAVE_NDIR_H)
177 # include <ndir.h>
178 # endif
179 # else
180 # include <dirent.h>
181 # define NAMLEN(dirent) strlen((dirent)->d_name)
182 # endif
183 # include <sys/wait.h>
184 # include <pwd.h>
185 # endif
186 # if !defined(S_ISDIR)
187 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
188 # endif
189 # if !defined(S_ISREG)
190 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
191 # endif
192 # include "MagickWand/MagickWand.h"
193 # if !defined(MAGICKWAND_WINDOWS_SUPPORT)
194 # include <sys/time.h>
195 # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
196 # include <sys/times.h>
197 # endif
198 # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
199 # include <sys/resource.h>
200 # endif
201 # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
202 # include <sys/mman.h>
203 # endif
204 # if defined(MAGICKCORE_HAVE_SYS_SENDFILE_H)
205 # include <sys/sendfile.h>
206 # endif
207 #endif
208 #else
209 # include <types.h>
210 # include <stat.h>
211 #endif
212 
213 #if defined(S_IRUSR) && defined(S_IWUSR)
214 # define S_MODE (S_IRUSR | S_IWUSR)
215 #elif defined (MAGICKWAND_WINDOWS_SUPPORT)
216 # define S_MODE (_S_IREAD | _S_IWRITE)
217 #else
218 # define S_MODE 0600
219 #endif
220 
221 #if defined(MAGICKWAND_WINDOWS_SUPPORT)
222 # include "MagickCore/nt-base.h"
223 #endif
224 
225 #undef HAVE_CONFIG_H
226 #undef gamma
227 #undef index
228 #undef pipe
229 #undef y1
230 
231 /*
232  Review these platform specific definitions.
233 */
234 #if defined(MAGICKWAND_POSIX_SUPPORT) && !defined(__OS2__)
235 # define DirectorySeparator "/"
236 # define DirectoryListSeparator ':'
237 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
238 # define Exit exit
239 # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
240 # define X11_PREFERENCES_PATH "~/."
241 # define ProcessPendingEvents(text)
242 # define ReadCommandlLine(argc,argv)
243 # define SetNotifyHandlers
244 #else
245 # if defined(__OS2__)
246 # define DirectorySeparator "\\"
247 # define DirectoryListSeparator ';'
248 # define EditorOptions " -title \"Edit Image Comment\" -e vi"
249 # define Exit exit
250 # define IsBasenameSeparator(c) \
251  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
252 # define PreferencesDefaults "~\."
253 # define ProcessPendingEvents(text)
254 # define ReadCommandlLine(argc,argv)
255 # define SetNotifyHandlers
256 #endif
257 # if defined(MAGICKWAND_WINDOWS_SUPPORT)
258 # define DirectorySeparator "\\"
259 # define DirectoryListSeparator ';'
260 # define EditorOptions ""
261 # define IsBasenameSeparator(c) \
262  (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
263 # define ProcessPendingEvents(text)
264 # if !defined(X11_PREFERENCES_PATH)
265 # define X11_PREFERENCES_PATH "~\\."
266 # endif
267 # define ReadCommandlLine(argc,argv)
268 # define SetNotifyHandlers \
269  SetErrorHandler(NTErrorHandler); \
270  SetWarningHandler(NTWarningHandler)
271 # endif
272 
273 #endif
274 
275 /*
276  Define system symbols if not already defined.
277 */
278 #if !defined(STDIN_FILENO)
279 #define STDIN_FILENO 0x00
280 #endif
281 
282 #if !defined(O_BINARY)
283 #define O_BINARY 0x00
284 #endif
285 
286 #if !defined(PATH_MAX)
287 #define PATH_MAX 4096
288 #endif
289 
290 /*
291  Magick defines.
292 */
293 #if defined(_MSC_VER)
294 # define DisableMSCWarning(nr) __pragma(warning(push)) \
295  __pragma(warning(disable:nr))
296 # define RestoreMSCWarning __pragma(warning(pop))
297 #else
298 # define DisableMSCWarning(nr)
299 # define RestoreMSCWarning
300 #endif
301 
302 #if defined(__cplusplus) || defined(c_plusplus)
303 }
304 #endif
305 
306 #endif