--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.simantics.interop.scl</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Scl
+Bundle-SymbolicName: org.simantics.interop.scl
+Bundle-Version: 1.0.0.qualifier
+Automatic-Module-Name: org.simantics.interop.scl
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.simantics.scl.data;bundle-version="1.0.0",
+ org.simantics.scl.db;bundle-version="0.1.3",
+ org.simantics.scl.expressions;bundle-version="1.0.0",
+ org.simantics.scl.osgi;bundle-version="1.0.4",
+ org.simantics.scl.reflection;bundle-version="1.0.0",
+ org.simantics.scl.runtime;bundle-version="0.4.0",
+ org.simantics.utils.datastructures;bundle-version="1.1.0"
--- /dev/null
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ scl/
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.simantics.interop</groupId>
+ <artifactId>org.simantics.interop.root</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.simantics.interop.scl</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+
+</project>
--- /dev/null
+importJava "org.simantics.interop.scl.FunctionRegistry" where
+
+ register :: a -> String -> (f -> <Proc>()) -> <Proc> ()
+ @JavaName register
+ register1 :: a -> String -> (f -> b -> <Proc>()) -> <Proc> ()
+ @JavaName register
+ register2 :: a -> String -> (f -> b -> c -> <Proc>()) -> <Proc> ()
+ @JavaName register
+ register3 :: a -> String -> (f -> b -> c -> d -> <Proc>()) -> <Proc> ()
+ @JavaName register
+ register4 :: a -> String -> (f -> b -> c -> d -> e -> <Proc>()) -> <Proc> ()
+ call0 :: a -> String -> <Proc> ()
+ call1 :: a -> String -> b -> <Proc> ()
+ call2 :: a -> String -> b -> c -> <Proc> ()
+ call3 :: a -> String -> b -> c -> d -> <Proc> ()
+ call4 :: a -> String -> b -> c -> d -> e -> <Proc> ()
+
+ @JavaName clear
+ clear :: a -> <Proc> ()
+
+ @JavaName clear
+ clearName :: a -> String -> <Proc> ()
\ No newline at end of file
--- /dev/null
+package org.simantics.interop.scl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.simantics.scl.runtime.function.Function;
+import org.simantics.utils.datastructures.MapList;
+
+@SuppressWarnings({"rawtypes","unchecked"})
+public class FunctionRegistry {
+
+
+ static Map<Object, MapList<String, Function>> map = new HashMap<Object, MapList<String,Function>>();
+
+ public static void register(Object key, String name, Function f) {
+ MapList<String, Function> fmap = map.get(key);
+ if (fmap == null) {
+ fmap = new MapList<>();
+ map.put(key, fmap);
+ }
+ fmap.add(name, f);
+ }
+
+ public static void call0 (Object key, String name) {
+ MapList<String, Function> fmap = map.get(key);
+ if (fmap == null)
+ return;
+ for (Function f : fmap.getValues(name)) {
+ f.apply(null);
+ }
+ }
+
+
+ public static void call1 (Object key, String name, Object o1) {
+ MapList<String, Function> fmap = map.get(key);
+ if (fmap == null)
+ return;
+ for (Function f : fmap.getValues(name)) {
+ f.apply(o1);
+ }
+ }
+
+ public static void call2 (Object key, String name, Object o1, Object o2) {
+ MapList<String, Function> fmap = map.get(key);
+ if (fmap == null)
+ return;
+ for (Function f : fmap.getValues(name)) {
+ f.apply(o1,o2);
+ }
+ }
+
+ public static void call3 (Object key, String name, Object o1, Object o2, Object o3) {
+ MapList<String, Function> fmap = map.get(key);
+ if (fmap == null)
+ return;
+ for (Function f : fmap.getValues(name)) {
+ f.apply(o1,o2,o3);
+ }
+ }
+
+ public static void call4 (Object key, String name, Object o1, Object o2, Object o3, Object o4) {
+ MapList<String, Function> fmap = map.get(key);
+ if (fmap == null)
+ return;
+ for (Function f : fmap.getValues(name)) {
+ f.apply(o1,o2,o3,o4);
+ }
+ }
+
+ public static void clear(Object key) {
+ map.remove(key);
+ }
+
+ public static void clear(Object key, String name) {
+ MapList<String, Function> fmap = map.get(key);
+ if (fmap == null)
+ return;
+ fmap.remove(name);
+ }
+
+
+}