PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/branches/ImageMagick-6.5.9/wand/studio.h

https://github.com/trevor/ImageMagick
C Header | 494 lines | 429 code | 39 blank | 26 comment | 93 complexity | 1293a9ecadd36dfbd21d65a084bcfd91 MD5 | raw file
  1. /*
  2. Copyright 1999-2010 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. MagickWand private application programming interface declarations.
  13. */
  14. #ifndef _MAGICKWAND_STUDIO_H
  15. #define _MAGICKWAND_STUDIO_H
  16. #if defined(__cplusplus) || defined(c_plusplus)
  17. extern "C" {
  18. #endif
  19. #if defined(__CYGWIN32__)
  20. # if !defined(__CYGWIN__)
  21. # define __CYGWIN__ __CYGWIN32__
  22. # endif
  23. #endif
  24. #if defined(_WIN32) || defined(WIN32)
  25. # if !defined(__WINDOWS__)
  26. # if defined(_WIN32)
  27. # define __WINDOWS__ _WIN32
  28. # else
  29. # if defined(WIN32)
  30. # define __WINDOWS__ WIN32
  31. # endif
  32. # endif
  33. # endif
  34. #endif
  35. #if defined(_WIN64) || defined(WIN64)
  36. # if !defined(__WINDOWS__)
  37. # if defined(_WIN64)
  38. # define __WINDOWS__ _WIN64
  39. # else
  40. # if defined(WIN64)
  41. # define __WINDOWS__ WIN64
  42. # endif
  43. # endif
  44. # endif
  45. #endif
  46. #if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
  47. # define MAGICKCORE_POSIX_SUPPORT
  48. #endif
  49. #define MAGICKWAND_IMPLEMENTATION 1
  50. #if !defined(_MAGICKWAND_CONFIG_H)
  51. # define _MAGICKWAND_CONFIG_H
  52. # if !defined(vms) && !defined(macintosh)
  53. # include "magick/magick-config.h"
  54. # else
  55. # include "magick-config.h"
  56. # endif
  57. #if defined(MAGICKCORE__FILE_OFFSET_BITS) && !defined(_FILE_OFFSET_BITS)
  58. # define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
  59. #endif
  60. #if defined(_magickcore_const) && !defined(const)
  61. # define const _magickcore_const
  62. #endif
  63. #if defined(_magickcore_inline) && !defined(inline)
  64. # define inline _magickcore_inline
  65. #endif
  66. # if defined(__cplusplus) || defined(c_plusplus)
  67. # undef inline
  68. # endif
  69. #if defined(_magickcore_restrict) && !defined(restrict)
  70. # define restrict _magickcore_restrict
  71. #endif
  72. #endif
  73. #if !defined(const)
  74. # define STDC
  75. #endif
  76. #if defined(__BORLANDC__) && defined(_DLL)
  77. # pragma message("BCBMagick lib DLL export interface")
  78. # define _MAGICKDLL_
  79. # define _MAGICKLIB_
  80. #endif
  81. #if defined(__WINDOWS__)
  82. # if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
  83. # define _MAGICKDLL_
  84. # endif
  85. # if defined(_MAGICKDLL_)
  86. # if defined(_VISUALC_)
  87. # pragma warning( disable: 4273 ) /* Disable the dll linkage warnings */
  88. # endif
  89. # if !defined(_MAGICKLIB_)
  90. # define WandExport __declspec(dllimport)
  91. # if defined(_VISUALC_)
  92. # pragma message( "MagickWand lib DLL import interface" )
  93. # endif
  94. # else
  95. # define WandExport __declspec(dllexport)
  96. # if defined(_VISUALC_)
  97. # pragma message( "MagickWand lib DLL export interface" )
  98. # endif
  99. # endif
  100. # else
  101. # define WandExport
  102. # if defined(_VISUALC_)
  103. # pragma message( "MagickWand lib static interface" )
  104. # endif
  105. # endif
  106. # if defined(_DLL) && !defined(_LIB)
  107. # define ModuleExport __declspec(dllexport)
  108. # if defined(_VISUALC_)
  109. # pragma message( "MagickWand module DLL export interface" )
  110. # endif
  111. # else
  112. # define ModuleExport
  113. # if defined(_VISUALC_)
  114. # pragma message( "MagickWand module static interface" )
  115. # endif
  116. # endif
  117. # define WandGlobal __declspec(thread)
  118. # if defined(_VISUALC_)
  119. # pragma warning(disable : 4018)
  120. # pragma warning(disable : 4068)
  121. # pragma warning(disable : 4244)
  122. # pragma warning(disable : 4142)
  123. # pragma warning(disable : 4800)
  124. # pragma warning(disable : 4786)
  125. # pragma warning(disable : 4996)
  126. # endif
  127. #else
  128. # define WandExport
  129. # define ModuleExport
  130. # define WandGlobal
  131. #endif
  132. #if defined(__cplusplus) || defined(c_plusplus)
  133. # define storage_class c_class
  134. #else
  135. # define storage_class class
  136. #endif
  137. #define WandSignature 0xabacadabUL
  138. #if !defined(MaxTextExtent)
  139. # define MaxTextExtent 4096
  140. #endif
  141. #include <stdarg.h>
  142. #include <stdio.h>
  143. #if defined(MAGICKCORE_HAVE_SYS_STAT_H)
  144. # include <sys/stat.h>
  145. #endif
  146. #if defined(MAGICKCORE_STDC_HEADERS)
  147. # include <stdlib.h>
  148. # include <stddef.h>
  149. #else
  150. # if defined(MAGICKCORE_HAVE_STDLIB_H)
  151. # include <stdlib.h>
  152. # endif
  153. #endif
  154. #if defined(MAGICKCORE_HAVE_STRING_H)
  155. # if !defined(STDC_HEADERS) && defined(MAGICKCORE_HAVE_MEMORY_H)
  156. # include <memory.h>
  157. # endif
  158. # include <string.h>
  159. #endif
  160. #if defined(MAGICKCORE_HAVE_STRINGS_H)
  161. # include <strings.h>
  162. #endif
  163. #if defined(MAGICKCORE_HAVE_INTTYPES_H)
  164. # include <inttypes.h>
  165. #endif
  166. #if defined(MAGICKCORE_HAVE_STDINT_H)
  167. # include <stdint.h>
  168. #endif
  169. #if defined(MAGICKCORE_HAVE_UNISTD_H)
  170. # include <unistd.h>
  171. #endif
  172. #if defined(__WINDOWS__) && defined(_DEBUG)
  173. #define _CRTDBG_MAP_ALLOC
  174. #endif
  175. #if defined(__WINDOWS__)
  176. # include <direct.h>
  177. # if !defined(MAGICKCORE_HAVE_STRERROR)
  178. # define HAVE_STRERROR
  179. # endif
  180. #endif
  181. #if defined(__WINDOWS__) && defined(_DEBUG)
  182. #define _CRTDBG_MAP_ALLOC
  183. #endif
  184. #if defined(__WINDOWS__)
  185. # include <direct.h>
  186. # if !defined(MAGICKCORE_HAVE_STRERROR)
  187. # define HAVE_STRERROR
  188. # endif
  189. #endif
  190. #include <ctype.h>
  191. #include <locale.h>
  192. #include <errno.h>
  193. #include <fcntl.h>
  194. #include <math.h>
  195. #include <time.h>
  196. #include <limits.h>
  197. #include <signal.h>
  198. #include <assert.h>
  199. #if defined(MAGICKCORE_HAVE_PTHREAD)
  200. # include <pthread.h>
  201. #elif defined(__WINDOWS__)
  202. # define MAGICKCORE_HAVE_WINTHREADS 1
  203. #include <windows.h>
  204. #endif
  205. #if defined(MAGICKCORE_HAVE_SYS_SYSLIMITS_H)
  206. # include <sys/syslimits.h>
  207. #endif
  208. #if defined(MAGICKCORE_HAVE_ARM_LIMITS_H)
  209. # include <arm/limits.h>
  210. #endif
  211. #if defined(MAGICKCORE__OPENCL)
  212. #if defined(MAGICKCORE_HAVE_CL_CL_H)
  213. # include <CL/cl.h>
  214. #endif
  215. #if defined(MAGICKCORE_HAVE_OPENCL_CL_H)
  216. # include <OpenCL/cl.h>
  217. #endif
  218. # define MAGICKCORE_OPENCL_SUPPORT 1
  219. #endif
  220. #if defined(_OPENMP) && (_OPENMP >= 200203)
  221. # include <omp.h>
  222. # define MAGICKCORE_OPENMP_SUPPORT 1
  223. #endif
  224. #if defined(MAGICKCORE_HAVE_PREAD) && defined(MAGICKCORE_HAVE_DECL_PREAD) && !MAGICKCORE_HAVE_DECL_PREAD
  225. ssize_t pread(int,void *,size_t,off_t);
  226. #endif
  227. #if defined(MAGICKCORE_HAVE_PWRITE) && defined(MAGICKCORE_HAVE_DECL_PWRITE) && !MAGICKCORE_HAVE_DECL_PWRITE
  228. ssize_t pwrite(int,const void *,size_t,off_t);
  229. #endif
  230. #if defined(MAGICKCORE_HAVE_STRLCPY) && defined(MAGICKCORE_HAVE_DECL_STRLCPY) && !MAGICKCORE_HAVE_DECL_STRLCPY
  231. extern size_t strlcpy(char *,const char *,size_t);
  232. #endif
  233. #if defined(MAGICKCORE_HAVE_VSNPRINTF) && defined(MAGICKCORE_HAVE_DECL_VSNPRINTF) && !MAGICKCORE_HAVE_DECL_VSNPRINTF
  234. extern int vsnprintf(char *,size_t,const char *,va_list);
  235. #endif
  236. #if !defined(wand_attribute)
  237. # if (defined(__GNUC__) && (__GNUC__ >= 3))
  238. # define wand_attribute __attribute__
  239. # else
  240. # define wand_attribute(x) /* nothing */
  241. # endif
  242. #endif
  243. #if !defined(wand_unused)
  244. # if (defined(__GNUC__) && (__GNUC__ >= 3))
  245. # define wand_unused(x) wand_unused_ ## x __attribute__((unused))
  246. # elif defined(__LCLINT__)
  247. # define wand_unused(x) /*@unused@*/ x
  248. # else
  249. # define wand_unused(x) x
  250. # endif
  251. #endif
  252. #if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
  253. # include <sys/types.h>
  254. # include <sys/stat.h>
  255. # if defined(MAGICKCORE_HAVE_FTIME)
  256. # include <sys/timeb.h>
  257. # endif
  258. # if defined(MAGICKCORE_POSIX_SUPPORT)
  259. # if defined(MAGICKCORE_HAVE_SYS_NDIR_H) || defined(MAGICKCORE_HAVE_SYS_DIR_H) || defined(MAGICKCORE_HAVE_NDIR_H)
  260. # define dirent direct
  261. # define NAMLEN(dirent) (dirent)->d_namlen
  262. # if defined(MAGICKCORE_HAVE_SYS_NDIR_H)
  263. # include <sys/ndir.h>
  264. # endif
  265. # if defined(MAGICKCORE_HAVE_SYS_DIR_H)
  266. # include <sys/dir.h>
  267. # endif
  268. # if defined(MAGICKCORE_HAVE_NDIR_H)
  269. # include <ndir.h>
  270. # endif
  271. # else
  272. # include <dirent.h>
  273. # define NAMLEN(dirent) strlen((dirent)->d_name)
  274. # endif
  275. # include <sys/wait.h>
  276. # include <pwd.h>
  277. # endif
  278. # if !defined(S_ISDIR)
  279. # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
  280. # endif
  281. # if !defined(S_ISREG)
  282. # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
  283. # endif
  284. # include "wand/MagickWand.h"
  285. # if !defined(__WINDOWS__)
  286. # include <sys/time.h>
  287. # if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
  288. # include <sys/times.h>
  289. # endif
  290. # if defined(MAGICKCORE_HAVE_SYS_RESOURCE_H)
  291. # include <sys/resource.h>
  292. # endif
  293. #endif
  294. #else
  295. # include <types.h>
  296. # include <stat.h>
  297. # if defined(macintosh)
  298. # if !defined(DISABLE_SIOUX)
  299. # include <SIOUX.h>
  300. # include <console.h>
  301. # endif
  302. # include <unix.h>
  303. # endif
  304. # include "wand/MagickWand.h"
  305. #endif
  306. #if defined(S_IRUSR) && defined(S_IWUSR)
  307. # define S_MODE (S_IRUSR | S_IWUSR)
  308. #elif defined (__WINDOWS__)
  309. # define S_MODE (_S_IREAD | _S_IWRITE)
  310. #else
  311. # define S_MODE 0600
  312. #endif
  313. #if defined(__WINDOWS__)
  314. # include "magick/nt-base.h"
  315. #endif
  316. #if defined(macintosh)
  317. # include "magick/mac.h"
  318. #endif
  319. #if defined(vms)
  320. # include "magick/vms.h"
  321. #endif
  322. #undef HAVE_CONFIG_H
  323. #undef gamma
  324. #undef index
  325. #undef pipe
  326. #undef y1
  327. /*
  328. Review these platform specific definitions.
  329. */
  330. #if defined(MAGICKCORE_POSIX_SUPPORT) && !defined(__OS2__)
  331. # define DirectorySeparator "/"
  332. # define DirectoryListSeparator ':'
  333. # define EditorOptions " -title \"Edit Image Comment\" -e vi"
  334. # define Exit exit
  335. # define IsBasenameSeparator(c) ((c) == '/' ? MagickTrue : MagickFalse)
  336. # define X11_PREFERENCES_PATH "~/."
  337. # define ProcessPendingEvents(text)
  338. # define ReadCommandlLine(argc,argv)
  339. # define SetNotifyHandlers
  340. #else
  341. # if defined(vms)
  342. # define X11_APPLICATION_PATH "decw$system_defaults:"
  343. # define DirectorySeparator ""
  344. # define DirectoryListSeparator ';'
  345. # define EditorOptions ""
  346. # define Exit exit
  347. # define IsBasenameSeparator(c) \
  348. (((c) == ']') || ((c) == ':') || ((c) == '/') ? MagickTrue : MagickFalse)
  349. # define MAGICKCORE_LIBRARY_PATH "sys$login:"
  350. # define MAGICKCORE_CODER_PATH "sys$login:"
  351. # define MAGICKCORE_FILTER_PATH "sys$login:"
  352. # define MAGICKCORE_SHARE_PATH "sys$login:"
  353. # define X11_PREFERENCES_PATH "decw$user_defaults:"
  354. # define ProcessPendingEvents(text)
  355. # define ReadCommandlLine(argc,argv)
  356. # define SetNotifyHandlers
  357. # endif
  358. # if defined(__OS2__)
  359. # define DirectorySeparator "\\"
  360. # define DirectoryListSeparator ';'
  361. # define EditorOptions " -title \"Edit Image Comment\" -e vi"
  362. # define Exit exit
  363. # define IsBasenameSeparator(c) \
  364. (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
  365. # define PreferencesDefaults "~\."
  366. # define ProcessPendingEvents(text)
  367. # define ReadCommandlLine(argc,argv)
  368. # define SetNotifyHandlers
  369. #endif
  370. # if defined(macintosh)
  371. # define X11_APPLICATION_PATH "/usr/lib/X11/app-defaults/"
  372. # define DirectorySeparator ":"
  373. # define DirectoryListSeparator ';'
  374. # define EditorOptions ""
  375. # define IsBasenameSeparator(c) ((c) == ':' ? MagickTrue : MagickFalse)
  376. # define MAGICKCORE_LIBRARY_PATH ""
  377. # define MAGICKCORE_CODER_PATH ""
  378. # define MAGICKCORE_FILTER_PATH ""
  379. # define MAGICKCORE_SHARE_PATH ""
  380. # define X11_PREFERENCES_PATH "~/."
  381. # if defined(DISABLE_SIOUX)
  382. # define ReadCommandlLine(argc,argv)
  383. # define SetNotifyHandlers \
  384. SetFatalErrorHandler(MacFatalErrorHandler); \
  385. SetErrorHandler(MACErrorHandler); \
  386. SetWarningHandler(MACWarningHandler)
  387. # else
  388. # define ReadCommandlLine(argc,argv) argc=ccommand(argv); puts(MagickVersion);
  389. # define SetNotifyHandlers \
  390. SetErrorHandler(MACErrorHandler); \
  391. SetWarningHandler(MACWarningHandler)
  392. # endif
  393. # endif
  394. # if defined(__WINDOWS__)
  395. # define DirectorySeparator "\\"
  396. # define DirectoryListSeparator ';'
  397. # define EditorOptions ""
  398. # define IsBasenameSeparator(c) \
  399. (((c) == '/') || ((c) == '\\') ? MagickTrue : MagickFalse)
  400. # define ProcessPendingEvents(text)
  401. # if !defined(X11_PREFERENCES_PATH)
  402. # define X11_PREFERENCES_PATH "~\\."
  403. # endif
  404. # define ReadCommandlLine(argc,argv)
  405. # define SetNotifyHandlers \
  406. SetErrorHandler(NTErrorHandler); \
  407. SetWarningHandler(NTWarningHandler)
  408. # undef sleep
  409. # define sleep(seconds) Sleep(seconds*1000)
  410. # if !defined(MAGICKCORE_HAVE_TIFFCONF_H)
  411. # define HAVE_TIFFCONF_H
  412. # endif
  413. # endif
  414. #endif
  415. /*
  416. Define system symbols if not already defined.
  417. */
  418. #if !defined(STDIN_FILENO)
  419. #define STDIN_FILENO 0x00
  420. #endif
  421. #if !defined(O_BINARY)
  422. #define O_BINARY 0x00
  423. #endif
  424. #if !defined(PATH_MAX)
  425. #define PATH_MAX 4096
  426. #endif
  427. /*
  428. I/O defines.
  429. */
  430. #if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
  431. #define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
  432. #define MagickTell(file) _telli64(file)
  433. #else
  434. #define MagickSeek(file,offset,whence) lseek(file,offset,whence)
  435. #define MagickTell(file) tell(file)
  436. #endif
  437. #define ThrowWandFatalException(severity,tag,context) \
  438. { \
  439. ExceptionInfo \
  440. *exception; \
  441. \
  442. exception=AcquireExceptionInfo(); \
  443. (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \
  444. "`%s'",context); \
  445. CatchException(exception); \
  446. exception=DestroyExceptionInfo(exception); \
  447. }
  448. #if defined(__cplusplus) || defined(c_plusplus)
  449. }
  450. #endif
  451. #endif