39#include "MagickCore/studio.h"
40#include "MagickCore/configure.h"
41#include "MagickCore/exception.h"
42#include "MagickCore/exception-private.h"
43#include "MagickCore/linked-list.h"
44#include "MagickCore/locale_.h"
45#include "MagickCore/option.h"
46#include "MagickCore/pixel.h"
47#include "MagickCore/string_.h"
48#include "MagickCore/utility.h"
49#include "MagickCore/utility-private.h"
50#include "MagickCore/version.h"
51#include "MagickCore/version-private.h"
56#define MagickURLFilename "index.html"
76MagickExport
const char *GetMagickCopyright(
void)
78 return(MagickCopyright);
101MagickExport
const char *GetMagickDelegates(
void)
105#if defined(MAGICKCORE_AUTOTRACE_DELEGATE)
108#if defined(MAGICKCORE_BZLIB_DELEGATE)
111#if defined(MAGICKCORE_CAIRO_DELEGATE)
114#if defined(MAGICKCORE_DMR_DELEGATE)
117#if defined(MAGICKCORE_DJVU_DELEGATE)
120#if defined(MAGICKCORE_DPS_DELEGATE)
123#if defined(MAGICKCORE_EMF_DELEGATE)
126#if defined(MAGICKCORE_FFTW_DELEGATE)
129#if defined(MAGICKCORE_FLIF_DELEGATE)
132#if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
135#if defined(MAGICKCORE_FPX_DELEGATE)
138#if defined(MAGICKCORE_FREETYPE_DELEGATE)
141#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
144#if defined(MAGICKCORE_GVC_DELEGATE)
147#if defined(MAGICKCORE_HEIC_DELEGATE)
150#if defined(MAGICKCORE_JBIG_DELEGATE)
153#if defined(MAGICKCORE_JPEG_DELEGATE) && defined(MAGICKCORE_PNG_DELEGATE)
156#if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
159#if defined(MAGICKCORE_JPEG_DELEGATE)
162#if defined(MAGICKCORE_JXL_DELEGATE)
165#if defined(MAGICKCORE_LCMS_DELEGATE)
168#if defined(MAGICKCORE_LQR_DELEGATE)
171#if defined(MAGICKCORE_LTDL_DELEGATE)
174#if defined(MAGICKCORE_LZMA_DELEGATE)
177#if defined(MAGICKCORE_OPENEXR_DELEGATE)
180#if defined(MAGICKCORE_PANGOCAIRO_DELEGATE)
183#if defined(MAGICKCORE_PNG_DELEGATE)
186#if defined(MAGICKCORE_DPS_DELEGATE) || defined(MAGICKCORE_GS_DELEGATE) || \
187 defined(MAGICKCORE_WINDOWS_SUPPORT)
190#if defined(MAGICKCORE_RAQM_DELEGATE)
193#if defined(MAGICKCORE_RAW_R_DELEGATE)
196#if defined(MAGICKCORE_RSVG_DELEGATE)
199#if defined(MAGICKCORE_TIFF_DELEGATE)
202#if defined(MAGICKCORE_UHDR_DELEGATE)
205#if defined(MAGICKCORE_WEBP_DELEGATE)
208#if defined(MAGICKCORE_WMF_DELEGATE) || defined (MAGICKCORE_WMFLITE_DELEGATE)
211#if defined(MAGICKCORE_X11_DELEGATE)
214#if defined(MAGICKCORE_XML_DELEGATE)
217#if defined(MAGICKCORE_ZIP_DELEGATE)
220#if defined(MAGICKCORE_ZLIB_DELEGATE)
223#if defined(MAGICKCORE_ZSTD_DELEGATE)
227 if (*delegates ==
'\0')
252MagickExport
const char *GetMagickFeatures(
void)
255#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
258#if defined(MAGICKCORE_64BIT_CHANNEL_MASK_SUPPORT)
259 "Channel-masks(64-bit) "
261#if defined(MAGICKCORE_CIPHER_SUPPORT)
264#if defined(MAGICKCORE_DPC_SUPPORT)
267#if defined(MAGICKCORE_HDRI_SUPPORT)
270#if defined(MAGICKCORE_BUILD_MODULES) || defined(_DLL)
273#if defined(MAGICKCORE_OPENCL_SUPPORT)
276#if defined(MAGICKCORE_OPENMP_SUPPORT)
280#elif _OPENMP == 200203
282#elif _OPENMP == 200505
284#elif _OPENMP == 200805
286#elif _OPENMP == 201107
288#elif _OPENMP == 201307
290#elif _OPENMP == 201511
292#elif _OPENMP == 201811
298#if defined(MAGICKCORE_HAVE_TCMALLOC)
301#if MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
302 "Zero-configuration "
304#if (MAGICKCORE_QUANTUM_DEPTH == 64)
305 "Q64 (experimental, not for production) "
328MagickExport
char *GetMagickHomeURL(
void)
331 path[MagickPathExtent];
342 exception=AcquireExceptionInfo();
343 paths=GetConfigurePaths(MagickURLFilename,exception);
344 exception=DestroyExceptionInfo(exception);
346 return(ConstantString(MagickHomeURL));
347 element=(
const char *) GetNextValueInLinkedList(paths);
348 while (element != (
const char *) NULL)
350 (void) FormatLocaleString(path,MagickPathExtent,
"%s%s%s",element,
351 DirectorySeparator,MagickURLFilename);
352 if (IsPathAccessible(path) != MagickFalse)
354 paths=DestroyLinkedList(paths,RelinquishMagickMemory);
355 return(ConstantString(path));
357 element=(
const char *) GetNextValueInLinkedList(paths);
359 paths=DestroyLinkedList(paths,RelinquishMagickMemory);
360 return(ConstantString(MagickHomeURL));
381MagickExport
const char *GetMagickLicense(
void)
383 return(MagickAuthoritativeLicense);
406MagickExport
const char *GetMagickPackageName(
void)
408 return(MagickPackageName);
433MagickExport
const char *GetMagickQuantumDepth(
size_t *depth)
435 if (depth != (
size_t *) NULL)
436 *depth=(size_t) MAGICKCORE_QUANTUM_DEPTH;
437 return(MagickQuantumDepth);
462MagickExport
const char *GetMagickQuantumRange(
size_t *range)
464 if (range != (
size_t *) NULL)
465 *range=(size_t) QuantumRange;
466 return(MagickQuantumRange);
489MagickExport
const char *GetMagickReleaseDate(
void)
491 return(MagickReleaseDate);
519static unsigned int CRC32(
const unsigned char *message,
const size_t length)
524 static MagickBooleanType
525 crc_initial = MagickFalse;
536 if (crc_initial == MagickFalse)
544 for (j=0; j < 256; j++)
550 for (k=0; k < 8; k++)
551 alpha=(alpha & 0x01) ? (0xEDB88320 ^ (alpha >> 1)) : (alpha >> 1);
554 crc_initial=MagickTrue;
557 for (i=0; i < (ssize_t) length; i++)
558 crc=crc_xor[(crc ^ message[i]) & 0xff] ^ (crc >> 8);
559 return(crc ^ 0xFFFFFFFF);
562MagickExport
unsigned int GetMagickSignature(
const StringInfo *nonce)
573 version=AcquireStringInfo(MagickPathExtent);
574 p=GetStringInfoDatum(version);
575 signature=MAGICKCORE_QUANTUM_DEPTH;
576 (void) memcpy(p,&signature,
sizeof(signature));
577 p+=
sizeof(signature);
578 signature=MAGICKCORE_HDRI_ENABLE;
579 (void) memcpy(p,&signature,
sizeof(signature));
580 p+=
sizeof(signature);
581 signature=MagickLibInterface;
582 (void) memcpy(p,&signature,
sizeof(signature));
583 p+=
sizeof(signature);
585 (void) memcpy(p,&signature,
sizeof(signature));
586 p+=
sizeof(signature);
587#if defined(MAGICKCORE_64BIT_CHANNEL_MASK_SUPPORT)
588 signature=
sizeof(ChannelType);
589 (void) memcpy(p,&signature,
sizeof(signature));
590 p+=
sizeof(signature);
592 SetStringInfoLength(version,(
size_t) (p-GetStringInfoDatum(version)));
594 ConcatenateStringInfo(version,nonce);
595 signature=CRC32(GetStringInfoDatum(version),GetStringInfoLength(version));
596 version=DestroyStringInfo(version);
623MagickExport
const char *GetMagickVersion(
size_t *version)
625 if (version != (
size_t *) NULL)
626 *version=MagickLibVersion;
627 return(MagickVersion);
654MagickExport
void ListMagickVersion(FILE *file)
656 (void) FormatLocaleFile(file,
"Version: %s\n",
657 GetMagickVersion((
size_t *) NULL));;
658 (void) FormatLocaleFile(file,
"Copyright: %s\n",GetMagickCopyright());
659 (void) FormatLocaleFile(file,
"License: %s\n",GetMagickLicense());
660 (void) FormatLocaleFile(file,
"Features: %s\n",GetMagickFeatures());
661 (void) FormatLocaleFile(file,
"Delegates (built-in): %s\n",
662 GetMagickDelegates());
663#if defined(MAGICKCORE_MSC_VER)
664 (void) FormatLocaleFile(file,
"Compiler: Visual Studio %d (%d)\n",
665 MAGICKCORE_MSC_VER,_MSC_FULL_VER);
666#elif defined(__GNUC__)
667 (void) FormatLocaleFile(file,
"Compiler: gcc (%d.%d)\n",__GNUC__,
669#elif defined(__clang__)
670 (void) FormatLocaleFile(file,
"Compiler: clang (%d.%d.%d)\n",__clang_major__,
671 __clang_minor__,__clang_patchlevel__);
672#elif defined(__MINGW32_MAJOR_VERSION)
673 (void) FormatLocaleFile(file,
"Compiler: MinGW (%d.%d)\n",
674 __MINGW32_MAJOR_VERSION,__MINGW32_MINOR_VERSION);
675#elif defined(__MINGW64_VERSION_MAJOR)
676 (void) FormatLocaleFile(file,
"Compiler: MinGW-w64 (%d.%d)\n",
677 __MINGW64_VERSION_MAJOR ,__MINGW64_VERSION_MINOR);
679 if (IsEventLogging() != MagickFalse)
681 (void) FormatLocaleFile(file,
"Wizard attributes: ");
682 (void) FormatLocaleFile(file,
"QuantumRange=%g; ",(
double) QuantumRange);
683 (void) FormatLocaleFile(file,
"QuantumScale=%.*g; ",GetMagickPrecision(),
684 (
double) QuantumScale);
685 (void) FormatLocaleFile(file,
"MagickEpsilon=%.*g; ",GetMagickPrecision(),
686 (
double) MagickEpsilon);
687 (void) FormatLocaleFile(file,
"MaxMap=%g; ",(
double) MaxMap);
688 (void) FormatLocaleFile(file,
"MagickPathExtent=%g; ",
689 (
double) MagickPathExtent);
690 (void) FormatLocaleFile(file,
"sizeof(Quantum)=%g; ",(
double)
692 (void) FormatLocaleFile(file,
"sizeof(MagickSizeType)=%g; ",(
double)
693 sizeof(MagickSizeType));
694 (void) FormatLocaleFile(file,
"sizeof(MagickOffsetType)=%g",(
double)
695 sizeof(MagickOffsetType));