43#include "MagickCore/studio.h"
44#include "MagickCore/annotate-private.h"
45#include "MagickCore/blob.h"
46#include "MagickCore/blob-private.h"
47#include "MagickCore/cache.h"
48#include "MagickCore/cache-private.h"
49#include "MagickCore/coder-private.h"
50#include "MagickCore/client.h"
51#include "MagickCore/color-private.h"
52#include "MagickCore/configure-private.h"
53#include "MagickCore/constitute-private.h"
54#include "MagickCore/delegate-private.h"
55#include "MagickCore/draw.h"
56#include "MagickCore/exception.h"
57#include "MagickCore/exception-private.h"
58#include "MagickCore/locale-private.h"
59#include "MagickCore/log-private.h"
60#include "MagickCore/magic-private.h"
61#include "MagickCore/magick.h"
62#include "MagickCore/magick-private.h"
63#include "MagickCore/memory_.h"
64#include "MagickCore/mime-private.h"
65#include "MagickCore/monitor-private.h"
66#include "MagickCore/module.h"
67#include "MagickCore/module-private.h"
68#include "MagickCore/mutex.h"
69#include "MagickCore/nt-base-private.h"
70#include "MagickCore/nt-feature.h"
71#include "MagickCore/opencl-private.h"
72#include "MagickCore/option-private.h"
73#include "MagickCore/random-private.h"
74#include "MagickCore/registry.h"
75#include "MagickCore/registry-private.h"
76#include "MagickCore/resource_.h"
77#include "MagickCore/resource-private.h"
78#include "MagickCore/policy.h"
79#include "MagickCore/policy-private.h"
80#include "MagickCore/mutex.h"
81#include "MagickCore/semaphore.h"
82#include "MagickCore/semaphore-private.h"
83#include "MagickCore/signature-private.h"
84#include "MagickCore/splay-tree.h"
85#include "MagickCore/static.h"
86#include "MagickCore/string_.h"
87#include "MagickCore/string-private.h"
88#include "MagickCore/thread_.h"
89#include "MagickCore/thread-private.h"
90#include "MagickCore/timer-private.h"
91#include "MagickCore/type-private.h"
92#include "MagickCore/token.h"
93#include "MagickCore/utility.h"
94#include "MagickCore/utility-private.h"
95#include "MagickCore/xwindow-private.h"
96#if defined(MAGICKCORE_XML_DELEGATE)
97# include <libxml/parser.h>
104# define SIG_DFL ((SignalHandler *) 0)
107# define SIG_ERR ((SignalHandler *) -1)
116typedef void SignalHandler(
int);
125 *signal_handlers[SIGMAX] = { (SignalHandler *) NULL };
130static volatile MagickBooleanType
131 magickcore_instantiated = MagickFalse,
132 magickcore_signal_in_progress = MagickFalse,
133 magick_list_initialized = MagickFalse;
136 magick_precision = 0;
141static MagickBooleanType
175MagickExport
MagickInfo *AcquireMagickInfo(
const char *magick_module,
176 const char *name,
const char *description)
181 assert(magick_module != (
const char *) NULL);
182 assert(name != (
const char *) NULL);
183 assert(description != (
const char *) NULL);
184 if (IsEventLogging() != MagickFalse)
185 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",name);
186 magick_info=(
MagickInfo *) AcquireCriticalMemory(
sizeof(*magick_info));
187 (void) memset(magick_info,0,
sizeof(*magick_info));
188 magick_info->magick_module=ConstantString(magick_module);
189 magick_info->name=ConstantString(name);
190 magick_info->description=ConstantString(description);
191 magick_info->flags=CoderAdjoinFlag | CoderBlobSupportFlag |
192 CoderDecoderThreadSupportFlag | CoderEncoderThreadSupportFlag |
193 CoderUseExtensionFlag;
194 magick_info->signature=MagickCoreSignature;
220MagickExport DecodeImageHandler *GetImageDecoder(
const MagickInfo *magick_info)
223 return((DecodeImageHandler *) NULL);
224 assert(magick_info->signature == MagickCoreSignature);
225 return(magick_info->decoder);
250MagickExport EncodeImageHandler *GetImageEncoder(
const MagickInfo *magick_info)
253 return((EncodeImageHandler *) NULL);
254 assert(magick_info->signature == MagickCoreSignature);
255 return(magick_info->encoder);
287MagickExport MagickBooleanType GetImageMagick(
const unsigned char *magick,
288 const size_t length,
char *format)
299 assert(magick != (
const unsigned char *) NULL);
300 if (IsEventLogging() != MagickFalse)
301 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"...");
302 exception=AcquireExceptionInfo();
303 p=GetMagickInfo(
"*",exception);
304 exception=DestroyExceptionInfo(exception);
308 LockSemaphoreInfo(magick_semaphore);
309 ResetSplayTreeIterator(magick_list);
310 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
313 if ((p->magick != (IsImageFormatHandler *) NULL) &&
314 (p->magick(magick,length) != 0))
317 (void) CopyMagickString(format,p->name,MagickPathExtent);
320 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
322 UnlockSemaphoreInfo(magick_semaphore);
348MagickExport MagickBooleanType GetMagickAdjoin(
const MagickInfo *magick_info)
351 assert(magick_info->signature == MagickCoreSignature);
352 return(((magick_info->flags & CoderAdjoinFlag) == 0) ? MagickFalse :
378MagickExport MagickBooleanType GetMagickBlobSupport(
382 assert(magick_info->signature == MagickCoreSignature);
383 return(((magick_info->flags & CoderBlobSupportFlag) == 0) ? MagickFalse :
411MagickExport MagickBooleanType GetMagickDecoderSeekableStream(
415 assert(magick_info->signature == MagickCoreSignature);
416 if ((magick_info->flags & CoderDecoderSeekableStreamFlag) == 0)
445MagickExport MagickBooleanType GetMagickDecoderThreadSupport(
449 assert(magick_info->signature == MagickCoreSignature);
450 return(((magick_info->flags & CoderDecoderThreadSupportFlag) == 0) ?
451 MagickFalse : MagickTrue);
476MagickExport
const char *GetMagickDescription(
const MagickInfo *magick_info)
479 assert(magick_info->signature == MagickCoreSignature);
480 return(magick_info->description);
507MagickExport MagickBooleanType GetMagickEncoderSeekableStream(
511 assert(magick_info->signature == MagickCoreSignature);
512 if ((magick_info->flags & CoderEncoderSeekableStreamFlag) == 0)
541MagickExport MagickBooleanType GetMagickEncoderThreadSupport(
545 assert(magick_info->signature == MagickCoreSignature);
546 return(((magick_info->flags & CoderDecoderThreadSupportFlag) == 0) ?
547 MagickFalse : MagickTrue);
573MagickExport MagickBooleanType GetMagickEndianSupport(
577 assert(magick_info->signature == MagickCoreSignature);
578 return(((magick_info->flags & CoderEndianSupportFlag) == 0) ? MagickFalse :
608MagickExport
const MagickInfo *GetMagickInfo(
const char *name,
618 if (IsMagickTreeInstantiated(exception) == MagickFalse)
621 if ((name != (
const char *) NULL) && (*name !=
'\0'))
623 LockSemaphoreInfo(magick_semaphore);
624 if (LocaleCompare(name,
"*") == 0)
625#if defined(MAGICKCORE_BUILD_MODULES)
626 (void) OpenModules(exception);
628 RegisterStaticModules();
632 magick_info=(
const MagickInfo *) GetValueFromSplayTree(magick_list,
635#if defined(MAGICKCORE_BUILD_MODULES)
636 (void) OpenModule(name,exception);
638 (void) RegisterStaticModule(name,exception);
641 UnlockSemaphoreInfo(magick_semaphore);
643 if ((name == (
const char *) NULL) || (LocaleCompare(name,
"*") == 0))
644 return((
const MagickInfo *) GetRootValueFromSplayTree(magick_list));
646 magick_info=(
const MagickInfo *) GetValueFromSplayTree(magick_list,name);
679#if defined(__cplusplus) || defined(c_plusplus)
683static int MagickInfoCompare(
const void *x,
const void *y)
691 return(LocaleCompare((*p)->name,(*q)->name));
694#if defined(__cplusplus) || defined(c_plusplus)
698MagickExport
const MagickInfo **GetMagickInfoList(
const char *pattern,
713 assert(pattern != (
char *) NULL);
714 assert(number_formats != (
size_t *) NULL);
715 if (IsEventLogging() != MagickFalse)
716 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",pattern);
718 p=GetMagickInfo(
"*",exception);
721 formats=(
const MagickInfo **) AcquireQuantumMemory((
size_t)
722 GetNumberOfNodesInSplayTree(magick_list)+1UL,
sizeof(*formats));
728 LockSemaphoreInfo(magick_semaphore);
729 ResetSplayTreeIterator(magick_list);
730 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
733 if ((GetMagickStealth(p) == MagickFalse) &&
734 (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
736 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
738 UnlockSemaphoreInfo(magick_semaphore);
739 qsort((
void *) formats,(
size_t) i,
sizeof(*formats),MagickInfoCompare);
741 *number_formats=(size_t) i;
773#if defined(__cplusplus) || defined(c_plusplus)
777static int MagickCompare(
const void *x,
const void *y)
785 return(LocaleCompare(*p,*q));
788#if defined(__cplusplus) || defined(c_plusplus)
792MagickExport
char **GetMagickList(
const char *pattern,
807 assert(pattern != (
char *) NULL);
808 assert(number_formats != (
size_t *) NULL);
809 if (IsEventLogging() != MagickFalse)
810 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",pattern);
812 p=GetMagickInfo(
"*",exception);
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);
819 LockSemaphoreInfo(magick_semaphore);
820 ResetSplayTreeIterator(magick_list);
821 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
824 if ((GetMagickStealth(p) == MagickFalse) &&
825 (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
826 formats[i++]=ConstantString(p->name);
827 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
829 UnlockSemaphoreInfo(magick_semaphore);
830 qsort((
void *) formats,(
size_t) i,
sizeof(*formats),MagickCompare);
831 formats[i]=(
char *) NULL;
832 *number_formats=(size_t) i;
858MagickExport
const char *GetMagickMimeType(
const MagickInfo *magick_info)
861 assert(magick_info->signature == MagickCoreSignature);
862 return(magick_info->mime_type);
887MagickExport
const char *GetMagickModuleName(
const MagickInfo *magick_info)
890 assert(magick_info->signature == MagickCoreSignature);
891 return(magick_info->magick_module);
916MagickExport
const char *GetMagickName(
const MagickInfo *magick_info)
919 assert(magick_info->signature == MagickCoreSignature);
920 return(magick_info->name);
942MagickExport
int GetMagickPrecision(
void)
944 if (IsEventLogging() != MagickFalse)
945 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"...");
946 return(SetMagickPrecision(0));
971MagickExport MagickBooleanType GetMagickRawSupport(
975 assert(magick_info->signature == MagickCoreSignature);
976 return(((magick_info->flags & CoderRawSupportFlag) == 0) ? MagickFalse :
1002MagickExport MagickBooleanType GetMagickStealth(
const MagickInfo *magick_info)
1005 assert(magick_info->signature == MagickCoreSignature);
1006 return(((magick_info->flags & CoderStealthFlag) == 0) ? MagickFalse :
1034MagickExport MagickBooleanType GetMagickUseExtension(
1038 assert(magick_info->signature == MagickCoreSignature);
1039 return(((magick_info->flags & CoderUseExtensionFlag) == 0) ? MagickFalse :
1067static void *DestroyMagickNode(
void *magick_info)
1073 if (p->magick_module != (
char *) NULL)
1074 p->magick_module=DestroyString(p->magick_module);
1075 if (p->note != (
char *) NULL)
1076 p->note=DestroyString(p->note);
1077 if (p->mime_type != (
char *) NULL)
1078 p->mime_type=DestroyString(p->mime_type);
1079 if (p->version != (
char *) NULL)
1080 p->version=DestroyString(p->version);
1081 if (p->description != (
char *) NULL)
1082 p->description=DestroyString(p->description);
1083 if (p->name != (
char *) NULL)
1084 p->name=DestroyString(p->name);
1086 RelinquishSemaphoreInfo(&p->semaphore);
1087 return(RelinquishMagickMemory(p));
1090static MagickBooleanType IsMagickTreeInstantiated(
ExceptionInfo *exception)
1093 if (magick_list_initialized == MagickFalse)
1096 ActivateSemaphoreInfo(&magick_semaphore);
1097 LockSemaphoreInfo(magick_semaphore);
1098 if (magick_list_initialized == MagickFalse)
1100 magick_list=NewSplayTree(CompareSplayTreeString,(
void *(*)(
void *))
1101 NULL,DestroyMagickNode);
1102#if defined(MAGICKCORE_MODULES_SUPPORT)
1103 (void) GetModuleInfo((
char *) NULL,exception);
1105 magick_list_initialized=MagickTrue;
1107 UnlockSemaphoreInfo(magick_semaphore);
1109 return(magick_list != (
SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
1135MagickPrivate MagickBooleanType IsMagickConflict(
const char *magick)
1137 assert(magick != (
char *) NULL);
1139 return(VMSIsMagickConflict(magick));
1140#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
1141 return(NTIsMagickConflict(magick));
1143 return(MagickFalse);
1171MagickExport MagickBooleanType ListMagickInfo(FILE *file,
1186 if (file == (FILE *) NULL)
1188 magick_info=GetMagickInfoList(
"*",&number_formats,exception);
1189 if (magick_info == (
const MagickInfo **) NULL)
1190 return(MagickFalse);
1191 ClearMagickException(exception);
1192#if !defined(MAGICKCORE_MODULES_SUPPORT)
1193 (void) FormatLocaleFile(file,
" Format Mode Description\n");
1195 (void) FormatLocaleFile(file,
" Format Module Mode Description\n");
1197 (void) FormatLocaleFile(file,
1198 "--------------------------------------------------------"
1199 "-----------------------\n");
1200 for (i=0; i < (ssize_t) number_formats; i++)
1202 if (GetMagickStealth(magick_info[i]) != MagickFalse)
1204 (void) FormatLocaleFile(file,
"%9s%c ",
1205 magick_info[i]->name != (
char *) NULL ? magick_info[i]->name :
"",
1206 GetMagickBlobSupport(magick_info[i]) != MagickFalse ?
'*' :
' ');
1207#if defined(MAGICKCORE_MODULES_SUPPORT)
1210 magick_module[MagickPathExtent];
1212 *magick_module=
'\0';
1213 if (magick_info[i]->magick_module != (
char *) NULL)
1214 (void) CopyMagickString(magick_module,magick_info[i]->magick_module,
1216 (void) ConcatenateMagickString(magick_module,
" ",
1218 magick_module[9]=
'\0';
1219 (void) FormatLocaleFile(file,
"%9s ",magick_module);
1222 (void) FormatLocaleFile(file,
"%c%c%c ",magick_info[i]->decoder ?
'r' :
'-',
1223 magick_info[i]->encoder ?
'w' :
'-',magick_info[i]->encoder != NULL &&
1224 GetMagickAdjoin(magick_info[i]) != MagickFalse ?
'+' :
'-');
1225 if (magick_info[i]->description != (
char *) NULL)
1226 (void) FormatLocaleFile(file,
" %s",magick_info[i]->description);
1227 if (magick_info[i]->version != (
char *) NULL)
1228 (void) FormatLocaleFile(file,
" (%s)",magick_info[i]->version);
1229 (void) FormatLocaleFile(file,
"\n");
1230 if (magick_info[i]->note != (
char *) NULL)
1235 text=StringToList(magick_info[i]->note);
1236 if (text != (
char **) NULL)
1238 for (j=0; text[j] != (
char *) NULL; j++)
1240 (void) FormatLocaleFile(file,
" %s\n",text[j]);
1241 text[j]=DestroyString(text[j]);
1243 text=(
char **) RelinquishMagickMemory(text);
1247 (void) FormatLocaleFile(file,
"\n* native blob support\n");
1248 (void) FormatLocaleFile(file,
"r read support\n");
1249 (void) FormatLocaleFile(file,
"w write support\n");
1250 (void) FormatLocaleFile(file,
"+ support for multiple images\n");
1251 (void) fflush(file);
1252 magick_info=(
const MagickInfo **) RelinquishMagickMemory((
void *)
1278MagickExport MagickBooleanType IsMagickCoreInstantiated(
void)
1280 return(magickcore_instantiated);
1301MagickPrivate MagickBooleanType MagickComponentGenesis(
void)
1304 magick_semaphore=AcquireSemaphoreInfo();
1326MagickPrivate
void MagickComponentTerminus(
void)
1329 ActivateSemaphoreInfo(&magick_semaphore);
1330 LockSemaphoreInfo(magick_semaphore);
1333 magick_list=DestroySplayTree(magick_list);
1334 magick_list_initialized=MagickFalse;
1336 UnlockSemaphoreInfo(magick_semaphore);
1337 RelinquishSemaphoreInfo(&magick_semaphore);
1367static SignalHandler *SetMagickSignalHandler(
int signal_number,
1368 SignalHandler *handler)
1370#if defined(MAGICKCORE_HAVE_SIGACTION) && defined(MAGICKCORE_HAVE_SIGEMPTYSET)
1382 sigaddset(&mask,signal_number);
1383 sigprocmask(SIG_BLOCK,&mask,NULL);
1384 action.sa_mask=mask;
1385 action.sa_handler=handler;
1387#if defined(SA_INTERRUPT)
1388 action.sa_flags|=SA_INTERRUPT;
1390#if defined(SA_ONSTACK)
1391 action.sa_flags|=SA_ONSTACK;
1393 previous_action.sa_handler=SIG_DFL;
1394 status=sigaction(signal_number,&action,&previous_action);
1397 sigprocmask(SIG_UNBLOCK,&mask,NULL);
1398 return(previous_action.sa_handler);
1400 return(signal(signal_number,handler));
1404static void MagickSignalHandler(
int signal_number)
1406 if (magickcore_signal_in_progress != MagickFalse)
1407 (void) SetMagickSignalHandler(signal_number,signal_handlers[signal_number]);
1408 magickcore_signal_in_progress=MagickTrue;
1409 AsynchronousResourceComponentTerminus();
1411 if (signal_number == SIGQUIT)
1415 if (signal_number == SIGABRT)
1419 if (signal_number == SIGBUS)
1423 if (signal_number == SIGFPE)
1427 if (signal_number == SIGSEGV)
1430#if !defined(MAGICKCORE_HAVE__EXIT)
1431 exit(signal_number);
1434 if (signal_number == SIGHUP)
1435 _exit(signal_number);
1438 if (signal_number == SIGINT)
1439 _exit(signal_number);
1441#if defined(MAGICKCORE_HAVE_RAISE)
1442 if (signal_handlers[signal_number] != MagickSignalHandler)
1443 raise(signal_number);
1445 _exit(signal_number);
1449static SignalHandler *RegisterMagickSignalHandler(
int signal_number)
1454 handler=SetMagickSignalHandler(signal_number,MagickSignalHandler);
1455 if (handler == SIG_ERR)
1457 if (handler != SIG_DFL)
1458 handler=SetMagickSignalHandler(signal_number,handler);
1460 (
void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
1461 "Register handler for signal: %d",signal_number);
1465static void SetClientNameAndPath(
const char *path)
1468 execution_path[MagickPathExtent],
1469 filename[MagickPathExtent];
1471#if defined(MAGICKCORE_WINDOWS_SUPPORT)
1472 if ((path != (
const char *) NULL) && (IsPathAccessible(path) != MagickFalse))
1474 if ((path != (
const char *) NULL) && (*path == *DirectorySeparator) &&
1475 (IsPathAccessible(path) != MagickFalse))
1477 (void) CopyMagickString(execution_path,path,MagickPathExtent);
1479 (
void) GetExecutionPath(execution_path,MagickPathExtent);
1480 GetPathComponent(execution_path,TailPath,filename);
1481 (void) SetClientName(filename);
1482 GetPathComponent(execution_path,HeadPath,execution_path);
1483 (void) SetClientPath(execution_path);
1486MagickExport
void MagickCoreGenesis(
const char *path,
1487 const MagickBooleanType establish_signal_handlers)
1495#if defined(__has_feature)
1496#if __has_feature(address_sanitizer)
1497 (void) putenv(
"MAGICK_THREAD_LIMIT=1");
1500 InitializeMagickMutex();
1502 if (magickcore_instantiated != MagickFalse)
1504 UnlockMagickMutex();
1507 (void) SemaphoreComponentGenesis();
1508 (void) ExceptionComponentGenesis();
1509 SetClientNameAndPath(path);
1510 (void) LogComponentGenesis();
1511 (void) LocaleComponentGenesis();
1512 (void) RandomComponentGenesis();
1513 events=GetEnvironmentValue(
"MAGICK_DEBUG");
1514 if (events != (
char *) NULL)
1516 (void) SetLogEventMask(events);
1517 events=DestroyString(events);
1519#if defined(MAGICKCORE_WINDOWS_SUPPORT)
1522 if (establish_signal_handlers != MagickFalse)
1528 if (signal_handlers[SIGABRT] == (SignalHandler *) NULL)
1529 signal_handlers[SIGABRT]=RegisterMagickSignalHandler(SIGABRT);
1532 if (signal_handlers[SIGBUS] == (SignalHandler *) NULL)
1533 signal_handlers[SIGBUS]=RegisterMagickSignalHandler(SIGBUS);
1536 if (signal_handlers[SIGSEGV] == (SignalHandler *) NULL)
1537 signal_handlers[SIGSEGV]=RegisterMagickSignalHandler(SIGSEGV);
1540 if (signal_handlers[SIGFPE] == (SignalHandler *) NULL)
1541 signal_handlers[SIGFPE]=RegisterMagickSignalHandler(SIGFPE);
1544 if (signal_handlers[SIGHUP] == (SignalHandler *) NULL)
1545 signal_handlers[SIGHUP]=RegisterMagickSignalHandler(SIGHUP);
1548 if (signal_handlers[SIGINT] == (SignalHandler *) NULL)
1549 signal_handlers[SIGINT]=RegisterMagickSignalHandler(SIGINT);
1552 if (signal_handlers[SIGQUIT] == (SignalHandler *) NULL)
1553 signal_handlers[SIGQUIT]=RegisterMagickSignalHandler(SIGQUIT);
1556 if (signal_handlers[SIGTERM] == (SignalHandler *) NULL)
1557 signal_handlers[SIGTERM]=RegisterMagickSignalHandler(SIGTERM);
1560 if (signal_handlers[SIGXCPU] == (SignalHandler *) NULL)
1561 signal_handlers[SIGXCPU]=RegisterMagickSignalHandler(SIGXCPU);
1564 if (signal_handlers[SIGXFSZ] == (SignalHandler *) NULL)
1565 signal_handlers[SIGXFSZ]=RegisterMagickSignalHandler(SIGXFSZ);
1571 (void) ConfigureComponentGenesis();
1572 (void) PolicyComponentGenesis();
1573#if MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
1574 (void) ZeroConfigurationPolicy;
1576 (void) CacheComponentGenesis();
1577 (void) ResourceComponentGenesis();
1578 (void) CoderComponentGenesis();
1579 (void) MagickComponentGenesis();
1580#if defined(MAGICKCORE_MODULES_SUPPORT)
1581 (void) ModuleComponentGenesis();
1583 (void) DelegateComponentGenesis();
1584 (void) MagicComponentGenesis();
1585 (void) ColorComponentGenesis();
1586 (void) TypeComponentGenesis();
1587 (void) MimeComponentGenesis();
1588 (void) AnnotateComponentGenesis();
1589#if defined(MAGICKCORE_X11_DELEGATE)
1590 (void) XComponentGenesis();
1592 (void) RegistryComponentGenesis();
1593 (void) MonitorComponentGenesis();
1594 magickcore_instantiated=MagickTrue;
1595 UnlockMagickMutex();
1638MagickExport
void MagickCoreTerminus(
void)
1640 InitializeMagickMutex();
1642 if (magickcore_instantiated == MagickFalse)
1644 UnlockMagickMutex();
1647 MonitorComponentTerminus();
1648 RegistryComponentTerminus();
1649#if defined(MAGICKCORE_XML_DELEGATE)
1652 AnnotateComponentTerminus();
1653 MimeComponentTerminus();
1654 TypeComponentTerminus();
1655#if defined(MAGICKCORE_OPENCL_SUPPORT)
1658 ColorComponentTerminus();
1659#if defined(MAGICKCORE_WINDOWS_SUPPORT)
1660 NTWindowsTerminus();
1662 MagicComponentTerminus();
1663 DelegateComponentTerminus();
1664 MagickComponentTerminus();
1665#if !defined(MAGICKCORE_BUILD_MODULES)
1666 UnregisterStaticModules();
1668#if defined(MAGICKCORE_MODULES_SUPPORT)
1669 ModuleComponentTerminus();
1671#if defined(MAGICKCORE_X11_DELEGATE)
1672 XComponentTerminus();
1674 CoderComponentTerminus();
1675 ResourceComponentTerminus();
1676 CacheComponentTerminus();
1677 PolicyComponentTerminus();
1678 ConfigureComponentTerminus();
1679 RandomComponentTerminus();
1680 LocaleComponentTerminus();
1681 LogComponentTerminus();
1682 ExceptionComponentTerminus();
1683 magickcore_instantiated=MagickFalse;
1684 UnlockMagickMutex();
1685 SemaphoreComponentTerminus();
1714MagickExport MagickBooleanType RegisterMagickInfo(
MagickInfo *magick_info)
1723 assert(magick_info->signature == MagickCoreSignature);
1724 if (IsEventLogging() != MagickFalse)
1725 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",magick_info->name);
1727 return(MagickFalse);
1728 if ((GetMagickDecoderThreadSupport(magick_info) == MagickFalse) ||
1729 (GetMagickEncoderThreadSupport(magick_info) == MagickFalse))
1730 magick_info->semaphore=AcquireSemaphoreInfo();
1731 status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
1753MagickPrivate
void ResetMagickPrecision(
void)
1787MagickExport
int SetMagickPrecision(
const int precision)
1789#define MagickPrecision (MAGICKCORE_QUANTUM_DEPTH/8+4)
1791 if (IsEventLogging() != MagickFalse)
1792 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"...");
1794 magick_precision=precision;
1795 if ((precision < 0) || (magick_precision == 0))
1801 *exception = AcquireExceptionInfo();
1803 magick_precision=MagickPrecision;
1804 limit=(
char *) GetImageRegistry(StringRegistryType,
"precision",exception);
1805 exception=DestroyExceptionInfo(exception);
1806 if (limit == (
char *) NULL)
1807 limit=GetEnvironmentValue(
"MAGICK_PRECISION");
1808 if (limit == (
char *) NULL)
1809 limit=GetPolicyValue(
"system:precision");
1810 if (limit != (
char *) NULL)
1812 magick_precision=StringToInteger(limit);
1813 limit=DestroyString(limit);
1816 return(magick_precision);
1843MagickExport MagickBooleanType UnregisterMagickInfo(
const char *name)
1851 assert(name != (
const char *) NULL);
1853 return(MagickFalse);
1854 if (GetNumberOfNodesInSplayTree(magick_list) == 0)
1855 return(MagickFalse);
1856 LockSemaphoreInfo(magick_semaphore);
1857 ResetSplayTreeIterator(magick_list);
1858 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
1861 if (LocaleCompare(p->name,name) == 0)
1863 p=(
const MagickInfo *) GetNextValueInSplayTree(magick_list);
1865 status=DeleteNodeByValueFromSplayTree(magick_list,p);
1866 UnlockSemaphoreInfo(magick_semaphore);