hades.utils
Class Parser

java.lang.Object
  extended byhades.utils.Parser

public class Parser
extends java.lang.Object

parse HADES (.hds) circuit schematics.


Field Summary
(package private) static int COMPONENTS
           
(package private) static Console console
           
(package private) static int IDLE
           
(package private) static int NAME
           
(package private) static int SIGNALS
           
 
Constructor Summary
Parser()
           
 
Method Summary
static void dbg(java.lang.String msg)
           
(package private) static boolean isCommentLine(java.lang.String line)
          check whether the String 'line' represents a comment.
(package private) static boolean isKeyword(java.lang.String line, java.lang.String keyword)
           
(package private) static void msg(java.lang.String msg)
          print diagnostic or information msgs to the HADES console window
static void parseComponent(java.lang.String line, Design design)
          parse a Component from one line of a HADES design file.
static int parseDesign(Design design, java.io.InputStream is)
          parse a Hades 'Design' (schematic).
(package private) static void parseSignal(java.lang.String line, Design design)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

console

static Console console

IDLE

static final int IDLE
See Also:
Constant Field Values

NAME

static final int NAME
See Also:
Constant Field Values

COMPONENTS

static final int COMPONENTS
See Also:
Constant Field Values

SIGNALS

static final int SIGNALS
See Also:
Constant Field Values
Constructor Detail

Parser

public Parser()
Method Detail

isCommentLine

static boolean isCommentLine(java.lang.String line)
check whether the String 'line' represents a comment. Currently, SLIF/BLIF and C++ style comments are recognized:
 # this is a comment to the end of the line
 // this is also a comment to the end of the line
 


isKeyword

static boolean isKeyword(java.lang.String line,
                         java.lang.String keyword)

parseComponent

public static void parseComponent(java.lang.String line,
                                  Design design)
                           throws java.lang.Exception
parse a Component from one line of a HADES design file. Example of a valid line:
 #classname              instanceName  position in schematic
 "hades.models.gates.Inv inv1          50250 30250"
 

Throws:
java.lang.Exception - If a component cannot be found, or its parameters are illegal.

parseSignal

static void parseSignal(java.lang.String line,
                        Design design)
                 throws java.lang.Exception
Throws:
java.lang.Exception

parseDesign

public static int parseDesign(Design design,
                              java.io.InputStream is)
parse a Hades 'Design' (schematic). This method uses the following file format:
      // comment
      [hades.models.Design] TheNameOfThisDesign
      [components]
      hades.models.Design subdesignName pos_x pos_y
      ...
      hades.models.gates.Inv inverterName pos_x pos_y
      ...
      [end components]
      [signals]
      hades.models.Signal  
      [end signals]
      ... [reserved]

      [end]
     


dbg

public static void dbg(java.lang.String msg)

msg

static void msg(java.lang.String msg)
print diagnostic or information msgs to the HADES console window