|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.llnl.babel.backend.writers.PrettyWriter
gov.llnl.babel.backend.writers.LanguageWriter
gov.llnl.babel.backend.writers.LanguageWriterForC
public class LanguageWriterForC
Class LanguageWriterForC
extends the generic language
writer to provide additional capabilities for writing C code. This
class manages writing comment blocks as well as include files and
C++ external declaration guards.
Field Summary | |
---|---|
protected LineCountingFilterWriter |
d_lcfw
|
protected boolean |
d_skipIncludeGuard
|
Fields inherited from class gov.llnl.babel.backend.writers.LanguageWriter |
---|
d_context |
Constructor Summary | |
---|---|
LanguageWriterForC(java.io.PrintWriter writer,
Context context)
Create a LanguageWriterForC instance that will send
output to the specified print writer object. |
|
LanguageWriterForC(java.io.PrintWriter writer,
LineCountingFilterWriter lcfw,
Context context)
Create a LanguageWriterForC instance that will send
output to the specified print writer object. |
Method Summary | |
---|---|
void |
beginBlockComment(boolean is_doc)
Begin a block comment. |
void |
closeCxxExtern()
Close the C++ extern block at the end of the header file. |
void |
closeHeaderGuard()
Close the header guard at the end of the header file. |
void |
endBlockComment(boolean is_doc)
End a block comment. |
void |
generateInclude(java.lang.String file,
boolean guards)
Generate a user include statement for the specified include file. |
void |
generateSystemInclude(java.lang.String file)
Generate a system include statement for the specified include file. |
java.lang.String |
getIncludeGuard(java.lang.String file)
Generate the include guard from the specified file name. |
int |
getLineCount()
get current line (returns -1 iff lfcw == null ) |
void |
openCxxExtern()
Open the C++ extern block at the top of the header file. |
void |
openHeaderGuard(java.lang.String file)
Open the header include guard at the top of the header file. |
void |
redirectBegin(java.lang.String path,
int line)
Mark a region where the debugger should be redirected to another file starting on a specific line. |
void |
redirectEnd(java.lang.String path,
int line)
End the region where the debugger can just follow this file. |
java.lang.String |
safeCommentString(java.lang.String str)
Convert a string into a string that can safely be included inside a C comment. |
void |
skipIncludeGuard()
Turns openHeaderGuard & closeHeaderGuard into no-ops. |
static java.lang.String |
toSafeComment(java.lang.String str)
Convert a string into a string that can safely be included inside a C comment. |
static java.lang.String |
toSafeString(java.lang.String str)
Convert a string into a string that can safely be included inside a C string. |
void |
writeCommentLine(java.lang.String comment)
Output a single-line comment to the pretty writer stream. |
void |
writeSplicerTagLine(java.lang.String tagLine)
Write the splicer tag as a language-specific comment. |
Methods inherited from class gov.llnl.babel.backend.writers.LanguageWriter |
---|
writeBanner, writeComment, writeComment, writeComment, writeComment, writeComment, writeComment, writeComment |
Methods inherited from class gov.llnl.babel.backend.writers.PrettyWriter |
---|
backTab, changeTabLevel, close, defineBlockComment, disableBlockComment, disableLineBreak, enableBlockComment, enableLineBreak, enableLineBreak, flushPrintWriter, getPrintWriter, popLineBreak, print, printAligned, println, println, printlnUnformatted, printSpaces, printUnformatted, pushLineBreak, restoreFirstTabStop, setFirstTabStop, setLineBreakString, setStrictBreaking, setTabSpacing, setTemporaryFirstTabStop, tab |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean d_skipIncludeGuard
protected LineCountingFilterWriter d_lcfw
Constructor Detail |
---|
public LanguageWriterForC(java.io.PrintWriter writer, Context context)
LanguageWriterForC
instance that will send
output to the specified print writer object. Set up the output
properties of the language writer for C, which sets the first tab
stop at zero, a tab spacing of three, and line breaking at column
eighty.
public LanguageWriterForC(java.io.PrintWriter writer, LineCountingFilterWriter lcfw, Context context)
LanguageWriterForC
instance that will send
output to the specified print writer object. Set up the output
properties of the language writer for C, which sets the first tab
stop at zero, a tab spacing of three, and line breaking at column
eighty.
Method Detail |
---|
public void skipIncludeGuard()
public void redirectBegin(java.lang.String path, int line)
redirectBegin
in interface LineRedirector
public void redirectEnd(java.lang.String path, int line)
redirectEnd
in interface LineRedirector
public int getLineCount()
getLineCount
in interface LineRedirector
public void beginBlockComment(boolean is_doc)
beginBlockComment
in class LanguageWriter
public void endBlockComment(boolean is_doc)
endBlockComment
in class LanguageWriter
public void writeSplicerTagLine(java.lang.String tagLine)
writeSplicerTagLine
in class LanguageWriter
public void writeCommentLine(java.lang.String comment)
writeCommentLine
in class LanguageWriter
comment
- a single line comment to include in the outputLanguageWriter.safeCommentString(java.lang.String)
public void generateInclude(java.lang.String file, boolean guards)
public void generateSystemInclude(java.lang.String file)
public void openHeaderGuard(java.lang.String file)
public void closeHeaderGuard()
public void openCxxExtern()
public void closeCxxExtern()
public java.lang.String getIncludeGuard(java.lang.String file)
public static java.lang.String toSafeString(java.lang.String str)
str
- a string to make safe for inclusion in a string
public final java.lang.String safeCommentString(java.lang.String str)
safeCommentString
in class LanguageWriter
str
- a string to make safe for inclusion in a comment
public static java.lang.String toSafeComment(java.lang.String str)
str
- a string to make safe for inclusion in a comment
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |