|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.common.CodegenPrintWriter
public final class CodegenPrintWriter
A PrintWriter incorporating common functions called from our code generators
Delegates to at.dms.compiler.TabbedPrintWriter, which in turn delegates to
java.io.PrintWriter.
Includes print and println at the base types commonly found in the compiler
and for String. Printing of Object (as its toString()) is deliberately
missing from this implementation since it was causing bugs in the printing
of CType's.
To print a CType see ToCCommon.printType(at.dms.kjc.CType)
.
Includes an optional debugging feature to dump the caller's line number and
test to be printed on a print, println, or printnl.
Field Summary | |
---|---|
static boolean |
defaultDebug
Static field to set to get debug dumps from all instantiations. |
static int |
defaultDebugDepth
How many stack frames to go up to print caller information. |
Constructor Summary | |
---|---|
CodegenPrintWriter()
Construct with a StringWriter The contents of the string writer can be accessed with getString() |
|
CodegenPrintWriter(Writer w)
Construct with a Writer |
Method Summary | |
---|---|
void |
close()
Close underlying Writer, (and StringWriter if used CodegenPrintWriter() . |
int |
getColumn()
Get current column. |
int |
getIndentation()
Get current amount of intentation. |
int |
getLine()
Get line number. |
String |
getString()
Get string if you used constructor CodegenPrintWriter() . |
void |
indent()
Increment indentation level. |
void |
newline()
Synonym for newLine() . |
void |
newLine()
Start a new line. |
void |
outdent()
Decrement indentation level. |
void |
print(boolean b)
|
void |
print(char c)
|
void |
print(double d)
|
void |
print(float f)
|
void |
print(int i)
|
void |
print(String s)
Print something in the current line. |
void |
println()
|
void |
println(boolean b)
|
void |
println(char c)
|
void |
println(double d)
|
void |
println(float f)
|
void |
println(int i)
|
void |
println(String s)
Print something in the current line and terminate the line. |
void |
printSeveralLines(String s)
Print a string, possibly containing \n characters. |
void |
setIndentation(int pos)
Set current amount of indentation. |
void |
setTabSize(int tabSize)
Set tab size to some number of spaces (if you don't like the default). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean defaultDebug
public static int defaultDebugDepth
Constructor Detail |
---|
public CodegenPrintWriter(Writer w)
w
- A Writer that is already opened.public CodegenPrintWriter()
getString()
Method Detail |
---|
public int getLine()
public int getColumn()
public int getIndentation()
public void setIndentation(int pos)
indent()
and
outdent()
instead.
pos
- number of spaces to use for indentationpublic void setTabSize(int tabSize)
tabSize
- number of spaces added per indent()
and removed
per outdent()
public String getString()
CodegenPrintWriter()
.
public void indent()
public void outdent()
public void close()
CodegenPrintWriter()
.
public void newLine()
public void newline()
newLine()
.
public void print(String s)
s
- String to print.
Also overloaded for base types boolean, int, char, float, double.public void print(boolean b)
public void print(int i)
public void print(char c)
public void print(float f)
public void print(double d)
public void println(String s)
s
- String to print.
Also overloaded at base types boolean, int, char, float, double.
println() acts identically to newLine()
.public void println()
public void println(boolean b)
public void println(int i)
public void println(char c)
public void println(float f)
public void println(double d)
public void printSeveralLines(String s)
s
- String to print
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |