Package mars.assembler
Class Directives
java.lang.Object
mars.assembler.Directives
Class representing MIPS assembler directives. If Java had enumerated types,
these would probably be implemented that way. Each directive is represented
by a unique object. The directive name is indicative of the directive it
represents. For example, DATA represents the MIPS .data directive.
- Version:
- August 2003
- Author:
- Pete Sanderson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
static Directives
-
Method Summary
Modifier and TypeMethodDescriptionGet description of this Directives objectstatic ArrayList<Directives>
Produces List of Directive objectsgetName()
Get name of this Directives objectstatic boolean
isFloatingDirective(Directives direct)
Lets you know whether given directive is for floating number (FLOAT,DOUBLE).static boolean
isIntegerDirective(Directives direct)
Lets you know whether given directive is for integer (WORD,HALF,BYTE).static Directives
matchDirective(String str)
Find Directive object, if any, which matches the given String.static ArrayList<Directives>
prefixMatchDirectives(String str)
Find Directive object, if any, which contains the given string as a prefix.toString()
Produces String-ified version of Directive object
-
Field Details
-
DATA
-
TEXT
-
WORD
-
ASCII
-
ASCIIZ
-
BYTE
-
ALIGN
-
HALF
-
SPACE
-
DOUBLE
-
FLOAT
-
EXTERN
-
KDATA
-
KTEXT
-
GLOBL
-
SET
-
EQV
-
MACRO
-
END_MACRO
-
INCLUDE
-
-
Method Details
-
matchDirective
Find Directive object, if any, which matches the given String.- Parameters:
str
- A String containing candidate directive name (e.g. ".ascii")- Returns:
- If match is found, returns matching Directives object, else returns
null
.
-
prefixMatchDirectives
Find Directive object, if any, which contains the given string as a prefix. For example, ".a" will match ".ascii", ".asciiz" and ".align"- Parameters:
str
- A String- Returns:
- If match is found, returns ArrayList of matching Directives objects,
else returns
null
.
-
toString
Produces String-ified version of Directive object -
getName
Get name of this Directives object- Returns:
- name of this MIPS directive as a String
-
getDescription
Get description of this Directives object- Returns:
- description of this MIPS directive (for help purposes)
-
getDirectiveList
Produces List of Directive objects- Returns:
- MIPS Directive
-
isIntegerDirective
Lets you know whether given directive is for integer (WORD,HALF,BYTE).- Parameters:
direct
- a MIPS directive- Returns:
- true if given directive is WORD or HALF or BYTE, false otherwise
-
isFloatingDirective
Lets you know whether given directive is for floating number (FLOAT,DOUBLE).- Parameters:
direct
- a MIPS directive- Returns:
- true if given directive is FLOAT or DOUBLE, false otherwise.
-