MagickWand 7.1.2-25
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/license/
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{ \
44 char *message=GetExceptionMessage(errno); \
45 (void) CLIThrowException(cli_wand,GetMagickModule(),severity,tag, \
46 "'%s': %s",context,message); \
47 message=DestroyString(message); \
48}
49
50#define CLIWandExceptionBreak(severity,tag,option) \
51 { CLIWandException(severity,tag,option); break; }
52
53#define CLIWandExceptionReturn(severity,tag,option) \
54 { CLIWandException(severity,tag,option); return; }
55
56#define CLIWandExceptArgBreak(severity,tag,option,arg) \
57 { CLIWandExceptionArg(severity,tag,option,arg); break; }
58
59#define CLIWandExceptArgReturn(severity,tag,option,arg) \
60 { CLIWandExceptionArg(severity,tag,option,arg); return; }
61
62
63
64/* Define how options should be processed */
65typedef enum
66{
67 /* General Option Handling */
68 ProcessImplicitRead = 0x0001, /* Non-options are image reads.
69 If not set then skip implied read
70 without producing an error.
71 For use with "mogrify" handling */
72 ProcessInterpretProperties = 0x0010, /* allow general escapes in args */
73
74 /* Special Option Handling */
75 ProcessExitOption = 0x0100, /* allow '-exit' use */
76 ProcessScriptOption = 0x0200, /* allow '-script' use */
77 ProcessReadOption = 0x0400, /* allow '-read' use */
78 ProcessWarnDeprecated = 0x0800, /* warn about deprecated options */
79
80 /* Option Processing Flags */
81 ProcessOneOptionOnly = 0x4000, /* Process one option only */
82 ProcessImplicitWrite = 0x8000, /* Last arg is an implicit write */
83
84 /* Flag Groups for specific Situations */
85 MagickCommandOptionFlags = 0x8FFF, /* Magick Command Flags */
86 ConvertCommandOptionFlags = 0x800F, /* Convert Command Flags */
87 MagickScriptArgsFlags = 0x000F, /* Script CLI Process Args Flags */
88} ProcessOptionFlags;
89
90
91/* Define a generic stack linked list, for pushing and popping
92 user defined ImageInfo settings, and Image lists.
93 See '(' ')' and '-clone' CLI options.
94*/
95typedef struct _CLIStack
96{
97 struct _CLIStack *next;
98 void *data;
99} CLIStack;
100
101/* Note this defines an extension to the normal MagickWand
102 Which adds extra elements specific to the Shell API interface
103 while still allowing the Wand to be passed to MagickWand API
104 for specific operations.
105*/
106struct _MagickCLI /* CLI interface version of MagickWand */
107{
108 struct _MagickWand /* This must be the first structure */
109 wand; /* The Image List and Global Option Settings */
110
111 QuantizeInfo
112 *quantize_info; /* for CLI API usage, not used by MagickWand API */
113
114 DrawInfo
115 *draw_info; /* for CLI API usage, not used by MagickWand API */
116
117 ProcessOptionFlags
118 process_flags; /* When handling CLI, what options do we process? */
119
120 const OptionInfo
121 *command; /* The option entry that is being processed */
122
123 CLIStack
124 *image_list_stack, /* Stacks of Image Lists and Image Info settings */
125 *image_info_stack;
126
127 const char /* Location of option being processed for exception */
128 *location, /* location format string for exception reports */
129 *filename; /* "CLI", "unknown", or the script filename */
130
131 size_t
132 line, /* location of current option from source */
133 column; /* note: line also used for cli argument count */
134
135 size_t
136 signature;
137};
138
139
140
141#if defined(__cplusplus) || defined(c_plusplus)
142}
143#endif
144
145#endif