wandcli-private.h

Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization
00003   dedicated to making software imaging solutions freely available.
00004 
00005   You may not use this file except in compliance with the License.  You may
00006   obtain a copy of the License at
00007 
00008     https://imagemagick.org/script/license.php
00009 
00010   Unless required by applicable law or agreed to in writing, software
00011   distributed under the License is distributed on an "AS IS" BASIS,
00012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013   See the License for the specific language governing permissions and
00014   limitations under the License.
00015 
00016   ImageMagick pixel wand API.
00017 */
00018 #ifndef MAGICKWAND_WANDCLI_PRIVATE_H
00019 #define MAGICKWAND_WANDCLI_PRIVATE_H
00020 
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024 
00025 #define CLIWandException(severity,tag,option) \
00026   (void) CLIThrowException(cli_wand,GetMagickModule(),severity,tag, \
00027        "`%s'",option)
00028 
00029 #define CLIWandExceptionArg(severity,tag,option,arg) \
00030   (void) CLIThrowException(cli_wand,GetMagickModule(),severity,tag, \
00031        "'%s' '%s'",option, arg)
00032 
00033 #define CLIWandWarnReplaced(message) \
00034   if ( (cli_wand->process_flags & ProcessWarnDeprecated) != 0 ) \
00035     (void) CLIThrowException(cli_wand,GetMagickModule(),OptionWarning, \
00036        "ReplacedOption", "'%s', use \"%s\"",option,message)
00037 
00038 #define CLIWandExceptionFile(severity,tag,context) \
00039 { char *message=GetExceptionMessage(errno); \
00040   (void) CLIThrowException(cli_wand,GetMagickModule(),severity,tag, \
00041        "'%s': %s",context,message); \
00042   message=DestroyString(message); \
00043 }
00044 
00045 #define CLIWandExceptionBreak(severity,tag,option) \
00046   { CLIWandException(severity,tag,option); break; }
00047 
00048 #define CLIWandExceptionReturn(severity,tag,option) \
00049   { CLIWandException(severity,tag,option); return; }
00050 
00051 #define CLIWandExceptArgBreak(severity,tag,option,arg) \
00052   { CLIWandExceptionArg(severity,tag,option,arg); break; }
00053 
00054 #define CLIWandExceptArgReturn(severity,tag,option,arg) \
00055   { CLIWandExceptionArg(severity,tag,option,arg); return; }
00056 
00057 
00058 
00059 /* Define how options should be processed */
00060 typedef enum
00061 {
00062   /* General Option Handling */
00063   ProcessImplictRead          = 0x0001,  /* Non-options are image reads.
00064                                             If not set then skip implied read
00065                                             without producing an error.
00066                                             For use with "mogrify" handling */
00067   ProcessInterpretProperities = 0x0010,  /* allow general escapes in args */
00068 
00069   /* Special Option Handling */
00070   ProcessExitOption           = 0x0100,  /* allow '-exit' use */
00071   ProcessScriptOption         = 0x0200,  /* allow '-script' use */
00072   ProcessReadOption           = 0x0400,  /* allow '-read' use */
00073   ProcessWarnDeprecated       = 0x0800,  /* warn about deprecated options */
00074 
00075   /* Option Processing Flags */
00076   ProcessOneOptionOnly        = 0x4000,  /* Process one option only */
00077   ProcessImplictWrite         = 0x8000,  /* Last arg is an implict write */
00078 
00079   /* Flag Groups for specific Situations */
00080   MagickCommandOptionFlags    = 0x8FFF,  /* Magick Command Flags */
00081   ConvertCommandOptionFlags   = 0x800F,  /* Convert Command Flags */
00082   MagickScriptArgsFlags       = 0x000F,  /* Script CLI Process Args Flags */
00083 } ProcessOptionFlags;
00084 
00085 
00086 /* Define a generic stack linked list, for pushing and popping
00087    user defined ImageInfo settings, and Image lists.
00088    See '(' ')' and '-clone' CLI options.
00089 */
00090 typedef struct _Stack
00091 {
00092   struct _Stack  *next;
00093   void           *data;
00094 } Stack;
00095 
00096 /* Note this defines an extension to the normal MagickWand
00097    Which adds extra elements specific to the Shell API interface
00098    while still allowing the Wand to be passed to MagickWand API
00099    for specific operations.
00100 */
00101 struct _MagickCLI       /* CLI interface version of MagickWand */
00102 {
00103   struct _MagickWand    /* This must be the first structure */
00104      wand;              /* The Image List and Global Option Settings */
00105 
00106   QuantizeInfo
00107     *quantize_info;     /* for CLI API usage, not used by MagickWand API */
00108 
00109   DrawInfo
00110     *draw_info;         /* for CLI API usage, not used by MagickWand API */
00111 
00112   ProcessOptionFlags
00113     process_flags;      /* When handling CLI, what options do we process? */
00114 
00115   const OptionInfo
00116     *command;           /* The option entry that is being processed */
00117 
00118   Stack
00119     *image_list_stack,  /* Stacks of Image Lists and Image Info settings */
00120     *image_info_stack;
00121 
00122   const char            /* Location of option being processed for exception */
00123     *location,          /* location format string for exception reports */
00124     *filename;          /* "CLI", "unknown", or the script filename */
00125 
00126   size_t
00127     line,               /* location of current option from source */
00128     column;             /* note: line also used for cli argument count */
00129 
00130   size_t
00131     signature;
00132 };
00133 
00134 
00135 
00136 #if defined(__cplusplus) || defined(c_plusplus)
00137 }
00138 #endif
00139 
00140 #endif

Generated on 22 Jul 2019 for MagickWand by  doxygen 1.6.1