[Mathlib-commitlog] SF.net SVN: mathlib:[713] JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ system
Status: Beta
Brought to you by:
st_mueller
|
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.
|