MagickCore 7.1.1
Convert, Edit, Or Compose Bitmap Images
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 "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/string_.h"
47#include "MagickCore/utility.h"
48#include "MagickCore/utility-private.h"
49#include "MagickCore/version.h"
50#include "MagickCore/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_DMR_DELEGATE)
113 "dmr "
114#endif
115#if defined(MAGICKCORE_DJVU_DELEGATE)
116 "djvu "
117#endif
118#if defined(MAGICKCORE_DPS_DELEGATE)
119 "dps "
120#endif
121#if defined(MAGICKCORE_EMF_DELEGATE)
122 "emf "
123#endif
124#if defined(MAGICKCORE_FFTW_DELEGATE)
125 "fftw "
126#endif
127#if defined(MAGICKCORE_FLIF_DELEGATE)
128 "flif "
129#endif
130#if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
131 "fontconfig "
132#endif
133#if defined(MAGICKCORE_FPX_DELEGATE)
134 "fpx "
135#endif
136#if defined(MAGICKCORE_FREETYPE_DELEGATE)
137 "freetype "
138#endif
139#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
140 "gslib "
141#endif
142#if defined(MAGICKCORE_GVC_DELEGATE)
143 "gvc "
144#endif
145#if defined(MAGICKCORE_HEIC_DELEGATE)
146 "heic "
147#endif
148#if defined(MAGICKCORE_JBIG_DELEGATE)
149 "jbig "
150#endif
151#if defined(MAGICKCORE_JPEG_DELEGATE) && defined(MAGICKCORE_PNG_DELEGATE)
152 "jng "
153#endif
154#if defined(MAGICKCORE_LIBOPENJP2_DELEGATE)
155 "jp2 "
156#endif
157#if defined(MAGICKCORE_JPEG_DELEGATE)
158 "jpeg "
159#endif
160#if defined(MAGICKCORE_JXL_DELEGATE)
161 "jxl "
162#endif
163#if defined(MAGICKCORE_LCMS_DELEGATE)
164 "lcms "
165#endif
166#if defined(MAGICKCORE_LQR_DELEGATE)
167 "lqr "
168#endif
169#if defined(MAGICKCORE_LTDL_DELEGATE)
170 "ltdl "
171#endif
172#if defined(MAGICKCORE_LZMA_DELEGATE)
173 "lzma "
174#endif
175#if defined(MAGICKCORE_OPENEXR_DELEGATE)
176 "openexr "
177#endif
178#if defined(MAGICKCORE_PANGOCAIRO_DELEGATE)
179 "pangocairo "
180#endif
181#if defined(MAGICKCORE_PNG_DELEGATE)
182 "png "
183#endif
184#if defined(MAGICKCORE_DPS_DELEGATE) || defined(MAGICKCORE_GS_DELEGATE) || \
185 defined(MAGICKCORE_WINDOWS_SUPPORT)
186 "ps "
187#endif
188#if defined(MAGICKCORE_RAQM_DELEGATE)
189 "raqm "
190#endif
191#if defined(MAGICKCORE_RAW_R_DELEGATE)
192 "raw "
193#endif
194#if defined(MAGICKCORE_RSVG_DELEGATE)
195 "rsvg "
196#endif
197#if defined(MAGICKCORE_TIFF_DELEGATE)
198 "tiff "
199#endif
200#if defined(MAGICKCORE_WEBP_DELEGATE)
201 "webp "
202#endif
203#if defined(MAGICKCORE_WMF_DELEGATE) || defined (MAGICKCORE_WMFLITE_DELEGATE)
204 "wmf "
205#endif
206#if defined(MAGICKCORE_X11_DELEGATE)
207 "x "
208#endif
209#if defined(MAGICKCORE_XML_DELEGATE)
210 "xml "
211#endif
212#if defined(MAGICKCORE_ZIP_DELEGATE)
213 "zip "
214#endif
215#if defined(MAGICKCORE_ZLIB_DELEGATE)
216 "zlib"
217#endif
218 ;
219}
220
221/*
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223% %
224% %
225% %
226% G e t M a g i c k F e a t u r e s %
227% %
228% %
229% %
230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
231%
232% GetMagickFeatures() returns the ImageMagick features.
233%
234% The format of the GetMagickFeatures method is:
235%
236% const char *GetMagickFeatures(void)
237%
238% No parameters are required.
239%
240*/
241MagickExport const char *GetMagickFeatures(void)
242{
243 return ""
244#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
245 "Debug "
246#endif
247#if defined(MAGICKCORE_CIPHER_SUPPORT)
248 "Cipher "
249#endif
250#if defined(MAGICKCORE_DPC_SUPPORT)
251 "DPC "
252#endif
253#if defined(MAGICKCORE_HDRI_SUPPORT)
254 "HDRI "
255#endif
256#if defined(MAGICKCORE_BUILD_MODULES) || defined(_DLL)
257 "Modules "
258#endif
259#if defined(MAGICKCORE_OPENCL_SUPPORT)
260 "OpenCL "
261#endif
262#if defined(MAGICKCORE_OPENMP_SUPPORT)
263 "OpenMP"
264#if _OPENMP == 199810
265 "(1.0) "
266#elif _OPENMP == 200203
267 "(2.0) "
268#elif _OPENMP == 200505
269 "(2.5) "
270#elif _OPENMP == 200805
271 "(3.0) "
272#elif _OPENMP == 201107
273 "(3.1) "
274#elif _OPENMP == 201307
275 "(4.0) "
276#elif _OPENMP == 201511
277 "(4.5) "
278#elif _OPENMP == 201811
279 "(5.0) "
280#else
281 " "
282#endif
283#endif
284#if defined(MAGICKCORE_HAVE_TCMALLOC)
285 "TCMalloc "
286#endif
287#if MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
288 "Zero-configuration "
289#endif
290#if (MAGICKCORE_QUANTUM_DEPTH == 64)
291 "Q64 (experimental, not for production) "
292#endif
293 ;
294}
295
296/*
297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298% %
299% %
300% %
301% G e t M a g i c k H o m e U R L %
302% %
303% %
304% %
305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
306%
307% GetMagickHomeURL() returns the ImageMagick home URL.
308%
309% The format of the GetMagickHomeURL method is:
310%
311% char *GetMagickHomeURL(void)
312%
313*/
314MagickExport char *GetMagickHomeURL(void)
315{
316 char
317 path[MagickPathExtent];
318
319 const char
320 *element;
321
323 *exception;
324
326 *paths;
327
328 exception=AcquireExceptionInfo();
329 paths=GetConfigurePaths(MagickURLFilename,exception);
330 exception=DestroyExceptionInfo(exception);
331 if (paths == (LinkedListInfo *) NULL)
332 return(ConstantString(MagickHomeURL));
333 element=(const char *) GetNextValueInLinkedList(paths);
334 while (element != (const char *) NULL)
335 {
336 (void) FormatLocaleString(path,MagickPathExtent,"%s%s%s",element,
337 DirectorySeparator,MagickURLFilename);
338 if (IsPathAccessible(path) != MagickFalse)
339 {
340 paths=DestroyLinkedList(paths,RelinquishMagickMemory);
341 return(ConstantString(path));
342 }
343 element=(const char *) GetNextValueInLinkedList(paths);
344 }
345 paths=DestroyLinkedList(paths,RelinquishMagickMemory);
346 return(ConstantString(MagickHomeURL));
347}
348
349/*
350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
351% %
352% %
353% %
354% G e t M a g i c k L i c e n s e %
355% %
356% %
357% %
358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
359%
360% GetMagickLicense() returns the ImageMagick API license as a string.
361%
362% The format of the GetMagickLicense method is:
363%
364% const char *GetMagickLicense(void)
365%
366*/
367MagickExport const char *GetMagickLicense(void)
368{
369 return(MagickAuthoritativeLicense);
370}
371
372/*
373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374% %
375% %
376% %
377% G e t M a g i c k P a c k a g e N a m e %
378% %
379% %
380% %
381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
382%
383% GetMagickPackageName() returns the ImageMagick package name.
384%
385% The format of the GetMagickName method is:
386%
387% const char *GetMagickName(void)
388%
389% No parameters are required.
390%
391*/
392MagickExport const char *GetMagickPackageName(void)
393{
394 return(MagickPackageName);
395}
396
397/*
398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399% %
400% %
401% %
402% G e t M a g i c k Q u a n t u m D e p t h %
403% %
404% %
405% %
406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407%
408% GetMagickQuantumDepth() returns the ImageMagick quantum depth.
409%
410% The format of the GetMagickQuantumDepth method is:
411%
412% const char *GetMagickQuantumDepth(size_t *depth)
413%
414% A description of each parameter follows:
415%
416% o depth: the quantum depth is returned as a number.
417%
418*/
419MagickExport const char *GetMagickQuantumDepth(size_t *depth)
420{
421 if (depth != (size_t *) NULL)
422 *depth=(size_t) MAGICKCORE_QUANTUM_DEPTH;
423 return(MagickQuantumDepth);
424}
425
426/*
427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428% %
429% %
430% %
431% G e t M a g i c k Q u a n t u m R a n g e %
432% %
433% %
434% %
435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436%
437% GetMagickQuantumRange() returns the ImageMagick quantum range.
438%
439% The format of the GetMagickQuantumRange method is:
440%
441% const char *GetMagickQuantumRange(size_t *range)
442%
443% A description of each parameter follows:
444%
445% o range: the quantum range is returned as a number.
446%
447*/
448MagickExport const char *GetMagickQuantumRange(size_t *range)
449{
450 if (range != (size_t *) NULL)
451 *range=(size_t) QuantumRange;
452 return(MagickQuantumRange);
453}
454
455/*
456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
457% %
458% %
459% %
460% G e t M a g i c k R e l e a s e D a t e %
461% %
462% %
463% %
464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
465%
466% GetMagickReleaseDate() returns the ImageMagick release date.
467%
468% The format of the GetMagickReleaseDate method is:
469%
470% const char *GetMagickReleaseDate(void)
471%
472% No parameters are required.
473%
474*/
475MagickExport const char *GetMagickReleaseDate(void)
476{
477 return(MagickReleaseDate);
478}
479
480/*
481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
482% %
483% %
484% %
485% G e t M a g i c k S i g n a t u r e %
486% %
487% %
488% %
489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
490%
491% GetMagickSignature() returns a signature that uniquely encodes the
492% MagickCore library version, quantum depth, HDRI status, OS word size, and
493% endianness.
494%
495% The format of the GetMagickSignature method is:
496%
497% unsigned int GetMagickSignature(const StringInfo *nonce)
498%
499% A description of each parameter follows:
500%
501% o nonce: arbitrary data.
502%
503*/
504
505static unsigned int CRC32(const unsigned char *message,const size_t length)
506{
507 ssize_t
508 i;
509
510 static MagickBooleanType
511 crc_initial = MagickFalse;
512
513 static unsigned int
514 crc_xor[256];
515
516 unsigned int
517 crc;
518
519 /*
520 Generate a 32-bit cyclic redundancy check for the message.
521 */
522 if (crc_initial == MagickFalse)
523 {
524 unsigned int
525 j;
526
527 unsigned int
528 alpha;
529
530 for (j=0; j < 256; j++)
531 {
532 ssize_t
533 k;
534
535 alpha=j;
536 for (k=0; k < 8; k++)
537 alpha=(alpha & 0x01) ? (0xEDB88320 ^ (alpha >> 1)) : (alpha >> 1);
538 crc_xor[j]=alpha;
539 }
540 crc_initial=MagickTrue;
541 }
542 crc=0xFFFFFFFF;
543 for (i=0; i < (ssize_t) length; i++)
544 crc=crc_xor[(crc ^ message[i]) & 0xff] ^ (crc >> 8);
545 return(crc ^ 0xFFFFFFFF);
546}
547
548MagickExport unsigned int GetMagickSignature(const StringInfo *nonce)
549{
550 unsigned char
551 *p;
552
554 *version;
555
556 unsigned int
557 signature;
558
559 version=AcquireStringInfo(MagickPathExtent);
560 p=GetStringInfoDatum(version);
561 signature=MAGICKCORE_QUANTUM_DEPTH;
562 (void) memcpy(p,&signature,sizeof(signature));
563 p+=sizeof(signature);
564 signature=MAGICKCORE_HDRI_ENABLE;
565 (void) memcpy(p,&signature,sizeof(signature));
566 p+=sizeof(signature);
567 signature=MagickLibInterface;
568 (void) memcpy(p,&signature,sizeof(signature));
569 p+=sizeof(signature);
570 signature=1; /* endianness */
571 (void) memcpy(p,&signature,sizeof(signature));
572 p+=sizeof(signature);
573 SetStringInfoLength(version,p-GetStringInfoDatum(version));
574 if (nonce != (const StringInfo *) NULL)
575 ConcatenateStringInfo(version,nonce);
576 signature=CRC32(GetStringInfoDatum(version),GetStringInfoLength(version));
577 version=DestroyStringInfo(version);
578 return(signature);
579}
580
581/*
582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
583% %
584% %
585% %
586% G e t M a g i c k V e r s i o n %
587% %
588% %
589% %
590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
591%
592% GetMagickVersion() returns the ImageMagick API version as a string and
593% as a number.
594%
595% The format of the GetMagickVersion method is:
596%
597% const char *GetMagickVersion(size_t *version)
598%
599% A description of each parameter follows:
600%
601% o version: the ImageMagick version is returned as a number.
602%
603*/
604MagickExport const char *GetMagickVersion(size_t *version)
605{
606 if (version != (size_t *) NULL)
607 *version=MagickLibVersion;
608 return(MagickVersion);
609}
610
611/*
612%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
613% %
614% %
615% %
616% L i s t M a g i c k V e r s i o n %
617% %
618% %
619% %
620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
621%
622% ListMagickVersion() identifies the ImageMagick version by printing its
623% attributes to the file. Attributes include the copyright, features, and
624% delegates.
625%
626% The format of the ListMagickVersion method is:
627%
628% void ListMagickVersion(FILE *file)
629%
630% A description of each parameter follows:
631%
632% o file: the file, typically stdout.
633%
634*/
635MagickExport void ListMagickVersion(FILE *file)
636{
637 (void) FormatLocaleFile(file,"Version: %s\n",
638 GetMagickVersion((size_t *) NULL));;
639 (void) FormatLocaleFile(file,"Copyright: %s\n",GetMagickCopyright());
640 (void) FormatLocaleFile(file,"License: %s\n",GetMagickLicense());
641 (void) FormatLocaleFile(file,"Features: %s\n",GetMagickFeatures());
642 (void) FormatLocaleFile(file,"Delegates (built-in): %s\n",
643 GetMagickDelegates());
644#if defined(MAGICKCORE_MSC_VER)
645 (void) FormatLocaleFile(file,"Compiler: Visual Studio %d (%d)\n",
646 MAGICKCORE_MSC_VER,_MSC_FULL_VER);
647#elif defined(__GNUC__)
648 (void) FormatLocaleFile(file,"Compiler: gcc (%d.%d)\n",__GNUC__,
649 __GNUC_MINOR__);
650#elif defined(__clang__)
651 (void) FormatLocaleFile(file,"Compiler: clang (%d.%d.%d)\n",__clang_major__,
652 __clang_minor__,__clang_patchlevel__);
653#elif defined(__MINGW32_MAJOR_VERSION)
654 (void) FormatLocaleFile(file,"Compiler: MinGW (%d.%d)\n",
655 __MINGW32_MAJOR_VERSION,__MINGW32_MINOR_VERSION);
656#elif defined(__MINGW64_VERSION_MAJOR)
657 (void) FormatLocaleFile(file,"Compiler: MinGW-w64 (%d.%d)\n",
658 __MINGW64_VERSION_MAJOR ,__MINGW64_VERSION_MINOR);
659#endif
660 if (IsEventLogging() != MagickFalse)
661 {
662 (void) FormatLocaleFile(file,"Wizard attributes: ");
663 (void) FormatLocaleFile(file,"QuantumRange=%g; ",(double) QuantumRange);
664 (void) FormatLocaleFile(file,"QuantumScale=%.*g; ",GetMagickPrecision(),
665 (double) QuantumScale);
666 (void) FormatLocaleFile(file,"MagickEpsilon=%.*g; ",GetMagickPrecision(),
667 (double) MagickEpsilon);
668 (void) FormatLocaleFile(file,"MaxMap=%g; ",(double) MaxMap);
669 (void) FormatLocaleFile(file,"MagickPathExtent=%g; ",
670 (double) MagickPathExtent);
671 (void) FormatLocaleFile(file,"sizeof(Quantum)=%g; ",(double)
672 sizeof(Quantum));
673 (void) FormatLocaleFile(file,"sizeof(MagickSizeType)=%g; ",(double)
674 sizeof(MagickSizeType));
675 (void) FormatLocaleFile(file,"sizeof(MagickOffsetType)=%g",(double)
676 sizeof(MagickOffsetType));
677 }
678}