]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authoranthony <anthony@git.imagemagick.org>
Mon, 9 Apr 2012 04:02:09 +0000 (04:02 +0000)
committeranthony <anthony@git.imagemagick.org>
Mon, 9 Apr 2012 04:02:09 +0000 (04:02 +0000)
MagickWand/magick-cli.c
MagickWand/operation.c
MagickWand/operation.h
Makefile.in

index a4fa67dea8298592fd4db6cce66579c80647b214..5dd11e8e71e37cd16a800cb6e52bbe56e730d197 100644 (file)
@@ -325,7 +325,7 @@ WandExport void ProcessScriptOptions(MagickCLI *cli_wand,int argc,char **argv,
     }
 
     if ( (option_type & SettingOptionFlags) != 0 ) {
-      CLISettingOptionInfo(cli_wand, option, arg1);
+      CLISettingOptionInfo(cli_wand, option, arg1, arg2);
       // FUTURE: Sync Specific Settings into Image Properities (not global)
     }
     if ( cli_wand->wand.images != (Image *)NULL )
@@ -551,7 +551,7 @@ WandExport int ProcessCommandOptions(MagickCLI *cli_wand, int argc,
     }
 
     if ( (option_type & SettingOptionFlags) != 0 ) {
-      CLISettingOptionInfo(cli_wand, option, arg1);
+      CLISettingOptionInfo(cli_wand, option, arg1, arg2);
       // FUTURE: Sync individual Settings into images (no SyncImageSettings())
     }
     if ( cli_wand->wand.images != (Image *)NULL )
@@ -655,14 +655,37 @@ next_argument:
 
 static void MagickUsage(MagickBooleanType verbose)
 {
-  (void) FormatLocaleFile(stdout,
-       "Usage: %s [{option}|{image}...] {output_image}\n",GetClientName());
-  (void) FormatLocaleFile(stdout,
+  const char
+    *name;
+
+  size_t
+    len;
+
+  name=GetClientName();
+  len=strlen(name);
+
+  if (len>=6 && LocaleCompare("script",name+len-6) == 0) {
+    /* magick-script usage */
+    (void) FormatLocaleFile(stdout,
+       "Usage: %s {filename} [{script_args}...]\n",name);
+  }
+  else if (len>=7 && LocaleCompare("convert",name+len-7) == 0) {
+    /* convert usage */
+    (void) FormatLocaleFile(stdout,
+       "Usage: %s [{option}|{image}...] {output_image}\n",name);
+    (void) FormatLocaleFile(stdout,
+       "       %s -help|-version|-usage|-list {option}\n",name);
+  }
+  else {
+    /* magick usage */
+    (void) FormatLocaleFile(stdout,
+       "Usage: %s [{option}|{image}...] {output_image}\n",name);
+    (void) FormatLocaleFile(stdout,
        "       %s [{option}|{image}...] -script {filename} [{script_args}...]\n",
-       GetClientName());
-  (void) FormatLocaleFile(stdout,
-       "       %s -help|-version|-usage|-list {option}\n",
-       GetClientName());
+       name);
+    (void) FormatLocaleFile(stdout,
+       "       %s -help|-version|-usage|-list {option}\n",name);
+  }
 
   if (IfMagickFalse(verbose))
     return;
@@ -739,6 +762,9 @@ WandExport MagickBooleanType MagickImageCommand(ImageInfo *image_info,
   const char
     *option;
 
+  size_t
+    len;
+
   ProcessOptionFlags
     process_flags = MagickCommandOptionFlags;
 
@@ -757,22 +783,25 @@ WandExport MagickBooleanType MagickImageCommand(ImageInfo *image_info,
   cli_wand->line=1;
 
   GetPathComponent(argv[0],TailPath,cli_wand->wand.name);
+  SetClientName(cli_wand->wand.name);
   ConcatenateMagickString(cli_wand->wand.name,"-CLI",MaxTextExtent);
 
+  len=strlen(argv[0]);  /* precaution */
+
   /* "convert" command - give a "depreciation" warning" */
-  if ( (LocaleCompare("convert",argv[0]+strlen((argv[0])-7)) == 0) ||
-       (LocaleNCompare("convert",argv[0],7) == 0) ||
-       (LocaleNCompare("lt-convert",argv[0],10) == 0) ) {
+  if (len>=7 && LocaleCompare("convert",argv[0]+len-7) == 0) {
     process_flags = ConvertCommandOptionFlags;
     /*(void) FormatLocaleFile(stderr,"WARNING: %s\n",
              "The convert is depreciated in IMv7, use \"magick\"\n");*/
   }
 
   /* 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);
-    goto Magick_Command_Cleanup;
+  if (len>=6 && LocaleCompare("script",argv[0]+len-6) == 0) {
+    if (argc >= 2 && *(argv[1]) != '-') {
+      GetPathComponent(argv[1],TailPath,cli_wand->wand.name);
+      ProcessScriptOptions(cli_wand,argc,argv,1);
+      goto Magick_Command_Cleanup;
+    }
   }
 
   /* Special Case: Version Information and Abort */
index 69c73480e3eef21a742d6e9fad0179829c751b00..e59ac6523c167090a45f15b0e377d2784bad6172 100644 (file)
@@ -148,6 +148,7 @@ static inline Image *GetImageCache(const ImageInfo *image_info,const char *path,
   return(image);
 }
 
+#if 0
 /*
   FloatListOption() converts a string option of space or comma seperated
   numbers into a list of floating point numbers, required by some operations.
@@ -168,6 +169,7 @@ static MagickBooleanType FloatListOption(const char *option,
     x;
 
 }
+#endif
 
 /*
   SparseColorOption() parse the complex -sparse-color argument into an
@@ -398,7 +400,7 @@ static Image *SparseColorOption(const Image *image,
 %  The format of the CLISettingOptionInfo method is:
 %
 %    void CLISettingOptionInfo(MagickCLI *cli_wand,
-%               const char *option, const char *arg1)
+%               const char *option, const char *arg1, const char *arg2)
 %
 %  A description of each parameter follows:
 %
@@ -406,13 +408,14 @@ static Image *SparseColorOption(const Image *image,
 %
 %    o option: The option string to be set
 %
-%    o arg1: The single argument used to set this option.
+%    o arg1, arg2: optional argument strings to the operation
+%        arg2 is currently only used by "-limit"
 %
 % Example usage...
 %
-%    CLISettingOptionInfo(cli_wand, "-background", "Red");  // set value
-%    CLISettingOptionInfo(cli_wand, "-adjoin", NULL);       // set boolean
-%    CLISettingOptionInfo(cli_wand, "+adjoin", NULL);       // unset
+%    CLISettingOptionInfo(cli_wand, "-background", "Red", NULL); // set value
+%    CLISettingOptionInfo(cli_wand, "-adjoin", NULL, NULL);      // set boolean
+%    CLISettingOptionInfo(cli_wand, "+adjoin", NULL, NULL);      // unset
 %
 % Or for handling command line arguments EG: +/-option ["arg1"]
 %
@@ -425,12 +428,13 @@ static Image *SparseColorOption(const Image *image,
 %
 %    if ( (option_type & SettingOperatorOptionFlags) != 0 )
 %      CLISettingOptionInfo(cli_wand, argv[i],
-%                   (count>0) ? argv[i+1] : (char *)NULL);
+%                   (count>=1) ? argv[i+1] : (char *)NULL,
+%                   (count>=2) ? argv[i+2] : (char *)NULL);
 %    i += count+1;
 %
 */
 WandExport void CLISettingOptionInfo(MagickCLI *cli_wand,
-     const char *option,const char *arg1)
+     const char *option,const char *arg1, const char *arg2)
 {
   ssize_t
     parse;     /* option argument parsing (string to value table lookup) */
@@ -569,7 +573,7 @@ WandExport void CLISettingOptionInfo(MagickCLI *cli_wand,
       if (LocaleCompare("box",option+1) == 0)
         {
           /* DEPRECIATED - now "undercolor" */
-          CLISettingOptionInfo(cli_wand,"undercolor",arg1);
+          CLISettingOptionInfo(cli_wand,"undercolor",arg1, arg2);
           break;
         }
       CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
@@ -1227,6 +1231,7 @@ WandExport void CLISettingOptionInfo(MagickCLI *cli_wand,
           break;
         }
       if (LocaleCompare("regard-warnings",option+1) == 0)
+        /* FUTURE: to be replaced by a 'fatal-level' type setting */
         break;
       if (LocaleCompare("render",option+1) == 0)
         {
@@ -3580,8 +3585,7 @@ WandExport void CLISimpleOperatorImages(MagickCLI *cli_wand,
 %    o option:  The option string for the operation
 %
 %    o arg1, arg2: optional argument strings to the operation
-%
-% NOTE: only "limit" uses two arguments.
+%        arg2 is currently not used
 %
 % Example usage...
 %
@@ -3606,7 +3610,7 @@ WandExport void CLISimpleOperatorImages(MagickCLI *cli_wand,
 %
 */
 WandExport void CLIListOperatorImages(MagickCLI *cli_wand,
-     const char *option,const char *arg1, const char *arg2)
+     const char *option,const char *arg1, const char *magick_unused(arg2))
 {
   ssize_t
     parse;
@@ -3714,12 +3718,8 @@ WandExport void CLIListOperatorImages(MagickCLI *cli_wand,
               MagickFalse,value);
 
           /* Get "clip-to-self" expert setting (false is normal) */
-          value=GetImageOption(_image_info,"compose:clip-to-self");
-          if (value == (const char *) NULL)
-            clip_to_self=MagickTrue;
-          else
-            clip_to_self=IsStringTrue(GetImageOption(_image_info,
-              "compose:clip-to-self"));       /* if this is true */
+          clip_to_self=IsStringTrue(GetImageOption(_image_info,
+                "compose:clip-to-self"));       /* if this is true */
           value=GetImageOption(_image_info,"compose:outside-overlay");
           if (value != (const char *) NULL) {   /* or this false */
             /* FUTURE: depreciate warning for "compose:outside-overlay"*/
index d0908c1150c1c27b480245b8a044f5745b682dc1..6726ec874b82032ab9c8cbf544159eee94ac67bc 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
 #endif
 
 extern WandExport void
-  CLISettingOptionInfo(MagickCLI *,const char *,const char *),
+  CLISettingOptionInfo(MagickCLI *,const char *,const char *, const char *),
   CLISimpleOperatorImages(MagickCLI *,const char *,const char *,const char *),
   CLIListOperatorImages(MagickCLI *, const char *,const char *,const char *),
   CLISpecialOperator(MagickCLI *,const char *,const char *);
index fe8868f661e90b9b4c77bafa5b1e360b28295fef..6ff047753ac7cd99055080897cf364664f9af6c5 100644 (file)
@@ -770,6 +770,7 @@ am__objects_18 = MagickWand/MagickWand_libMagickWand_la-animate.lo \
        MagickWand/MagickWand_libMagickWand_la-script-token.lo \
        MagickWand/MagickWand_libMagickWand_la-stream.lo \
        MagickWand/MagickWand_libMagickWand_la-wand.lo \
+       MagickWand/MagickWand_libMagickWand_la-wandcli.lo \
        MagickWand/MagickWand_libMagickWand_la-wand-view.lo
 am_MagickWand_libMagickWand_la_OBJECTS = $(am__objects_18)
 MagickWand_libMagickWand_la_OBJECTS =  \
@@ -4430,6 +4431,9 @@ MAGICKWAND_SOURCES = \
        MagickWand/studio.h \
        MagickWand/wand.c \
        MagickWand/wand.h \
+       MagickWand/wandcli.c \
+       MagickWand/wandcli.h \
+       MagickWand/wandcli-private.h \
        MagickWand/wand-view.c \
        MagickWand/wand-view.h 
 
@@ -4455,16 +4459,17 @@ MAGICKWAND_INCLUDE_HDRS = \
        MagickWand/pixel-iterator.h \
        MagickWand/pixel-wand.h \
        MagickWand/stream.h \
+       MagickWand/wandcli.h
        MagickWand/wand-view.h
 
 MAGICKWAND_NOINST_HDRS = \
        MagickWand/mogrify-private.h \
        MagickWand/magick-wand-private.h \
-       MagickWand/operation-private.h \
        MagickWand/pixel-wand-private.h \
        MagickWand/script-token.h \
        MagickWand/studio.h \
        MagickWand/wand.h
+       MagickWand/wandcli-private.h
 
 
 # Headers which are installed
@@ -5817,6 +5822,9 @@ MagickWand/MagickWand_libMagickWand_la-stream.lo:  \
 MagickWand/MagickWand_libMagickWand_la-wand.lo:  \
        MagickWand/$(am__dirstamp) \
        MagickWand/$(DEPDIR)/$(am__dirstamp)
+MagickWand/MagickWand_libMagickWand_la-wandcli.lo:  \
+       MagickWand/$(am__dirstamp) \
+       MagickWand/$(DEPDIR)/$(am__dirstamp)
 MagickWand/MagickWand_libMagickWand_la-wand-view.lo:  \
        MagickWand/$(am__dirstamp) \
        MagickWand/$(DEPDIR)/$(am__dirstamp)
@@ -6940,6 +6948,8 @@ mostlyclean-compile:
        -rm -f MagickWand/MagickWand_libMagickWand_la-wand-view.lo
        -rm -f MagickWand/MagickWand_libMagickWand_la-wand.$(OBJEXT)
        -rm -f MagickWand/MagickWand_libMagickWand_la-wand.lo
+       -rm -f MagickWand/MagickWand_libMagickWand_la-wandcli.$(OBJEXT)
+       -rm -f MagickWand/MagickWand_libMagickWand_la-wandcli.lo
        -rm -f MagickWand/drawtest.$(OBJEXT)
        -rm -f MagickWand/wandtest.$(OBJEXT)
        -rm -f coders/MagickCore_libMagickCore_la-aai.$(OBJEXT)
@@ -9553,6 +9563,13 @@ MagickWand/MagickWand_libMagickWand_la-wand.lo: MagickWand/wand.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MagickWand_libMagickWand_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o MagickWand/MagickWand_libMagickWand_la-wand.lo `test -f 'MagickWand/wand.c' || echo '$(srcdir)/'`MagickWand/wand.c
 
+MagickWand/MagickWand_libMagickWand_la-wandcli.lo: MagickWand/wandcli.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MagickWand_libMagickWand_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT MagickWand/MagickWand_libMagickWand_la-wandcli.lo -MD -MP -MF MagickWand/$(DEPDIR)/MagickWand_libMagickWand_la-wandcli.Tpo -c -o MagickWand/MagickWand_libMagickWand_la-wandcli.lo `test -f 'MagickWand/wandcli.c' || echo '$(srcdir)/'`MagickWand/wandcli.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) MagickWand/$(DEPDIR)/MagickWand_libMagickWand_la-wandcli.Tpo MagickWand/$(DEPDIR)/MagickWand_libMagickWand_la-wandcli.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='MagickWand/wandcli.c' object='MagickWand/MagickWand_libMagickWand_la-wandcli.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MagickWand_libMagickWand_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o MagickWand/MagickWand_libMagickWand_la-wandcli.lo `test -f 'MagickWand/wandcli.c' || echo '$(srcdir)/'`MagickWand/wandcli.c
+
 MagickWand/MagickWand_libMagickWand_la-wand-view.lo: MagickWand/wand-view.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MagickWand_libMagickWand_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT MagickWand/MagickWand_libMagickWand_la-wand-view.lo -MD -MP -MF MagickWand/$(DEPDIR)/MagickWand_libMagickWand_la-wand-view.Tpo -c -o MagickWand/MagickWand_libMagickWand_la-wand-view.lo `test -f 'MagickWand/wand-view.c' || echo '$(srcdir)/'`MagickWand/wand-view.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) MagickWand/$(DEPDIR)/MagickWand_libMagickWand_la-wand-view.Tpo MagickWand/$(DEPDIR)/MagickWand_libMagickWand_la-wand-view.Plo