2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % M M OOO DDDD U U L EEEEE %
7 % MM MM O O D D U U L E %
8 % M M M O O D D U U L EEE %
9 % M M O O D D U U L E %
10 % M M OOO DDDD UUU LLLLL EEEEE %
13 % MagickCore Module Methods %
20 % Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % http://www.imagemagick.org/script/license.php %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 #include "MagickCore/studio.h"
44 #include "MagickCore/blob.h"
45 #include "MagickCore/coder.h"
46 #include "MagickCore/client.h"
47 #include "MagickCore/configure.h"
48 #include "MagickCore/exception.h"
49 #include "MagickCore/exception-private.h"
50 #include "MagickCore/log.h"
51 #include "MagickCore/hashmap.h"
52 #include "MagickCore/magic.h"
53 #include "MagickCore/magick.h"
54 #include "MagickCore/memory_.h"
55 #include "MagickCore/module.h"
56 #include "MagickCore/module-private.h"
57 #include "MagickCore/nt-base-private.h"
58 #include "MagickCore/policy.h"
59 #include "MagickCore/semaphore.h"
60 #include "MagickCore/splay-tree.h"
61 #include "MagickCore/static.h"
62 #include "MagickCore/string_.h"
63 #include "MagickCore/string-private.h"
64 #include "MagickCore/token.h"
65 #include "MagickCore/utility.h"
66 #include "MagickCore/utility-private.h"
67 #if defined(MAGICKCORE_MODULES_SUPPORT)
68 #if defined(MAGICKCORE_LTDL_DELEGATE)
70 typedef lt_dlhandle ModuleHandle;
72 typedef void *ModuleHandle;
78 #if defined(MAGICKCORE_LTDL_DELEGATE)
79 # define ModuleGlobExpression "*.la"
82 # define ModuleGlobExpression "IM_MOD_DB_*.dll"
84 # define ModuleGlobExpression "IM_MOD_RL_*.dll"
92 *module_semaphore = (SemaphoreInfo *) NULL;
95 *module_list = (SplayTreeInfo *) NULL;
100 static const ModuleInfo
101 *RegisterModule(const ModuleInfo *,ExceptionInfo *);
103 static MagickBooleanType
104 GetMagickModulePath(const char *,MagickModuleType,char *,ExceptionInfo *),
105 IsModuleTreeInstantiated(ExceptionInfo *),
106 UnregisterModule(const ModuleInfo *,ExceptionInfo *);
109 TagToCoderModuleName(const char *,char *),
110 TagToFilterModuleName(const char *,char *),
111 TagToModuleName(const char *,const char *,char *);
114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 % A c q u i r e M o d u l e I n f o %
122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 % AcquireModuleInfo() allocates the ModuleInfo structure.
126 % The format of the AcquireModuleInfo method is:
128 % ModuleInfo *AcquireModuleInfo(const char *path,const char *tag)
130 % A description of each parameter follows:
132 % o path: the path associated with the tag.
134 % o tag: a character string that represents the image format we are
138 MagickExport ModuleInfo *AcquireModuleInfo(const char *path,const char *tag)
143 module_info=(ModuleInfo *) AcquireMagickMemory(sizeof(*module_info));
144 if (module_info == (ModuleInfo *) NULL)
145 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
146 (void) ResetMagickMemory(module_info,0,sizeof(*module_info));
147 if (path != (const char *) NULL)
148 module_info->path=ConstantString(path);
149 if (tag != (const char *) NULL)
150 module_info->tag=ConstantString(tag);
151 module_info->timestamp=time(0);
152 module_info->signature=MagickSignature;
157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 % D e s t r o y M o d u l e L i s t %
165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167 % DestroyModuleList() unregisters any previously loaded modules and exits
168 % the module loaded environment.
170 % The format of the DestroyModuleList module is:
172 % void DestroyModuleList(void)
175 MagickExport void DestroyModuleList(void)
178 Destroy magick modules.
180 LockSemaphoreInfo(module_semaphore);
181 #if defined(MAGICKCORE_MODULES_SUPPORT)
182 if (module_list != (SplayTreeInfo *) NULL)
183 module_list=DestroySplayTree(module_list);
185 UnlockSemaphoreInfo(module_semaphore);
189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193 % G e t M o d u l e I n f o %
197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
199 % GetModuleInfo() returns a pointer to a ModuleInfo structure that matches the
200 % specified tag. If tag is NULL, the head of the module list is returned. If
201 % no modules are loaded, or the requested module is not found, NULL is
204 % The format of the GetModuleInfo module is:
206 % ModuleInfo *GetModuleInfo(const char *tag,ExceptionInfo *exception)
208 % A description of each parameter follows:
210 % o tag: a character string that represents the image format we are
213 % o exception: return any errors or warnings in this structure.
216 MagickExport ModuleInfo *GetModuleInfo(const char *tag,ExceptionInfo *exception)
218 if (IsModuleTreeInstantiated(exception) == MagickFalse)
219 return((ModuleInfo *) NULL);
220 if ((tag == (const char *) NULL) || (LocaleCompare(tag,"*") == 0))
225 #if defined(MAGICKCORE_MODULES_SUPPORT)
226 if (LocaleCompare(tag,"*") == 0)
227 (void) OpenModules(exception);
229 LockSemaphoreInfo(module_semaphore);
230 ResetSplayTreeIterator(module_list);
231 p=(ModuleInfo *) GetNextValueInSplayTree(module_list);
232 UnlockSemaphoreInfo(module_semaphore);
235 return((ModuleInfo *) GetValueFromSplayTree(module_list,tag));
239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
243 % G e t M o d u l e I n f o L i s t %
247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
249 % GetModuleInfoList() returns any modules that match the specified pattern.
251 % The format of the GetModuleInfoList function is:
253 % const ModuleInfo **GetModuleInfoList(const char *pattern,
254 % size_t *number_modules,ExceptionInfo *exception)
256 % A description of each parameter follows:
258 % o pattern: Specifies a pointer to a text string containing a pattern.
260 % o number_modules: This integer returns the number of modules in the list.
262 % o exception: return any errors or warnings in this structure.
266 #if defined(__cplusplus) || defined(c_plusplus)
270 static int ModuleInfoCompare(const void *x,const void *y)
276 p=(const ModuleInfo **) x,
277 q=(const ModuleInfo **) y;
278 if (LocaleCompare((*p)->path,(*q)->path) == 0)
279 return(LocaleCompare((*p)->tag,(*q)->tag));
280 return(LocaleCompare((*p)->path,(*q)->path));
283 #if defined(__cplusplus) || defined(c_plusplus)
287 MagickExport const ModuleInfo **GetModuleInfoList(const char *pattern,
288 size_t *number_modules,ExceptionInfo *exception)
293 register const ModuleInfo
300 Allocate module list.
302 assert(pattern != (char *) NULL);
303 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
304 assert(number_modules != (size_t *) NULL);
306 p=GetModuleInfo("*",exception);
307 if (p == (const ModuleInfo *) NULL)
308 return((const ModuleInfo **) NULL);
309 modules=(const ModuleInfo **) AcquireQuantumMemory((size_t)
310 GetNumberOfNodesInSplayTree(module_list)+1UL,sizeof(*modules));
311 if (modules == (const ModuleInfo **) NULL)
312 return((const ModuleInfo **) NULL);
314 Generate module list.
316 LockSemaphoreInfo(module_semaphore);
317 ResetSplayTreeIterator(module_list);
318 p=(const ModuleInfo *) GetNextValueInSplayTree(module_list);
319 for (i=0; p != (const ModuleInfo *) NULL; )
321 if ((p->stealth == MagickFalse) &&
322 (GlobExpression(p->tag,pattern,MagickFalse) != MagickFalse))
324 p=(const ModuleInfo *) GetNextValueInSplayTree(module_list);
326 UnlockSemaphoreInfo(module_semaphore);
327 qsort((void *) modules,(size_t) i,sizeof(*modules),ModuleInfoCompare);
328 modules[i]=(ModuleInfo *) NULL;
329 *number_modules=(size_t) i;
334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
338 % G e t M o d u l e L i s t %
342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
344 % GetModuleList() returns any image format modules that match the specified
347 % The format of the GetModuleList function is:
349 % char **GetModuleList(const char *pattern,const MagickModuleType type,
350 % size_t *number_modules,ExceptionInfo *exception)
352 % A description of each parameter follows:
354 % o pattern: Specifies a pointer to a text string containing a pattern.
356 % o type: choose from MagickImageCoderModule or MagickImageFilterModule.
358 % o number_modules: This integer returns the number of modules in the
361 % o exception: return any errors or warnings in this structure.
365 #if defined(__cplusplus) || defined(c_plusplus)
369 static int ModuleCompare(const void *x,const void *y)
377 return(LocaleCompare(*p,*q));
380 #if defined(__cplusplus) || defined(c_plusplus)
384 static inline int MagickReadDirectory(DIR *directory,struct dirent *entry,
385 struct dirent **result)
387 #if defined(MAGICKCORE_HAVE_READDIR_R)
388 return(readdir_r(directory,entry,result));
392 *result=readdir(directory);
397 MagickExport char **GetModuleList(const char *pattern,
398 const MagickModuleType type,size_t *number_modules,ExceptionInfo *exception)
402 filename[MaxTextExtent],
403 module_path[MaxTextExtent],
423 Locate all modules in the image coder or filter path.
427 case MagickImageCoderModule:
430 TagToCoderModuleName("magick",filename);
431 status=GetMagickModulePath(filename,MagickImageCoderModule,module_path,
435 case MagickImageFilterModule:
437 TagToFilterModuleName("analyze",filename);
438 status=GetMagickModulePath(filename,MagickImageFilterModule,module_path,
443 if (status == MagickFalse)
444 return((char **) NULL);
445 GetPathComponent(module_path,HeadPath,path);
447 modules=(char **) AcquireQuantumMemory((size_t) max_entries+1UL,
449 if (modules == (char **) NULL)
450 return((char **) NULL);
451 *modules=(char *) NULL;
452 directory=opendir(path);
453 if (directory == (DIR *) NULL)
455 modules=(char **) RelinquishMagickMemory(modules);
456 return((char **) NULL);
458 buffer=(struct dirent *) AcquireMagickMemory(sizeof(*buffer)+FILENAME_MAX+1);
459 if (buffer == (struct dirent *) NULL)
460 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
462 while ((MagickReadDirectory(directory,buffer,&entry) == 0) &&
463 (entry != (struct dirent *) NULL))
465 status=GlobExpression(entry->d_name,ModuleGlobExpression,MagickFalse);
466 if (status == MagickFalse)
468 if (GlobExpression(entry->d_name,pattern,MagickFalse) == MagickFalse)
470 if (i >= (ssize_t) max_entries)
472 modules=(char **) NULL;
473 if (~max_entries > max_entries)
474 modules=(char **) ResizeQuantumMemory(modules,(size_t)
475 (max_entries << 1),sizeof(*modules));
477 if (modules == (char **) NULL)
481 Add new module name to list.
483 modules[i]=AcquireString((char *) NULL);
484 GetPathComponent(entry->d_name,BasePath,modules[i]);
485 if (LocaleNCompare("IM_MOD_",modules[i],7) == 0)
487 (void) CopyMagickString(modules[i],modules[i]+10,MaxTextExtent);
488 modules[i][strlen(modules[i])-1]='\0';
492 buffer=(struct dirent *) RelinquishMagickMemory(buffer);
493 (void) closedir(directory);
494 if (modules == (char **) NULL)
496 (void) ThrowMagickException(exception,GetMagickModule(),ConfigureError,
497 "MemoryAllocationFailed","`%s'",pattern);
498 return((char **) NULL);
500 qsort((void *) modules,(size_t) i,sizeof(*modules),ModuleCompare);
501 modules[i]=(char *) NULL;
502 *number_modules=(size_t) i;
507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
511 % G e t M a g i c k M o d u l e P a t h %
515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
517 % GetMagickModulePath() finds a module with the specified module type and
520 % The format of the GetMagickModulePath module is:
522 % MagickBooleanType GetMagickModulePath(const char *filename,
523 % MagickModuleType module_type,char *path,ExceptionInfo *exception)
525 % A description of each parameter follows:
527 % o filename: the module file name.
529 % o module_type: the module type: MagickImageCoderModule or
530 % MagickImageFilterModule.
532 % o path: the path associated with the filename.
534 % o exception: return any errors or warnings in this structure.
537 static MagickBooleanType GetMagickModulePath(const char *filename,
538 MagickModuleType module_type,char *path,ExceptionInfo *exception)
543 assert(filename != (const char *) NULL);
544 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
545 assert(path != (char *) NULL);
546 assert(exception != (ExceptionInfo *) NULL);
547 (void) CopyMagickString(path,filename,MaxTextExtent);
548 module_path=(char *) NULL;
551 case MagickImageCoderModule:
554 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),
555 "Searching for coder module file \"%s\" ...",filename);
556 module_path=GetEnvironmentValue("MAGICK_CODER_MODULE_PATH");
557 #if defined(MAGICKCORE_CODER_PATH)
558 if (module_path == (char *) NULL)
559 module_path=AcquireString(MAGICKCORE_CODER_PATH);
563 case MagickImageFilterModule:
565 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),
566 "Searching for filter module file \"%s\" ...",filename);
567 module_path=GetEnvironmentValue("MAGICK_CODER_FILTER_PATH");
568 #if defined(MAGICKCORE_FILTER_PATH)
569 if (module_path == (char *) NULL)
570 module_path=AcquireString(MAGICKCORE_FILTER_PATH);
575 if (module_path != (char *) NULL)
581 for (p=module_path-1; p != (char *) NULL; )
583 (void) CopyMagickString(path,p+1,MaxTextExtent);
584 q=strchr(path,DirectoryListSeparator);
585 if (q != (char *) NULL)
587 q=path+strlen(path)-1;
588 if ((q >= path) && (*q != *DirectorySeparator))
589 (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);
590 (void) ConcatenateMagickString(path,filename,MaxTextExtent);
591 if (IsPathAccessible(path) != MagickFalse)
593 module_path=DestroyString(module_path);
596 p=strchr(p+1,DirectoryListSeparator);
598 module_path=DestroyString(module_path);
600 #if defined(MAGICKCORE_INSTALLED_SUPPORT)
602 #if defined(MAGICKCORE_CODER_PATH)
608 Search hard coded paths.
612 case MagickImageCoderModule:
615 directory=MAGICKCORE_CODER_PATH;
618 case MagickImageFilterModule:
620 directory=MAGICKCORE_FILTER_PATH;
624 (void) FormatLocaleString(path,MaxTextExtent,"%s%s",directory,filename);
625 if (IsPathAccessible(path) == MagickFalse)
627 ThrowFileException(exception,ConfigureWarning,
628 "UnableToOpenModuleFile",path);
634 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
643 Locate path via registry key.
647 case MagickImageCoderModule:
650 registery_key="CoderModulesPath";
653 case MagickImageFilterModule:
655 registery_key="FilterModulesPath";
659 key_value=NTRegistryKeyLookup(registery_key);
660 if (key_value == (unsigned char *) NULL)
662 ThrowMagickException(exception,GetMagickModule(),ConfigureError,
663 "RegistryKeyLookupFailed","`%s'",registery_key);
666 (void) FormatLocaleString(path,MaxTextExtent,"%s%s%s",(char *) key_value,
667 DirectorySeparator,filename);
668 key_value=(unsigned char *) RelinquishMagickMemory(key_value);
669 if (IsPathAccessible(path) == MagickFalse)
671 ThrowFileException(exception,ConfigureWarning,
672 "UnableToOpenModuleFile",path);
679 #if !defined(MAGICKCORE_CODER_PATH) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
680 # error MAGICKCORE_CODER_PATH or MAGICKCORE_WINDOWS_SUPPORT must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined
687 home=GetEnvironmentValue("MAGICK_HOME");
688 if (home != (char *) NULL)
693 #if !defined(MAGICKCORE_POSIX_SUPPORT)
694 (void) FormatLocaleString(path,MaxTextExtent,"%s%s%s",home,
695 DirectorySeparator,filename);
702 case MagickImageCoderModule:
705 directory=MAGICKCORE_CODER_RELATIVE_PATH;
708 case MagickImageFilterModule:
710 directory=MAGICKCORE_FILTER_RELATIVE_PATH;
714 (void) FormatLocaleString(path,MaxTextExtent,"%s/lib/%s/%s",home,
717 home=DestroyString(home);
718 if (IsPathAccessible(path) != MagickFalse)
722 if (*GetClientPath() != '\0')
725 Search based on executable directory.
727 #if !defined(MAGICKCORE_POSIX_SUPPORT)
728 (void) FormatLocaleString(path,MaxTextExtent,"%s%s%s",GetClientPath(),
729 DirectorySeparator,filename);
732 prefix[MaxTextExtent];
739 case MagickImageCoderModule:
745 case MagickImageFilterModule:
751 (void) CopyMagickString(prefix,GetClientPath(),MaxTextExtent);
752 ChopPathComponents(prefix,1);
753 (void) FormatLocaleString(path,MaxTextExtent,"%s/lib/%s/%s/%s",prefix,
754 MAGICKCORE_MODULES_RELATIVE_PATH,directory,filename);
756 if (IsPathAccessible(path) != MagickFalse)
759 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
764 if ((NTGetModulePath("CORE_RL_magick_.dll",path) != MagickFalse) ||
765 (NTGetModulePath("CORE_DB_magick_.dll",path) != MagickFalse) ||
766 (NTGetModulePath("Magick.dll",path) != MagickFalse))
768 (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);
769 (void) ConcatenateMagickString(path,filename,MaxTextExtent);
770 if (IsPathAccessible(path) != MagickFalse)
779 home=GetEnvironmentValue("HOME");
780 if (home == (char *) NULL)
781 home=GetEnvironmentValue("USERPROFILE");
782 if (home != (char *) NULL)
785 Search $HOME/.config/ImageMagick.
787 (void) FormatLocaleString(path,MaxTextExtent,
788 "%s%s.config%sImageMagick%s%s",home,DirectorySeparator,
789 DirectorySeparator,DirectorySeparator,filename);
790 home=DestroyString(home);
791 if (IsPathAccessible(path) != MagickFalse)
796 Search current directory.
798 if (IsPathAccessible(path) != MagickFalse)
800 if (exception->severity < ConfigureError)
801 ThrowFileException(exception,ConfigureWarning,"UnableToOpenModuleFile",
808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
812 % I s M o d u l e T r e e I n s t a n t i a t e d %
816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
818 % IsModuleTreeInstantiated() determines if the module tree is instantiated.
819 % If not, it instantiates the tree and returns it.
821 % The format of the IsModuleTreeInstantiated() method is:
823 % IsModuleTreeInstantiated(Exceptioninfo *exception)
825 % A description of each parameter follows.
827 % o exception: return any errors or warnings in this structure.
831 static void *DestroyModuleNode(void *module_info)
839 exception=AcquireExceptionInfo();
840 p=(ModuleInfo *) module_info;
841 if (UnregisterModule(p,exception) == MagickFalse)
842 CatchException(exception);
843 if (p->tag != (char *) NULL)
844 p->tag=DestroyString(p->tag);
845 if (p->path != (char *) NULL)
846 p->path=DestroyString(p->path);
847 exception=DestroyExceptionInfo(exception);
848 return(RelinquishMagickMemory(p));
851 static MagickBooleanType IsModuleTreeInstantiated(
852 ExceptionInfo *magick_unused(exception))
854 if (module_semaphore == (SemaphoreInfo *) NULL)
855 ActivateSemaphoreInfo(&module_semaphore);
856 LockSemaphoreInfo(module_semaphore);
857 if (module_list == (SplayTreeInfo *) NULL)
865 module_list=NewSplayTree(CompareSplayTreeString,
866 (void *(*)(void *)) NULL,DestroyModuleNode);
867 if (module_list == (SplayTreeInfo *) NULL)
868 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
869 module_info=AcquireModuleInfo((const char *) NULL,"[boot-strap]");
870 module_info->stealth=MagickTrue;
871 status=AddValueToSplayTree(module_list,module_info->tag,module_info);
872 if (status == MagickFalse)
873 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
874 if (lt_dlinit() != 0)
875 ThrowFatalException(ModuleFatalError,"UnableToInitializeModuleLoader");
877 UnlockSemaphoreInfo(module_semaphore);
878 return(module_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
886 % I n v o k e D y n a m i c I m a g e F i l t e r %
890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
892 % InvokeDynamicImageFilter() invokes a dynamic image filter.
894 % The format of the InvokeDynamicImageFilter module is:
896 % MagickBooleanType InvokeDynamicImageFilter(const char *tag,Image **image,
897 % const int argc,const char **argv,ExceptionInfo *exception)
899 % A description of each parameter follows:
901 % o tag: a character string that represents the name of the particular
904 % o image: the image.
906 % o argc: a pointer to an integer describing the number of elements in the
909 % o argv: a pointer to a text array containing the command line arguments.
911 % o exception: return any errors or warnings in this structure.
914 MagickExport MagickBooleanType InvokeDynamicImageFilter(const char *tag,
915 Image **images,const int argc,const char **argv,ExceptionInfo *exception)
936 assert(images != (Image **) NULL);
937 assert((*images)->signature == MagickSignature);
938 if ((*images)->debug != MagickFalse)
939 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
940 (*images)->filename);
941 #if !defined(MAGICKCORE_BUILD_MODULES)
946 status=InvokeStaticImageFilter(tag,images,argc,argv,exception);
947 if (status != MagickFalse)
951 rights=ReadPolicyRights;
952 if (IsRightsAuthorized(FilterPolicyDomain,rights,tag) == MagickFalse)
955 (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
956 "NotAuthorized","`%s'",tag);
959 TagToFilterModuleName(tag,name);
960 status=GetMagickModulePath(name,MagickImageFilterModule,path,exception);
961 if (status == MagickFalse)
963 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
964 "UnableToLoadModule","'%s': %s",name,path);
970 handle=(ModuleHandle) lt_dlopen(path);
971 if (handle == (ModuleHandle) NULL)
973 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
974 "UnableToLoadModule","'%s': %s",name,lt_dlerror());
980 #if !defined(MAGICKCORE_NAMESPACE_PREFIX)
981 (void) FormatLocaleString(name,MaxTextExtent,"%sImage",tag);
983 (void) FormatLocaleString(name,MaxTextExtent,"%s%sImage",
984 MAGICKCORE_NAMESPACE_PREFIX,tag);
989 ClearMagickException(exception);
990 image_filter=(ImageFilterHandler *) lt_dlsym(handle,name);
991 if (image_filter == (ImageFilterHandler *) NULL)
992 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
993 "UnableToLoadModule","'%s': %s",name,lt_dlerror());
999 if ((*images)->debug != MagickFalse)
1000 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),
1001 "Invoking \"%s\" dynamic image filter",tag);
1002 signature=image_filter(images,argc,argv,exception);
1003 if ((*images)->debug != MagickFalse)
1004 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),"\"%s\" completes",
1006 if (signature != MagickImageFilterSignature)
1007 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
1008 "ImageFilterSignatureMismatch","'%s': %8lx != %8lx",tag,
1009 (unsigned long) signature,(unsigned long) MagickImageFilterSignature);
1014 if (lt_dlclose(handle) != 0)
1015 (void) ThrowMagickException(exception,GetMagickModule(),ModuleWarning,
1016 "UnableToCloseModule","'%s': %s",name,lt_dlerror());
1017 return(exception->severity < ErrorException ? MagickTrue : MagickFalse);
1021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025 % L i s t M o d u l e I n f o %
1029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1031 % ListModuleInfo() lists the module info to a file.
1033 % The format of the ListModuleInfo module is:
1035 % MagickBooleanType ListModuleInfo(FILE *file,ExceptionInfo *exception)
1037 % A description of each parameter follows.
1039 % o file: An pointer to a FILE.
1041 % o exception: return any errors or warnings in this structure.
1044 MagickExport MagickBooleanType ListModuleInfo(FILE *file,
1045 ExceptionInfo *exception)
1048 filename[MaxTextExtent],
1049 module_path[MaxTextExtent],
1051 path[MaxTextExtent];
1059 if (file == (const FILE *) NULL)
1064 modules=GetModuleList("*",MagickImageCoderModule,&number_modules,exception);
1065 if (modules == (char **) NULL)
1066 return(MagickFalse);
1067 TagToCoderModuleName("magick",filename);
1068 (void) GetMagickModulePath(filename,MagickImageCoderModule,module_path,
1070 GetPathComponent(module_path,HeadPath,path);
1071 (void) FormatLocaleFile(file,"\nPath: %s\n\n",path);
1072 (void) FormatLocaleFile(file,"Image Coder\n");
1073 (void) FormatLocaleFile(file,
1074 "-------------------------------------------------"
1075 "------------------------------\n");
1076 for (i=0; i < (ssize_t) number_modules; i++)
1078 (void) FormatLocaleFile(file,"%s",modules[i]);
1079 (void) FormatLocaleFile(file,"\n");
1081 (void) fflush(file);
1083 Relinquish resources.
1085 for (i=0; i < (ssize_t) number_modules; i++)
1086 modules[i]=DestroyString(modules[i]);
1087 modules=(char **) RelinquishMagickMemory(modules);
1091 modules=GetModuleList("*",MagickImageFilterModule,&number_modules,exception);
1092 if (modules == (char **) NULL)
1093 return(MagickFalse);
1094 TagToFilterModuleName("analyze",filename);
1095 (void) GetMagickModulePath(filename,MagickImageFilterModule,module_path,
1097 GetPathComponent(module_path,HeadPath,path);
1098 (void) FormatLocaleFile(file,"\nPath: %s\n\n",path);
1099 (void) FormatLocaleFile(file,"Image Filter\n");
1100 (void) FormatLocaleFile(file,
1101 "-------------------------------------------------"
1102 "------------------------------\n");
1103 for (i=0; i < (ssize_t) number_modules; i++)
1105 (void) FormatLocaleFile(file,"%s",modules[i]);
1106 (void) FormatLocaleFile(file,"\n");
1108 (void) fflush(file);
1110 Relinquish resources.
1112 for (i=0; i < (ssize_t) number_modules; i++)
1113 modules[i]=DestroyString(modules[i]);
1114 modules=(char **) RelinquishMagickMemory(modules);
1119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1123 + M o d u l e C o m p o n e n t G e n e s i s %
1127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1129 % ModuleComponentGenesis() instantiates the module component.
1131 % The format of the ModuleComponentGenesis method is:
1133 % MagickBooleanType ModuleComponentGenesis(void)
1136 MagickPrivate MagickBooleanType ModuleComponentGenesis(void)
1144 module_semaphore=AcquireSemaphoreInfo();
1145 exception=AcquireExceptionInfo();
1146 status=IsModuleTreeInstantiated(exception);
1147 exception=DestroyExceptionInfo(exception);
1152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1156 + M o d u l e C o m p o n e n t T e r m i n u s %
1160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1162 % ModuleComponentTerminus() destroys the module component.
1164 % The format of the ModuleComponentTerminus method is:
1166 % ModuleComponentTerminus(void)
1169 MagickPrivate void ModuleComponentTerminus(void)
1171 if (module_semaphore == (SemaphoreInfo *) NULL)
1172 ActivateSemaphoreInfo(&module_semaphore);
1173 DestroyModuleList();
1174 RelinquishSemaphoreInfo(&module_semaphore);
1178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1182 % O p e n M o d u l e %
1186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1188 % OpenModule() loads a module, and invokes its registration module. It
1189 % returns MagickTrue on success, and MagickFalse if there is an error.
1191 % The format of the OpenModule module is:
1193 % MagickBooleanType OpenModule(const char *module,ExceptionInfo *exception)
1195 % A description of each parameter follows:
1197 % o module: a character string that indicates the module to load.
1199 % o exception: return any errors or warnings in this structure.
1202 MagickPrivate MagickBooleanType OpenModule(const char *module,
1203 ExceptionInfo *exception)
1206 filename[MaxTextExtent],
1207 module_name[MaxTextExtent],
1208 name[MaxTextExtent],
1209 path[MaxTextExtent];
1220 register const CoderInfo
1227 Assign module name from alias.
1229 assert(module != (const char *) NULL);
1230 module_info=(ModuleInfo *) GetModuleInfo(module,exception);
1231 if (module_info != (ModuleInfo *) NULL)
1233 (void) CopyMagickString(module_name,module,MaxTextExtent);
1234 p=GetCoderInfo(module,exception);
1235 if (p != (CoderInfo *) NULL)
1236 (void) CopyMagickString(module_name,p->name,MaxTextExtent);
1237 if (GetValueFromSplayTree(module_list,module_name) != (void *) NULL)
1238 return(MagickTrue); /* module already opened, return */
1242 handle=(ModuleHandle) NULL;
1243 TagToCoderModuleName(module_name,filename);
1244 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),
1245 "Searching for module \"%s\" using filename \"%s\"",module_name,filename);
1247 status=GetMagickModulePath(filename,MagickImageCoderModule,path,exception);
1248 if (status == MagickFalse)
1249 return(MagickFalse);
1253 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),
1254 "Opening module at path \"%s\"",path);
1255 handle=(ModuleHandle) lt_dlopen(path);
1256 if (handle == (ModuleHandle) NULL)
1258 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
1259 "UnableToLoadModule","'%s': %s",path,lt_dlerror());
1260 return(MagickFalse);
1265 module_info=AcquireModuleInfo(path,module_name);
1266 module_info->handle=handle;
1267 if (RegisterModule(module_info,exception) == (ModuleInfo *) NULL)
1268 return(MagickFalse);
1270 Define RegisterFORMATImage method.
1272 TagToModuleName(module_name,"Register%sImage",name);
1273 module_info->register_module=(size_t (*)(void)) lt_dlsym(handle,name);
1274 if (module_info->register_module == (size_t (*)(void)) NULL)
1276 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
1277 "UnableToRegisterImageFormat","'%s': %s",module_name,lt_dlerror());
1278 return(MagickFalse);
1280 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),
1281 "Method \"%s\" in module \"%s\" at address %p",name,module_name,
1282 (void *) module_info->register_module);
1284 Define UnregisterFORMATImage method.
1286 TagToModuleName(module_name,"Unregister%sImage",name);
1287 module_info->unregister_module=(void (*)(void)) lt_dlsym(handle,name);
1288 if (module_info->unregister_module == (void (*)(void)) NULL)
1290 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
1291 "UnableToRegisterImageFormat","'%s': %s",module_name,lt_dlerror());
1292 return(MagickFalse);
1294 (void) LogMagickEvent(ModuleEvent,GetMagickModule(),
1295 "Method \"%s\" in module \"%s\" at address %p",name,module_name,
1296 (void *) module_info->unregister_module);
1297 signature=module_info->register_module();
1298 if (signature != MagickImageCoderSignature)
1300 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
1301 "ImageCoderSignatureMismatch","'%s': %8lx != %8lx",module_name,
1302 (unsigned long) signature,(unsigned long) MagickImageCoderSignature);
1303 return(MagickFalse);
1309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1313 % O p e n M o d u l e s %
1317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1319 % OpenModules() loads all available modules.
1321 % The format of the OpenModules module is:
1323 % MagickBooleanType OpenModules(ExceptionInfo *exception)
1325 % A description of each parameter follows:
1327 % o exception: return any errors or warnings in this structure.
1330 MagickPrivate MagickBooleanType OpenModules(ExceptionInfo *exception)
1344 (void) GetMagickInfo((char *) NULL,exception);
1346 modules=GetModuleList("*",MagickImageCoderModule,&number_modules,exception);
1347 if (modules == (char **) NULL)
1348 return(MagickFalse);
1349 for (i=0; i < (ssize_t) number_modules; i++)
1350 (void) OpenModule(modules[i],exception);
1352 Relinquish resources.
1354 for (i=0; i < (ssize_t) number_modules; i++)
1355 modules[i]=DestroyString(modules[i]);
1356 modules=(char **) RelinquishMagickMemory(modules);
1361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1365 % R e g i s t e r M o d u l e %
1369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1371 % RegisterModule() adds an entry to the module list. It returns a pointer to
1372 % the registered entry on success.
1374 % The format of the RegisterModule module is:
1376 % ModuleInfo *RegisterModule(const ModuleInfo *module_info,
1377 % ExceptionInfo *exception)
1379 % A description of each parameter follows:
1381 % o info: a pointer to the registered entry is returned.
1383 % o module_info: a pointer to the ModuleInfo structure to register.
1385 % o exception: return any errors or warnings in this structure.
1388 static const ModuleInfo *RegisterModule(const ModuleInfo *module_info,
1389 ExceptionInfo *exception)
1394 assert(module_info != (ModuleInfo *) NULL);
1395 assert(module_info->signature == MagickSignature);
1396 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",module_info->tag);
1397 if (module_list == (SplayTreeInfo *) NULL)
1398 return((const ModuleInfo *) NULL);
1399 status=AddValueToSplayTree(module_list,module_info->tag,module_info);
1400 if (status == MagickFalse)
1401 (void) ThrowMagickException(exception,GetMagickModule(),ResourceLimitError,
1402 "MemoryAllocationFailed","`%s'",module_info->tag);
1403 return(module_info);
1407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1411 % T a g T o C o d e r M o d u l e N a m e %
1415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1417 % TagToCoderModuleName() munges a module tag and obtains the filename of the
1418 % corresponding module.
1420 % The format of the TagToCoderModuleName module is:
1422 % char *TagToCoderModuleName(const char *tag,char *name)
1424 % A description of each parameter follows:
1426 % o tag: a character string representing the module tag.
1428 % o name: return the module name here.
1431 static void TagToCoderModuleName(const char *tag,char *name)
1433 assert(tag != (char *) NULL);
1434 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",tag);
1435 assert(name != (char *) NULL);
1436 #if defined(MAGICKCORE_LTDL_DELEGATE)
1437 (void) FormatLocaleString(name,MaxTextExtent,"%s.la",tag);
1438 (void) LocaleLower(name);
1440 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1441 if (LocaleNCompare("IM_MOD_",tag,7) == 0)
1442 (void) CopyMagickString(name,tag,MaxTextExtent);
1446 (void) FormatLocaleString(name,MaxTextExtent,"IM_MOD_DB_%s_.dll",tag);
1448 (void) FormatLocaleString(name,MaxTextExtent,"IM_MOD_RL_%s_.dll",tag);
1456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1460 % T a g T o F i l t e r M o d u l e N a m e %
1464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1466 % TagToFilterModuleName() munges a module tag and returns the filename of the
1467 % corresponding filter module.
1469 % The format of the TagToFilterModuleName module is:
1471 % void TagToFilterModuleName(const char *tag,char name)
1473 % A description of each parameter follows:
1475 % o tag: a character string representing the module tag.
1477 % o name: return the filter name here.
1480 static void TagToFilterModuleName(const char *tag,char *name)
1482 assert(tag != (char *) NULL);
1483 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",tag);
1484 assert(name != (char *) NULL);
1485 #if !defined(MAGICKCORE_LTDL_DELEGATE)
1486 (void) FormatLocaleString(name,MaxTextExtent,"%s.dll",tag);
1488 (void) FormatLocaleString(name,MaxTextExtent,"%s.la",tag);
1493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1497 % T a g T o M o d u l e N a m e %
1501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1503 % TagToModuleName() munges the module tag name and returns an upper-case tag
1504 % name as the input string, and a user-provided format.
1506 % The format of the TagToModuleName module is:
1508 % TagToModuleName(const char *tag,const char *format,char *module)
1510 % A description of each parameter follows:
1512 % o tag: the module tag.
1514 % o format: a sprintf-compatible format string containing %s where the
1515 % upper-case tag name is to be inserted.
1517 % o module: pointer to a destination buffer for the formatted result.
1520 static void TagToModuleName(const char *tag,const char *format,char *module)
1523 name[MaxTextExtent];
1525 assert(tag != (const char *) NULL);
1526 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",tag);
1527 assert(format != (const char *) NULL);
1528 assert(module != (char *) NULL);
1529 (void) CopyMagickString(name,tag,MaxTextExtent);
1531 #if !defined(MAGICKCORE_NAMESPACE_PREFIX)
1532 (void) FormatLocaleString(module,MaxTextExtent,format,name);
1536 prefix_format[MaxTextExtent];
1538 (void) FormatLocaleString(prefix_format,MaxTextExtent,"%s%s",
1539 MAGICKCORE_NAMESPACE_PREFIX,format);
1540 (void) FormatLocaleString(module,MaxTextExtent,prefix_format,name);
1546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1550 % U n r e g i s t e r M o d u l e %
1554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1556 % UnregisterModule() unloads a module, and invokes its de-registration module.
1557 % Returns MagickTrue on success, and MagickFalse if there is an error.
1559 % The format of the UnregisterModule module is:
1561 % MagickBooleanType UnregisterModule(const ModuleInfo *module_info,
1562 % ExceptionInfo *exception)
1564 % A description of each parameter follows:
1566 % o module_info: the module info.
1568 % o exception: return any errors or warnings in this structure.
1571 static MagickBooleanType UnregisterModule(const ModuleInfo *module_info,
1572 ExceptionInfo *exception)
1575 Locate and execute UnregisterFORMATImage module.
1577 assert(module_info != (const ModuleInfo *) NULL);
1578 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",module_info->tag);
1579 assert(exception != (ExceptionInfo *) NULL);
1580 if (module_info->unregister_module == NULL)
1582 module_info->unregister_module();
1583 if (lt_dlclose((ModuleHandle) module_info->handle) != 0)
1585 (void) ThrowMagickException(exception,GetMagickModule(),ModuleWarning,
1586 "UnableToCloseModule","'%s': %s",module_info->tag,lt_dlerror());
1587 return(MagickFalse);
1593 #if !defined(MAGICKCORE_BUILD_MODULES)
1595 analyzeImage(Image **,const int,const char **,ExceptionInfo *);
1598 MagickExport MagickBooleanType ListModuleInfo(FILE *magick_unused(file),
1599 ExceptionInfo *magick_unused(exception))
1604 MagickExport MagickBooleanType InvokeDynamicImageFilter(const char *tag,
1605 Image **image,const int argc,const char **argv,ExceptionInfo *exception)
1610 assert(image != (Image **) NULL);
1611 assert((*image)->signature == MagickSignature);
1612 if ((*image)->debug != MagickFalse)
1613 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",(*image)->filename);
1614 rights=ReadPolicyRights;
1615 if (IsRightsAuthorized(FilterPolicyDomain,rights,tag) == MagickFalse)
1618 (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
1619 "NotAuthorized","`%s'",tag);
1620 return(MagickFalse);
1622 #if defined(MAGICKCORE_BUILD_MODULES)
1632 image_filter=(ImageFilterHandler *) NULL;
1633 if (LocaleCompare("analyze",tag) == 0)
1634 image_filter=(ImageFilterHandler *) analyzeImage;
1635 if (image_filter == (ImageFilterHandler *) NULL)
1636 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
1637 "UnableToLoadModule","`%s'",tag);
1643 if ((*image)->debug != MagickFalse)
1644 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
1645 "Invoking \"%s\" static image filter",tag);
1646 signature=image_filter(image,argc,argv,exception);
1647 if ((*image)->debug != MagickFalse)
1648 (void) LogMagickEvent(CoderEvent,GetMagickModule(),"\"%s\" completes",
1650 if (signature != MagickImageFilterSignature)
1652 (void) ThrowMagickException(exception,GetMagickModule(),ModuleError,
1653 "ImageFilterSignatureMismatch","'%s': %8lx != %8lx",tag,
1654 (unsigned long) signature,(unsigned long)
1655 MagickImageFilterSignature);
1656 return(MagickFalse);