Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javafe
Class Options

    java.lang.Object
      javafe.Options

Direct Known Subclasses:
  SrcToolOptions

public class Options
extends java.lang.Object

This is the super-class of classes that hold the values of command-line options. The options are separated from the Main class to improve modularity and to allow the options to be reset during a single execution of the main program. Consequently, none of the options fields should be static. The program may hold a static instance of an Options object if it wishes.

Derived classes should define overriding methods for

- `processOption(String, String[], int)`,
- `showNonOptions()`,
- `showOptions(boolean)`

Field Summary
`boolean` | `assertionsEnabled` Java allows assertions to be enabled and disabled.
`boolean` | `assertIsKeyword` Are we parsing Java 1.4 source code (i.e., we must parse the new "assert" Java keyword).
`java.lang.String` | `currentdir` Option holding the current working directory.
`static java.lang.String` | `eol`
`int` | `fileOrigin`
`java.util.ArrayList` | `inputEntries` Holds all the non-option arguments.
`boolean` | `issueUsage` True if we should simply issue a usage message and abort.
`static int` | `NEVER_BINARY`
`static int` | `NEVER_SOURCE`
`boolean` | `noCautions` Option to turn off caution warnings.
`static int` | `PREFER_BINARY` Flags to use or not use source or binary files.
`static int` | `PREFER_RECENT`
`static int` | `PREFER_SOURCE`
`(package private) java.lang.String[][]` | `privateOptionData`
`(package private) java.lang.String[][]` | `publicOptionData`
`boolean` | `quiet` Option to restrict output to error/caution/warning messages only - no progress or informational output.
`boolean` | `showErrorLocation` Debugging flag used to turn on stack trace dumps when error messages are issued.
`java.lang.String` | `sysPath` Option holding the user-specified boot classpath.
`boolean` | `testMode` When true, no variable output (e.g., execution time) is printed, so that output can be compared to an oracle output file.
`java.lang.String` | `userPath` Option holding the user-specified classpath.
`java.lang.String` | `userSourcePath` Option holding the user-specified sourcepath.
`boolean` | `v` Option to generate lots of output indicating what is happening during execution.

Constructor Summary
`Options()`

Method Summary
`protected void` | `checkMoreArguments(java.lang.String option, java.lang.String[] args, int offset)`
`java.lang.String` | `format(java.lang.String[] sa)`
`void` | `processFileOfArgs(java.lang.String filename)`
`int` | `processOption(java.lang.String option, java.lang.String[] args, int offset)` Process next tool option.
`void` | `processOptions(java.lang.String[] args)` Process tool options contained in `args`.
`protected void` | `processOptionsLoop(java.lang.String[] args)`
`java.lang.String` | `showNonOptions()`
`java.lang.String` | `showOptionArray(java.lang.String[][] data)`
`java.lang.String` | `showOptions(boolean all)` Return option information in a string where each line is preceeded by two blank spaces and followed by a line separator.
`void` | `usage(java.lang.String name)` Print our usage message to `System.err`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### inputEntries

    public java.util.ArrayList inputEntries

  Holds all the non-option arguments.

### quiet

    public boolean quiet

  Option to restrict output to error/caution/warning messages only - no progress or informational output.

### v

    public boolean v

  Option to generate lots of output indicating what is happening during execution.

