coins.driver
Interface CompileSpecification

All Known Implementing Classes:
CommandLine

public interface CompileSpecification

Abstraction of a specification of compilation, i.e., specification of options, arguments and source files.
Objects that implements this interface provide accesses to a compile specification through this interface. It may be generated by parsing command line, may be by asking to an operator through GUI, or may be generated from some database record automatically.
option may be one of:

Any other options are invalid and should be warned.


Field Summary
static java.lang.String ARCHIVE_TO_LINK
          Option to speficy an archive to link.
static java.lang.String ASSEMBLE_ONLY
          Switch not to link.
static java.lang.String COINS
          Option header of COINS options.
static java.lang.String COMPILE_ONLY
          Switch to stop after assembly code generation and leave it.
static java.lang.String DEFINE_MACRO
          Option header to define a preprocessor macro.
static java.lang.String DYNAMIC_LINKAGE
          Option to use dynamic linkage.
static java.lang.String HELP
          Switch to show help.
static java.lang.String INCLUDE_PATH
          Option header to specify an include path.
static java.lang.String INHIBIT_NUMBER_LINE
          Option header not to output #line directives.
static java.lang.String LINK_PATH
          Option to specify an archive search path.
static java.lang.String OPTIMIZE_LEVEL
          Option header to set optimization level.
static java.lang.String OUTPUT_FILE
          Option to specify an output file.
static java.lang.String PERFORMANCE_MONITOR
          Option to use performance monitor.
static java.lang.String PIPE
          Switch to use pipe rather than temporary files to communicate between passes.
static java.lang.String PREPROCESS_ONLY
          Switch to stop after preprocessing and leave a preprocessed source code.
static java.lang.String PRESERVE_COMMENTS
          Switch to preserve comments in output file.
static java.lang.String PRESERVE_SYMBOLS
          Option to preserve all symbols.
static java.lang.String STATIC_LINKAGE
          Option to use static linkage.
static java.lang.String TARGET_ARCHITECTURE
          Option to specify a target architecture.
static java.lang.String UNDEFINE_MACRO
          Option header to undefine a preprocessor macro.
static java.lang.String VERBOSE
          Verbose option.
static java.lang.String WARNING_CATEGORY
          Option header to show warning messages of a category.
 
Method Summary
 java.lang.Object getArg(java.lang.String option)
          Returns an argument of an option in this command line.
 java.util.List getAssemblerOptions()
          Returns a List of Strings containing all assembler options specified in this command line.
 CoinsOptions getCoinsOptions()
          Returns an CoinsOptions object which represents -coins options included in this command line.
 java.util.List getCompilerOptions()
          Returns a List of Strings containing all compiler options specified in this command line.
 java.util.List getLinkerOptions()
          Returns a List of Strings containing all linker options specified in this command line.
 java.util.List getPreprocessorOptions()
          Returns a List of Strings containing all preprocessor options specified in this command line.
 java.util.List getSourceFiles()
          Returns a List of source file names listed in this command line.
 Trace getTrace()
          Returns a Trace object which filters trace messages in a manner specified in this command line.
 Warning getWarning()
          Returns a Warning object which filters warning messages in a manner specified in this command line.
 boolean isAssemblerOption(java.lang.String arg)
          Tests if the argument string is one of assembler options.
 boolean isCompilerOption(java.lang.String arg)
          Tests if the argument string is one of compiler options.
 boolean isLinkerOption(java.lang.String arg)
          Tests if the argument string is one of linker options.
 boolean isPreprocessorOption(java.lang.String arg)
          Tests if the argument string is one of preprocessor options.
 boolean isSet(java.lang.String option)
          Tests if an option is set or not in this command line.
 void setObjectFile(java.lang.String sourceFile, java.lang.String objectFile)
          Registers a file as an object file of a specified source file.
 void showHelp(java.io.PrintStream out, CompilerImplementation driver)
          Shows help messages.
 

Field Detail

PREPROCESS_ONLY

public static final java.lang.String PREPROCESS_ONLY
Switch to stop after preprocessing and leave a preprocessed source code. A driver control option.

See Also:
Constant Field Values

COMPILE_ONLY

public static final java.lang.String COMPILE_ONLY
Switch to stop after assembly code generation and leave it. A driver control option.

See Also:
Constant Field Values

ASSEMBLE_ONLY

public static final java.lang.String ASSEMBLE_ONLY
Switch not to link. A driver control option.

See Also:
Constant Field Values

HELP

public static final java.lang.String HELP
Switch to show help. A driver control option.

See Also:
Constant Field Values

OUTPUT_FILE

public static final java.lang.String OUTPUT_FILE
Option to specify an output file. Takes an argument. A driver control option.

See Also:
Constant Field Values

TARGET_ARCHITECTURE

public static final java.lang.String TARGET_ARCHITECTURE
Option to specify a target architecture. May take an argument. A driver control option.

See Also:
Constant Field Values

VERBOSE

public static final java.lang.String VERBOSE
Verbose option.

See Also:
Constant Field Values

PIPE

public static final java.lang.String PIPE
Switch to use pipe rather than temporary files to communicate between passes. A driver control option.

See Also:
Constant Field Values

WARNING_CATEGORY

public static final java.lang.String WARNING_CATEGORY
Option header to show warning messages of a category. An overall option which is passed to all passes.

See Also:
Constant Field Values

PRESERVE_COMMENTS

public static final java.lang.String PRESERVE_COMMENTS
Switch to preserve comments in output file. A preprocessor option.

See Also:
Constant Field Values

DEFINE_MACRO

