polyglot.main
Class Options

java.lang.Object
  extended by polyglot.main.Options

public class Options
extends java.lang.Object

This object encapsulates various polyglot options.


Field Summary
 boolean assertions
           
 java.lang.String bootclasspath
           
 java.lang.String classpath
           
 java.lang.String default_classpath
           
 java.util.Set disable_passes
          Disable the following passes?
 java.util.Set dump_ast
          Dump the AST after the following passes?
 int error_count
           
protected  ExtensionInfo extension
          Back pointer to the extension that owns this options
 boolean fully_qualified_names
           
static Options global
          An annoying hack to allow objects to get their hands on the Options object.
 boolean keep_output_files
          keep output files
 java.io.File output_directory
           
 java.lang.String output_ext
           
 boolean output_stdout
           
 int output_width
           
 java.lang.String post_compiler
           
 java.util.Set print_ast
          Pretty-print the AST after the following passes?
 boolean serialize_type_info
          Inject type information in serialized form into output file?
 java.lang.String[] source_ext
           
 java.util.Collection source_path
           
protected  int USAGE_FLAG_WIDTH
          The number of spaces from the left that the descriptions for flags will be displayed.
protected  int USAGE_SCREEN_WIDTH
          The maximum width of a line when printing usage information.
protected  int USAGE_SUBSECTION_INDENT
          The number of spaces to indent a subsection of usage information.
 
Constructor Summary
Options(ExtensionInfo extension)
          Constructor
 
Method Summary
 java.lang.String constructFullClasspath()
           
 java.lang.String constructPostCompilerClasspath()
           
 boolean cppBackend()
          HACK: This method really, for cleanliness, should not exist.
protected  int parseCommand(java.lang.String[] args, int index, java.util.Set source)
          Parse a command
 void parseCommandLine(java.lang.String[] args, java.util.Set source)
          Parse the command line
protected static void printSpaces(java.io.PrintStream out, int n)
          Utility method to print a number of spaces to a PrintStream.
 void setDefaultValues()
          Set default values for options
 void usage(java.io.PrintStream out)
          Print usage information
protected  void usageForFlag(java.io.PrintStream out, java.lang.String flag, java.lang.String description)
          Output a flag and a description of its usage in a nice format.
protected  void usageSubsection(java.io.PrintStream out, java.lang.String text)
          Output a section of text for usage information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

global

public static Options global
An annoying hack to allow objects to get their hands on the Options object. This should be fixed. XXX###@@@


extension

protected ExtensionInfo extension
Back pointer to the extension that owns this options


error_count

public int error_count

source_path

public java.util.Collection source_path

output_directory

public java.io.File output_directory

default_classpath

public java.lang.String default_classpath

classpath

public java.lang.String classpath

bootclasspath

public java.lang.String bootclasspath

assertions

public boolean assertions

source_ext

public java.lang.String[] source_ext

output_ext

public java.lang.String output_ext

output_stdout

public boolean output_stdout

post_compiler

public java.lang.String post_compiler

output_width

public int output_width

fully_qualified_names

public boolean fully_qualified_names

serialize_type_info

public boolean serialize_type_info
Inject type information in serialized form into output file?


dump_ast

public java.util.Set dump_ast
Dump the AST after the following passes?


print_ast

public java.util.Set print_ast
Pretty-print the AST after the following passes?


disable_passes

public java.util.Set disable_passes
Disable the following passes?


keep_output_files

public boolean keep_output_files
keep output files


USAGE_SCREEN_WIDTH

protected int USAGE_SCREEN_WIDTH
The maximum width of a line when printing usage information. Used by usageForFlag and usageSubsection.


USAGE_FLAG_WIDTH

protected int USAGE_FLAG_WIDTH
The number of spaces from the left that the descriptions for flags will be displayed. Used by usageForFlag.


USAGE_SUBSECTION_INDENT

protected int USAGE_SUBSECTION_INDENT
The number of spaces to indent a subsection of usage information. Used by usageSubsection.

Constructor Detail

Options

public Options(ExtensionInfo extension)
Constructor

Method Detail

cppBackend

public boolean cppBackend()
HACK: This method really, for cleanliness, should not exist. But the Translator class has inextricably linked with C++ code generation that needs to know if the C++ backend has been enabled. This, however, is a JMatch option, defined in the ext.jmatch.JMatchOptions class. I suppose Translator should really be forked out into two translators, one that handles C++ translation, and one that's purely for Java. But in the interim to get the 1.1.4 version released, this will have to suffice. Sorry! (ak333)

Returns:

setDefaultValues

public void setDefaultValues()
Set default values for options


parseCommandLine

public void parseCommandLine(java.lang.String[] args,
                             java.util.Set source)
                      throws UsageError
Parse the command line

Throws:
UsageError - if the usage is incorrect.

parseCommand

protected int parseCommand(java.lang.String[] args,
                           int index,
                           java.util.Set source)
                    throws UsageError,
                           Main.TerminationException
Parse a command

Returns:
the next index to process. i.e., if calling this method processes two commands, then the return value should be index+2
Throws:
UsageError
Main.TerminationException

usage

public void usage(java.io.PrintStream out)
Print usage information


usageForFlag

protected void usageForFlag(java.io.PrintStream out,
                            java.lang.String flag,
                            java.lang.String description)
Output a flag and a description of its usage in a nice format. This makes it easier for extensions to output their usage in a consistent format.

Parameters:
out - output PrintStream
flag -
description - description of the flag.

usageSubsection

protected void usageSubsection(java.io.PrintStream out,
                               java.lang.String text)
Output a section of text for usage information. This text will be displayed indented a certain amount from the left, controlled by the field USAGE_SUBSECTION_INDENT

Parameters:
out - the output PrintStream
text - the text to output.

printSpaces

protected static void printSpaces(java.io.PrintStream out,
                                  int n)
Utility method to print a number of spaces to a PrintStream.

Parameters:
out - output PrintStream
n - number of spaces to print.

constructFullClasspath

public java.lang.String constructFullClasspath()

constructPostCompilerClasspath

public java.lang.String constructPostCompilerClasspath()