### testMode

    public boolean testMode

  When true, no variable output (e.g., execution time) is printed, so that output can be compared to an oracle output file. Also, emit all paths for warnings, errors, etc. in canonical, machine-independent form. Such output is strictly used for unit testing. The canonical form of a path replaces all use of the slash ('/') and wack ('\') characters with bar ('|').

### noCautions

    public boolean noCautions

  Option to turn off caution warnings. This is used for Houdini where it is a pain to weed out the cautions from code where we are looking only at warnings.

### currentdir

    public java.lang.String currentdir

  Option holding the current working directory.

### userPath

    public java.lang.String userPath

  Option holding the user-specified classpath.

### userSourcePath

    public java.lang.String userSourcePath

  Option holding the user-specified sourcepath.

### sysPath

    public java.lang.String sysPath

  Option holding the user-specified boot classpath.

### issueUsage

    public boolean issueUsage

  True if we should simply issue a usage message and abort.

### assertIsKeyword

    public boolean assertIsKeyword

  Are we parsing Java 1.4 source code (i.e., we must parse the new "assert" Java keyword).

  Design:
    As Java evolves we'll likely have to change this to an enumeration type.

### assertionsEnabled

    public boolean assertionsEnabled

  Java allows assertions to be enabled and disabled. Replicate those options as well.

### showErrorLocation

    public boolean showErrorLocation

  Debugging flag used to turn on stack trace dumps when error messages are issued. (cf. javafe.util.ErrorSet)

### PREFER_BINARY

    public static final int PREFER_BINARY

  Flags to use or not use source or binary files.

  See Also:
    Constant Field Values

### PREFER_SOURCE

    public static final int PREFER_SOURCE

See Also:
  Constant Field Values

### PREFER_RECENT

    public static final int PREFER_RECENT

See Also:
  Constant Field Values

### NEVER_BINARY

    public static final int NEVER_BINARY

See Also:
  Constant Field Values

### NEVER_SOURCE

    public static final int NEVER_SOURCE

See Also:
  Constant Field Values

### fileOrigin

    public int fileOrigin

### publicOptionData

    final java.lang.String[][] publicOptionData

### privateOptionData

    final java.lang.String[][] privateOptionData

### eol

    public static final java.lang.String eol

Constructor Detail

### Options

    public Options()

Method Detail

### processOptions

    public final void processOptions(java.lang.String[] args)
                              throws UsageError

  Process tool options contained in `args`.

  Parameters:
    `args` - the command-line arguments that are being processed.
  Throws:
    `UsageError` - If the option is erroneous, throw an `UsageError` exception with a string describing the problem.

### processOptionsLoop

    protected final void processOptionsLoop(java.lang.String[] args)
                                     throws UsageError

  Throws:
    `UsageError`

### processOption

    public int processOption(java.lang.String option,
                             java.lang.String[] args,
                             int offset)
                      throws UsageError

  Process next tool option.

  This routine handles the standard front-end options, storing the resulting information in the preceding instance variables and `Info.on`.

  Parameters:
    `option` - the option currently being handled. An option always starts with a '-' character, and the remaining command-line arguments (not counting `option`) (`args[offset]`,...,`args[args.length-1]`).
    `args` - the command-line arguments that are being processed.
    `offset` - the offset into the `args array that indicates which option is currently being dealt with.`
  Returns:
    The offset to any remaining command-line arguments should be returned. (This allows the option to consume some or all of the following arguments.)
  Throws:
    `UsageError` - If the option is erroneous, throw an `UsageError` exception with a string describing the problem.
  Design:
    When this routine is overridden, the new method body should always end with `return super.processOption(option, args, offset)`.

### checkMoreArguments

    protected void checkMoreArguments(java.lang.String option,
                                      java.lang.String[] args,
                                      int offset)
                               throws UsageError

  Throws:
    `UsageError`

### processFileOfArgs

    public void processFileOfArgs(java.lang.String filename)
                           throws UsageError

  Throws:
    `UsageError`

### usage

    public void usage(java.lang.String name)

  Print our usage message to `System.err`.

  Parameters:
    `name` - the name of the tool whose options we are printing.

### showNonOptions

    public java.lang.String showNonOptions()

  Returns:
    non-option usage information in a string.

### showOptions

    public java.lang.String showOptions(boolean all)

  Return option information in a string where each line is preceeded by two blank spaces and followed by a line separator.

  Parameters:
    `all` - if true, then all options are printed, including experimental options; otherwise, just the options expected to be used by standard users are printed.
  Returns:
    a String containing all option information ready for output.
  Usage:
    Each overriding method should first call `super.showOptions()`.

### showOptionArray

    public java.lang.String showOptionArray(java.lang.String[][] data)

### format

    public java.lang.String format(java.lang.String[] sa)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

The ESC/Java2 Project Homepage