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