if (phase_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),ImageError,
- "ImageSequenceRequired","`%s'",image->filename);
+ "TwoOrMoreImagesRequired","`%s'",image->filename);
return(MagickFalse);
}
/*
if (phase_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),ImageError,
- "ImageSequenceRequired","`%s'",magnitude_image->filename);
+ "TwoOrMoreImagesRequired","`%s'",magnitude_image->filename);
return((Image *) NULL);
}
#if !defined(MAGICKCORE_FFTW_DELEGATE)
/*
Designed to efficiently find first image (index == 0), or last image
- (index == -1) as appropriate, without to go through the whole image list,
- unless the offset is outside of the list length range.
-
- That is it tries to avoid 'counting the whole list' to handle the index.
+ (index == -1) as appropriate, without to go through the whole image list.
+ That is it tries to avoid 'counting the whole list' to handle the
+ most common image indexes.
*/
if ( index < 0 )
{
{ "-backdrop", 1L, NonMagickOptionFlag, MagickFalse },
{ "+background", 0L, ImageInfoOptionFlag, MagickFalse },
{ "-background", 1L, ImageInfoOptionFlag, MagickFalse },
- { "+bench", 0L, GenesisOptionFlag, MagickFalse },
+ { "+bench", 1L, DeprecateOptionFlag, MagickTrue },
{ "-bench", 1L, GenesisOptionFlag, MagickFalse },
{ "+bias", 0L, ImageInfoOptionFlag, MagickFalse },
{ "-bias", 1L, ImageInfoOptionFlag, MagickFalse },
{ "-composite", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse },
{ "+compress", 0L, ImageInfoOptionFlag, MagickFalse },
{ "-compress", 1L, ImageInfoOptionFlag, MagickFalse },
- { "+concurrent", 0L, GenesisOptionFlag, MagickFalse },
+ { "+concurrent", 0L, DeprecateOptionFlag, MagickTrue },
{ "-concurrent", 0L, GenesisOptionFlag, MagickFalse },
{ "+contrast", 0L, DeprecateOptionFlag, MagickTrue },
{ "-contrast", 0L, DeprecateOptionFlag, MagickTrue },
{ "-crop", 1L, SimpleOperatorOptionFlag | FireOptionFlag, MagickFalse },
{ "+cycle", 1L, DeprecateOptionFlag, MagickTrue },
{ "-cycle", 1L, SimpleOperatorOptionFlag, MagickFalse },
- { "+debug", 0L, GlobalOptionFlag|GenesisOptionFlag | FireOptionFlag, MagickFalse },
- { "-debug", 1L, GlobalOptionFlag|GenesisOptionFlag | FireOptionFlag, MagickFalse },
+ { "+debug", 0L, GlobalOptionFlag | FireOptionFlag, MagickFalse },
+ { "-debug", 1L, GlobalOptionFlag | FireOptionFlag, MagickFalse },
{ "+decipher", 1L, DeprecateOptionFlag, MagickTrue },
{ "-decipher", 1L, SimpleOperatorOptionFlag, MagickFalse },
{ "+deconstruct", 0L, DeprecateOptionFlag, MagickTrue },
{ "-recolor", 1L, DeprecateOptionFlag, MagickTrue },
{ "+red-primary", 0L, ImageInfoOptionFlag, MagickFalse },
{ "-red-primary", 1L, ImageInfoOptionFlag, MagickFalse },
- { "+regard-warnings", 0L, GenesisOptionFlag, MagickFalse },
- { "-regard-warnings", 0L, GenesisOptionFlag, MagickFalse },
+ { "+regard-warnings", 0L, ImageInfoOptionFlag, MagickFalse },
+ { "-regard-warnings", 0L, ImageInfoOptionFlag, MagickFalse },
{ "+region", 0L, SpecialOptionFlag, MagickFalse },
{ "-region", 1L, SpecialOptionFlag, MagickFalse },
{ "+remap", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse },
{ "-window", 1L, NonMagickOptionFlag, MagickFalse },
{ "+window-group", 0L, NonMagickOptionFlag, MagickFalse },
{ "-window-group", 1L, NonMagickOptionFlag, MagickFalse },
- { "+write", 1L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse },
- { "-write", 1L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse },
+ { "+write", 1L, SpecialOptionFlag | FireOptionFlag, MagickFalse },
+ { "-write", 1L, SpecialOptionFlag | FireOptionFlag, MagickFalse },
{ (char *) NULL, 0L, UndefinedOptionFlag, MagickFalse }
},
ComposeOptions[] =
SpecialOptionFlag = 0x0040, /* Special handled Option */
GenesisOptionFlag = 0x0080, /* Genesis Command Wrapper Option */
+ ImageRequiredFlags = 0x0030, /* Flags also means Images Required */
+
NonMagickOptionFlag = 0x1000, /* Option not used by Magick Command */
FireOptionFlag = 0x4000, /* Convert operation seq firing point */
DeprecateOptionFlag = 0x8000 /* Deprecate option, give warning */
if (k != 0)
clone_images=image_stack[k-1].image;
if (clone_images == (Image *) NULL)
- ThrowAnimateException(ImageError,"ImageSequenceRequired",option);
+ ThrowAnimateException(ImageError,"UnableToCloneImage",option);
FireImageStack(MagickFalse,MagickTrue,MagickTrue);
if (*option == '+')
clone_images=CloneImages(clone_images,"-1",exception);
clone_images=image;
if (k != 0)
clone_images=image_stack[k-1].image;
- /* FUTURE: Change error report to something more meaningful */
if (clone_images == (Image *) NULL)
- ThrowConvertException(ImageError,"ImageSequenceRequired",option);
+ ThrowConvertException(ImageError,"UnableToCloneImage",option);
FireImageStack(MagickTrue,MagickTrue,MagickTrue);
if (*option == '+')
clone_images=CloneImages(clone_images,"-1",exception);
\
message=GetExceptionMessage(errno); \
(void) ThrowMagickException(exception,GetMagickModule(),severity, \
- tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \
+ tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context,message); \
message=DestroyString(message); \
}
#if MagickCommandDebug >= 9
+/*
+ Temporary Debugging Information
+ FUTURE: these should be able to be printed out using 'percent escapes'
+ Actually 'Properities' can already be output with "%[*]"
+*/
static void OutputOptions(ImageInfo *image_info)
{
const char
cli_wand->line,cli_wand->line,option,count,option_type,arg1,arg2);
#endif
+ if ( (option_type & GenesisOptionFlag) != 0 ) {
+ /* Genesis Options have no place in a magick script */
+ CLIWandExceptionBreak(OptionError,"InvalidUseOfOption",option);
+ goto next_token;
+ }
if ( (option_type & DeprecateOptionFlag) != 0 ) {
CLIWandException(OptionWarning,"DeprecatedOption",option);
if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse )
break;
+ /* fall through - do the depreciated option */
+ }
+ if (((option_type & ImageRequiredFlags) != 0 ) &&
+ ( cli_wand->wand.images != (Image *)NULL ) ) {
+ CLIWandException(OptionError,"NoImagesFound",option);
+ goto next_token;
}
/* handle special script-argument options here */
// or making use of the command line options.
//CLICommandOptions(cli_wand,count+1,argv, MagickScriptArgsFlags);
- /* Process Option from file */
+ /*
+ Process Option from file
+ */
if ( (option_type & SpecialOptionFlag) != 0 ) {
- if ( LocaleCompare(option,"-exit") == 0 )
- break;
- /* No "-script" option from script at this time - though posible */
+ if ( LocaleCompare(option,"-exit") == 0 ) {
+ break; /* forced end of script */
+ }
+ if ( LocaleCompare(option,"-script") == 0 ) {
+ CLIWandExceptionBreak(OptionError,"InvalidUseOfOption",option);
+ goto next_token;
+ }
+ /* handle any other special operators now */
CLISpecialOperator(cli_wand,option,arg1);
}
switch( token_info->status ) {
case TokenStatusOK:
case TokenStatusEOF:
+ if (cli_wand->image_list_stack != (Stack *)NULL)
+ CLIWandException(OptionError,"UnbalancedParenthesis", "(eof)");
+ else if (cli_wand->image_info_stack != (Stack *)NULL)
+ CLIWandException(OptionError,"UnbalancedBraces", "(eof)");
break;
case TokenStatusBadQuotes:
/* Ensure last token has a sane length for error report */
goto next_argument;
}
- if ( (option_type & DeprecateOptionFlag) != 0 ) {
- CLIWandException(OptionWarning,"DeprecatedOption",option);
- if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse )
- return(i+count+1);
- }
if ((i+count) >= end ) {
CLIWandException(OptionFatalError,"MissingArgument",option);
if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse )
i,option,count,option_type,arg1,arg2);
#endif
+ if ( (option_type & DeprecateOptionFlag) != 0 ) {
+ CLIWandException(OptionWarning,"DeprecatedOption",option);
+ if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse )
+ return(end);
+ /* fall through - do the depreciated option */
+ }
+ if ( (option_type & GenesisOptionFlag) != 0 ) {
+ goto next_argument; /* ignore genesis options */
+ }
+ if (((option_type & ImageRequiredFlags) != 0 ) &&
+ ( cli_wand->wand.images == (Image *)NULL ) ) {
+ CLIWandException(OptionError,"NoImagesFound",option);
+ goto next_argument;
+ }
+
if ( (option_type & SpecialOptionFlag) != 0 ) {
if ( ( process_flags & ProcessExitOption ) != 0
&& LocaleCompare(option,"-exit") == 0 )
return(i+count);
if ( ( process_flags & ProcessScriptOption ) != 0
&& LocaleCompare(option,"-script") == 0) {
- // Unbalanced Parenthesis if stack not empty
// Call Script, with a filename as a zeroth argument
ProcessScriptOptions(cli_wand,argc,argv,i+1);
return(argc); /* no more options after script process! */
}
+ /* handle any other special operators now */
CLISpecialOperator(cli_wand,option,arg1);
}
(void) FormatLocaleFile(stderr, "CLI %d Write File: \"%s\"\n", i, option );
#endif
- // if stacks are not empty
- // ThrowConvertException(OptionError,"UnbalancedParenthesis",option,i);
+ /* check that stacks are empty */
+ if (cli_wand->image_list_stack != (Stack *)NULL)
+ CLIWandException(OptionError,"UnbalancedParenthesis", "(eof)");
+ else if (cli_wand->image_info_stack != (Stack *)NULL)
+ CLIWandException(OptionError,"UnbalancedBraces", "(eof)");
+ if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse )
+ return(argc);
- /* This is a valid 'do no write' option for a CLI */
+ /* This is a valid 'do no write' option - no images needed */
if (LocaleCompare(option,"-exit") == 0 )
return(argc); /* just exit, no image write */
- /* If there is an option -- produce an error */
+ /* If filename looks like an option -- produce an error */
if (IsCommandOption(option) != MagickFalse) {
CLIWandException(OptionError,"MissingOutputFilename",option);
return(argc);
}
- /* If no images in MagickCLI */
- if ( cli_wand->wand.images == (Image *) NULL ) {
- /* a "null:" output coder with no images is not an error! */
- if ( LocaleCompare(option,"null:") == 0 )
- return(argc);
- CLIWandException(OptionError,"NoImagesForFinalWrite",option);
- return(argc);
- }
-
-#if 0
- WandListOperatorImages(cli_wand,"-write",option,(const char *)NULL);
-#else
(void) SyncImagesSettings(cli_wand->wand.image_info,cli_wand->wand.images,
cli_wand->wand.exception);
- (void) WriteImages(cli_wand->wand.image_info,cli_wand->wand.images,option,
- cli_wand->wand.exception);
-#endif
+ CLISpecialOperator(cli_wand,"-write",option);
return(argc);
}
\f
/* Initialize special "CLI Wand" to hold images and settings (empty) */
cli_wand=AcquireMagickCLI(image_info,exception);
+ cli_wand->line=1;
GetPathComponent(argv[0],TailPath,cli_wand->wand.name);
ConcatenateMagickString(cli_wand->wand.name,"-CLI",MaxTextExtent);
"The convert is depreciated in IMv7, use \"magick\"\n");*/
}
- /* Special Case: If command name ends with "script" then run it as is
- a "-script" option is implied. This allows you to name the "magick"
- command "magick-script", and create scripts of the form...
- #!/usr/bin/env magick-script
- */
+ /* Special Case: If command name ends with "script" implied "-script" */
if (LocaleCompare("script",argv[0]+strlen(argv[0])-6) == 0) {
GetPathComponent(argv[1],TailPath,cli_wand->wand.name);
ProcessScriptOptions(cli_wand,argc,argv,1);
/* ------------- */
Magick_Command_Cleanup:
- /* recover original image_info from bottom of stack */
+ /* recover original image_info and clean up stacks */
+ while (cli_wand->image_list_stack != (Stack *)NULL)
+ CLISpecialOperator(cli_wand,")",(const char *)NULL);
while (cli_wand->image_info_stack != (Stack *)NULL)
CLISpecialOperator(cli_wand,"}",(const char *)NULL);
option=argv[i];
if ((strlen(option) == 1) || ((*option != '-') && (*option != '+')))
continue;
- if (LocaleCompare("bench",option+1) == 0)
+ if (LocaleCompare("-bench",option) == 0)
iterations=StringToUnsignedLong(argv[++i]);
- if (LocaleCompare("concurrent",option+1) == 0)
+ if (LocaleCompare("-concurrent",option) == 0)
concurrent=MagickTrue;
- if (LocaleCompare("debug",option+1) == 0)
+ if (LocaleCompare("-debug",option) == 0)
(void) SetLogEventMask(argv[++i]);
- if (LocaleCompare("duration",option+1) == 0)
+ if (LocaleCompare("-duration",option) == 0)
duration=StringToDouble(argv[++i],(char **) NULL);
- if (LocaleCompare("regard-warnings",option+1) == 0)
+ if (LocaleCompare("-regard-warnings",option) == 0)
regard_warnings=MagickTrue;
}
if (iterations == 1)
if (k != 0)
clone_images=image_stack[k-1].image;
if (clone_images == (Image *) NULL)
- ThrowMontageException(ImageError,"ImageSequenceRequired",option);
+ ThrowMontageException(ImageError,"UnableToCloneImage",option);
FireImageStack(MagickTrue,MagickTrue,MagickTrue);
if (*option == '+')
clone_images=CloneImages(clone_images,"-1",exception);
}
p=GetImageFromList(_images,index);
q=GetImageFromList(_images,swap_index);
- if ((p == (Image *) NULL) || (q == (Image *) NULL))
- CLIWandExceptArgBreak(OptionError,"NoSuchImage",option,arg1);
+ if ((p == (Image *) NULL) || (q == (Image *) NULL)) {
+ if (IfNormalOp)
+ CLIWandExceptArgBreak(OptionError,"InvalidImageIndex",option,arg1)
+ else
+ CLIWandExceptionBreak(OptionError,"TwoOrMoreImagesRequired",option);
+ }
if (p == q)
- break; /* same image - no-op - not an error */
+ CLIWandExceptArgBreak(OptionError,"InvalidImageIndex",option,arg1);
swap=CloneImage(p,0,0,MagickTrue,_exception);
ReplaceImageInList(&p,CloneImage(q,0,0,MagickTrue,_exception));
ReplaceImageInList(&q,swap);
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
- case 'w':
- {
- if (LocaleCompare("write",option+1) == 0)
- {
- char
- key[MaxTextExtent];
-
- Image
- *write_images;
-
- ImageInfo
- *write_info;
-
- (void) FormatLocaleString(key,MaxTextExtent,"cache:%s",arg1);
- (void) DeleteImageRegistry(key);
- write_images=_images;
- if (IfPlusOp)
- write_images=CloneImageList(_images,_exception);
- write_info=CloneImageInfo(_image_info);
- (void) WriteImages(write_info,write_images,arg1,_exception);
- write_info=DestroyImageInfo(write_info);
- if (IfPlusOp)
- write_images=DestroyImageList(write_images);
- break;
- }
- CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
- }
default:
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
WandExport void CLISpecialOperator(MagickCLI *cli_wand,
const char *option, const char *arg1)
{
-#define _exception (cli_wand->wand.exception)
+#define _image_info (cli_wand->wand.image_info)
+#define _images (cli_wand->wand.images)
+#define _exception (cli_wand->wand.exception)
+#define IfNormalOp (*option=='-')
+#define IfPlusOp (*option!='-')
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == WandSignature);
if (IfMagickTrue(cli_wand->wand.debug))
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",cli_wand->wand.name);
- if(cli_wand->wand.images != (Image *)NULL)
- (void) SyncImagesSettings(cli_wand->wand.image_info,cli_wand->wand.images,
- _exception);
+ if(_images != (Image *)NULL)
+ (void) SyncImagesSettings(cli_wand->wand.image_info,_images,_exception);
/*
No-op options
#if !USE_WAND_METHODS
Image *
new_images;
- if (IfMagickTrue(cli_wand->wand.image_info->ping))
- new_images=PingImages(cli_wand->wand.image_info,argv[i],_exception);
+ if (IfMagickTrue(_image_info->ping))
+ new_images=PingImages(_image_info,argv[i],_exception);
else
- new_images=ReadImages(cli_wand->wand.image_info,argv[i],_exception);
- AppendImageToList(&cli_wand->wand.images, new_images);
+ new_images=ReadImages(_image_info,argv[i],_exception);
+ AppendImageToList(&_images, new_images);
#else
/* read images using MagickWand method - no ping */
/* This is not working! - it locks up in a CPU loop! */
return;
}
+ /*
+ Image Writing
+ */
+ if (LocaleCompare("write",option+1) == 0) {
+ char
+ key[MaxTextExtent];
+
+ Image
+ *write_images;
+
+ ImageInfo
+ *write_info;
+
+ /* Need images, unless a "null:" output coder is used */
+ if ( cli_wand->wand.images == (Image *) NULL ) {
+ if ( LocaleCompare(option,"null:") == 0 )
+ return;
+ CLIWandExceptArgReturn(OptionError,"NoImagesForWrite",option,arg1);
+ }
+
+ (void) FormatLocaleString(key,MaxTextExtent,"cache:%s",arg1);
+ (void) DeleteImageRegistry(key);
+ write_images=_images;
+ if (IfPlusOp)
+ write_images=CloneImageList(_images,_exception);
+ write_info=CloneImageInfo(_image_info);
+ (void) WriteImages(write_info,write_images,arg1,_exception);
+ write_info=DestroyImageInfo(write_info);
+ if (IfPlusOp)
+ write_images=DestroyImageList(write_images);
+ return;
+ }
/*
Parenthesis and Brace operations
*/
if (LocaleCompare("respect-parenthesis",option+1) == 0) {
/* link image and setting stacks - option is itself saved on stack! */
(void) SetImageOption(cli_wand->wand.image_info,option+1,
- *option == '-' ? "true" : (char *) NULL);
+ IfNormalOp ? "true" : (char *) NULL);
return;
}
if (LocaleCompare("(",option) == 0) {
- /* stack 'push' images */
- Stack
- *node;
-
- size_t
- size;
-
- size=0;
- node=cli_wand->image_list_stack;
- for ( ; node != (Stack *)NULL; node=node->next)
- size++;
- if ( size >= MAX_STACK_DEPTH )
- CLIWandExceptionReturn(OptionError,"ParenthesisNestedTooDeeply",option);
- node=(Stack *) AcquireMagickMemory(sizeof(*node));
- if (node == (Stack *) NULL)
- CLIWandExceptionReturn(ResourceLimitFatalError,
- "MemoryAllocationFailed",option);
- node->data = (void *)cli_wand->wand.images;
- cli_wand->wand.images = NewImageList();
- node->next = cli_wand->image_list_stack;
- cli_wand->image_list_stack = node;
-
- /* handle respect-parenthesis */
- if (IfMagickTrue(IsStringTrue(GetImageOption(cli_wand->wand.image_info,
- "respect-parenthesis"))))
- option="{"; /* fall-thru so as to push image settings too */
- else
- return;
- }
+ /* stack 'push' images */
+ Stack
+ *node;
+
+ size_t
+ size;
+
+ size=0;
+ node=cli_wand->image_list_stack;
+ for ( ; node != (Stack *)NULL; node=node->next)
+ size++;
+ if ( size >= MAX_STACK_DEPTH )
+ CLIWandExceptionReturn(OptionError,"ParenthesisNestedTooDeeply",option);
+ node=(Stack *) AcquireMagickMemory(sizeof(*node));
+ if (node == (Stack *) NULL)
+ CLIWandExceptionReturn(ResourceLimitFatalError,
+ "MemoryAllocationFailed",option);
+ node->data = (void *)cli_wand->wand.images;
+ cli_wand->wand.images = NewImageList();
+ node->next = cli_wand->image_list_stack;
+ cli_wand->image_list_stack = node;
+
+ /* handle respect-parenthesis */
+ if (IfMagickTrue(IsStringTrue(GetImageOption(cli_wand->wand.image_info,
+ "respect-parenthesis"))))
+ option="{"; /* fall-thru so as to push image settings too */
+ else
+ return;
+ }
if (LocaleCompare("{",option) == 0) {
- /* stack 'push' of image_info settings */
- Stack
- *node;
-
- size_t
- size;
-
- size=0;
- node=cli_wand->image_info_stack;
- for ( ; node != (Stack *)NULL; node=node->next)
- size++;
- if ( size >= MAX_STACK_DEPTH )
- CLIWandExceptionReturn(OptionError,"CurlyBracesNestedTooDeeply",option);
- node=(Stack *) AcquireMagickMemory(sizeof(*node));
- if (node == (Stack *) NULL)
- CLIWandExceptionReturn(ResourceLimitFatalError,
- "MemoryAllocationFailed",option);
-
- node->data = (void *)cli_wand->wand.image_info;
- cli_wand->wand.image_info = CloneImageInfo(cli_wand->wand.image_info);
- if (cli_wand->wand.image_info == (ImageInfo *)NULL) {
- CLIWandException(ResourceLimitFatalError,"MemoryAllocationFailed",
- option);
- cli_wand->wand.image_info = (ImageInfo *)node->data;
- node = (Stack *)RelinquishMagickMemory(node);
- return;
- }
-
- node->next = cli_wand->image_info_stack;
- cli_wand->image_info_stack = node;
-
+ /* stack 'push' of image_info settings */
+ Stack
+ *node;
+
+ size_t
+ size;
+
+ size=0;
+ node=cli_wand->image_info_stack;
+ for ( ; node != (Stack *)NULL; node=node->next)
+ size++;
+ if ( size >= MAX_STACK_DEPTH )
+ CLIWandExceptionReturn(OptionError,"CurlyBracesNestedTooDeeply",option);
+ node=(Stack *) AcquireMagickMemory(sizeof(*node));
+ if (node == (Stack *) NULL)
+ CLIWandExceptionReturn(ResourceLimitFatalError,
+ "MemoryAllocationFailed",option);
+
+ node->data = (void *)cli_wand->wand.image_info;
+ cli_wand->wand.image_info = CloneImageInfo(cli_wand->wand.image_info);
+ if (cli_wand->wand.image_info == (ImageInfo *)NULL) {
+ CLIWandException(ResourceLimitFatalError,"MemoryAllocationFailed",
+ option);
+ cli_wand->wand.image_info = (ImageInfo *)node->data;
+ node = (Stack *)RelinquishMagickMemory(node);
return;
}
- if (LocaleCompare(")",option) == 0) {
- /* pop images from stack */
- Stack
- *node;
- node = (Stack *)cli_wand->image_list_stack;
- if ( node == (Stack *)NULL)
- CLIWandExceptionReturn(OptionError,"UnbalancedParenthesis",option);
- cli_wand->image_list_stack = node->next;
+ node->next = cli_wand->image_info_stack;
+ cli_wand->image_info_stack = node;
- AppendImageToList((Image **)&node->data,cli_wand->wand.images);
- cli_wand->wand.images= (Image *)node->data;
- node = (Stack *)RelinquishMagickMemory(node);
-
- /* handle respect-parenthesis - of the previous 'pushed' settings */
- node = cli_wand->image_info_stack;
- if ( node != (Stack *)NULL)
- {
- if (IfMagickTrue(IsStringTrue(GetImageOption(
- cli_wand->wand.image_info,"respect-parenthesis"))))
- option="}"; /* fall-thru so as to pop image settings too */
- else
- return;
- }
- else
- return;
- }
+ return;
+ }
+ if (LocaleCompare(")",option) == 0) {
+ /* pop images from stack */
+ Stack
+ *node;
+
+ node = (Stack *)cli_wand->image_list_stack;
+ if ( node == (Stack *)NULL)
+ CLIWandExceptionReturn(OptionError,"UnbalancedParenthesis",option);
+ cli_wand->image_list_stack = node->next;
+
+ AppendImageToList((Image **)&node->data,cli_wand->wand.images);
+ cli_wand->wand.images= (Image *)node->data;
+ node = (Stack *)RelinquishMagickMemory(node);
+
+ /* handle respect-parenthesis - of the previous 'pushed' settings */
+ node = cli_wand->image_info_stack;
+ if ( node != (Stack *)NULL)
+ {
+ if (IfMagickTrue(IsStringTrue(GetImageOption(
+ cli_wand->wand.image_info,"respect-parenthesis"))))
+ option="}"; /* fall-thru so as to pop image settings too */
+ else
+ return;
+ }
+ else
+ return;
+ }
if (LocaleCompare("}",option) == 0) {
- /* pop image_info settings from stack */
- Stack
- *node;
+ /* pop image_info settings from stack */
+ Stack
+ *node;
- node = (Stack *)cli_wand->image_info_stack;
- if ( node == (Stack *)NULL)
- CLIWandExceptionReturn(OptionError,"UnbalancedCurlyBraces",option);
- cli_wand->image_info_stack = node->next;
+ node = (Stack *)cli_wand->image_info_stack;
+ if ( node == (Stack *)NULL)
+ CLIWandExceptionReturn(OptionError,"UnbalancedCurlyBraces",option);
+ cli_wand->image_info_stack = node->next;
- (void) DestroyImageInfo(cli_wand->wand.image_info);
- cli_wand->wand.image_info = (ImageInfo *)node->data;
- node = (Stack *)RelinquishMagickMemory(node);
+ (void) DestroyImageInfo(cli_wand->wand.image_info);
+ cli_wand->wand.image_info = (ImageInfo *)node->data;
+ node = (Stack *)RelinquishMagickMemory(node);
- GetDrawInfo(cli_wand->wand.image_info, cli_wand->draw_info);
- cli_wand->quantize_info=DestroyQuantizeInfo(cli_wand->quantize_info);
- cli_wand->quantize_info=AcquireQuantizeInfo(cli_wand->wand.image_info);
+ GetDrawInfo(cli_wand->wand.image_info, cli_wand->draw_info);
+ cli_wand->quantize_info=DestroyQuantizeInfo(cli_wand->quantize_info);
+ cli_wand->quantize_info=AcquireQuantizeInfo(cli_wand->wand.image_info);
- return;
- }
+ return;
+ }
if (LocaleCompare("clone",option+1) == 0) {
Image
*new_images;
new_images=CloneImages(new_images,arg1,_exception);
if (new_images == (Image *) NULL)
CLIWandExceptionReturn(OptionError,"NoSuchImage",option);
- AppendImageToList(&cli_wand->wand.images,new_images);
+ AppendImageToList(&_images,new_images);
return;
}
/*
Informational Operations
*/
if (LocaleCompare("version",option+1) == 0) {
- (void) FormatLocaleFile(stdout,"Version: %s\n",
- GetMagickVersion((size_t *) NULL));
- (void) FormatLocaleFile(stdout,"Copyright: %s\n",
- GetMagickCopyright());
- (void) FormatLocaleFile(stdout,"Features: %s\n\n",
- GetMagickFeatures());
+ (void) FormatLocaleFile(stdout,"Version: %s\n",
+ GetMagickVersion((size_t *) NULL));
+ (void) FormatLocaleFile(stdout,"Copyright: %s\n",
+ GetMagickCopyright());
+ (void) FormatLocaleFile(stdout,"Features: %s\n\n",
+ GetMagickFeatures());
+ return;
+ }
+ if (LocaleCompare("list",option+1) == 0) {
+ /* FUTURE: This should really be built into the MagickCore
+ It does not actually require a cli-wand or and images!
+ */
+ ssize_t
+ list;
+
+ list=ParseCommandOption(MagickListOptions,MagickFalse,arg1);
+ if ( list < 0 ) {
+ CLIWandExceptionArg(OptionError,"UnrecognizedListType",option,arg1);
return;
}
- if (LocaleCompare("list",option+1) == 0) {
- /* FUTURE: This should really be built into the MagickCore
- It does not actually require any wand or images at all!
- */
- ssize_t
- list;
-
- list=ParseCommandOption(MagickListOptions,MagickFalse,arg1);
- if ( list < 0 ) {
- CLIWandExceptionArg(OptionError,"UnrecognizedListType",option,arg1);
- return;
+ switch (list)
+ {
+ case MagickCoderOptions:
+ {
+ (void) ListCoderInfo((FILE *) NULL,_exception);
+ break;
}
- switch (list)
+ case MagickColorOptions:
{
- case MagickCoderOptions:
- {
- (void) ListCoderInfo((FILE *) NULL,_exception);
- break;
- }
- case MagickColorOptions:
- {
- (void) ListColorInfo((FILE *) NULL,_exception);
- break;
- }
- case MagickConfigureOptions:
- {
- (void) ListConfigureInfo((FILE *) NULL,_exception);
- break;
- }
- case MagickDelegateOptions:
- {
- (void) ListDelegateInfo((FILE *) NULL,_exception);
- break;
- }
- case MagickFontOptions:
- {
- (void) ListTypeInfo((FILE *) NULL,_exception);
- break;
- }
- case MagickFormatOptions:
- (void) ListMagickInfo((FILE *) NULL,_exception);
- break;
- case MagickLocaleOptions:
- (void) ListLocaleInfo((FILE *) NULL,_exception);
- break;
- case MagickLogOptions:
- (void) ListLogInfo((FILE *) NULL,_exception);
- break;
- case MagickMagicOptions:
- (void) ListMagicInfo((FILE *) NULL,_exception);
- break;
- case MagickMimeOptions:
- (void) ListMimeInfo((FILE *) NULL,_exception);
- break;
- case MagickModuleOptions:
- (void) ListModuleInfo((FILE *) NULL,_exception);
- break;
- case MagickPolicyOptions:
- (void) ListPolicyInfo((FILE *) NULL,_exception);
- break;
- case MagickResourceOptions:
- (void) ListMagickResourceInfo((FILE *) NULL,_exception);
- break;
- case MagickThresholdOptions:
- (void) ListThresholdMaps((FILE *) NULL,_exception);
- break;
- default:
- (void) ListCommandOptions((FILE *) NULL,(CommandOption) list,
- _exception);
- break;
+ (void) ListColorInfo((FILE *) NULL,_exception);
+ break;
}
- return;
+ case MagickConfigureOptions:
+ {
+ (void) ListConfigureInfo((FILE *) NULL,_exception);
+ break;
+ }
+ case MagickDelegateOptions:
+ {
+ (void) ListDelegateInfo((FILE *) NULL,_exception);
+ break;
+ }
+ case MagickFontOptions:
+ {
+ (void) ListTypeInfo((FILE *) NULL,_exception);
+ break;
+ }
+ case MagickFormatOptions:
+ (void) ListMagickInfo((FILE *) NULL,_exception);
+ break;
+ case MagickLocaleOptions:
+ (void) ListLocaleInfo((FILE *) NULL,_exception);
+ break;
+ case MagickLogOptions:
+ (void) ListLogInfo((FILE *) NULL,_exception);
+ break;
+ case MagickMagicOptions:
+ (void) ListMagicInfo((FILE *) NULL,_exception);
+ break;
+ case MagickMimeOptions:
+ (void) ListMimeInfo((FILE *) NULL,_exception);
+ break;
+ case MagickModuleOptions:
+ (void) ListModuleInfo((FILE *) NULL,_exception);
+ break;
+ case MagickPolicyOptions:
+ (void) ListPolicyInfo((FILE *) NULL,_exception);
+ break;
+ case MagickResourceOptions:
+ (void) ListMagickResourceInfo((FILE *) NULL,_exception);
+ break;
+ case MagickThresholdOptions:
+ (void) ListThresholdMaps((FILE *) NULL,_exception);
+ break;
+ default:
+ (void) ListCommandOptions((FILE *) NULL,(CommandOption) list,
+ _exception);
+ break;
}
+ return;
+ }
#if 0
- // adjust stack handling
// Other 'special' options this should handle
- // "region" "list" "version"
- // It does not do "exit" however as due to its side-effect requirements
-#endif
-#if 0
+ // "region"
if ( ( process_flags & ProcessUnknownOptionError ) != 0 )
#endif
CLIWandException(OptionError,"UnrecognizedOption",option);
+#undef _image_info
+#undef _images
#undef _exception
+#undef IfNormalOp
+#undef IfPlusOp
}
<message name="ImageDepthNotSupported">
image depth not supported
</message>
- <message name="ImageSequenceRequired">
- image sequence is required
+ <message name="ImageListRequired">
+ image list is required
</message>
<message name="ImageSizeDiffers">
image size differs
geometry does not contain image
</message>
<message name="InvalidUseOfOption">
- invalif use of option
+ invalid use of option
+ </message>
+ <message name="InvalidArgument">
+ invalid argument for option
+ </message>
+ <message name="InvalidGeometry">
+ invalid geometry
+ </message>
+ <message name="InvalidImageIndex">
+ invalid image index
</message>
<message name="ImagesAreNotTheSameSize">
images are not the same size
<message name="ImageWidthsOrHeightsDiffer">
image widths or heights differ
</message>
- <message name="InvalidArgument">
- invalid argument for option
- </message>
- <message name="InvalidGeometry">
- invalid geometry
- </message>
<message name="KernelWidthMustBeAnOddNumber">
kernel width must be an odd number
</message>
<message name="NoClipPathDefined">
no clip path defined
</message>
- <message name="NoImagesDefined">
- no images defined for operation
+ <message name="NoImagesForWrite">
+ no images for write
</message>
- <message name="NoImagesForFinalWrite">
- no images for final write
+ <message name="NoImagesFound">
+ no images found for operation
</message>
<message name="NoImageVectorGraphics">
no image vector graphics
<message name="SubimageSpecificationReturnsNoImages">
subimage specification returns no images
</message>
+ <message name="TwoOrMoreImagesRequired">
+ two or more images required
+ </message>
<message name="UnableToOpenFile">
unable to open file
</message>
<message name="UnableToParseKernel">
unable to parse kernel string
</message>
+ <message name="UnbalancedBraces">
+ unbalanced braces
+ </message>
<message name="UnbalancedParenthesis">
unbalanced parenthesis
</message>
<message name="ImageDepthNotSupported">
profondeur d'image non supportée
</message>
- <message name="ImageSequenceRequired">
- une séquence d'images est requise
+ <message name="ImageListRequired">
+ une liste d'images est requise
</message>
<message name="ImageSizeDiffers">
différences dans la taille de l'image
<message name="InvalidUseOfOption">
Invalide utilisation de l'option
</message>
+ <message name="InvalidArgument">
+ argument invalide pour l'option
+ </message>
+ <message name="InvalidGeometry">
+ géométrie invalide
+ </message>
+ <message name="InvalidImageIndex">
+ index de l'image non valide
+ </message>
<message name="ImagesAreNotTheSameSize">
images diffèrent par la taille
</message>
<message name="ImageWidthsOrHeightsDiffer">
différences dans la hauteur ou la largeur de l'image
</message>
- <message name="InvalidArgument">
- argument invalide pour l'option
- </message>
- <message name="InvalidGeometry">
- géométrie invalide
- </message>
<message name="KernelWidthMustBeAnOddNumber">
la largeur du grain doit être un nombre impair
</message>
<message name="NoClipPathDefined">
pas de chemin de coupe défini
</message>
- <message name="NoImagesDefined">
- pas d'images définies pour un fonctionnement
+ <message name="NoImagesForWrite">
+ pas d'images pour écriture
</message>
- <message name="NoImagesForFinalWrite">
- pas d'images pour écriture finales
+ <message name="NoImagesFound">
+ pas d'image pour un fonctionnement
</message>
<message name="NoImageVectorGraphics">
pas de graphiques vectoriels
<message name="SubimageSpecificationReturnsNoImages">
la spécification de sous-image ne permet pas de fournir des images
</message>
+ <message name="TwoOrMoreImagesRequired">
+ deux ou plusieurs images nécessaires
+ </message>
<message name="UnableToOpenFile">
impossible d'ouvrir le fichier
</message>
<message name="UnableToParseKernel">
impossible d'analyser l'kernel string
</message>
+ <message name="UnbalancedBraces">
+ brace non fermée
+ </message>
<message name="UnbalancedParenthesis">
parenthèse non fermée
</message>