PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/branches/ImageMagick-6.8.0/magick/studio.h

https://github.com/trevor/ImageMagick
C Header | 370 lines | 314 code | 30 blank | 26 comment | 63 complexity | 59ae46f74f1adf2b09eea7d1073e7a7c MD5 | raw file
  1. /*
  2. Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
  3. dedicated to making software imaging solutions freely available.
  4. You may not use this file except in compliance with the License.
  5. obtain a copy of the License at
  6. http://www.imagemagick.org/script/license.php
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. MagickCore private application programming interface declarations.
  13. */
  14. #ifndef _MAGICKCORE_STUDIO_H
  15. #define _MAGICKCORE_STUDIO_H
  16. #if defined(__cplusplus) || defined(c_plusplus)
  17. extern "C" {
  18. #endif
  19. #if defined(WIN32) || defined(WIN64)
  20. # define MAGICKCORE_WINDOWS_SUPPORT
  21. #else
  22. # define MAGICKCORE_POSIX_SUPPORT
  23. #endif
  24. #define MAGICKCORE_IMPLEMENTATION 1
  25. #if !defined(_MAGICKCORE_CONFIG_H)
  26. # define _MAGICKCORE_CONFIG_H
  27. # if !defined(vms) && !defined(macintosh)
  28. # include "magick/magick-config.h"
  29. # else
  30. # include "magick-config.h"
  31. # endif
  32. #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
  33. # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
  34. #endif
  35. #if defined(_magickcore_const) && !defined(const)
  36. # define const _magickcore_const
  37. #endif
  38. #if defined(_magickcore_inline) && !defined(inline)
  39. # define inline _magickcore_inline
  40. #endif
  41. #if defined(_magickcore_restrict) && !defined(restrict)
  42. # define restrict _magickcore_restrict
  43. #endif
  44. # if defined(__cplusplus) || defined(c_plusplus)
  45. # undef inline
  46. # endif
  47. #endif
  48. #if defined(MAGICKCORE_NAMESPACE_PREFIX)
  49. # include "magick/methods.h"
  50. #endif
  51. #if !defined(const)
  52. # define STDC
  53. #endif
  54. #include <stdarg.h>
  55. #include <stdio.h>
  56. #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
  57. # include <sys/stat.h>
  58. #endif
  59. #if defined(MAGICKCORE_STDC_HEADERS)
  60. # include <stdlib.h>
  61. # include <stddef.h>
  62. #else
  63. # if defined(MAGICKCORE_HAVE_STDLIB_H)
  64. # include <stdlib.h>
  65. # endif
  66. #endif
  67. #if defined(MAGICKCORE_HAVE_STRING_H)
  68. # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
  69. # include <memory.h>
  70. # endif
  71. # include <string.h>
  72. #endif
  73. #if defined(MAGICKCORE_HAVE_STRINGS_H)
  74. # include <strings.h>
  75. #endif
  76. #if defined(MAGICKCORE_HAVE_INTTYPES_H)
  77. # include <inttypes.h>
  78. #endif
  79. #if defined(MAGICKCORE_HAVE_STDINT_H)
  80. # include <stdint.h>
  81. #endif
  82. #if defined(MAGICKCORE_HAVE_UNISTD_H)
  83. # include <unistd.h>
  84. #endif
  85. #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
  86. #define _CRTDBG_MAP_ALLOC
  87. #endif
  88. #if defined(MAGICKCORE_WINDOWS_SUPPORT)
  89. # include <direct.h>
  90. # if !defined(MAGICKCORE_HAVE_STRERROR)
  91. # define HAVE_STRERROR
  92. # endif
  93. #endif
  94. #include <ctype.h>
  95. #include <locale.h>
  96. #include <errno.h>
  97. #include <fcntl.h>
  98. #include <math.h>
  99. #include <time.h>
  100. #include <limits.h>
  101. #include <signal.h>
  102. #include <assert.h>
  103. #if defined(MAGICKCORE_HAVE_XLOCALE_H)
  104. # include <xlocale.h>
  105. #endif
  106. #if defined(MAGICKCORE_THREAD_SUPPORT)
  107. # include <pthread.h>
  108. #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
  109. # define MAGICKCORE_HAVE_WINTHREADS 1
  110. #include <windows.h>
  111. #endif
  112. #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
  113. # include <sys/syslimits.h>
  114. #endif
  115. #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
  116. # include <arm/limits.h>
  117. #endif
  118. #if defined(MAGICKCORE__OPENCL)
  119. #if defined(MAGICKCORE_HAVE_CL_CL_H)
  120. # include <CL/cl.h>
  121. #endif
  122. #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
  123. # include <OpenCL/cl.h>
  124. #endif
  125. # define MAGICKCORE_OPENCL_SUPPORT 1
  126. #endif
  127. #if defined(_OPENMP) && ((_OPENMP >= 200203) || defined(__OPENCC__))
  128. # include <omp.h>
  129. # define MAGICKCORE_OPENMP_SUPPORT 1
  130. #endif
  131. #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
  132. ssize_t pread(int,void *,size_t,off_t);
  133. #endif
  134. #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
  135. ssize_t pwrite(int,const void *,size_t,off_t);
  136. #endif
  137. #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
  138. extern size_t strlcpy(char *,const char *,size_t);
  139. #endif
  140. #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
  141. extern int vsnprintf(char *,size_t,const char *,va_list);
  142. #endif
  143. #include "magick/method-attribute.h"
  144. #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
  145. # include <sys/types.h>
  146. # include <sys/stat.h>
  147. # if defined(MAGICKCORE_HAVE_FTIME)
  148. # include <sys/timeb.h>
  149. # endif
  150. # if defined(MAGICKCORE_POSIX_SUPPORT)
  151. # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
  152. # define dirent direct
  153. # define NAMLEN(dirent) (dirent)->d_namlen
  154. # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
  155. # include <sys/ndir.h>
  156. # endif
  157. # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
  158. # include <sys/dir.h>
  159. # endif
  160. # if defined(MAGICKCORE_HAVE_NDIR_H)
  161. # include <ndir.h>
  162. # endif
  163. # else
  164. # include <dirent.h>
  165. # define NAMLEN(dirent) strlen((dirent)->d_name)
  166. # endif
  167. # include <sys/wait.h>
  168. # include <pwd.h>
  169. # endif
  170. # if !defined(S_ISDIR)
  171. # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
  172. # endif
  173. # if !defined(S_ISREG)
  174. # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
  175. # endif
  176. # include "magick/magick-type.h"
  177. # if !defined(MAGICKCORE_WINDOWS_SUPPORT)
  178. # include <sys/time.h>
  179. # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
  180. # include <sys/times.h>
  181. # endif
  182. # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
  183. # include <sys/resource.h>
  184. # endif
  185. # if defined(MAGICKCORE_HAVE_SYS_MMAN_H)
  186. # include <sys/mman.h>
  187. # endif
  188. #endif
  189. #else
  190. # include <types.h>
  191. # include <stat.h>
  192. # if defined(macintosh)
  193. # if !defined(DISABLE_SIOUX)
  194. # include <SIOUX.h>
  195. # include <console.h>
  196. # endif
  197. # include <unix.h>
  198. # endif
  199. # include "magick/magick-type.h"
  200. #endif
  201. #if defined(S_IRUSR) && defined(S_IWUSR)
  202. # define S_MODE (S_IRUSR | S_IWUSR)
  203. #elif defined (MAGICKCORE_WINDOWS_SUPPORT)
  204. # define S_MODE (_S_IREAD | _S_IWRITE)
  205. #else
  206. # define S_MODE 0600
  207. #endif
  208. #if defined(MAGICKCORE_WINDOWS_SUPPORT)
  209. # include "magick/nt-base.h"
  210. #endif
  211. #if defined(macintosh)
  212. # include "magick/mac.h"
  213. #endif
  214. #if defined(vms)
  215. # include "magick/vms.h"
  216. #endif
  217. #undef HAVE_CONFIG_H
  218. #undef gamma
  219. #undef index
  220. #undef pipe
  221. #undef y1
  222. /*
  223. Review these platform specific definitions.
  224. */
  225. #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
  226. # define DirectorySeparator "/"
  227. # define DirectoryListSeparator ':'
  228. # define EditorOptions " -title \"Edit Image Comment\" -e vi"
  229. # define Exit exit
  230. # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
  231. # define X11_PREFERENCES_PATH "~/."
  232. # define ProcessPendingEvents(text)
  233. # define ReadCommandlLine(argc,argv)
  234. # define SetNotifyHandlers
  235. #else
  236. # if defined(vms)
  237. # define X11_APPLICATION_PATH "decw$system_defaults:"
  238. # define DirectorySeparator ""
  239. # define DirectoryListSeparator ';'
  240. # define EditorOptions ""
  241. # define Exit exit
  242. # define IsBasenameSeparator(c) \
  243. (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
  244. # define MAGICKCORE_LIBRARY_PATH "sys$login:"
  245. # define MAGICKCORE_CODER_PATH "sys$login:"
  246. # define MAGICKCORE_FILTER_PATH "sys$login:"
  247. # define MAGICKCORE_SHARE_PATH "sys$login:"
  248. # define X11_PREFERENCES_PATH "decw$user_defaults:"
  249. # define ProcessPendingEvents(text)
  250. # define ReadCommandlLine(argc,argv)
  251. # define SetNotifyHandlers
  252. # endif
  253. # if defined(__OS2__)
  254. # define DirectorySeparator "\\"
  255. # define DirectoryListSeparator ';'
  256. # define EditorOptions " -title \"Edit Image Comment\" -e vi"
  257. # define Exit exit
  258. # define IsBasenameSeparator(c) \
  259. (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
  260. # define PreferencesDefaults "~\."
  261. # define ProcessPendingEvents(text)
  262. # define ReadCommandlLine(argc,argv)
  263. # define SetNotifyHandlers
  264. #endif
  265. # if defined(macintosh)
  266. # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
  267. # define DirectorySeparator ":"
  268. # define DirectoryListSeparator ';'
  269. # define EditorOptions ""
  270. # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
  271. # define MAGICKCORE_LIBRARY_PATH ""
  272. # define MAGICKCORE_CODER_PATH ""
  273. # define MAGICKCORE_FILTER_PATH ""
  274. # define MAGICKCORE_SHARE_PATH ""
  275. # define X11_PREFERENCES_PATH "~/."
  276. # if defined(DISABLE_SIOUX)
  277. # define ReadCommandlLine(argc,argv)
  278. # define SetNotifyHandlers \
  279. SetFatalErrorHandler(MacFatalErrorHandler); \
  280. SetErrorHandler(MACErrorHandler); \
  281. SetWarningHandler(MACWarningHandler)
  282. # else
  283. # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
  284. # define SetNotifyHandlers \
  285. SetErrorHandler(MACErrorHandler); \
  286. SetWarningHandler(MACWarningHandler)
  287. # endif
  288. # endif
  289. # if defined(MAGICKCORE_WINDOWS_SUPPORT)
  290. # define DirectorySeparator "\\"
  291. # define DirectoryListSeparator ';'
  292. # define EditorOptions ""
  293. # define IsBasenameSeparator(c) \
  294. (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
  295. # define ProcessPendingEvents(text)
  296. # if !defined(X11_PREFERENCES_PATH)
  297. # define X11_PREFERENCES_PATH "~\\."
  298. # endif
  299. # define ReadCommandlLine(argc,argv)
  300. # define SetNotifyHandlers \
  301. SetErrorHandler(NTErrorHandler); \
  302. SetWarningHandler(NTWarningHandler)
  303. # undef sleep
  304. # define sleep(seconds) Sleep(seconds*1000)
  305. # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
  306. # define HAVE_TIFFCONF_H
  307. # endif
  308. # endif
  309. #endif
  310. /*
  311. Define system symbols if not already defined.
  312. */
  313. #if !defined(STDIN_FILENO)
  314. #define STDIN_FILENO 0x00
  315. #endif
  316. #if !defined(O_BINARY)
  317. #define O_BINARY 0x00
  318. #endif
  319. #if !defined(PATH_MAX)
  320. #define PATH_MAX 4096
  321. #endif
  322. #if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
  323. # define MAGICKCORE_MODULES_SUPPORT
  324. #endif
  325. #if defined(_MAGICKMOD_)
  326. # undef MAGICKCORE_BUILD_MODULES
  327. # define MAGICKCORE_BUILD_MODULES
  328. #endif
  329. /*
  330. Magick defines.
  331. */
  332. #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
  333. #if defined(__cplusplus) || defined(c_plusplus)
  334. }
  335. #endif
  336. #endif