Jpp  18.2.1
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 452 of file JShellParser.cc.

453 {
454  using namespace std;
455  using namespace JPP;
456 
457  try {
458 
459  JEnvironment<bool> boolean;
460  JEnvironment<string> regular;
461 
462  JParser<> zap;
463 
464  zap['b'] = make_field(boolean) = JPARSER::initialised();
465  zap['o'] = make_field(regular) = JPARSER::initialised();
466 
467  const JArgs options = zap(argc, argv);
468 
469  JShellParser<> buffer;
470 
471  buffer.join(boolean);
472  buffer.join(regular);
473 
474  buffer(options);
475 
476  boolean.evaluate();
477  regular.evaluate();
478  }
479  catch(const exception& error) {
480  return gexit(2, error.what());
481  }
482 }
Utility class to parse command line options.
Definition: JParser.hh:1514
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:1989
Data structure to store command line arguments.
Definition: JArgs.hh:24
int gexit(int status, const std::string &message="")
Exit method.