MagickCore  7.0.8
Convert, Edit, Or Compose Bitmap Images
configure.c
Go to the documentation of this file.
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % CCCC OOO N N FFFFF IIIII GGGG U U RRRR EEEEE %
7 % C O O NN N F I G U U R R E %
8 % C O O N N N FFF I G GG U U RRRR EEE %
9 % C O O N NN F I G G U U R R E %
10 % CCCC OOO N N F IIIII GGG UUU R R EEEEE %
11 % %
12 % %
13 % MagickCore Image Configure Methods %
14 % %
15 % Software Design %
16 % Cristy %
17 % July 2003 %
18 % %
19 % %
20 % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
22 % %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
25 % %
26 % https://imagemagick.org/script/license.php %
27 % %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
33 % %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 */
38 
39 /*
40  Include declarations.
41 */
42 #include "MagickCore/studio.h"
43 #include "MagickCore/blob.h"
44 #include "MagickCore/client.h"
45 #include "MagickCore/configure.h"
47 #include "MagickCore/exception.h"
49 #include "MagickCore/linked-list.h"
50 #include "MagickCore/log.h"
51 #include "MagickCore/memory_.h"
53 #include "MagickCore/semaphore.h"
54 #include "MagickCore/string_.h"
56 #include "MagickCore/token.h"
57 #include "MagickCore/utility.h"
59 #include "MagickCore/xml-tree.h"
61 
62 /*
63  Define declarations.
64 */
65 #define ConfigureFilename "configure.xml"
66 
67 #ifdef _OPENMP
68 #define MAGICKCORE_FEATURE_OPENMP_STR "OpenMP "
69 #else
70 #define MAGICKCORE_FEATURE_OPENMP_STR ""
71 #endif
72 #ifdef _OPENCL
73 #define MAGICKCORE_FEATURE_OPENCL_STR "OpenCL "
74 #else
75 #define MAGICKCORE_FEATURE_OPENCL_STR ""
76 #endif
77 #ifdef MAGICKCORE_ZERO_CONFIGURATION_SUPPORT
78 #define MAGICKCORE_FEATURE_ZERO_CONFIGURATION_STR "Zero-Configuration "
79 #else
80 #define MAGICKCORE_FEATURE_ZERO_CONFIGURATION_STR ""
81 #endif
82 #ifdef HDRI_SUPPORT
83 #define MAGICKCORE_FEATURE_HDRI_STR "HDRI"
84 #else
85 #define MAGICKCORE_FEATURE_HDRI_STR ""
86 #endif
87 
88 #define MAGICKCORE_FEATURES_STR MAGICKCORE_FEATURE_OPENMP_STR MAGICKCORE_FEATURE_OPENCL_STR MAGICKCORE_FEATURE_ZERO_CONFIGURATION_STR MAGICKCORE_FEATURE_HDRI_STR
89 
90 /*
91  Typedef declarations.
92 */
93 typedef struct _ConfigureMapInfo
94 {
95  const char
96  *name,
97  *value;
99 
100 /*
101  Static declarations.
102 */
103 static const ConfigureMapInfo
105  {
106  { "NAME", "ImageMagick" },
108  { "FEATURES", MAGICKCORE_FEATURES_STR }
109  };
110 
111 static LinkedListInfo
113 
114 static SemaphoreInfo
116 
117 /*
118  Forward declarations.
119 */
120 static MagickBooleanType
122  LoadConfigureCache(LinkedListInfo *,const char *,const char *,const size_t,
123  ExceptionInfo *);
124 
125 /*
126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127 % %
128 % %
129 % %
130 % A c q u i r e C o n f i g u r e C a c h e %
131 % %
132 % %
133 % %
134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
135 %
136 % AcquireConfigureCache() caches one or more configure configurations which
137 % provides a mapping between configure attributes and a configure name.
138 %
139 % The format of the AcquireConfigureCache method is:
140 %
141 % LinkedListInfo *AcquireConfigureCache(const char *filename,
142 % ExceptionInfo *exception)
143 %
144 % A description of each parameter follows:
145 %
146 % o filename: the font file name.
147 %
148 % o exception: return any errors or warnings in this structure.
149 %
150 */
151 
152 static ConfigureInfo *NewConfigureKey(const char *path,const char *name,
153  const char *value)
154 {
156  *configure_info;
157 
158  configure_info=(ConfigureInfo *) AcquireMagickMemory(sizeof(*configure_info));
159  if (configure_info == (ConfigureInfo *) NULL)
160  return((ConfigureInfo *) NULL);
161  (void) memset(configure_info,0,sizeof(*configure_info));
162  configure_info->path=(char *) path;
163  configure_info->name=(char *) name;
164  configure_info->value=(char *) value;
165  configure_info->exempt=MagickTrue;
166  configure_info->signature=MagickCoreSignature;
167  return(configure_info);
168 }
169 
170 static LinkedListInfo *AcquireConfigureCache(const char *filename,
171  ExceptionInfo *exception)
172 {
173  char
174  head_path[MagickPathExtent],
175  path[MagickPathExtent];
176 
178  *configure_info;
179 
181  *cache;
182 
184  status;
185 
186  register ssize_t
187  i;
188 
189  /*
190  Load external configure map.
191  */
192  cache=NewLinkedList(0);
193  status=MagickTrue;
194 #if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT)
195  {
196  const StringInfo
197  *option;
198 
200  *options;
201 
202  options=GetConfigureOptions(filename,exception);
203  option=(const StringInfo *) GetNextValueInLinkedList(options);
204  while (option != (const StringInfo *) NULL)
205  {
206  status&=LoadConfigureCache(cache,(const char *)
207  GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
208  option=(const StringInfo *) GetNextValueInLinkedList(options);
209  }
210  options=DestroyConfigureOptions(options);
211  }
212 #endif
213  /*
214  Load built-in configure map.
215  */
216  for (i=0; i < (ssize_t) (sizeof(ConfigureMap)/sizeof(*ConfigureMap)); i++)
217  {
218  register const ConfigureMapInfo
219  *p;
220 
221  p=ConfigureMap+i;
222  configure_info=NewConfigureKey("[built-in]",p->name,p->value);
223  if (configure_info == (ConfigureInfo *) NULL)
224  {
225  (void) ThrowMagickException(exception,GetMagickModule(),
226  ResourceLimitError,"MemoryAllocationFailed","`%s'",p->name);
227  continue;
228  }
229  status&=AppendValueToLinkedList(cache,configure_info);
230  if (status == MagickFalse)
231  (void) ThrowMagickException(exception,GetMagickModule(),
232  ResourceLimitError,"MemoryAllocationFailed","`%s'",
233  configure_info->name);
234  }
235  /*
236  Load runtime configuration.
237  */
238  (void) AcquireUniqueFilename(path);
239  GetPathComponent(path,HeadPath,head_path);
240  configure_info=NewConfigureKey("[built-in]","MAGICK_TEMPORARY_PATH",
241  head_path);
242  if (configure_info != (ConfigureInfo *) NULL)
243  status&=AppendValueToLinkedList(cache,configure_info);
244  return(cache);
245 }
246 
247 /*
248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
249 % %
250 % %
251 % %
252 + C o n f i g u r e C o m p o n e n t G e n e s i s %
253 % %
254 % %
255 % %
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257 %
258 % ConfigureComponentGenesis() instantiates the configure component.
259 %
260 % The format of the ConfigureComponentGenesis method is:
261 %
262 % MagickBooleanType ConfigureComponentGenesis(void)
263 %
264 */
266 {
267  if (configure_semaphore == (SemaphoreInfo *) NULL)
269  return(MagickTrue);
270 }
271 
272 /*
273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274 % %
275 % %
276 % %
277 + C o n f i g u r e C o m p o n e n t T e r m i n u s %
278 % %
279 % %
280 % %
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282 %
283 % ConfigureComponentTerminus() destroys the configure component.
284 %
285 % The format of the ConfigureComponentTerminus method is:
286 %
287 % ConfigureComponentTerminus(void)
288 %
289 */
290 
291 static void *DestroyConfigureElement(void *configure_info)
292 {
293  register ConfigureInfo
294  *p;
295 
296  p=(ConfigureInfo *) configure_info;
297  if (p->exempt == MagickFalse)
298  {
299  if (p->value != (char *) NULL)
300  p->value=DestroyString(p->value);
301  if (p->name != (char *) NULL)
302  p->name=DestroyString(p->name);
303  if (p->path != (char *) NULL)
304  p->path=DestroyString(p->path);
305  }
307  return((void *) NULL);
308 }
309 
311 {
312  if (configure_semaphore == (SemaphoreInfo *) NULL)
315  if (configure_cache != (LinkedListInfo *) NULL)
320 }
321 
322 /*
323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
324 % %
325 % %
326 % %
327 % D e s t r o y C o n f i g u r e O p t i o n s %
328 % %
329 % %
330 % %
331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332 %
333 % DestroyConfigureOptions() releases memory associated with an configure
334 % options.
335 %
336 % The format of the DestroyProfiles method is:
337 %
338 % LinkedListInfo *DestroyConfigureOptions(Image *image)
339 %
340 % A description of each parameter follows:
341 %
342 % o image: the image.
343 %
344 */
345 
346 static void *DestroyOptions(void *option)
347 {
348  return(DestroyStringInfo((StringInfo *) option));
349 }
350 
352 {
353  assert(options != (LinkedListInfo *) NULL);
354  return(DestroyLinkedList(options,DestroyOptions));
355 }
356 
357 /*
358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
359 % %
360 % %
361 % %
362 + G e t C o n f i g u r e I n f o %
363 % %
364 % %
365 % %
366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367 %
368 % GetConfigureInfo() searches the configure list for the specified name and if
369 % found returns attributes for that element.
370 %
371 % The format of the GetConfigureInfo method is:
372 %
373 % const ConfigureInfo *GetConfigureInfo(const char *name,
374 % ExceptionInfo *exception)
375 %
376 % A description of each parameter follows:
377 %
378 % o configure_info: GetConfigureInfo() searches the configure list for the
379 % specified name and if found returns attributes for that element.
380 %
381 % o name: the configure name.
382 %
383 % o exception: return any errors or warnings in this structure.
384 %
385 */
387  ExceptionInfo *exception)
388 {
389  register const ConfigureInfo
390  *p;
391 
392  assert(exception != (ExceptionInfo *) NULL);
393  if (IsConfigureCacheInstantiated(exception) == MagickFalse)
394  return((const ConfigureInfo *) NULL);
395  /*
396  Search for configure tag.
397  */
401  if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
402  {
404  return(p);
405  }
406  while (p != (const ConfigureInfo *) NULL)
407  {
408  if (LocaleCompare(name,p->name) == 0)
409  break;
411  }
412  if (p != (ConfigureInfo *) NULL)
416  return(p);
417 }
418 
419 /*
420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
421 % %
422 % %
423 % %
424 % G e t C o n f i g u r e I n f o L i s t %
425 % %
426 % %
427 % %
428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
429 %
430 % GetConfigureInfoList() returns any configure options that match the
431 % specified pattern.
432 %
433 % The format of the GetConfigureInfoList function is:
434 %
435 % const ConfigureInfo **GetConfigureInfoList(const char *pattern,
436 % size_t *number_options,ExceptionInfo *exception)
437 %
438 % A description of each parameter follows:
439 %
440 % o pattern: Specifies a pointer to a text string containing a pattern.
441 %
442 % o number_options: This integer returns the number of configure options in
443 % the list.
444 %
445 % o exception: return any errors or warnings in this structure.
446 %
447 */
448 
449 #if defined(__cplusplus) || defined(c_plusplus)
450 extern "C" {
451 #endif
452 
453 static int ConfigureInfoCompare(const void *x,const void *y)
454 {
455  const ConfigureInfo
456  **p,
457  **q;
458 
459  p=(const ConfigureInfo **) x,
460  q=(const ConfigureInfo **) y;
461  if (LocaleCompare((*p)->path,(*q)->path) == 0)
462  return(LocaleCompare((*p)->name,(*q)->name));
463  return(LocaleCompare((*p)->path,(*q)->path));
464 }
465 
466 #if defined(__cplusplus) || defined(c_plusplus)
467 }
468 #endif
469 
470 MagickExport const ConfigureInfo **GetConfigureInfoList(const char *pattern,
471  size_t *number_options,ExceptionInfo *exception)
472 {
473  const ConfigureInfo
474  **options;
475 
476  register const ConfigureInfo
477  *p;
478 
479  register ssize_t
480  i;
481 
482  /*
483  Allocate configure list.
484  */
485  assert(pattern != (char *) NULL);
486  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
487  assert(number_options != (size_t *) NULL);
488  *number_options=0;
489  p=GetConfigureInfo("*",exception);
490  if (p == (const ConfigureInfo *) NULL)
491  return((const ConfigureInfo **) NULL);
492  options=(const ConfigureInfo **) AcquireQuantumMemory((size_t)
493  GetNumberOfElementsInLinkedList(configure_cache)+1UL,sizeof(*options));
494  if (options == (const ConfigureInfo **) NULL)
495  return((const ConfigureInfo **) NULL);
496  /*
497  Generate configure list.
498  */
502  for (i=0; p != (const ConfigureInfo *) NULL; )
503  {
504  if ((p->stealth == MagickFalse) &&
505  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
506  options[i++]=p;
508  }
510  qsort((void *) options,(size_t) i,sizeof(*options),ConfigureInfoCompare);
511  options[i]=(ConfigureInfo *) NULL;
512  *number_options=(size_t) i;
513  return(options);
514 }
515 
516 /*
517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
518 % %
519 % %
520 % %
521 % G e t C o n f i g u r e L i s t %
522 % %
523 % %
524 % %
525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
526 %
527 % GetConfigureList() returns any configure options that match the specified
528 % pattern.
529 %
530 % The format of the GetConfigureList function is:
531 %
532 % char **GetConfigureList(const char *pattern,
533 % size_t *number_options,ExceptionInfo *exception)
534 %
535 % A description of each parameter follows:
536 %
537 % o pattern: Specifies a pointer to a text string containing a pattern.
538 %
539 % o number_options: This integer returns the number of options in the list.
540 %
541 % o exception: return any errors or warnings in this structure.
542 %
543 */
544 
545 #if defined(__cplusplus) || defined(c_plusplus)
546 extern "C" {
547 #endif
548 
549 static int ConfigureCompare(const void *x,const void *y)
550 {
551  register char
552  **p,
553  **q;
554 
555  p=(char **) x;
556  q=(char **) y;
557  return(LocaleCompare(*p,*q));
558 }
559 
560 #if defined(__cplusplus) || defined(c_plusplus)
561 }
562 #endif
563 
564 MagickExport char **GetConfigureList(const char *pattern,
565  size_t *number_options,ExceptionInfo *exception)
566 {
567  char
568  **options;
569 
570  register const ConfigureInfo
571  *p;
572 
573  register ssize_t
574  i;
575 
576  /*
577  Allocate configure list.
578  */
579  assert(pattern != (char *) NULL);
580  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
581  assert(number_options != (size_t *) NULL);
582  *number_options=0;
583  p=GetConfigureInfo("*",exception);
584  if (p == (const ConfigureInfo *) NULL)
585  return((char **) NULL);
586  options=(char **) AcquireQuantumMemory((size_t)
587  GetNumberOfElementsInLinkedList(configure_cache)+1UL,sizeof(*options));
588  if (options == (char **) NULL)
589  return((char **) NULL);
593  for (i=0; p != (const ConfigureInfo *) NULL; )
594  {
595  if ((p->stealth == MagickFalse) &&
596  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
597  options[i++]=ConstantString(p->name);
599  }
601  qsort((void *) options,(size_t) i,sizeof(*options),ConfigureCompare);
602  options[i]=(char *) NULL;
603  *number_options=(size_t) i;
604  return(options);
605 }
606 
607 /*
608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609 % %
610 % %
611 % %
612 % G e t C o n f i g u r e O p t i o n %
613 % %
614 % %
615 % %
616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
617 %
618 % GetConfigureOption() returns the value associated with the configure option.
619 %
620 % The format of the GetConfigureOption method is:
621 %
622 % char *GetConfigureOption(const char *option)
623 %
624 % A description of each parameter follows:
625 %
626 % o configure_info: The configure info.
627 %
628 */
629 MagickExport char *GetConfigureOption(const char *option)
630 {
631  const char
632  *value;
633 
634  const ConfigureInfo
635  *configure_info;
636 
638  *exception;
639 
640  assert(option != (const char *) NULL);
641  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",option);
642  exception=AcquireExceptionInfo();
643  configure_info=GetConfigureInfo(option,exception);
644  exception=DestroyExceptionInfo(exception);
645  if (configure_info == (ConfigureInfo *) NULL)
646  return((char *) NULL);
647  value=GetConfigureValue(configure_info);
648  if ((value == (const char *) NULL) || (*value == '\0'))
649  return((char *) NULL);
650  return(ConstantString(value));
651 }
652 
653 /*
654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
655 % %
656 % %
657 % %
658 % G e t C o n f i g u r e O p t i o n s %
659 % %
660 % %
661 % %
662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
663 %
664 % GetConfigureOptions() returns any Magick configuration options associated
665 % with the specified filename.
666 %
667 % The format of the GetConfigureOptions method is:
668 %
669 % LinkedListInfo *GetConfigureOptions(const char *filename,
670 % ExceptionInfo *exception)
671 %
672 % A description of each parameter follows:
673 %
674 % o filename: the configure file name.
675 %
676 % o exception: return any errors or warnings in this structure.
677 %
678 */
680  ExceptionInfo *exception)
681 {
682  char
683  path[MagickPathExtent];
684 
685  const char
686  *element;
687 
689  *options,
690  *paths;
691 
692  StringInfo
693  *xml;
694 
695  assert(filename != (const char *) NULL);
696  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
697  assert(exception != (ExceptionInfo *) NULL);
698  (void) CopyMagickString(path,filename,MagickPathExtent);
699  /*
700  Load XML from configuration files to linked-list.
701  */
702  options=NewLinkedList(0);
703  paths=GetConfigurePaths(filename,exception);
704  if (paths != (LinkedListInfo *) NULL)
705  {
707  element=(const char *) GetNextValueInLinkedList(paths);
708  while (element != (const char *) NULL)
709  {
710  (void) FormatLocaleString(path,MagickPathExtent,"%s%s",element,
711  filename);
713  "Searching for configure file: \"%s\"",path);
714  xml=ConfigureFileToStringInfo(path);
715  if (xml != (StringInfo *) NULL)
716  (void) AppendValueToLinkedList(options,xml);
717  element=(const char *) GetNextValueInLinkedList(paths);
718  }
720  }
721 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
722  if (GetNumberOfElementsInLinkedList(options) == 0)
723  {
724  char
725  *blob;
726 
727  blob=(char *) NTResourceToBlob(filename);
728  if (blob != (char *) NULL)
729  {
730  xml=AcquireStringInfo(0);
731  SetStringInfoLength(xml,strlen(blob)+1);
732  SetStringInfoDatum(xml,(unsigned char *) blob);
733  SetStringInfoPath(xml,filename);
734  (void) AppendValueToLinkedList(options,xml);
735  }
736  }
737 #endif
738  if (GetNumberOfElementsInLinkedList(options) == 0)
740  "UnableToOpenConfigureFile","`%s'",filename);
741  ResetLinkedListIterator(options);
742  return(options);
743 }
744 
745 /*
746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
747 % %
748 % %
749 % %
750 % G e t C o n f i g u r e P a t h s %
751 % %
752 % %
753 % %
754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
755 %
756 % GetConfigurePaths() returns any Magick configuration paths associated
757 % with the specified filename.
758 %
759 % The format of the GetConfigurePaths method is:
760 %
761 % LinkedListInfo *GetConfigurePaths(const char *filename,
762 % ExceptionInfo *exception)
763 %
764 % A description of each parameter follows:
765 %
766 % o filename: the configure file name.
767 %
768 % o exception: return any errors or warnings in this structure.
769 %
770 */
772  ExceptionInfo *exception)
773 {
774 #define RegistryKey "ConfigurePath"
775 #define MagickCoreDLL "CORE_RL_MagickCore_.dll"
776 #define MagickCoreDebugDLL "CORE_DB_MagickCore_.dll"
777 
778  char
779  path[MagickPathExtent];
780 
782  *paths;
783 
784  assert(filename != (const char *) NULL);
785  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
786  assert(exception != (ExceptionInfo *) NULL);
787  (void) CopyMagickString(path,filename,MagickPathExtent);
788  paths=NewLinkedList(0);
789  {
790  char
791  *configure_path;
792 
793  /*
794  Search $MAGICK_CONFIGURE_PATH.
795  */
796  configure_path=GetEnvironmentValue("MAGICK_CONFIGURE_PATH");
797  if (configure_path != (char *) NULL)
798  {
799  register char
800  *p,
801  *q;
802 
803  for (p=configure_path-1; p != (char *) NULL; )
804  {
805  (void) CopyMagickString(path,p+1,MagickPathExtent);
806  q=strchr(path,DirectoryListSeparator);
807  if (q != (char *) NULL)
808  *q='\0';
809  q=path+strlen(path)-1;
810  if ((q >= path) && (*q != *DirectorySeparator))
813  (void) AppendValueToLinkedList(paths,ConstantString(path));
814  p=strchr(p+1,DirectoryListSeparator);
815  }
816  configure_path=DestroyString(configure_path);
817  }
818  }
819 #if defined(MAGICKCORE_INSTALLED_SUPPORT)
820 #if defined(MAGICKCORE_SHARE_PATH)
822 #endif
823 #if defined(MAGICKCORE_SHAREARCH_PATH)
825  MAGICKCORE_SHAREARCH_PATH));
826 #endif
827 #if defined(MAGICKCORE_CONFIGURE_PATH)
830 #endif
831 #if defined(MAGICKCORE_DOCUMENTATION_PATH)
834 #endif
835 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_PATH))
836  {
837  unsigned char
838  *key_value;
839 
840  /*
841  Locate file via registry key.
842  */
843  key_value=NTRegistryKeyLookup(RegistryKey);
844  if (key_value != (unsigned char *) NULL)
845  {
846  (void) FormatLocaleString(path,MagickPathExtent,"%s%s",(char *)
847  key_value,DirectorySeparator);
848  (void) AppendValueToLinkedList(paths,ConstantString(path));
849  key_value=(unsigned char *) RelinquishMagickMemory(key_value);
850  }
851  }
852 #endif
853 #else
854  {
855  char
856  *home;
857 
858  /*
859  Search under MAGICK_HOME.
860  */
861  home=GetEnvironmentValue("MAGICK_HOME");
862  if (home != (char *) NULL)
863  {
864 #if !defined(MAGICKCORE_POSIX_SUPPORT) || defined( __VMS )
865  (void) FormatLocaleString(path,MagickPathExtent,"%s%s",home,
867  (void) AppendValueToLinkedList(paths,ConstantString(path));
868 #else
869  (void) FormatLocaleString(path,MagickPathExtent,"%s/etc/%s/",home,
871  (void) AppendValueToLinkedList(paths,ConstantString(path));
872  (void) FormatLocaleString(path,MagickPathExtent,"%s/share/%s/",home,
874  (void) AppendValueToLinkedList(paths,ConstantString(path));
875  (void) FormatLocaleString(path,MagickPathExtent,"%s",
876  MAGICKCORE_SHAREARCH_PATH);
877  (void) AppendValueToLinkedList(paths,ConstantString(path));
878 #endif
879  home=DestroyString(home);
880  }
881  }
882  if (*GetClientPath() != '\0')
883  {
884 #if !defined(MAGICKCORE_POSIX_SUPPORT) || defined( __VMS )
887  (void) AppendValueToLinkedList(paths,ConstantString(path));
888 #else
889  char
890  prefix[MagickPathExtent];
891 
892  /*
893  Search based on executable directory if directory is known.
894  */
896  ChopPathComponents(prefix,1);
897  (void) FormatLocaleString(path,MagickPathExtent,"%s/etc/%s/",prefix,
899  (void) AppendValueToLinkedList(paths,ConstantString(path));
900  (void) FormatLocaleString(path,MagickPathExtent,"%s/share/%s/",prefix,
902  (void) AppendValueToLinkedList(paths,ConstantString(path));
903  (void) FormatLocaleString(path,MagickPathExtent,"%s",
904  MAGICKCORE_SHAREARCH_PATH);
905  (void) AppendValueToLinkedList(paths,ConstantString(path));
906 #endif
907  }
908  /*
909  Search current directory.
910  */
911  (void) AppendValueToLinkedList(paths,ConstantString(""));
912 #endif
913  {
914  char
915  *home;
916 
917  home=GetEnvironmentValue("XDG_CONFIG_HOME");
918  if (home == (char *) NULL)
919  home=GetEnvironmentValue("LOCALAPPDATA");
920  if (home == (char *) NULL)
921  home=GetEnvironmentValue("APPDATA");
922  if (home == (char *) NULL)
923  home=GetEnvironmentValue("USERPROFILE");
924  if (home != (char *) NULL)
925  {
926  /*
927  Search $XDG_CONFIG_HOME/ImageMagick.
928  */
929  (void) FormatLocaleString(path,MagickPathExtent,"%s%sImageMagick%s",
931  (void) AppendValueToLinkedList(paths,ConstantString(path));
932  home=DestroyString(home);
933  }
934  home=GetEnvironmentValue("HOME");
935  if (home != (char *) NULL)
936  {
937  /*
938  Search $HOME/.config/ImageMagick.
939  */
941  "%s%s.config%sImageMagick%s",home,DirectorySeparator,
943  (void) AppendValueToLinkedList(paths,ConstantString(path));
944  home=DestroyString(home);
945  }
946  }
947 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
948  {
949  char
950  module_path[MagickPathExtent];
951 
952  if ((NTGetModulePath(MagickCoreDLL,module_path) != MagickFalse) ||
953  (NTGetModulePath(MagickCoreDebugDLL,module_path) != MagickFalse))
954  {
955  unsigned char
956  *key_value;
957 
958  /*
959  Search module path.
960  */
961  (void) FormatLocaleString(path,MagickPathExtent,"%s%s",module_path,
963  key_value=NTRegistryKeyLookup(RegistryKey);
964  if (key_value == (unsigned char *) NULL)
965  (void) AppendValueToLinkedList(paths,ConstantString(path));
966  else
967  key_value=(unsigned char *) RelinquishMagickMemory(key_value);
968  }
969  if (NTGetModulePath("Magick.dll",module_path) != MagickFalse)
970  {
971  /*
972  Search PerlMagick module path.
973  */
974  (void) FormatLocaleString(path,MagickPathExtent,"%s%s",module_path,
976  (void) AppendValueToLinkedList(paths,ConstantString(path));
977  (void) FormatLocaleString(path,MagickPathExtent,"%s%s",module_path,
978  "\\inc\\lib\\auto\\Image\\Magick\\");
979  (void) AppendValueToLinkedList(paths,ConstantString(path));
980  }
981  }
982 #endif
983  if (GetNumberOfElementsInLinkedList(paths) == 0)
985  "no configuration paths found","`%s'",filename);
986  return(paths);
987 }
988 
989 /*
990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991 % %
992 % %
993 % %
994 % G e t C o n f i g u r e V a l u e %
995 % %
996 % %
997 % %
998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
999 %
1000 % GetConfigureValue() returns the value associated with the configure info.
1001 %
1002 % The format of the GetConfigureValue method is:
1003 %
1004 % const char *GetConfigureValue(const ConfigureInfo *configure_info)
1005 %
1006 % A description of each parameter follows:
1007 %
1008 % o configure_info: The configure info.
1009 %
1010 */
1011 MagickExport const char *GetConfigureValue(const ConfigureInfo *configure_info)
1012 {
1013  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
1014  assert(configure_info != (ConfigureInfo *) NULL);
1015  assert(configure_info->signature == MagickCoreSignature);
1016  return(configure_info->value);
1017 }
1018 
1019 /*
1020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1021 % %
1022 % %
1023 % %
1024 + I s C o n f i g u r e C a c h e I n s t a n t i a t e d %
1025 % %
1026 % %
1027 % %
1028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1029 %
1030 % IsConfigureCacheInstantiated() determines if the configure list is
1031 % instantiated. If not, it instantiates the list and returns it.
1032 %
1033 % The format of the IsConfigureInstantiated method is:
1034 %
1035 % MagickBooleanType IsConfigureCacheInstantiated(ExceptionInfo *exception)
1036 %
1037 % A description of each parameter follows.
1038 %
1039 % o exception: return any errors or warnings in this structure.
1040 %
1041 */
1043 {
1044  if (configure_cache == (LinkedListInfo *) NULL)
1045  {
1046  if (configure_semaphore == (SemaphoreInfo *) NULL)
1049  if (configure_cache == (LinkedListInfo *) NULL)
1052  }
1053  return(configure_cache != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
1054 }
1055 
1056 /*
1057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1058 % %
1059 % %
1060 % %
1061 % L i s t C o n f i g u r e I n f o %
1062 % %
1063 % %
1064 % %
1065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1066 %
1067 % ListConfigureInfo() lists the configure info to a file.
1068 %
1069 % The format of the ListConfigureInfo method is:
1070 %
1071 % MagickBooleanType ListConfigureInfo(FILE *file,ExceptionInfo *exception)
1072 %
1073 % A description of each parameter follows.
1074 %
1075 % o file: An pointer to a FILE.
1076 %
1077 % o exception: return any errors or warnings in this structure.
1078 %
1079 */
1081  ExceptionInfo *exception)
1082 {
1083  const char
1084  *name,
1085  *path,
1086  *value;
1087 
1088  const ConfigureInfo
1089  **configure_info;
1090 
1091  register ssize_t
1092  i;
1093 
1094  size_t
1095  number_options;
1096 
1097  ssize_t
1098  j;
1099 
1100  if (file == (const FILE *) NULL)
1101  file=stdout;
1102  configure_info=GetConfigureInfoList("*",&number_options,exception);
1103  if (configure_info == (const ConfigureInfo **) NULL)
1104  return(MagickFalse);
1105  path=(const char *) NULL;
1106  for (i=0; i < (ssize_t) number_options; i++)
1107  {
1108  if (configure_info[i]->stealth != MagickFalse)
1109  continue;
1110  if ((path == (const char *) NULL) ||
1111  (LocaleCompare(path,configure_info[i]->path) != 0))
1112  {
1113  if (configure_info[i]->path != (char *) NULL)
1114  (void) FormatLocaleFile(file,"\nPath: %s\n\n",
1115  configure_info[i]->path);
1116  (void) FormatLocaleFile(file,"Name Value\n");
1117  (void) FormatLocaleFile(file,
1118  "-------------------------------------------------"
1119  "------------------------------\n");
1120  }
1121  path=configure_info[i]->path;
1122  name="unknown";
1123  if (configure_info[i]->name != (char *) NULL)
1124  name=configure_info[i]->name;
1125  (void) FormatLocaleFile(file,"%s",name);
1126  for (j=(ssize_t) strlen(name); j <= 20; j++)
1127  (void) FormatLocaleFile(file," ");
1128  (void) FormatLocaleFile(file," ");
1129  value="unknown";
1130  if (configure_info[i]->value != (char *) NULL)
1131  value=configure_info[i]->value;
1132  (void) FormatLocaleFile(file,"%s",value);
1133  (void) FormatLocaleFile(file,"\n");
1134  }
1135  (void) fflush(file);
1136  configure_info=(const ConfigureInfo **) RelinquishMagickMemory((void *)
1137  configure_info);
1138  return(MagickTrue);
1139 }
1140 
1141 /*
1142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1143 % %
1144 % %
1145 % %
1146 + L o a d C o n f i g u r e C a c h e %
1147 % %
1148 % %
1149 % %
1150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1151 %
1152 % LoadConfigureCache() loads the configure configurations which provides a
1153 % mapping between configure attributes and a configure name.
1154 %
1155 % The format of the LoadConfigureCache method is:
1156 %
1157 % MagickBooleanType LoadConfigureCache(LinkedListInfo *cache,
1158 % const char *xml,const char *filename,const size_t depth,
1159 % ExceptionInfo *exception)
1160 %
1161 % A description of each parameter follows:
1162 %
1163 % o xml: The configure list in XML format.
1164 %
1165 % o filename: The configure list filename.
1166 %
1167 % o depth: depth of <include /> statements.
1168 %
1169 % o exception: return any errors or warnings in this structure.
1170 %
1171 */
1173  const char *xml,const char *filename,const size_t depth,
1174  ExceptionInfo *exception)
1175 {
1176  char
1177  keyword[MagickPathExtent],
1178  *token;
1179 
1181  *configure_info;
1182 
1183  const char
1184  *q;
1185 
1187  status;
1188 
1189  size_t
1190  extent;
1191 
1192  /*
1193  Load the configure map file.
1194  */
1196  "Loading configure file \"%s\" ...",filename);
1197  status=MagickTrue;
1198  configure_info=(ConfigureInfo *) NULL;
1199  token=AcquireString(xml);
1200  extent=strlen(token)+MagickPathExtent;
1201  for (q=(char *) xml; *q != '\0'; )
1202  {
1203  /*
1204  Interpret XML.
1205  */
1206  GetNextToken(q,&q,extent,token);
1207  if (*token == '\0')
1208  break;
1209  (void) CopyMagickString(keyword,token,MagickPathExtent);
1210  if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)
1211  {
1212  /*
1213  Doctype element.
1214  */
1215  while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
1216  GetNextToken(q,&q,extent,token);
1217  continue;
1218  }
1219  if (LocaleNCompare(keyword,"<!--",4) == 0)
1220  {
1221  /*
1222  Comment element.
1223  */
1224  while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
1225  GetNextToken(q,&q,extent,token);
1226  continue;
1227  }
1228  if (LocaleCompare(keyword,"<include") == 0)
1229  {
1230  /*
1231  Include element.
1232  */
1233  while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
1234  {
1235  (void) CopyMagickString(keyword,token,MagickPathExtent);
1236  GetNextToken(q,&q,extent,token);
1237  if (*token != '=')
1238  continue;
1239  GetNextToken(q,&q,extent,token);
1240  if (LocaleCompare(keyword,"file") == 0)
1241  {
1242  if (depth > MagickMaxRecursionDepth)
1243  (void) ThrowMagickException(exception,GetMagickModule(),
1244  ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);
1245  else
1246  {
1247  char
1248  path[MagickPathExtent],
1249  *file_xml;
1250 
1251  GetPathComponent(filename,HeadPath,path);
1252  if (*path != '\0')
1255  if (*token == *DirectorySeparator)
1256  (void) CopyMagickString(path,token,MagickPathExtent);
1257  else
1258  (void) ConcatenateMagickString(path,token,MagickPathExtent);
1259  file_xml=FileToXML(path,~0UL);
1260  if (file_xml != (char *) NULL)
1261  {
1262  status&=LoadConfigureCache(cache,file_xml,path,depth+1,
1263  exception);
1264  file_xml=DestroyString(file_xml);
1265  }
1266  }
1267  }
1268  }
1269  continue;
1270  }
1271  if (LocaleCompare(keyword,"<configure") == 0)
1272  {
1273  /*
1274  Configure element.
1275  */
1276  configure_info=(ConfigureInfo *) AcquireCriticalMemory(
1277  sizeof(*configure_info));
1278  (void) memset(configure_info,0,sizeof(*configure_info));
1279  configure_info->path=ConstantString(filename);
1280  configure_info->exempt=MagickFalse;
1281  configure_info->signature=MagickCoreSignature;
1282  continue;
1283  }
1284  if (configure_info == (ConfigureInfo *) NULL)
1285  continue;
1286  if ((LocaleCompare(keyword,"/>") == 0) ||
1287  (LocaleCompare(keyword,"</policy>") == 0))
1288  {
1289  status=AppendValueToLinkedList(cache,configure_info);
1290  if (status == MagickFalse)
1291  (void) ThrowMagickException(exception,GetMagickModule(),
1292  ResourceLimitError,"MemoryAllocationFailed","`%s'",
1293  configure_info->name);
1294  configure_info=(ConfigureInfo *) NULL;
1295  continue;
1296  }
1297  /*
1298  Parse configure element.
1299  */
1300  GetNextToken(q,(const char **) NULL,extent,token);
1301  if (*token != '=')
1302  continue;
1303  GetNextToken(q,&q,extent,token);
1304  GetNextToken(q,&q,extent,token);
1305  switch (*keyword)
1306  {
1307  case 'N':
1308  case 'n':
1309  {
1310  if (LocaleCompare((char *) keyword,"name") == 0)
1311  {
1312  configure_info->name=ConstantString(token);
1313  break;
1314  }
1315  break;
1316  }
1317  case 'S':
1318  case 's':
1319  {
1320  if (LocaleCompare((char *) keyword,"stealth") == 0)
1321  {
1322  configure_info->stealth=IsStringTrue(token);
1323  break;
1324  }
1325  break;
1326  }
1327  case 'V':
1328  case 'v':
1329  {
1330  if (LocaleCompare((char *) keyword,"value") == 0)
1331  {
1332  configure_info->value=ConstantString(token);
1333  break;
1334  }
1335  break;
1336  }
1337  default:
1338  break;
1339  }
1340  }
1341  token=(char *) RelinquishMagickMemory(token);
1342  return(status != 0 ? MagickTrue : MagickFalse);
1343 }
char * name
Definition: configure.h:30
#define MAGICKCORE_STRING_XQUOTE(str)
#define MagickMaxRecursionDepth
Definition: studio.h:344
#define MAGICKCORE_CONFIGURE_PATH
MagickExport char * GetConfigureOption(const char *option)
Definition: configure.c:629
MagickExport void SetStringInfoPath(StringInfo *string_info, const char *path)
Definition: string.c:1901
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:450
#define MAGICKCORE_CONFIGURE_RELATIVE_PATH
MagickExport void ResetLinkedListIterator(LinkedListInfo *list_info)
Definition: linked-list.c:959
static MagickBooleanType IsConfigureCacheInstantiated(ExceptionInfo *)
Definition: configure.c:1042
char * value
Definition: configure.h:30
MagickExport LinkedListInfo * DestroyLinkedList(LinkedListInfo *list_info, void *(*relinquish_value)(void *))
Definition: linked-list.c:219
static int ConfigureCompare(const void *x, const void *y)
Definition: configure.c:549
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 InsertValueInLinkedList(LinkedListInfo *list_info, const size_t index, const void *value)
Definition: linked-list.c:447
MagickPrivate void ConfigureComponentTerminus(void)
Definition: configure.c:310
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:108
MagickExport MagickBooleanType AppendValueToLinkedList(LinkedListInfo *list_info, const void *value)
Definition: linked-list.c:111
MagickExport ssize_t FormatLocaleString(char *magick_restrict string, const size_t length, const char *magick_restrict format,...)
Definition: locale.c:504
static void * AcquireCriticalMemory(const size_t size)
MagickExport void * RemoveElementByValueFromLinkedList(LinkedListInfo *list_info, const void *value)
Definition: linked-list.c:756
static LinkedListInfo * configure_cache
Definition: configure.c:112
#define MAGICKCORE_QUANTUM_DEPTH
Definition: magick-type.h:28
#define RegistryKey
MagickExport const ConfigureInfo * GetConfigureInfo(const char *name, ExceptionInfo *exception)
Definition: configure.c:386
static void * DestroyConfigureElement(void *configure_info)
Definition: configure.c:291
MagickExport MagickBooleanType AcquireUniqueFilename(char *path)
Definition: utility.c:111
Definition: log.h:52
MagickExport void * GetNextValueInLinkedList(LinkedListInfo *list_info)
Definition: linked-list.c:305
MagickExport MagickBooleanType ListConfigureInfo(FILE *file, ExceptionInfo *exception)
Definition: configure.c:1080
#define MAGICKCORE_SHARE_PATH
#define MagickCoreSignature
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
#define MAGICKCORE_SHARE_RELATIVE_PATH
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1295
const char * value
Definition: configure.c:96
MagickExport LinkedListInfo * GetConfigureOptions(const char *filename, ExceptionInfo *exception)
Definition: configure.c:679
static const ConfigureMapInfo ConfigureMap[]
Definition: configure.c:104
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:409
MagickBooleanType
Definition: magick-type.h:158
#define DirectorySeparator
Definition: studio.h:259
unsigned int MagickStatusType
Definition: magick-type.h:121
MagickExport char * AcquireString(const char *source)
Definition: string.c:129
MagickExport StringInfo * DestroyStringInfo(StringInfo *string_info)
Definition: string.c:850
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
Definition: memory.c:533
MagickExport int LocaleNCompare(const char *p, const char *q, const size_t length)
Definition: locale.c:1542
struct _ConfigureMapInfo ConfigureMapInfo
#define MagickCoreDebugDLL
MagickExport MagickBooleanType GlobExpression(const char *expression, const char *pattern, const MagickBooleanType case_insensitive)
Definition: token.c:347
#define MagickPathExtent
MagickExport MagickBooleanType IsStringTrue(const char *value)
Definition: string.c:1505
char * path
Definition: configure.h:30
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
Definition: exception.c:1064
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1398
MagickExport char * GetEnvironmentValue(const char *name)
Definition: string.c:1262
MagickExport StringInfo * ConfigureFileToStringInfo(const char *filename)
Definition: string.c:592
MagickExport LinkedListInfo * NewLinkedList(const size_t capacity)
Definition: linked-list.c:713
MagickExport size_t CopyMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:755
MagickExport StringInfo * AcquireStringInfo(const size_t length)
Definition: string.c:187
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: locale.c:1440
#define GetMagickModule()
Definition: log.h:28
MagickExport LinkedListInfo * GetConfigurePaths(const char *filename, ExceptionInfo *exception)
Definition: configure.c:771
MagickExport const char * GetStringInfoPath(const StringInfo *string_info)
Definition: string.c:1382
#define ConfigureFilename
Definition: configure.c:65
MagickExport void GetNextToken(const char *start, const char **end, const size_t extent, char *token)
Definition: token.c:172
MagickExport const char * GetConfigureValue(const ConfigureInfo *configure_info)
Definition: configure.c:1011
size_t signature
Definition: configure.h:39
MagickBooleanType exempt
Definition: configure.h:35
MagickBooleanType stealth
Definition: configure.h:35
static MagickBooleanType LoadConfigureCache(LinkedListInfo *, const char *, const char *, const size_t, ExceptionInfo *)
Definition: configure.c:1172
MagickExport void SetStringInfoLength(StringInfo *string_info, const size_t length)
Definition: string.c:1825
#define MagickCoreDLL
MagickExport char * DestroyString(char *string)
Definition: string.c:823
MagickExport void * AcquireMagickMemory(const size_t size)
Definition: memory.c:462
MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:97
MagickExport size_t GetNumberOfElementsInLinkedList(const LinkedListInfo *list_info)
Definition: linked-list.c:348
static LinkedListInfo * AcquireConfigureCache(const char *filename, ExceptionInfo *exception)
Definition: configure.c:170
const char * name
Definition: configure.c:96
static void * DestroyOptions(void *option)
Definition: configure.c:346
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:1054
MagickPrivate void ChopPathComponents(char *, const size_t)
#define MAGICKCORE_DOCUMENTATION_PATH
MagickExport char ** GetConfigureList(const char *pattern, size_t *number_options, ExceptionInfo *exception)
Definition: configure.c:564
#define MagickPrivate
static SemaphoreInfo * configure_semaphore
Definition: configure.c:115
MagickPrivate char * FileToXML(const char *, const size_t)
Definition: xml-tree.c:599
#define MagickExport
MagickPrivate MagickBooleanType ConfigureComponentGenesis(void)
Definition: configure.c:265
#define MAGICKCORE_FEATURES_STR
Definition: configure.c:88
MagickExport const ConfigureInfo ** GetConfigureInfoList(const char *pattern, size_t *number_options, ExceptionInfo *exception)
Definition: configure.c:470
static ConfigureInfo * NewConfigureKey(const char *path, const char *name, const char *value)
Definition: configure.c:152
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:351
MagickExport LinkedListInfo * DestroyConfigureOptions(LinkedListInfo *options)
Definition: configure.c:351
static int ConfigureInfoCompare(const void *x, const void *y)
Definition: configure.c:453
MagickExport char * ConstantString(const char *source)
Definition: string.c:700
#define DirectoryListSeparator
Definition: studio.h:260
MagickExport void SetStringInfoDatum(StringInfo *string_info, const unsigned char *source)
Definition: string.c:1792
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:411
MagickExport const char * GetClientPath(void)
Definition: client.c:87