|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.copernicus.c.CodeGenerator
public abstract class CodeGenerator
A base class for C code generators in Ptolemy II.
| Red (ssb) |
| Red (ssb) |
| Field Summary | |
|---|---|
protected Context |
_context
Code generation context information. |
protected java.util.HashMap |
_requiredTypeMap
Mapping from classes that the current class depends on to their include file names. |
| Constructor Summary | |
|---|---|
CodeGenerator()
Construct a new code generator. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
_comment(java.lang.String text)
Enclose a given string of text within appropriate delimiters to form a comment in the generated code. |
protected java.lang.String |
_generateArrayInstanceDeclarations()
Generate code for typedef declaring array instances. |
protected java.lang.String |
_generateIncludeDirectives()
Generate include directives for all types that are required for the class that we are generating code for. |
protected java.lang.String |
_generateMethodHeader(soot.SootMethod method)
Generate header code for a method. |
protected java.lang.String |
_generateParameterTypeList(soot.SootMethod method)
Generate code for the parameter type list of a method, excluding parentheses. |
protected java.util.Iterator |
_getRequiredIncludeFiles()
Return an iterator over the include files required by the generated code. |
protected java.lang.String |
_indent(int level)
Return a string that generates an indentation string (a sequence of spaces) for the given indentation level. |
protected void |
_removeRequiredType(soot.SootClass source)
Remove a class from the list of required types (types whose associated include files must be imported) if the class exists in the list. |
protected void |
_updateRequiredTypes(soot.Type type)
Register a type as a type that must be imported into the generated code through an #include directive. |
protected void |
_warn(java.lang.String message)
Issue a warning message to standard error. |
abstract java.lang.String |
generate(soot.SootClass source)
Given a class, return the code generated by this code generator for the class. |
void |
setSingleClassMode()
Turn on (enable) single class mode translation (see Context.getSingleClassMode()). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Context _context
protected java.util.HashMap _requiredTypeMap
| Constructor Detail |
|---|
public CodeGenerator()
| Method Detail |
|---|
public abstract java.lang.String generate(soot.SootClass source)
source - The class.
public void setSingleClassMode()
Context.getSingleClassMode()).
protected final java.lang.String _comment(java.lang.String text)
text - The text to place in the generated comment.
protected java.lang.String _generateArrayInstanceDeclarations()
protected java.lang.String _generateIncludeDirectives()
protected java.lang.String _generateMethodHeader(soot.SootMethod method)
method - The method.
protected java.lang.String _generateParameterTypeList(soot.SootMethod method)
method - The method.
protected java.util.Iterator _getRequiredIncludeFiles()
protected java.lang.String _indent(int level)
level - The indentation level.
protected void _removeRequiredType(soot.SootClass source)
source - The class.protected void _updateRequiredTypes(soot.Type type)
type - The type.protected void _warn(java.lang.String message)
message - The warning message.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||