Commit 9456ad3c authored by Hernan Ponce de Leon's avatar Hernan Ponce de Leon
Browse files

Merge remote-tracking branch 'origin/master' into 3465-IStatementTerm_toZ3

parents 9d3a2981 cccdb14e
ComponentContentProvider.java ca43a156b3748dbd3d7db6980668701f2862018a RED
DSEContentProviderBase.java 47ee32035915253649dfbedb65856abb796cf54d RED
DSETreeContentProvider.java a0f2c4dbeea8bb0ec57943c8585de9ff579cc98f RED
DSLPatternArchitectureContentProvider.java 60fa83087ec02d0c78f7760e70873cc7189a2c43 RED
DSLPatternArchitectureContentProvider.java 0397aa8e6a63406e4b9d452cac4fbc0f8477edf6 RED
ExplorationSolutionVisualizationUtils.java 3c65742386082d47ae21ecb8c2fc132ebf0d5e9a RED
ExplorationUiUtil.java 7e8e2b524d189e48f109b0ae0b3aeca140611e5a RED
ExplorationUiUtil.java dcf9d6b221fd4a5aa1e6eecee054142967e2ecb6 RED
HierarchicElementContentProvider.java b3403cb3e5b466d84a08c7e658dfbfc630fb0ec0 YELLOW
PerspectiveUtils.java 5a79fba794e160bd797cf7b0def022f545e50809 RED
SpiderChartUtils.java 6071c47e77c3bd0a9e0e57200cdb10d5ad2cfe06 RED
......@@ -25,7 +25,7 @@ import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
/**
* Similar to {@link ComponentContentProvider} but doesn't show the {@link ComponentArchitecture}
* Similar to {@link HierarchicElementContentProvider} but doesn't show the {@link ComponentArchitecture}
* Root.
*
* @author zverlov
......
......@@ -16,27 +16,19 @@
package org.fortiss.af3.exploration.ui.util;
import static java.util.Collections.sort;
import static org.fortiss.af3.deployment.utils.DeploymentUtils.isComponentDeployed;
import static org.fortiss.tooling.graphicsGL.ui.util.ColorUtil.rgbToColor3D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.graphics.RGB;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.deployment.model.ComponentAllocation;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.visualization.Axis;
import org.fortiss.tooling.base.model.visualization.DataSet;
import org.fortiss.tooling.base.model.visualization.DataSetCollection;
import org.fortiss.tooling.graphicsGL.model.Color3D;
import org.fortiss.tooling.kernel.utils.KernelModelElementUtils;
/**
* -- IMPORTANT: --
......@@ -185,52 +177,6 @@ public class ExplorationUiUtil {
return col;
}
/**
* Returns the top-level component of the given deployment whose children are deployed. Null
* if not every child is deployed
*/
public static Component getRootLevelComponent(ComponentAllocation allocation) {
Component component = allocation.getComponent();
ComponentArchitecture ca =
KernelModelElementUtils.getRootElement(component, ComponentArchitecture.class);
return ca.getTopComponent();
}
/**
* Returns the top-level component of the given deployment whose children are deployed. Null
* if not every child is deployed
*/
public static Component getTopLevelComponent(Deployment deployment) {
ArrayList<Component> topComponents = new ArrayList<Component>();
for(ComponentAllocation ca : deployment.getComponentAllocations()) {
Component top = (Component)ca.getComponent().eContainer();
List<IHierarchicElement> contained = top.getContainedElements();
for(IHierarchicElement el : contained) {
if(el instanceof Component) {
if(!isComponentDeployed((Component)el, deployment)) {
return null;
}
}
}
topComponents.add(top);
}
for(int i = 0; i < topComponents.size(); ++i) {
try {
// check if top components are all the same
if(!topComponents.get(i).equals(topComponents.get(i + 1))) {
return null;
}
} catch(IndexOutOfBoundsException e) {
// nothing to do
}
}
// cannot be empty at this point
return !topComponents.isEmpty() ? topComponents.get(0) : null;
}
/** Updates the tree with the current combo box selection. */
public static void updateTreeWithComboSelection(ComboViewer comboViewer, TreeViewer treeViewer) {
IStructuredSelection selection = (IStructuredSelection)comboViewer.getSelection();
......
......@@ -19,27 +19,24 @@ import java.util.List;
import org.conqat.ide.commons.ui.jface.TreeContentProviderBase;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
/**
* Copy and Paste of ComponentsContentProvider in safetycase plugin. Created in order to spare a
* further dependency.
* Tree content provider for {@link IHierarchicElement}s.
*
* @author eder
*/
public class ComponentContentProvider extends TreeContentProviderBase {
public class HierarchicElementContentProvider extends TreeContentProviderBase {
/** {@inheritDoc} */
@Override
public Object[] getChildren(Object element) {
if(element instanceof List) {
return ((List<?>)element).toArray();
} else if(element instanceof Component &&
((Component)element).getContainedElements().size() == 0) {
return null;
} else if(element instanceof IHierarchicElement) {
return ((IHierarchicElement)element).getContainedElements().toArray();
}
return ((IHierarchicElement)element).getContainedElements().toArray();
return new Object[0];
}
/** {@inheritDoc} */
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/jgrapht-core-1.2.0.jar" sourcepath="lib/jgrapht-core-1.2.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jgrapht-ext-1.2.0-uber.jar" sourcepath="lib/jgrapht-ext-1.2.0-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
......
......@@ -3,18 +3,43 @@ Bundle-ManifestVersion: 2
Bundle-Name: Exploration Meta Model
Bundle-SymbolicName: org.fortiss.af3.exploration;singleton:=true
Bundle-Version: 2.13.0.qualifier
Bundle-ClassPath: .
Bundle-ClassPath: .,
lib/jgrapht-core-1.2.0.jar,
lib/jgrapht-ext-1.2.0-uber.jar
Bundle-Vendor: fortiss GmbH
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.fortiss.af3.exploration.ExplorationActivator
Export-Package: org.fortiss.af3.efficientdeployment.model,
Export-Package: com.mxgraph.analysis,
com.mxgraph.canvas,
com.mxgraph.costfunction,
com.mxgraph.generatorfunction,
com.mxgraph.io,
com.mxgraph.layout,
com.mxgraph.layout.hierarchical,
com.mxgraph.layout.hierarchical.model,
com.mxgraph.layout.hierarchical.stage,
com.mxgraph.layout.orthogonal,
com.mxgraph.layout.orthogonal.model,
com.mxgraph.model,
com.mxgraph.reader,
com.mxgraph.shape,
com.mxgraph.swing,
com.mxgraph.swing.handler,
com.mxgraph.swing.util,
com.mxgraph.swing.view,
com.mxgraph.util,
com.mxgraph.util.png,
com.mxgraph.util.svg,
com.mxgraph.view,
org.fortiss.af3.efficientdeployment.model,
org.fortiss.af3.efficientdeployment.model.impl,
org.fortiss.af3.efficientdeployment.model.util,
org.fortiss.af3.exploration,
org.fortiss.af3.exploration.annotation,
org.fortiss.af3.exploration.backend,
org.fortiss.af3.exploration.compositor,
org.fortiss.af3.exploration.dsl_v2.model.arithmetic,
org.fortiss.af3.exploration.dsl_v2.model.arithmetic.impl,
org.fortiss.af3.exploration.dsl_v2.model.arithmetic.util,
......@@ -34,12 +59,14 @@ Export-Package: org.fortiss.af3.efficientdeployment.model,
org.fortiss.af3.exploration.dsl_v2.model.function.impl,
org.fortiss.af3.exploration.dsl_v2.model.function.util,
org.fortiss.af3.exploration.lang,
org.fortiss.af3.exploration.migration,
org.fortiss.af3.exploration.model,
org.fortiss.af3.exploration.model.arithmetic.impl,
org.fortiss.af3.exploration.model.booleanp.allocation.impl,
org.fortiss.af3.exploration.model.booleanp.comparison.impl,
org.fortiss.af3.exploration.model.booleanp.impl,
org.fortiss.af3.exploration.model.expression.impl,
org.fortiss.af3.exploration.model.function,
org.fortiss.af3.exploration.model.impl,
org.fortiss.af3.exploration.model.solutions,
org.fortiss.af3.exploration.model.solutions.impl,
......@@ -54,7 +81,36 @@ Export-Package: org.fortiss.af3.efficientdeployment.model,
org.fortiss.af3.exploration.projectmodel.dseModelAllocations.util,
org.fortiss.af3.exploration.projectmodel.impl,
org.fortiss.af3.exploration.projectmodel.util,
org.fortiss.af3.exploration.util
org.fortiss.af3.exploration.util,
org.jgrapht,
org.jgrapht.alg,
org.jgrapht.alg.clique,
org.jgrapht.alg.color,
org.jgrapht.alg.connectivity,
org.jgrapht.alg.cycle,
org.jgrapht.alg.flow,
org.jgrapht.alg.independentset,
org.jgrapht.alg.interfaces,
org.jgrapht.alg.isomorphism,
org.jgrapht.alg.matching,
org.jgrapht.alg.scoring,
org.jgrapht.alg.shortestpath,
org.jgrapht.alg.spanning,
org.jgrapht.alg.tour,
org.jgrapht.alg.util,
org.jgrapht.alg.util.extension,
org.jgrapht.alg.vertexcover,
org.jgrapht.alg.vertexcover.util,
org.jgrapht.event,
org.jgrapht.experimental,
org.jgrapht.ext,
org.jgrapht.generate,
org.jgrapht.graph,
org.jgrapht.graph.builder,
org.jgrapht.graph.concurrent,
org.jgrapht.graph.specifics,
org.jgrapht.traverse,
org.jgrapht.util
Require-Bundle: org.fortiss.af3.deployment;bundle-version="2.13.0";visibility:=reexport,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
......
......@@ -4,7 +4,9 @@ bin.includes = .,\
model/,\
META-INF/,\
plugin.xml,\
plugin.properties
plugin.properties,\
lib/jgrapht-core-1.2.0.jar,\
lib/jgrapht-ext-1.2.0-uber.jar
source.. = generated-src/,\
src/,\
test-src/
......
ExplorationExpressionDeploymentValidator.java d49f3feb1573796e6913871ffc2b95eda65c516c GREEN
ExplorationExpressionDeploymentValidator.java 5eab1726ce7e0c93f54b95fb1c2935e1ff8eda2f GREEN
ExplorationExpressionEvaluator.java 43da0316e9215aa3fb0d80c6db0e81ca6ac3ada4 GREEN
IExplorationExpressionVisitor.java bbb5847ded8cf0d05272b940c8d8f086f9ac69f4 GREEN
......@@ -15,27 +15,28 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.lang;
import static org.fortiss.af3.deployment.utils.DeploymentUtils.containsComponentAllocation;
import java.util.LinkedList;
import java.util.Queue;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.allocation.utils.AllocationUtils;
import org.fortiss.af3.exploration.dsl_v2.model.booleanp.Implies;
import org.fortiss.af3.exploration.dsl_v2.model.booleanp.allocation.Allocation;
import org.fortiss.af3.exploration.dsl_v2.model.booleanp.allocation.Dislocation;
import org.fortiss.af3.exploration.dsl_v2.model.booleanp.allocation.ILocationExpression;
import org.fortiss.af3.exploration.dsl_v2.model.function.Maximize;
import org.fortiss.af3.exploration.dsl_v2.model.function.Minimize;
import org.fortiss.af3.exploration.model.ExplorationConstraint;
import org.fortiss.af3.exploration.model.ExplorationSpecification;
import org.fortiss.af3.exploration.model.ExplorationTarget;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.task.model.Task;
import org.fortiss.af3.task.model.allocation.TaskToExecutionUnitAllocationEntry;
import org.fortiss.af3.task.model.allocation.TaskToExecutionUnitAllocationTable;
/**
* Validates a {@link Deployment} versus the {@link ExplorationConstraint}s of an
* {@link ExplorationSpecification}. The {@link ExplorationConstraint}s must be encoded in terms of
* the exploration DSL v2.
* Validates a {@link TaskToExecutionUnitAllocationTable} versus the {@link ExplorationConstraint}s
* of an {@link ExplorationSpecification}. The {@link ExplorationConstraint}s must be encoded in
* terms of the exploration DSL v2.
*
* @author diewald
*/
......@@ -43,30 +44,31 @@ public class ExplorationExpressionDeploymentValidator extends ExplorationExpress
/**
* Reference to the {@link ExplorationSpecification} containing the
* {@link ExplorationConstraint}s against which the {@link Deployment} will be evaluated.
* {@link ExplorationConstraint}s against which the {@link TaskToExecutionUnitAllocationTable}
* will be evaluated.
*/
private ExplorationSpecification expSpec;
/** Reference to the {@link Deployment} to validate. */
private Deployment deployment;
/** Reference to the {@link TaskToExecutionUnitAllocationTable} to validate. */
private TaskToExecutionUnitAllocationTable ta2hw;
/**
* Constructor defining the model to evaluate versus the given specification.
*
* @param deploymentModel
* {@link Deployment} to validate.
* @param ta2hw
* {@link TaskToExecutionUnitAllocationTable} to validate.
* @param expSpec
* Defines the constraints on the given {@link Deployment}.
* Defines the constraints on the given {@link TaskToExecutionUnitAllocationTable}.
*/
public ExplorationExpressionDeploymentValidator(Deployment deploymentModel,
public ExplorationExpressionDeploymentValidator(TaskToExecutionUnitAllocationTable ta2hw,
ExplorationSpecification expSpec) {
this.deployment = deploymentModel;
this.ta2hw = ta2hw;
this.expSpec = expSpec;
}
/**
* Validates the selected {@link Deployment} against the {@link ExplorationConstraint}s of the
* current {@link ExplorationSpecification}.
* Validates the selected {@link TaskToExecutionUnitAllocationTable} against the
* {@link ExplorationConstraint}s of the current {@link ExplorationSpecification}.
*/
public Boolean validate() throws Exception {
boolean validationResult;
......@@ -99,40 +101,47 @@ public class ExplorationExpressionDeploymentValidator extends ExplorationExpress
return true;
}
/**
* Predicate if in the given {@link #ta2hw} contains the
* {@link TaskToExecutionUnitAllocationEntry} encoded by the given {@link ILocationExpression}.
*/
private Boolean isAllocated(ILocationExpression alloc) throws Exception {
Task task = alloc.getLeft().accept(this, Task.class);
ExecutionUnit executionUnit = alloc.getRight().accept(this, ExecutionUnit.class);
return AllocationUtils.isAllocated(ta2hw, TaskToExecutionUnitAllocationEntry.class, task,
executionUnit);
}
/** {@inheritDoc} */
@Override
public Boolean visit(Allocation alloc) throws Exception {
Component sourceME = alloc.getLeft().accept(this, Component.class);
ExecutionUnit targetME = alloc.getRight().accept(this, ExecutionUnit.class);
return containsComponentAllocation(deployment, sourceME, targetME);
return isAllocated(alloc);
}
/** {@inheritDoc} */
@Override
public Boolean visit(Dislocation disLoc) throws Exception {
Component sourceME = disLoc.getLeft().accept(this, Component.class);
ExecutionUnit targetME = disLoc.getRight().accept(this, ExecutionUnit.class);
return !containsComponentAllocation(deployment, sourceME, targetME);
return !isAllocated(disLoc);
}
/** {@inheritDoc} */
@Override
public Boolean visit(Implies implies) throws Exception {
throw new UnsupportedOperationException(
"Imply Expressions are not yet supported by the Deployment Validator.");
"Imply Expressions are not yet supported by the Task-to-Hardware Validator.");
}
/** {@inheritDoc} */
@Override
public Number visit(Maximize max) throws Exception {
throw new UnsupportedOperationException(
"Only ExplorationConstraints are supported by the Deployment Validator.");
"Only ExplorationConstraints are supported by the Task-to-Hardware Validator.");
}
/** {@inheritDoc} */
@Override
public Number visit(Minimize min) throws Exception {
throw new UnsupportedOperationException(
"Only ExplorationConstraints are supported by the Deployment Validator.");
"Only ExplorationConstraints are supported by the Task-to-Hardware Validator.");
}
}
ExpressionStaticImpl.java 3717bc52bd3a0ae91c1135bb36d7ce3d5f825160 GREEN
SetStaticImpl.java 91cf7d6f0bd7a39087cd3af390e89631ced0c77c GREEN
SuperSetStaticImpl.java 4be86fff54b035934e226fd02c3dfe3c9eaceb90 GREEN
SuperSetStaticImpl.java e02a15a55fe615e2d2e191277d518d860fc9692e GREEN
......@@ -15,7 +15,6 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.model.expression.impl;
import org.fortiss.af3.exploration.dsl_v2.model.expression.Set;
import org.fortiss.af3.exploration.dsl_v2.model.expression.SuperSet;
import org.fortiss.tooling.base.model.element.IModelElement;
......@@ -28,7 +27,6 @@ public class SuperSetStaticImpl {
/** Static implementation of {@link SuperSet#getCastedSet(Class)} */
public static <S extends IModelElement> SuperSet<S> getCastedSet(
SuperSet<? extends IModelElement> set, Class<S> type) {
Set<S> castedSet = set.getCastedSet(type);
return (castedSet != null) ? (SuperSet<S>)castedSet : null;
return (SuperSet<S>)SetStaticImpl.getCastedSet(set, type);
}
}
......@@ -10,7 +10,7 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.fortiss.af3.expression.AF3ExpressionActivator
Require-Bundle: org.fortiss.af3.generator.common;visibility:=reexport;bundle-version="2.13.0",
Require-Bundle: org.fortiss.af3.generator.common;bundle-version="2.13.0";visibility:=reexport,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.fortiss.af3.project;visibility:=reexport,
......@@ -25,7 +25,7 @@ Export-Package: org.antlr.stringtemplate,
org.fortiss.af3.expression.generator.c,
org.fortiss.af3.expression.generator.java,
org.fortiss.af3.expression.generator.nusmv.utils,
org.fortiss.af3.expression.language,
org.fortiss.af3.expression.language,
org.fortiss.af3.expression.language.constraint,
org.fortiss.af3.expression.language.evaluation,
org.fortiss.af3.expression.model,
......
......@@ -16,48 +16,42 @@
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/types"
class="org.fortiss.af3.expression.model.types.TypesPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.types.TypesPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/terms"
class="org.fortiss.af3.expression.model.terms.TermsPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.terms.TermsPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/terms/imperative"
class="org.fortiss.af3.expression.model.terms.imperative.ImperativePackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.terms.imperative.ImperativePackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/terms/collection"
class="org.fortiss.af3.expression.model.terms.collection.CollectionPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.terms.collection.CollectionPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/definitions"
class="org.fortiss.af3.expression.model.definitions.DefinitionsPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.definitions.DefinitionsPackage"/>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated expression -->
<package
uri="http://www.fortiss.org/af3/expression/definitions/library"
class="org.fortiss.af3.expression.model.definitions.library.LibraryPackage"
genModel="model/expression.genmodel"/>
class="org.fortiss.af3.expression.model.definitions.library.LibraryPackage"/>
</extension>
<extension
......
ArrayToCHeaderTransformation.java d656d0ff5ed03f108eb543d77789e7f0e4bbd21c GREEN
CReplacementVisitor.java 835e0b5d373e99a9d7f34c61f68b9643c7ada99e GREEN
CReplacementVisitor.java 44eadd0a6a257e6ce1d656e28016c0818f73c69f GREEN
DataDictionaryToCSourcePackageTransformation.java b15e9f1ae8b3d5ac18017a141607f93d0e6adb5e GREEN
EnumerationToCHeaderTransformation.java 99055f3848aad7b8fd9fd958ac7a837f44703b65 GREEN
FunctionDefinitionToCFunctionDeclarationTransformation.java 5e60a0edd88d602a0a524749ccdf8d6e22a8d885 GREEN
......
......@@ -15,7 +15,9 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.expression.generator.c;
import static org.fortiss.af3.expression.model.terms.EOperator.INDEX;
import static org.fortiss.af3.expression.model.terms.EOperator.MEMBER;
import static org.fortiss.af3.expression.model.terms.EOperator.MODULO;
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.arrayAccess;
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.assignment;
import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.createVar;
......@@ -34,7 +36,6 @@ import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.expression.generator.TermReplacementVisitor;
import org.fortiss.af3.expression.model.definitions.FunctionDefinition;
import org.fortiss.af3.expression.model.terms.ArrayConst;
import org.fortiss.af3.expression.model.terms.EOperator;
import org.fortiss.af3.expression.model.terms.FunctionCall;
import org.fortiss.af3.expression.model.terms.IExpressionTerm;
import org.fortiss.af3.expression.model.terms.PredefinedFunction;
......@@ -63,17 +64,26 @@ public class CReplacementVisitor extends TermReplacementVisitor {
/** {@inheritDoc} */
@Override
protected ITerm applyToFunctionCall(FunctionCall call) {
if(call.getFunction() instanceof PredefinedFunction &&
EOperator.INDEX.equals(((PredefinedFunction)call.getFunction()).getOperator())) {
// get(0) to apply the replacement on the function itself
FunctionCall contentAccess =
structAccess((IExpressionTerm)applyInternal(call.getArguments().get(0)),
"content");
// get(1) to apply the replacement on the argument of the function
FunctionCall indexAccess =
arrayAccess(contentAccess, (IExpressionTerm)applyInternal(call.getArguments()
.get(1)));
return indexAccess;
if(call.getFunction() instanceof PredefinedFunction) {
if(INDEX.equals(((PredefinedFunction)call.getFunction()).getOperator())) {
// get(0) to apply the replacement on the function itself
FunctionCall contentAccess =
structAccess((IExpressionTerm)applyInternal(call.getArguments().get(0)),
"content");
// get(1) to apply the replacement on the argument of the function
FunctionCall indexAccess =
arrayAccess(contentAccess, (IExpressionTerm)applyInternal(call
.getArguments().get(1)));
return indexAccess;
}
if(MODULO.equals(((PredefinedFunction)call.getFunction()).getOperator())) {
// Change the modulo to fmod
FunctionCall fmod = funcCall("fmod");
// Modulo operator has 2 arguments.
fmod.getArguments().add(applyInternal(call.getArguments().get(0)));
fmod.getArguments().add(applyInternal(call.getArguments().get(1)));
return fmod;
}
}
return super.applyToFunctionCall(call);
}
......
......@@ -23,7 +23,8 @@ endif
# The flags which are passed to the compiler and the linker.
CCFLAGS+=-std=c99 -Wall -pedantic -c \${patsubst %,-I%,\${subst :, ,\${IPATH}}}
LDFLAGS+=-std=c99 -Wall -pedantic
LDFLAGS+=
LIBS+= -lm
# The default rules, i.e. the entry point.
all: \${BPATH}
......@@ -47,6 +48,6 @@ clean:
# The rule for linking an application.
\${BPATH}/%.run:
@echo "linking application '\${@}' ..."
@\${CROSSLD} \${LDFLAGS} -o \${@} \$(filter %.o %.a, \${^})
@\${CROSSLD} \${LDFLAGS} -o \${@} \$(filter %.o %.a, \${^}) \${LIBS}