mars.assembler
Class Directives

java.lang.Object
  extended by mars.assembler.Directives

public final class Directives
extends Object

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.

Author:
Pete Sanderson

Field Summary
static Directives ALIGN
           
static Directives ASCII
           
static Directives ASCIIZ
           
static Directives BYTE
           
static Directives DATA
           
static Directives DOUBLE
           
static Directives END_MACRO
           
static Directives EQV
           
static Directives EXTERN
           
static Directives FLOAT
           
static Directives GLOBL
           
static Directives HALF
           
static Directives INCLUDE
           
static Directives KDATA
           
static Directives KTEXT
           
static Directives MACRO
           
static Directives SET
           
static Directives SPACE
           
static Directives TEXT
           
static Directives WORD
           
 
Method Summary
 String getDescription()
          Get description of this Directives object
static ArrayList getDirectiveList()
          Produces List of Directive objects
 String getName()
          Get name of this Directives object
static 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 prefixMatchDirectives(String str)
          Find Directive object, if any, which contains the given string as a prefix.
 String toString()
          Produces String-ified version of Directive object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA

public static final Directives DATA

TEXT

public static final Directives TEXT

WORD

public static final Directives WORD

ASCII

public static final Directives ASCII

ASCIIZ

public static final Directives ASCIIZ

BYTE

public static final Directives BYTE

ALIGN

public static final Directives ALIGN

HALF

public static final Directives HALF

SPACE

public static final Directives SPACE

DOUBLE

public static final Directives DOUBLE

FLOAT

public static final Directives FLOAT

EXTERN

public static final Directives EXTERN

KDATA

public static final Directives KDATA

KTEXT

public static final Directives KTEXT

GLOBL

public static final Directives GLOBL

SET

public static final Directives SET

EQV

public static final Directives EQV

MACRO

public static final Directives MACRO

END_MACRO

public static final Directives END_MACRO

INCLUDE

public static final Directives INCLUDE
Method Detail

matchDirective

public static Directives matchDirective(String str)
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

public static ArrayList prefixMatchDirectives(String str)
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

public String toString()
Produces String-ified version of Directive object

Overrides:
toString in class Object
Returns:
String representing Directive: its MIPS name

getName

public String getName()
Get name of this Directives object

Returns:
name of this MIPS directive as a String

getDescription

public String getDescription()
Get description of this Directives object

Returns:
description of this MIPS directive (for help purposes)

getDirectiveList

public static ArrayList getDirectiveList()
Produces List of Directive objects

Returns:
MIPS Directive

isIntegerDirective

public static boolean isIntegerDirective(Directives direct)
Lets you know whether given directive is for integer (WORD,HALF,BYTE).

Parameters:
direct - a MIPS directive
Returns:
true if given directive is FLOAT or DOUBLE, false otherwise

isFloatingDirective

public static boolean isFloatingDirective(Directives direct)
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.