% MagickCore Version and Copyright Methods %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% September 2002 %
% %
% %
-% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/version.h"
+#include "MagickCore/version-private.h"
\f
/*
Define declarations.
% %
% %
% %
+% G e t M a g i c k D e l e g a t e s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% GetMagickDelegates() returns the ImageMagick delegate libraries.
+%
+% The format of the GetMagickDelegates method is:
+%
+% const char *GetMagickDelegates(void)
+%
+% No parameters are required.
+%
+*/
+MagickExport const char *GetMagickDelegates(void)
+{
+ return ""
+#if defined(MAGICKCORE_AUTOTRACE_DELEGATE)
+ "autotrace "
+#endif
+#if defined(MAGICKCORE_BZLIB_DELEGATE)
+ "bzlib "
+#endif
+#if defined(MAGICKCORE_CAIRO_DELEGATE)
+ "cairo "
+#endif
+#if defined(MAGICKCORE_DJVU_DELEGATE)
+ "djvu "
+#endif
+#if defined(MAGICKCORE_DPS_DELEGATE)
+ "dps "
+#endif
+#if defined(MAGICKCORE_EMF_DELEGATE)
+ "emf "
+#endif
+#if defined(MAGICKCORE_FFTW_DELEGATE)
+ "fftw "
+#endif
+#if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
+ "fontconfig "
+#endif
+#if defined(MAGICKCORE_FREETYPE_DELEGATE)
+ "freetype "
+#endif
+#if defined(MAGICKCORE_FPX_DELEGATE)
+ "fpx "
+#endif
+#if defined(MAGICKCORE_GS_DELEGATE)
+ "gslib "
+#endif
+#if defined(MAGICKCORE_GVC_DELEGATE)
+ "gvc "
+#endif
+#if defined(MAGICKCORE_JBIG_DELEGATE)
+ "jbig "
+#endif
+#if defined(MAGICKCORE_JPEG_DELEGATE) && defined(MAGICKCORE_PNG_DELEGATE)
+ "jng "
+#endif
+#if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
+ "jp2 "
+#endif
+#if defined(MAGICKCORE_JPEG_DELEGATE)
+ "jpeg "
+#endif
+#if defined(MAGICKCORE_LCMS_DELEGATE)
+ "lcms "
+#endif
+#if defined(MAGICKCORE_LQR_DELEGATE)
+ "lqr "
+#endif
+#if defined(MAGICKCORE_LTDL_DELEGATE)
+ "ltdl "
+#endif
+#if defined(MAGICKCORE_LZMA_DELEGATE)
+ "lzma "
+#endif
+#if defined(MAGICKCORE_OPENEXR_DELEGATE)
+ "openexr "
+#endif
+#if defined(MAGICKCORE_PANGOCAIRO_DELEGATE)
+ "pangocairo "
+#endif
+#if defined(MAGICKCORE_PNG_DELEGATE)
+ "png "
+#endif
+#if defined(MAGICKCORE_DPS_DELEGATE) || defined(MAGICKCORE_GS_DELEGATE) || defined(WIN32)
+ "ps "
+#endif
+#if defined(MAGICKCORE_RSVG_DELEGATE)
+ "rsvg "
+#endif
+#if defined(MAGICKCORE_TIFF_DELEGATE)
+ "tiff "
+#endif
+#if defined(MAGICKCORE_WEBP_DELEGATE)
+ "webp "
+#endif
+#if defined(MAGICKCORE_WMF_DELEGATE) || defined (MAGICKCORE_WMFLITE_DELEGATE)
+ "wmf "
+#endif
+#if defined(MAGICKCORE_X11_DELEGATE)
+ "x "
+#endif
+#if defined(MAGICKCORE_XML_DELEGATE)
+ "xml "
+#endif
+#if defined(MAGICKCORE_ZLIB_DELEGATE)
+ "zlib"
+#endif
+ ;
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% G e t M a g i c k F e a t u r e s %
% %
% %
*/
MagickExport const char *GetMagickFeatures(void)
{
- return(MagickFeatures);
+ return "DPC"
+#if defined(MAGICKCORE_BUILD_MODULES) || defined(_DLL)
+ " Modules"
+#endif
+#if defined(MAGICKCORE_HDRI_SUPPORT)
+ " HDRI"
+#endif
+#if defined(MAGICKCORE_OPENCL_SUPPORT)
+ " OpenCL"
+#endif
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ " OpenMP"
+#endif
+ ;
}
\f
/*
% %
% %
% %
+% G e t M a g i c k S i g n a t u r e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% GetMagickSignature() returns a signature that uniquely encodes the
+% MagickCore libary version, quantum depth, HDRI status, OS word size, and
+% endianness.
+%
+% The format of the GetMagickSignature method is:
+%
+% unsigned int GetMagickSignature(const StringInfo *nonce)
+%
+% A description of each parameter follows:
+%
+% o nonce: arbitrary data.
+%
+*/
+
+static unsigned int CRC32(const unsigned char *message,const size_t length)
+{
+ register ssize_t
+ i;
+
+ static MagickBooleanType
+ crc_initial = MagickFalse;
+
+ static unsigned int
+ crc_xor[256];
+
+ unsigned int
+ crc;
+
+ /*
+ Generate a 32-bit cyclic redundancy check for the message.
+ */
+ if (crc_initial == MagickFalse)
+ {
+ register unsigned int
+ i;
+
+ unsigned int
+ alpha;
+
+ for (i=0; i < 256; i++)
+ {
+ register ssize_t
+ j;
+
+ alpha=i;
+ for (j=0; j < 8; j++)
+ alpha=(alpha & 0x01) ? (0xEDB88320 ^ (alpha >> 1)) : (alpha >> 1);
+ crc_xor[i]=alpha;
+ }
+ crc_initial=MagickTrue;
+ }
+ crc=0xFFFFFFFF;
+ for (i=0; i < (ssize_t) length; i++)
+ crc=crc_xor[(crc ^ message[i]) & 0xff] ^ (crc >> 8);
+ return(crc ^ 0xFFFFFFFF);
+}
+
+MagickExport unsigned int GetMagickSignature(const StringInfo *nonce)
+{
+ register unsigned char
+ *p;
+
+ StringInfo
+ *version;
+
+ unsigned int
+ signature;
+
+ version=AcquireStringInfo(MaxTextExtent);
+ p=GetStringInfoDatum(version);
+ signature=MAGICKCORE_QUANTUM_DEPTH;
+ (void) memcpy(p,&signature,sizeof(signature));
+ p+=sizeof(signature);
+ signature=MAGICKCORE_HDRI_ENABLE;
+ (void) memcpy(p,&signature,sizeof(signature));
+ p+=sizeof(signature);
+ signature=MagickLibInterface;
+ (void) memcpy(p,&signature,sizeof(signature));
+ p+=sizeof(signature);
+ signature=1; /* endianess */
+ (void) memcpy(p,&signature,sizeof(signature));
+ p+=sizeof(signature);
+ SetStringInfoLength(version,p-GetStringInfoDatum(version));
+ if (nonce != (const StringInfo *) NULL)
+ ConcatenateStringInfo(version,nonce);
+ signature=CRC32(GetStringInfoDatum(version),GetStringInfoLength(version));
+ version=DestroyStringInfo(version);
+ return(signature);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% G e t M a g i c k V e r s i o n %
% %
% %
*version=MagickLibVersion;
return(MagickVersion);
}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% L i s t M a g i c k V e r s i o n %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ListMagickVersion() identifies the ImageMagick version by printing its
+% attributes to the file. Attributes include the copyright, features, and
+% delegates.
+%
+% The format of the ListMagickVersion method is:
+%
+% void ListMagickVersion(FILE *file)
+%
+% A description of each parameter follows:
+%
+% o file: the file, typically stdout.
+%
+*/
+MagickExport void ListMagickVersion(FILE *file)
+{
+ (void) FormatLocaleFile(file,"Version: %s\n",
+ GetMagickVersion((size_t *) NULL));
+ (void) FormatLocaleFile(file,"Copyright: %s\n",GetMagickCopyright());
+ (void) FormatLocaleFile(file,"Features: %s\n",GetMagickFeatures());
+ (void) FormatLocaleFile(file,"Delegates: %s\n\n",GetMagickDelegates());
+}