org.openfdl.core
Class OpenFDL

java.lang.Object
  extended by org.openfdl.core.OpenFDL

public class OpenFDL
extends java.lang.Object

OpenFDL.java Main entry point for OpenFDL. Meaning this is where arguments are checked, the parser is called and output processing is handled. Also contains the program name and version strings in case someone cares.

Version:
1.00
Author:
Matt Acosta

Field Summary
private static boolean buildStatus
           
protected static java.lang.String PRODUCT_NAME
           
protected static java.lang.String PRODUCT_VERSION
           
 
Constructor Summary
OpenFDL()
           
 
Method Summary
private static java.lang.String format(java.lang.String str, int width)
          Right justifies the input string over the given width.
static void main(java.lang.String[] args)
          Checks areguments and calls the parser.
private static void parseFile(java.lang.String inFile, java.lang.String outFile)
          Parses an input file to create a properly formatted C header file.
private static void printFileHeader(java.io.PrintStream out, java.lang.String inFile, java.lang.String outFile)
          Prints the file header to a supplied PrintStream object.
private static void printUsage(java.io.PrintStream out)
          Prints help on how to run this program from the console.
static void setBuildFailed()
          Changes the build status to failure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRODUCT_NAME

protected static final java.lang.String PRODUCT_NAME
See Also:
Constant Field Values

PRODUCT_VERSION

protected static final java.lang.String PRODUCT_VERSION
See Also:
Constant Field Values

buildStatus

private static boolean buildStatus
Constructor Detail

OpenFDL

public OpenFDL()
Method Detail

main

public static void main(java.lang.String[] args)
Checks areguments and calls the parser.

Parameters:
args - Program arguments from the console. Possible arguments include:
  • inputfile.fdl
  • outputfile.h - Optional
  • "?" or "help"
See Also:
parseFile(String, String), printUsage(PrintStream)

setBuildFailed

public static void setBuildFailed()
Changes the build status to failure. It's pretty hard to really necesitate this, besides a failure opening a input/output file.


parseFile

private static void parseFile(java.lang.String inFile,
                              java.lang.String outFile)
Parses an input file to create a properly formatted C header file. First checks input file grammer, outputs the file header, then traverses the AST tree to create and output frame attribute nodes.

Parameters:
inFile - Create output from this file.
outFile - Header file to send frame attribute data to.
See Also:
FrameAttrNode

printFileHeader

private static void printFileHeader(java.io.PrintStream out,
                                    java.lang.String inFile,
                                    java.lang.String outFile)
Prints the file header to a supplied PrintStream object. More specifically just outputs the file we are to create, the date, the input we got, and what is outputing this code (this compiler).

Parameters:
out - PrintStream to output this info to. Usually a file.
inFile - The input filename that we are processing.
outFile - The output filename.

printUsage

private static void printUsage(java.io.PrintStream out)
Prints help on how to run this program from the console. java -jar openfdl.jar inputfile.fdl [outputfile.h] inputfile.fdl is a *.fdl file created by the user. outputfile.h is the C header file to send output. If help is needed you may also use ? or help.

Parameters:
out - Send output to this PrintStream object. Usually System.out.

format

private static java.lang.String format(java.lang.String str,
                                       int width)
Right justifies the input string over the given width. If the given width is lower than the length of the string, nothing happens. Otherwise, the extra width will be added to the left of the string.
Ex: System.out.println(format("OpenFDL", 10)); results in [ OpenFDL] being printed.

Parameters:
str - Input string to right justify.
width - Length of new string to create, generally greater than length of input string.
Returns:
String containing enough spaces to right justify the given string over the input width.