--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2017 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.layer0.variable;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+
+/**
+ * Used for defining custom variable spaces in SCL.
+ * See SCL module <code>Simantics/Variables</code> function
+ * <code>createVariableMap :: [Resource] -> VariableMap</code>.
+ *
+ * @author Antti Villberg
+ * @since 1.29.0
+ */
+public class ResourceCollectionVariableMap extends VariableMapImpl {
+
+ final private Collection<Resource> resources;
+
+ public ResourceCollectionVariableMap(Collection<Resource> resources) {
+ this.resources = resources;
+ }
+
+ @Override
+ public Map<String, Variable> getVariables(ReadGraph graph, Variable context, Map<String, Variable> map)
+ throws DatabaseException {
+ for(Resource resource : resources) {
+ if(map == null) map = new HashMap<>();
+ Variable child = new StandardGraphChildVariable(context, null, resource);
+ map.put(child.getName(graph), child);
+ }
+ return map;
+ }
+
+}
protected VariableMap getPossibleChildVariableMap(ReadGraph graph) throws DatabaseException {
if(resource == null) return All.standardChildDomainChildren;
- return graph.getPossibleRelatedValue2(resource, Layer0.getInstance(graph).domainChildren, this);
+ Resource domainChildren = Layer0.getInstance(graph).domainChildren;
+ return graph.getPossibleRelatedValue2(resource, domainChildren,
+ new StandardGraphPropertyVariable(graph, this, domainChildren));
}
@Override
MBC
@VP.dropActionContribution MOD.Subscription MAC.Actions.SubscriptionDropAction 1.0
+MOD.sclChildRule : L0.Template
+ @template %action %expression
+ %action : MOD.SCLChildRule
+ MOD.SCLChildRule.getChildren _ : MOD.SCLValue
+ L0.SCLValue.expression %expression
+ L0.HasValueType "Resource -> <ReadGraph> [Resource]"
+
MOD.sclAction : L0.Template
@template %action %expression
%action : MOD.SCLAction
import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
import org.simantics.scl.compiler.elaboration.expressions.Expression;
import org.simantics.scl.compiler.elaboration.macros.StandardMacroRule;
+import org.simantics.scl.compiler.elaboration.modules.DerivedProperty;
import org.simantics.scl.compiler.elaboration.modules.InlineProperty;
import org.simantics.scl.compiler.elaboration.modules.MethodImplementation;
import org.simantics.scl.compiler.elaboration.modules.PrivateProperty;
decomposed.typeParameters,
decomposed.returnType,
decomposed.parameterTypes));*/
+ boolean isDerived = false;
for(SCLValueProperty prop : value.getProperties()) {
if(prop instanceof InlineProperty) {
InlineProperty inlineProperty = (InlineProperty)prop;
constant.setInlineArity(inlineProperty.arity, inlineProperty.phaseMask);
}
else if(prop == PrivateProperty.INSTANCE)
- constant.setPrivate(true);
+ constant.setPrivate(!isDerived);
+ else if(prop == DerivedProperty.INSTANCE) {
+ constant.setPrivate(false);
+ isDerived = true;
+ }
}
}
// This is quite hackish optimization that can be possibly removed when
import org.simantics.scl.compiler.elaboration.java.JavaMethodDeclaration;
import org.simantics.scl.compiler.elaboration.macros.StandardMacroRule;
import org.simantics.scl.compiler.elaboration.modules.DeprecatedProperty;
+import org.simantics.scl.compiler.elaboration.modules.DerivedProperty;
import org.simantics.scl.compiler.elaboration.modules.InlineProperty;
import org.simantics.scl.compiler.elaboration.modules.MethodImplementation;
import org.simantics.scl.compiler.elaboration.modules.PrivateProperty;
String fullName = instancePrefix + valueName;
long loc = valueDefs.getDefinition(valueName).get(0).location;
valueDefinitionsAst.addFrom(valueDefs, valueName, fullName);
+ valueDefinitionsAst.setDerived(fullName);
/*valueDefinitionsAst.addAnnotation(fullName, new DAnnotationAst(new EVar("@private"),
Collections.<Expression>emptyList()));*/
TypeClassMethod method = typeClass.methods.get(valueName);
value.definitionLocation = location;
if(module.addValue(value))
errorLog.log(location, "Value " + name + " is already defined.");
+ if(valueDefinitionsAst.isDerived(name))
+ value.addProperty(DerivedProperty.INSTANCE);
}
for(DValueTypeAst valueTypeAst : typeAnnotationsAst)
for(EVar name : valueTypeAst.names) {
int max = 1 << constraint.parameterTypes.length;
for(int i=0;i<max;++i)
constraint.getOrCreateIndex(cachedContext, i);
+ constraint.setMayBeRemoved();
/*
constraint.getOrCreateIndex(cachedContext, 0);
if(constraint.parameterTypes.length > 0)
--- /dev/null
+package org.simantics.scl.compiler.elaboration.modules;
+
+public enum DerivedProperty implements SCLValueProperty {
+ INSTANCE;
+}
public final Name name;
public final boolean isDefault;
- private SCLValue value;
public MethodImplementation(Name name, boolean isDefault) {
this.name = name;
this.isDefault = isDefault;
}
-
- public SCLValue getValue() {
- return value;
- }
-
- public void setValue(SCLValue value) {
- this.value = value;
- }
-
}
}
public void mergeBlocks(SSAFunction function) {
+ if(this == function)
+ throw new InternalCompilerError();
SSABlock block = function.firstBlock;
while(block != null) {
SSABlock next = block.next;
tailBlock.setExit(headBlock.getExit());
// Merge blocks
- thisFunction.mergeBlocks(function);
+ thisFunction.mergeBlocks(function);
headBlock.setExit(new Jump(function.getFirstBlock().createOccurrence(),
parameters));
import gnu.trove.impl.Constants;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TObjectLongHashMap;
+import gnu.trove.set.hash.THashSet;
public class ValueRepository {
THashMap<String, ArrayList<DValueAst>> values =
new THashMap<String, ArrayList<DValueAst>>();
THashMap<String, ArrayList<DAnnotationAst>> annotations =
new THashMap<String, ArrayList<DAnnotationAst>>();
+ THashSet<String> derived = new THashSet<String>();
TObjectLongHashMap<String> locations = new TObjectLongHashMap<String>(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR,
Locations.NO_LOCATION);
public long getLocation(String name) {
return locations.get(name);
}
+
+ public boolean isDerived(String name) {
+ return derived.contains(name);
+ }
+
+ public void setDerived(String name) {
+ derived.add(name);
+ }
}
@JavaName getObject
objectOf :: Statement -> Resource
+ isAsserted :: Statement -> Resource -> <ReadGraph> Boolean
+
importJava "org.simantics.db.ReadGraph" where
"Converts an absolute URI to a resource or returns `Nothing` if there is no such resource."
@JavaName getPossibleResource
@JavaName getSingleStatement
singleStatement :: Resource -> Resource -> <ReadGraph> Statement
+ @JavaName getPossibleStatement
+ possibleStatement :: Resource -> Resource -> <ReadGraph> Maybe Statement
+
@JavaName getRelatedVariantValue
relatedVariantValue :: Resource -> Resource -> <ReadGraph> Variant
importJava "org.simantics.db.layer0.variable.VariableMap" where
data VariableMap
+importJava "org.simantics.db.layer0.variable.ResourceCollectionVariableMap" where
+ @JavaName "<init>"
+ createVariableMap :: [Resource] -> VariableMap
+
importJava "org.simantics.db.layer0.variable.ValueAccessor" where
data ValueAccessor
else False
else True
+@inline
+filter :: (a -> <e> Boolean) -> T a -> <Proc,e> ()
+filter f it = loop ()
+ where
+ loop _ =
+ if hasNext it
+ then do
+ if f (next it)
+ then ()
+ else remove it
+ loop ()
+ else ()
+
@inline
mapFirst :: (a -> <e> Maybe b) -> T a -> <Proc,e> Maybe b
mapFirst f it = loop ()
all :: (a -> <e> Boolean) -> T a -> <e,Proc> Boolean
all f s = Iterator.iterB f (iterator s)
+
+filterInPlace :: (a -> <e> Boolean) -> T a -> <e,Proc> ()
+filterInPlace p s = Iterator.filter p (iterator s)
"forall",
"rule",
"ruleset",
+ "constraint",
"extends",
"by",
"select",
package org.simantics.scl.ui.modulebrowser;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map.Entry;
import gnu.trove.map.hash.THashMap;
return entry;
}
- public Collection<ModuleNameTreeEntry> children() {
- ArrayList<ModuleNameTreeEntry> children = new ArrayList<ModuleNameTreeEntry>(childMap.values());
- Collections.sort(children);
- return children;
+ public Object[] children() {
+ Object[] result = childMap.values().toArray();
+ Arrays.sort(result);
+ return result;
+ }
+
+ public void clearModuleFlags() {
+ isModule = false;
+ for(ModuleNameTreeEntry child : childMap.values())
+ child.clearModuleFlags();
}
@Override
return name.compareTo(o.name);
}
- @Override
- public String toString() {
- return name;
+ public boolean prune() {
+ Iterator<ModuleNameTreeEntry> it = childMap.values().iterator();
+ while(it.hasNext()) {
+ ModuleNameTreeEntry entry = it.next();
+ if(!entry.prune())
+ it.remove();
+ }
+ return isModule || !childMap.isEmpty();
}
}
package org.simantics.scl.ui.modulebrowser;
-import java.util.Collection;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
import org.simantics.scl.compiler.module.repository.ModuleRepository;
public class SCLModuleTree extends TreeViewer {
-
- private final ModuleRepository repository;
-
- private ITreeContentProvider contentProvider = new ITreeContentProvider() {
- ModuleNameTreeEntry rootEntry;
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if(newInput != null)
- this.rootEntry = createModuleTreeEntry((Collection<String>)newInput);
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- if(rootEntry == null)
- return new Object[0];
- return rootEntry.children().toArray();
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- return ((ModuleNameTreeEntry)parentElement).children().toArray();
- }
-
- @Override
- public Object getParent(Object element) {
- return ((ModuleNameTreeEntry)element).parent;
- }
-
- @Override
- public boolean hasChildren(Object element) {
- return !((ModuleNameTreeEntry)element).childMap.isEmpty();
- }
- };
-
- private LabelProvider labelProvider = new LabelProvider();
+ private LabelProvider labelProvider = new SCLModuleTreeLabelProvider();
+ private SCLModuleTreeContentProvider contentProvider;
public SCLModuleTree(Composite parent, int style, ModuleRepository repository) {
super(parent, style);
- this.repository = repository;
+ this.contentProvider = new SCLModuleTreeContentProvider();
+ setUseHashlookup(true);
setLabelProvider(labelProvider);
setContentProvider(contentProvider);
setAutoExpandLevel(1);
- recalculateInput();
- }
-
- private static ModuleNameTreeEntry createModuleTreeEntry(Collection<String> names) {
- ModuleNameTreeEntry root = new ModuleNameTreeEntry(null, "", "");
- for(String name : names)
- root.addModule(name);
- return root;
+ setInput(repository);
}
public void recalculateInput() {
- setInput(repository.getSourceRepository().getModuleNames());
+ contentProvider.update();
+ refresh();
}
}
--- /dev/null
+package org.simantics.scl.ui.modulebrowser;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.simantics.scl.compiler.module.repository.ModuleRepository;
+
+public class SCLModuleTreeContentProvider implements ITreeContentProvider {
+ private ModuleRepository repository;
+ private final ModuleNameTreeEntry rootEntry = new ModuleNameTreeEntry(null, "", "");
+
+ public void update() {
+ rootEntry.clearModuleFlags();
+ if(repository != null) {
+ for(String moduleName : repository.getSourceRepository().getModuleNames()) {
+ rootEntry.addModule(moduleName);
+ }
+ }
+ rootEntry.prune();
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.repository = (ModuleRepository)newInput;
+ update();
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return rootEntry.children();
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ ModuleNameTreeEntry entry = (ModuleNameTreeEntry)parentElement;
+ return entry.children();
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ ModuleNameTreeEntry entry = (ModuleNameTreeEntry)element;
+ return entry.parent;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ ModuleNameTreeEntry entry = (ModuleNameTreeEntry)element;
+ return !entry.childMap.isEmpty();
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+}
--- /dev/null
+package org.simantics.scl.ui.modulebrowser;
+
+import org.eclipse.jface.viewers.LabelProvider;
+
+public class SCLModuleTreeLabelProvider extends LabelProvider {
+ @Override
+ public String getText(Object element) {
+ ModuleNameTreeEntry entry = (ModuleNameTreeEntry)element;
+ return entry.name;
+ }
+}
String style = "";
int size = 12;
for(FontData d : descriptor.getFontData()) {
- System.err.println("data: " + d);
family = d.getName();
if((d.getStyle() & SWT.ITALIC) != 0) style += "Italic";
if((d.getStyle() & SWT.BOLD) != 0) style += "Bold";
<feature
id="org.simantics.sdk"
label="Simantics SDK"
- version="1.29.0"
+ version="1.30.0"
provider-name="VTT Technical Research Centre of Finland">
<description url="http://www.example.com/description">
</code></pre>
</li>
<li>
-<p>Edit version number of `org.simantics.sdk` feature in `features/org.simantics.sdk.feature/feature.xml` to `x.y.z[.w]`.</p>
-<pre><code>
-<feature
+<p>Edit version number of <code>org.simantics.sdk</code> feature in <code>features/org.simantics.sdk.feature/feature.xml</code> to <code>x.y.z[.w]</code>.</p>
+<pre><code><feature
id="org.simantics.sdk"
label="Simantics SDK"
version="x.y.z"
provider-name="VTT Technical Research Centre of Finland">
</code></pre>
-<p>Now commit and push the changes to the release branch.</p>
+<p>An example of these changes can be seen in <a href="https://www.simantics.org:8088/r/gitweb?p=simantics/platform.git;a=commit;h=bab5c9bd68277c76dc5c20bc7a60a9896cbd1540">gitweb</a>.</p>
+</li>
+<li>
+<p>Ensure that Redmine has a release engineering issue for the branched release, such as <a href="https://www.simantics.org/redmine/issues/7263">Simantics 1.30.0 release engineering</a>. Make a copy of the previous release issue to create the new one. Include link to original issue while copying.</p>
+</li>
+<li>
+<p>Commit the changes made</p>
+<pre><code> git commit -a
+</code></pre>
+<p>with the commit message</p>
+<pre><code> Configured release/x.y.z[.w] branch for SDK builds.
+
+ refs #xxxx
+</code></pre>
+<p>where <code>#xxxx</code> is the number of the x.y.z[.w] release engineering issue and push them to remote</p>
+<pre><code> git push origin release/x.y.z[.w]
+</code></pre>
+</li>
+<li>
+<p>If you are branching from <code>master</code>, bump the revision of master right now to start the next release cycle in master.
+An example of these changes can be seen in <a href="https://www.simantics.org:8088/r/gitweb?p=simantics/platform.git;a=commitdiff;h=ae93c9930c6345c32219e6845b9e72e9d9d2d28c">gitweb</a>.</p>
+<p>Commit the changes with the following commit message</p>
+<pre><code>Bumped master target and org.simantics.sdk feature versions to x.y.z[.w].
+refs #yyyy
+</code></pre>
+<p>where <code>#yyyy</code> is the number of the next release's release engineering issue.</p>
</li>
</ol>
<h3>Initialize release branch distribution web site</h3>
at a later time for some reason, we'll put the documentation up then in a
separate Mediawiki installation.</p>
<ol>
-<li>Dump documentation wiki databases using [dump-wikis.sh](./dump-wikis.sh) script.</li>
+<li>Dump documentation wiki databases using <a href="./dump-wikis.sh">dump-wikis.sh</a> script.</li>
<li>Put the generated backup x.y.z.tar.gz at /var/backup/simantics-releases/x.y.z/wiki/</li>
</ol>
<h2>Compile change log entry</h2>
provider-name="VTT Technical Research Centre of Finland">
~~~
+ An example of these changes can be seen in [gitweb](https://www.simantics.org:8088/r/gitweb?p=simantics/platform.git;a=commit;h=bab5c9bd68277c76dc5c20bc7a60a9896cbd1540).
+
+4. Ensure that Redmine has a release engineering issue for the branched release, such as [Simantics 1.30.0 release engineering](https://www.simantics.org/redmine/issues/7263). Make a copy of the previous release issue to create the new one. Include link to original issue while copying.
+
+5. Commit the changes made
+
+ git commit -a
+
+ with the commit message
+
+ Configured release/x.y.z[.w] branch for SDK builds.
+
+ refs #xxxx
+
+ where `#xxxx` is the number of the x.y.z[.w] release engineering issue and push them to remote
+
+ git push origin release/x.y.z[.w]
+
+6. If you are branching from `master`, bump the revision of master right now to start the next release cycle in master.
+ An example of these changes can be seen in [gitweb](https://www.simantics.org:8088/r/gitweb?p=simantics/platform.git;a=commitdiff;h=ae93c9930c6345c32219e6845b9e72e9d9d2d28c).
+
+ Commit the changes with the following commit message
+
+ Bumped master target and org.simantics.sdk feature versions to x.y.z[.w].
+ refs #yyyy
+
+ where `#yyyy` is the number of the next release's release engineering issue.
+
### Initialize release branch distribution web site
* Run [SDK/Deploy External Components to Web](https://www.simantics.org/jenkins/job/SDK/job/Deploy%20External%20Components%20to%20Web/) build with parameters:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
-<target name="Simantics 1.29.0" sequenceNumber="21">
+<target name="Simantics 1.30.0" sequenceNumber="22">
<locations>
<location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
-<unit id="org.simantics.sdk.feature.group" version="1.29.0"/>
-<unit id="org.simantics.sdk.source.feature.group" version="1.29.0"/>
+<unit id="org.simantics.sdk.feature.group" version="1.30.0"/>
+<unit id="org.simantics.sdk.source.feature.group" version="1.30.0"/>
<repository location="http://www.simantics.org/download/master/sdk"/>
</location>
<location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.simantics.sdk.repository</artifactId>
- <version>1.29.0-SNAPSHOT</version>
+ <version>1.30.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<parent>
@Test public void LocalDefinitions4() { test(); }
@Test public void LocalDefinitions5() { test(); }
@Test public void Logger() { test(); }
+ @Test public void LP() { test(); }
@Test public void Macros1() { test(); }
@Test public void Macros2() { test(); }
@Test public void Macros4() { test(); }
@Test public void SinConst1() { test(); }
@Test public void Sort() { test(); }
@Test public void Sort2() { test(); }
+ @Test public void SpecConstr1() { test(); }
@Test public void SSATypingBug() { test(); }
@Test public void StreamFusion() { test(); }
@Test public void StringEscape() { test(); }
@Test public void FunctionalDependencies2() { test(); }
@Test public void InlineLoop() { test(); }
@Test public void InstanceTypeVariables() { test(); }
- @Test public void LP() { test(); }
@Test public void Macros3() { test(); }
@Test public void MissingTypeParameter() { test(); }
@Test(timeout=100L) public void RecursiveValues() { test(); }
@Test public void Set1() { test(); }
@Test public void Signals() { test(); }
- @Test public void SpecConstr1() { test(); }
@Test public void StackTrace() { test(); }
- @Test public void StringInterpolation2() { test(); }
@Test public void Timing() { test(); }
}