Jpp  17.2.1-pre0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JShellParser.cc File Reference

Auxiliary program to interface JPARSER::JParser to command line of shell scripts. More...

#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <list>
#include "JLang/JNullType.hh"
#include "JLang/JEquation.hh"
#include "JLang/JEquationFacet.hh"
#include "JLang/JException.hh"
#include "JLang/JRedirectStream.hh"
#include "JLang/JLangToolkit.hh"
#include "JSystem/JSystemToolkit.hh"
#include "Jeep/JParser.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to interface JPARSER::JParser to command line of shell scripts.

Syntax:

  eval JShellParser -o "-a \<environment variable\> [= \<default value\>[, \<possible value\>]]" -- $*

Definition in file JShellParser.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 445 of file JShellParser.cc.

446 {
447  using namespace std;
448  using namespace JPP;
449 
450  try {
451 
452  JEnvironment<bool> boolean;
453  JEnvironment<string> regular;
454 
455  JParser<> zap;
456 
457  zap['b'] = make_field(boolean) = JPARSER::initialised();
458  zap['o'] = make_field(regular) = JPARSER::initialised();
459 
460  const JArgs options = zap(argc, argv);
461 
462  JShellParser<> buffer;
463 
464  buffer.join(boolean);
465  buffer.join(regular);
466 
467  buffer(options);
468 
469  boolean.evaluate();
470  regular.evaluate();
471  }
472  catch(const exception& error) {
473  return gexit(2, error.what());
474  }
475 }
Utility class to parse command line options.
Definition: JParser.hh:1517
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
then usage $script[port]< option > nPossible options
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
Data structure to store command line arguments.
Definition: JArgs.hh:24
int gexit(int status, const std::string &message="")
Exit method.