mars.assembler
Class Directives

java.lang.Object
  |
  +--mars.assembler.Directives

public final class Directives
extends java.lang.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.


Field Summary
static Directives ALIGN
           
static Directives ASCII
           
static Directives ASCIIZ
           
static Directives BYTE
           
static Directives DATA
           
static Directives DOUBLE
           
static Directives EXTERN
           
static Directives FLOAT
           
static Directives GLOBL
           
static Directives HALF
           
static Directives KDATA
           
static Directives KTEXT
           
static Directives SET
           
static Directives SPACE
           
static Directives TEXT
           
static Directives WORD
           
 
Method Summary
 java.lang.String getDescription()
          Get description of this Directives object
static java.util.ArrayList getDirectiveList()
          Produces List of Directive objects
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(java.lang.String str)
          Find Directive object, if any, which matches the given String.
 java.lang.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
Method Detail

matchDirective

public static Directives matchDirective(java.lang.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.

toString

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

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

getDescription

public java.lang.String getDescription()
Get description of this Directives object

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

getDirectiveList

public static java.util.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.