43#include "EST_String.h"
44#include "EST_io_aux.h"
46#include "EST_cutils.h"
48#include "EST_string_aux.h"
49#include "EST_cmd_line.h"
50#include "EST_Pathname.h"
51#include "EST_Features.h"
71 if ((
al.val(
"-N", 0) !=
"true") &&
72 ((
envname = getenv(
"IA_OP_FILE")) != 0))
73 if (op.
load(getenv(
"IA_OP_FILE")) != read_ok)
77 if (
al.val(
"-c", 0) !=
"")
78 if (op.
load(
al.val(
"-c")) != read_ok)
82 override_lib_ops(op,
al);
84 if (
al.val(
"-ops", 0) ==
"true")
98int parse_command_line(
int argc,
116 est_progname =
argv[0];
119 for (i=1; i <
argc; i++)
123 else if (streq(
argv[i],
"-"))
133 al.add_item(
arg,
"true");
144 arg+
"\" not an int\n");
152 EST_String(
": missing float argument for \"")+
158 arg+
"\" not a float\n");
165 EST_String(
": missing string argument for \"")+
174 EST_String(
": missing ifile argument for \"")+
177 if (writable_file(
argv[i]) == TRUE)
181 EST_String(
": output file not accessible \"")+
188 EST_String(
": missing ifile argument for \"")+
191 if (readable_file(
argv[i]) == TRUE)
208 options.val(
argv[i])+
"\" (misparsed usage string)\n");
213 if (
files.length() == 0)
227 for (p =
options.list.head(); p != 0; p = p->next())
234 else if ((
options.val(p) ==
"<star>") &&
254 ts.set_SingleCharSymbols(
"{}[]|");
255 ts.set_PunctuationSymbols(
"");
256 ts.set_PrePunctuationSymbols(
"");
261 if ((t.string().contains(
"-",0)) &&
262 (t.whitespace().contains(
"\n")))
264 if ((
ts.peek().string() ==
"<string>") ||
265 (
ts.peek().string() ==
"<float>") ||
266 (
ts.peek().string() ==
"<double>") ||
267 (
ts.peek().string() ==
"<ifile>") ||
268 (
ts.peek().string() ==
"<ofile>") ||
269 (
ts.peek().string() ==
"<int>"))
271 options.add_item(t.string(),
ts.get().string());
272 if (
ts.peek().string() ==
"{")
275 al.add_item(t.string(),
ts.get().string());
278 EST_String(
": malformed default value for \"")+
279 t.string()+
"\" (missing closing brace)\n");
282 else if (t.string().contains(
"*"))
283 options.add_item(t.string().before(
"*"),
"<star>");
286 options.add_item(t.string(),
"true");
295 cerr <<
"Type -h for help on options.\n";
304 for (i=1; i <
argc; i++)
306 if (streq(
argv[i],
"-man_options"))
308 output_man_options(
usage);
311 if (streq(
argv[i],
"-sgml_options"))
313 output_sgml_options(
usage);
316 if (streq(
argv[i],
"-sgml_synopsis"))
321 if ((streq(
argv[i],
"-h")) ||
322 (streq(
argv[i],
"-help")) ||
323 (streq(
argv[i],
"-?")) ||
324 (streq(
argv[i],
"--help")))
330 if (((streq(
argv[i],
"-version")) ||
331 (streq(
argv[i],
"--version")))&&
332 (!
usage.contains(
"\n-v")))
334 cout <<
argv[0] <<
": " << est_name <<
" v" << est_tools_version <<
endl;
349 ts.set_SingleCharSymbols(
"{}[]|");
350 ts.set_PunctuationSymbols(
"");
351 ts.set_PrePunctuationSymbols(
"");
356 if ((t.string().contains(
"-",0)) &&
357 (t.whitespace().contains(
"\n")))
359 fprintf(
stdout,
"\n.TP 8\n.BI \"%s \" ",(
const char *)t.string());
360 if ((
ts.peek().string() ==
"<string>") ||
361 (
ts.peek().string() ==
"<float>") ||
362 (
ts.peek().string() ==
"<double>") ||
363 (
ts.peek().string() ==
"<int>"))
365 if ((
ts.peek().string() ==
"{"))
371 if (!
ts.peek().whitespace().contains(
"\n"))
377 if (t.whitespace().contains(
"\n"))
396 ts.set_SingleCharSymbols(
"{}[]|");
397 ts.set_PunctuationSymbols(
"");
398 ts.set_PrePunctuationSymbols(
"");
405 if ((t.string().contains(
"-",0)) &&
406 (t.whitespace().contains(
"\n")))
410 fprintf(
stdout,
"<varlistentry><term>%s</term>\n<LISTITEM><PARA>\n", (
const char *)t.string());
411 if ((
ts.peek().string() ==
"<string>") ||
412 (
ts.peek().string() ==
"<float>") ||
413 (
ts.peek().string() ==
"<ifile>") ||
414 (
ts.peek().string() ==
"<ofile>") ||
415 (
ts.peek().string() ==
"<double>") ||
416 (
ts.peek().string() ==
"<int>"))
422 (
const char *)
atype);
424 if ((
ts.peek().string() ==
"{"))
430 if (!
ts.peek().whitespace().contains(
"\n"))
436 if (t.whitespace().contains(
"\n"))
442 fprintf(
stdout,
"</PARA></LISTITEM>\n</varlistentry>\n</variablelist>\n");
454 ts.set_SingleCharSymbols(
"{}[]|");
455 ts.set_PunctuationSymbols(
"");
456 ts.set_PrePunctuationSymbols(
"");
461 (
const char *)
full.filename());
468 if ((t.string().contains(
"-",0)) &&
469 (t.whitespace().contains(
"\n")))
474 if ((
ts.peek().string() ==
"<string>") ||
475 (
ts.peek().string() ==
"<float>") ||
476 (
ts.peek().string() ==
"<ifile>") ||
477 (
ts.peek().string() ==
"<ofile>") ||
478 (
ts.peek().string() ==
"<double>") ||
479 (
ts.peek().string() ==
"<int>"))
485 (
const char *)
atype);
487 if ((
ts.peek().string() ==
"{"))
504 "-o <ofile> output file" +
505 "-otype <string> output file type\n";
void set(const EST_String &name, int ival)
EST_read_status load(const EST_String &filename, const EST_String &comment=";")
int contains(const char *s, int pos=-1) const
Does it contain this substring?