2 * File automatically generated by
3 * gengen 1.2 by Lorenzo Bettini
4 * http://www.gnu.org/software/gengen
7 #include "generic_option.h"
10 generic_option_gen_class::generate_generic_option(ostream &stream, unsigned int indent)
12 string indent_str (indent, ' ');
18 generate_string (short_option, stream, indent + indent_str.length ());
20 generate_string (option_comment, stream, indent + indent_str.length ());
24 if (( short_option == "?" ))
28 stream << " if (optopt) /* '?' represents an unrecognized option */";
31 stream << " goto failure;";
39 generate_string (option_comment, stream, indent + indent_str.length ());
43 generate_string (gen_else, stream, indent + indent_str.length ());
44 stream << "if (strcmp (long_options[option_index].name, \"";
45 generate_string (long_option, stream, indent + indent_str.length ());
46 stream << "\") == 0)";
55 stream << " args_info->";
56 generate_string (group_var_name, stream, indent + indent_str.length ());
57 stream << "_mode_counter += 1;";
67 stream << " if (update_multiple_arg_temp(&";
68 generate_string (structure, stream, indent + indent_str.length ());
72 stream << " &(local_args_info.";
73 generate_string (option_var_name, stream, indent + indent_str.length ());
74 stream << "_given), optarg, ";
75 generate_string (possible_values, stream, indent + indent_str.length ());
77 generate_string (default_value, stream, indent + indent_str.length ());
79 generate_string (arg_type, stream, indent + indent_str.length ());
84 generate_string (long_option, stream, indent + indent_str.length ());
86 generate_string (short_option, stream, indent + indent_str.length ());
90 stream << " additional_error))";
93 stream << " goto failure;";
99 stream << " local_args_info.";
100 generate_string (option_var_name, stream, indent + indent_str.length ());
101 stream << "_given++;";
103 stream << indent_str;
105 if (option_has_group)
107 stream << " if (!args_info->";
108 generate_string (option_var_name, stream, indent + indent_str.length ());
111 stream << indent_str;
114 stream << indent_str;
115 stream << " args_info->";
116 generate_string (option_var_name, stream, indent + indent_str.length ());
117 stream << "_group = 1;";
119 stream << indent_str;
120 stream << " args_info->";
121 generate_string (group_var_name, stream, indent + indent_str.length ());
122 stream << "_group_counter += 1;";
124 stream << indent_str;
127 stream << indent_str;
132 if (option_has_group)
134 stream << " if (args_info->";
135 generate_string (group_var_name, stream, indent + indent_str.length ());
136 stream << "_group_counter && override)";
138 stream << indent_str;
139 stream << " reset_group_";
140 generate_string (group_var_name, stream, indent + indent_str.length ());
141 stream << " (args_info);";
143 stream << indent_str;
144 stream << " args_info->";
145 generate_string (group_var_name, stream, indent + indent_str.length ());
146 stream << "_group_counter += 1;";
148 stream << indent_str;
151 stream << indent_str;
152 if (( arg_type == "ARG_FLAG" ))
154 stream << " if (update_arg((void *)&(args_info->";
155 generate_string (option_var_name, stream, indent + indent_str.length ());
156 stream << "_flag), 0, &(args_info->";
157 generate_string (option_var_name, stream, indent + indent_str.length ());
158 stream << "_given),";
160 stream << indent_str;
161 stream << " &(local_args_info.";
162 generate_string (option_var_name, stream, indent + indent_str.length ());
163 stream << "_given), optarg, 0, 0, ";
164 generate_string (arg_type, stream, indent + indent_str.length ());
167 stream << indent_str;
168 stream << " check_ambiguity, override, 1, 0, \"";
169 generate_string (long_option, stream, indent + indent_str.length ());
171 generate_string (short_option, stream, indent + indent_str.length ());
174 stream << indent_str;
175 stream << " additional_error))";
177 stream << indent_str;
178 stream << " goto failure;";
180 stream << indent_str;
184 stream << " if (update_arg(";
185 if (( arg_type == "ARG_NO" ))
191 stream << " (void *)&(args_info->";
192 generate_string (option_var_name, stream, indent + indent_str.length ());
197 stream << indent_str;
200 if (( arg_type == "ARG_NO" ))
206 stream << " &(args_info->";
207 generate_string (option_var_name, stream, indent + indent_str.length ());
210 stream << ", &(args_info->";
211 generate_string (option_var_name, stream, indent + indent_str.length ());
212 stream << "_given),";
215 stream << indent_str;
216 stream << " &(local_args_info.";
217 generate_string (option_var_name, stream, indent + indent_str.length ());
218 stream << "_given), optarg, ";
219 generate_string (possible_values, stream, indent + indent_str.length ());
221 generate_string (default_value, stream, indent + indent_str.length ());
223 generate_string (arg_type, stream, indent + indent_str.length ());
226 stream << indent_str;
227 stream << " check_ambiguity, override, 0, 0,";
229 stream << indent_str;
231 generate_string (long_option, stream, indent + indent_str.length ());
233 generate_string (short_option, stream, indent + indent_str.length ());
236 stream << indent_str;
237 stream << " additional_error))";
239 stream << indent_str;
240 stream << " goto failure;";
242 stream << indent_str;
244 if (( final_instructions != "" ))
248 generate_string (final_instructions, stream, indent + indent_str.length ());
251 stream << indent_str;
254 if (has_short_option)
257 stream << indent_str;
263 stream << indent_str;
266 stream << indent_str;