MagickCore 6.9.13
Loading...
Searching...
No Matches
version.c
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% V V EEEEE RRRR SSSSS IIIII OOO N N %
7% V V E R R SS I O O NN N %
8% V V EEE RRRR SSS I O O N N N %
9% V V E R R SS I O O N NN %
10% V EEEEE R R SSSSS IIIII OOO N N %
11% %
12% %
13% MagickCore Version and Copyright Methods %
14% %
15% Software Design %
16% Cristy %
17% September 2002 %
18% %
19% %
20% Copyright 1999 ImageMagick Studio LLC, a non-profit organization %
21% dedicated to making software imaging solutions freely available. %
22% %
23% You may not use this file except in compliance with the License. You may %
24% obtain a copy of the License at %
25% %
26% https://imagemagick.org/script/license.php %
27% %
28% Unless required by applicable law or agreed to in writing, software %
29% distributed under the License is distributed on an "AS IS" BASIS, %
30% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31% See the License for the specific language governing permissions and %
32% limitations under the License. %
33% %
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35%
36%
37*/
38
39#include "magick/studio.h"
40#include "magick/configure.h"
41#include "magick/exception.h"
42#include "magick/exception-private.h"
43#include "magick/hashmap.h"
44#include "magick/locale_.h"
45#include "magick/memory_.h"
46#include "magick/option.h"
47#include "magick/string_.h"
48#include "magick/utility.h"
49#include "magick/version.h"
50#include "magick/version-private.h"
51
52/*
53 Define declarations.
54*/
55#define MagickURLFilename "index.html"
56
57/*
58%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59% %
60% %
61% %
62% G e t M a g i c k C o p y r i g h t %
63% %
64% %
65% %
66%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67%
68% GetMagickCopyright() returns the ImageMagick API copyright as a string.
69%
70% The format of the GetMagickCopyright method is:
71%
72% const char *GetMagickCopyright(void)
73%
74*/
75MagickExport const char *GetMagickCopyright(void)
76{
77 return(MagickCopyright);
78}
79
80/*
81%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82% %
83% %
84% %
85% G e t M a g i c k D e l e g a t e s %
86% %
87% %
88% %
89%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90%
91% GetMagickDelegates() returns the ImageMagick delegate libraries.
92%
93% The format of the GetMagickDelegates method is:
94%
95% const char *GetMagickDelegates(void)
96%
97% No parameters are required.
98%
99*/
100MagickExport const char *GetMagickDelegates(void)
101{
102 return ""
103#if defined(MAGICKCORE_AUTOTRACE_DELEGATE)
104 "autotrace "
105#endif
106#if defined(MAGICKCORE_BZLIB_DELEGATE)
107 "bzlib "
108#endif
109#if defined(MAGICKCORE_CAIRO_DELEGATE)
110 "cairo "
111#endif
112#if defined(MAGICKCORE_DJVU_DELEGATE)
113 "djvu "
114#endif
115#if defined(MAGICKCORE_DPS_DELEGATE)
116 "dps "
117#endif
118#if defined(MAGICKCORE_EMF_DELEGATE)
119 "emf "
120#endif
121#if defined(MAGICKCORE_FFTW_DELEGATE)
122 "fftw "
123#endif
124#if defined(MAGICKCORE_FLIF_DELEGATE)
125 "flif "
126#endif
127#if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
128 "fontconfig "
129#endif
130#if defined(MAGICKCORE_FPX_DELEGATE)
131 "fpx "
132#endif
133#if defined(MAGICKCORE_FREETYPE_DELEGATE)
134 "freetype "
135#endif
136#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
137 "gslib "
138#endif
139#if defined(MAGICKCORE_GVC_DELEGATE)
140 "gvc "
141#endif
142#if defined(MAGICKCORE_HEIC_DELEGATE)
143 "heic "
144#endif
145#if defined(MAGICKCORE_JBIG_DELEGATE)
146 "jbig "
147#endif
148#if defined(MAGICKCORE_JPEG_DELEGATE) && defined(MAGICKCORE_PNG_DELEGATE)
149 "jng "
150#endif
151#if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
152 "jp2 "
153#endif
154#if defined(MAGICKCORE_JPEG_DELEGATE)
155 "jpeg "
156#endif
157#if defined(MAGICKCORE_LCMS_DELEGATE)
158 "lcms "
159#endif
160#if defined(MAGICKCORE_LQR_DELEGATE)
161 "lqr "
162#endif
163#if defined(MAGICKCORE_LTDL_DELEGATE)
164 "ltdl "
165#endif
166#if defined(MAGICKCORE_LZMA_DELEGATE)
167 "lzma "
168#endif
169#if defined(MAGICKCORE_OPENEXR_DELEGATE)
170 "openexr "
171#endif
172#if defined(MAGICKCORE_PANGOCAIRO_DELEGATE)
173 "pangocairo "
174#endif
175#if defined(MAGICKCORE_PNG_DELEGATE)
176 "png "
177#endif
178#if defined(MAGICKCORE_DPS_DELEGATE) || defined(MAGICKCORE_GS_DELEGATE) || \
179 defined(MAGICKCORE_WINDOWS_SUPPORT)
180 "ps "
181#endif
182#if defined(MAGICKCORE_RAQM_DELEGATE)
183 "raqm "
184#endif
185#if defined(MAGICKCORE_RAW_R_DELEGATE)
186 "raw "
187#endif
188#if defined(MAGICKCORE_RSVG_DELEGATE)
189 "rsvg "
190#endif
191#if defined(MAGICKCORE_TIFF_DELEGATE)
192 "tiff "
193#endif
194#if defined(MAGICKCORE_WEBP_DELEGATE)
195 "webp "
196#endif
197#if defined(MAGICKCORE_WMF_DELEGATE) || defined (MAGICKCORE_WMFLITE_DELEGATE)
198 "wmf "
199#endif
200#if defined(MAGICKCORE_X11_DELEGATE)
201 "x "
202#endif
203#if defined(MAGICKCORE_XML_DELEGATE)
204 "xml "
205#endif
206#if defined(MAGICKCORE_ZLIB_DELEGATE)
207 "zlib"
208#endif
209 ;
210}
211
212/*
213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
214% %
215% %
216% %
217% G e t M a g i c k F e a t u r e s %
218% %
219% %
220% %
221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222%
223% GetMagickFeatures() returns the ImageMagick features.
224%
225% The format of the GetMagickFeatures method is:
226%
227% const char *GetMagickFeatures(void)
228%
229% No parameters are required.
230%
231*/
232MagickExport const char *GetMagickFeatures(void)
233{
234 return ""
235#if defined(MAGICKCORE_CIPHER_SUPPORT)
236 "Cipher "
237#endif
238#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
239 "Debug "
240#endif
241#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_HAVE_SOCKET) && defined(MAGICKCORE_THREAD_SUPPORT)
242 "DPC "
243#endif
244#if defined(MAGICKCORE_HDRI_SUPPORT)
245 "HDRI "
246#endif
247#if defined(MAGICKCORE_BUILD_MODULES) || defined(_DLL)
248 "Modules "
249#endif
250#if defined(MAGICKCORE_OPENCL_SUPPORT)
251 "OpenCL "
252#endif
253#if defined(MAGICKCORE_OPENMP_SUPPORT)
254 "OpenMP"
255#if _OPENMP == 199810
256 "(1.0) "
257#elif _OPENMP == 200203
258 "(2.0) "
259#elif _OPENMP == 200505
260 "(2.5) "
261#elif _OPENMP == 200805
262 "(3.0) "
263#elif _OPENMP == 201107
264 "(3.1) "
265#elif _OPENMP == 201307
266 "(4.0) "
267#elif _OPENMP == 201511
268 "(4.5) "
269#elif _OPENMP == 201811
270 "(5.0) "
271#else
272 " "
273#endif
274#endif
275#if defined(MAGICKCORE_HAVE_TCMALLOC)
276 "TCMalloc "
277#endif
278#if MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
279 "Zero-configuration "
280#endif
281#if (MAGICKCORE_QUANTUM_DEPTH == 64)
282 "Q64 (experimental, not for production) "
283#endif
284 ;
285}
286
287/*
288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289% %
290% %
291% %
292% G e t M a g i c k H o m e U R L %
293% %
294% %
295% %
296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297%
298% GetMagickHomeURL() returns the ImageMagick home URL.
299%
300% The format of the GetMagickHomeURL method is:
301%
302% char *GetMagickHomeURL(void)
303%
304*/
305MagickExport char *GetMagickHomeURL(void)
306{
307 char
308 path[MaxTextExtent];
309
310 const char
311 *element;
312
314 *exception;
315
317 *paths;
318
319 exception=AcquireExceptionInfo();
320 paths=GetConfigurePaths(MagickURLFilename,exception);
321 exception=DestroyExceptionInfo(exception);
322 if (paths == (LinkedListInfo *) NULL)
323 return(ConstantString(MagickHomeURL));
324 element=(const char *) GetNextValueInLinkedList(paths);
325 while (element != (const char *) NULL)
326 {
327 (void) FormatLocaleString(path,MaxTextExtent,"%s%s%s",element,
328 DirectorySeparator,MagickURLFilename);
329 if (IsPathAccessible(path) != MagickFalse)
330 {
331 paths=DestroyLinkedList(paths,RelinquishMagickMemory);
332 return(ConstantString(path));
333 }
334 element=(const char *) GetNextValueInLinkedList(paths);
335 }
336 paths=DestroyLinkedList(paths,RelinquishMagickMemory);
337 return(ConstantString(MagickHomeURL));
338}
339
340/*
341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342% %
343% %
344% %
345% G e t M a g i c k L i c e n s e %
346% %
347% %
348% %
349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350%
351% GetMagickLicense() returns the ImageMagick API license as a string.
352%
353% The format of the GetMagickLicense method is:
354%
355% const char *GetMagickLicense(void)
356%
357*/
358MagickExport const char *GetMagickLicense(void)
359{
360 return(MagickAuthoritativeLicense);
361}
362
363/*
364%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
365% %
366% %
367% %
368% G e t M a g i c k P a c k a g e N a m e %
369% %
370% %
371% %
372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
373%
374% GetMagickPackageName() returns the ImageMagick package name.
375%
376% The format of the GetMagickName method is:
377%
378% const char *GetMagickName(void)
379%
380% No parameters are required.
381%
382*/
383MagickExport const char *GetMagickPackageName(void)
384{
385 return(MagickPackageName);
386}
387
388/*
389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
390% %
391% %
392% %
393% G e t M a g i c k Q u a n t u m D e p t h %
394% %
395% %
396% %
397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
398%
399% GetMagickQuantumDepth() returns the ImageMagick quantum depth.
400%
401% The format of the GetMagickQuantumDepth method is:
402%
403% const char *GetMagickQuantumDepth(size_t *depth)
404%
405% A description of each parameter follows:
406%
407% o depth: the quantum depth is returned as a number.
408%
409*/
410MagickExport const char *GetMagickQuantumDepth(size_t *depth)
411{
412 if (depth != (size_t *) NULL)
413 *depth=(size_t) MAGICKCORE_QUANTUM_DEPTH;
414 return(MagickQuantumDepth);
415}
416
417/*
418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419% %
420% %
421% %
422% G e t M a g i c k Q u a n t u m R a n g e %
423% %
424% %
425% %
426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
427%
428% GetMagickQuantumRange() returns the ImageMagick quantum range.
429%
430% The format of the GetMagickQuantumRange method is:
431%
432% const char *GetMagickQuantumRange(size_t *range)
433%
434% A description of each parameter follows:
435%
436% o range: the quantum range is returned as a number.
437%
438*/
439MagickExport const char *GetMagickQuantumRange(size_t *range)
440{
441 if (range != (size_t *) NULL)
442 *range=(size_t) QuantumRange;
443 return(MagickQuantumRange);
444}
445
446/*
447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
448% %
449% %
450% %
451% G e t M a g i c k R e l e a s e D a t e %
452% %
453% %
454% %
455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
456%
457% GetMagickReleaseDate() returns the ImageMagick release date.
458%
459% The format of the GetMagickReleaseDate method is:
460%
461% const char *GetMagickReleaseDate(void)
462%
463% No parameters are required.
464%
465*/
466MagickExport const char *GetMagickReleaseDate(void)
467{
468 return(MagickReleaseDate);
469}
470
471/*
472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
473% %
474% %
475% %
476% G e t M a g i c k S i g n a t u r e %
477% %
478% %
479% %
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481%
482% GetMagickCoreSignature() returns a signature that uniquely encodes the
483% MagickCore libary version, quantum depth, HDRI status, OS word size, and
484% endianness.
485%
486% The format of the GetMagickCoreSignature method is:
487%
488% unsigned int GetMagickCoreSignature(const StringInfo *nonce)
489%
490% A description of each parameter follows:
491%
492% o nonce: arbitrary data.
493%
494*/
495
496static unsigned int CRC32(const unsigned char *message,const size_t length)
497{
498 ssize_t
499 i;
500
501 static MagickBooleanType
502 crc_initial = MagickFalse;
503
504 static unsigned int
505 crc_xor[256];
506
507 unsigned int
508 crc;
509
510 /*
511 Generate a 32-bit cyclic redundancy check for the message.
512 */
513 if (crc_initial == MagickFalse)
514 {
515 unsigned int
516 i;
517
518 unsigned int
519 alpha;
520
521 for (i=0; i < 256; i++)
522 {
523 ssize_t
524 j;
525
526 alpha=i;
527 for (j=0; j < 8; j++)
528 alpha=(alpha & 0x01) ? (0xEDB88320 ^ (alpha >> 1)) : (alpha >> 1);
529 crc_xor[i]=alpha;
530 }
531 crc_initial=MagickTrue;
532 }
533 crc=0xFFFFFFFF;
534 for (i=0; i < (ssize_t) length; i++)
535 crc=crc_xor[(crc ^ message[i]) & 0xff] ^ (crc >> 8);
536 return(crc ^ 0xFFFFFFFF);
537}
538
539MagickExport unsigned int GetMagickCoreSignature(const StringInfo *nonce)
540{
541 unsigned char
542 *p;
543
545 *version;
546
547 unsigned int
548 signature;
549
550 version=AcquireStringInfo(MaxTextExtent);
551 p=GetStringInfoDatum(version);
552 signature=MAGICKCORE_QUANTUM_DEPTH;
553 (void) memcpy(p,&signature,sizeof(signature));
554 p+=sizeof(signature);
555 signature=MAGICKCORE_HDRI_ENABLE;
556 (void) memcpy(p,&signature,sizeof(signature));
557 p+=sizeof(signature);
558 signature=MagickLibInterface;
559 (void) memcpy(p,&signature,sizeof(signature));
560 p+=sizeof(signature);
561 signature=1; /* endinaness */
562 (void) memcpy(p,&signature,sizeof(signature));
563 p+=sizeof(signature);
564 SetStringInfoLength(version,p-GetStringInfoDatum(version));
565 if (nonce != (const StringInfo *) NULL)
566 ConcatenateStringInfo(version,nonce);
567 signature=CRC32(GetStringInfoDatum(version),GetStringInfoLength(version));
568 version=DestroyStringInfo(version);
569 return(signature);
570}
571
572/*
573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
574% %
575% %
576% %
577% G e t M a g i c k V e r s i o n %
578% %
579% %
580% %
581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
582%
583% GetMagickVersion() returns the ImageMagick API version as a string and
584% as a number.
585%
586% The format of the GetMagickVersion method is:
587%
588% const char *GetMagickVersion(size_t *version)
589%
590% A description of each parameter follows:
591%
592% o version: the ImageMagick version is returned as a number.
593%
594*/
595MagickExport const char *GetMagickVersion(size_t *version)
596{
597 if (version != (size_t *) NULL)
598 *version=MagickLibVersion;
599 return(MagickVersion);
600}
601
602/*
603%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
604% %
605% %
606% %
607% L i s t M a g i c k V e r s i o n %
608% %
609% %
610% %
611%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
612%
613% ListMagickVersion() identifies the ImageMagick version by printing its
614% attributes to the file. Attributes include the copyright, features, and
615% delegates.
616%
617% The format of the ListMagickVersion method is:
618%
619% void ListMagickVersion(FILE *file)
620%
621% A description of each parameter follows:
622%
623% o file: the file, typically stdout.
624%
625*/
626MagickExport void ListMagickVersion(FILE *file)
627{
628 (void) FormatLocaleFile(file,"Version: %s\n",
629 GetMagickVersion((size_t *) NULL));
630 (void) FormatLocaleFile(file,"Copyright: %s\n",GetMagickCopyright());
631 (void) FormatLocaleFile(file,"License: %s\n",GetMagickLicense());
632#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_MSC_FULL_VER)
633 (void) FormatLocaleFile(file,"Visual C++: %d\n",_MSC_FULL_VER);
634#endif
635 (void) FormatLocaleFile(file,"Features: %s\n",GetMagickFeatures());
636 (void) FormatLocaleFile(file,"Delegates (built-in): %s\n",
637 GetMagickDelegates());
638 if (IsEventLogging() != MagickFalse)
639 {
640 (void) FormatLocaleFile(file,"Wizard attributes: ");
641 (void) FormatLocaleFile(file,"QuantumRange=%g; ",(double) QuantumRange);
642 (void) FormatLocaleFile(file,"QuantumScale=%.*g; ",GetMagickPrecision(),
643 (double) QuantumScale);
644 (void) FormatLocaleFile(file,"MagickEpsilon=%.*g; ",GetMagickPrecision(),
645 (double) MagickEpsilon);
646 (void) FormatLocaleFile(file,"MaxMap=%g; ",(double) MaxMap);
647 (void) FormatLocaleFile(file,"MaxTextExtent=%g; ",(double) MaxTextExtent);
648 (void) FormatLocaleFile(file,"sizeof(Quantum)=%g; ",(double)
649 sizeof(Quantum));
650 (void) FormatLocaleFile(file,"sizeof(MagickSizeType)=%g; ",(double)
651 sizeof(MagickSizeType));
652 (void) FormatLocaleFile(file,"sizeof(MagickOffsetType)=%g",(double)
653 sizeof(MagickOffsetType));
654 }
655}