scale.common
Class EmitToFile

java.lang.Object
  extended by scale.common.Emit
      extended by scale.common.EmitToFile

public class EmitToFile
extends Emit

A class for emitting code sequences to a file.

$Id: EmitToFile.java,v 1.10 2005-02-07 21:28:21 burrill Exp $

Copyright 2005 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.


Field Summary
 
Fields inherited from class scale.common.Emit
currentColumn, currentLine, lineStart, numIndent, spaces
 
Constructor Summary
EmitToFile(java.io.PrintWriter pw, int indent)
          Create a class to use in writing out generated code.
 
Method Summary
 void emit(char c)
          Print a char to the output.
 void emit(int n)
          Print an integer to the output.
 void emit(long n)
          Print a long to the output.
 void emit(java.lang.String s)
          Print a string to the output.
 void endLine()
          Signal the end of the current line and start a new one.
 void flush()
          Flush the current output
 
Methods inherited from class scale.common.Emit
decIndLevel, getCurrentColumn, getCurrentLine, incIndLevel, indent, newLine, setIndentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmitToFile

public EmitToFile(java.io.PrintWriter pw,
                  int indent)
Create a class to use in writing out generated code.

Parameters:
pw - is the stream to which the code is written
indent - is the number of spaces to indent
Method Detail

emit

public void emit(java.lang.String s)
Print a string to the output. If we are at the beginning of a line, then generate some indentation.

Specified by:
emit in class Emit

emit

public void emit(int n)
Print an integer to the output. If we are at the beginning of a line, then generate some indentation.

Specified by:
emit in class Emit

emit

public void emit(long n)
Print a long to the output. If we are at the beginning of a line, then generate some indentation.

Specified by:
emit in class Emit

emit

public void emit(char c)
Print a char to the output. If we are at the beginning of a line, then generate some indentation.

Specified by:
emit in class Emit

endLine

public void endLine()
Signal the end of the current line and start a new one.

Overrides:
endLine in class Emit

flush

public void flush()
Flush the current output