Thread: [Mathlib-commitlog] SF.net SVN: mathlib:[522] JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ system
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2008-12-06 16:53:35
|
Revision: 522
http://mathlib.svn.sourceforge.net/mathlib/?rev=522&view=rev
Author: st_mueller
Date: 2008-12-06 16:53:26 +0000 (Sat, 06 Dec 2008)
Log Message:
-----------
changed from GlobalProperties to LocalProperties
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2008-12-06 16:51:12 UTC (rev 521)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2008-12-06 16:53:26 UTC (rev 522)
@@ -13,19 +13,19 @@
getInterpreter().displayText("Version information for JMathLib");
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.version");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.version");
getInterpreter().displayText("version: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.release.date");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
getInterpreter().displayText("release date: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.release.name");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
getInterpreter().displayText("release name: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.release.description");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
getInterpreter().displayText("release description: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.copyright");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
getInterpreter().displayText(s);
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2008-12-06 16:51:12 UTC (rev 521)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2008-12-06 16:53:26 UTC (rev 522)
@@ -13,19 +13,19 @@
getInterpreter().displayText("Version information for JMathLib");
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.version");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.version");
getInterpreter().displayText("version: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.release.date");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
getInterpreter().displayText("release date: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.release.name");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
getInterpreter().displayText("release name: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.release.description");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
getInterpreter().displayText("release description: "+s);
- s = getInterpreter().prefs.getGlobalProperty("jmathlib.copyright");
+ s = getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
getInterpreter().displayText(s);
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2008-12-06 16:57:02
|
Revision: 523
http://mathlib.svn.sourceforge.net/mathlib/?rev=523&view=rev
Author: st_mueller
Date: 2008-12-06 16:56:53 +0000 (Sat, 06 Dec 2008)
Log Message:
-----------
get/set global properties
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java 2008-12-06 16:56:53 UTC (rev 523)
@@ -0,0 +1,51 @@
+package jmathlib.toolbox.jmathlib.system;
+
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.CharToken;
+import jmathlib.core.tokens.OperandToken;
+
+/**External function to get a enviroment variable*/
+public class getglobalproperty extends ExternalFunction
+{
+ /**Returns an enviroment variable
+ @param operand[0] = the name of the variable
+ @param operand[1] = a default value (optional)
+ @return the enviroment value*/
+ public OperandToken evaluate(Token[] operands)
+ {
+ OperandToken result = null;
+
+ if (getNArgIn(operands)!=1)
+ throwMathLibException("getglobalproperty: number of arguments != 1");
+
+
+ if (!(operands[0] instanceof CharToken))
+ throwMathLibException("getglobalproperty: number of arguments != 1");
+
+ String name = operands[0].toString();
+ String defaultVal = "";
+
+
+ String property = getInterpreter().prefs.getGlobalProperty(name);
+
+ result = new CharToken(property);
+
+ return result;
+ }
+}
+
+/*
+@GROUP
+system
+@SYNTAX
+GETENV(variablename)
+@DOC
+Returns the value of the enviromental variable variablename.
+@NOTES
+@EXAMPLES
+getlocal("HOME")= "/home/user"
+@SEE
+getenv, getglobalproperty, setlocalproperty, setglobalproperty
+*/
+
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2008-12-06 16:53:26 UTC (rev 522)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2008-12-06 16:56:53 UTC (rev 523)
@@ -44,7 +44,8 @@
Returns the value of the enviromental variable variablename.
@NOTES
@EXAMPLES
-GETENV("HOME")= "/home/user"
+getlocal("HOME")= "/home/user"
@SEE
+getenv, getglobalproperty, setlocalproperty, setglobalproperty
*/
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2008-12-06 16:53:26 UTC (rev 522)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2008-12-06 16:56:53 UTC (rev 523)
@@ -38,12 +38,13 @@
@GROUP
system
@SYNTAX
-GETENV(variablename)
+setlocalproperty(property name, value)
@DOC
Returns the value of the enviromental variable variablename.
@NOTES
@EXAMPLES
GETENV("HOME")= "/home/user"
@SEE
+setglobalproperty
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2008-12-31 13:36:14
|
Revision: 588
http://mathlib.svn.sourceforge.net/mathlib/?rev=588&view=rev
Author: st_mueller
Date: 2008-12-31 13:36:06 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
quit and exit to terminate JMathLib
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/exit.m
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/exit.m
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/exit.m (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/exit.m 2008-12-31 13:36:06 UTC (rev 588)
@@ -0,0 +1,20 @@
+function exit()
+
+quit();
+
+/*
+@GROUP
+system
+@SYNTAX
+exit
+@DOC
+exits JMathLib
+@EXAMPLE
+<programlisting>
+exit
+</programlisting>
+@NOTES
+.
+@SEE
+quit
+*/
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java 2008-12-31 13:36:06 UTC (rev 588)
@@ -0,0 +1,48 @@
+package jmathlib.toolbox.jmathlib.system;
+
+import jmathlib.core.tokens.*;
+import jmathlib.core.functions.ExternalFunction;
+
+public class quit extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands)
+ {
+
+ if ((getNArgIn(operands) == 1) &&
+ (operands[0] instanceof CharToken) )
+ {
+ String value = operands[0].toString();
+
+ // if user calls quit("force") JMathLib will be terminated
+ // immediately without saving anything
+ if (value.equals("force"))
+ System.exit(0);
+ }
+
+ // run finish script and save local properties
+ getInterpreter().save();
+
+ // exit JMathLib
+ System.exit(0);
+
+ return null;
+ }
+}
+
+/*
+@GROUP
+system
+@SYNTAX
+quit
+@DOC
+exits JMathLib
+@EXAMPLE
+<programlisting>
+quit
+</programlisting>
+@NOTES
+quit("force") will terminate JMathLib
+without saving any variables of saving any changed settings.
+@SEE
+exit
+*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:32:49
|
Revision: 712
http://mathlib.svn.sourceforge.net/mathlib/?rev=712&view=rev
Author: st_mueller
Date: 2009-01-21 19:32:46 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -14,7 +15,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -34,23 +35,23 @@
//setNumberFormat(DecimalFormat.getInstance(Locale.ENGLISH));
if (type.equals("short"))
- setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long"))
- setNumberFormat(new DecimalFormat("0.000000000000000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("short e"))
- setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long e"))
- setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("short g"))
- setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long g"))
- setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("short eng"))
- setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else if (type.equals("long eng"))
- setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.000000000000000E000", new DecimalFormatSymbols(Locale.ENGLISH)));
else
- setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
+ globals.setNumberFormat(new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.ENGLISH)));
return result;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -13,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String defaultVal = "";
- String property = getInterpreter().prefs.getGlobalProperty(name);
+ String property = globals.getInterpreter().prefs.getGlobalProperty(name);
result = new CharToken(property);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String defaultVal = "";
- String property = getInterpreter().prefs.getLocalProperty(name);
+ String property = globals.getInterpreter().prefs.getLocalProperty(name);
result = new CharToken(property);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java 2009-01-21 19:31:17 UTC (rev 711)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java 2009-01-21 19:32:46 UTC (rev 712)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.plugins.dynjava.JavaPlugin;
/**An example of an external function - it returns the first parameter*/
@@ -12,13 +13,13 @@
/**Executes the function - returning the first parameter
@param operands - the array of parameters
@return the result of the function as an OperandToken*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
// load java plugin
- getPluginsManager().addPlugin("JavaPlugin");
+ globals.getPluginsManager().addPlugin("JavaPlugin");
- String result = ((JavaPlugin)getPluginsManager().getPlugin("JavaPlugin")).executeJavaExpression(operands[0].toString());
+ String result = ((JavaPlugin)globals.getPluginsManager().getPlugin("JavaPlugin")).executeJavaExpression(operands[0].toString());
return new CharToken(result);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:34:36
|
Revision: 713
http://mathlib.svn.sourceforge.net/mathlib/?rev=713&view=rev
Author: st_mueller
Date: 2009-01-21 19:34:32 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String name = operands[0].toString();
String prop = operands[1].toString();
- getInterpreter().prefs.setGlobalProperty(name, prop);
+ globals.getInterpreter().prefs.setGlobalProperty(name, prop);
return result;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -1,6 +1,7 @@
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -12,7 +13,7 @@
@param operand[0] = the name of the variable
@param operand[1] = a default value (optional)
@return the enviroment value*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
@@ -27,7 +28,7 @@
String name = operands[0].toString();
String prop = operands[1].toString();
- getInterpreter().prefs.setLocalProperty(name, prop);
+ globals.getInterpreter().prefs.setLocalProperty(name, prop);
return result;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -6,30 +6,31 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for updating JMathLib*/
public class update extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String lineFile = "";
boolean successB = true;
- getInterpreter().displayText("UPDATING JMathLib\n");
+ globals.getInterpreter().displayText("UPDATING JMathLib\n");
// get update site of jmathlib
- String updateSiteS = getInterpreter().prefs.getLocalProperty("update.site.primary");
- getInterpreter().displayText("update site: "+updateSiteS);
+ String updateSiteS = globals.getInterpreter().prefs.getLocalProperty("update.site.primary");
+ globals.getInterpreter().displayText("update site: "+updateSiteS);
// get local version of jmathlib
- String localVersionS = getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ String localVersionS = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
localVersionS = localVersionS.replaceAll("/", ".");
- getInterpreter().displayText("current version: "+localVersionS);
+ globals.getInterpreter().displayText("current version: "+localVersionS);
// first check to which version an update is possible
- getInterpreter().displayText("Checking to which version an update is possible");
+ globals.getInterpreter().displayText("Checking to which version an update is possible");
// url of the update site including the request for the version
@@ -63,20 +64,20 @@
String updateVersionS = props.getProperty("update.toversion");
if (updateVersionS.equals("no_update_available"))
{
- getInterpreter().displayText("No update available right now.");
+ globals.getInterpreter().displayText("No update available right now.");
return null;
}
if (updateVersionS.equals("full_download_required"))
{
- getInterpreter().displayText("\n");
- getInterpreter().displayText("Full download required in order to update!");
- getInterpreter().displayText("Please visit www.jmathlib.de for details.");
- getInterpreter().displayText("\n");
+ globals.getInterpreter().displayText("\n");
+ globals.getInterpreter().displayText("Full download required in order to update!");
+ globals.getInterpreter().displayText("Please visit www.jmathlib.de for details.");
+ globals.getInterpreter().displayText("\n");
return null;
}
- getInterpreter().displayText("updating to version >"+updateVersionS+"< \n");
+ globals.getInterpreter().displayText("updating to version >"+updateVersionS+"< \n");
// download new files from server
@@ -106,7 +107,7 @@
{
// read a file from the server and place it on the local disc
String fileS = s.substring(5).trim();
- getInterpreter().displayText("new file: >"+fileS+"<");
+ globals.getInterpreter().displayText("new file: >"+fileS+"<");
// open URL to file on update server
try
@@ -115,7 +116,7 @@
InputStream in = fileURL.openStream();
// open file on local disc
- File file = new File(getWorkingDirectory(),fileS);
+ File file = new File(globals.getWorkingDirectory(),fileS);
OutputStream out = new FileOutputStream(file);
byte[] cbuf = new byte[4096];
@@ -131,7 +132,7 @@
catch (Exception e)
{
successB = false;
- getInterpreter().displayText("update: problem downloading "+fileS);
+ globals.getInterpreter().displayText("update: problem downloading "+fileS);
}
}
@@ -139,16 +140,16 @@
{
// create a directory on the local disc
String dirS = s.substring(4).trim();
- getInterpreter().displayText("new directory: >"+dirS+"<");
+ globals.getInterpreter().displayText("new directory: >"+dirS+"<");
try
{
- File file = new File(getWorkingDirectory(),dirS);
+ File file = new File(globals.getWorkingDirectory(),dirS);
file.mkdir();
}
catch (Exception e)
{
successB = false;
- getInterpreter().displayText("update: problem creating directory "+dirS);
+ globals.getInterpreter().displayText("update: problem creating directory "+dirS);
}
}
@@ -156,25 +157,25 @@
{
// delete a file/directory on the local disc
String delS = s.substring(4).trim();
- getInterpreter().displayText("delete file/dir: >"+delS+"<");
+ globals.getInterpreter().displayText("delete file/dir: >"+delS+"<");
try
{
- File file = new File(getWorkingDirectory(),delS);
+ File file = new File(globals.getWorkingDirectory(),delS);
file.delete();
}
catch (Exception e)
{
successB = false;
- getInterpreter().displayText("update: problem deleting "+delS);
+ globals.getInterpreter().displayText("update: problem deleting "+delS);
}
}
else if (s.startsWith("prop"))
{
// delete a file/directory on the local disc
String propS = s.substring(5).trim();
- getInterpreter().displayText("new property: >"+propS+"<");
+ globals.getInterpreter().displayText("new property: >"+propS+"<");
String[] p = propS.split("=");
- getInterpreter().prefs.setLocalProperty(p[0],p[1]);
+ globals.getInterpreter().prefs.setLocalProperty(p[0],p[1]);
}
else
{
@@ -196,7 +197,7 @@
// notifiy user
if (!successB)
- getInterpreter().displayText("\n Update was not successful. Repeat again later on or inform the admin.");
+ globals.getInterpreter().displayText("\n Update was not successful. Repeat again later on or inform the admin.");
return null;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for displaying error messages
aborts the current function being processed*/
@@ -11,7 +12,7 @@
{
/**write operand to main display then abort processing
@param operand[0] = error messages to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Errors.throwUsageException(operands[0].toString());
//Errors.throwMathLibException(ERR_USER_ERROR, new Object[] {operands[0]});
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -2,31 +2,32 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for returning versionn information*/
public class ver extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String s = "";
- getInterpreter().displayText("Version information for JMathLib");
+ globals.getInterpreter().displayText("Version information for JMathLib");
- s = getInterpreter().prefs.getLocalProperty("jmathlib.version");
- getInterpreter().displayText("version: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ globals.getInterpreter().displayText("version: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
- getInterpreter().displayText("release date: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
+ globals.getInterpreter().displayText("release date: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
- getInterpreter().displayText("release name: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
+ globals.getInterpreter().displayText("release name: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
- getInterpreter().displayText("release description: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
+ globals.getInterpreter().displayText("release description: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
- getInterpreter().displayText(s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
+ globals.getInterpreter().displayText(s);
return null;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -2,31 +2,32 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for returning versionn information*/
public class version extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String s = "";
- getInterpreter().displayText("Version information for JMathLib");
+ globals.getInterpreter().displayText("Version information for JMathLib");
- s = getInterpreter().prefs.getLocalProperty("jmathlib.version");
- getInterpreter().displayText("version: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ globals.getInterpreter().displayText("version: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
- getInterpreter().displayText("release date: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
+ globals.getInterpreter().displayText("release date: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
- getInterpreter().displayText("release name: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
+ globals.getInterpreter().displayText("release name: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
- getInterpreter().displayText("release description: "+s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
+ globals.getInterpreter().displayText("release description: "+s);
- s = getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
- getInterpreter().displayText(s);
+ s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
+ globals.getInterpreter().displayText(s);
return null;
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-01-21 19:32:46 UTC (rev 712)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-01-21 19:34:32 UTC (rev 713)
@@ -5,6 +5,7 @@
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.interpreter.Variable;
/**An external function for writing to the main display
@@ -13,16 +14,16 @@
{
/**write operand to main display
@param operand[n] = items to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String message = "";
for(int index = 0; index < operands.length; index++)
{
message = operands[index].toString();
- getInterpreter().displayText(message);
+ globals.getInterpreter().displayText(message);
}
- Variable var = createVariable("lastwarning");
+ Variable var = globals.createVariable("lastwarning");
var.assign(new CharToken(message));
return new DoubleNumberToken(1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:37:19
|
Revision: 714
http://mathlib.svn.sourceforge.net/mathlib/?rev=714&view=rev
Author: st_mueller
Date: 2009-01-21 19:37:16 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -6,6 +6,7 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for checking the number of arguments*/
public class nargchk extends ExternalFunction
@@ -17,7 +18,7 @@
@return an error string if the number of arguments is
not between the lowest and highest values
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -6,6 +6,7 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for checking the number of arguments*/
public class nargoutchk extends ExternalFunction
@@ -17,7 +18,7 @@
@return an error string if the number of arguments is
not between the lowest and highest values
*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
OperandToken result = null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -4,13 +4,14 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for writing to the main display*/
public class newline extends ExternalFunction
{
/**write operand to main display
@param operand[n] = items to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
double count = 1;
@@ -21,7 +22,7 @@
for(int index = 0; index < count; index++)
{
- getInterpreter().displayText("");
+ globals.getInterpreter().displayText("");
}
return new DoubleNumberToken(1);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -3,6 +3,7 @@
import jmathlib.core.functions.FunctionLoader;
import jmathlib.core.functions.FileFunctionLoader;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -13,14 +14,14 @@
public class path extends ExternalFunction
{
/**return the search path as a string token*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
StringBuffer pathString = new StringBuffer();
- for (int i=0; i<getFunctionManager().getFunctionLoaderCount(); i++)
+ for (int i=0; i<globals.getFunctionManager().getFunctionLoaderCount(); i++)
{
// get one of the function loaders
- FunctionLoader loader = getFunctionManager().getFunctionLoader(i);
+ FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
// check if loader is loading files
if (loader instanceof FileFunctionLoader)
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -3,10 +3,11 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class print_usage extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
throwMathLibException("print_usage");
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for displaying error messages
aborts the current function being processed*/
@@ -11,7 +12,7 @@
{
/**write operand to main display then abort processing
@param operand[n] = error messages to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String val = "";
if(operands[0] instanceof CharToken)
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -2,10 +2,11 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class quit extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if ((getNArgIn(operands) == 1) &&
@@ -20,7 +21,7 @@
}
// run finish script and save local properties
- getInterpreter().save();
+ globals.getInterpreter().save();
// exit JMathLib
System.exit(0);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -2,13 +2,14 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
public class rehash extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
- getFunctionManager().checkAndRehashTimeStamps();
+ globals.getFunctionManager().checkAndRehashTimeStamps();
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -3,6 +3,7 @@
import jmathlib.core.functions.FunctionLoader;
import jmathlib.core.functions.FileFunctionLoader;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -14,7 +15,7 @@
{
/**removes an item from the search path
@param operands[0] = item to remove*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands)!=1)
throwMathLibException("rmpath: number of arguments != 1");
@@ -24,9 +25,9 @@
File path = new File(((CharToken)operands[0]).toString());
- for (int i=0;i<getFunctionManager().getFunctionLoaderCount();i++)
+ for (int i=0;i<globals.getFunctionManager().getFunctionLoaderCount();i++)
{
- FunctionLoader loader = getFunctionManager().getFunctionLoader(i);
+ FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
if (loader instanceof FileFunctionLoader)
{
@@ -34,7 +35,7 @@
if (ffl.getBaseDirectory().compareTo(path) == 0)
{
- getFunctionManager().removeFunctionLoader(loader);
+ globals.getFunctionManager().removeFunctionLoader(loader);
break;
}
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-21 19:34:32 UTC (rev 713)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-21 19:37:16 UTC (rev 714)
@@ -4,6 +4,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**External function for controlling the debug setting for the system*/
public class setdebug extends ExternalFunction
@@ -11,7 +12,7 @@
/**Sets the debug flag
@param operands[0] = 1, show debug info
0, to turn debug info off*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands) !=1)
throwMathLibException("setdebug: number of arguments !=1");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-21 19:38:36
|
Revision: 715
http://mathlib.svn.sourceforge.net/mathlib/?rev=715&view=rev
Author: st_mueller
Date: 2009-01-21 19:38:33 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
changed signature of evaluate(Token[] operands)
to
evaluate(Token[] operands, GlobalValues globals)
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/addpath.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -4,6 +4,7 @@
import jmathlib.core.functions.FileFunctionLoader;
import jmathlib.core.functions.FunctionLoader;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.CharToken;
import jmathlib.core.tokens.OperandToken;
@@ -15,7 +16,7 @@
{
/**adds an item to the search path
@param operands[0] = item to add*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if (getNArgIn(operands)!=1)
throwMathLibException("addpath: number of arguments != 1");
@@ -44,8 +45,8 @@
{
FunctionLoader loader = new FileFunctionLoader(new File(path), true);
if (!prepend)
- getFunctionManager().addFunctionLoader(loader);
- else getFunctionManager().addFunctionLoaderAt(0, loader);
+ globals.getFunctionManager().addFunctionLoader(loader);
+ else globals.getFunctionManager().addFunctionLoaderAt(0, loader);
}
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -2,6 +2,8 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
import java.net.*;
import java.util.*;
@@ -11,15 +13,19 @@
/**An external function for checking for updates over the network*/
public class checkforupdates extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ GlobalValues globals = null;
+
+ public OperandToken evaluate(Token[] operands, GlobalValues _globals)
{
+
+ globals = _globals;
String s = "";
String lineFile = "";
String updateSiteS = "http://www.jmathlib.de/checkForUpdates/";
boolean silentB = false;
- s = getInterpreter().prefs.getLocalProperty("update.site.primary");
+ s = globals.getInterpreter().prefs.getLocalProperty("update.site.primary");
if (s != null)
updateSiteS = s;
@@ -37,22 +43,22 @@
else
{
updateSiteS = s;
- getInterpreter().displayText("Update Site "+updateSiteS);
+ globals.getInterpreter().displayText("Update Site "+updateSiteS);
}
}
}
if (!silentB)
- getInterpreter().displayText("Checking for Updates at "+updateSiteS);
+ globals.getInterpreter().displayText("Checking for Updates at "+updateSiteS);
- String[] lastUpdateS = getInterpreter().prefs.getLocalProperty("update.date.last").split("/");
+ String[] lastUpdateS = globals.getInterpreter().prefs.getLocalProperty("update.date.last").split("/");
int year = Integer.parseInt(lastUpdateS[0]);
int month = Integer.parseInt(lastUpdateS[1])-1;
int day = Integer.parseInt(lastUpdateS[2]);
//getInterpreter().displayText("check:"+year+"/"+month+"/"+day);
- int intervall = Integer.parseInt(getInterpreter().prefs.getLocalProperty("update.intervall"));
+ int intervall = Integer.parseInt(globals.getInterpreter().prefs.getLocalProperty("update.intervall"));
GregorianCalendar calFile = new GregorianCalendar(year,month,day);
GregorianCalendar calCur = new GregorianCalendar();
@@ -136,7 +142,7 @@
System.out.println("checkForUpdates: Properties error");
}
- String[] localVersionS = getInterpreter().prefs.getLocalProperty("jmathlib.version").replace("/",".").split("\\.");
+ String[] localVersionS = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version").replace("/",".").split("\\.");
String[] webVersionS = props.getProperty("jmathlib.version").replace("/",".").split("\\.");
// build version number of local version
@@ -166,42 +172,42 @@
{
// set marker for next startup
- getInterpreter().prefs.setLocalProperty("update.newversionavailable","yes");
+ globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable","yes");
s = props.getProperty("update.newversionavailable.message01");
if (s!=null)
{
- getInterpreter().prefs.setLocalProperty("update.newversionavailable.message01", s);
- getInterpreter().displayText(s);
+ globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable.message01", s);
+ globals.getInterpreter().displayText(s);
}
else
- getInterpreter().displayText("There is a new version of JMathLib available");
+ globals.getInterpreter().displayText("There is a new version of JMathLib available");
s = props.getProperty("update.newversionavailable.message02");
if (s!=null)
{
- getInterpreter().prefs.setLocalProperty("update.newversionavailable.message02", s);
- getInterpreter().displayText(s);
+ globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable.message02", s);
+ globals.getInterpreter().displayText(s);
}
}
else if (webVersion < localVersion)
{
- getInterpreter().displayText("Funny! The version of JMathLib on the web is older than your local version");
+ globals.getInterpreter().displayText("Funny! The version of JMathLib on the web is older than your local version");
}
else
{
if (!silentB)
{
- getInterpreter().displayText("The local version of JMathLib is up to date");
+ globals.getInterpreter().displayText("The local version of JMathLib is up to date");
s=props.getProperty("update.uptodate.message01");
if (s!=null)
- getInterpreter().displayText(s);
+ globals.getInterpreter().displayText(s);
s=props.getProperty("update.uptodate.message02");
if (s!=null)
- getInterpreter().displayText(s);
+ globals.getInterpreter().displayText(s);
}
}
@@ -213,23 +219,23 @@
String checkedDate = Integer.toString(cal.get(Calendar.YEAR)) + "/"
+ Integer.toString(cal.get(Calendar.MONTH)+1) + "/"
+ Integer.toString(cal.get(Calendar.DAY_OF_MONTH));
- getInterpreter().prefs.setLocalProperty("update.date.last", checkedDate);
+ globals.getInterpreter().prefs.setLocalProperty("update.date.last", checkedDate);
// update link to primary update-site
s= props.getProperty("update.site.primary");
if (s!=null)
- getInterpreter().prefs.setLocalProperty("update.site.primary",s);
+ globals.getInterpreter().prefs.setLocalProperty("update.site.primary",s);
// update link to backup update-site
s= props.getProperty("update.site.backup");
if (s!=null)
- getInterpreter().prefs.setLocalProperty("update.site.backup",s);
+ globals.getInterpreter().prefs.setLocalProperty("update.site.backup",s);
// update message of the day
s= props.getProperty("message.of.the.day");
if (s!=null)
- getInterpreter().prefs.setLocalProperty("message.of.the.day",s);
+ globals.getInterpreter().prefs.setLocalProperty("message.of.the.day",s);
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -23,16 +23,16 @@
public class createFunctionsList extends ExternalFunction
{
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
Vector pathVector = new Vector();
// get all search paths from all file loaders
- for (int i=0;i<getFunctionManager().getFunctionLoaderCount();i++)
+ for (int i=0;i<globals.getFunctionManager().getFunctionLoaderCount();i++)
{
- FunctionLoader loader = getFunctionManager().getFunctionLoader(i);
+ FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
if (loader instanceof FileFunctionLoader)
{
@@ -52,13 +52,13 @@
String path = "";
String line = "";
- ErrorLogger.debugLine("working directory: "+getWorkingDirectory().getAbsolutePath());
+ ErrorLogger.debugLine("working directory: "+globals.getWorkingDirectory().getAbsolutePath());
try
{
// create file to store all class-, m-files and images
- File funcFile = new File(getWorkingDirectory().getAbsoluteFile() +
+ File funcFile = new File(globals.getWorkingDirectory().getAbsoluteFile() +
File.separator + "bin" +
File.separator + "jmathlib" +
File.separator + "webFunctionsList.dat");
@@ -101,7 +101,7 @@
!line.contains(".svn") )
{
// remove preceding absolute path
- line = line.substring((getWorkingDirectory().getAbsolutePath()+"/bin/").length());
+ line = line.substring((globals.getWorkingDirectory().getAbsolutePath()+"/bin/").length());
ErrorLogger.debugLine("path = "+ line);
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -12,7 +12,7 @@
/**Executes an expression, displaying the parse tree.
@param operand[0] = the string containing the expression
@return the result of the expression*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
String answer = "";
if(operands[0] instanceof CharToken)
@@ -26,7 +26,7 @@
// open a tree to show the expression-tree for a parsed command
jmathlib.tools.treeanalyser.TreeAnalyser treeAnalyser = new jmathlib.tools.treeanalyser.TreeAnalyser(expressionTree);
- OperandToken answerToken = expressionTree.evaluate(null);
+ OperandToken answerToken = expressionTree.evaluate(null, globals);
//while(answerToken != null)
//{
if(answerToken != null)
@@ -36,7 +36,7 @@
//if(answerToken.display)
// answer += answerToken.toString() + "\n";
- answerToken = expressionTree.evaluate(null);
+ answerToken = expressionTree.evaluate(null, globals);
}
//}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -3,17 +3,18 @@
import jmathlib.core.tokens.Token;
import jmathlib.core.tokens.OperandToken;
import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for writing to the main display*/
public class disp extends ExternalFunction
{
/**write operand to main display
@param operand[n] = items to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
for(int index = 0; index < operands.length; index++)
{
- getInterpreter().displayText(operands[index].toString());
+ globals.getInterpreter().displayText(operands[index].toString());
}
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -5,6 +5,7 @@
import jmathlib.core.tokens.CharToken;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.GlobalValues;
/**An external function for displaying error messages
aborts the current function being processed*/
@@ -12,7 +13,7 @@
{
/**write operand to main display then abort processing
@param operand[n] = error messages to display*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
if(operands[0] instanceof CharToken)
{
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-01-21 19:37:16 UTC (rev 714)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-01-21 19:38:33 UTC (rev 715)
@@ -13,7 +13,7 @@
@param operand[1] = a string containing the variable name
@param operand[2] = a string containing the expression
@return 0 if there were any errors, otherwise it returns 1*/
- public OperandToken evaluate(Token[] operands)
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
{
int result = 0;
//check that the first operand is a matrix
@@ -27,7 +27,7 @@
if((operands[1] instanceof CharToken) && (operands[2] instanceof CharToken))
{
//create a variable with the correct name
- Variable var = createVariable(((CharToken)operands[1]).toString());
+ Variable var = globals.createVariable(((CharToken)operands[1]).toString());
String expression = ((CharToken)operands[2]).toString();
//parse the expression
@@ -44,7 +44,7 @@
OperandToken exp = ((OperandToken)expressionTree.clone());
- exp.evaluate(null);
+ exp.evaluate(null, globals);
}
}
result = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-23 13:37:38
|
Revision: 724
http://mathlib.svn.sourceforge.net/mathlib/?rev=724&view=rev
Author: st_mueller
Date: 2009-01-23 13:37:36 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
getdebug() and setdebug()
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java 2009-01-23 13:37:36 UTC (rev 724)
@@ -0,0 +1,35 @@
+package jmathlib.toolbox.jmathlib.system;
+
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.tokens.*;
+import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
+import jmathlib.core.interpreter.Errors;
+import jmathlib.core.interpreter.ErrorLogger;
+import jmathlib.core.interpreter.GlobalValues;
+
+/**External function for controlling the debug setting for the system*/
+public class getdebug extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+ if (getNArgIn(operands) !=0)
+ throwMathLibException("getdebug: number of arguments !=0");
+
+ return new LogicalToken(ErrorLogger.getDebug());
+ }
+}
+
+/*
+@GROUP
+system
+@SYNTAX
+getdebug()
+@DOC
+returns state of debug logging
+@NOTES
+@EXAMPLES
+getdebug()
+@SEE
+setdebug
+*/
+
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-23 13:34:27 UTC (rev 723)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-01-23 13:37:36 UTC (rev 724)
@@ -48,5 +48,6 @@
setdebug(1) turns debug output on
setdebug(0) turns debug output off
@SEE
+getdebug
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-30 18:21:27
|
Revision: 793
http://mathlib.svn.sourceforge.net/mathlib/?rev=793&view=rev
Author: st_mueller
Date: 2009-01-30 18:21:19 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
Removed Paths:
-------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createfunctionslist.java
Deleted: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java 2009-01-29 20:26:00 UTC (rev 792)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createFunctionsList.java 2009-01-30 18:21:19 UTC (rev 793)
@@ -1,151 +0,0 @@
-package jmathlib.toolbox.jmathlib.system;
-
-/* This file is part or JMathLib
-
-
- Author: Stefan Mueller 2002/03/31
-*/
-
-//ToDo: do not include empty directories in the list
-// relative path names
-
-import jmathlib.core.tokens.*;
-import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
-import jmathlib.core.interpreter.*;
-import jmathlib.core.functions.FunctionLoader;
-import jmathlib.core.functions.FileFunctionLoader;
-import jmathlib.core.functions.ExternalFunction;
-import java.util.Vector;
-import java.io.*;
-
-/**An external function for creating a filelist used by the class
- loader for java applets */
-public class createFunctionsList extends ExternalFunction
-{
-
- public OperandToken evaluate(Token[] operands, GlobalValues globals)
- {
-
- Vector pathVector = new Vector();
-
- // get all search paths from all file loaders
- for (int i=0;i<globals.getFunctionManager().getFunctionLoaderCount();i++)
- {
-
- FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
-
- if (loader instanceof FileFunctionLoader)
- {
- FileFunctionLoader ffl = (FileFunctionLoader)loader;
-
- for (int pathIdx=0;pathIdx<ffl.getPathCount();pathIdx++)
- {
- File path = ffl.getPath(pathIdx).getAbsoluteFile();
-
- pathVector.add(path.toString());
- }
- }
- }
-
-
- int size = pathVector.size();
- String path = "";
- String line = "";
-
- ErrorLogger.debugLine("working directory: "+globals.getWorkingDirectory().getAbsolutePath());
-
- try
- {
-
- // create file to store all class-, m-files and images
- File funcFile = new File(globals.getWorkingDirectory().getAbsoluteFile() +
- File.separator + "bin" +
- File.separator + "jmathlib" +
- File.separator + "webFunctionsList.dat");
- BufferedWriter outWriter = new BufferedWriter( new FileWriter(funcFile));
- ErrorLogger.debugLine("funcFile ="+funcFile.toString());
-
-
- /* The first line of the file is a comment */
- line = "# created with createFunctionsList.java";
- outWriter.write(line, 0, line.length());
- outWriter.newLine();
- line = "# This is a generated file. DO NOT EDIT!";
- outWriter.write(line, 0, line.length());
- outWriter.newLine();
-
- // search through all serach directories
- for(int n = 0; n < size; n++)
- {
- path = (String)pathVector.elementAt(n);
- ErrorLogger.debugLine("path func manager = "+path);
-
- File dir = new File(path);
- String[] files = dir.list();
-
- // do not use empty directories
- if (files != null)
- {
- for(int fileNo = 0; (fileNo < files.length); fileNo++)
- {
- line = path + "/" + files[fileNo];
-
- // use unix-style file separator as default
- line = line.replace('\\', '/');
-
- // do not put CVS directories and files into functions list
- if (!line.endsWith("/CVS") &&
- !line.endsWith("/CVS/Entries") &&
- !line.endsWith("/CVS/Root") &&
- !line.endsWith("/CVS/Repository") &&
- !line.contains(".svn") )
- {
- // remove preceding absolute path
- line = line.substring((globals.getWorkingDirectory().getAbsolutePath()+"/bin/").length());
-
- ErrorLogger.debugLine("path = "+ line);
-
- // also remove unwanted directories
- if (!line.startsWith("jmathlibtests") &&
- !line.startsWith("jmathlib/tools") )
- {
- // write relative path and filename to dat-file
- outWriter.write(line, 0, line.length());
- outWriter.newLine();
- }
- }
-
- }
- }
- else
- ErrorLogger.debugLine("directory is empty");
- }
- outWriter.close();
-
- }
- catch (Exception e)
- {
- ErrorLogger.debugLine("createFunctionsList");
- e.printStackTrace();
- }
- return DoubleNumberToken.one;
-
- } // end evaluate
-}
-
-/*
-@GROUP
-system
-@SYNTAX
-createfunctionslist()
-@DOC
-Creates a file called webFunctionList.dat containing the name
-of all external functions.
-This functions is used when running JMathLib as an applet.
-@NOTES
-@EXAMPLES
-createfunctionslist()
-@SEE
-path, setpath, rmpath
-*/
-
Deleted: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createfunctionslist.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createfunctionslist.java 2009-01-29 20:26:00 UTC (rev 792)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/createfunctionslist.java 2009-01-30 18:21:19 UTC (rev 793)
@@ -1,151 +0,0 @@
-package jmathlib.toolbox.jmathlib.system;
-
-/* This file is part or JMathLib
-
-
- Author: Stefan Mueller 2002/03/31
-*/
-
-//ToDo: do not include empty directories in the list
-// relative path names
-
-import jmathlib.core.tokens.*;
-import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
-import jmathlib.core.interpreter.*;
-import jmathlib.core.functions.FunctionLoader;
-import jmathlib.core.functions.FileFunctionLoader;
-import jmathlib.core.functions.ExternalFunction;
-import java.util.Vector;
-import java.io.*;
-
-/**An external function for creating a filelist used by the class
- loader for java applets */
-public class createfunctionslist extends ExternalFunction
-{
-
- public OperandToken evaluate(Token[] operands, GlobalValues globals)
- {
-
- Vector pathVector = new Vector();
-
- // get all search paths from all file loaders
- for (int i=0;i<globals.getFunctionManager().getFunctionLoaderCount();i++)
- {
-
- FunctionLoader loader = globals.getFunctionManager().getFunctionLoader(i);
-
- if (loader instanceof FileFunctionLoader)
- {
- FileFunctionLoader ffl = (FileFunctionLoader)loader;
-
- for (int pathIdx=0;pathIdx<ffl.getPathCount();pathIdx++)
- {
- File path = ffl.getPath(pathIdx).getAbsoluteFile();
-
- pathVector.add(path.toString());
- }
- }
- }
-
-
- int size = pathVector.size();
- String path = "";
- String line = "";
-
- ErrorLogger.debugLine("working directory: "+globals.getWorkingDirectory().getAbsolutePath());
-
- try
- {
-
- // create file to store all class-, m-files and images
- File funcFile = new File(globals.getWorkingDirectory().getAbsoluteFile() +
- File.separator + "bin" +
- File.separator + "jmathlib" +
- File.separator + "webFunctionsList.dat");
- BufferedWriter outWriter = new BufferedWriter( new FileWriter(funcFile));
- ErrorLogger.debugLine("funcFile ="+funcFile.toString());
-
-
- /* The first line of the file is a comment */
- line = "# created with createFunctionsList.java";
- outWriter.write(line, 0, line.length());
- outWriter.newLine();
- line = "# This is a generated file. DO NOT EDIT!";
- outWriter.write(line, 0, line.length());
- outWriter.newLine();
-
- // search through all serach directories
- for(int n = 0; n < size; n++)
- {
- path = (String)pathVector.elementAt(n);
- ErrorLogger.debugLine("path func manager = "+path);
-
- File dir = new File(path);
- String[] files = dir.list();
-
- // do not use empty directories
- if (files != null)
- {
- for(int fileNo = 0; (fileNo < files.length); fileNo++)
- {
- line = path + "/" + files[fileNo];
-
- // use unix-style file separator as default
- line = line.replace('\\', '/');
-
- // do not put CVS directories and files into functions list
- if (!line.endsWith("/CVS") &&
- !line.endsWith("/CVS/Entries") &&
- !line.endsWith("/CVS/Root") &&
- !line.endsWith("/CVS/Repository") &&
- !line.contains(".svn") )
- {
- // remove preceding absolute path
- line = line.substring((globals.getWorkingDirectory().getAbsolutePath()+"/bin/").length());
-
- ErrorLogger.debugLine("path = "+ line);
-
- // also remove unwanted directories
- if (!line.startsWith("jmathlibtests") &&
- !line.startsWith("jmathlib/tools") )
- {
- // write relative path and filename to dat-file
- outWriter.write(line, 0, line.length());
- outWriter.newLine();
- }
- }
-
- }
- }
- else
- ErrorLogger.debugLine("directory is empty");
- }
- outWriter.close();
-
- }
- catch (Exception e)
- {
- ErrorLogger.debugLine("createFunctionsList");
- e.printStackTrace();
- }
- return DoubleNumberToken.one;
-
- } // end evaluate
-}
-
-/*
-@GROUP
-system
-@SYNTAX
-createfunctionslist()
-@DOC
-Creates a file called webFunctionList.dat containing the name
-of all external functions.
-This functions is used when running JMathLib as an applet.
-@NOTES
-@EXAMPLES
-createfunctionslist()
-@SEE
-path, setpath, rmpath
-*/
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-01-30 19:02:35
|
Revision: 796
http://mathlib.svn.sourceforge.net/mathlib/?rev=796&view=rev
Author: st_mueller
Date: 2009-01-30 19:02:16 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
changed handling of preferences/properties
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java
Removed Paths:
-------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -25,7 +25,7 @@
String updateSiteS = "http://www.jmathlib.de/checkForUpdates/";
boolean silentB = false;
- s = globals.getInterpreter().prefs.getLocalProperty("update.site.primary");
+ s = globals.getProperty("update.site.primary");
if (s != null)
updateSiteS = s;
@@ -52,13 +52,13 @@
globals.getInterpreter().displayText("Checking for Updates at "+updateSiteS);
- String[] lastUpdateS = globals.getInterpreter().prefs.getLocalProperty("update.date.last").split("/");
+ String[] lastUpdateS = globals.getProperty("update.date.last").split("/");
int year = Integer.parseInt(lastUpdateS[0]);
int month = Integer.parseInt(lastUpdateS[1])-1;
int day = Integer.parseInt(lastUpdateS[2]);
//getInterpreter().displayText("check:"+year+"/"+month+"/"+day);
- int intervall = Integer.parseInt(globals.getInterpreter().prefs.getLocalProperty("update.intervall"));
+ int intervall = Integer.parseInt(globals.getProperty("update.intervall"));
GregorianCalendar calFile = new GregorianCalendar(year,month,day);
GregorianCalendar calCur = new GregorianCalendar();
@@ -142,7 +142,7 @@
System.out.println("checkForUpdates: Properties error");
}
- String[] localVersionS = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version").replace("/",".").split("\\.");
+ String[] localVersionS = globals.getProperty("jmathlib.version").replace("/",".").split("\\.");
String[] webVersionS = props.getProperty("jmathlib.version").replace("/",".").split("\\.");
// build version number of local version
@@ -172,12 +172,12 @@
{
// set marker for next startup
- globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable","yes");
+ globals.setProperty("update.newversionavailable","yes");
s = props.getProperty("update.newversionavailable.message01");
if (s!=null)
{
- globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable.message01", s);
+ globals.setProperty("update.newversionavailable.message01", s);
globals.getInterpreter().displayText(s);
}
else
@@ -187,7 +187,7 @@
s = props.getProperty("update.newversionavailable.message02");
if (s!=null)
{
- globals.getInterpreter().prefs.setLocalProperty("update.newversionavailable.message02", s);
+ globals.setProperty("update.newversionavailable.message02", s);
globals.getInterpreter().displayText(s);
}
}
@@ -219,23 +219,23 @@
String checkedDate = Integer.toString(cal.get(Calendar.YEAR)) + "/"
+ Integer.toString(cal.get(Calendar.MONTH)+1) + "/"
+ Integer.toString(cal.get(Calendar.DAY_OF_MONTH));
- globals.getInterpreter().prefs.setLocalProperty("update.date.last", checkedDate);
+ globals.setProperty("update.date.last", checkedDate);
// update link to primary update-site
s= props.getProperty("update.site.primary");
if (s!=null)
- globals.getInterpreter().prefs.setLocalProperty("update.site.primary",s);
+ globals.setProperty("update.site.primary",s);
// update link to backup update-site
s= props.getProperty("update.site.backup");
if (s!=null)
- globals.getInterpreter().prefs.setLocalProperty("update.site.backup",s);
+ globals.setProperty("update.site.backup",s);
// update message of the day
s= props.getProperty("message.of.the.day");
if (s!=null)
- globals.getInterpreter().prefs.setLocalProperty("message.of.the.day",s);
+ globals.setProperty("message.of.the.day",s);
}
Deleted: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getglobalproperty.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -1,52 +0,0 @@
-package jmathlib.toolbox.jmathlib.system;
-
-import jmathlib.core.functions.ExternalFunction;
-import jmathlib.core.interpreter.GlobalValues;
-import jmathlib.core.tokens.Token;
-import jmathlib.core.tokens.CharToken;
-import jmathlib.core.tokens.OperandToken;
-
-/**External function to get a enviroment variable*/
-public class getglobalproperty extends ExternalFunction
-{
- /**Returns an enviroment variable
- @param operand[0] = the name of the variable
- @param operand[1] = a default value (optional)
- @return the enviroment value*/
- public OperandToken evaluate(Token[] operands, GlobalValues globals)
- {
- OperandToken result = null;
-
- if (getNArgIn(operands)!=1)
- throwMathLibException("getglobalproperty: number of arguments != 1");
-
-
- if (!(operands[0] instanceof CharToken))
- throwMathLibException("getglobalproperty: number of arguments != 1");
-
- String name = operands[0].toString();
- String defaultVal = "";
-
-
- String property = globals.getInterpreter().prefs.getGlobalProperty(name);
-
- result = new CharToken(property);
-
- return result;
- }
-}
-
-/*
-@GROUP
-system
-@SYNTAX
-GETENV(variablename)
-@DOC
-Returns the value of the enviromental variable variablename.
-@NOTES
-@EXAMPLES
-getlocal("HOME")= "/home/user"
-@SEE
-getenv, getglobalproperty, setlocalproperty, setglobalproperty
-*/
-
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -0,0 +1,52 @@
+package jmathlib.toolbox.jmathlib.system;
+
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.CharToken;
+import jmathlib.core.tokens.OperandToken;
+
+/**External function to get a enviroment variable*/
+public class getjmathlibproperty extends ExternalFunction
+{
+ /**Returns an enviroment variable
+ @param operand[0] = the name of the variable
+ @param operand[1] = a default value (optional)
+ @return the enviroment value*/
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+ OperandToken result = null;
+
+ if (getNArgIn(operands)!=1)
+ throwMathLibException("getjmathlibproperty: number of arguments != 1");
+
+
+ if (!(operands[0] instanceof CharToken))
+ throwMathLibException("getjmathlibproperty: number of arguments != 1");
+
+ String name = operands[0].toString();
+ String defaultVal = "";
+
+
+ String property = globals.getProperty(name);
+
+ result = new CharToken(property);
+
+ return result;
+ }
+}
+
+/*
+@GROUP
+system
+@SYNTAX
+getjmathlibproperty(variablename)
+@DOC
+Returns the value of the enviromental variable variablename.
+@NOTES
+@EXAMPLES
+getlocal("HOME")= "/home/user"
+@SEE
+getenv, setjmathlibproperty
+*/
+
Deleted: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getlocalproperty.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -1,52 +0,0 @@
-package jmathlib.toolbox.jmathlib.system;
-
-import jmathlib.core.functions.ExternalFunction;
-import jmathlib.core.interpreter.GlobalValues;
-import jmathlib.core.tokens.Token;
-import jmathlib.core.tokens.CharToken;
-import jmathlib.core.tokens.OperandToken;
-
-/**External function to get a enviroment variable*/
-public class getlocalproperty extends ExternalFunction
-{
- /**Returns an enviroment variable
- @param operand[0] = the name of the variable
- @param operand[1] = a default value (optional)
- @return the enviroment value*/
- public OperandToken evaluate(Token[] operands, GlobalValues globals)
- {
- OperandToken result = null;
-
- if (getNArgIn(operands)!=1)
- throwMathLibException("getlocalproperty: number of arguments != 1");
-
-
- if (!(operands[0] instanceof CharToken))
- throwMathLibException("getlocalproperty: number of arguments != 1");
-
- String name = operands[0].toString();
- String defaultVal = "";
-
-
- String property = globals.getInterpreter().prefs.getLocalProperty(name);
-
- result = new CharToken(property);
-
- return result;
- }
-}
-
-/*
-@GROUP
-system
-@SYNTAX
-GETENV(variablename)
-@DOC
-Returns the value of the enviromental variable variablename.
-@NOTES
-@EXAMPLES
-getlocal("HOME")= "/home/user"
-@SEE
-getenv, getglobalproperty, setlocalproperty, setglobalproperty
-*/
-
Deleted: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -1,51 +0,0 @@
-package jmathlib.toolbox.jmathlib.system;
-
-import jmathlib.core.functions.ExternalFunction;
-import jmathlib.core.interpreter.GlobalValues;
-import jmathlib.core.tokens.Token;
-import jmathlib.core.tokens.CharToken;
-import jmathlib.core.tokens.OperandToken;
-
-/**External function to get a enviroment variable*/
-public class setglobalproperty extends ExternalFunction
-{
- /**Returns an enviroment variable
- @param operand[0] = the name of the variable
- @param operand[1] = a default value (optional)
- @return the enviroment value*/
- public OperandToken evaluate(Token[] operands, GlobalValues globals)
- {
- OperandToken result = null;
-
- if (getNArgIn(operands)!=2)
- throwMathLibException("setglobalproperty: number of arguments != 2");
-
-
- if ( (!(operands[0] instanceof CharToken)) &&
- (!(operands[1] instanceof CharToken)) )
- throwMathLibException("setglobalproperty: arguments must be strings");
-
- String name = operands[0].toString();
- String prop = operands[1].toString();
-
- globals.getInterpreter().prefs.setGlobalProperty(name, prop);
-
-
- return result;
- }
-}
-
-/*
-@GROUP
-system
-@SYNTAX
-setglobalproperty(property name, value)
-@DOC
-Returns the value of the enviromental variable variablename.
-@NOTES
-@EXAMPLES
-GETENV("HOME")= "/home/user"
-@SEE
-setlocalproperty, getlocalproperty, getglobalproperty
-*/
-
Copied: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java (from rev 713, JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setglobalproperty.java)
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -0,0 +1,51 @@
+package jmathlib.toolbox.jmathlib.system;
+
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.CharToken;
+import jmathlib.core.tokens.OperandToken;
+
+/**External function to get a enviroment variable*/
+public class setjmathlibproperty extends ExternalFunction
+{
+ /**Returns an enviroment variable
+ @param operand[0] = the name of the variable
+ @param operand[1] = a default value (optional)
+ @return the enviroment value*/
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+ OperandToken result = null;
+
+ if (getNArgIn(operands)!=2)
+ throwMathLibException("setjmathlibproperty: number of arguments != 2");
+
+
+ if ( (!(operands[0] instanceof CharToken)) &&
+ (!(operands[1] instanceof CharToken)) )
+ throwMathLibException("setjmathlibproperty: arguments must be strings");
+
+ String name = operands[0].toString();
+ String prop = operands[1].toString();
+
+ globals.setProperty(name, prop);
+
+
+ return result;
+ }
+}
+
+/*
+@GROUP
+system
+@SYNTAX
+setjmathlibproperty(property name, value)
+@DOC
+Returns the value of the enviromental variable variablename.
+@NOTES
+@EXAMPLES
+GETENV("HOME")= "/home/user"
+@SEE
+getjmathlibproperty, getenv
+*/
+
Deleted: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setlocalproperty.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -1,51 +0,0 @@
-package jmathlib.toolbox.jmathlib.system;
-
-import jmathlib.core.functions.ExternalFunction;
-import jmathlib.core.interpreter.GlobalValues;
-import jmathlib.core.tokens.Token;
-import jmathlib.core.tokens.CharToken;
-import jmathlib.core.tokens.OperandToken;
-
-/**External function to get a enviroment variable*/
-public class setlocalproperty extends ExternalFunction
-{
- /**Returns an enviroment variable
- @param operand[0] = the name of the variable
- @param operand[1] = a default value (optional)
- @return the enviroment value*/
- public OperandToken evaluate(Token[] operands, GlobalValues globals)
- {
- OperandToken result = null;
-
- if (getNArgIn(operands)!=2)
- throwMathLibException("setlocalproperty: number of arguments != 2");
-
-
- if ( (!(operands[0] instanceof CharToken)) &&
- (!(operands[1] instanceof CharToken)) )
- throwMathLibException("setlocalproperty: arguments must be strings");
-
- String name = operands[0].toString();
- String prop = operands[1].toString();
-
- globals.getInterpreter().prefs.setLocalProperty(name, prop);
-
-
- return result;
- }
-}
-
-/*
-@GROUP
-system
-@SYNTAX
-setlocalproperty(property name, value)
-@DOC
-Returns the value of the enviromental variable variablename.
-@NOTES
-@EXAMPLES
-GETENV("HOME")= "/home/user"
-@SEE
-setglobalproperty
-*/
-
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -20,11 +20,11 @@
globals.getInterpreter().displayText("UPDATING JMathLib\n");
// get update site of jmathlib
- String updateSiteS = globals.getInterpreter().prefs.getLocalProperty("update.site.primary");
+ String updateSiteS = globals.getProperty("update.site.primary");
globals.getInterpreter().displayText("update site: "+updateSiteS);
// get local version of jmathlib
- String localVersionS = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ String localVersionS = globals.getProperty("jmathlib.version");
localVersionS = localVersionS.replaceAll("/", ".");
globals.getInterpreter().displayText("current version: "+localVersionS);
@@ -175,7 +175,7 @@
String propS = s.substring(5).trim();
globals.getInterpreter().displayText("new property: >"+propS+"<");
String[] p = propS.split("=");
- globals.getInterpreter().prefs.setLocalProperty(p[0],p[1]);
+ globals.setProperty(p[0],p[1]);
}
else
{
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -14,19 +14,19 @@
globals.getInterpreter().displayText("Version information for JMathLib");
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ s = globals.getProperty("jmathlib.version");
globals.getInterpreter().displayText("version: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
+ s = globals.getProperty("jmathlib.release.date");
globals.getInterpreter().displayText("release date: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
+ s = globals.getProperty("jmathlib.release.name");
globals.getInterpreter().displayText("release name: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
+ s = globals.getProperty("jmathlib.release.description");
globals.getInterpreter().displayText("release description: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
+ s = globals.getProperty("jmathlib.copyright");
globals.getInterpreter().displayText(s);
return null;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-01-30 18:59:26 UTC (rev 795)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-01-30 19:02:16 UTC (rev 796)
@@ -14,19 +14,19 @@
globals.getInterpreter().displayText("Version information for JMathLib");
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.version");
+ s = globals.getProperty("jmathlib.version");
globals.getInterpreter().displayText("version: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.date");
+ s = globals.getProperty("jmathlib.release.date");
globals.getInterpreter().displayText("release date: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.name");
+ s = globals.getProperty("jmathlib.release.name");
globals.getInterpreter().displayText("release name: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.release.description");
+ s = globals.getProperty("jmathlib.release.description");
globals.getInterpreter().displayText("release description: "+s);
- s = globals.getInterpreter().prefs.getLocalProperty("jmathlib.copyright");
+ s = globals.getProperty("jmathlib.copyright");
globals.getInterpreter().displayText(s);
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-15 10:20:35
|
Revision: 849
http://mathlib.svn.sourceforge.net/mathlib/?rev=849&view=rev
Author: st_mueller
Date: 2009-02-15 10:20:32 +0000 (Sun, 15 Feb 2009)
Log Message:
-----------
new update manager
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-02-15 05:12:08 UTC (rev 848)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-02-15 10:20:32 UTC (rev 849)
@@ -3,6 +3,7 @@
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
import jmathlib.core.interpreter.GlobalValues;
+import jmathlib.core.interpreter.ErrorLogger;
import java.net.*;
import java.util.*;
@@ -18,11 +19,12 @@
public OperandToken evaluate(Token[] operands, GlobalValues _globals)
{
+ // copy pointer to globals
globals = _globals;
String s = "";
String lineFile = "";
- String updateSiteS = "http://www.jmathlib.de/checkForUpdates/";
+ String updateSiteS = "http://www.jmathlib.de/updates/";
boolean silentB = false;
s = globals.getProperty("update.site.primary");
@@ -42,8 +44,8 @@
}
else
{
- updateSiteS = s;
- globals.getInterpreter().displayText("Update Site "+updateSiteS);
+ updateSiteS = st;
+ globals.getInterpreter().displayText("New Update Site "+updateSiteS);
}
}
}
@@ -75,10 +77,6 @@
//getInterpreter().displayText("calCur "+calCur);
- //if (calCur.after(calFile))
- // getInterpreter().displayText("AFTER: TRUE" );
- //else
- // getInterpreter().displayText("AFTER: FALSE" );
if (silentB)
{
@@ -115,16 +113,24 @@
System.out.println("checkForUpdates: constructor");
}
+ /**
+ * separate thread which checks the update site
+ * It is a thread in order to cause no time delay for the user.
+ */
public synchronized void run()
{
String s;
+
// open URL
URL url = null;
try
{
- url = new URL(updateSiteS);
+ // get local version of jmathlib
+ String localVersionS = globals.getProperty("jmathlib.version").replaceAll("/", ".");
+
+ url = new URL(updateSiteS+"?jmathlib_version="+localVersionS+"&command=check");
}
catch (Exception e)
{
@@ -142,77 +148,50 @@
System.out.println("checkForUpdates: Properties error");
}
- String[] localVersionS = globals.getProperty("jmathlib.version").replace("/",".").split("\\.");
- String[] webVersionS = props.getProperty("jmathlib.version").replace("/",".").split("\\.");
+ String localVersionS = globals.getProperty("jmathlib.version");
+ String updateVersionS = props.getProperty("update.toversion");
+ String updateActionS = props.getProperty("update.action");
- // build version number of local version
- // e.g. 2.6.7 -> 20607
- int localVersion =0;
-
- if (localVersionS.length==3)
- {
- localVersion += Integer.parseInt(localVersionS[0]) * 100 * 100;
- localVersion += Integer.parseInt(localVersionS[1]) * 100;
- localVersion += Integer.parseInt(localVersionS[2]);
- }
-
- // build version number of web version
- // e.g. 2.6.7 -> 20607
- int webVersion=0;
-
- if (webVersionS.length==3)
+ // evaluate the response from the web server
+ if (updateActionS.equals("INCREMENTAL_DOWNLOAD"))
{
- webVersion += Integer.parseInt(webVersionS[0]) * 100 * 100;
- webVersion += Integer.parseInt(webVersionS[1]) * 100;
- webVersion += Integer.parseInt(webVersionS[2]);
- }
-
- // check version number of web version against local version
- if (webVersion > localVersion)
- {
-
- // set marker for next startup
- globals.setProperty("update.newversionavailable","yes");
- s = props.getProperty("update.newversionavailable.message01");
- if (s!=null)
+ if (!silentB)
{
- globals.setProperty("update.newversionavailable.message01", s);
- globals.getInterpreter().displayText(s);
+ globals.getInterpreter().displayText("A full download ist required");
+ globals.getInterpreter().displayText("A new version "+ updateVersionS +" is available");
+ globals.getInterpreter().displayText("\n Just type update at the prompt.");
}
- else
- globals.getInterpreter().displayText("There is a new version of JMathLib available");
-
- s = props.getProperty("update.newversionavailable.message02");
- if (s!=null)
+ }
+ else if (updateActionS.equals("FULL_DOWNLOAD_REQUIRED"))
+ {
+ if (!silentB)
{
- globals.setProperty("update.newversionavailable.message02", s);
- globals.getInterpreter().displayText(s);
+ globals.getInterpreter().displayText("A full download ist required");
+ globals.getInterpreter().displayText("A new version "+ updateVersionS +" is available");
+ globals.getInterpreter().displayText("Go to www.jmathlib.de and download the latest version");
}
}
- else if (webVersion < localVersion)
+ else if (updateActionS.equals("NO_ACTION"))
{
- globals.getInterpreter().displayText("Funny! The version of JMathLib on the web is older than your local version");
+ if (!silentB)
+ globals.getInterpreter().displayText("The local version of JMathLib is up to date");
+
}
- else
+ else if (updateActionS.equals("VERSION_UNKNOWN"))
{
if (!silentB)
- {
- globals.getInterpreter().displayText("The local version of JMathLib is up to date");
+ globals.getInterpreter().displayText("The local version of JMathLib ist not recognized by the server");
- s=props.getProperty("update.uptodate.message01");
- if (s!=null)
- globals.getInterpreter().displayText(s);
-
- s=props.getProperty("update.uptodate.message02");
- if (s!=null)
- globals.getInterpreter().displayText(s);
- }
}
+ else
+ {
+ // wrong or unknown or empty "action"-command
+ globals.getInterpreter().displayText("check for updates encountered an error.");
+ }
-
- debugLine("checkForUpdates: web:" +webVersion +" local:"+ localVersion);
+ debugLine("checkForUpdates: web:" + updateVersionS +" local:"+ localVersionS);
// set current date for property "update.date.last"
Calendar cal = Calendar.getInstance();
@@ -222,21 +201,18 @@
globals.setProperty("update.date.last", checkedDate);
- // update link to primary update-site
- s= props.getProperty("update.site.primary");
- if (s!=null)
- globals.setProperty("update.site.primary",s);
+
+ // copy properties from webserver to global properties
+ Enumeration propnames = props.propertyNames();
+ while (propnames.hasMoreElements())
+ {
+ String propName = (String)propnames.nextElement();
+ String propValue = (String)props.getProperty(propName);
+ ErrorLogger.debugLine("Property: "+propName+" = "+propValue);
+ globals.setProperty(propName, propValue);
+ }
- // update link to backup update-site
- s= props.getProperty("update.site.backup");
- if (s!=null)
- globals.setProperty("update.site.backup",s);
- // update message of the day
- s= props.getProperty("message.of.the.day");
- if (s!=null)
- globals.setProperty("message.of.the.day",s);
-
}
}
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-02-15 05:12:08 UTC (rev 848)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-02-15 10:20:32 UTC (rev 849)
@@ -25,7 +25,6 @@
// get local version of jmathlib
String localVersionS = globals.getProperty("jmathlib.version");
- localVersionS = localVersionS.replaceAll("/", ".");
globals.getInterpreter().displayText("current version: "+localVersionS);
@@ -33,12 +32,11 @@
globals.getInterpreter().displayText("Checking to which version an update is possible");
- // url of the update site including the request for the version
- // to update to
+ // url of the update site including the request for the version to update to
URL url = null;
try
{
- url = new URL(updateSiteS+"updates/?jmathlib_version="+localVersionS);
+ url = new URL(updateSiteS+"?jmathlib_version="+localVersionS+"&command=update");
}
catch (Exception e)
{
@@ -58,148 +56,217 @@
successB = false;
}
-
+
// Check return properties for "update-to-version"
// Update site could send a lot of properties
String updateVersionS = props.getProperty("update.toversion");
- if (updateVersionS.equals("no_update_available"))
+ String updateActionS = props.getProperty("update.action");
+
+ // reaction on the response from the update server
+ if (updateActionS.equals("VERSION_UNKNOWN"))
{
+ globals.getInterpreter().displayText("Your version of JMathLib is not known by the update server.");
+ return null;
+ }
+ else if (updateVersionS.equals("NO_UPDATE_AVAILABLE") ||
+ updateActionS.equals("NO_ACTION") )
+ {
globals.getInterpreter().displayText("No update available right now.");
return null;
}
-
- if (updateVersionS.equals("full_download_required"))
+ else if (updateActionS.equals("FULL_DOWNLOAD_REQUIRED"))
{
globals.getInterpreter().displayText("\n");
globals.getInterpreter().displayText("Full download required in order to update!");
globals.getInterpreter().displayText("Please visit www.jmathlib.de for details.");
globals.getInterpreter().displayText("\n");
+ String urlS = props.getProperty("update.full_file_url");
+ String fileS = props.getProperty("update.file_name");
+ globals.getInterpreter().displayText("url: "+urlS);
+ globals.getInterpreter().displayText("file: "+fileS);
+
+ if ((urlS==null) || (fileS==null))
+ return null;
+
+
+ // put a message box here
+
+ // open URL to file on update server
+ try
+ {
+ globals.getInterpreter().displayText("Downloading ...");
+ URL fileURL = new URL(urlS);
+ InputStream in = fileURL.openStream();
+
+ // open file on local disc
+ File file = new File(globals.getWorkingDirectory(),fileS);
+ OutputStream out = new FileOutputStream(file);
+ byte[] cbuf = new byte[4096];
+ int len = -1;
+
+ while ((len = in.read(cbuf)) != -1)
+ {
+ out.write(cbuf,0,len);
+ }
+
+ in.close();
+ out.close();
+ globals.getInterpreter().displayText("Downloading done.");
+ }
+ catch (Exception e)
+ {
+ successB = false;
+ globals.getInterpreter().displayText("update: problem downloading "+fileS);
+ }
+
+
+ // run the downloaded file
+ try
+ {
+ globals.getInterpreter().displayText("Running installer ...");
+ Runtime.getRuntime().exec(fileS);
+ globals.getInterpreter().displayText("Please exit JMathLib");
+ }
+ catch(IOException exception)
+ {
+ throwMathLibException("SystemCommand");
+ }
+
+
return null;
}
+ else if (updateActionS.equals("INCREMENTAL_DOWNLOAD"))
+ {
- globals.getInterpreter().displayText("updating to version >"+updateVersionS+"< \n");
+ globals.getInterpreter().displayText("updating to version >"+updateVersionS+"< \n");
- // download new files from server
- updateSiteS += "updates/jmathlib_" + updateVersionS + "/";
- try
- {
- url = new URL(updateSiteS);
- }
- catch (Exception e)
- {
- throwMathLibException("update: malformed url");
- successB = false;
- }
-
- BufferedReader inR = null;
- try
- {
- inR = new BufferedReader(new InputStreamReader(url.openStream()));
- String s = null;
-
- // read next line from server
- while ((s = inR.readLine()) != null )
+ // download new files from server
+ updateSiteS += "jmathlib_" + updateVersionS + "/";
+ try
{
- //getInterpreter().displayText("update "+s);
+ url = new URL(updateSiteS);
+ }
+ catch (Exception e)
+ {
+ throwMathLibException("update: malformed url");
+ successB = false;
+ }
+
+ try
+ {
+ BufferedReader inR = new BufferedReader(new InputStreamReader(url.openStream()));
+ String s = null;
- if (s.startsWith("file"))
+ // read next line from server
+ while ((s = inR.readLine()) != null )
{
- // read a file from the server and place it on the local disc
- String fileS = s.substring(5).trim();
- globals.getInterpreter().displayText("new file: >"+fileS+"<");
+ //getInterpreter().displayText("update "+s);
- // open URL to file on update server
- try
+ if (s.startsWith("file"))
{
- URL fileURL = new URL(updateSiteS+fileS);
- InputStream in = fileURL.openStream();
-
- // open file on local disc
- File file = new File(globals.getWorkingDirectory(),fileS);
- OutputStream out = new FileOutputStream(file);
-
- byte[] cbuf = new byte[4096];
- int len;
- while ((len = in.read(cbuf)) != -1)
+ // read a file from the server and place it on the local disc
+ String fileS = s.substring(5).trim();
+ globals.getInterpreter().displayText("new file: >"+fileS+"<");
+
+ // open URL to file on update server
+ try
{
- out.write(cbuf,0,len);
+ URL fileURL = new URL(updateSiteS+fileS);
+ InputStream in = fileURL.openStream();
+
+ // open file on local disc
+ File file = new File(globals.getWorkingDirectory(),fileS);
+ OutputStream out = new FileOutputStream(file);
+ byte[] cbuf = new byte[4096];
+ int len = -1;
+
+ while ((len = in.read(cbuf)) != -1)
+ {
+ out.write(cbuf,0,len);
+ }
+
+ in.close();
+ out.close();
}
+ catch (Exception e)
+ {
+ successB = false;
+ globals.getInterpreter().displayText("update: problem downloading "+fileS);
+ }
- in.close();
- out.close();
}
- catch (Exception e)
+ else if (s.startsWith("dir"))
{
- successB = false;
- globals.getInterpreter().displayText("update: problem downloading "+fileS);
+ // create a directory on the local disc
+ String dirS = s.substring(4).trim();
+ globals.getInterpreter().displayText("new directory: >"+dirS+"<");
+ try
+ {
+ File file = new File(globals.getWorkingDirectory(),dirS);
+ file.mkdir();
+ }
+ catch (Exception e)
+ {
+ successB = false;
+ globals.getInterpreter().displayText("update: problem creating directory "+dirS);
+ }
+
}
-
- }
- else if (s.startsWith("dir"))
- {
- // create a directory on the local disc
- String dirS = s.substring(4).trim();
- globals.getInterpreter().displayText("new directory: >"+dirS+"<");
- try
+ else if (s.startsWith("del"))
{
- File file = new File(globals.getWorkingDirectory(),dirS);
- file.mkdir();
+ // delete a file/directory on the local disc
+ String delS = s.substring(4).trim();
+ globals.getInterpreter().displayText("delete file/dir: >"+delS+"<");
+ try
+ {
+ File file = new File(globals.getWorkingDirectory(),delS);
+ file.delete();
+ }
+ catch (Exception e)
+ {
+ successB = false;
+ globals.getInterpreter().displayText("update: problem deleting "+delS);
+ }
}
- catch (Exception e)
+ else if (s.startsWith("prop"))
{
- successB = false;
- globals.getInterpreter().displayText("update: problem creating directory "+dirS);
+ // delete a file/directory on the local disc
+ String propS = s.substring(5).trim();
+ globals.getInterpreter().displayText("new property: >"+propS+"<");
+ String[] p = propS.split("=");
+ globals.setProperty(p[0],p[1]);
}
-
- }
- else if (s.startsWith("del"))
- {
- // delete a file/directory on the local disc
- String delS = s.substring(4).trim();
- globals.getInterpreter().displayText("delete file/dir: >"+delS+"<");
- try
+ else
{
- File file = new File(globals.getWorkingDirectory(),delS);
- file.delete();
+ // empty line or unknown command or comment
}
- catch (Exception e)
- {
- successB = false;
- globals.getInterpreter().displayText("update: problem deleting "+delS);
- }
+
+ // in case something went wrong terminate
+ if (!successB)
+ break;
+
}
- else if (s.startsWith("prop"))
- {
- // delete a file/directory on the local disc
- String propS = s.substring(5).trim();
- globals.getInterpreter().displayText("new property: >"+propS+"<");
- String[] p = propS.split("=");
- globals.setProperty(p[0],p[1]);
- }
- else
- {
- // empty line or unknown command or comment
- }
-
- // in case something went wrong terminate
- if (!successB)
- break;
-
+
}
+ catch (Exception e)
+ {
+ throwMathLibException("update: open or reading stream");
+ }
+
+
+ }
+ else
+ {
+ throwMathLibException("update: unknown action");
+ }
- }
- catch (Exception e)
- {
- throwMathLibException("update: open or reading stream");
- }
-
-
// notifiy user
if (!successB)
globals.getInterpreter().displayText("\n Update was not successful. Repeat again later on or inform the admin.");
- return null;
+ return null;
+
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-16 06:35:33
|
Revision: 851
http://mathlib.svn.sourceforge.net/mathlib/?rev=851&view=rev
Author: st_mueller
Date: 2009-02-16 06:35:26 +0000 (Mon, 16 Feb 2009)
Log Message:
-----------
added standard comment
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-02-15 10:21:58 UTC (rev 850)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-02-16 06:35:26 UTC (rev 851)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: st...@he...
+ * (c) 2008-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-02-15 10:21:58 UTC (rev 850)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-02-16 06:35:26 UTC (rev 851)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: st...@he...
+ * (c) 2008-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import java.io.*;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-18 19:25:55
|
Revision: 852
http://mathlib.svn.sourceforge.net/mathlib/?rev=852&view=rev
Author: st_mueller
Date: 2009-02-18 19:25:47 +0000 (Wed, 18 Feb 2009)
Log Message:
-----------
added standard comment
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargchk.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/nargoutchk.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/newline.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
@@ -33,18 +41,15 @@
@GROUP
system
@SYNTAX
-NEWLINE(lines)
+newline(lines)
@DOC
Displays number of blank lines equal to the first parameter.
@NOTES
@EXAMPLES
NEWLINE(1)
-
NEWLINE(2)
-
-
@SEE
*/
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/path.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.FunctionLoader;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/print_usage.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/printstacktrace.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
@@ -29,7 +37,7 @@
@GROUP
system
@SYNTAX
-PrintStackTrace(message)
+printstacktrace(message)
@DOC
Displays message and the current execution stack trace.
@NOTES
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/quit.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author: st...@he...
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rehash.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/rmpath.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.FunctionLoader;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setdebug.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/setjmathlibproperty.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/usage.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/ver.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/version.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-02-16 06:35:26 UTC (rev 851)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/warning.java 2009-02-18 19:25:47 UTC (rev 852)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-18 19:28:40
|
Revision: 853
http://mathlib.svn.sourceforge.net/mathlib/?rev=853&view=rev
Author: st_mueller
Date: 2009-02-18 19:28:34 +0000 (Wed, 18 Feb 2009)
Log Message:
-----------
added standard comment
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/debug.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.interpreter.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/disp.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/error.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/foreach.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.interpreter.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/format.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getdebug.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
@@ -2,4 +10,2 @@
import jmathlib.core.tokens.*;
-import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
-import jmathlib.core.interpreter.Errors;
import jmathlib.core.interpreter.ErrorLogger;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getenv.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.interpreter.*;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/getjmathlibproperty.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.functions.ExternalFunction;
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java 2009-02-18 19:25:47 UTC (rev 852)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/java.java 2009-02-18 19:28:34 UTC (rev 853)
@@ -1,3 +1,11 @@
+/*
+ * This file is part or JMathLib
+ *
+ * Check it out at http://www.jmathlib.de
+ *
+ * Author:
+ * (c) 2005-2009
+ */
package jmathlib.toolbox.jmathlib.system;
import jmathlib.core.tokens.Token;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st_...@us...> - 2009-02-21 17:49:26
|
Revision: 860
http://mathlib.svn.sourceforge.net/mathlib/?rev=860&view=rev
Author: st_mueller
Date: 2009-02-21 17:49:12 +0000 (Sat, 21 Feb 2009)
Log Message:
-----------
renamed MathLibOutput into JMathLibOutput and added a new method: setStatusText in order to show some status message in the GUI
Modified Paths:
--------------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-02-21 17:48:39 UTC (rev 859)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/checkforupdates.java 2009-02-21 17:49:12 UTC (rev 860)
@@ -16,9 +16,6 @@
import java.net.*;
import java.util.*;
-// OPEN: Also send current information about toolboxes and
-// installed version to server
-
/**An external function for checking for updates over the network*/
public class checkforupdates extends ExternalFunction
{
@@ -32,14 +29,22 @@
String s = "";
String lineFile = "";
- String updateSiteS = "http://www.jmathlib.de/updates/";
boolean silentB = false;
+ // check the information of the primary update site
+ String updateSiteS = "http://www.jmathlib.de/updates/";
s = globals.getProperty("update.site.primary");
+
+ // if update-site information is not available try the secondary site
+ if (s==null)
+ s = globals.getProperty("update.site.secondary");
+
+ // if primary update site or secondary site information is available
+ // take it
if (s != null)
updateSiteS = s;
-
-
+
+ // check the arguments
if (getNArgIn(operands) == 1)
{
if ((operands[0] instanceof CharToken))
@@ -52,43 +57,39 @@
}
else
{
+ // argument is maybe a different update site URL
updateSiteS = st;
globals.getInterpreter().displayText("New Update Site "+updateSiteS);
}
}
}
+ // inform the user about checking the update site
if (!silentB)
globals.getInterpreter().displayText("Checking for Updates at "+updateSiteS);
-
+ // check the last date when an update has been performed
String[] lastUpdateS = globals.getProperty("update.date.last").split("/");
int year = Integer.parseInt(lastUpdateS[0]);
int month = Integer.parseInt(lastUpdateS[1])-1;
int day = Integer.parseInt(lastUpdateS[2]);
//getInterpreter().displayText("check:"+year+"/"+month+"/"+day);
+ // read the interval between updates
int intervall = Integer.parseInt(globals.getProperty("update.intervall"));
+ // get the current date
GregorianCalendar calFile = new GregorianCalendar(year,month,day);
GregorianCalendar calCur = new GregorianCalendar();
- //getInterpreter().displayText("check: "+calCur.toString());
-
- //getInterpreter().displayText("check: "+calFile.toString());
-
+ // add update-interval to the current date
calFile.add(Calendar.DATE,intervall);
- //getInterpreter().displayText("check: "+calFile.toString());
-
- //getInterpreter().displayText("calFile "+calFile);
- //getInterpreter().displayText("calCur "+calCur);
-
-
if (silentB)
{
- if (calCur.after(calFile))
+ // if silent-mode is active only check for updates when update intervall has been reached
+ if (calCur.after(calFile) )
{
checkForUpdatesThread ch = new checkForUpdatesThread(updateSiteS, silentB);
}
@@ -99,8 +100,9 @@
}
return null;
- }
+ } // end evaluate
+
// create separate thread for checking the update site, because this may take
// some time
public class checkForUpdatesThread extends Thread
@@ -234,11 +236,17 @@
checkForUpdates(site)
checkForUpdates("-silent")
@DOC
+This functions checks via network if the current
+installation of JMathLib is up to date.
+
+This functions is also called during startup of JMathLib's GUI.
@EXAMPLE
+checkforupdates()
@NOTES
This functions checks via network if the current
installation of JMathLib is up to date.
This functions is also called during startup of JMathLib's GUI.
@SEE
+update
*/
Modified: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-02-21 17:48:39 UTC (rev 859)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/system/update.java 2009-02-21 17:49:12 UTC (rev 860)
@@ -8,6 +8,8 @@
*/
package jmathlib.toolbox.jmathlib.system;
+import java.awt.FileDialog;
+import java.awt.Frame;
import java.io.*;
import java.net.*;
import java.util.Properties;
@@ -73,17 +75,20 @@
// reaction on the response from the update server
if (updateActionS.equals("VERSION_UNKNOWN"))
{
+ // the server does not recognize the local version of JMathLib
globals.getInterpreter().displayText("Your version of JMathLib is not known by the update server.");
return null;
}
else if (updateVersionS.equals("NO_UPDATE_AVAILABLE") ||
updateActionS.equals("NO_ACTION") )
{
+ // there is no update available on the server
globals.getInterpreter().displayText("No update available right now.");
return null;
}
else if (updateActionS.equals("FULL_DOWNLOAD_REQUIRED"))
{
+ // the updates requires to do a full download of a new version of JMathLib
globals.getInterpreter().displayText("\n");
globals.getInterpreter().displayText("Full download required in order to update!");
globals.getInterpreter().displayText("Please visit www.jmathlib.de for details.");
@@ -96,30 +101,45 @@
if ((urlS==null) || (fileS==null))
return null;
-
- // put a message box here
+ // open a file dialog to choose the download directory and download filename
+ Frame f = new Frame();
+ FileDialog theFileDialog = new FileDialog(f, "Save to ...", FileDialog.SAVE);
+ theFileDialog.setFile(fileS);
+ theFileDialog.setVisible(true);
+ String downloadDirS = theFileDialog.getDirectory();
+ fileS = theFileDialog.getFile();
+ if (downloadDirS==null)
+ throwMathLibException("download directory error");
+
+ if (fileS==null)
+ throwMathLibException("download file error");
+
+ globals.getInterpreter().setStatusText("You selected "+downloadDirS+" as download directory.");
+
// open URL to file on update server
try
{
- globals.getInterpreter().displayText("Downloading ...");
+ globals.getInterpreter().displayText("Downloading ... (please wait some minutes)");
URL fileURL = new URL(urlS);
InputStream in = fileURL.openStream();
- // open file on local disc
- File file = new File(globals.getWorkingDirectory(),fileS);
+ // open file on local disc and download the new version of JMathLib
+ File file = new File(downloadDirS, fileS);
OutputStream out = new FileOutputStream(file);
byte[] cbuf = new byte[4096];
int len = -1;
-
+ int x = 0;
while ((len = in.read(cbuf)) != -1)
{
out.write(cbuf,0,len);
+ x+= len;
+ globals.getInterpreter().setStatusText("downloaded "+new Integer(x).toString()+" bytes");
}
in.close();
out.close();
- globals.getInterpreter().displayText("Downloading done.");
+ globals.getInterpreter().setStatusText("Downloading done.");
}
catch (Exception e)
{
@@ -132,7 +152,7 @@
try
{
globals.getInterpreter().displayText("Running installer ...");
- Runtime.getRuntime().exec(fileS);
+ Runtime.getRuntime().exec(downloadDirS+fileS);
globals.getInterpreter().displayText("Please exit JMathLib");
}
catch(IOException exception)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|