|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object CBasicVisitor ujf.verimag.bip.codegen.CBipVisitor ujf.verimag.bip.codegen.C2BIPVisitor
public class C2BIPVisitor
Visitor that generates BIP code as a ASG composed of BIP metamodel objects. It can use the result from the FindInteractionPoint visitor.
FindInteractionPoint
Field Summary | |
---|---|
protected boolean |
activated
if set to false, no BIP is created. |
protected PetriNet |
behav
|
protected CGenerator |
cGeneratorForCGeneration
|
protected java.util.Map<Statement,java.util.Set<InteractionPoint>> |
contains_interaction
Contains all objects that contain interaction with one or many interface. |
protected AtomType |
ct
|
protected StatementBlock |
current_block
|
protected State |
current_state
|
protected Transition |
current_transition
|
protected java.lang.String |
entryFunction
The function name considered as the root of the call graph (first transition in the automaton) |
protected boolean |
fold_code_block
if set to true, the visitor tries to fold the C code when it does not contain any 'interaction'. |
protected StatementBlock |
header_block
|
protected State |
init_state
The initial state of the created automaton |
protected StatementBlock |
initialization_block
This block contains the C code used at initialization |
protected PortDefinition |
internal_stepp
|
protected java.util.logging.Logger |
logger
|
protected Module |
model
The BIP Model corresponding to the function 'entryFunction'. |
protected Variable |
return_data
|
protected PortDefinition |
returnp
|
protected int |
state_index
|
protected boolean |
useContextForCGeneration
When true, the generateCodeFromCodegen will always use the same visitor (preserving the context). |
Fields inherited from class ujf.verimag.bip.codegen.CBipVisitor |
---|
interaction_method_names |
Constructor Summary | |
---|---|
C2BIPVisitor()
Default constructor, to create a visitor that appends to model created by previous visitors. |
|
C2BIPVisitor(boolean fold)
Default constructor, to create a visitor that appends to model created by previous visitors. |
|
C2BIPVisitor(java.lang.String entryFunctionName,
java.lang.String topCompName,
java.util.Map<java.lang.String,java.lang.String> dataAttributes,
Module bipModule,
boolean fold_code_block)
Creates a new visitor. |
|
C2BIPVisitor(java.lang.String entryFunctionName,
java.lang.String topCompName,
Module bipModule,
boolean fold_code_block)
Creates a new visitor. |
|
C2BIPVisitor(java.lang.String entryFunctionName,
java.lang.String topCompName,
Module bipModule,
java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction,
boolean fold_code_block)
Creates a new visitor. |
|
C2BIPVisitor(java.lang.String entryFunctionName,
java.lang.String topCompName,
java.lang.String packageName)
Creates a new visitor. |
|
C2BIPVisitor(java.lang.String entryFunctionName,
java.lang.String topCompName,
java.lang.String packageName,
java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction)
Creates a new visitor and enables the code folding if possible. |
|
C2BIPVisitor(java.lang.String entryFunctionName,
java.lang.String topCompName,
java.lang.String packageName,
java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction,
boolean fold_code_block)
Creates a new visitor. |
Method Summary | ||
---|---|---|
protected void |
addActionToCurrentTransition(Action action)
Adds an action to the current transition |
|
protected State |
createNextState(boolean update_current_state)
|
|
protected State |
createNextState(java.lang.String prefix)
|
|
protected void |
doWhileLoop(
Utility function to generate BIP from for(;;){} and while(){} loops. |
|
protected java.lang.String |
generateCodeFromCodegen(Statement s)
Helper method to create a String from a Codegen Statement object |
|
Module |
getModel()
|
|
static
|
preprocessesFile(java.lang.String srcFileName,
java.util.List<java.lang.String> preProcCommand,
java.lang.String destFilePrefix,
boolean debugCommand,
java.io.File destFile,
java.lang.String context)
|
|
protected void |
purgeCurrentBlockToCurrentTransition(boolean close_transition)
Puts all the statements gathered after last purge (or beginning) to the actions on the current transition. |
|
protected void |
purgeCurrentBlockToCurrentTransition(boolean close_transition,
Transition[] extra_transitions)
Puts all the statements gathered after last purge (or beginning) to the actions on the current transition. |
|
void |
setContainsInteraction(java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction)
|
|
protected BinaryExpression |
translateBinaryCodegenToBIPBinaryExpression(CBinaryExpression cbe)
Translate a simple CBinaryExpression codegen object to a BinaryExpression in the BIP metamodel |
|
void |
visit(
|
|
|
visit(
|
|
|
visit(
|
|
|
visit(
|
|
|
visit(
|
|
void |
visit(For c)
|
|
void |
visit(FunctionCall s)
|
|
void |
visit(IfElse c)
|
|
void |
visit(Return c)
|
|
void |
visit(StatementBlock b)
|
|
void |
visit(WhileDo c)
|
Methods inherited from class ujf.verimag.bip.codegen.CBipVisitor |
---|
addInteractionMethod, addInteractionMethod, clearInteractionMethods, getMatchForFunctionCall, matchAnyFunctionCall |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.logging.Logger logger
protected boolean useContextForCGeneration
protected CGenerator cGeneratorForCGeneration
protected java.lang.String entryFunction
protected boolean activated
protected Module model
protected State init_state
protected PetriNet behav
protected AtomType ct
protected State current_state
protected Transition current_transition
protected StatementBlock current_block
protected final StatementBlock header_block
protected PortDefinition internal_stepp
protected PortDefinition returnp
protected Variable return_data
protected int state_index
protected StatementBlock initialization_block
protected java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction
protected final boolean fold_code_block
Constructor Detail |
---|
public C2BIPVisitor(java.lang.String entryFunctionName, java.lang.String topCompName, Module bipModule, java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction, boolean fold_code_block)
entryFunctionName
- the C function name to look for during the visittopCompName
- the name of the newly created component (corresponding to the C function)bipModule
- existing BIP packagecontains_interaction
- a map associating Statement to set of interactions.fold_code_block
- if true, the visitor tries to reduce automaton size.public C2BIPVisitor(java.lang.String entryFunctionName, java.lang.String topCompName, Module bipModule, boolean fold_code_block)
entryFunctionName
- the C function name to look for during the visittopCompName
- the name of the newly created component (corresponding to the C function)bipModule
- existing BIP packagefold_code_block
- if true, the visitor tries to reduce automaton size.public C2BIPVisitor(java.lang.String entryFunctionName, java.lang.String topCompName, java.util.Map<java.lang.String,java.lang.String> dataAttributes, Module bipModule, boolean fold_code_block)
entryFunctionName
- the C function name to look for during the visittopCompName
- the name of the newly created component (corresponding to the C function)dataAttributes
- a map of extra data attributes to include in the new AtombipModule
- existing BIP packagefold_code_block
- if true, the visitor tries to reduce automaton size.public C2BIPVisitor(java.lang.String entryFunctionName, java.lang.String topCompName, java.lang.String packageName, java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction, boolean fold_code_block)
entryFunctionName
- the C function name to look for during the visittopCompName
- the name of the newly created component (corresponding to the C function)packageName
- the name for the newly created packagecontains_interaction
- a map associating Statement to set of interactions.fold_code_block
- if true, the visitor tries to reduce automaton size.public C2BIPVisitor(java.lang.String entryFunctionName, java.lang.String topCompName, java.lang.String packageName)
entryFunctionName
- the C function name to look for during the visittopCompName
- the name of the newly created component (corresponding to the C function)packageName
- the name for the newly created packagepublic C2BIPVisitor(java.lang.String entryFunctionName, java.lang.String topCompName, java.lang.String packageName, java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction)
entryFunctionName
- the C function name to look for during the visittopCompName
- the name of the newly created component (corresponding to the C function)packageName
- the name for the newly created packagecontains_interaction
- a map associating Statement to set of interactions.public C2BIPVisitor()
public C2BIPVisitor(boolean fold)
fold
- if true, the visitor tries to reduce automaton size.Method Detail |
---|
public void setContainsInteraction(java.util.Map<Statement,java.util.Set<InteractionPoint>> contains_interaction)
public static <SC extends CStatement> java.lang.String preprocessesFile(java.lang.String srcFileName, java.util.List<java.lang.String> preProcCommand, java.lang.String destFilePrefix, boolean debugCommand, java.io.File destFile, java.lang.String context) throws java.lang.Exception
java.lang.Exception
protected java.lang.String generateCodeFromCodegen(Statement s)
s
- a C statement
public Module getModel()
protected void purgeCurrentBlockToCurrentTransition(boolean close_transition)
close_transition
- if true, also closes the current transition with a new stateprotected void addActionToCurrentTransition(Action action)
action
- the action to addprotected void purgeCurrentBlockToCurrentTransition(boolean close_transition, Transition[] extra_transitions)
close_transition
- if true, also closes the current transition with a new stateprotected State createNextState(boolean update_current_state)
protected State createNextState(java.lang.String prefix)
protected BinaryExpression translateBinaryCodegenToBIPBinaryExpression(CBinaryExpression cbe)
cbe
- the binary expression in codegen
protected void doWhileLoop(condition, CBlock cblock, ForIter foriter)
condition
- the condition for looping before each iterationcblock
- the code block to execute during each iterationforiter
- the code to be executed between all iterationspublic void visit(StatementBlock b)
public void visit(Return c)
public <TypeClass extends CType> void visit(d)
public void visit(WhileDo c)
public void visit(For c)
public void visit(IfElse c)
public <RetTypeClass extends CType> void visit(s)
public void visit(FunctionCall s)
public <TypeClass extends CType> void visit(e)
public <TypeClass extends CType> void visit(d)
public void visit(b)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |