ptolemy.copernicus.c
Class Options

java.lang.Object
  extended by ptolemy.copernicus.c.Options

public class Options
extends java.lang.Object

A class that keeps track of compiler options. All options are stored as key-value string pairs. Possible options are:

verbose
true/false Turns verbose mode on or off.

compileMode
singleClass compiles only the given class,
full generates all required files.

pruneLevel
0 no code pruning done.
1 Code Pruning done by CallGraphPruner.

vta
true/false Whether or not to perform Variable Type Analysis.

lib
stores the path to the directory where library of generated files is stored.

gcDir
stores the path to the directory containing the garbage collector. Not using this option turns the collector off.

target
C6000 The TMS320C6xxx series of processors.
The target platform. A blank refers to a generic unix-like system. This includes Cygwin installations on windows.

runtimeDir
The path to the runtime directory.

ptII
The path to the ptII directory.

compulsoryMethods
A semicolon-separated list of methods for which code must always be generated. If more than one such entity is to be specified, the entire list may be enclosed within double quotes. The complete method subsignature of the form

 returnType class.method(arg1, arg2 ... ) 
must be specified.

cFlags
The GCC flags to be used in the makefile.

reportEntities
true/false whether to output a summary of the number of classes, methods and fields (entities) generated.

Since:
Ptolemy II 4.0
Version:
$Id: Options.java,v 1.26 2005/10/24 19:09:08 cxh Exp $
Author:
Ankush Varma
Accepted Rating:
Red (ssb)
Proposed Rating:
Red (ankush)

Constructor Summary
Options()
          Default constructor.
 
Method Summary
 java.lang.String get(java.lang.String key)
          Get the value corresponding to a key from the options table.
 boolean getBoolean(java.lang.String key)
          Get a boolean value corresponding to a given key.
 int getInt(java.lang.String key)
          Get the integer value corresponding to a given key.
static boolean isValidFlag(java.lang.String string)
          Checks if a given string is a valid option flag.
static boolean isValidOption(java.lang.String string)
          Checks if a given string is a valid Option.
 void put(java.lang.String key, java.lang.String value)
          Put a key-value pair into the options table.
 java.lang.String toString()
          Convert the option table to a String.
static Options v()
          Return a static version of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Options

public Options()
Default constructor. Initializes default key-value pairs.

Method Detail

get

public java.lang.String get(java.lang.String key)
Get the value corresponding to a key from the options table.

Parameters:
key - The name of the option to be looked up.
Returns:
The value corresponding to this option.

getBoolean

public boolean getBoolean(java.lang.String key)
Get a boolean value corresponding to a given key. This returns true or false depending on whether the value is the string "true" or "false".

Parameters:
key - The name of the option to be looked up.
Returns:
The boolean corresponding to the value of this key.
Throws:
java.lang.RuntimeException - If a lookup of a value that is not "true" or "false" occurs.

getInt

public int getInt(java.lang.String key)
Get the integer value corresponding to a given key.

Parameters:
key - The name of the option to be looked up.
Returns:
The integer value corresponding to this key.

isValidOption

public static boolean isValidOption(java.lang.String string)
Checks if a given string is a valid Option.

Parameters:
string - The string to be checked.
Returns:
True if it is a valid Option flag.

isValidFlag

public static boolean isValidFlag(java.lang.String string)
Checks if a given string is a valid option flag. A valid option flag is a "-" followed by a valid Option String.

Parameters:
string - The string to be checked.
Returns:
True if it is a valid option flag.

put

public void put(java.lang.String key,
                java.lang.String value)
Put a key-value pair into the options table.

Parameters:
key - The name of the option to be set.
value - The value assigned to this option.

toString

public java.lang.String toString()
Convert the option table to a String.

Overrides:
toString in class java.lang.Object
Returns:
A string showing the used options.

v

public static Options v()
Return a static version of this class.

Returns:
A static Options object.