diff --git a/lib/jython-standalone-2.7-b3.jar b/lib/jython-standalone-2.7-b3.jar new file mode 100644 index 0000000..2c349c4 Binary files /dev/null and b/lib/jython-standalone-2.7-b3.jar differ diff --git a/nbproject/build-native.xml b/nbproject/build-native.xml index b40fd54..75448ad 100644 --- a/nbproject/build-native.xml +++ b/nbproject/build-native.xml @@ -67,7 +67,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - + @@ -89,27 +89,19 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + - - - + - - - - - - + + @@ -120,9 +112,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -133,9 +123,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -146,9 +134,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -159,9 +145,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -172,9 +156,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -185,9 +167,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -198,9 +178,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -212,9 +190,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -226,9 +202,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -240,9 +214,7 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - + @@ -258,8 +230,8 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. + uri="javafx:com.sun.javafx.tools.ant" + classpath="${javafx.ant.classpath}"/> @@ -397,23 +369,13 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - - - - - - - - - - - - - - - + + + + + + + @@ -427,17 +389,11 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - - - - - - - - - + + + + + @@ -447,16 +403,12 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - - - - - - - - + + + + + + @@ -466,16 +418,12 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. - - - - - - - - - - + + + + + + @@ -514,11 +462,11 @@ Portions Copyrighted 2013 Sun Microsystems, Inc. self.addMappedName( - (source.indexOf("jfxrt.jar") >= 0) || - (source.indexOf("deploy.jar") >= 0) || - (source.indexOf("javaws.jar") >= 0) || - (source.indexOf("plugin.jar") >= 0) - ? "" : source + (source.indexOf("jfxrt.jar") >= 0) || + (source.indexOf("deploy.jar") >= 0) || + (source.indexOf("javaws.jar") >= 0) || + (source.indexOf("plugin.jar") >= 0) + ? "" : source ); diff --git a/nbproject/build-native.xml~ b/nbproject/build-native.xml~ new file mode 100644 index 0000000..b40fd54 --- /dev/null +++ b/nbproject/build-native.xml~ @@ -0,0 +1,1005 @@ + + + + + + + + + Native Packager Ant calls based on SE support in JavaFX packager + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + self.addMappedName( + (source.indexOf("jfxrt.jar") >= 0) || + (source.indexOf("deploy.jar") >= 0) || + (source.indexOf("javaws.jar") >= 0) || + (source.indexOf("plugin.jar") >= 0) + ? "" : source + ); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties index c168218..3208b81 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -3,7 +3,7 @@ annotation.processing.enabled.in.editor=false annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.splash=C:\\Users\\Skylar\\SparkleShare\\aplabs\\appmedia\\SyMAT\\splash0.5.png +application.splash=C:\\Users\\Skylar\\SparkleShare\\aplabs\\appmedia\\SyMAT\\splash0.6.png application.title=SyMAT application.vendor=Apocalypse Laboratories auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml @@ -36,6 +36,7 @@ file.reference.iText-4.2.0-com.itextpdf.jar=lib/iText-4.2.0-com.itextpdf.jar file.reference.JavaPrettify-1.2.1.jar=lib/JavaPrettify-1.2.1.jar file.reference.js-engine.jar=lib/js-engine.jar file.reference.js.jar=lib/js.jar +file.reference.jython-standalone-2.7-b3.jar=lib/jython-standalone-2.7-b3.jar file.reference.log4j-1.2.11.jar=lib/log4j-1.2.11.jar file.reference.symja-2014-11-01.jar=lib/symja-2014-11-01.jar includes=** @@ -49,7 +50,8 @@ javac.classpath=\ ${file.reference.iText-4.2.0-com.itextpdf.jar}:\ ${file.reference.htmlcleaner-2.10.jar}:\ ${file.reference.js-engine.jar}:\ - ${file.reference.js.jar} + ${file.reference.js.jar}:\ + ${file.reference.jython-standalone-2.7-b3.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/src/net/apocalypselabs/symat/CodeEditor.form b/src/net/apocalypselabs/symat/CodeEditor.form index 1aab7b2..99fb83d 100644 --- a/src/net/apocalypselabs/symat/CodeEditor.form +++ b/src/net/apocalypselabs/symat/CodeEditor.form @@ -25,14 +25,16 @@ + + - + - + @@ -40,10 +42,10 @@ - + - + @@ -51,10 +53,10 @@ - + - + @@ -62,25 +64,28 @@ - + - + + + + - + - + - + @@ -88,17 +93,41 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/src/net/apocalypselabs/symat/CodeEditor.java b/src/net/apocalypselabs/symat/CodeEditor.java index 479d818..2aa6409 100644 --- a/src/net/apocalypselabs/symat/CodeEditor.java +++ b/src/net/apocalypselabs/symat/CodeEditor.java @@ -1,7 +1,7 @@ -/* +/* * Apocalypse Laboratories * Open Source License - * + * * Source code can be used for any purpose, as long as: * - Compiled binaries are rebranded and trademarks are not * visible by the end user at any time, except to give @@ -14,7 +14,7 @@ * - and you provide your modified source code for download, * under the terms of the GNU LGPL v3 or a comparable * license. - * + * * Compiled binaries cannot be redistributed or mirrored, * unless: * - You have written permission from Apocalypse Laboratories; @@ -22,7 +22,7 @@ * not even behind a paywall or other blocking mechanism; * - or you have received a multi-computer license, in which * case you should take measures to prevent unauthorized - * downloads, such as preventing download access from the + * downloads, such as preventing download access from the * Internet. */ package net.apocalypselabs.symat; @@ -68,12 +68,19 @@ public class CodeEditor extends javax.swing.JInternalFrame { */ public CodeEditor() { initComponents(); - FileFilter filter = new FileNameExtensionFilter("SyMAT script (.symt)", "symt"); + + if (!PrefStorage.isset("advancedcontrols")) { + runMenu.remove(codeLangMenu); + } + + FileFilter filter = new FileNameExtensionFilter("SyMAT JavaScript (.syjs)", "syjs"); fc.setFileFilter(filter); fc.addChoosableFileFilter(filter); + filter = new FileNameExtensionFilter("SyMAT Python (.sypy)", "sypy"); + fc.addChoosableFileFilter(filter); filter = new FileNameExtensionFilter("JavaScript file (.js)", "js"); fc.addChoosableFileFilter(filter); - filter = new FileNameExtensionFilter("MeetLeeb script (.mls)", "mls"); + filter = new FileNameExtensionFilter("Python script (.py)", "py"); fc.addChoosableFileFilter(filter); int font_size = 12; try { @@ -132,6 +139,7 @@ public class CodeEditor extends javax.swing.JInternalFrame { jMenuBar2 = new javax.swing.JMenuBar(); jMenu3 = new javax.swing.JMenu(); jMenu4 = new javax.swing.JMenu(); + langBtnGroup = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jSplitPane1 = new javax.swing.JSplitPane(); scrollPane = new JScrollPane(codeBox); @@ -140,14 +148,17 @@ public class CodeEditor extends javax.swing.JInternalFrame { jScrollPane1 = new javax.swing.JScrollPane(); outputBox = new javax.swing.JTextArea(); jMenuBar1 = new javax.swing.JMenuBar(); - jMenu1 = new javax.swing.JMenu(); - jMenuItem1 = new javax.swing.JMenuItem(); - jMenuItem2 = new javax.swing.JMenuItem(); - jMenuItem3 = new javax.swing.JMenuItem(); - jMenuItem8 = new javax.swing.JMenuItem(); - jMenu5 = new javax.swing.JMenu(); - jMenuItem6 = new javax.swing.JMenuItem(); - jMenu2 = new javax.swing.JMenu(); + fileMenu = new javax.swing.JMenu(); + openMenu = new javax.swing.JMenuItem(); + saveMenu = new javax.swing.JMenuItem(); + saveAsMenu = new javax.swing.JMenuItem(); + exportMenu = new javax.swing.JMenuItem(); + editMenu = new javax.swing.JMenu(); + clrOutputMenu = new javax.swing.JMenuItem(); + codeLangMenu = new javax.swing.JMenu(); + javascriptOption = new javax.swing.JRadioButtonMenuItem(); + pythonOption = new javax.swing.JRadioButtonMenuItem(); + runMenu = new javax.swing.JMenu(); jMenuItem5 = new javax.swing.JMenuItem(); jMenuItem4.setText("jMenuItem4"); @@ -213,62 +224,76 @@ public class CodeEditor extends javax.swing.JInternalFrame { .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE) ); - jMenu1.setText("File"); + fileMenu.setText("File"); - jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); - jMenuItem1.setText("Open..."); - jMenuItem1.addActionListener(new java.awt.event.ActionListener() { + openMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); + openMenu.setText("Open..."); + openMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem1ActionPerformed(evt); + openMenuActionPerformed(evt); } }); - jMenu1.add(jMenuItem1); + fileMenu.add(openMenu); - jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); - jMenuItem2.setText("Save..."); - jMenuItem2.addActionListener(new java.awt.event.ActionListener() { + saveMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); + saveMenu.setText("Save..."); + saveMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem2ActionPerformed(evt); + saveMenuActionPerformed(evt); } }); - jMenu1.add(jMenuItem2); + fileMenu.add(saveMenu); - jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); - jMenuItem3.setText("Save as..."); - jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + saveAsMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); + saveAsMenu.setText("Save as..."); + saveAsMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem3ActionPerformed(evt); + saveAsMenuActionPerformed(evt); } }); - jMenu1.add(jMenuItem3); + fileMenu.add(saveAsMenu); - jMenuItem8.setText("Export..."); - jMenuItem8.addActionListener(new java.awt.event.ActionListener() { + exportMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK)); + exportMenu.setText("Export..."); + exportMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem8ActionPerformed(evt); + exportMenuActionPerformed(evt); } }); - jMenu1.add(jMenuItem8); + fileMenu.add(exportMenu); - jMenuBar1.add(jMenu1); + jMenuBar1.add(fileMenu); - jMenu5.setText("Edit"); + editMenu.setText("Edit"); - jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.CTRL_MASK)); - jMenuItem6.setText("Clear output"); - jMenuItem6.addActionListener(new java.awt.event.ActionListener() { + clrOutputMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.CTRL_MASK)); + clrOutputMenu.setText("Clear output"); + clrOutputMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem6ActionPerformed(evt); + clrOutputMenuActionPerformed(evt); } }); - jMenu5.add(jMenuItem6); + editMenu.add(clrOutputMenu); + + codeLangMenu.setText("Language"); + + langBtnGroup.add(javascriptOption); + javascriptOption.setSelected(true); + javascriptOption.setText("Javascript"); + codeLangMenu.add(javascriptOption); + + langBtnGroup.add(pythonOption); + pythonOption.setText("Python"); + codeLangMenu.add(pythonOption); + + editMenu.add(codeLangMenu); - jMenuBar1.add(jMenu5); + jMenuBar1.add(editMenu); - jMenu2.setText("Run"); - jMenu2.addActionListener(new java.awt.event.ActionListener() { + runMenu.setText("Run"); + runMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenu2ActionPerformed(evt); + runMenuActionPerformed(evt); } }); @@ -279,9 +304,9 @@ public class CodeEditor extends javax.swing.JInternalFrame { jMenuItem5ActionPerformed(evt); } }); - jMenu2.add(jMenuItem5); + runMenu.add(jMenuItem5); - jMenuBar1.add(jMenu2); + jMenuBar1.add(runMenu); setJMenuBar(jMenuBar1); @@ -299,7 +324,7 @@ public class CodeEditor extends javax.swing.JInternalFrame { pack(); }// //GEN-END:initComponents - private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + private void openMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuActionPerformed int r = fc.showOpenDialog(this); if (r == JFileChooser.APPROVE_OPTION) { try { @@ -314,7 +339,7 @@ public class CodeEditor extends javax.swing.JInternalFrame { } } codeBox.setCaretPosition(0); - }//GEN-LAST:event_jMenuItem1ActionPerformed + }//GEN-LAST:event_openMenuActionPerformed public void openFileFromString(String file) { try { @@ -323,13 +348,20 @@ public class CodeEditor extends javax.swing.JInternalFrame { isSaved = true; lastSaved = codeBox.getText(); setTitle("Editor - " + f.getName()); + if (file.matches(".*\\.(js|mls|symt|syjs)")) { + javascriptOption.setSelected(true); + pythonOption.setSelected(false); + } else if (file.matches(".*\\.(sypy|py)")) { + javascriptOption.setSelected(false); + pythonOption.setSelected(true); + } } catch (IOException ex) { JOptionPane.showInternalMessageDialog(this, "Error: Cannot load file: " + ex.getMessage()); } } - private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed + private void saveMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuActionPerformed if (!isSaved) { int r = fc.showSaveDialog(this); if (r == JFileChooser.APPROVE_OPTION) { @@ -346,41 +378,58 @@ public class CodeEditor extends javax.swing.JInternalFrame { JOptionPane.showInternalMessageDialog(this, "Error: Cannot save file: " + ex.getMessage()); } } - }//GEN-LAST:event_jMenuItem2ActionPerformed + }//GEN-LAST:event_saveMenuActionPerformed private String addSaveExt(String path) { - if (!path.matches(".*\\.(js|mls|symt)")) { - path += ".symt"; + if (!path.matches(".*\\.(js|mls|symt|syjs|sypy|py)")) { + if (pythonOption.isSelected()) { + path += ".sypy"; + } else { + path += ".syjs"; + } } return path; } - private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + private void saveAsMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAsMenuActionPerformed isSaved = false; // Reset saved status, force dialog - jMenuItem2ActionPerformed(evt); - }//GEN-LAST:event_jMenuItem3ActionPerformed + saveMenuActionPerformed(evt); + }//GEN-LAST:event_saveAsMenuActionPerformed - private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed + private void runMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runMenuActionPerformed - }//GEN-LAST:event_jMenu2ActionPerformed + }//GEN-LAST:event_runMenuActionPerformed private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed - CodeRunner cr = new CodeRunner(); + if (javascriptOption.isSelected()) { + execCode("javascript"); + } else if (pythonOption.isSelected()) { + execCode("python"); + } + }//GEN-LAST:event_jMenuItem5ActionPerformed + + private void execCode(String lang) { + CodeRunner cr = new CodeRunner(lang); + System.out.println(lang); + System.out.println(codeBox.getText()); Object result = cr.evalString(codeBox.getText()); try { outputBox.append(result.toString() + "\n"); } catch (NullPointerException ex) { } - }//GEN-LAST:event_jMenuItem5ActionPerformed - - private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed + } + private void clrOutputMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clrOutputMenuActionPerformed outputBox.setText(""); - }//GEN-LAST:event_jMenuItem6ActionPerformed + }//GEN-LAST:event_clrOutputMenuActionPerformed - private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed - CodeExport ce = new CodeExport(codeBox.getText()); + private void exportMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportMenuActionPerformed + String lang = "js"; + if (pythonOption.isSelected()) { + lang = "python"; + } + CodeExport ce = new CodeExport(codeBox.getText(), lang); MainGUI.loadFrame(ce); - }//GEN-LAST:event_jMenuItem8ActionPerformed + }//GEN-LAST:event_exportMenuActionPerformed private void saveFile(String content, String path) throws IOException { @@ -405,7 +454,7 @@ public class CodeEditor extends javax.swing.JInternalFrame { if (p == JOptionPane.YES_OPTION) { dispose(); } else { - jMenuItem3ActionPerformed(null); + saveMenuActionPerformed(null); } } } @@ -417,26 +466,30 @@ public class CodeEditor extends javax.swing.JInternalFrame { } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JMenuItem clrOutputMenu; + private javax.swing.JMenu codeLangMenu; + private javax.swing.JMenu editMenu; + private javax.swing.JMenuItem exportMenu; + private javax.swing.JMenu fileMenu; private javax.swing.JLabel jLabel1; - private javax.swing.JMenu jMenu1; - private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenu jMenu4; - private javax.swing.JMenu jMenu5; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuBar jMenuBar2; - private javax.swing.JMenuItem jMenuItem1; - private javax.swing.JMenuItem jMenuItem2; - private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem4; private javax.swing.JMenuItem jMenuItem5; - private javax.swing.JMenuItem jMenuItem6; - private javax.swing.JMenuItem jMenuItem8; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSplitPane jSplitPane1; + private javax.swing.JRadioButtonMenuItem javascriptOption; + private javax.swing.ButtonGroup langBtnGroup; + private javax.swing.JMenuItem openMenu; private javax.swing.JTextArea outputBox; + private javax.swing.JRadioButtonMenuItem pythonOption; + private javax.swing.JMenu runMenu; + private javax.swing.JMenuItem saveAsMenu; + private javax.swing.JMenuItem saveMenu; private javax.swing.JScrollPane scrollPane; // End of variables declaration//GEN-END:variables } diff --git a/src/net/apocalypselabs/symat/CodeExport.java b/src/net/apocalypselabs/symat/CodeExport.java index e09dac4..414f1aa 100644 --- a/src/net/apocalypselabs/symat/CodeExport.java +++ b/src/net/apocalypselabs/symat/CodeExport.java @@ -58,6 +58,7 @@ import syntaxhighlight.ParseResult; */ public class CodeExport extends javax.swing.JInternalFrame { + private String codeLang = "js"; private String html; private final String origCode; private final JFileChooser fc = new JFileChooser(); @@ -65,7 +66,7 @@ public class CodeExport extends javax.swing.JInternalFrame { /** * Creates new form CodeExport * - * @param code + * @param code The code. */ public CodeExport(String code) { origCode = code; @@ -74,6 +75,17 @@ public class CodeExport extends javax.swing.JInternalFrame { previewPane.setText(html); previewPane.setCaretPosition(0); } + + /** + * Create CodeExport window with a set language for syntax highlighting. + * + * @param code The code. + * @param lang Options are "js" or "python". + */ + public CodeExport(String code, String lang) { + this(code); + codeLang = lang; + } private String genHtml(String code) { String css = ""; @@ -107,7 +119,7 @@ public class CodeExport extends javax.swing.JInternalFrame { html += "

" + headerBox.getText() + "

"; } PrettifyParser parser = new PrettifyParser(); - List parseResults = parser.parse("js", code); + List parseResults = parser.parse(codeLang, code); html += PrettifyToHtml.toHtml(code, parseResults); html += ""; html = html.replace("\t", "    "); diff --git a/src/net/apocalypselabs/symat/CodeRunner.java b/src/net/apocalypselabs/symat/CodeRunner.java index 860d03d..93f59e4 100644 --- a/src/net/apocalypselabs/symat/CodeRunner.java +++ b/src/net/apocalypselabs/symat/CodeRunner.java @@ -29,6 +29,8 @@ package net.apocalypselabs.symat; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.StringWriter; import javax.script.*; import javax.swing.JOptionPane; @@ -38,23 +40,60 @@ import javax.swing.JOptionPane; */ public class CodeRunner { - ScriptEngine jse = new ScriptEngineManager().getEngineByName("rhino"); - boolean isJava8 = false; + private ScriptEngine se; + + // If we need to wrap code around input to make everything nice. + private boolean wrapRequired = false; + // What codez are we speaking? + private String scriptLang = ""; + + private boolean isShell = false; public CodeRunner() { - try { - // Add custom functions. - jse.eval("importClass(net.apocalypselabs.symat.Functions);" - + "SyMAT_Functions = new net.apocalypselabs.symat.Functions();"); - } catch (Exception ex) { - JOptionPane.showMessageDialog(null, "Error: " - + "Could not properly initialize scripting engine." - + "\n\nSome functions may not work.\n\n" - + "(" + ex.getMessage() + ")"); - ex.printStackTrace(); + this("javascript"); + } + + public CodeRunner(String lang) { + scriptLang = lang; + switch (lang) { + case "javascript": + se = new ScriptEngineManager().getEngineByName("rhino"); + wrapRequired = true; + try { + // Add custom functions. + se.eval("importClass(net.apocalypselabs.symat.Functions);" + + "SyMAT_Functions = new net.apocalypselabs.symat.Functions();" + + jsFunctions()); + } catch (Exception ex) { + initError(ex); + } + break; + case "python": + se = new ScriptEngineManager().getEngineByName("python"); + try { + se.eval("from net.apocalypselabs.symat import Functions\n_=Functions()\n"); + } catch (Exception ex) { + initError(ex); + } + break; + default: + throw new UnsupportedOperationException("Script language " + lang + " not supported."); } } + public CodeRunner(String lang, boolean shell) { + this(lang); + isShell = shell; + } + + private void initError(Exception ex) { + JOptionPane.showMessageDialog(null, "Error: " + + "Could not properly initialize " + scriptLang + " scripting engine." + + "\n\nSome functions may not work.\n\n" + + "(" + ex.getMessage() + ")"); + ex.printStackTrace(); + } + /** * Parse a String of JavaScript. * @@ -63,7 +102,15 @@ public class CodeRunner { */ public Object evalString(String eval) { try { - return jse.eval(wrapMath(eval)); + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + se.getContext().setWriter(pw); + Object res = se.eval(wrapMath(eval)); + if (res == null) { + res = ""; + } + String result = res + sw.getBuffer().toString().trim(); + return result; } catch (ScriptException ex) { return formatEx(ex); } @@ -85,17 +132,20 @@ public class CodeRunner { * @return wrapped input */ private String wrapMath(String eval) { - String with = "with(SyMAT_Functions){with(Math){" + eval + "}}"; - //System.out.println(with); - return with; + if (wrapRequired) { + String with = "with(SyMAT_Functions){with(Math){" + eval + "}}"; + //System.out.println(with); + return with; + } + return eval; } public void setVar(String var, Object val) { - jse.put(var, val); + se.put(var, val); } public Object getVar(String var) { - return jse.get(var); + return se.get(var); } private String jsFunctions() { diff --git a/src/net/apocalypselabs/symat/Display.form b/src/net/apocalypselabs/symat/Display.form index da04521..26e9338 100644 --- a/src/net/apocalypselabs/symat/Display.form +++ b/src/net/apocalypselabs/symat/Display.form @@ -39,13 +39,18 @@ - + + + + + + @@ -53,20 +58,19 @@ - + - - - - - - - - - - + + + + - + + + + + + @@ -102,7 +106,7 @@ - + @@ -142,10 +146,11 @@ - - - - + + + + + @@ -153,11 +158,10 @@ - - - - + + + @@ -206,5 +210,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/net/apocalypselabs/symat/Display.java b/src/net/apocalypselabs/symat/Display.java index 74f1e32..5909bb5 100644 --- a/src/net/apocalypselabs/symat/Display.java +++ b/src/net/apocalypselabs/symat/Display.java @@ -27,6 +27,8 @@ */ package net.apocalypselabs.symat; +import javax.swing.JOptionPane; + /** * * @author Skylar @@ -58,6 +60,8 @@ public class Display extends javax.swing.JInternalFrame { jLabel1 = new javax.swing.JLabel(); saveBtn = new javax.swing.JButton(); cancelBtn = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + advOptionsBox = new javax.swing.JCheckBox(); setClosable(true); setIconifiable(true); @@ -97,7 +101,7 @@ public class Display extends javax.swing.JInternalFrame { .addComponent(themeLight) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(themeDark) - .addContainerGap(51, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Font")); @@ -114,19 +118,19 @@ public class Display extends javax.swing.JInternalFrame { jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fontSizeBox, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(125, Short.MAX_VALUE)) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(fontSizeBox, 0, 0, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1) - .addComponent(fontSizeBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(fontSizeBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) ); saveBtn.setText("Save"); @@ -143,6 +147,27 @@ public class Display extends javax.swing.JInternalFrame { } }); + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Editor")); + + advOptionsBox.setText("Advanced Options"); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(advOptionsBox) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(advOptionsBox) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -152,27 +177,31 @@ public class Display extends javax.swing.JInternalFrame { .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(cancelBtn) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(saveBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(saveBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(42, 42, 42) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(saveBtn) - .addComponent(cancelBtn))) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(saveBtn) + .addComponent(cancelBtn)) + .addContainerGap(15, Short.MAX_VALUE)) ); pack(); @@ -188,10 +217,6 @@ public class Display extends javax.swing.JInternalFrame { } if (PrefStorage.isset("theme")) { switch (PrefStorage.getSetting("theme")) { - case "light": - themeLight.setSelected(true); - themeDark.setSelected(false); - break; case "dark": themeLight.setSelected(false); themeDark.setSelected(true); @@ -201,6 +226,9 @@ public class Display extends javax.swing.JInternalFrame { themeDark.setSelected(false); } } + if (PrefStorage.isset("advancedcontrols")) { + advOptionsBox.setSelected(true); + } }//GEN-LAST:event_formComponentShown private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed @@ -210,16 +238,30 @@ public class Display extends javax.swing.JInternalFrame { } else { PrefStorage.saveSetting("theme", "light"); } + if (advOptionsBox.isSelected()) { + PrefStorage.saveSetting("advancedcontrols", "true"); + } else { + PrefStorage.unset("advancedcontrols"); + } + if (!PrefStorage.save()) { + // Something dun goofed... + JOptionPane.showInternalMessageDialog(this, + "Error: Problem occured while saving settings. " + + "This error is outside the control of " + + "the application."); + } MainGUI.updateDisplay(); dispose(); }//GEN-LAST:event_saveBtnActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JCheckBox advOptionsBox; private javax.swing.JButton cancelBtn; private javax.swing.JComboBox fontSizeBox; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; private javax.swing.JButton saveBtn; private javax.swing.JRadioButton themeDark; private javax.swing.ButtonGroup themeGroup; diff --git a/src/net/apocalypselabs/symat/Functions.java b/src/net/apocalypselabs/symat/Functions.java index 9dcec7f..5454aae 100644 --- a/src/net/apocalypselabs/symat/Functions.java +++ b/src/net/apocalypselabs/symat/Functions.java @@ -54,14 +54,10 @@ public class Functions { return JOptionPane.showInternalInputDialog(MainGUI.mainPane, question); } - public void write(String content) { - // TODO: enable output logging - } - /* Math commands */ - public String d(String function, String idv) { + public String D(String function, String idv) { return util.evaluate("diff(" + function + "," + idv + ")").toString(); } diff --git a/src/net/apocalypselabs/symat/Interpreter.form b/src/net/apocalypselabs/symat/Interpreter.form index 7463efb..38718cb 100644 --- a/src/net/apocalypselabs/symat/Interpreter.form +++ b/src/net/apocalypselabs/symat/Interpreter.form @@ -82,6 +82,7 @@ + diff --git a/src/net/apocalypselabs/symat/Interpreter.java b/src/net/apocalypselabs/symat/Interpreter.java index 2635eb6..79fc30e 100644 --- a/src/net/apocalypselabs/symat/Interpreter.java +++ b/src/net/apocalypselabs/symat/Interpreter.java @@ -29,6 +29,7 @@ package net.apocalypselabs.symat; import java.awt.Color; import java.awt.Font; +import java.awt.event.KeyEvent; import javax.swing.text.DefaultCaret; /** @@ -37,7 +38,9 @@ import javax.swing.text.DefaultCaret; */ public class Interpreter extends javax.swing.JInternalFrame { - private final CodeRunner cr = new CodeRunner(); + private final CodeRunner cr = new CodeRunner("javascript", true); + private String[] history = new String[10]; // Command history buffer + private int historyIndex = 0; // For going back in time and keeping things straight /** * Creates new form Interpreter @@ -102,6 +105,9 @@ public class Interpreter extends javax.swing.JInternalFrame { jScrollPane1.setViewportView(mainBox); inputBox.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + inputBoxKeyPressed(evt); + } public void keyTyped(java.awt.event.KeyEvent evt) { inputBoxKeyTyped(evt); } @@ -152,9 +158,35 @@ public class Interpreter extends javax.swing.JInternalFrame { private void inputBoxKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inputBoxKeyTyped if (evt.getKeyChar() == '\n') { doRunCode(); + return; } }//GEN-LAST:event_inputBoxKeyTyped + private void inputBoxKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inputBoxKeyPressed + switch (evt.getKeyCode()) { + case KeyEvent.VK_UP: + if (historyIndex < 9) { + if (historyIndex < 0) { + historyIndex++; + } + inputBox.setText(history[historyIndex]); + historyIndex++; + } + break; + case KeyEvent.VK_DOWN: + if (historyIndex >= 0) { + historyIndex--; + if (historyIndex < 0) { + historyIndex = 0; + inputBox.setText(""); + } else { + inputBox.setText(history[historyIndex]); + } + } + break; + } + }//GEN-LAST:event_inputBoxKeyPressed + private void doRunCode() { String code = inputBox.getText(); mainBox.append(" " + code + "\n"); @@ -164,7 +196,12 @@ public class Interpreter extends javax.swing.JInternalFrame { } mainBox.append(">>"); + for (int i = 9; i > 0; i--) { + history[i] = history[i - 1]; + } + history[0] = code; inputBox.setText(""); + historyIndex = -1; } // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/src/net/apocalypselabs/symat/PrefStorage.java b/src/net/apocalypselabs/symat/PrefStorage.java index 21ef39d..ba40528 100644 --- a/src/net/apocalypselabs/symat/PrefStorage.java +++ b/src/net/apocalypselabs/symat/PrefStorage.java @@ -27,6 +27,9 @@ */ package net.apocalypselabs.symat; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; /** @@ -35,17 +38,18 @@ import java.util.prefs.Preferences; */ public class PrefStorage { - private static Preferences prefs = Preferences.userNodeForPackage(PrefStorage.class); + private static final Preferences prefs = Preferences.userNodeForPackage(PrefStorage.class); public static void saveSetting(String key, String value) { prefs.put(key, value); } public static boolean isset(String key) { - if (!getSetting(key, "NULL").equals("NULL")) { - return true; - } - return false; + return !getSetting(key, "NULL").equals("NULL"); + } + + public static void unset(String key) { + prefs.remove(key); } public static String getSetting(String key) { @@ -55,6 +59,16 @@ public class PrefStorage { public static String getSetting(String key, String emptyResponse) { return prefs.get(key, emptyResponse); } + + public static boolean save() { + try { + prefs.flush(); + } catch (BackingStoreException ex) { + System.err.println("Settings could not be saved!"); + return false; + } + return true; + } // xkcd 221 compliance. int getRandomNumber() { diff --git a/src/net/apocalypselabs/symat/functions.js b/src/net/apocalypselabs/symat/functions.js index e69de29..d5bf783 100644 --- a/src/net/apocalypselabs/symat/functions.js +++ b/src/net/apocalypselabs/symat/functions.js @@ -0,0 +1,3 @@ +function write(data) { + console.log(data); +} \ No newline at end of file diff --git a/src/net/apocalypselabs/symat/help/basics.html b/src/net/apocalypselabs/symat/help/basics.html index c571d04..d2d9a53 100644 --- a/src/net/apocalypselabs/symat/help/basics.html +++ b/src/net/apocalypselabs/symat/help/basics.html @@ -7,6 +7,7 @@

Open a new shell by clicking the button.
Try typing commands, like "2*2" or "sin[.5]".
You can make variables too, try "x=.5" then "sin[x]". -

Fun fact: You can use the Enter key OR the run button to run the command!

+

SyMAT keeps track of the last few commands you enter in a shell. + To run one again, use the up and down keys to navigate the history.

diff --git a/src/net/apocalypselabs/symat/help/commands.html b/src/net/apocalypselabs/symat/help/commands.html index e59b56d..081fb81 100644 --- a/src/net/apocalypselabs/symat/help/commands.html +++ b/src/net/apocalypselabs/symat/help/commands.html @@ -7,7 +7,8 @@

notify(var) Creates a popup box with the given content.
ask(prompt) Returns the entered text. -
d("3*x", "x") Returns the derivative of the function with respect to the second argument. +
print(text) Outputs the given text to the screen. Does not require special prefix in Python. +
D("3*x", "x") Returns the derivative of the function with respect to the second argument.
$("command") Parses the given text with the Symja library.
   Aliases: sym
replace("text", "find", "replace") Returns "text" with all occurrences of "find" changed to "replace". diff --git a/src/net/apocalypselabs/symat/help/editor.html b/src/net/apocalypselabs/symat/help/editor.html index 96c4e42..c971336 100644 --- a/src/net/apocalypselabs/symat/help/editor.html +++ b/src/net/apocalypselabs/symat/help/editor.html @@ -4,9 +4,19 @@

Code Editor

-

You can write code here. This code will be run all at once. -
You can even open and save code files. -
Press F5 to run your script. - Whatever it spits out will appear in the Output box.

+

The code editor allows you to make scripts that can do many things. +
Scripts can be written in JavaScript or in Python. +
To switch languages, use the Language option on the Edit menu. +

+

Note: + Python scripts require + _. + before SyMAT commands.

+

Exporting Code

+

You can export syntax-highlighted (colored) code to + HTML or PDF with the Export tool. This is useful for generating + reports or for publishing to the Internet. +
The code will be formatted according to the currently selected + language in the editor.

diff --git a/src/net/apocalypselabs/symat/help/licenses.html b/src/net/apocalypselabs/symat/help/licenses.html index bbd0204..4ec70c6 100644 --- a/src/net/apocalypselabs/symat/help/licenses.html +++ b/src/net/apocalypselabs/symat/help/licenses.html @@ -44,6 +44,46 @@ See the License for the specific language governing permissions and
limitations under the License.


+

Jython


+

PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+ 1. This LICENSE AGREEMENT is between the Python Software Foundation + ("PSF"), and the Individual or Organization ("Licensee") accessing and + otherwise using this software ("Jython") in source or binary form and + its associated documentation.
+ 2. Subject to the terms and conditions of this License Agreement, PSF + hereby grants Licensee a nonexclusive, royalty-free, world-wide + license to reproduce, analyze, test, perform and/or display publicly, + prepare derivative works, distribute, and otherwise use Jython alone + or in any derivative version, provided, however, that PSF's License + Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2007 + Python Software Foundation; All Rights Reserved" are retained in + Jython alone or in any derivative version prepared by Licensee.
+ 3. In the event Licensee prepares a derivative work that is based on + or incorporates Jython or any part thereof, and wants to make + the derivative work available to others as provided herein, then + Licensee hereby agrees to include in any such work a brief summary of + the changes made to Jython.
+ 4. PSF is making Jython available to Licensee on an "AS IS" + basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND + DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF JYTHON WILL NOT + INFRINGE ANY THIRD PARTY RIGHTS.
+ 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF JYTHON + FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS + A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING JYTHON, + OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+ 6. This License Agreement will automatically terminate upon a material + breach of its terms and conditions.
+ 7. Nothing in this License Agreement shall be deemed to create any + relationship of agency, partnership, or joint venture between PSF and + Licensee. This License Agreement does not grant permission to use PSF + trademarks or trade name in a trademark sense to endorse or promote + products or services of Licensee, or any third party.
+ 8. By copying, installing or otherwise using Jython, Licensee + agrees to be bound by the terms and conditions of this License + Agreement.

+

HtmlCleaner


Copyright (c) 2006-2014, HtmlCleaner team.
All rights reserved.