MagickWand 7.1.1-43
Convert, Edit, Or Compose Bitmap Images
Loading...
Searching...
No Matches
wandcli-private.h
1/*
2 Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License. You may
6 obtain a copy of the License at
7
8 https://imagemagick.org/script/license.php
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 ImageMagick pixel wand API.
17*/
18#ifndef MAGICKWAND_WANDCLI_PRIVATE_H
19#define MAGICKWAND_WANDCLI_PRIVATE_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#define CLIWandException(severity,tag,option) \
26 (void) CLIThrowException(cli_wand,GetMagickModule(),severity,tag, \
27 "`%s'",option)
28
29#define CLIWandExceptionArg(severity,tag,option,arg) \
30 { \
31 char *message = GetExceptionMessage(errno); \
32 (void) CLIThrowException(cli_wand,GetMagickModule(),severity,tag, \
33 "'%s' '%s'",option, arg == (char *) NULL ? message : arg); \
34 message=DestroyString(message); \
35 }
36
37#define CLIWandWarnReplaced(message) \
38 if ( (cli_wand->process_flags & ProcessWarnDeprecated) != 0 ) \
39 (void) CLIThrowException(cli_wand,GetMagickModule(),OptionWarning, \
40 "ReplacedOption", "'%s', use \"%s\"",option,message)
41
42#define CLIWandExceptionFile(severity,tag,context) \
43{ char *message=GetExceptionMessage(errno); \
44 (void) CLIThrowException(cli_wand,GetMagickModule(),severity,tag, \
45 "'%s': %s",context,message); \
46 message=DestroyString(message); \
47}
48
49#define CLIWandExceptionBreak(severity,tag,option) \
50 { CLIWandException(severity,tag,option); break; }
51
52#define CLIWandExceptionReturn(severity,tag,option) \
53 { CLIWandException(severity,tag,option); return; }
54
55#define CLIWandExceptArgBreak(severity,tag,option,arg) \
56 { CLIWandExceptionArg(severity,tag,option,arg); break; }
57
58#define CLIWandExceptArgReturn(severity,tag,option,arg) \
59 { CLIWandExceptionArg(severity,tag,option,arg); return; }
60
61
62
63/* Define how options should be processed */
64typedef enum
65{
66 /* General Option Handling */
67 ProcessImplicitRead = 0x0001, /* Non-options are image reads.
68 If not set then skip implied read
69 without producing an error.
70 For use with "mogrify" handling */
71 ProcessInterpretProperties = 0x0010, /* allow general escapes in args */
72
73 /* Special Option Handling */
74 ProcessExitOption = 0x0100, /* allow '-exit' use */
75 ProcessScriptOption = 0x0200, /* allow '-script' use */
76 ProcessReadOption = 0x0400, /* allow '-read' use */
77 ProcessWarnDeprecated = 0x0800, /* warn about deprecated options */
78
79 /* Option Processing Flags */
80 ProcessOneOptionOnly = 0x4000, /* Process one option only */
81 ProcessImplicitWrite = 0x8000, /* Last arg is an implicit write */
82
83 /* Flag Groups for specific Situations */
84 MagickCommandOptionFlags = 0x8FFF, /* Magick Command Flags */
85 ConvertCommandOptionFlags = 0x800F, /* Convert Command Flags */
86 MagickScriptArgsFlags = 0x000F, /* Script CLI Process Args Flags */
87} ProcessOptionFlags;
88
89
90/* Define a generic stack linked list, for pushing and popping
91 user defined ImageInfo settings, and Image lists.
92 See '(' ')' and '-clone' CLI options.
93*/
94typedef struct _CLIStack
95{
96 struct _CLIStack *next;
97 void *data;
98} CLIStack;
99
100/* Note this defines an extension to the normal MagickWand
101 Which adds extra elements specific to the Shell API interface
102 while still allowing the Wand to be passed to MagickWand API
103 for specific operations.
104*/
105struct _MagickCLI /* CLI interface version of MagickWand */
106{
107 struct _MagickWand /* This must be the first structure */
108 wand; /* The Image List and Global Option Settings */
109
110 QuantizeInfo
111 *quantize_info; /* for CLI API usage, not used by MagickWand API */
112
113 DrawInfo
114 *draw_info; /* for CLI API usage, not used by MagickWand API */
115
116 ProcessOptionFlags
117 process_flags; /* When handling CLI, what options do we process? */
118
119 const OptionInfo
120 *command; /* The option entry that is being processed */
121
123 *image_list_stack, /* Stacks of Image Lists and Image Info settings */
124 *image_info_stack;
125
126 const char /* Location of option being processed for exception */
127 *location, /* location format string for exception reports */
128 *filename; /* "CLI", "unknown", or the script filename */
129
130 size_t
131 line, /* location of current option from source */
132 column; /* note: line also used for cli argument count */
133
134 size_t
135 signature;
136};
137
138
139
140#if defined(__cplusplus) || defined(c_plusplus)
141}
142#endif
143
144#endif