at.dms.compiler
Class Compiler

java.lang.Object
  |
  +--at.dms.compiler.Compiler
Direct Known Subclasses:
Main

public abstract class Compiler
extends java.lang.Object

This class defines the common behaviour of all KOPI compilers.


Constructor Summary
protected Compiler()
          Creates a new compiler instance.
 
Method Summary
protected  java.lang.String checkDestination(java.lang.String destination)
          Checks if destination is absolute or relative to working directory.
 long getTimestamp()
          Returns the timestamp of the compilation session, identifying it uniquely.
 void inform(Message message)
          Write a message to the diagnostic output.
 void inform(MessageDescription description)
          Write a message to the diagnostic output.
 void inform(MessageDescription description, java.lang.Object parameter)
          Write a message to the diagnostic output.
 void inform(MessageDescription description, java.lang.Object[] parameters)
          Write a message to the diagnostic output.
 void inform(MessageDescription description, java.lang.Object parameter1, java.lang.Object parameter2)
          Write a message to the diagnostic output.
 void inform(PositionedError trouble)
          Write a message to the diagnostic output.
 void inform(java.lang.Throwable trouble)
          Write a message to the diagnostic output.
abstract  boolean parseComments()
          Returns true iff comments should be parsed (false if to be skipped).
abstract  void reportTrouble(PositionedError trouble)
          Reports a trouble (error or warning).
abstract  boolean run(java.lang.String[] args)
          Runs a compilation session.
 boolean run(java.lang.String dir, java.io.PrintWriter err, java.lang.String[] args)
          Runs a compilation session
 void setDebug(boolean debug)
          Changes 'verbose debugging output' flag.
 void setErr(java.io.PrintStream err)
          Sets the error stream.
protected  void setWorkingDirectory(java.lang.String dir)
          Sets the directory where to search for source files.
abstract  boolean verboseMode()
          Returns true iff compilation runs in verbose mode.
 java.util.List verifyFiles(java.util.List names)
          Takes a the command-line list of source files, expands list files and and checks that each exists.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compiler

protected Compiler()
Creates a new compiler instance.
Method Detail

setWorkingDirectory

protected void setWorkingDirectory(java.lang.String dir)
Sets the directory where to search for source files.
Parameters:
dir - the name of the directory

getTimestamp

public final long getTimestamp()
Returns the timestamp of the compilation session, identifying it uniquely.

setErr

public void setErr(java.io.PrintStream err)
Sets the error stream.

setDebug

public void setDebug(boolean debug)
Changes 'verbose debugging output' flag.

verifyFiles

public java.util.List verifyFiles(java.util.List names)
                           throws UnpositionedError
Takes a the command-line list of source files, expands list files and and checks that each exists.
Parameters:
files - A list of source files from the command line.
Returns:
A list of files known to exist.
Throws:
UnpositionedError - At least one file does not exist.

checkDestination

protected java.lang.String checkDestination(java.lang.String destination)
Checks if destination is absolute or relative to working directory.

run

public boolean run(java.lang.String dir,
                   java.io.PrintWriter err,
                   java.lang.String[] args)
Runs a compilation session
Parameters:
dir - the working directory
err - the diagnostic output stream
args - the arguments to the compiler
Returns:
true iff the compilation succeeded

run

public abstract boolean run(java.lang.String[] args)
Runs a compilation session.
Parameters:
args - the arguments to the compiler
Returns:
true iff the compilatioan succeeded

reportTrouble

public abstract void reportTrouble(PositionedError trouble)
Reports a trouble (error or warning).
Parameters:
trouble - a description of the trouble to report.

parseComments

public abstract boolean parseComments()
Returns true iff comments should be parsed (false if to be skipped).

verboseMode

public abstract boolean verboseMode()
Returns true iff compilation runs in verbose mode.

inform

public void inform(java.lang.Throwable trouble)
Write a message to the diagnostic output.
Parameters:
trouble - the error caught.

inform

public void inform(PositionedError trouble)
Write a message to the diagnostic output.
Parameters:
trouble - the error caught.

inform

public void inform(Message message)
Write a message to the diagnostic output.
Parameters:
message - the formatted message

inform

public void inform(MessageDescription description,
                   java.lang.Object[] parameters)
Write a message to the diagnostic output.
Parameters:
description - the message description.
parameters - the array of parameters.

inform

public void inform(MessageDescription description,
                   java.lang.Object parameter1,
                   java.lang.Object parameter2)
Write a message to the diagnostic output.
Parameters:
description - the message description.
parameter1 - the first parameter.
parameter2 - the second parameter.

inform

public void inform(MessageDescription description,
                   java.lang.Object parameter)
Write a message to the diagnostic output.
Parameters:
description - the message description.
parameter - the parameter.

inform

public void inform(MessageDescription description)
Write a message to the diagnostic output.
Parameters:
description - the message description.