fi.hu.cs.titokone
Class CompileDebugger

java.lang.Object
  extended byfi.hu.cs.titokone.CompileDebugger

public class CompileDebugger
extends java.lang.Object

This class is used by compiler when it compiles code. For each line compiled compiler asks CompileDebugger to create a CompileInfo object and passes it to the GUIBrain.


Field Summary
private  java.lang.String comment
          This field contains current comment.
private  CompileInfo info
          This field contains current CompileInfo object.
private  int phase
          This field contains current phase of compilation.
private  java.lang.String statusMessage
          This field contains current statusmessage.
 
Constructor Summary
CompileDebugger()
          This is the only constructor for CompileDebugger.
 
Method Summary
 void finalFirstPhase(java.lang.String[] codeArea, java.lang.String[] dataArea, java.lang.String[][] symbolTable)
          This method is used when all DC and DS are defined and compiler is ready to move to the second phase.
 void finalPhase()
          This method tells debugger that final phase of compilation is in progress.
 void firstPhase()
          This method is used when all lines are checked in the first phase of compilation and compiler is setting symbols and labels.
 void firstPhase(int lineNumber, java.lang.String lineContents)
          This method tells debugger that first round of compilation is in progres and line wasn't empty.
 void foundDC(java.lang.String name)
          This method tells debugger that a DC compiler instruction was found and it is added to the symboltable.
 void foundDS(java.lang.String name)
          This method tells debugger that a DS compiler instruction was found and it is added to the symboltable.
 void foundEQU(java.lang.String name, int value)
          This method tells that an EQU was found and it is added to the symboltable.
 void foundLabel(java.lang.String name, int lineNumber)
          This method tells that for given label points to given line.
 void foundSymbol(java.lang.String name)
          This Method tells debugger that a symbol was used as an address.
 CompileInfo lineCompiled()
          This method returns the created CompileInfo-object.
 void secondPhase(int lineNumber, java.lang.String lineContents)
          This method tells debugger that the second round of compilation is in progress.
 void setBinary(int binary)
          This method sets the compiled value of a line during the second round of compilation.
 void setComment(java.lang.String message)
          This method sets the comment to the compileInfo.
 void setStatusMessage(java.lang.String message)
          This method sets the status info to the compileInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

info

private CompileInfo info
This field contains current CompileInfo object.


phase

private int phase
This field contains current phase of compilation.


statusMessage

private java.lang.String statusMessage
This field contains current statusmessage.


comment

private java.lang.String comment
This field contains current comment. This string is created by debugger when its different methods are called.

Constructor Detail

CompileDebugger

public CompileDebugger()
This is the only constructor for CompileDebugger. It is called when compiler is created.

Method Detail

foundEQU

public void foundEQU(java.lang.String name,
                     int value)
This method tells that an EQU was found and it is added to the symboltable.

Parameters:
name - String containing name of the symbol.
value - Int containing the value.

foundDS

public void foundDS(java.lang.String name)
This method tells debugger that a DS compiler instruction was found and it is added to the symboltable.

Parameters:
name - String containing name of the symbol.

foundDC

public void foundDC(java.lang.String name)
This method tells debugger that a DC compiler instruction was found and it is added to the symboltable.

Parameters:
name - String containing name of the symbol.

foundSymbol

public void foundSymbol(java.lang.String name)
This Method tells debugger that a symbol was used as an address.

Parameters:
name - String containing name of the symbol.

foundLabel

public void foundLabel(java.lang.String name,
                       int lineNumber)
This method tells that for given label points to given line.

Parameters:
name - String containing name of the symbol.
lineNumber - Int containing the linenumber of the label.

setBinary

public void setBinary(int binary)
This method sets the compiled value of a line during the second round of compilation.


firstPhase

public void firstPhase(int lineNumber,
                       java.lang.String lineContents)
This method tells debugger that first round of compilation is in progres and line wasn't empty. It creates CompileInfo object and sets its phase to 1, lineNumber and lineContents fields.

Parameters:
lineNumber - Number of the compiled line.
lineContents - String containing the symbolic command.

firstPhase

public void firstPhase()
This method is used when all lines are checked in the first phase of compilation and compiler is setting symbols and labels.


finalFirstPhase

public void finalFirstPhase(java.lang.String[] codeArea,
                            java.lang.String[] dataArea,
                            java.lang.String[][] symbolTable)
This method is used when all DC and DS are defined and compiler is ready to move to the second phase. Compiler tells debugger what are code lines and then what is dataArea in memory and what it contains. GUIBrain then redraws GUI and writes codelines leaving binary cells empty. Then it draws data area where number of first data line is codeArea.length

Parameters:
codeArea - String array containing codelines.
dataArea - String array containing data.
symbolTable - 2-dimensional String array containing the symbol table.

setComment

public void setComment(java.lang.String message)
This method sets the comment to the compileInfo.


setStatusMessage

public void setStatusMessage(java.lang.String message)
This method sets the status info to the compileInfo.


secondPhase

public void secondPhase(int lineNumber,
                        java.lang.String lineContents)
This method tells debugger that the second round of compilation is in progress. It creates CompileInfo object and sets its phase to 3.

Parameters:
lineNumber - number of the compiled line.
lineContents - Contents of the line.

finalPhase

public void finalPhase()
This method tells debugger that final phase of compilation is in progress. It creates CompileInfo object and sets its phase to 4.


lineCompiled

public CompileInfo lineCompiled()
This method returns the created CompileInfo-object. It sets comments in the CompileInfo and then returns it.