MagickCore  7.0.10
magick.c
Go to the documentation of this file.
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % M M AAA GGGG IIIII CCCC K K %
7 % MM MM A A G I C K K %
8 % M M M AAAAA G GGG I C KKK %
9 % M M A A G G I C K K %
10 % M M A A GGGG IIIII CCCC K K %
11 % %
12 % %
13 % Methods to Read or List ImageMagick Image formats %
14 % %
15 % Software Design %
16 % Bob Friesenhahn %
17 % Cristy %
18 % November 1998 %
19 % %
20 % %
21 % Copyright 1999-2020 ImageMagick Studio LLC, a non-profit organization %
22 % dedicated to making software imaging solutions freely available. %
23 % %
24 % You may not use this file except in compliance with the License. You may %
25 % obtain a copy of the License at %
26 % %
27 % https://imagemagick.org/script/license.php %
28 % %
29 % Unless required by applicable law or agreed to in writing, software %
30 % distributed under the License is distributed on an "AS IS" BASIS, %
31 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
32 % See the License for the specific language governing permissions and %
33 % limitations under the License. %
34 % %
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 %
37 %
38 */
39 
40 /*
41  Include declarations.
42 */
43 #include "MagickCore/studio.h"
45 #include "MagickCore/blob.h"
47 #include "MagickCore/cache.h"
50 #include "MagickCore/client.h"
55 #include "MagickCore/draw.h"
56 #include "MagickCore/exception.h"
59 #include "MagickCore/log-private.h"
61 #include "MagickCore/magick.h"
63 #include "MagickCore/memory_.h"
66 #include "MagickCore/module.h"
68 #include "MagickCore/mutex.h"
70 #include "MagickCore/nt-feature.h"
74 #include "MagickCore/registry.h"
76 #include "MagickCore/resource_.h"
78 #include "MagickCore/policy.h"
80 #include "MagickCore/mutex.h"
81 #include "MagickCore/semaphore.h"
84 #include "MagickCore/splay-tree.h"
85 #include "MagickCore/static.h"
86 #include "MagickCore/string_.h"
88 #include "MagickCore/thread_.h"
91 #include "MagickCore/token.h"
92 #include "MagickCore/utility.h"
95 #if defined(MAGICKCORE_XML_DELEGATE)
96 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
97 # if !defined(__MINGW32__)
98 # include <win32config.h>
99 # endif
100 # endif
101 # include <libxml/parser.h>
102 #endif
103 
104 /*
105  Define declarations.
106 */
107 #if !defined(SIG_DFL)
108 # define SIG_DFL ((SignalHandler *) 0)
109 #endif
110 #if !defined(SIG_ERR)
111 # define SIG_ERR ((SignalHandler *) -1)
112 #endif
113 #if !defined(SIGMAX)
114 #define SIGMAX 64
115 #endif
116 
117 /*
118  Typedef declarations.
119 */
120 typedef void SignalHandler(int);
121 
122 /*
123  Global declarations.
124 */
125 static SemaphoreInfo
127 
128 static SignalHandler
130 
131 static SplayTreeInfo
133 
134 static volatile MagickBooleanType
138 
139 static int
141 
142 /*
143  Forward declarations.
144 */
145 static MagickBooleanType
147 
148 /*
149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150 % %
151 % %
152 % %
153 % A c q u i r e M a g i c k I n f o %
154 % %
155 % %
156 % %
157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
158 %
159 % AcquireMagickInfo() allocates a MagickInfo structure and initializes the
160 % members to default values.
161 %
162 % The format of the AcquireMagickInfo method is:
163 %
164 % MagickInfo *AcquireMagickInfo(const char *magick_module,
165 % const char *name,const char *description)
166 %
167 % A description of each parameter follows:
168 %
169 % o magick_module: a character string that represents the module associated
170 % with the MagickInfo structure.
171 %
172 % o name: a character string that represents the image format associated
173 % with the MagickInfo structure.
174 %
175 % o description: a character string that represents the image format
176 % associated with the MagickInfo structure.
177 %
178 */
180  const char *name,const char *description)
181 {
182  MagickInfo
183  *magick_info;
184 
185  assert(magick_module != (const char *) NULL);
186  assert(name != (const char *) NULL);
187  assert(description != (const char *) NULL);
188  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",name);
189  magick_info=(MagickInfo *) AcquireCriticalMemory(sizeof(*magick_info));
190  (void) memset(magick_info,0,sizeof(*magick_info));
192  magick_info->name=ConstantString(name);
193  magick_info->description=ConstantString(description);
197  magick_info->signature=MagickCoreSignature;
198  return(magick_info);
199 }
200 
201 /*
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
203 % %
204 % %
205 % %
206 + G e t I m a g e D e c o d e r %
207 % %
208 % %
209 % %
210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
211 %
212 % GetImageDecoder() returns the image decoder.
213 %
214 % The format of the GetImageDecoder method is:
215 %
216 % DecodeImageHandler *GetImageDecoder(const MagickInfo *magick_info)
217 %
218 % A description of each parameter follows:
219 %
220 % o magick_info: The magick info.
221 %
222 */
224 {
225  if (magick_info == (MagickInfo *) NULL)
226  return((DecodeImageHandler *) NULL);
227  assert(magick_info->signature == MagickCoreSignature);
228  return(magick_info->decoder);
229 }
230 
231 /*
232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
233 % %
234 % %
235 % %
236 + G e t I m a g e E n c o d e r %
237 % %
238 % %
239 % %
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
241 %
242 % GetImageEncoder() returns the image encoder.
243 %
244 % The format of the GetImageEncoder method is:
245 %
246 % EncodeImageHandler *GetImageEncoder(const MagickInfo *magick_info)
247 %
248 % A description of each parameter follows:
249 %
250 % o magick_info: The magick info.
251 %
252 */
254 {
255  if (magick_info == (MagickInfo *) NULL)
256  return((EncodeImageHandler *) NULL);
257  assert(magick_info->signature == MagickCoreSignature);
258  return(magick_info->encoder);
259 }
260 
261 /*
262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263 % %
264 % %
265 % %
266 + G e t I m a g e M a g i c k %
267 % %
268 % %
269 % %
270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271 %
272 % GetImageMagick() searches for an image format that matches the specified
273 % magick string. If one is found, MagickTrue is returned otherwise
274 % MagickFalse.
275 %
276 % The format of the GetImageMagick method is:
277 %
278 % MagickBooleanType GetImageMagick(const unsigned char *magick,
279 % const size_t length,char *format)
280 %
281 % A description of each parameter follows:
282 %
283 % o magick: the image format we are searching for.
284 %
285 % o length: the length of the binary string.
286 %
287 % o format: the image format as determined by the magick bytes.
288 %
289 */
291  const size_t length,char *format)
292 {
294  *exception;
295 
297  status;
298 
299  register const MagickInfo
300  *p;
301 
302  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
303  assert(magick != (const unsigned char *) NULL);
304  exception=AcquireExceptionInfo();
305  p=GetMagickInfo("*",exception);
306  exception=DestroyExceptionInfo(exception);
307  if (p == (const MagickInfo *) NULL)
308  return(MagickFalse);
309  status=MagickFalse;
313  while (p != (const MagickInfo *) NULL)
314  {
315  if ((p->magick != (IsImageFormatHandler *) NULL) &&
316  (p->magick(magick,length) != 0))
317  {
318  status=MagickTrue;
319  (void) CopyMagickString(format,p->name,MagickPathExtent);
320  break;
321  }
323  }
325  return(status);
326 }
327 
328 /*
329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
330 % %
331 % %
332 % %
333 + G e t M a g i c k A d j o i n %
334 % %
335 % %
336 % %
337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
338 %
339 % GetMagickAdjoin() returns MagickTrue if the magick adjoin is MagickTrue.
340 %
341 % The format of the GetMagickAdjoin method is:
342 %
343 % MagickBooleanType GetMagickAdjoin(const MagickInfo *magick_info)
344 %
345 % A description of each parameter follows:
346 %
347 % o magick_info: The magick info.
348 %
349 */
351 {
352  assert(magick_info != (MagickInfo *) NULL);
353  assert(magick_info->signature == MagickCoreSignature);
354  return(((magick_info->flags & CoderAdjoinFlag) == 0) ? MagickFalse :
355  MagickTrue);
356 }
357 
358 /*
359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
360 % %
361 % %
362 % %
363 + G e t M a g i c k B l o b S u p p o r t %
364 % %
365 % %
366 % %
367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
368 %
369 % GetMagickBlobSupport() returns MagickTrue if the magick supports blobs.
370 %
371 % The format of the GetMagickBlobSupport method is:
372 %
373 % MagickBooleanType GetMagickBlobSupport(const MagickInfo *magick_info)
374 %
375 % A description of each parameter follows:
376 %
377 % o magick_info: The magick info.
378 %
379 */
381  const MagickInfo *magick_info)
382 {
383  assert(magick_info != (MagickInfo *) NULL);
384  assert(magick_info->signature == MagickCoreSignature);
385  return(((magick_info->flags & CoderBlobSupportFlag) == 0) ? MagickFalse :
386  MagickTrue);
387 }
388 
389 /*
390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391 % %
392 % %
393 % %
394 + G e t M a g i c k D e c o d e r S e e k a b l e S t r e a m %
395 % %
396 % %
397 % %
398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399 %
400 % GetMagickDecoderSeekableStream() returns MagickTrue if the magick supports a
401 % seekable stream in the decoder.
402 %
403 % The format of the GetMagickDecoderSeekableStream method is:
404 %
405 % MagickBooleanType GetMagickDecoderSeekableStream(
406 % const MagickInfo *magick_info)
407 %
408 % A description of each parameter follows:
409 %
410 % o magick_info: The magick info.
411 %
412 */
414  const MagickInfo *magick_info)
415 {
416  assert(magick_info != (MagickInfo *) NULL);
417  assert(magick_info->signature == MagickCoreSignature);
418  if ((magick_info->flags & CoderDecoderSeekableStreamFlag) == 0)
419  return(MagickFalse);
420  return(MagickTrue);
421 }
422 
423 /*
424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425 % %
426 % %
427 % %
428 + G e t M a g i c k D e c o d e r T h r e a d S u p p o r t %
429 % %
430 % %
431 % %
432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433 %
434 % GetMagickDecoderThreadSupport() returns MagickTrue if the decoder supports
435 % threads.
436 %
437 % The format of the GetMagickDecoderThreadSupport method is:
438 %
439 % MagickStatusType GetMagickDecoderThreadSupport(
440 % const MagickInfo *magick_info)
441 %
442 % A description of each parameter follows:
443 %
444 % o magick_info: The magick info.
445 %
446 */
448  const MagickInfo *magick_info)
449 {
450  assert(magick_info != (MagickInfo *) NULL);
451  assert(magick_info->signature == MagickCoreSignature);
452  return(((magick_info->flags & CoderDecoderThreadSupportFlag) == 0) ?
454 }
455 
456 /*
457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458 % %
459 % %
460 % %
461 + G e t M a g i c k D e s c r i p t i o n %
462 % %
463 % %
464 % %
465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466 %
467 % GetMagickDescription() returns the magick description.
468 %
469 % The format of the GetMagickDescription method is:
470 %
471 % const char *GetMagickDescription(const MagickInfo *magick_info)
472 %
473 % A description of each parameter follows:
474 %
475 % o magick_info: The magick info.
476 %
477 */
478 MagickExport const char *GetMagickDescription(const MagickInfo *magick_info)
479 {
480  assert(magick_info != (MagickInfo *) NULL);
481  assert(magick_info->signature == MagickCoreSignature);
482  return(magick_info->description);
483 }
484 
485 /*
486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
487 % %
488 % %
489 % %
490 + G e t M a g i c k E n c o d e r S e e k a b l e S t r e a m %
491 % %
492 % %
493 % %
494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
495 %
496 % GetMagickEncoderSeekableStream() returns MagickTrue if the magick supports a
497 % seekable stream in the encoder.
498 %
499 % The format of the GetMagickEncoderSeekableStream method is:
500 %
501 % MagickBooleanType GetMagickEncoderSeekableStream(
502 % const MagickInfo *magick_info)
503 %
504 % A description of each parameter follows:
505 %
506 % o magick_info: The magick info.
507 %
508 */
510  const MagickInfo *magick_info)
511 {
512  assert(magick_info != (MagickInfo *) NULL);
513  assert(magick_info->signature == MagickCoreSignature);
514  if ((magick_info->flags & CoderEncoderSeekableStreamFlag) == 0)
515  return(MagickFalse);
516  return(MagickTrue);
517 }
518 
519 /*
520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
521 % %
522 % %
523 % %
524 + G e t M a g i c k E n c o d e r T h r e a d S u p p o r t %
525 % %
526 % %
527 % %
528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
529 %
530 % GetMagickEncoderThreadSupport() returns MagickTrue if the encoder supports
531 % threads.
532 %
533 % The format of the GetMagickEncoderThreadSupport method is:
534 %
535 % MagickStatusType GetMagickEncoderThreadSupport(
536 % const MagickInfo *magick_info)
537 %
538 % A description of each parameter follows:
539 %
540 % o magick_info: The magick info.
541 %
542 */
544  const MagickInfo *magick_info)
545 {
546  assert(magick_info != (MagickInfo *) NULL);
547  assert(magick_info->signature == MagickCoreSignature);
548  return(((magick_info->flags & CoderDecoderThreadSupportFlag) == 0) ?
550 }
551 
552 /*
553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554 % %
555 % %
556 % %
557 + G e t M a g i c k E n d i a n S u p p o r t %
558 % %
559 % %
560 % %
561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
562 %
563 % GetMagickEndianSupport() returns the MagickTrue if the coder respects
564 % endianness other than MSBEndian.
565 %
566 % The format of the GetMagickEndianSupport method is:
567 %
568 % MagickBooleanType GetMagickEndianSupport(const MagickInfo *magick_info)
569 %
570 % A description of each parameter follows:
571 %
572 % o magick_info: The magick info.
573 %
574 */
576  const MagickInfo *magick_info)
577 {
578  assert(magick_info != (MagickInfo *) NULL);
579  assert(magick_info->signature == MagickCoreSignature);
580  return(((magick_info->flags & CoderEndianSupportFlag) == 0) ? MagickFalse :
581  MagickTrue);
582 }
583 
584 /*
585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586 % %
587 % %
588 % %
589 + G e t M a g i c k I n f o %
590 % %
591 % %
592 % %
593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
594 %
595 % GetMagickInfo() returns a pointer MagickInfo structure that matches
596 % the specified name. If name is NULL, the head of the image format list
597 % is returned.
598 %
599 % The format of the GetMagickInfo method is:
600 %
601 % const MagickInfo *GetMagickInfo(const char *name,Exception *exception)
602 %
603 % A description of each parameter follows:
604 %
605 % o name: the image format we are looking for.
606 %
607 % o exception: return any errors or warnings in this structure.
608 %
609 */
610 MagickExport const MagickInfo *GetMagickInfo(const char *name,
611  ExceptionInfo *exception)
612 {
613  register const MagickInfo
614  *magick_info;
615 
616  /*
617  Find named module attributes.
618  */
619  assert(exception != (ExceptionInfo *) NULL);
620  if (IsMagickTreeInstantiated(exception) == MagickFalse)
621  return((const MagickInfo *) NULL);
622  magick_info=(const MagickInfo *) NULL;
623  if ((name != (const char *) NULL) && (*name != '\0'))
624  {
626  if (LocaleCompare(name,"*") == 0)
627 #if defined(MAGICKCORE_BUILD_MODULES)
628  (void) OpenModules(exception);
629 #else
631 #endif
632  else
633  {
634  magick_info=(const MagickInfo *) GetValueFromSplayTree(magick_list,
635  name);
636  if (magick_info == (const MagickInfo *) NULL)
637 #if defined(MAGICKCORE_BUILD_MODULES)
638  (void) OpenModule(name,exception);
639 #else
640  (void) RegisterStaticModule(name,exception);
641 #endif
642  }
644  }
645  if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
647  if (magick_info == (const MagickInfo *) NULL)
648  magick_info=(const MagickInfo *) GetValueFromSplayTree(magick_list,name);
649  return(magick_info);
650 }
651 
652 /*
653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
654 % %
655 % %
656 % %
657 + G e t M a g i c k I n f o L i s t %
658 % %
659 % %
660 % %
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
662 %
663 % GetMagickInfoList() returns any image formats that match the specified
664 % pattern.
665 %
666 % The format of the GetMagickInfoList function is:
667 %
668 % const MagickInfo **GetMagickInfoList(const char *pattern,
669 % size_t *number_formats,ExceptionInfo *exception)
670 %
671 % A description of each parameter follows:
672 %
673 % o pattern: Specifies a pointer to a text string containing a pattern.
674 %
675 % o number_formats: This integer returns the number of formats in the list.
676 %
677 % o exception: return any errors or warnings in this structure.
678 %
679 */
680 
681 #if defined(__cplusplus) || defined(c_plusplus)
682 extern "C" {
683 #endif
684 
685 static int MagickInfoCompare(const void *x,const void *y)
686 {
687  const MagickInfo
688  **p,
689  **q;
690 
691  p=(const MagickInfo **) x,
692  q=(const MagickInfo **) y;
693  return(LocaleCompare((*p)->name,(*q)->name));
694 }
695 
696 #if defined(__cplusplus) || defined(c_plusplus)
697 }
698 #endif
699 
700 MagickExport const MagickInfo **GetMagickInfoList(const char *pattern,
701  size_t *number_formats,ExceptionInfo *exception)
702 {
703  const MagickInfo
704  **formats;
705 
706  register const MagickInfo
707  *p;
708 
709  register ssize_t
710  i;
711 
712  /*
713  Allocate magick list.
714  */
715  assert(pattern != (char *) NULL);
716  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
717  assert(number_formats != (size_t *) NULL);
718  *number_formats=0;
719  p=GetMagickInfo("*",exception);
720  if (p == (const MagickInfo *) NULL)
721  return((const MagickInfo **) NULL);
722  formats=(const MagickInfo **) AcquireQuantumMemory((size_t)
723  GetNumberOfNodesInSplayTree(magick_list)+1UL,sizeof(*formats));
724  if (formats == (const MagickInfo **) NULL)
725  return((const MagickInfo **) NULL);
726  /*
727  Generate magick list.
728  */
732  for (i=0; p != (const MagickInfo *) NULL; )
733  {
734  if ((GetMagickStealth(p) == MagickFalse) &&
735  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
736  formats[i++]=p;
738  }
740  qsort((void *) formats,(size_t) i,sizeof(*formats),MagickInfoCompare);
741  formats[i]=(MagickInfo *) NULL;
742  *number_formats=(size_t) i;
743  return(formats);
744 }
745 
746 /*
747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
748 % %
749 % %
750 % %
751 + G e t M a g i c k L i s t %
752 % %
753 % %
754 % %
755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
756 %
757 % GetMagickList() returns any image formats that match the specified pattern.
758 %
759 % The format of the GetMagickList function is:
760 %
761 % char **GetMagickList(const char *pattern,size_t *number_formats,
762 % ExceptionInfo *exception)
763 %
764 % A description of each parameter follows:
765 %
766 % o pattern: Specifies a pointer to a text string containing a pattern.
767 %
768 % o number_formats: This integer returns the number of formats in the list.
769 %
770 % o exception: return any errors or warnings in this structure.
771 %
772 */
773 
774 #if defined(__cplusplus) || defined(c_plusplus)
775 extern "C" {
776 #endif
777 
778 static int MagickCompare(const void *x,const void *y)
779 {
780  register const char
781  **p,
782  **q;
783 
784  p=(const char **) x;
785  q=(const char **) y;
786  return(LocaleCompare(*p,*q));
787 }
788 
789 #if defined(__cplusplus) || defined(c_plusplus)
790 }
791 #endif
792 
793 MagickExport char **GetMagickList(const char *pattern,
794  size_t *number_formats,ExceptionInfo *exception)
795 {
796  char
797  **formats;
798 
799  register const MagickInfo
800  *p;
801 
802  register ssize_t
803  i;
804 
805  /*
806  Allocate magick list.
807  */
808  assert(pattern != (char *) NULL);
809  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
810  assert(number_formats != (size_t *) NULL);
811  *number_formats=0;
812  p=GetMagickInfo("*",exception);
813  if (p == (const MagickInfo *) NULL)
814  return((char **) NULL);
815  formats=(char **) AcquireQuantumMemory((size_t)
816  GetNumberOfNodesInSplayTree(magick_list)+1UL,sizeof(*formats));
817  if (formats == (char **) NULL)
818  return((char **) NULL);
822  for (i=0; p != (const MagickInfo *) NULL; )
823  {
824  if ((GetMagickStealth(p) == MagickFalse) &&
825  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
826  formats[i++]=ConstantString(p->name);
828  }
830  qsort((void *) formats,(size_t) i,sizeof(*formats),MagickCompare);
831  formats[i]=(char *) NULL;
832  *number_formats=(size_t) i;
833  return(formats);
834 }
835 
836 /*
837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838 % %
839 % %
840 % %
841 + G e t M a g i c k M i m e T y p e %
842 % %
843 % %
844 % %
845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846 %
847 % GetMagickMimeType() returns the magick mime type.
848 %
849 % The format of the GetMagickMimeType method is:
850 %
851 % const char *GetMagickMimeType(const MagickInfo *magick_info)
852 %
853 % A description of each parameter follows:
854 %
855 % o magick_info: The magick info.
856 %
857 */
858 MagickExport const char *GetMagickMimeType(const MagickInfo *magick_info)
859 {
860  assert(magick_info != (MagickInfo *) NULL);
861  assert(magick_info->signature == MagickCoreSignature);
862  return(magick_info->mime_type);
863 }
864 
865 /*
866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
867 % %
868 % %
869 % %
870 + G e t M a g i c k M o d u l e N a m e %
871 % %
872 % %
873 % %
874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
875 %
876 % GetMagickModuleName() returns the magick module name.
877 %
878 % The format of the GetMagickModuleName method is:
879 %
880 % const char *GetMagickModuleName(const MagickInfo *magick_info)
881 %
882 % A description of each parameter follows:
883 %
884 % o magick_info: The magick info.
885 %
886 */
887 MagickExport const char *GetMagickModuleName(const MagickInfo *magick_info)
888 {
889  assert(magick_info != (MagickInfo *) NULL);
890  assert(magick_info->signature == MagickCoreSignature);
891  return(magick_info->magick_module);
892 }
893 
894 /*
895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896 % %
897 % %
898 % %
899 + G e t M a g i c k N a m e %
900 % %
901 % %
902 % %
903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
904 %
905 % GetMagickName() returns the magick name.
906 %
907 % The format of the GetMagickName method is:
908 %
909 % const char *GetMagickName(const MagickInfo *magick_info)
910 %
911 % A description of each parameter follows:
912 %
913 % o magick_info: The magick info.
914 %
915 */
916 MagickExport const char *GetMagickName(const MagickInfo *magick_info)
917 {
918  assert(magick_info != (MagickInfo *) NULL);
919  assert(magick_info->signature == MagickCoreSignature);
920  return(magick_info->name);
921 }
922 
923 /*
924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
925 % %
926 % %
927 % %
928 % G e t M a g i c k P r e c i s i o n %
929 % %
930 % %
931 % %
932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
933 %
934 % GetMagickPrecision() returns the maximum number of significant digits to be
935 % printed.
936 %
937 % The format of the GetMagickPrecision method is:
938 %
939 % int GetMagickPrecision(void)
940 %
941 */
943 {
944  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
945  return(SetMagickPrecision(0));
946 }
947 
948 /*
949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
950 % %
951 % %
952 % %
953 + G e t M a g i c k R a w S u p p o r t %
954 % %
955 % %
956 % %
957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
958 %
959 % GetMagickRawSupport() returns the MagickTrue if the coder is a raw format.
960 %
961 % The format of the GetMagickRawSupport method is:
962 %
963 % MagickBooleanType GetMagickRawSupport(const MagickInfo *magick_info)
964 %
965 % A description of each parameter follows:
966 %
967 % o magick_info: The magick info.
968 %
969 */
971  const MagickInfo *magick_info)
972 {
973  assert(magick_info != (MagickInfo *) NULL);
974  assert(magick_info->signature == MagickCoreSignature);
975  return(((magick_info->flags & CoderRawSupportFlag) == 0) ? MagickFalse :
976  MagickTrue);
977 }
978 
979 
980 /*
981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
982 % %
983 % %
984 % %
985 + G e t M a g i c k S t e a l t h %
986 % %
987 % %
988 % %
989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
990 %
991 % GetMagickStealth() returns MagickTrue if the magick is a stealth coder.
992 %
993 % The format of the GetMagickStealth method is:
994 %
995 % MagickBooleanType GetMagickStealth(const MagickInfo *magick_info)
996 %
997 % A description of each parameter follows:
998 %
999 % o magick_info: The magick info.
1000 %
1001 */
1003 {
1004  assert(magick_info != (MagickInfo *) NULL);
1005  assert(magick_info->signature == MagickCoreSignature);
1006  return(((magick_info->flags & CoderStealthFlag) == 0) ? MagickFalse :
1007  MagickTrue);
1008 }
1009 
1010 
1011 /*
1012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1013 % %
1014 % %
1015 % %
1016 + G e t M a g i c k U s e E x t e n s i o n %
1017 % %
1018 % %
1019 % %
1020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1021 %
1022 % GetMagickUseExtension() returns MagickTrue if the magick can use the
1023 % extension of the format if the format return by IsImageFormatHandler uses
1024 % the same coder.
1025 %
1026 % The format of the GetMagickUseExtension method is:
1027 %
1028 % MagickBooleanType GetMagickUseExtension(const MagickInfo *magick_info)
1029 %
1030 % A description of each parameter follows:
1031 %
1032 % o magick_info: The magick info.
1033 %
1034 */
1036  const MagickInfo *magick_info)
1037 {
1038  assert(magick_info != (MagickInfo *) NULL);
1039  assert(magick_info->signature == MagickCoreSignature);
1040  return(((magick_info->flags & CoderUseExtensionFlag) == 0) ? MagickFalse :
1041  MagickTrue);
1042 }
1043 
1044 /*
1045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1046 % %
1047 % %
1048 % %
1049 + I s M a g i c k T r e e I n s t a n t i a t e d %
1050 % %
1051 % %
1052 % %
1053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1054 %
1055 % IsMagickTreeInstantiated() determines if the magick tree is instantiated.
1056 % If not, it instantiates the tree and returns it.
1057 %
1058 % The format of the IsMagickTreeInstantiated() method is:
1059 %
1060 % IsMagickTreeInstantiated(Exceptioninfo *exception)
1061 %
1062 % A description of each parameter follows.
1063 %
1064 % o exception: return any errors or warnings in this structure.
1065 %
1066 */
1067 
1068 static void *DestroyMagickNode(void *magick_info)
1069 {
1070  register MagickInfo
1071  *p;
1072 
1073  p=(MagickInfo *) magick_info;
1074  if (p->magick_module != (char *) NULL)
1076  if (p->note != (char *) NULL)
1077  p->note=DestroyString(p->note);
1078  if (p->mime_type != (char *) NULL)
1080  if (p->version != (char *) NULL)
1081  p->version=DestroyString(p->version);
1082  if (p->description != (char *) NULL)
1084  if (p->name != (char *) NULL)
1085  p->name=DestroyString(p->name);
1086  if (p->semaphore != (SemaphoreInfo *) NULL)
1088  return(RelinquishMagickMemory(p));
1089 }
1090 
1092 {
1093  (void) exception;
1095  {
1096  if (magick_semaphore == (SemaphoreInfo *) NULL)
1100  {
1101  magick_list=NewSplayTree(CompareSplayTreeString,(void *(*)(void *))
1102  NULL,DestroyMagickNode);
1103 #if defined(MAGICKCORE_MODULES_SUPPORT)
1104  (void) GetModuleInfo((char *) NULL,exception);
1105 #endif
1107  }
1109  }
1110  return(magick_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
1111 }
1112 
1113 /*
1114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115 % %
1116 % %
1117 % %
1118 + I s M a g i c k C o n f l i c t %
1119 % %
1120 % %
1121 % %
1122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1123 %
1124 % IsMagickConflict() returns MagickTrue if the image format conflicts with a
1125 % logical drive (.e.g. X:).
1126 %
1127 % The format of the IsMagickConflict method is:
1128 %
1129 % MagickBooleanType IsMagickConflict(const char *magick)
1130 %
1131 % A description of each parameter follows:
1132 %
1133 % o magick: Specifies the image format.
1134 %
1135 */
1137 {
1138  assert(magick != (char *) NULL);
1139 #if defined(macintosh)
1140  return(MACIsMagickConflict(magick));
1141 #elif defined(vms)
1142  return(VMSIsMagickConflict(magick));
1143 #elif defined(MAGICKCORE_WINDOWS_SUPPORT)
1144  return(NTIsMagickConflict(magick));
1145 #else
1146  return(MagickFalse);
1147 #endif
1148 }
1149 
1150 /*
1151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1152 % %
1153 % %
1154 % %
1155 + L i s t M a g i c k I n f o %
1156 % %
1157 % %
1158 % %
1159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1160 %
1161 % ListMagickInfo() lists the image formats to a file.
1162 %
1163 % The format of the ListMagickInfo method is:
1164 %
1165 % MagickBooleanType ListMagickInfo(FILE *file,ExceptionInfo *exception)
1166 %
1167 % A description of each parameter follows.
1168 %
1169 % o file: A file handle.
1170 %
1171 % o exception: return any errors or warnings in this structure.
1172 %
1173 */
1175  ExceptionInfo *exception)
1176 {
1177  const MagickInfo
1178  **magick_info;
1179 
1180  register ssize_t
1181  i;
1182 
1183  size_t
1184  number_formats;
1185 
1186  ssize_t
1187  j;
1188 
1189  if (file == (FILE *) NULL)
1190  file=stdout;
1191  magick_info=GetMagickInfoList("*",&number_formats,exception);
1192  if (magick_info == (const MagickInfo **) NULL)
1193  return(MagickFalse);
1194  ClearMagickException(exception);
1195 #if !defined(MAGICKCORE_MODULES_SUPPORT)
1196  (void) FormatLocaleFile(file," Format Mode Description\n");
1197 #else
1198  (void) FormatLocaleFile(file," Format Module Mode Description\n");
1199 #endif
1200  (void) FormatLocaleFile(file,
1201  "--------------------------------------------------------"
1202  "-----------------------\n");
1203  for (i=0; i < (ssize_t) number_formats; i++)
1204  {
1205  if (GetMagickStealth(magick_info[i]) != MagickFalse)
1206  continue;
1207  (void) FormatLocaleFile(file,"%9s%c ",
1208  magick_info[i]->name != (char *) NULL ? magick_info[i]->name : "",
1209  GetMagickBlobSupport(magick_info[i]) != MagickFalse ? '*' : ' ');
1210 #if defined(MAGICKCORE_MODULES_SUPPORT)
1211  {
1212  char
1214 
1215  *magick_module='\0';
1216  if (magick_info[i]->magick_module != (char *) NULL)
1217  (void) CopyMagickString(magick_module,magick_info[i]->magick_module,
1221  magick_module[9]='\0';
1222  (void) FormatLocaleFile(file,"%9s ",magick_module);
1223  }
1224 #endif
1225  (void) FormatLocaleFile(file,"%c%c%c ",magick_info[i]->decoder ? 'r' : '-',
1226  magick_info[i]->encoder ? 'w' : '-',magick_info[i]->encoder != NULL &&
1227  GetMagickAdjoin(magick_info[i]) != MagickFalse ? '+' : '-');
1228  if (magick_info[i]->description != (char *) NULL)
1229  (void) FormatLocaleFile(file," %s",magick_info[i]->description);
1230  if (magick_info[i]->version != (char *) NULL)
1231  (void) FormatLocaleFile(file," (%s)",magick_info[i]->version);
1232  (void) FormatLocaleFile(file,"\n");
1233  if (magick_info[i]->note != (char *) NULL)
1234  {
1235  char
1236  **text;
1237 
1238  text=StringToList(magick_info[i]->note);
1239  if (text != (char **) NULL)
1240  {
1241  for (j=0; text[j] != (char *) NULL; j++)
1242  {
1243  (void) FormatLocaleFile(file," %s\n",text[j]);
1244  text[j]=DestroyString(text[j]);
1245  }
1246  text=(char **) RelinquishMagickMemory(text);
1247  }
1248  }
1249  }
1250  (void) FormatLocaleFile(file,"\n* native blob support\n");
1251  (void) FormatLocaleFile(file,"r read support\n");
1252  (void) FormatLocaleFile(file,"w write support\n");
1253  (void) FormatLocaleFile(file,"+ support for multiple images\n");
1254  (void) fflush(file);
1255  magick_info=(const MagickInfo **) RelinquishMagickMemory((void *)
1256  magick_info);
1257  return(MagickTrue);
1258 }
1259 
1260 /*
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262 % %
1263 % %
1264 % %
1265 % I s M a g i c k C o r e I n s t a n t i a t e d %
1266 % %
1267 % %
1268 % %
1269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1270 %
1271 % IsMagickCoreInstantiated() returns MagickFalse if the ImageMagick
1272 % environment has not been instantiated; the ImageMagick environment
1273 % has been instantiated when MagickCoreGenesis() has been called but
1274 % MagickDestroy() has not been called.
1275 %
1276 % The format of the IsMagickCoreInstantiated method is:
1277 %
1278 % MagickBooleanType IsMagickCoreInstantiated(void)
1279 %
1280 */
1282 {
1283  return(magickcore_instantiated);
1284 }
1285 
1286 /*
1287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1288 % %
1289 % %
1290 % %
1291 + M a g i c k C o m p o n e n t G e n e s i s %
1292 % %
1293 % %
1294 % %
1295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1296 %
1297 % MagickComponentGenesis() instantiates the magick component.
1298 %
1299 % The format of the MagickComponentGenesis method is:
1300 %
1301 % MagickBooleanType MagickComponentGenesis(void)
1302 %
1303 */
1305 {
1306  if (magick_semaphore == (SemaphoreInfo *) NULL)
1308  return(MagickTrue);
1309 }
1310 
1311 /*
1312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1313 % %
1314 % %
1315 % %
1316 + M a g i c k C o m p o n e n t T e r m i n u s %
1317 % %
1318 % %
1319 % %
1320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1321 %
1322 % MagickComponentTerminus() destroys the magick component.
1323 %
1324 % The format of the MagickComponentTerminus method is:
1325 %
1326 % void MagickComponentTerminus(void)
1327 %
1328 */
1330 {
1331  if (magick_semaphore == (SemaphoreInfo *) NULL)
1334  if (magick_list != (SplayTreeInfo *) NULL)
1335  {
1338  }
1341 }
1342 
1343 /*
1344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1345 % %
1346 % %
1347 % %
1348 % M a g i c k C o r e G e n e s i s %
1349 % %
1350 % %
1351 % %
1352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1353 %
1354 % MagickCoreGenesis() initializes the MagickCore environment.
1355 %
1356 % The format of the MagickCoreGenesis function is:
1357 %
1358 % MagickCoreGenesis(const char *path,
1359 % const MagickBooleanType establish_signal_handlers)
1360 %
1361 % A description of each parameter follows:
1362 %
1363 % o path: the execution path of the current ImageMagick client.
1364 %
1365 % o establish_signal_handlers: set to MagickTrue to use MagickCore's own
1366 % signal handlers for common signals.
1367 %
1368 */
1369 
1370 static SignalHandler *SetMagickSignalHandler(int signal_number,
1371  SignalHandler *handler)
1372 {
1373 #if defined(MAGICKCORE_HAVE_SIGACTION) && defined(MAGICKCORE_HAVE_SIGEMPTYSET)
1374  int
1375  status;
1376 
1377  sigset_t
1378  mask;
1379 
1380  struct sigaction
1381  action,
1382  previous_action;
1383 
1384  sigemptyset(&mask);
1385  sigaddset(&mask,signal_number);
1386  sigprocmask(SIG_BLOCK,&mask,NULL);
1387  action.sa_mask=mask;
1388  action.sa_handler=handler;
1389  action.sa_flags=0;
1390 #if defined(SA_INTERRUPT)
1391  action.sa_flags|=SA_INTERRUPT;
1392 #endif
1393 #if defined(SA_ONSTACK)
1394  action.sa_flags|=SA_ONSTACK;
1395 #endif
1396  previous_action.sa_handler=SIG_DFL;
1397  status=sigaction(signal_number,&action,&previous_action);
1398  if (status < 0)
1399  return(SIG_ERR);
1400  sigprocmask(SIG_UNBLOCK,&mask,NULL);
1401  return(previous_action.sa_handler);
1402 #else
1403  return(signal(signal_number,handler));
1404 #endif
1405 }
1406 
1407 static void MagickSignalHandler(int signal_number)
1408 {
1410  (void) SetMagickSignalHandler(signal_number,signal_handlers[signal_number]);
1413 #if defined(SIGQUIT)
1414  if (signal_number == SIGQUIT)
1415  abort();
1416 #endif
1417 #if defined(SIGABRT)
1418  if (signal_number == SIGABRT)
1419  abort();
1420 #endif
1421 #if defined(SIGBUS)
1422  if (signal_number == SIGBUS)
1423  abort();
1424 #endif
1425 #if defined(SIGFPE)
1426  if (signal_number == SIGFPE)
1427  abort();
1428 #endif
1429 #if defined(SIGSEGV)
1430  if (signal_number == SIGSEGV)
1431  abort();
1432 #endif
1433 #if !defined(MAGICKCORE_HAVE__EXIT)
1434  exit(signal_number);
1435 #else
1436 #if defined(SIGHUP)
1437  if (signal_number == SIGHUP)
1438  _exit(signal_number);
1439 #endif
1440 #if defined(SIGINT)
1441  if (signal_number == SIGINT)
1442  _exit(signal_number);
1443 #endif
1444 #if defined(MAGICKCORE_HAVE_RAISE)
1445  if (signal_handlers[signal_number] != MagickSignalHandler)
1446  raise(signal_number);
1447 #endif
1448  _exit(signal_number); /* do not invoke registered atexit() methods */
1449 #endif
1450 }
1451 
1452 static SignalHandler *RegisterMagickSignalHandler(int signal_number)
1453 {
1455  *handler;
1456 
1457  handler=SetMagickSignalHandler(signal_number,MagickSignalHandler);
1458  if (handler == SIG_ERR)
1459  return(handler);
1460  if (handler != SIG_DFL)
1461  handler=SetMagickSignalHandler(signal_number,handler);
1462  else
1464  "Register handler for signal: %d",signal_number);
1465  return(handler);
1466 }
1467 
1468 MagickExport void MagickCoreGenesis(const char *path,
1469  const MagickBooleanType establish_signal_handlers)
1470 {
1471  char
1472  *events,
1473  execution_path[MagickPathExtent],
1474  filename[MagickPathExtent];
1475 
1476  /*
1477  Initialize the Magick environment.
1478  */
1480  LockMagickMutex();
1482  {
1484  return;
1485  }
1486  (void) SemaphoreComponentGenesis();
1487  (void) ExceptionComponentGenesis();
1488  (void) LogComponentGenesis();
1489  (void) LocaleComponentGenesis();
1490  (void) RandomComponentGenesis();
1491  events=GetEnvironmentValue("MAGICK_DEBUG");
1492  if (events != (char *) NULL)
1493  {
1494  (void) SetLogEventMask(events);
1495  events=DestroyString(events);
1496  }
1497 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1498  NTWindowsGenesis();
1499 #endif
1500  /*
1501  Set client name and execution path.
1502  */
1503 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1504  if ((path != (const char *) NULL) && (IsPathAccessible(path) != MagickFalse))
1505 #else
1506  if ((path != (const char *) NULL) && (*path == *DirectorySeparator) &&
1507  (IsPathAccessible(path) != MagickFalse))
1508 #endif
1509  (void) CopyMagickString(execution_path,path,MagickPathExtent);
1510  else
1511  (void) GetExecutionPath(execution_path,MagickPathExtent);
1512  GetPathComponent(execution_path,TailPath,filename);
1513  (void) SetClientName(filename);
1514  GetPathComponent(execution_path,HeadPath,execution_path);
1515  (void) SetClientPath(execution_path);
1516  if (establish_signal_handlers != MagickFalse)
1517  {
1518  /*
1519  Set signal handlers.
1520  */
1521 #if defined(SIGABRT)
1522  if (signal_handlers[SIGABRT] == (SignalHandler *) NULL)
1523  signal_handlers[SIGABRT]=RegisterMagickSignalHandler(SIGABRT);
1524 #endif
1525 #if defined(SIGBUS)
1526  if (signal_handlers[SIGBUS] == (SignalHandler *) NULL)
1528 #endif
1529 #if defined(SIGSEGV)
1530  if (signal_handlers[SIGSEGV] == (SignalHandler *) NULL)
1531  signal_handlers[SIGSEGV]=RegisterMagickSignalHandler(SIGSEGV);
1532 #endif
1533 #if defined(SIGFPE)
1534  if (signal_handlers[SIGFPE] == (SignalHandler *) NULL)
1536 #endif
1537 #if defined(SIGHUP)
1538  if (signal_handlers[SIGHUP] == (SignalHandler *) NULL)
1540 #endif
1541 #if defined(SIGINT)
1542  if (signal_handlers[SIGINT] == (SignalHandler *) NULL)
1544 #endif
1545 #if defined(SIGQUIT)
1546  if (signal_handlers[SIGQUIT] == (SignalHandler *) NULL)
1547  signal_handlers[SIGQUIT]=RegisterMagickSignalHandler(SIGQUIT);
1548 #endif
1549 #if defined(SIGTERM)
1550  if (signal_handlers[SIGTERM] == (SignalHandler *) NULL)
1551  signal_handlers[SIGTERM]=RegisterMagickSignalHandler(SIGTERM);
1552 #endif
1553 #if defined(SIGXCPU)
1554  if (signal_handlers[SIGXCPU] == (SignalHandler *) NULL)
1555  signal_handlers[SIGXCPU]=RegisterMagickSignalHandler(SIGXCPU);
1556 #endif
1557 #if defined(SIGXFSZ)
1558  if (signal_handlers[SIGXFSZ] == (SignalHandler *) NULL)
1559  signal_handlers[SIGXFSZ]=RegisterMagickSignalHandler(SIGXFSZ);
1560 #endif
1561  }
1562  /*
1563  Instantiate magick resources.
1564  */
1565  (void) ConfigureComponentGenesis();
1566  (void) PolicyComponentGenesis();
1567 #if MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
1568  (void) ZeroConfigurationPolicy;
1569 #endif
1570  (void) CacheComponentGenesis();
1571  (void) ResourceComponentGenesis();
1572  (void) CoderComponentGenesis();
1573  (void) MagickComponentGenesis();
1574 #if defined(MAGICKCORE_MODULES_SUPPORT)
1575  (void) ModuleComponentGenesis();
1576 #endif
1577  (void) DelegateComponentGenesis();
1578  (void) MagicComponentGenesis();
1579  (void) ColorComponentGenesis();
1580  (void) TypeComponentGenesis();
1581  (void) MimeComponentGenesis();
1582  (void) AnnotateComponentGenesis();
1583 #if defined(MAGICKCORE_X11_DELEGATE)
1584  (void) XComponentGenesis();
1585 #endif
1586  (void) RegistryComponentGenesis();
1587  (void) MonitorComponentGenesis();
1590 }
1591 
1592 /*
1593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1594 % %
1595 % %
1596 % %
1597 % M a g i c k C o r e T e r m i n u s %
1598 % %
1599 % %
1600 % %
1601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1602 %
1603 % MagickCoreTerminus() destroys the MagickCore environment.
1604 %
1605 % The format of the MagickCoreTerminus function is:
1606 %
1607 % MagickCoreTerminus(void)
1608 %
1609 */
1611 {
1613  return;
1616 #if defined(MAGICKCORE_X11_DELEGATE)
1617  XComponentTerminus();
1618 #endif
1619 #if defined(MAGICKCORE_XML_DELEGATE)
1620  xmlCleanupParser();
1621 #endif
1625 #if defined(MAGICKCORE_OPENCL_SUPPORT)
1626  OpenCLTerminus();
1627 #endif
1629 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1630  NTWindowsTerminus();
1631 #endif
1635 #if !defined(MAGICKCORE_BUILD_MODULES)
1637 #endif
1638 #if defined(MAGICKCORE_MODULES_SUPPORT)
1640 #endif
1652 }
1653 
1654 /*
1655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1656 % %
1657 % %
1658 % %
1659 + R e g i s t e r M a g i c k I n f o %
1660 % %
1661 % %
1662 % %
1663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1664 %
1665 % RegisterMagickInfo() adds attributes for a particular image format to the
1666 % list of supported formats. The attributes include the image format name,
1667 % a method to read and/or write the format, whether the format supports the
1668 % saving of more than one frame to the same file or blob, whether the format
1669 % supports native in-memory I/O, and a brief description of the format.
1670 %
1671 % The format of the RegisterMagickInfo method is:
1672 %
1673 % MagickInfo *RegisterMagickInfo(MagickInfo *magick_info)
1674 %
1675 % A description of each parameter follows:
1676 %
1677 % o magick_info: the magick info.
1678 %
1679 */
1681 {
1683  status;
1684 
1685  /*
1686  Register a new image format.
1687  */
1688  assert(magick_info != (MagickInfo *) NULL);
1689  assert(magick_info->signature == MagickCoreSignature);
1690  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",magick_info->name);
1691  if (magick_list == (SplayTreeInfo *) NULL)
1692  return(MagickFalse);
1693  if ((GetMagickDecoderThreadSupport(magick_info) == MagickFalse) ||
1694  (GetMagickEncoderThreadSupport(magick_info) == MagickFalse))
1695  magick_info->semaphore=AcquireSemaphoreInfo();
1696  status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
1697  return(status);
1698 }
1699 
1700 /*
1701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1702 % %
1703 % %
1704 % %
1705 + R e s e t M a g i c k P r e c i s i o n %
1706 % %
1707 % %
1708 % %
1709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1710 %
1711 % ResetMagickPrecision() resets the magick_precision value.
1712 %
1713 % The format of the ResetMagickPrecision method is:
1714 %
1715 % void ResetMagickPrecision(void)
1716 %
1717 */
1719 {
1720  magick_precision=0;
1721 }
1722 
1723 /*
1724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1725 % %
1726 % %
1727 % %
1728 % S e t M a g i c k P r e c i s i o n %
1729 % %
1730 % %
1731 % %
1732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1733 %
1734 % SetMagickPrecision() sets the maximum number of significant digits to be
1735 % printed.
1736 %
1737 % An input argument of 0 returns the current precision setting.
1738 %
1739 % A negative value forces the precision to reset to a default value according
1740 % to the environment variable "MAGICK_PRECISION", the current 'policy'
1741 % configuration setting, or the default value of '6', in that order.
1742 %
1743 % The format of the SetMagickPrecision method is:
1744 %
1745 % int SetMagickPrecision(const int precision)
1746 %
1747 % A description of each parameter follows:
1748 %
1749 % o precision: set the maximum number of significant digits to be printed.
1750 %
1751 */
1752 MagickExport int SetMagickPrecision(const int precision)
1753 {
1754 #define MagickPrecision (4+MAGICKCORE_QUANTUM_DEPTH/8)
1755 
1756  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
1757  if (precision > 0)
1758  magick_precision=precision;
1759  if ((precision < 0) || (magick_precision == 0))
1760  {
1761  char
1762  *limit;
1763 
1764  /*
1765  Precision reset, or it has not been set yet
1766  */
1768  limit=GetEnvironmentValue("MAGICK_PRECISION");
1769  if (limit == (char *) NULL)
1770  limit=GetPolicyValue("system:precision");
1771  if (limit != (char *) NULL)
1772  {
1774  limit=DestroyString(limit);
1775  }
1776  }
1777  return(magick_precision);
1778 }
1779 
1780 /*
1781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1782 % %
1783 % %
1784 % %
1785 + U n r e g i s t e r M a g i c k I n f o %
1786 % %
1787 % %
1788 % %
1789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1790 %
1791 % UnregisterMagickInfo() removes a name from the magick info list. It returns
1792 % MagickFalse if the name does not exist in the list otherwise MagickTrue.
1793 %
1794 % The format of the UnregisterMagickInfo method is:
1795 %
1796 % MagickBooleanType UnregisterMagickInfo(const char *name)
1797 %
1798 % A description of each parameter follows:
1799 %
1800 % o name: a character string that represents the image format we are
1801 % looking for.
1802 %
1803 */
1805 {
1806  register const MagickInfo
1807  *p;
1808 
1810  status;
1811 
1812  assert(name != (const char *) NULL);
1813  if (magick_list == (SplayTreeInfo *) NULL)
1814  return(MagickFalse);
1816  return(MagickFalse);
1820  while (p != (const MagickInfo *) NULL)
1821  {
1822  if (LocaleCompare(p->name,name) == 0)
1823  break;
1825  }
1828  return(status);
1829 }
MagickPrivate void AnnotateComponentTerminus(void)
Definition: annotate.c:188
MagickPrivate MagickBooleanType SemaphoreComponentGenesis(void)
Definition: semaphore.c:398
MagickExport MagickBooleanType GetMagickUseExtension(const MagickInfo *magick_info)
Definition: magick.c:1035
static int MagickInfoCompare(const void *x, const void *y)
Definition: magick.c:685
MagickPrivate MagickBooleanType ResourceComponentGenesis(void)
Definition: resource.c:1143
static void InitializeMagickMutex(void)
Definition: mutex.h:55
MagickPrivate void RandomComponentTerminus(void)
Definition: random.c:823
MagickExport MagickBooleanType AddValueToSplayTree(SplayTreeInfo *splay_tree, const void *key, const void *value)
Definition: splay-tree.c:154
char magick[MagickPathExtent]
Definition: image.h:480
MagickExport size_t ConcatenateMagickString(char *magick_restrict destination, const char *magick_restrict source, const size_t length)
Definition: string.c:428
MagickPrivate MagickBooleanType IsMagickConflict(const char *magick)
Definition: magick.c:1136
MagickPrivate MagickBooleanType PolicyComponentGenesis(void)
Definition: policy.c:988
MagickPrivate MagickBooleanType RegistryComponentGenesis(void)
Definition: registry.c:295
MagickPrivate MagickBooleanType MagicComponentGenesis(void)
Definition: magic.c:750
static void * DestroyMagickNode(void *magick_info)
Definition: magick.c:1068
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:449
MagickExport MagickBooleanType RegisterStaticModule(const char *module, ExceptionInfo *exception)
Definition: static.c:217
MagickExport void RegisterStaticModules(void)
Definition: static.c:284
MagickPrivate MagickBooleanType ColorComponentGenesis(void)
MagickPrivate void PolicyComponentTerminus(void)
Definition: policy.c:1035
MagickPrivate MagickBooleanType CacheComponentGenesis(void)
MagickPrivate MagickBooleanType LogComponentGenesis(void)
Definition: log.c:1092
MagickPrivate MagickBooleanType ConfigureComponentGenesis(void)
Definition: configure.c:228
MagickPrivate MagickBooleanType CoderComponentGenesis(void)
Definition: coder.c:210
static int StringToInteger(const char *magick_restrict value)
MagickExport void MagickCoreTerminus(void)
Definition: magick.c:1610
MagickExport SemaphoreInfo * AcquireSemaphoreInfo(void)
Definition: semaphore.c:192
MagickExport MagickBooleanType GetMagickEncoderThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:543
char * note
Definition: magick.h:70
MagickPrivate void LogComponentTerminus(void)
Definition: log.c:1148
MagickExport const char * GetMagickDescription(const MagickInfo *magick_info)
Definition: magick.c:478
char * magick_module
Definition: magick.h:70
char * version
Definition: magick.h:70
MagickPrivate void MonitorComponentTerminus(void)
Definition: monitor.c:98
char * name
Definition: magick.h:70
EncodeImageHandler * encoder
Definition: magick.h:81
MagickPrivate MagickBooleanType TypeComponentGenesis(void)
Definition: type.c:1349
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:115
MagickPrivate MagickBooleanType DelegateComponentGenesis(void)
Definition: delegate.c:248
MagickExport size_t CopyMagickString(char *magick_restrict destination, const char *magick_restrict source, const size_t length)
Definition: string.c:756
MagickBooleanType EncodeImageHandler(const ImageInfo *, Image *, ExceptionInfo *)
Definition: magick.h:62
static void MagickSignalHandler(int signal_number)
Definition: magick.c:1407
MagickExport const char * GetMagickName(const MagickInfo *magick_info)
Definition: magick.c:916
MagickPrivate MagickBooleanType MagickComponentGenesis(void)
Definition: magick.c:1304
MagickExport const char * SetClientName(const char *name)
Definition: client.c:115
MagickExport void MagickCoreGenesis(const char *path, const MagickBooleanType establish_signal_handlers)
Definition: magick.c:1468
MagickPrivate MagickBooleanType MonitorComponentGenesis(void)
Definition: monitor.c:73
MagickExport LogEventType SetLogEventMask(const char *events)
Definition: log.c:1762
Definition: log.h:52
size_t signature
Definition: magick.h:99
MagickExport const void * GetNextValueInSplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:823
MagickExport MagickBooleanType GetMagickRawSupport(const MagickInfo *magick_info)
Definition: magick.c:970
#define MagickCoreSignature
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
MagickExport MagickBooleanType GetMagickDecoderSeekableStream(const MagickInfo *magick_info)
Definition: magick.c:413
MagickPrivate void DelegateComponentTerminus(void)
Definition: delegate.c:294
SemaphoreInfo * semaphore
Definition: magick.h:96
static int MagickCompare(const void *x, const void *y)
Definition: magick.c:778
MagickExport void GetPathComponent(const char *path, PathType type, char *component)
Definition: utility.c:1223
MagickExport ssize_t FormatLocaleFile(FILE *file, const char *magick_restrict format,...)
Definition: locale.c:404
MagickBooleanType
Definition: magick-type.h:169
MagickExport char ** StringToList(const char *text)
Definition: string.c:2289
static volatile MagickBooleanType magick_list_initialized
Definition: magick.c:137
#define DirectorySeparator
Definition: studio.h:259
MagickPrivate MagickBooleanType ModuleComponentGenesis(void)
MagickExport MagickBooleanType ListMagickInfo(FILE *file, ExceptionInfo *exception)
Definition: magick.c:1174
#define magick_module
Definition: magick.h:31
MagickExport const char * SetClientPath(const char *path)
Definition: client.c:152
MagickPrivate void AsynchronousResourceComponentTerminus(void)
MagickExport MagickBooleanType GlobExpression(const char *magick_restrict expression, const char *magick_restrict pattern, const MagickBooleanType case_insensitive)
Definition: token.c:355
MagickPrivate MagickBooleanType RandomComponentGenesis(void)
Definition: random.c:798
MagickExport MagickBooleanType DeleteNodeByValueFromSplayTree(SplayTreeInfo *splay_tree, const void *value)
Definition: splay-tree.c:486
size_t length
Definition: image.h:477
MagickExport void * AcquireCriticalMemory(const size_t size)
Definition: memory.c:595
DecodeImageHandler * decoder
Definition: magick.h:78
MagickExport char ** GetMagickList(const char *pattern, size_t *number_formats, ExceptionInfo *exception)
Definition: magick.c:793
MagickExport MagickBooleanType GetImageMagick(const unsigned char *magick, const size_t length, char *format)
Definition: magick.c:290
MagickStatusType flags
Definition: magick.h:93
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
Definition: memory.c:634
MagickBooleanType IsImageFormatHandler(const unsigned char *, const size_t)
Definition: magick.h:65
MagickPrivate MagickBooleanType AnnotateComponentGenesis(void)
Definition: annotate.c:163
static void UnlockMagickMutex(void)
Definition: mutex.h:87
MagickExport MagickBooleanType VMSIsMagickConflict(const char *)
MagickPrivate void ColorComponentTerminus(void)
Definition: color.c:968
MagickExport SplayTreeInfo * DestroySplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:682
#define MagickPathExtent
MagickExport MagickBooleanType GetMagickBlobSupport(const MagickInfo *magick_info)
Definition: magick.c:380
#define SIG_ERR
Definition: magick.c:111
MagickExport int GetMagickPrecision(void)
Definition: magick.c:942
MagickExport SplayTreeInfo * NewSplayTree(int(*compare)(const void *, const void *), void *(*relinquish_key)(void *), void *(*relinquish_value)(void *))
Definition: splay-tree.c:1141
MagickPrivate void ModuleComponentTerminus(void)
MagickPrivate MagickBooleanType ExceptionComponentGenesis(void)
Definition: exception.c:468
MagickExport MagickBooleanType GetMagickStealth(const MagickInfo *magick_info)
Definition: magick.c:1002
static MagickBooleanType IsMagickTreeInstantiated(ExceptionInfo *)
Definition: magick.c:1091
static SplayTreeInfo * magick_list
Definition: magick.c:132
MagickExport ModuleInfo * GetModuleInfo(const char *, ExceptionInfo *)
MagickPrivate void ExceptionComponentTerminus(void)
MagickExport DecodeImageHandler * GetImageDecoder(const MagickInfo *magick_info)
Definition: magick.c:223
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1660
MagickExport MagickBooleanType IsPathAccessible(const char *path)
Definition: utility.c:1477
static SignalHandler * signal_handlers[SIGMAX]
Definition: magick.c:129
MagickExport const MagickInfo * GetMagickInfo(const char *name, ExceptionInfo *exception)
Definition: magick.c:610
IsImageFormatHandler * magick
Definition: magick.h:87
static void LockMagickMutex(void)
Definition: mutex.h:63
MagickExport MagickBooleanType GetMagickAdjoin(const MagickInfo *magick_info)
Definition: magick.c:350
MagickExport char * GetEnvironmentValue(const char *name)
Definition: string.c:1172
MagickPrivate void CacheComponentTerminus(void)
MagickExport EncodeImageHandler * GetImageEncoder(const MagickInfo *magick_info)
Definition: magick.c:253
MagickExport MagickBooleanType GetMagickEndianSupport(const MagickInfo *magick_info)
Definition: magick.c:575
MagickExport const void * GetValueFromSplayTree(SplayTreeInfo *splay_tree, const void *key)
Definition: splay-tree.c:921
MagickPrivate void ResourceComponentTerminus(void)
Definition: resource.c:1309
MagickPrivate void SemaphoreComponentTerminus(void)
Definition: semaphore.c:422
MagickPrivate MagickBooleanType OpenModules(ExceptionInfo *)
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: locale.c:1435
MagickExport MagickBooleanType GetMagickDecoderThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:447
MagickPrivate void ResetMagickPrecision(void)
Definition: magick.c:1718
MagickPrivate void MagicComponentTerminus(void)
Definition: magic.c:797
#define GetMagickModule()
Definition: log.h:28
MagickPrivate void TypeComponentTerminus(void)
Definition: type.c:1374
MagickExport int CompareSplayTreeString(const void *target, const void *source)
Definition: splay-tree.c:412
MagickPrivate MagickBooleanType GetExecutionPath(char *, const size_t)
MagickExport void ClearMagickException(ExceptionInfo *exception)
Definition: exception.c:164
MagickExport MagickBooleanType GetMagickEncoderSeekableStream(const MagickInfo *magick_info)
Definition: magick.c:509
#define SIG_DFL
Definition: magick.c:108
MagickExport MagickBooleanType UnregisterMagickInfo(const char *name)
Definition: magick.c:1804
MagickExport const MagickInfo ** GetMagickInfoList(const char *pattern, size_t *number_formats, ExceptionInfo *exception)
Definition: magick.c:700
void SignalHandler(int)
Definition: magick.c:120
static SignalHandler * RegisterMagickSignalHandler(int signal_number)
Definition: magick.c:1452
MagickExport char * DestroyString(char *string)
Definition: string.c:813
static volatile MagickBooleanType magickcore_instantiated
Definition: magick.c:135
MagickExport const char * GetMagickMimeType(const MagickInfo *magick_info)
Definition: magick.c:858
#define SIGMAX
Definition: magick.c:114
MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:98
char * description
Definition: magick.h:70
static int magick_precision
Definition: magick.c:140
MagickExport MagickBooleanType NTIsMagickConflict(const char *)
MagickExport const void * GetRootValueFromSplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:877
MagickPrivate MagickBooleanType XComponentGenesis(void)
Definition: xwindow.c:10008
FILE * file
Definition: image.h:471
MagickExport char * GetPolicyValue(const char *name)
Definition: policy.c:506
static SignalHandler * SetMagickSignalHandler(int signal_number, SignalHandler *handler)
Definition: magick.c:1370
MagickExport MagickBooleanType IsMagickCoreInstantiated(void)
Definition: magick.c:1281
MagickExport void ResetSplayTreeIterator(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:1472
MagickPrivate void CoderComponentTerminus(void)
Definition: coder.c:235
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:1122
MagickExport size_t GetNumberOfNodesInSplayTree(const SplayTreeInfo *splay_tree)
Definition: splay-tree.c:976
MagickExport void UnregisterStaticModules(void)
Definition: static.c:366
MagickPrivate void RegistryComponentTerminus(void)
Definition: registry.c:320
#define MagickPrecision
MagickPrivate MagickBooleanType MimeComponentGenesis(void)
Definition: mime.c:1029
MagickExport MagickInfo * AcquireMagickInfo(const char *magick_module, const char *name, const char *description)
Definition: magick.c:179
MagickPrivate MagickBooleanType LocaleComponentGenesis(void)
Definition: locale.c:1691
static volatile MagickBooleanType magickcore_signal_in_progress
Definition: magick.c:136
#define MagickPrivate
MagickExport int SetMagickPrecision(const int precision)
Definition: magick.c:1752
MagickPrivate void MagickComponentTerminus(void)
Definition: magick.c:1329
#define MagickExport
MagickExport MagickBooleanType RegisterMagickInfo(MagickInfo *magick_info)
Definition: magick.c:1680
MagickPrivate void MimeComponentTerminus(void)
Definition: mime.c:1075
MagickPrivate void ConfigureComponentTerminus(void)
Definition: configure.c:273
MagickPrivate MagickBooleanType OpenModule(const char *, ExceptionInfo *)
MagickExport const char * GetMagickModuleName(const MagickInfo *magick_info)
Definition: magick.c:887
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:351
MagickExport char * ConstantString(const char *source)
Definition: string.c:702
static SemaphoreInfo * magick_semaphore
Definition: magick.c:126
MagickPrivate void LocaleComponentTerminus(void)
Definition: locale.c:1719
char * mime_type
Definition: magick.h:70
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:418
Image * DecodeImageHandler(const ImageInfo *, ExceptionInfo *)
Definition: magick.h:59