platypus
Class Platypus

java.lang.Object
  extended by platypus.Platypus

public class Platypus
extends java.lang.Object

Main module for Platypus

Author:
alb (Andrew Binstock)

Field Summary
static OutputFormatObjectFactory formatFactory
          factory for output-format-dependent classes
static GDD gdd
          GDD: global document data: all data re the output file at any given point (singleton)
static GID gid
          GID: global input data: all data re the input file at any given moment (singleton)
static Literals lits
          resource bundle that holds all the literals used in Platypus (singleton)
static UserString macros
          user-defined strings, numerics, and macros
static SystemStrings platyStrings
          Platypus system strings.
 
Constructor Summary
Platypus()
          Creates the global data blocks, gets the literals resource bundle, sets up our default logger, and finally creates the data structures for an output file.
 
Method Summary
private static void addCommandLineToPlatyStrings(java.lang.String[] args)
          add command line to table of Platypus system strings
static GDD.FileType identifyOutputFileType(java.lang.String filename)
          determine the file type of the output file
static void main(java.lang.String[] args)
          This mainline: 1) Sets up the major data structures 2) Writes the version number and copyright notice to the console 3) Checks that no command-line arg is longer than ARG_LEN_MAX bytes.
static int mainProcessing()
          The main processing routine.
static int processCommandLine(java.lang.String[] args)
          Processes the command line.
static int processCommandLineSwitches(java.lang.String[] args)
          processes all the items on the command line, other than the filenames of the input and output files.
static void processInputFile()
          the main routine that processes the input file
private static int processPsizeClSwitch(java.lang.String[] args, int i)
          Process the -psize command-line switch ( = page size )
private static void processVerboseClSwitch()
          Process the -verbose command-line switch ( = verbose output )
private static void processVVerboseClSwitch()
          Process the -vverbose command-line switch ( = very verbose output ) -vverbose implies -verbose
private static void showUsage()
          Prints the usage message to the console, unless gdd.logger is set to no messages (which only occurs in unit testing)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lits

public static Literals lits
resource bundle that holds all the literals used in Platypus (singleton)


gdd

public static GDD gdd
GDD: global document data: all data re the output file at any given point (singleton)


gid

public static GID gid
GID: global input data: all data re the input file at any given moment (singleton)


platyStrings

public static SystemStrings platyStrings
Platypus system strings. They are user-accessible as read-only


macros

public static UserString macros
user-defined strings, numerics, and macros


formatFactory

public static OutputFormatObjectFactory formatFactory
factory for output-format-dependent classes

Constructor Detail

Platypus

public Platypus()
Creates the global data blocks, gets the literals resource bundle, sets up our default logger, and finally creates the data structures for an output file.

Method Detail

processCommandLine

public static int processCommandLine(java.lang.String[] args)
Processes the command line.

Parameters:
args - The command-line args
Returns:
if no error, the number of args processed; otherwise, an error code.

identifyOutputFileType

public static GDD.FileType identifyOutputFileType(java.lang.String filename)
determine the file type of the output file

Parameters:
filename - name of the output file (from which we determine format)
Returns:
the FileType, or null on error

addCommandLineToPlatyStrings

private static void addCommandLineToPlatyStrings(java.lang.String[] args)
add command line to table of Platypus system strings

Parameters:
args - the command-line arguments

showUsage

private static void showUsage()
Prints the usage message to the console, unless gdd.logger is set to no messages (which only occurs in unit testing)


mainProcessing

public static int mainProcessing()
The main processing routine. Processes the input file, closes the file and optionally dumps the GDD

Returns:
Status.OK in all cases. Eventually, should have greater variation, perhaps.

processCommandLineSwitches

public static int processCommandLineSwitches(java.lang.String[] args)
processes all the items on the command line, other than the filenames of the input and output files.

Parameters:
args - the complete command line as specified by the user
Returns:
number of args, if all OK; else Status.INVALID_PARAM

processVerboseClSwitch

private static void processVerboseClSwitch()
Process the -verbose command-line switch ( = verbose output )


processVVerboseClSwitch

private static void processVVerboseClSwitch()
Process the -vverbose command-line switch ( = very verbose output ) -vverbose implies -verbose


processPsizeClSwitch

private static int processPsizeClSwitch(java.lang.String[] args,
                                        int i)
Process the -psize command-line switch ( = page size )

Parameters:
args - the command-line arguments
i - where -psize is in the array
Returns:
Status.OK if all is well; Status.INVALID_PARAM if there's a problem

processInputFile

public static void processInputFile()
the main routine that processes the input file


main

public static void main(java.lang.String[] args)
This mainline: 1) Sets up the major data structures 2) Writes the version number and copyright notice to the console 3) Checks that no command-line arg is longer than ARG_LEN_MAX bytes. (This is purely a security measure to protect against buffer oveflow-type attacks). If any exceeds that length, an error message in English is generated and program exits. 4) If all args are within prescribed length, the command line is processed 5) Then, the main processing is performed.

Parameters:
args - the command-line arguments


Copyright © 2006-7 Pacific Data Works LLC