Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members  

command_line_parsing.h File Reference

This is the interface to provide command line parsing. More...


Compounds

class ValueClass
class StructureValueClass
class StringValueClass
class IntValueClass
class StreamValueClass
class Option
class OptionString
class OptionPrefixString
class OptionMultiString
class OptionInt
class OptionLiteral
class OptionSelection
class OptionList
class OptionLoop
class OptionStream

Defines

#define SUIFKERNEL_COMMANDLINE_PARSING_H

Typedefs

typedef suif_vector<Option*> Options

Enumerations

enum AllowEmpty { DontAllowEmptySelection, AllowEmptySelection }

Functions

Option* build_prefixed_string ( String prefix, String argument, String* storage, String description = emptyString)
A convenient function to create an option tree that matches a literal followed by a string. More...

Option* build_multi_string ( String argument, suif_vector<String> &storage, String description = emptyString)
A convenient function to create an option tree that matches any set of strings. More...


Detailed Description

This is the interface to provide command line parsing.

The system is designed so that a subclass can add additional command line options to the ones defined in a superclass.

The Module::_command_line is an *OptionList which is a class that keeps track of the options for the module.

To add command line parsing to your module, add your options to the Module::_command_line in the initialize() routine.

Here is an example of code for initialize

   // This will add a required field "-f filename"
  Module::initialize();
  _command_line->set_description("This pass constructs the call graph");
  OptionString* _file = new OptionString("-f", &_filename);
  Option *file_option = (new OptionList())->add(_file);
  _command_line->add(file_option);

  file = fopen(_filename.c_str(), "wt");

  \code
  // This will add an optional "-verbose" switch
  Module::initialize();
  _command_line -> set_description("description of the pass");
  _verbose = new OptionLiteral("-verbose");
  OptionSelection *opt = new OptionSelection(true);
  opt->add(_verbose);
  _command_line->add(opt);

  // This will add a required "-bigendian" or "-littleendian" switch
  Module::initialize();
  _command_line -> set_description("description of the pass");
  _bigend = new OptionLiteral("-bigendian");
  _littleend = new OptionLiteral("-littleendian");
  OptionLoop *opt = new OptionSelection();
  opt->add(_bitend);
  opt->add(_littleend);
  _command_line->add(opt);

  // This will add optional "-keep" and "-verbose" switches
  Module::initialize();
  _command_line -> set_description("description of the pass");
  _keep = new OptionLiteral("-keep");
  _verbose = new OptionLiteral("-verbose");
  OptionSelect *select_opt = new OptionSelection();
  select_opt->add(_keep);
  select_opt->add(_verbose);
  OptionLoop *loop_opt = new OptionLoop(select_opt);
  _command_line->add(loop_opt);


Define Documentation

#define SUIFKERNEL_COMMANDLINE_PARSING_H


Typedef Documentation

typedef suif_vector<Option*> Options


Enumeration Type Documentation

enum AllowEmpty

Enumeration values:


Function Documentation

Option * build_prefixed_string (String prefix, String argument, String * storage, String description = emptyString)

A convenient function to create an option tree that matches a literal followed by a string.

E.g. "-I /usr/include".

param prefix - the literal string. param argument - the name of the string argument. param storage - the location to store the string argument. param description - the description of this compound option.

Option * build_multi_string (String argument, suif_vector<String>& storage, String description = emptyString)

A convenient function to create an option tree that matches any set of strings.

e.g. "filename1 filename2 filename3"

param argument - the name of the string argument. param storage - the location to store the string arguments. param description - the description of this compound option.


Generated at Wed Apr 25 17:34:41 2001 for NCI SUIF by doxygen  written by Dimitri van Heesch, © 1997-1999