configure.c

Go to the documentation of this file.
00001 /*
00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00003 %                                                                             %
00004 %                                                                             %
00005 %                                                                             %
00006 %          CCCC   OOO   N   N  FFFFF  IIIII   GGGG  U   U  RRRR   EEEEE       %
00007 %         C      O   O  NN  N  F        I    G      U   U  R   R  E           %
00008 %         C      O   O  N N N  FFF      I    G GG   U   U  RRRR   EEE         %
00009 %         C      O   O  N  NN  F        I    G   G  U   U  R R    E           %
00010 %          CCCC   OOO   N   N  F      IIIII   GGG    UUU   R  R   EEEEE       %
00011 %                                                                             %
00012 %                                                                             %
00013 %                      MagickCore Image Configure Methods                     %
00014 %                                                                             %
00015 %                              Software Design                                %
00016 %                                John Cristy                                  %
00017 %                                 July 2003                                   %
00018 %                                                                             %
00019 %                                                                             %
00020 %  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
00021 %  dedicated to making software imaging solutions freely available.           %
00022 %                                                                             %
00023 %  You may not use this file except in compliance with the License.  You may  %
00024 %  obtain a copy of the License at                                            %
00025 %                                                                             %
00026 %    http://www.imagemagick.org/script/license.php                            %
00027 %                                                                             %
00028 %  Unless required by applicable law or agreed to in writing, software        %
00029 %  distributed under the License is distributed on an "AS IS" BASIS,          %
00030 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
00031 %  See the License for the specific language governing permissions and        %
00032 %  limitations under the License.                                             %
00033 %                                                                             %
00034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00035 %
00036 %
00037 */
00038 
00039 /*
00040   Include declarations.
00041 */
00042 #include "magick/studio.h"
00043 #include "magick/blob.h"
00044 #include "magick/client.h"
00045 #include "magick/configure.h"
00046 #include "magick/exception.h"
00047 #include "magick/exception-private.h"
00048 #include "magick/hashmap.h"
00049 #include "magick/log.h"
00050 #include "magick/memory_.h"
00051 #include "magick/semaphore.h"
00052 #include "magick/string_.h"
00053 #include "magick/token.h"
00054 #include "magick/utility.h"
00055 #include "magick/xml-tree.h"
00056 
00057 /*
00058   Define declarations.
00059 */
00060 #define ConfigureFilename  "configure.xml"
00061 
00062 /*
00063   Typedef declarations.
00064 */
00065 typedef struct _ConfigureMapInfo
00066 {
00067   const char
00068     *name,
00069     *value;
00070 } ConfigureMapInfo;
00071 
00072 /*
00073   Static declarations.
00074 */
00075 static const ConfigureMapInfo
00076   ConfigureMap[] =
00077   {
00078     { "NAME", "ImageMagick" }
00079   };
00080 
00081 static LinkedListInfo
00082   *configure_list = (LinkedListInfo *) NULL;
00083 
00084 static SemaphoreInfo
00085   *configure_semaphore = (SemaphoreInfo *) NULL;
00086 
00087 static volatile MagickBooleanType
00088   instantiate_configure = MagickFalse;
00089 
00090 /*
00091   Forward declarations.
00092 */
00093 static MagickBooleanType
00094   InitializeConfigureList(ExceptionInfo *),
00095   LoadConfigureLists(const char *,ExceptionInfo *);
00096 
00097 /*
00098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00099 %                                                                             %
00100 %                                                                             %
00101 %                                                                             %
00102 +   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                         %
00103 %                                                                             %
00104 %                                                                             %
00105 %                                                                             %
00106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00107 %
00108 %  ConfigureComponentGenesis() instantiates the configure component.
00109 %
00110 %  The format of the ConfigureComponentGenesis method is:
00111 %
00112 %      MagickBooleanType ConfigureComponentGenesis(void)
00113 %
00114 */
00115 MagickExport MagickBooleanType ConfigureComponentGenesis(void)
00116 {
00117   AcquireSemaphoreInfo(&configure_semaphore);
00118   return(MagickTrue);
00119 }
00120 
00121 /*
00122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00123 %                                                                             %
00124 %                                                                             %
00125 %                                                                             %
00126 +   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                       %
00127 %                                                                             %
00128 %                                                                             %
00129 %                                                                             %
00130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00131 %
00132 %  ConfigureComponentTerminus() destroys the configure component.
00133 %
00134 %  The format of the ConfigureComponentTerminus method is:
00135 %
00136 %      ConfigureComponentTerminus(void)
00137 %
00138 */
00139 
00140 static void *DestroyConfigureElement(void *configure_info)
00141 {
00142   register ConfigureInfo
00143     *p;
00144 
00145   p=(ConfigureInfo *) configure_info;
00146   if (p->exempt == MagickFalse)
00147     {
00148       if (p->value != (char *) NULL)
00149         p->value=DestroyString(p->value);
00150       if (p->name != (char *) NULL)
00151         p->name=DestroyString(p->name);
00152       if (p->path != (char *) NULL)
00153         p->path=DestroyString(p->path);
00154     }
00155   p=(ConfigureInfo *) RelinquishMagickMemory(p);
00156   return((void *) NULL);
00157 }
00158 
00159 MagickExport void ConfigureComponentTerminus(void)
00160 {
00161   if (configure_semaphore == (SemaphoreInfo *) NULL)
00162     AcquireSemaphoreInfo(&configure_semaphore);
00163   (void) LockSemaphoreInfo(configure_semaphore);
00164   if (configure_list != (LinkedListInfo *) NULL)
00165     configure_list=DestroyLinkedList(configure_list,DestroyConfigureElement);
00166   configure_list=(LinkedListInfo *) NULL;
00167   instantiate_configure=MagickFalse;
00168   (void) UnlockSemaphoreInfo(configure_semaphore);
00169   DestroySemaphoreInfo(&configure_semaphore);
00170 }
00171 
00172 /*
00173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00174 %                                                                             %
00175 %                                                                             %
00176 %                                                                             %
00177 %   D e s t r o y C o n f i g u r e O p t i o n s                             %
00178 %                                                                             %
00179 %                                                                             %
00180 %                                                                             %
00181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00182 %
00183 %  DestroyConfigureOptions() releases memory associated with an configure
00184 %  options.
00185 %
00186 %  The format of the DestroyProfiles method is:
00187 %
00188 %      LinkedListInfo *DestroyConfigureOptions(Image *image)
00189 %
00190 %  A description of each parameter follows:
00191 %
00192 %    o image: the image.
00193 %
00194 */
00195 
00196 static void *DestroyOptions(void *option)
00197 {
00198   return(DestroyStringInfo((StringInfo *) option));
00199 }
00200 
00201 MagickExport LinkedListInfo *DestroyConfigureOptions(LinkedListInfo *options)
00202 {
00203   assert(options != (LinkedListInfo *) NULL);
00204   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
00205   return(DestroyLinkedList(options,DestroyOptions));
00206 }
00207 
00208 /*
00209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00210 %                                                                             %
00211 %                                                                             %
00212 %                                                                             %
00213 +   G e t C o n f i g u r e I n f o                                           %
00214 %                                                                             %
00215 %                                                                             %
00216 %                                                                             %
00217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00218 %
00219 %  GetConfigureInfo() searches the configure list for the specified name and if
00220 %  found returns attributes for that element.
00221 %
00222 %  The format of the GetConfigureInfo method is:
00223 %
00224 %      const ConfigureInfo *GetConfigureInfo(const char *name,
00225 %        ExceptionInfo *exception)
00226 %
00227 %  A description of each parameter follows:
00228 %
00229 %    o configure_info: GetConfigureInfo() searches the configure list for the
00230 %      specified name and if found returns attributes for that element.
00231 %
00232 %    o name: the configure name.
00233 %
00234 %    o exception: return any errors or warnings in this structure.
00235 %
00236 */
00237 MagickExport const ConfigureInfo *GetConfigureInfo(const char *name,
00238   ExceptionInfo *exception)
00239 {
00240   register const ConfigureInfo
00241     *p;
00242 
00243   assert(exception != (ExceptionInfo *) NULL);
00244   if ((configure_list == (LinkedListInfo *) NULL) ||
00245       (instantiate_configure == MagickFalse))
00246     if (InitializeConfigureList(exception) == MagickFalse)
00247       return((const ConfigureInfo *) NULL);
00248   if ((configure_list == (LinkedListInfo *) NULL) ||
00249       (IsLinkedListEmpty(configure_list) != MagickFalse))
00250     return((const ConfigureInfo *) NULL);
00251   if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
00252     return((const ConfigureInfo *) GetValueFromLinkedList(configure_list,0));
00253   /*
00254     Search for configure tag.
00255   */
00256   (void) LockSemaphoreInfo(configure_semaphore);
00257   ResetLinkedListIterator(configure_list);
00258   p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list);
00259   while (p != (const ConfigureInfo *) NULL)
00260   {
00261     if (LocaleCompare(name,p->name) == 0)
00262       break;
00263     p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list);
00264   }
00265   if (p != (ConfigureInfo *) NULL)
00266     (void) InsertValueInLinkedList(configure_list,0,
00267       RemoveElementByValueFromLinkedList(configure_list,p));
00268   (void) UnlockSemaphoreInfo(configure_semaphore);
00269   return(p);
00270 }
00271 
00272 /*
00273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00274 %                                                                             %
00275 %                                                                             %
00276 %                                                                             %
00277 %   G e t C o n f i g u r e I n f o L i s t                                   %
00278 %                                                                             %
00279 %                                                                             %
00280 %                                                                             %
00281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00282 %
00283 %  GetConfigureInfoList() returns any configure options that match the
00284 %  specified pattern.
00285 %
00286 %  The format of the GetConfigureInfoList function is:
00287 %
00288 %      const ConfigureInfo **GetConfigureInfoList(const char *pattern,
00289 %        unsigned long *number_options,ExceptionInfo *exception)
00290 %
00291 %  A description of each parameter follows:
00292 %
00293 %    o pattern: Specifies a pointer to a text string containing a pattern.
00294 %
00295 %    o number_options:  This integer returns the number of configure options in
00296 %    the list.
00297 %
00298 %    o exception: return any errors or warnings in this structure.
00299 %
00300 */
00301 
00302 #if defined(__cplusplus) || defined(c_plusplus)
00303 extern "C" {
00304 #endif
00305 
00306 static int ConfigureInfoCompare(const void *x,const void *y)
00307 {
00308   const ConfigureInfo
00309     **p,
00310     **q;
00311 
00312   p=(const ConfigureInfo **) x,
00313   q=(const ConfigureInfo **) y;
00314   if (LocaleCompare((*p)->path,(*q)->path) == 0)
00315     return(LocaleCompare((*p)->name,(*q)->name));
00316   return(LocaleCompare((*p)->path,(*q)->path));
00317 }
00318 
00319 #if defined(__cplusplus) || defined(c_plusplus)
00320 }
00321 #endif
00322 
00323 MagickExport const ConfigureInfo **GetConfigureInfoList(const char *pattern,
00324   unsigned long *number_options,ExceptionInfo *exception)
00325 {
00326   const ConfigureInfo
00327     **options;
00328 
00329   register const ConfigureInfo
00330     *p;
00331 
00332   register long
00333     i;
00334 
00335   /*
00336     Allocate configure list.
00337   */
00338   assert(pattern != (char *) NULL);
00339   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
00340   assert(number_options != (unsigned long *) NULL);
00341   *number_options=0;
00342   p=GetConfigureInfo("*",exception);
00343   if (p == (const ConfigureInfo *) NULL)
00344     return((const ConfigureInfo **) NULL);
00345   options=(const ConfigureInfo **) AcquireQuantumMemory((size_t)
00346     GetNumberOfElementsInLinkedList(configure_list)+1UL,sizeof(*options));
00347   if (options == (const ConfigureInfo **) NULL)
00348     return((const ConfigureInfo **) NULL);
00349   /*
00350     Generate configure list.
00351   */
00352   (void) LockSemaphoreInfo(configure_semaphore);
00353   ResetLinkedListIterator(configure_list);
00354   p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list);
00355   for (i=0; p != (const ConfigureInfo *) NULL; )
00356   {
00357     if ((p->stealth == MagickFalse) &&
00358         (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
00359       options[i++]=p;
00360     p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list);
00361   }
00362   (void) UnlockSemaphoreInfo(configure_semaphore);
00363   qsort((void *) options,(size_t) i,sizeof(*options),ConfigureInfoCompare);
00364   options[i]=(ConfigureInfo *) NULL;
00365   *number_options=(unsigned long) i;
00366   return(options);
00367 }
00368 
00369 /*
00370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00371 %                                                                             %
00372 %                                                                             %
00373 %                                                                             %
00374 %   G e t C o n f i g u r e L i s t                                           %
00375 %                                                                             %
00376 %                                                                             %
00377 %                                                                             %
00378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00379 %
00380 %  GetConfigureList() returns any configure options that match the specified
00381 %  pattern.
00382 %
00383 %  The format of the GetConfigureList function is:
00384 %
00385 %      char **GetConfigureList(const char *pattern,
00386 %        unsigned long *number_options,ExceptionInfo *exception)
00387 %
00388 %  A description of each parameter follows:
00389 %
00390 %    o pattern: Specifies a pointer to a text string containing a pattern.
00391 %
00392 %    o number_options:  This integer returns the number of options in the list.
00393 %
00394 %    o exception: return any errors or warnings in this structure.
00395 %
00396 */
00397 
00398 #if defined(__cplusplus) || defined(c_plusplus)
00399 extern "C" {
00400 #endif
00401 
00402 static int ConfigureCompare(const void *x,const void *y)
00403 {
00404   register char
00405     **p,
00406     **q;
00407 
00408   p=(char **) x;
00409   q=(char **) y;
00410   return(LocaleCompare(*p,*q));
00411 }
00412 
00413 #if defined(__cplusplus) || defined(c_plusplus)
00414 }
00415 #endif
00416 
00417 MagickExport char **GetConfigureList(const char *pattern,
00418   unsigned long *number_options,ExceptionInfo *exception)
00419 {
00420   char
00421     **options;
00422 
00423   register const ConfigureInfo
00424     *p;
00425 
00426   register long
00427     i;
00428 
00429   /*
00430     Allocate configure list.
00431   */
00432   assert(pattern != (char *) NULL);
00433   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
00434   assert(number_options != (unsigned long *) NULL);
00435   *number_options=0;
00436   p=GetConfigureInfo("*",exception);
00437   if (p == (const ConfigureInfo *) NULL)
00438     return((char **) NULL);
00439   options=(char **) AcquireQuantumMemory((size_t)
00440     GetNumberOfElementsInLinkedList(configure_list)+1UL,sizeof(*options));
00441   if (options == (char **) NULL)
00442     return((char **) NULL);
00443   (void) LockSemaphoreInfo(configure_semaphore);
00444   ResetLinkedListIterator(configure_list);
00445   p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list);
00446   for (i=0; p != (const ConfigureInfo *) NULL; )
00447   {
00448     if ((p->stealth == MagickFalse) &&
00449         (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
00450       options[i++]=ConstantString(p->name);
00451     p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list);
00452   }
00453   (void) UnlockSemaphoreInfo(configure_semaphore);
00454   qsort((void *) options,(size_t) i,sizeof(*options),ConfigureCompare);
00455   options[i]=(char *) NULL;
00456   *number_options=(unsigned long) i;
00457   return(options);
00458 }
00459 
00460 /*
00461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00462 %                                                                             %
00463 %                                                                             %
00464 %                                                                             %
00465 %   G e t C o n f i g u r e O p t i o n                                       %
00466 %                                                                             %
00467 %                                                                             %
00468 %                                                                             %
00469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00470 %
00471 %  GetConfigureOption() returns the value associated with the configure option.
00472 %
00473 %  The format of the GetConfigureOption method is:
00474 %
00475 %      char *GetConfigureOption(const char *option)
00476 %
00477 %  A description of each parameter follows:
00478 %
00479 %    o configure_info:  The configure info.
00480 %
00481 */
00482 MagickExport char *GetConfigureOption(const char *option)
00483 {
00484   const char
00485     *value;
00486 
00487   const ConfigureInfo
00488     *configure_info;
00489 
00490   ExceptionInfo
00491     *exception;
00492 
00493   assert(option != (const char *) NULL);
00494   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",option);
00495   exception=AcquireExceptionInfo();
00496   configure_info=GetConfigureInfo(option,exception);
00497   exception=DestroyExceptionInfo(exception);
00498   if (configure_info == (ConfigureInfo *) NULL)
00499     return((char *) NULL);
00500   value=GetConfigureValue(configure_info);
00501   if ((value == (const char *) NULL) || (*value == '\0'))
00502     return((char *) NULL);
00503   return(ConstantString(value));
00504 }
00505 
00506 /*
00507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00508 %                                                                             %
00509 %                                                                             %
00510 %                                                                             %
00511 %  G e t C o n f i g u r e O p t i o n s                                      %
00512 %                                                                             %
00513 %                                                                             %
00514 %                                                                             %
00515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00516 %
00517 %  GetConfigureOptions() returns any Magick configuration options associated
00518 %  with the specified filename.
00519 %
00520 %  The format of the GetConfigureOptions method is:
00521 %
00522 %      LinkedListInfo *GetConfigureOptions(const char *filename,
00523 %        ExceptionInfo *exception)
00524 %
00525 %  A description of each parameter follows:
00526 %
00527 %    o filename: the configure file name.
00528 %
00529 %    o exception: return any errors or warnings in this structure.
00530 %
00531 */
00532 MagickExport LinkedListInfo *GetConfigureOptions(const char *filename,
00533   ExceptionInfo *exception)
00534 {
00535   char
00536     path[MaxTextExtent];
00537 
00538   const char
00539     *element;
00540 
00541   LinkedListInfo
00542     *options,
00543     *paths;
00544 
00545   StringInfo
00546     *xml;
00547 
00548   assert(filename != (const char *) NULL);
00549   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
00550   assert(exception != (ExceptionInfo *) NULL);
00551   (void) CopyMagickString(path,filename,MaxTextExtent);
00552   /*
00553     Load XML from configuration files to linked-list.
00554   */
00555   options=NewLinkedList(0);
00556   paths=GetConfigurePaths(filename,exception);
00557   if (paths != (LinkedListInfo *) NULL)
00558     {
00559       ResetLinkedListIterator(paths);
00560       element=(const char *) GetNextValueInLinkedList(paths);
00561       while (element != (const char *) NULL)
00562       {
00563         (void) FormatMagickString(path,MaxTextExtent,"%s%s",element,filename);
00564         (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
00565           "Searching for configure file: \"%s\"",path);
00566         xml=ConfigureFileToStringInfo(path);
00567         if (xml != (StringInfo *) NULL)
00568           (void) AppendValueToLinkedList(options,xml);
00569         element=(const char *) GetNextValueInLinkedList(paths);
00570       }
00571       paths=DestroyLinkedList(paths,RelinquishMagickMemory);
00572     }
00573 #if defined(__WINDOWS__)
00574   {
00575     char
00576       *blob;
00577 
00578     blob=(char *) NTResourceToBlob(filename);
00579     if (blob != (char *) NULL)
00580       {
00581         xml=StringToStringInfo(blob);
00582         SetStringInfoPath(xml,filename);
00583         (void) AppendValueToLinkedList(options,xml);
00584         blob=DestroyString(blob);
00585       }
00586   }
00587 #endif
00588   if (GetNumberOfElementsInLinkedList(options) == 0)
00589     (void) ThrowMagickException(exception,GetMagickModule(),ConfigureWarning,
00590       "UnableToOpenConfigureFile","`%s'",filename);
00591   ResetLinkedListIterator(options);
00592   return(options);
00593 }
00594 
00595 /*
00596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00597 %                                                                             %
00598 %                                                                             %
00599 %                                                                             %
00600 %  G e t C o n f i g u r e P a t h s                                          %
00601 %                                                                             %
00602 %                                                                             %
00603 %                                                                             %
00604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00605 %
00606 %  GetConfigurePaths() returns any Magick configuration paths associated
00607 %  with the specified filename.
00608 %
00609 %  The format of the GetConfigurePaths method is:
00610 %
00611 %      LinkedListInfo *GetConfigurePaths(const char *filename,
00612 %        ExceptionInfo *exception)
00613 %
00614 %  A description of each parameter follows:
00615 %
00616 %    o filename: the configure file name.
00617 %
00618 %    o exception: return any errors or warnings in this structure.
00619 %
00620 */
00621 MagickExport LinkedListInfo *GetConfigurePaths(const char *filename,
00622   ExceptionInfo *exception)
00623 {
00624   char
00625     path[MaxTextExtent];
00626 
00627   LinkedListInfo
00628     *paths;
00629 
00630   assert(filename != (const char *) NULL);
00631   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
00632   assert(exception != (ExceptionInfo *) NULL);
00633   (void) CopyMagickString(path,filename,MaxTextExtent);
00634   paths=NewLinkedList(0);
00635   {
00636     char
00637       *configure_path;
00638 
00639     /*
00640       Search $MAGICK_CONFIGURE_PATH.
00641     */
00642     configure_path=GetEnvironmentValue("MAGICK_CONFIGURE_PATH");
00643     if (configure_path != (char *) NULL)
00644       {
00645         register char
00646           *p,
00647           *q;
00648 
00649         for (p=configure_path-1; p != (char *) NULL; )
00650         {
00651           (void) CopyMagickString(path,p+1,MaxTextExtent);
00652           q=strchr(path,DirectoryListSeparator);
00653           if (q != (char *) NULL)
00654             *q='\0';
00655           q=path+strlen(path)-1;
00656           if ((q >= path) && (*q != *DirectorySeparator))
00657             (void) ConcatenateMagickString(path,DirectorySeparator,
00658               MaxTextExtent);
00659           (void) AppendValueToLinkedList(paths,ConstantString(path));
00660           p=strchr(p+1,DirectoryListSeparator);
00661         }
00662         configure_path=DestroyString(configure_path);
00663       }
00664   }
00665 #if defined(MAGICKCORE_INSTALLED_SUPPORT)
00666 #if defined(MAGICKCORE_SHARE_CONFIGURE_PATH)
00667   (void) AppendValueToLinkedList(paths,ConstantString(
00668     MAGICKCORE_SHARE_CONFIGURE_PATH));
00669 #endif
00670 #if defined(MAGICKCORE_CONFIGURE_PATH)
00671   (void) AppendValueToLinkedList(paths,ConstantString(
00672     MAGICKCORE_CONFIGURE_PATH));
00673 #endif
00674 #if defined(MAGICKCORE_DOCUMENTATION_PATH)
00675   (void) AppendValueToLinkedList(paths,ConstantString(
00676     MAGICKCORE_DOCUMENTATION_PATH));
00677 #endif
00678 #if defined(MAGICKCORE_SHARE_PATH)
00679   (void) AppendValueToLinkedList(paths,ConstantString(MAGICKCORE_SHARE_PATH));
00680 #endif
00681 #if defined(__WINDOWS__) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
00682   {
00683     char
00684       *registry_key;
00685 
00686     unsigned char
00687       *key_value;
00688 
00689     /*
00690       Locate file via registry key.
00691     */
00692     registry_key="ConfigurePath";
00693     key_value=NTRegistryKeyLookup(registry_key);
00694     if (key_value != (unsigned char *) NULL)
00695       {
00696         (void) FormatMagickString(path,MaxTextExtent,"%s%s",(char *) key_value,
00697           DirectorySeparator);
00698         (void) AppendValueToLinkedList(paths,ConstantString(path));
00699         key_value=(unsigned char *) RelinquishMagickMemory(key_value);
00700       }
00701   }
00702 #endif
00703 #else
00704   {
00705     char
00706       *home;
00707 
00708     /*
00709       Search under MAGICK_HOME.
00710     */
00711     home=GetEnvironmentValue("MAGICK_HOME");
00712     if (home != (char *) NULL)
00713       {
00714 #if !defined(MAGICKCORE_POSIX_SUPPORT)
00715         (void) FormatMagickString(path,MaxTextExtent,"%s%s",home,
00716           DirectorySeparator);
00717         (void) AppendValueToLinkedList(paths,ConstantString(path));
00718 #else
00719         (void) FormatMagickString(path,MaxTextExtent,"%s/lib/%s/",home,
00720           MAGICKCORE_CONFIGURE_RELATIVE_PATH);
00721         (void) AppendValueToLinkedList(paths,ConstantString(path));
00722         (void) FormatMagickString(path,MaxTextExtent,"%s/share/%s/",home,
00723           MAGICKCORE_SHARE_CONFIGURE_RELATIVE_PATH);
00724         (void) AppendValueToLinkedList(paths,ConstantString(path));
00725 #endif
00726         home=DestroyString(home);
00727       }
00728     }
00729   if (*GetClientPath() != '\0')
00730     {
00731 #if !defined(MAGICKCORE_POSIX_SUPPORT)
00732       (void) FormatMagickString(path,MaxTextExtent,"%s%s",GetClientPath(),
00733         DirectorySeparator);
00734       (void) AppendValueToLinkedList(paths,ConstantString(path));
00735 #else
00736       char
00737         prefix[MaxTextExtent];
00738 
00739       /*
00740         Search based on executable directory if directory is known.
00741       */
00742       (void) CopyMagickString(prefix,GetClientPath(),MaxTextExtent);
00743       ChopPathComponents(prefix,1);
00744       (void) FormatMagickString(path,MaxTextExtent,"%s/share/%s/",prefix,
00745         MAGICKCORE_SHARE_CONFIGURE_RELATIVE_PATH);
00746       (void) AppendValueToLinkedList(paths,ConstantString(path));
00747       (void) FormatMagickString(path,MaxTextExtent,"%s/lib/%s/",prefix,
00748         MAGICKCORE_CONFIGURE_RELATIVE_PATH);
00749       (void) AppendValueToLinkedList(paths,ConstantString(path));
00750 #endif
00751     }
00752 #endif
00753   {
00754     char
00755       *home;
00756 
00757     home=GetEnvironmentValue("HOME");
00758     if (home == (char *) NULL)
00759       home=GetEnvironmentValue("USERPROFILE");
00760     if (home != (char *) NULL)
00761       {
00762         /*
00763           Search $HOME/.magick.
00764         */
00765         (void) FormatMagickString(path,MaxTextExtent,"%s%s.magick%s",home,
00766           DirectorySeparator,DirectorySeparator);
00767         (void) AppendValueToLinkedList(paths,ConstantString(path));
00768         home=DestroyString(home);
00769       }
00770   }
00771 #if defined(__WINDOWS__)
00772   {
00773     char
00774       module_path[MaxTextExtent];
00775 
00776     if ((NTGetModulePath("CORE_RL_magick_.dll",module_path) != MagickFalse) ||
00777         (NTGetModulePath("CORE_DB_magick_.dll",module_path) != MagickFalse))
00778       {
00779         char
00780           *element;
00781 
00782         /*
00783           Search module path.
00784         */
00785         (void) FormatMagickString(path,MaxTextExtent,"%s%s",module_path,
00786           DirectorySeparator);
00787         element=(char *) RemoveElementByValueFromLinkedList(paths,path);
00788         if (element != (char *) NULL)
00789           element=DestroyString(element);
00790         (void) AppendValueToLinkedList(paths,ConstantString(path));
00791       }
00792     if (NTGetModulePath("Magick.dll",module_path) != MagickFalse)
00793       {
00794         /*
00795           Search PerlMagick module path.
00796         */
00797         (void) FormatMagickString(path,MaxTextExtent,"%s%s",module_path,
00798           DirectorySeparator);
00799         (void) AppendValueToLinkedList(paths,ConstantString(path));
00800         (void) FormatMagickString(path,MaxTextExtent,"%s%s",module_path,
00801           "\\inc\\lib\\auto\\Image\\Magick\\");
00802         (void) AppendValueToLinkedList(paths,ConstantString(path));
00803       }
00804   }
00805 #endif
00806   /*
00807     Search current directory.
00808   */
00809   (void) AppendValueToLinkedList(paths,ConstantString(""));
00810   return(paths);
00811 }
00812 
00813 /*
00814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00815 %                                                                             %
00816 %                                                                             %
00817 %                                                                             %
00818 %   G e t C o n f i g u r e V a l u e                                         %
00819 %                                                                             %
00820 %                                                                             %
00821 %                                                                             %
00822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00823 %
00824 %  GetConfigureValue() returns the value associated with the configure info.
00825 %
00826 %  The format of the GetConfigureValue method is:
00827 %
00828 %      const char *GetConfigureValue(const ConfigureInfo *configure_info)
00829 %
00830 %  A description of each parameter follows:
00831 %
00832 %    o configure_info:  The configure info.
00833 %
00834 */
00835 MagickExport const char *GetConfigureValue(const ConfigureInfo *configure_info)
00836 {
00837   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
00838   assert(configure_info != (ConfigureInfo *) NULL);
00839   assert(configure_info->signature == MagickSignature);
00840   return(configure_info->value);
00841 }
00842 
00843 /*
00844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00845 %                                                                             %
00846 %                                                                             %
00847 %                                                                             %
00848 +   I n i t i a l i z e C o n f i g u r e L i s t                             %
00849 %                                                                             %
00850 %                                                                             %
00851 %                                                                             %
00852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00853 %
00854 %  InitializeConfigureList() initializes the configure list.
00855 %
00856 %  The format of the InitializeConfigureList method is:
00857 %
00858 %      MagickBooleanType InitializeConfigureList(ExceptionInfo *exception)
00859 %
00860 %  A description of each parameter follows.
00861 %
00862 %    o exception: return any errors or warnings in this structure.
00863 %
00864 */
00865 static MagickBooleanType InitializeConfigureList(ExceptionInfo *exception)
00866 {
00867   if ((configure_list == (LinkedListInfo *) NULL) &&
00868       (instantiate_configure == MagickFalse))
00869     {
00870       if (configure_semaphore == (SemaphoreInfo *) NULL)
00871         AcquireSemaphoreInfo(&configure_semaphore);
00872       (void) LockSemaphoreInfo(configure_semaphore);
00873       if ((configure_list == (LinkedListInfo *) NULL) &&
00874           (instantiate_configure == MagickFalse))
00875         {
00876           (void) LoadConfigureLists(ConfigureFilename,exception);
00877           instantiate_configure=MagickTrue;
00878         }
00879       (void) UnlockSemaphoreInfo(configure_semaphore);
00880     }
00881   return(configure_list != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
00882 }
00883 
00884 /*
00885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00886 %                                                                             %
00887 %                                                                             %
00888 %                                                                             %
00889 %  L i s t C o n f i g u r e I n f o                                          %
00890 %                                                                             %
00891 %                                                                             %
00892 %                                                                             %
00893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00894 %
00895 %  ListConfigureInfo() lists the configure info to a file.
00896 %
00897 %  The format of the ListConfigureInfo method is:
00898 %
00899 %      MagickBooleanType ListConfigureInfo(FILE *file,ExceptionInfo *exception)
00900 %
00901 %  A description of each parameter follows.
00902 %
00903 %    o file:  An pointer to a FILE.
00904 %
00905 %    o exception: return any errors or warnings in this structure.
00906 %
00907 */
00908 MagickExport MagickBooleanType ListConfigureInfo(FILE *file,
00909   ExceptionInfo *exception)
00910 {
00911   const char
00912     *name,
00913     *path,
00914     *value;
00915 
00916   const ConfigureInfo
00917     **configure_info;
00918 
00919   long
00920     j;
00921 
00922   register long
00923     i;
00924 
00925   unsigned long
00926     number_options;
00927 
00928   if (file == (const FILE *) NULL)
00929     file=stdout;
00930   configure_info=GetConfigureInfoList("*",&number_options,exception);
00931   if (configure_info == (const ConfigureInfo **) NULL)
00932     return(MagickFalse);
00933   path=(const char *) NULL;
00934   for (i=0; i < (long) number_options; i++)
00935   {
00936     if (configure_info[i]->stealth != MagickFalse)
00937       continue;
00938     if ((path == (const char *) NULL) ||
00939         (LocaleCompare(path,configure_info[i]->path) != 0))
00940       {
00941         if (configure_info[i]->path != (char *) NULL)
00942           (void) fprintf(file,"\nPath: %s\n\n",configure_info[i]->path);
00943         (void) fprintf(file,"Name          Value\n");
00944         (void) fprintf(file,"-------------------------------------------------"
00945           "------------------------------\n");
00946       }
00947     path=configure_info[i]->path;
00948     name="unknown";
00949     if (configure_info[i]->name != (char *) NULL)
00950       name=configure_info[i]->name;
00951     (void) fprintf(file,"%s",name);
00952     for (j=(long) strlen(name); j <= 12; j++)
00953       (void) fprintf(file," ");
00954     (void) fprintf(file," ");
00955     value="unknown";
00956     if (configure_info[i]->value != (char *) NULL)
00957       value=configure_info[i]->value;
00958     (void) fprintf(file,"%s",value);
00959     (void) fprintf(file,"\n");
00960   }
00961   (void) fflush(file);
00962   configure_info=(const ConfigureInfo **)
00963     RelinquishMagickMemory((void *) configure_info);
00964   return(MagickTrue);
00965 }
00966 
00967 /*
00968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00969 %                                                                             %
00970 %                                                                             %
00971 %                                                                             %
00972 +   L o a d C o n f i g u r e L i s t                                         %
00973 %                                                                             %
00974 %                                                                             %
00975 %                                                                             %
00976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00977 %
00978 %  LoadConfigureList() loads the configure configuration file which provides a
00979 %  mapping between configure attributes and a configure name.
00980 %
00981 %  The format of the LoadConfigureList method is:
00982 %
00983 %      MagickBooleanType LoadConfigureList(const char *xml,const char *filename,
00984 %        const unsigned long depth,ExceptionInfo *exception)
00985 %
00986 %  A description of each parameter follows:
00987 %
00988 %    o xml:  The configure list in XML format.
00989 %
00990 %    o filename:  The configure list filename.
00991 %
00992 %    o depth: depth of <include /> statements.
00993 %
00994 %    o exception: return any errors or warnings in this structure.
00995 %
00996 */
00997 static MagickBooleanType LoadConfigureList(const char *xml,const char *filename,
00998   const unsigned long depth,ExceptionInfo *exception)
00999 {
01000   char
01001     keyword[MaxTextExtent],
01002     *token;
01003 
01004   ConfigureInfo
01005     *configure_info;
01006 
01007   const char
01008     *q;
01009 
01010   MagickBooleanType
01011     status;
01012 
01013   /*
01014     Load the configure map file.
01015   */
01016   (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
01017     "Loading configure file \"%s\" ...",filename);
01018   if (configure_list == (LinkedListInfo *) NULL)
01019     {
01020       configure_list=NewLinkedList(0);
01021       if (configure_list == (LinkedListInfo *) NULL)
01022         {
01023           ThrowFileException(exception,ResourceLimitError,
01024             "MemoryAllocationFailed",filename);
01025           return(MagickFalse);
01026         }
01027     }
01028   status=MagickTrue;
01029   configure_info=(ConfigureInfo *) NULL;
01030   token=AcquireString((char *) xml);
01031   for (q=(char *) xml; *q != '\0'; )
01032   {
01033     /*
01034       Interpret XML.
01035     */
01036     GetMagickToken(q,&q,token);
01037     if (*token == '\0')
01038       break;
01039     (void) CopyMagickString(keyword,token,MaxTextExtent);
01040     if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)
01041       {
01042         /*
01043           Doctype element.
01044         */
01045         while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
01046           GetMagickToken(q,&q,token);
01047         continue;
01048       }
01049     if (LocaleNCompare(keyword,"<!--",4) == 0)
01050       {
01051         /*
01052           Comment element.
01053         */
01054         while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
01055           GetMagickToken(q,&q,token);
01056         continue;
01057       }
01058     if (LocaleCompare(keyword,"<include") == 0)
01059       {
01060         /*
01061           Include element.
01062         */
01063         while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
01064         {
01065           (void) CopyMagickString(keyword,token,MaxTextExtent);
01066           GetMagickToken(q,&q,token);
01067           if (*token != '=')
01068             continue;
01069           GetMagickToken(q,&q,token);
01070           if (LocaleCompare(keyword,"file") == 0)
01071             {
01072               if (depth > 200)
01073                 (void) ThrowMagickException(exception,GetMagickModule(),
01074                   ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);
01075               else
01076                 {
01077                   char
01078                     path[MaxTextExtent],
01079                     *xml;
01080 
01081                   GetPathComponent(filename,HeadPath,path);
01082                   if (*path != '\0')
01083                     (void) ConcatenateMagickString(path,DirectorySeparator,
01084                       MaxTextExtent);
01085                   if (*token == *DirectorySeparator)
01086                     (void) CopyMagickString(path,token,MaxTextExtent);
01087                   else
01088                     (void) ConcatenateMagickString(path,token,MaxTextExtent);
01089                   xml=FileToString(path,~0,exception);
01090                   if (xml != (char *) NULL)
01091                     {
01092                       status=LoadConfigureList(xml,path,depth+1,exception);
01093                       xml=(char *) RelinquishMagickMemory(xml);
01094                     }
01095                 }
01096             }
01097         }
01098         continue;
01099       }
01100     if (LocaleCompare(keyword,"<configure") == 0)
01101       {
01102         /*
01103           Configure element.
01104         */
01105         configure_info=(ConfigureInfo *) AcquireMagickMemory(
01106           sizeof(*configure_info));
01107         if (configure_info == (ConfigureInfo *) NULL)
01108           ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
01109         (void) ResetMagickMemory(configure_info,0,sizeof(*configure_info));
01110         configure_info->path=ConstantString(filename);
01111         configure_info->exempt=MagickFalse;
01112         configure_info->signature=MagickSignature;
01113         continue;
01114       }
01115     if (configure_info == (ConfigureInfo *) NULL)
01116       continue;
01117     if (LocaleCompare(keyword,"/>") == 0)
01118       {
01119         status=AppendValueToLinkedList(configure_list,configure_info);
01120         if (status == MagickFalse)
01121           (void) ThrowMagickException(exception,GetMagickModule(),
01122             ResourceLimitError,"MemoryAllocationFailed","`%s'",
01123             configure_info->name);
01124         configure_info=(ConfigureInfo *) NULL;
01125       }
01126     /*
01127       Parse configure element.
01128     */
01129     GetMagickToken(q,(const char **) NULL,token);
01130     if (*token != '=')
01131       continue;
01132     GetMagickToken(q,&q,token);
01133     GetMagickToken(q,&q,token);
01134     switch (*keyword)
01135     {
01136       case 'N':
01137       case 'n':
01138       {
01139         if (LocaleCompare((char *) keyword,"name") == 0)
01140           {
01141             configure_info->name=ConstantString(token);
01142             break;
01143           }
01144         break;
01145       }
01146       case 'S':
01147       case 's':
01148       {
01149         if (LocaleCompare((char *) keyword,"stealth") == 0)
01150           {
01151             configure_info->stealth=IsMagickTrue(token);
01152             break;
01153           }
01154         break;
01155       }
01156       case 'V':
01157       case 'v':
01158       {
01159         if (LocaleCompare((char *) keyword,"value") == 0)
01160           {
01161             configure_info->value=ConstantString(token);
01162             break;
01163           }
01164         break;
01165       }
01166       default:
01167         break;
01168     }
01169   }
01170   token=(char *) RelinquishMagickMemory(token);
01171   return(status);
01172 }
01173 
01174 /*
01175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01176 %                                                                             %
01177 %                                                                             %
01178 %                                                                             %
01179 %  L o a d C o n f i g u r e L i s t s                                        %
01180 %                                                                             %
01181 %                                                                             %
01182 %                                                                             %
01183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01184 %
01185 %  LoadConfigureList() loads one or more configure configuration files which
01186 %  provides a mapping between configure attributes and a configure name.
01187 %
01188 %  The format of the LoadConfigureLists method is:
01189 %
01190 %      MagickBooleanType LoadConfigureLists(const char *filename,
01191 %        ExceptionInfo *exception)
01192 %
01193 %  A description of each parameter follows:
01194 %
01195 %    o filename: the font file name.
01196 %
01197 %    o exception: return any errors or warnings in this structure.
01198 %
01199 */
01200 static MagickBooleanType LoadConfigureLists(const char *filename,
01201   ExceptionInfo *exception)
01202 {
01203   const StringInfo
01204     *option;
01205 
01206   LinkedListInfo
01207     *options;
01208 
01209   MagickStatusType
01210     status;
01211 
01212   register long
01213     i;
01214 
01215   /*
01216     Load built-in configure map.
01217   */
01218   status=MagickFalse;
01219   if (configure_list == (LinkedListInfo *) NULL)
01220     {
01221       configure_list=NewLinkedList(0);
01222       if (configure_list == (LinkedListInfo *) NULL)
01223         {
01224           ThrowFileException(exception,ResourceLimitError,
01225             "MemoryAllocationFailed",filename);
01226           return(MagickFalse);
01227         }
01228     }
01229   for (i=0; i < (long) (sizeof(ConfigureMap)/sizeof(*ConfigureMap)); i++)
01230   {
01231     ConfigureInfo
01232       *configure_info;
01233 
01234     register const ConfigureMapInfo
01235       *p;
01236 
01237     p=ConfigureMap+i;
01238     configure_info=(ConfigureInfo *) AcquireMagickMemory(
01239       sizeof(*configure_info));
01240     if (configure_info == (ConfigureInfo *) NULL)
01241       {
01242         (void) ThrowMagickException(exception,GetMagickModule(),
01243           ResourceLimitError,"MemoryAllocationFailed","`%s'",
01244           configure_info->name);
01245         continue;
01246       }
01247     (void) ResetMagickMemory(configure_info,0,sizeof(*configure_info));
01248     configure_info->path=(char *) "[built-in]";
01249     configure_info->name=(char *) p->name;
01250     configure_info->value=(char *) p->value;
01251     configure_info->exempt=MagickTrue;
01252     configure_info->signature=MagickSignature;
01253     status=AppendValueToLinkedList(configure_list,configure_info);
01254     if (status == MagickFalse)
01255       (void) ThrowMagickException(exception,GetMagickModule(),
01256         ResourceLimitError,"MemoryAllocationFailed","`%s'",
01257         configure_info->name);
01258   }
01259   /*
01260     Load external configure map.
01261   */
01262   options=GetConfigureOptions(filename,exception);
01263   option=(const StringInfo *) GetNextValueInLinkedList(options);
01264   while (option != (const StringInfo *) NULL)
01265   {
01266     status|=LoadConfigureList((const char *) GetStringInfoDatum(option),
01267       GetStringInfoPath(option),0,exception);
01268     option=(const StringInfo *) GetNextValueInLinkedList(options);
01269   }
01270   options=DestroyConfigureOptions(options);
01271   return(status != 0 ? MagickTrue : MagickFalse);
01272 }

Generated on 19 Nov 2009 for MagickCore by  doxygen 1.6.1