misim.asm
Class Assembler
java.lang.Object
|
+--misim.asm.Assembler
- All Implemented Interfaces:
- FirstPassIF
- public class Assembler
- extends java.lang.Object
- implements FirstPassIF
Method Summary |
void |
addIncludeFile(TokenString include)
Add the given include file to the current iterator list, so that the
next lines loaded will be from the included file |
void |
addToList(AsmLine aLine,
TextFile listFile,
int index,
boolean force)
Add the specified line to the list file, either as a visible line,
or unlisted depending on the current listing controls. |
int |
assemble(TextFile file,
boolean isApplet,
LogListener logging)
Assemble the given file and indicate the number of errors that
were encountered during assembly. |
void |
checkConditional(Token aToken,
AsmLine aLine)
Test to see if this token might affect conditional assembly. |
TextFile |
getListFile()
Get the list file generated by the assembler |
int |
getWarnings()
Return the number of warnings encountered in the last assembly |
AsmLine |
preprocess(LineIterator iterator,
java.util.Hashtable defineHash)
Read the next line from the given line iterator. |
void |
setList(int listType)
Set the flag that indicates whether current lines added to the listing
should be visible or not. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Assembler
public Assembler(Processor processor,
AssemblyParser parser,
EditorPrefs prefs,
FileHandler fileHandler)
assemble
public int assemble(TextFile file,
boolean isApplet,
LogListener logging)
- Assemble the given file and indicate the number of errors that
were encountered during assembly.
- Parameters:
file
- The file to assemble- Returns:
- The number of errors encountered during assembly
getWarnings
public int getWarnings()
- Return the number of warnings encountered in the last assembly
- Returns:
- The number of warnings
getListFile
public TextFile getListFile()
- Get the list file generated by the assembler
- Returns:
- The TextFile generated during assembly
checkConditional
public void checkConditional(Token aToken,
AsmLine aLine)
- Test to see if this token might affect conditional assembly. If
it will (ie. it is not null, and is one of the IF, IFDEF, IFNDEF,
ELSE, ENDIF commands), process the command and update the state
of the conditional flag as appropriate. Note that this does not
evaluate the IF part of the command, but flags the current line
for conditional assembly (by using AsmLine.setSkip()).
- Parameters:
aToken
- The token to checkaLine
- The line that the token occurs on
addToList
public void addToList(AsmLine aLine,
TextFile listFile,
int index,
boolean force)
- Add the specified line to the list file, either as a visible line,
or unlisted depending on the current listing controls.
If the line is not visible it is added as a child of the last visible
line added.
- Specified by:
addToList
in interface FirstPassIF
- Parameters:
aLine
- The line to addlistFile
- The list file to append the line toindex
- The index to add the line at, or END_OF_FILE for end of fileforce
- If True, this will be added as a visible line, regardless of the list setting
setList
public void setList(int listType)
- Set the flag that indicates whether current lines added to the listing
should be visible or not.
listType may be one of the following values:
LIST_ALL - All current lines should be listed
LIST_NONE - No current lines should be listed
LIST_SKIP - The current line should not be listed, then return to
previous behaviour
- Specified by:
setList
in interface FirstPassIF
- Parameters:
listType
- The new list behaviour
preprocess
public AsmLine preprocess(LineIterator iterator,
java.util.Hashtable defineHash)
- Read the next line from the given line iterator. Create a new AsmLine
from this one, setting the source line, list and line number values. Clear
existing errors on the source line.
If defineHash is not null, and the line contains tokens in the defineHash,
expand #define-d tokens into a new Vector, and set the AsmLine's
preprocessed vector of tokens to the expanded list.
Tokens that follow IFDEF or IFNDEF commands are not
expanded.
- Specified by:
preprocess
in interface FirstPassIF
- Parameters:
aLine
- The line to preprocessdefineHash
- The hashtable containing #defines
addIncludeFile
public void addIncludeFile(TokenString include)
throws EditorException
- Add the given include file to the current iterator list, so that the
next lines loaded will be from the included file
- Specified by:
addIncludeFile
in interface FirstPassIF
- Parameters:
include
- The String token representing the include file name- Throws:
EditorException
- If the file could not be loaded