ujf.verimag.bip.codegen
Class C2BIPUtil

java.lang.Object
  extended by ujf.verimag.bip.codegen.C2BIPUtil

public abstract class C2BIPUtil
extends java.lang.Object

Helper class for translating C to BIP.


Field Summary
protected static java.util.logging.Logger logger
           
 
Constructor Summary
C2BIPUtil()
           
 
Method Summary
static Module c2bipAsModel(java.lang.String c_filename, boolean use_cpp, java.lang.String context, InteractionPoint[] interaction_points, Module bipModule, C2BIPVisitor v)
          Translates a C file into an abstract model using the BIP metamodel.
static java.lang.String c2bipAsString(java.lang.String c_filename, boolean use_cpp, java.lang.String context, InteractionPoint[] interaction_points, C2BIPVisitor v)
          Translates a C file into BIP (as a String).
static java.lang.String c2bipAsString(java.lang.String c_filename, boolean use_cpp, java.lang.String context, InteractionPoint[] interaction_points, Module bipModule, C2BIPVisitor v)
          Translates a C file into BIP (as a String).
static StatementBlock getStatementForCFile(java.lang.String c_filename, boolean use_cpp, java.lang.String context)
          Returns the codegen AST corresponding to a given C source file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static java.util.logging.Logger logger
Constructor Detail

C2BIPUtil

public C2BIPUtil()
Method Detail

getStatementForCFile

public static StatementBlock getStatementForCFile(java.lang.String c_filename,
                                                  boolean use_cpp,
                                                  java.lang.String context)
                                           throws java.lang.Exception
Returns the codegen AST corresponding to a given C source file. The file can be pre-processed, and a context can be used.

Parameters:
c_filename - the C source filename
use_cpp - if true, the cpp is used
context - a C code used as a context
Returns:
a statement block
Throws:
java.lang.Exception - in case an error happens (mainly file io related)

c2bipAsModel

public static Module c2bipAsModel(java.lang.String c_filename,
                                  boolean use_cpp,
                                  java.lang.String context,
                                  InteractionPoint[] interaction_points,
                                  Module bipModule,
                                  C2BIPVisitor v)
                           throws java.lang.Exception
Translates a C file into an abstract model using the BIP metamodel.

Parameters:
c_filename - path to the C source file
use_cpp - if true, the cpp is used before parsing
context - contains extra C statement if needed, such as cpp macro. Can be null.
interaction_points - an array for functions considered as interaction points
Returns:
a Package object corresponding to the C code
Throws:
java.lang.Exception

c2bipAsString

public static java.lang.String c2bipAsString(java.lang.String c_filename,
                                             boolean use_cpp,
                                             java.lang.String context,
                                             InteractionPoint[] interaction_points,
                                             C2BIPVisitor v)
                                      throws java.lang.Exception
Translates a C file into BIP (as a String).

Parameters:
c_filename - path to the C source file
use_cpp - if true, the cpp is used before parsing
context - contains extra C statement if needed, such as cpp macro. Can be null.
interaction_points - an array for functions considered as interaction points
Returns:
a string corresponding to the C code
Throws:
java.lang.Exception

c2bipAsString

public static java.lang.String c2bipAsString(java.lang.String c_filename,
                                             boolean use_cpp,
                                             java.lang.String context,
                                             InteractionPoint[] interaction_points,
                                             Module bipModule,
                                             C2BIPVisitor v)
                                      throws java.lang.Exception
Translates a C file into BIP (as a String).

Parameters:
c_filename - path to the C source file
use_cpp - if true, the cpp is used before parsing
context - contains extra C statement if needed, such as cpp macro. Can be null.
interaction_points - an array for functions considered as interaction points
Returns:
a string corresponding to the C code
Throws:
java.lang.Exception