]> gerrit.simantics Code Review - simantics/python.git/commitdiff
Merge "Macro for Python installation directory." release/1.27.0
authorReino Ruusu <reino.ruusu@vtt.fi>
Wed, 1 Feb 2017 13:00:21 +0000 (15:00 +0200)
committerGerrit Code Review <gerrit2@www.simantics.org>
Wed, 1 Feb 2017 13:00:21 +0000 (15:00 +0200)
18 files changed:
.gitignore [new file with mode: 0644]
org.simantics.pythonlink.feature/feature.xml
org.simantics.pythonlink.feature/pom.xml [new file with mode: 0644]
org.simantics.pythonlink.parent/.project [new file with mode: 0644]
org.simantics.pythonlink.parent/.settings/org.eclipse.m2e.core.prefs [new file with mode: 0644]
org.simantics.pythonlink.parent/pom.xml [new file with mode: 0644]
org.simantics.pythonlink.repository/.project [new file with mode: 0644]
org.simantics.pythonlink.repository/.settings/org.eclipse.m2e.core.prefs [new file with mode: 0644]
org.simantics.pythonlink.repository/category.xml [new file with mode: 0644]
org.simantics.pythonlink.repository/pom.xml [new file with mode: 0644]
org.simantics.pythonlink.win32.x86_64/META-INF/MANIFEST.MF
org.simantics.pythonlink.win32.x86_64/jnipython.dll
org.simantics.pythonlink.win32.x86_64/pom.xml [new file with mode: 0644]
org.simantics.pythonlink.win32.x86_64/src/sclpy.c
org.simantics.pythonlink.win32.x86_64/src/sclpy.h
org.simantics.pythonlink/pom.xml [new file with mode: 0644]
org.simantics.pythonlink/src/org/simantics/pythonlink/PythonContext.java
pom.xml [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..9defc98
--- /dev/null
@@ -0,0 +1 @@
+/*/bin/
index 97bea756f72778ca163011bcd23a862ff63ce9b9..b69cfa12fd939292a9e1a91d0dcecf1175b32dac 100644 (file)
@@ -1,19 +1,88 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <feature\r
-      id="org.simantics.pythonlink"\r
+      id="org.simantics.pythonlink.feature"\r
       label="Simantics Python Integration"\r
       version="1.0.0.qualifier">\r
 \r
-   <description url="http://www.example.com/description">\r
-      [Enter Feature Description here.]\r
+   <description>\r
+      Python bindings for Simantics SCL language.\r
    </description>\r
 \r
-   <copyright url="http://www.example.com/copyright">\r
-      [Enter Copyright Description here.]\r
+   <copyright>\r
+      VTT Technical Research Centre of Finland - initial API and implementation\r
    </copyright>\r
 \r
-   <license url="http://www.example.com/license">\r
-      [Enter License Description here.]\r
+   <license url="https://www.eclipse.org/legal/epl-v10.html">\r
+      Eclipse Public License - v 1.0\r
+\r
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT&apos;S ACCEPTANCE OF THIS AGREEMENT.\r
+\r
+1. DEFINITIONS\r
+\r
+&quot;Contribution&quot; means:\r
+\r
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and\r
+b) in the case of each subsequent Contributor:\r
+i) changes to the Program, and\r
+ii) additions to the Program;\r
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution &apos;originates&apos; from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor&apos;s behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.\r
+&quot;Contributor&quot; means any person or entity that distributes the Program.\r
+\r
+&quot;Licensed Patents&quot; mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.\r
+\r
+&quot;Program&quot; means the Contributions distributed in accordance with this Agreement.\r
+\r
+&quot;Recipient&quot; means anyone who receives the Program under this Agreement, including all Contributors.\r
+\r
+2. GRANT OF RIGHTS\r
+\r
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.\r
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.\r
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient&apos;s responsibility to acquire that license before distributing the Program.\r
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.\r
+3. REQUIREMENTS\r
+\r
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:\r
+\r
+a) it complies with the terms and conditions of this Agreement; and\r
+b) its license agreement:\r
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;\r
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;\r
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and\r
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.\r
+When the Program is made available in source code form:\r
+\r
+a) it must be made available under this Agreement; and\r
+b) a copy of this Agreement must be included with each copy of the Program.\r
+Contributors may not remove or alter any copyright notices contained within the Program.\r
+\r
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.\r
+\r
+4. COMMERCIAL DISTRIBUTION\r
+\r
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (&quot;Commercial Contributor&quot;) hereby agrees to defend and indemnify every other Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.\r
+\r
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor&apos;s responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.\r
+\r
+5. NO WARRANTY\r
+\r
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.\r
+\r
+6. DISCLAIMER OF LIABILITY\r
+\r
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
+\r
+7. GENERAL\r
+\r
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.\r
+\r
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient&apos;s patent(s), then such Recipient&apos;s rights granted under Section 2(b) shall terminate as of the date such litigation is filed.\r
+\r
+All Recipient&apos;s rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient&apos;s rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient&apos;s obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.\r
+\r
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.\r
+\r
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.\r
    </license>\r
 \r
    <requires>\r
@@ -23,7 +92,6 @@
       <import plugin="gnu.trove3" version="3.0.3" match="greaterOrEqual"/>\r
       <import plugin="org.simantics.scl.compiler"/>\r
       <import plugin="org.simantics.scl.osgi"/>\r
-      <import plugin="org.simantics.pythonlink" version="1.0.0" match="greaterOrEqual"/>\r
    </requires>\r
 \r
    <plugin\r
 \r
    <plugin\r
          id="org.simantics.pythonlink.win32.x86_64"\r
+         os="win32"\r
+         arch="x86_64"\r
          download-size="0"\r
          install-size="0"\r
          version="0.0.0"\r
diff --git a/org.simantics.pythonlink.feature/pom.xml b/org.simantics.pythonlink.feature/pom.xml
new file mode 100644 (file)
index 0000000..6baf61f
--- /dev/null
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       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>
+
+       <parent>
+               <groupId>org.simantics.python</groupId>
+               <artifactId>org.simantics.pythonlink.parent</artifactId>
+               <version>1.0.0-SNAPSHOT</version>
+               <relativePath>../org.simantics.pythonlink.parent</relativePath>
+       </parent>
+
+       <artifactId>org.simantics.pythonlink.feature</artifactId>
+       <packaging>eclipse-feature</packaging>
+       <version>1.0.0-SNAPSHOT</version>
+
+</project>
diff --git a/org.simantics.pythonlink.parent/.project b/org.simantics.pythonlink.parent/.project
new file mode 100644 (file)
index 0000000..e35a974
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.simantics.pythonlink.parent</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.simantics.pythonlink.parent/.settings/org.eclipse.m2e.core.prefs b/org.simantics.pythonlink.parent/.settings/org.eclipse.m2e.core.prefs
new file mode 100644 (file)
index 0000000..f897a7f
--- /dev/null
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/org.simantics.pythonlink.parent/pom.xml b/org.simantics.pythonlink.parent/pom.xml
new file mode 100644 (file)
index 0000000..b0abce2
--- /dev/null
@@ -0,0 +1,148 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       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>
+       <groupId>org.simantics.python</groupId>
+       <artifactId>org.simantics.pythonlink.parent</artifactId>
+       <version>1.0.0-SNAPSHOT</version>
+       <packaging>pom</packaging>
+
+        <parent>
+                <groupId>org.simantics.python</groupId>
+                <artifactId>org.simantics.pythonlink.root</artifactId>
+                <version>1.0.0-SNAPSHOT</version>
+                <relativePath>..</relativePath>
+        </parent>
+
+        <!-- common settings for all modules -->
+        <properties>
+                <branch-spec>master</branch-spec>
+                <simantics-download-site>http://www.simantics.org/download</simantics-download-site>
+                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+                <tycho-version>0.26.0</tycho-version>
+        </properties>
+
+        <repositories>
+                <!-- configure p2 repository to resolve against -->
+                <repository>
+                        <id>simantics-sdk</id>
+                        <layout>p2</layout>
+                        <url>${simantics-download-site}/${branch-spec}/sdk</url>
+                </repository>
+        </repositories>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.eclipse.tycho</groupId>
+                               <artifactId>tycho-maven-plugin</artifactId>
+                               <version>${tycho-version}</version>
+                               <extensions>true</extensions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.eclipse.tycho</groupId>
+                               <artifactId>target-platform-configuration</artifactId>
+                               <version>${tycho-version}</version>
+                               <configuration>
+                                       <ignoreTychoRepositories>true</ignoreTychoRepositories>
+                                       <resolver>p2</resolver>
+                                       <environments>
+                                               <environment>
+                                                       <os>win32</os>
+                                                       <ws>win32</ws>
+                                                       <arch>x86_64</arch>
+                                               </environment>
+                                       </environments>
+                               </configuration>
+                       </plugin>
+               </plugins>
+               <pluginManagement>
+                       <plugins>
+                               <!--This plugin's configuration is used to store Eclipse m2e settings 
+                                       only. It has no influence on the Maven build itself. -->
+                               <plugin>
+                                       <groupId>org.eclipse.m2e</groupId>
+                                       <artifactId>lifecycle-mapping</artifactId>
+                                       <version>1.0.0</version>
+                                       <configuration>
+                                               <lifecycleMappingMetadata>
+                                                       <pluginExecutions>
+                                                               <pluginExecution>
+                                                                       <pluginExecutionFilter>
+                                                                               <groupId>
+                                                                                       org.eclipse.tycho
+                                                                               </groupId>
+                                                                               <artifactId>
+                                                                                       tycho-compiler-plugin
+                                                                               </artifactId>
+                                                                               <versionRange>
+                                                                                       [0.26.0,)
+                                                                               </versionRange>
+                                                                               <goals>
+                                                                                       <goal>compile</goal>
+                                                                               </goals>
+                                                                       </pluginExecutionFilter>
+                                                                       <action>
+                                                                               <ignore></ignore>
+                                                                       </action>
+                                                               </pluginExecution>
+                                                               <pluginExecution>
+                                                                       <pluginExecutionFilter>
+                                                                               <groupId>
+                                                                                       org.eclipse.tycho
+                                                                               </groupId>
+                                                                               <artifactId>
+                                                                                       tycho-packaging-plugin
+                                                                               </artifactId>
+                                                                               <versionRange>
+                                                                                       [0.26.0,)
+                                                                               </versionRange>
+                                                                               <goals>
+                                                                                       <goal>build-qualifier</goal>
+                                                                                       <goal>validate-id</goal>
+                                                                                       <goal>
+                                                                                               validate-version
+                                                                                       </goal>
+                                                                                       <goal>
+                                                                                               build-qualifier-aggregator
+                                                                                       </goal>
+                                                                               </goals>
+                                                                       </pluginExecutionFilter>
+                                                                       <action>
+                                                                               <ignore></ignore>
+                                                                       </action>
+                                                               </pluginExecution>
+                                                               <pluginExecution>
+                                                                       <pluginExecutionFilter>
+                                                                               <groupId>
+                                                                                       org.apache.maven.plugins
+                                                                               </groupId>
+                                                                               <artifactId>
+                                                                                       maven-clean-plugin
+                                                                               </artifactId>
+                                                                               <versionRange>
+                                                                                       [2.5,)
+                                                                               </versionRange>
+                                                                               <goals>
+                                                                                       <goal>clean</goal>
+                                                                               </goals>
+                                                                       </pluginExecutionFilter>
+                                                                       <action>
+                                                                               <ignore></ignore>
+                                                                       </action>
+                                                               </pluginExecution>
+                                                       </pluginExecutions>
+                                               </lifecycleMappingMetadata>
+                                       </configuration>
+                               </plugin>
+                       </plugins>
+               </pluginManagement>
+       </build>
+
+       <modules>
+               <module>../org.simantics.pythonlink</module>
+               <module>../org.simantics.pythonlink.win32.x86_64</module>
+               <module>../org.simantics.pythonlink.feature</module>
+               <module>../org.simantics.pythonlink.repository</module>
+       </modules>
+
+</project>
diff --git a/org.simantics.pythonlink.repository/.project b/org.simantics.pythonlink.repository/.project
new file mode 100644 (file)
index 0000000..fb01470
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.simantics.pythonlink.repository</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.simantics.pythonlink.repository/.settings/org.eclipse.m2e.core.prefs b/org.simantics.pythonlink.repository/.settings/org.eclipse.m2e.core.prefs
new file mode 100644 (file)
index 0000000..f897a7f
--- /dev/null
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/org.simantics.pythonlink.repository/category.xml b/org.simantics.pythonlink.repository/category.xml
new file mode 100644 (file)
index 0000000..be07370
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+   <feature id="org.simantics.pythonlink.feature">
+      <category name="org.simantics.python"/>
+   </feature>
+   <category-def name="org.simantics.python" label="Simantics Python Support">
+      <description>
+         Simantics Python support P2 repository
+      </description>
+   </category-def>
+</site>
diff --git a/org.simantics.pythonlink.repository/pom.xml b/org.simantics.pythonlink.repository/pom.xml
new file mode 100644 (file)
index 0000000..77b06da
--- /dev/null
@@ -0,0 +1,29 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       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.pythonlink.repository</artifactId>
+       <packaging>eclipse-repository</packaging>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.eclipse.tycho</groupId>
+                               <artifactId>tycho-p2-repository-plugin</artifactId>
+                               <version>${tycho-version}</version>
+                               <configuration>
+                                       <!--
+                                       <includeAllDependencies>true</includeAllDependencies>
+                                       -->
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+       <parent>
+               <groupId>org.simantics.python</groupId>
+               <artifactId>org.simantics.pythonlink.parent</artifactId>
+               <version>1.0.0-SNAPSHOT</version>
+               <relativePath>../org.simantics.pythonlink.parent</relativePath>
+       </parent>
+
+</project>
index 166dc32e1802140516f546c27d8a033c98a72e9f..b0ae7f47432dc2dba95994b3fcf6dc3ed827ff1f 100644 (file)
@@ -4,4 +4,5 @@ Bundle-SymbolicName: org.simantics.pythonlink.win32.x86_64
 Bundle-Version: 1.0.0.qualifier
 Bundle-Vendor: VTT Technical Research Centre of Finland
 Fragment-Host: org.simantics.pythonlink;bundle-version="1.0.0"
+Eclipse-PlatformFilter: (& (osgi.os=win32) (osgi.arch=x86_64))
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
index 7fff774adac1bb1b1d2c5ffbffa6043e44d877e1..1770fb739bc91fd7193ea478c320ecd35812dbe6 100644 (file)
Binary files a/org.simantics.pythonlink.win32.x86_64/jnipython.dll and b/org.simantics.pythonlink.win32.x86_64/jnipython.dll differ
diff --git a/org.simantics.pythonlink.win32.x86_64/pom.xml b/org.simantics.pythonlink.win32.x86_64/pom.xml
new file mode 100644 (file)
index 0000000..104d57a
--- /dev/null
@@ -0,0 +1,35 @@
+<?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.python</groupId>
+               <artifactId>org.simantics.pythonlink.parent</artifactId>
+               <version>1.0.0-SNAPSHOT</version>
+               <relativePath>../org.simantics.pythonlink.parent</relativePath>
+       </parent>
+
+       <artifactId>org.simantics.pythonlink.win32.x86_64</artifactId>
+       <packaging>eclipse-plugin</packaging>
+       <version>1.0.0-SNAPSHOT</version>
+
+        <build>
+                <plugins>
+                        <plugin>
+                                <groupId>org.eclipse.tycho</groupId>
+                                <artifactId>target-platform-configuration</artifactId>
+                                <configuration>
+                                        <environments>
+                                                <environment>
+                                                        <os>win32</os>
+                                                        <arch>x86_64</arch>
+                                                </environment>
+                                        </environments>
+                                </configuration>
+                        </plugin>
+                </plugins>
+        </build>
+
+</project>
index b10b36f5d3c1103aeda3c6e7582ff44bdb6670b5..a6c64abf183e2b68b3a9ab48e54bccbd26172723 100644 (file)
@@ -32,10 +32,48 @@ jint throwIllegalArgumentException( JNIEnv *env, char *message ) {
        return throwException( env, ILLEGAL_ARGUMENT_EXCEPTION, message );\r
 }\r
 \r
+PyObject* getModule(jlong contextID) {\r
+       return PyState_FindModule((PyModuleDef*) contextID);\r
+//     return PyImport_AddModule("__main__");\r
+}\r
+\r
 int moduleCount = 0;\r
 int initCalled = 0;\r
 int hasNumpy = 0;\r
 \r
+static JNIEnv *currentEnv = NULL;\r
+jobject sclWriter = NULL;\r
+\r
+static PyObject *\r
+writeToSCL(PyObject *self, PyObject *args)\r
+{\r
+    if (currentEnv != NULL && sclWriter != NULL) {\r
+       JNIEnv *env = currentEnv;\r
+\r
+               Py_UNICODE *what;\r
+               Py_ssize_t length;\r
+               if (!PyArg_ParseTuple(args, "u#", &what, &length))\r
+                       return NULL;\r
+\r
+               {\r
+               jclass writerClass = (*env)->FindClass(env, WRITER_CLASS);\r
+               jmethodID writeMethod = (*env)->GetMethodID(env, writerClass, "write", "([CII)V");\r
+               jcharArray chars = (*env)->NewCharArray(env, (jsize)length);\r
+\r
+               (*env)->SetCharArrayRegion(env, chars, 0, length, what);\r
+               (*env)->CallVoidMethod(env, sclWriter, writeMethod, chars, 0, length);\r
+               }\r
+    }\r
+\r
+    return Py_BuildValue("");\r
+}\r
+\r
+static PyMethodDef sclWriterMethods[] = {\r
+    {"write", writeToSCL, METH_VARARGS, "Write something."},\r
+    {NULL, NULL, 0, NULL}\r
+};\r
+\r
+\r
 JNIEXPORT jlong JNICALL Java_org_simantics_pythonlink_PythonContext_createContextImpl(JNIEnv *env, jobject thisObj) {\r
        char name[16];\r
 \r
@@ -43,6 +81,15 @@ JNIEXPORT jlong JNICALL Java_org_simantics_pythonlink_PythonContext_createContex
         Py_Initialize();\r
         initCalled = 1;\r
 \r
+        {\r
+               static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "sclwriter", NULL, -1, sclWriterMethods, };\r
+                       PyObject *m = PyModule_Create(&moduledef);\r
+\r
+               if (m == NULL) throwException(env, PYTHON_EXCEPTION, "Failed to create SCL writer module");\r
+                       PySys_SetObject("stdout", m);\r
+                       PySys_SetObject("stderr", m);\r
+        }\r
+\r
        hasNumpy = _import_array();\r
        hasNumpy = hasNumpy != -1;\r
        }\r
@@ -50,18 +97,35 @@ JNIEXPORT jlong JNICALL Java_org_simantics_pythonlink_PythonContext_createContex
        sprintf(name, "SCL_%d", ++moduleCount);\r
 \r
        {\r
-               PyObject *module = PyModule_New(name);\r
-               PyObject *main = PyImport_AddModule("__main__");\r
+               PyObject *module;\r
+               PyModuleDef *modDef = malloc(sizeof(PyModuleDef));\r
+               memset(modDef, 0, sizeof(PyModuleDef));\r
+               modDef->m_name = strdup(name);\r
+               modDef->m_doc = NULL;\r
+               modDef->m_size = -1;\r
 \r
-               PyDict_Merge(PyModule_GetDict(module), PyModule_GetDict(main), 0);\r
+               module = PyModule_Create(modDef);\r
+               Py_INCREF(module);\r
+               PyState_AddModule(module, modDef);\r
 \r
-               return (jlong)module;\r
+               {\r
+                       PyObject *builtin = PyImport_AddModule("builtins");\r
+                       PyObject *dict = PyModule_GetDict(module);\r
+                       PyDict_SetItemString(dict, "__builtin__", builtin);\r
+                       PyDict_SetItemString(dict, "__builtins__", builtin);\r
+\r
+                       return (jlong)modDef;\r
+               }\r
        }\r
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_deleteContextImpl(JNIEnv *env, jobject thisObj, jlong contextID) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyModuleDef *modDef = (PyModuleDef*)contextID;\r
+       PyObject *module = PyState_FindModule(modDef);\r
        Py_XDECREF(module);\r
+       PyState_RemoveModule(modDef);\r
+       free((char*)modDef->m_name);\r
+       free(modDef);\r
 }\r
 \r
 PyObject *getPythonBool(jboolean value) {\r
@@ -783,7 +847,7 @@ jobject pythonDictionaryAsMap(JNIEnv *env, PyObject *dict) {
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonBooleanVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jboolean value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonBool(value);\r
@@ -792,7 +856,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonBool
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonBooleanArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jbooleanArray value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonBooleanList(env, value);\r
@@ -801,7 +865,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonBool
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonLongVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jlong value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = PyLong_FromLongLong(value);\r
@@ -810,7 +874,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonLong
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonIntegerArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jintArray value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonIntegerList(env, value);\r
@@ -819,7 +883,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonInte
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonLongArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jlongArray value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonLongList(env, value);\r
@@ -828,7 +892,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonLong
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonDoubleVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jdouble value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = PyFloat_FromDouble(value);\r
@@ -837,7 +901,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonDoub
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonFloatArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jfloatArray value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonFloatList(env, value);\r
@@ -846,7 +910,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonFloa
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonDoubleArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jdoubleArray value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonDoubleList(env, value);\r
@@ -855,7 +919,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonDoub
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonStringVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jstring value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonString(env, value);\r
@@ -864,7 +928,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonStri
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonStringArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jobjectArray value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonStringList(env, value);\r
@@ -873,7 +937,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonStri
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonNDArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jobject value) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        if (!hasNumpy) {\r
                throwPythonException(env, "Importing numpy failed");\r
@@ -889,7 +953,7 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonNDAr
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonVariantVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName, jobject value, jobject binding) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
        PyObject *val = getPythonObject(env, value, binding);\r
@@ -898,16 +962,26 @@ JNIEXPORT void JNICALL Java_org_simantics_pythonlink_PythonContext_setPythonVari
 }\r
 \r
 JNIEXPORT jint JNICALL Java_org_simantics_pythonlink_PythonContext_executePythonStatementImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring statement) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        const char *utfchars = (*env)->GetStringUTFChars(env, statement, NULL);\r
 \r
        PyErr_Clear();\r
        {\r
+               jclass sclReportingWriterClass = (*env)->FindClass(env, SCL_REPORTING_WRITER_CLASS);\r
+               jmethodID constructor = (*env)->GetMethodID(env, sclReportingWriterClass, "<init>", "()V");\r
+               jmethodID flushMethod = (*env)->GetMethodID(env, sclReportingWriterClass, "flush", "()V");\r
+\r
                PyObject *globals;\r
 \r
                globals = PyModule_GetDict(module);\r
 \r
+               currentEnv = env;\r
+               if (sclReportingWriterClass && constructor)\r
+                       sclWriter = (*env)->NewObject(env, sclReportingWriterClass, constructor);\r
+               else\r
+                       sclWriter = NULL;\r
+\r
                {\r
                        PyObject *result = PyRun_String(utfchars, Py_file_input, globals, globals);\r
 \r
@@ -951,13 +1025,20 @@ JNIEXPORT jint JNICALL Java_org_simantics_pythonlink_PythonContext_executePython
 \r
                        (*env)->ReleaseStringUTFChars(env, statement, utfchars);\r
 \r
+                       if (sclWriter != NULL) {\r
+                               (*env)->CallVoidMethod(env, sclWriter, flushMethod);\r
+                       }\r
+\r
+                       currentEnv = NULL;\r
+                       sclWriter = NULL;\r
+\r
                        return result != NULL ? 0 : 1;\r
                }\r
        }\r
 }\r
 \r
 JNIEXPORT jstring JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonStringVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -979,7 +1060,7 @@ JNIEXPORT jstring JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonS
 }\r
 \r
 JNIEXPORT jobjectArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonStringArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1001,7 +1082,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPy
 }\r
 \r
 JNIEXPORT jboolean JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonBooleanVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1020,7 +1101,7 @@ JNIEXPORT jboolean JNICALL Java_org_simantics_pythonlink_PythonContext_getPython
 }\r
 \r
 JNIEXPORT jbooleanArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonBooleanArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1042,7 +1123,7 @@ JNIEXPORT jbooleanArray JNICALL Java_org_simantics_pythonlink_PythonContext_getP
 }\r
 \r
 JNIEXPORT jlong JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonLongVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1064,7 +1145,7 @@ JNIEXPORT jlong JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonLon
 }\r
 \r
 JNIEXPORT jintArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonIntegerArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1086,7 +1167,7 @@ JNIEXPORT jintArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPytho
 }\r
 \r
 JNIEXPORT jlongArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonLongArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1108,7 +1189,7 @@ JNIEXPORT jlongArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPyth
 }\r
 \r
 JNIEXPORT jdouble JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonDoubleVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1130,7 +1211,7 @@ JNIEXPORT jdouble JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonD
 }\r
 \r
 JNIEXPORT jdoubleArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonDoubleArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1152,7 +1233,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPy
 }\r
 \r
 JNIEXPORT jobject JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonNDArrayVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        if (!hasNumpy) {\r
                throwPythonException(env, "Importing numpy failed");\r
@@ -1186,7 +1267,7 @@ JNIEXPORT jobject JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonN
 }\r
 \r
 JNIEXPORT jobject JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonVariantVariableImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
 \r
@@ -1205,7 +1286,7 @@ JNIEXPORT jobject JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonV
 }\r
 \r
 JNIEXPORT jint JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonVariableTypeImpl(JNIEnv *env, jobject thisObj, jlong contextID, jstring variableName) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
        PyObject *dict = PyModule_GetDict(module);\r
 \r
        PyObject *pythonName = getPythonString(env, variableName);\r
@@ -1243,7 +1324,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonVari
 }\r
 \r
 JNIEXPORT jobjectArray JNICALL Java_org_simantics_pythonlink_PythonContext_getPythonVariableNamesImpl(JNIEnv *env, jobject thisObj, jlong contextID) {\r
-       PyObject *module = (PyObject*)contextID;\r
+       PyObject *module = getModule(contextID);\r
        PyObject *dict = PyModule_GetDict(module);\r
 \r
        PyObject *keys = PyDict_Keys(dict);\r
index 4032d4854512fb27fa18008e6a1c23b894140e63..15d681d43b7c5e023fccc34604c79ce997bd29d2 100644 (file)
@@ -34,6 +34,9 @@
 #define MAP_CLASS "java/util/Map"\r
 #define SET_CLASS "java/util/Set"\r
 \r
+#define WRITER_CLASS "java/io/Writer"\r
+#define SCL_REPORTING_WRITER_CLASS "org/simantics/scl/runtime/reporting/SCLReportingWriter"\r
+\r
 #define PACKAGE_PREFIX "org/simantics/pythonlink/"\r
 \r
 #define NDARRAY_CLASS (PACKAGE_PREFIX "NDArray")\r
diff --git a/org.simantics.pythonlink/pom.xml b/org.simantics.pythonlink/pom.xml
new file mode 100644 (file)
index 0000000..80ffa41
--- /dev/null
@@ -0,0 +1,18 @@
+<?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.python</groupId>
+               <artifactId>org.simantics.pythonlink.parent</artifactId>
+               <version>1.0.0-SNAPSHOT</version>
+               <relativePath>../org.simantics.pythonlink.parent</relativePath>
+       </parent>
+
+       <artifactId>org.simantics.pythonlink</artifactId>
+       <packaging>eclipse-plugin</packaging>
+       <version>1.0.0-SNAPSHOT</version>
+
+</project>
index 6c96dd3bde8a877e1e2115c4f1686f4101a44200..2063c0bd7b53ecfcd113b2e7a5185a1bf42e1714 100644 (file)
@@ -13,6 +13,8 @@ import org.simantics.databoard.Bindings;
 import org.simantics.databoard.binding.Binding;\r
 import org.simantics.databoard.binding.error.BindingException;\r
 import org.simantics.databoard.binding.mutable.Variant;\r
+import org.simantics.scl.runtime.SCLContext;\r
+import org.simantics.scl.runtime.reporting.SCLReportingHandler;\r
 \r
 public class PythonContext implements Closeable {\r
     private long contextID;\r
@@ -75,7 +77,14 @@ public class PythonContext implements Closeable {
     }\r
     \r
     public void executePythonStatement(String statement) {\r
-        execute(() -> executePythonStatementImpl( contextID, statement ));\r
+       SCLContext sclContext = SCLContext.getCurrent();\r
+       \r
+        execute(() -> {\r
+               SCLContext.push(sclContext);\r
+               executePythonStatementImpl( contextID, statement );\r
+               SCLContext.pop();\r
+        });\r
+        \r
        for (Listener l : listeners) { l.updated(null); }\r
     }\r
 \r
diff --git a/pom.xml b/pom.xml
new file mode 100644 (file)
index 0000000..653572f
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       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>
+       <groupId>org.simantics.python</groupId>
+       <artifactId>org.simantics.pythonlink.root</artifactId>
+       <version>1.0.0-SNAPSHOT</version>
+       <packaging>pom</packaging>
+
+       <modules>
+               <module>org.simantics.pythonlink.parent</module>
+       </modules>
+</project>