public class XcodeML extends Xnode
LHS, RHS, UNDEF_DEPTH
Modifier | Constructor and Description |
---|---|
protected |
XcodeML(org.w3c.dom.Document baseElement)
Constructs a basic XcodeML object representing the XcodeML file given in
input.
|
Modifier and Type | Method and Description |
---|---|
Xnode |
createAndAddParam(java.lang.String nameValue,
java.lang.String type,
FfunctionType fctType)
Create a name node and adds it as a parameter of the given function
type.
|
Xnode |
createAndAddParamIfNotExists(java.lang.String nameValue,
java.lang.String type,
FfunctionType fctType)
Create a name node and adds it as a parameter of the given function
type if this parameter does not exist yet.
|
Xnode |
createArrayRef(FbasicType type,
Xnode var)
Create a new FarrayRef node with varRef node as a child with the
given Var element.
|
FbasicType |
createBasicType(FortranType type,
Intent intent)
Constructs a new basicType node with attributes.
|
FbasicType |
createBasicType(java.lang.String type,
java.lang.String ref,
Intent intent)
Constructs a new basicType node with attributes.
|
Xnode |
createDoStmt(Xnode inductionVar,
Xnode indexRange)
Create a new FdoStatement node with an empty body.
|
Xnode |
createEmptyAssumedShaped()
Create an empty assumed shape indexRange node.
|
Xnode |
createFctCall(java.lang.String returnType,
java.lang.String fctName,
java.lang.String fctType)
Create a new functionCall node with name and arguments as children nodes.
|
FfunctionType |
createFunctionType(java.lang.String type)
Create a new FfunctionType with empty params child.
|
Xid |
createId(FortranType type,
XstorageClass sclass,
java.lang.String idValue)
Create a new Id node with all the underlying needed node and attributes.
|
Xid |
createId(java.lang.String type,
XstorageClass sclass,
java.lang.String idValue)
Create a new Id node with all the underlying needed node and attributes.
|
void |
createIdAndDecl(java.lang.String name,
FortranType type,
XstorageClass sclass,
FfunctionDefinition fctDef,
DeclarationPosition declPos)
Create the id and varDecl nodes and add them to the symbol/declaration
table.
|
void |
createIdAndDecl(java.lang.String name,
java.lang.String type,
XstorageClass sclass,
FfunctionDefinition fctDef,
DeclarationPosition declPos)
Create the id and varDecl nodes and add them to the symbol/declaration
table.
|
Xnode |
createIfThen()
Create a new FifStatement node with an empty condition and then body.
|
Xnode |
createIntConstant(int value)
Create a FintConstant node with the given value.
|
Xnode |
createName(java.lang.String value,
java.lang.String type)
Constructs a new name node with name value and optional type.
|
Xnode |
createNamedValue(java.lang.String value)
Create a new namedValue node with its attribute.
|
Xnode |
createNode(Xcode opcode)
Create a new node in the current translation unit.
|
java.util.List<Xnode> |
createPragma(java.lang.String value,
int maxColumn)
Create a list of FpragmaStatement with correct line continuation symbols.
|
Xnode |
createPrintStatement(java.lang.String format,
java.lang.String[] charConstants)
Create a print statement with the given char constants.
|
Xnode |
createRangeForAssumedShapeArray(Xnode arrayVar,
int startIndex,
int dimension)
Create an indexRange element to loop over an assumed shape array.
|
Xnode |
createVar(FortranType type,
java.lang.String value,
Xscope scope)
Create a new var node.
|
Xnode |
createVar(java.lang.String type,
java.lang.String value,
Xscope scope)
Create a new var node.
|
Xnode |
createVarDecl(FortranType nameType,
java.lang.String nameValue)
Create a new varDecl node with all the mandatory nodes.
|
Xnode |
createVarDecl(java.lang.String varType,
java.lang.String varId)
Create a new varDecl node with all the mandatory nodes.
|
java.util.List<FfunctionDefinition> |
getAllFctDef()
Retrieve all function definitions in the XcodeProgram unit.
|
org.w3c.dom.Document |
getDocument() |
XtypeTable |
getTypeTable()
Get the type table of the FortranModule module.
|
Xnode |
importConstOrVar(Xnode base,
XcodeML xcodemlSrc)
Create a copy of a variable element or an integer constant from a XcodeML
unit to this unit.
|
Xnode |
importNode(Xnode node)
Import node to current XcodeML translation unit.
|
void |
importType(XcodeML src,
java.lang.String typeId)
Import a type description from one XcodeML unit to the current one.
|
void |
write(java.lang.String outputFile,
int indent)
Write the XcodeML to file or std out
|
ancestor, append, append, body, child, children, cloneNode, cloneRawNode, compareFirstChildValues, compareOptionalValues, compareValues, constructRepresentation, copyAttribute, copyEnhancedInfo, delete, deleteWithSiblings, depth, element, equals, filename, findParentFunction, findParentModule, firstChild, getAttribute, getBooleanAttribute, getType, hasAttribute, hasBody, hashCode, hasSameParentBlock, insert, insert, insertAfter, insertBefore, isDeleted, isDirectSibling, isNestedIn, lastChild, lineNo, matchAll, matchAllAncestor, matchAllAncestor, matchAncestor, matchDescendant, matchDirectDescendant, matchDirectDescendant, matchSeq, matchSibling, nextSibling, opcode, prevSibling, removeAttribute, setAttribute, setBooleanAttribute, setFilename, setLine, setType, setValue, toString, value
protected XcodeML(org.w3c.dom.Document baseElement)
baseElement
- Document representing the XcodeML file.public Xnode createNode(Xcode opcode)
opcode
- Opcode of the new node.public org.w3c.dom.Document getDocument()
public XtypeTable getTypeTable()
public java.util.List<FfunctionDefinition> getAllFctDef()
public Xnode importConstOrVar(Xnode base, XcodeML xcodemlSrc) throws IllegalTransformationException
base
- Base element to be copied.xcodemlSrc
- Source XcodeML unit.IllegalTransformationException
- If the variable element doesn't meet
the criteria.public void importType(XcodeML src, java.lang.String typeId)
src
- Source XcodeML unit.typeId
- Type id to be imported.public Xnode importNode(Xnode node)
node
- Node to import.public void write(java.lang.String outputFile, int indent) throws IllegalTransformationException
outputFile
- Path of the output file or null to output on std outindent
- Number of spaces used for the indentationIllegalTransformationException
- if XML file cannot be written.public Xnode createName(java.lang.String value, java.lang.String type)
<name type="type">value</name>
value
- Name value.type
- Optional type value.public void createIdAndDecl(java.lang.String name, FortranType type, XstorageClass sclass, FfunctionDefinition fctDef, DeclarationPosition declPos)
name
- Name of the variable.type
- Type of the variable.sclass
- Scope class of the variable (from Xname).fctDef
- Function definition in which id and decl are created.declPos
- Position of the newly inserted declaration.public void createIdAndDecl(java.lang.String name, java.lang.String type, XstorageClass sclass, FfunctionDefinition fctDef, DeclarationPosition declPos)
name
- Name of the variable.type
- Type of the variable.sclass
- Scope class of the variable (from Xname).fctDef
- Function definition in which id and decl are created.declPos
- Position of the newly inserted declaration.public Xnode createNamedValue(java.lang.String value)
<namedValue name="value"></namedValue>
value
- Value of the name attribute.public Xnode createVar(FortranType type, java.lang.String value, Xscope scope)
<Var type="type" scope="scope">value</Var>
type
- Value of the type attribute.value
- Value of the var.scope
- Value of the scope attribute.public Xnode createVar(java.lang.String type, java.lang.String value, Xscope scope)
<Var type="type" scope="scope">value</Var>
type
- Value of the type attribute.value
- Value of the var.scope
- Value of the scope attribute.public Xnode createFctCall(java.lang.String returnType, java.lang.String fctName, java.lang.String fctType)
<functionCall type="returnType">
<name type="fctType">fctName</name>
<arguments></arguments>
</functionCall>
returnType
- Value of the type attribute for the functionCall node.fctName
- Value of the name node.fctType
- Value of the type attribute for the name node.public FfunctionType createFunctionType(java.lang.String type)
<functionCall type="returnType">
<name type="fctType">fctName</name>
<arguments></arguments>
</functionCall>
type
- Type hash of the FfunctionType node.public Xnode createArrayRef(FbasicType type, Xnode var)
<FarrayRef type="type">
<varRef type="">
<Var/> <!-- var argument -->
</varRef>
</FarrayRef>
type
- Value of the type attribute for the FarrayRef node.var
- Var node nested in the varRef element.public Xid createId(FortranType type, XstorageClass sclass, java.lang.String idValue)
<id type="type" sclass="sclass">idValue</id>
type
- Value for the attribute type.sclass
- Value for the attribute sclass.idValue
- Value of the name inner element.public Xid createId(java.lang.String type, XstorageClass sclass, java.lang.String idValue)
<id type="type" sclass="sclass">idValue</id>
type
- Value for the attribute type.sclass
- Value for the attribute sclass.idValue
- Value of the name inner element.public Xnode createVarDecl(FortranType nameType, java.lang.String nameValue)
<varDecl>
<name type="varType">varId</name>
</varDecl>
nameType
- Value for the attribute type of the name node.nameValue
- Value of the name inner node.public Xnode createVarDecl(java.lang.String varType, java.lang.String varId)
<varDecl>
<name type="varType">varId</name>
</varDecl>
varType
- Value for the attribute type of the name node.varId
- Value of the name inner node.public FbasicType createBasicType(FortranType type, Intent intent)
<FbasicType type="type" ref="ref" intent="intent"/>
type
- Reference built-in type.intent
- Optional intent value.public FbasicType createBasicType(java.lang.String type, java.lang.String ref, Intent intent)
<FbasicType type="type" ref="ref" intent="intent"/>
type
- Type attribute value.ref
- Reference attribute value.intent
- Optional intent value.public Xnode createEmptyAssumedShaped()
<indexRange is_assumed_shape="true"></indexRange>
public Xnode createDoStmt(Xnode inductionVar, Xnode indexRange)
<FdoStatement>
<Var></Var> <!-- provided as argument -->
<indexRange></indexRange> <!-- provided as argument -->
<body></body>
</FdoStatement>
inductionVar
- Var element for the induction variable.indexRange
- indexRange element for the iteration range.public Xnode createIfThen()
<FifStatement>
<condition></condition>
<then>
<body></body>
</then>
</FifStatement>
public Xnode createRangeForAssumedShapeArray(Xnode arrayVar, int startIndex, int dimension)
arrayVar
- Var element representing the array variable.startIndex
- Lower bound index value.dimension
- Dimension index for the upper bound value.public Xnode createAndAddParam(java.lang.String nameValue, java.lang.String type, FfunctionType fctType)
nameValue
- Value of the name node to create.type
- Type of the name node to create.fctType
- Function type in which the node will be added as a
parameter.public Xnode createAndAddParamIfNotExists(java.lang.String nameValue, java.lang.String type, FfunctionType fctType)
nameValue
- Value of the name node to create.type
- Type of the name node to create.fctType
- Function type in which the node will be added as a
parameter.public Xnode createPrintStatement(java.lang.String format, java.lang.String[] charConstants)
<FprintStatement format="format">
<valueList>
<value> <!-- a value node by element in charConstants -->
<!-- FcharacterConstant type are created on the fly -->
<FcharacterConstant type="cType">charConstants</FcharacterConstant>
</value>
</valueList>
</FprintStatement>
format
- Format for the print statement.charConstants
- Array of char constants to be created.public Xnode createIntConstant(int value)
<FintConstant type="Fint">value</FintConstant>
value
- Value assigned to the int constant.public java.util.List<Xnode> createPragma(java.lang.String value, int maxColumn)
value
- Value of the FpragmaStatement.maxColumn
- Maximum column value. Split is based on this value.