|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.copernicus.c.MethodCodeGenerator
public class MethodCodeGenerator
Class that encapsulates functionality for generating C code from a SootMethod.
| Red (ssb) |
| Red ( |
| Constructor Summary | |
|---|---|
MethodCodeGenerator(Context context,
java.util.HashMap requiredTypeMap)
Construct a MethodCodeGenerator object. |
|
| 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 |
_declareExceptionVariables(ExceptionTracker tracker)
Generate the declarations for variables used in exception-tracking. |
protected java.lang.String |
_generateEpilogue(ExceptionTracker tracker,
CSwitch visitor)
Generate the epilogue. |
protected java.lang.String |
_generateExceptionMap(ExceptionTracker tracker,
CSwitch visitor)
Generate the exception map. |
protected java.lang.String |
_generateLocal(soot.SootMethod method,
java.util.HashSet parameterAndThisLocals)
Generate code to declare and initialize local variables. |
protected java.lang.String |
_generateMethodBody(soot.SootMethod method,
CSwitch visitor,
ExceptionTracker tracker,
java.lang.String thisLocalName)
Generate the code for the body of a method. |
protected java.lang.String |
_generateMethodDeclaration(soot.SootMethod method,
java.util.HashSet parameterAndThisLocals,
java.lang.String thisLocalName)
Generate the method header for the code. |
protected java.lang.String |
_generateMethodPrologue(ExceptionTracker tracker,
CSwitch visitor)
Generate prologue code to be inserted in a method for exception-catching. |
protected java.lang.String |
_generateMethodUnitCode(ExceptionTracker tracker,
CSwitch visitor,
soot.SootMethod method,
byte indentLevel)
Generate the method unit code and code for handling exceptions. |
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 |
_initializeLabels(CSwitch visitor,
ExceptionTracker tracker,
soot.SootMethod method)
Initialize the labels for branch targets in the method. |
protected void |
_updateRequiredTypes(soot.Type type)
Register a type as a type that must be imported into the generated code through an #include directive. |
java.lang.String |
generate(soot.SootMethod method)
Generate code for a method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MethodCodeGenerator(Context context,
java.util.HashMap requiredTypeMap)
context - a Context objectrequiredTypeMap - a HashMap object| Method Detail |
|---|
public java.lang.String generate(soot.SootMethod method)
method - The method.
protected final java.lang.String _comment(java.lang.String text)
text - The text to place in the generated comment.
protected java.lang.String _declareExceptionVariables(ExceptionTracker tracker)
tracker - The ExceptionTracker for the method for which the
declarations are needed.
protected java.lang.String _generateEpilogue(ExceptionTracker tracker,
CSwitch visitor)
tracker - The ExceptionTrackervisitor - The visitor.
protected java.lang.String _generateExceptionMap(ExceptionTracker tracker,
CSwitch visitor)
tracker - The ExceptionTrackervisitor - The visitor
protected java.lang.String _generateLocal(soot.SootMethod method,
java.util.HashSet parameterAndThisLocals)
method - The method for which declarations are
needed.parameterAndThisLocals - The parameters of this method, and
variables that are local to the instance of the class to which this
method belongs. These variables do NOT need to be declared
or initialized by this method.
protected java.lang.String _generateMethodBody(soot.SootMethod method,
CSwitch visitor,
ExceptionTracker tracker,
java.lang.String thisLocalName)
method - The method for which code is needed.visitor - The visitor.tracker - The ExceptionTracker.thisLocalName - The local name.
protected java.lang.String _generateMethodDeclaration(soot.SootMethod method,
java.util.HashSet parameterAndThisLocals,
java.lang.String thisLocalName)
method - The method.parameterAndThisLocals - The set of parameters and local
variables for this method.thisLocalName - The local name.
protected java.lang.String _generateMethodPrologue(ExceptionTracker tracker,
CSwitch visitor)
tracker - The ExceptionTracker that has the information for
exceptions in this method.visitor - The local CSwitch visitor object.
protected java.lang.String _generateMethodUnitCode(ExceptionTracker tracker,
CSwitch visitor,
soot.SootMethod method,
byte indentLevel)
tracker - The ExceptionTracker object handing exceptions here.visitor - The CSwitch visitor.method - The method for which code is needed.indentLevel - The level of indentation needed in each
statement.
protected java.lang.String _indent(int level)
level - The indentation level.
protected void _initializeLabels(CSwitch visitor,
ExceptionTracker tracker,
soot.SootMethod method)
visitor - The visitor design pattern.tracker - The ExceptionTracker.method - The method for which labels need to be initialized.protected void _updateRequiredTypes(soot.Type type)
type - The type.
Same as the corresponding method in CodeGenerator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||