public static final java.lang.String DEFINE_MACRO
Option header to define a preprocessor macro. A preprocessor option.

See Also:
Constant Field Values

INCLUDE_PATH

public static final java.lang.String INCLUDE_PATH
Option header to specify an include path. A preprocessor option.

See Also:
Constant Field Values

INHIBIT_NUMBER_LINE

public static final java.lang.String INHIBIT_NUMBER_LINE
Option header not to output #line directives. A preprocessor option.

See Also:
Constant Field Values

UNDEFINE_MACRO

public static final java.lang.String UNDEFINE_MACRO
Option header to undefine a preprocessor macro. A preprocessor option.

See Also:
Constant Field Values

OPTIMIZE_LEVEL

public static final java.lang.String OPTIMIZE_LEVEL
Option header to set optimization level. A compiler option.

See Also:
Constant Field Values

PRESERVE_SYMBOLS

public static final java.lang.String PRESERVE_SYMBOLS
Option to preserve all symbols. A compiler option.

See Also:
Constant Field Values

PERFORMANCE_MONITOR

public static final java.lang.String PERFORMANCE_MONITOR
Option to use performance monitor. A compiler option.

See Also:
Constant Field Values

LINK_PATH

public static final java.lang.String LINK_PATH
Option to specify an archive search path. A linker option.

See Also:
Constant Field Values

DYNAMIC_LINKAGE

public static final java.lang.String DYNAMIC_LINKAGE
Option to use dynamic linkage. A linker option.

See Also:
Constant Field Values

STATIC_LINKAGE

public static final java.lang.String STATIC_LINKAGE
Option to use static linkage. A linker option.

See Also:
Constant Field Values

ARCHIVE_TO_LINK

public static final java.lang.String ARCHIVE_TO_LINK
Option to speficy an archive to link. Usually, specifying "-larchive" means to link archive file whose name is libarchive.a. A linker option.

See Also:
Constant Field Values

COINS

public static final java.lang.String COINS
Option header of COINS options. Even if more than one COINS options are specified, they are interpreted as a single COINS option whose argument is arguments of the options concatenated with commas.

See Also:
Constant Field Values
Method Detail

isSet

public boolean isSet(java.lang.String option)
Tests if an option is set or not in this command line.

Parameters:
option - the option string, including leading `-'.
Returns:
true if the option is set, false otherwise.

getArg

public java.lang.Object getArg(java.lang.String option)
Returns an argument of an option in this command line. When the option is not set, a null is returned. The argument is a String for -o, a List of Strings for -D, -I, -L, -O, -U, -W and -l.

Parameters:
option - the option string, including leading `-'.
Returns:
the argument of option.

isPreprocessorOption

public boolean isPreprocessorOption(java.lang.String arg)
Tests if the argument string is one of preprocessor options. The argument string should start with `-' to be judged as a preprocessor option.

Parameters:
arg - the argument string
Returns:
true if `arg' is one of the preprocessor options; false otherwise.

getPreprocessorOptions

public java.util.List getPreprocessorOptions()
Returns a List of Strings containing all preprocessor options specified in this command line. One copy of the list is created per a call.

Returns:
preprocessor options

isCompilerOption

public boolean isCompilerOption(java.lang.String arg)
Tests if the argument string is one of compiler options. The argument string should start with `-' to be judged as a compiler option.

Parameters:
arg - the argument string
Returns:
true if `arg' is one of the compiler options; false otherwise.

getCompilerOptions

public java.util.List getCompilerOptions()
Returns a List of Strings containing all compiler options specified in this command line. One copy of the list is created per a call.

Returns:
compiler options

isAssemblerOption

public boolean isAssemblerOption(java.lang.String arg)
Tests if the argument string is one of assembler options. The argument string should start with `-' to be judged as a assembler option.

Parameters:
arg - the argument string
Returns:
true if `arg' is one of the assembler options; false otherwise.

getAssemblerOptions

public java.util.List getAssemblerOptions()
Returns a List of Strings containing all assembler options specified in this command line. One copy of the list is created per a call.

Returns:
assembler options.

isLinkerOption

public boolean isLinkerOption(java.lang.String arg)
Tests if the argument string is one of linker options. The argument string should start with `-' to be judged as a linker option.

Parameters:
arg - the argument string
Returns:
true if `arg' is one of the linker options; false otherwise.

getLinkerOptions

public java.util.List getLinkerOptions()
Returns a List of Strings containing all linker options specified in this command line. One copy of the list is created per a call.

Returns:
linker options

getCoinsOptions

public CoinsOptions getCoinsOptions()
Returns an CoinsOptions object which represents -coins options included in this command line.

Returns:
a CoinsOptions object.

getSourceFiles

public java.util.List getSourceFiles()
Returns a List of source file names listed in this command line. One copy of the list is created per a call.

Returns:
the List of source files names.

setObjectFile

public void setObjectFile(java.lang.String sourceFile,
                          java.lang.String objectFile)
Registers a file as an object file of a specified source file. Without calling this method, getLinkerOptions cannot return a correct command line arguments.

Parameters:
sourceFile - the source file name
objectFile - the object file name
Throws:
java.lang.Error - there is no source file sourceFile

getTrace

public Trace getTrace()
Returns a Trace object which filters trace messages in a manner specified in this command line.

Returns:
a Trace object.

getWarning

public Warning getWarning()
Returns a Warning object which filters warning messages in a manner specified in this command line.

Returns:
a Warning object.

showHelp

public void showHelp(java.io.PrintStream out,
                     CompilerImplementation driver)
Shows help messages.

Parameters:
out - A PrintStream to which the help messages are written.
driver - A driver object which has the method `main'.