if (LocaleNCompare(pattern,"filename:",9) != 0)
break;
value=(const char *) NULL;
+#if 0
+ // FUTURE: remove this code. -- Anthony 29 Arpil 2012
+ // Removed as GetMagickProperty() will now return a 'cloned' string
+ // that must also be freed. It will never match a "filename:" string
+ // in any case as this is not a specificaally 'known' image properity.
+ //
if ((image_info != (const ImageInfo *) NULL) &&
(image != (const Image *) NULL))
value=GetMagickProperty(image_info,image,pattern,exception);
else
- if (image != (Image *) NULL)
- value=GetImageProperty(image,pattern,exception);
- else
- if (image_info != (ImageInfo *) NULL)
- value=GetImageOption(image_info,pattern);
+#endif
+ if (image != (Image *) NULL)
+ value=GetImageProperty(image,pattern,exception);
+ if ((value == (const char *) NULL) &&
+ (image != (Image *) NULL))
+ value=GetImageArtifact(image,pattern);
+ if ((value == (const char *) NULL) &&
+ (image_info != (ImageInfo *) NULL))
+ value=GetImageOption(image_info,pattern);
if (value == (const char *) NULL)
break;
q--;
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetMagickProperty() gets a value associated with an image property.
+% GetMagickProperty() gets attributes or calculated values that is associated
+% with a fixed known property name.
+%
+% This does not return single character properity names, special profile or
+% calculated properity substitutions. Nor does it return free-form properity
+% strings, unless such a name is also associated with a specific attribute.
+%
+% The returned string should be freed using DestoryString() when finished.
%
% The format of the GetMagickProperty method is:
%
% const char *GetMagickProperty(const ImageInfo *image_info,Image *image,
-% const char *key,ExceptionInfo *exception)
+% const char *properity,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
{
case 'b':
{
- if (LocaleNCompare("base",property,4) == 0)
+ if ((LocaleNCompare("base",property,4) == 0) ||
+ (LocaleNCompare("basename",property,8) == 0) )
{
GetPathComponent(image->magick_filename,BasePath,filename);
(void) CopyMagickString(value,filename,MaxTextExtent);
break;
}
}
- if (*value != '\0')
- {
- if (image->properties == (void *) NULL)
- image->properties=NewSplayTree(CompareSplayTreeString,
- RelinquishMagickMemory,RelinquishMagickMemory);
- (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
- ConstantString(property),ConstantString(value));
- }
- return(GetImageProperty(image,property,exception));
+ if (*value == '\0')
+ return(NULL);
+ return(ConstantString(value));
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetNextImageProperty() gets the next image property value.
+% GetNextImageProperty() gets the next free-form string properity name.
%
% The format of the GetNextImageProperty method is:
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% InterpretImageProperties() replaces any embedded formatting characters with
-% the appropriate image property and returns the interpreted text. Free with
-% DestoryString() or RelinquishMagickMemory().
+% the appropriate image property and returns the interpreted text.
+%
+% This searches for and replaces
+% %x where 'x' is a single letter, case sensitive).
+% %[type:...] where 'type' is specifically known prefix.
+% %[name] where 'name' is a specifically known attribute, calculated
+% value, or free-form properity string name, or a free-form
+% global option string setting.
+% \n \r replaced by newline, return
+% < < replaced by '<', '>' resp.
+%
+% If 'name' is a 'glob-expresion' (containing '*' or '?' characters) it is used
+% as a search pattern to print "name=value\n" pairs of free-form string
+% properities. Some 'type' properities may also allow 'glob-expressions'.
+%
+% The returned string must be freeds using DestoryString() or
+% RelinquishMagickMemory().
%
% The format of the InterpretImageProperties method is:
%
}
(void) CopyMagickString(q,value,extent);
q+=length;
+ value=DestroyString((char *)value); /* must be destoryed */
break;
}
if (image_info == (ImageInfo *) NULL)
%
% A pointer to the copy of the source string, or NULL is returned.
%
+% Free the string using DestoryString().
+%
% The format of the CloneString method is:
%
% char *CloneString(char **destination,const char *source)
% to that memory location (and returns it). Use it for strings that you do
% do not expect to change over its lifetime.
%
+% When finished free the string using DestoryString().
+%
% The format of the ConstantString method is:
%
% char *ConstantString(const char *source)
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% CopyMagickString() copies the source string to the destination string. The
-% destination buffer is always null-terminated even if the string must be
-% truncated. The return value is the minimum of the source string length
-% or the length parameter.
+% CopyMagickString() copies the source string to the destination string, with
+% out exceeding the given pre-declared length.
+%
+% The destination buffer is always null-terminated even if the string must be
+% truncated. The return value is the minimum of the source string length or
+% the length parameter.
%
% The format of the CopyMagickString method is:
%
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% LocaleNCompare() performs a case-insensitive comparison of two
-% strings byte-by-byte, according to the ordering of the current locale
-% encoding. LocaleNCompare returns an integer greater than, equal to, or
-% less than 0, if the string pointed to by p is greater than, equal to, or
-% less than the string pointed to by q respectively. The sign of a non-zero
-% return value is determined by the sign of the difference between the
-% values of the first pair of bytes that differ in the strings being
-% compared. The LocaleNCompare method makes the same comparison as
-% LocaleCompare but looks at a maximum of n bytes. Bytes following a
-% null byte are not compared.
+% LocaleNCompare() performs a case-insensitive comparison of two strings
+% byte-by-byte, according to the ordering of the current locale encoding.
+%
+% LocaleNCompare returns an integer greater than, equal to, or less than 0,
+% if the string pointed to by p is greater than, equal to, or less than the
+% string pointed to by q respectively. The sign of a non-zero return value
+% is determined by the sign of the difference between the values of the first
+% pair of bytes that differ in the strings being compared.
+%
+% The LocaleNCompare method makes the same comparison as LocaleCompare but
+% looks at a maximum of n bytes. Bytes following a null byte are not
+% compared.
%
% The format of the LocaleNCompare method is:
%
goto Magick_Command_Exit;
}
- /* List Information and Abort */
- if (LocaleCompare("-list",argv[1]) == 0) {
- CLIOption(cli_wand, argv[1], argv[2]);
- goto Magick_Command_Exit;
- }
-
/* Special "concatenate option (hidden) for delegate usage */
if (LocaleCompare("-concatenate",argv[1]) == 0) {
ConcatenateImages(argc,argv,exception);
goto Magick_Command_Exit;
}
+ /* List Information and Abort */
+ if (argc == 3 && LocaleCompare("-list",argv[1]) == 0) {
+ CLIOption(cli_wand, argv[1], argv[2]);
+ goto Magick_Command_Exit;
+ }
+
/* ------------- */
/* The Main Call */