else {  try { String property = System.getProperty(sub); if (property != null) retval = new Argument(Argument.STRING, property); else retval = new Argument(Argument.STRING, "undef"); } catch (SecurityException e) { retval = new Argument(Argument.STRING, "undef"); } }
	public Argument getVariableValue(String varName) throws MapyrusException	{		Argument retval = null;		String sub;		double d;		int i;		Rectangle2D bounds;		if (varName.startsWith(Mapyrus.PROGRAM_NAME + "."))		{			sub = varName.substring(Mapyrus.PROGRAM_NAME.length() + 1);					/*			 * Return internal/system variable.			 */			if (sub.equals("random"))			{				retval = new Argument(Math.random());			}			else if (sub.equals("timestamp"))			{				Date now = new Date();				retval = new Argument(Argument.STRING, now.toString());			}			else if (sub.equals("elapsedtime"))			{				/*				 * The elapsed time in seconds since this context was created				 * at the beginning of interpreting a file.				 */				retval = new Argument((System.currentTimeMillis() - mStartTime) / 1000.0);			}			else if (sub.equals("version"))			{				retval = new Argument(Argument.STRING, Mapyrus.getVersion());			}			else if (sub.equals("rotation"))			{				retval = new Argument(Math.toDegrees(getCurrentContext().getRotation()));			}			else if (sub.equals("scale.x"))			{				retval = new Argument(getCurrentContext().getScalingX());			}			else if (sub.equals("scale.y"))			{				retval = new Argument(getCurrentContext().getScalingY());			}			else if (sub.equals("page.width"))			{				retval = new Argument(getCurrentContext().getPageWidth());			}			else if (sub.equals("page.height"))			{				retval = new Argument(getCurrentContext().getPageHeight());			}			else if (sub.equals("page.resolution"))			{				retval = new Argument(Constants.MM_PER_INCH /					getCurrentContext().getResolution());			}			else if (sub.equals("import.moreRows"))			{				if (getCurrentContext().datasetHasMoreRows())					retval = Argument.numericOne;				else					retval = Argument.numericZero;			}			else if (sub.equals("import.count"))			{				retval = new Argument(getCurrentContext().getDatasetQueryCount());			}			else if (sub.startsWith(GEOMETRY_VARIABLE + "."))			{				sub = sub.substring(GEOMETRY_VARIABLE.length() + 1);				if (sub.equals("length"))					retval = new Argument(getCurrentContext().getPathLength());				else if (sub.equals("area"))					retval = new Argument(getCurrentContext().getPathArea());				else if (sub.equals("centroid.x"))					retval = new Argument(getCurrentContext().getPathCentroid().getX());				else if (sub.equals("centroid.y"))					retval = new Argument(getCurrentContext().getPathCentroid().getY());				else				{					bounds = getCurrentContext().getBounds2D();					retval = getBoundingBoxVariable(sub, bounds);				}			}			else if (sub.startsWith(WORLDS_VARIABLE + "."))			{				bounds = getCurrentContext().getWorldExtents();				sub = sub.substring(WORLDS_VARIABLE.length() + 1);				if (sub.equals("scale"))				{					retval = new Argument(getCurrentContext().getWorldScale());				}				else				{					retval = getBoundingBoxVariable(sub, bounds);				}			}			else if (sub.startsWith(UNPROJECTED_VARIABLE + "."))			{				bounds = getCurrentContext().getUnprojectedExtents();				sub = sub.substring(UNPROJECTED_VARIABLE.length() + 1);				retval = getBoundingBoxVariable(sub, bounds);			}			else if (sub.startsWith(DATASET_VARIABLE + "."))			{				GeographicDataset dataset = getCurrentContext().getDataset();				if (dataset == null)					throw new MapyrusException(MapyrusMessages.get(MapyrusMessages.NO_DATASET));				sub = sub.substring(DATASET_VARIABLE.length() + 1);				if (sub.equals("projection"))					retval = new Argument(Argument.STRING, dataset.getProjection());				else if (sub.equals("fieldnames"))				{					String []fieldNames = dataset.getFieldNames();					StringBuffer s = new StringBuffer();										for (i = 0; i < fieldNames.length; i++)					{						if (i > 0)							s.append(" ");						s.append(fieldNames[i]);					}					retval = new Argument(Argument.STRING, s.toString());				}				else				{					retval = getBoundingBoxVariable(sub, dataset.getWorlds());				}			}			else			{				/*				 * Get value from system properties.				 */				try				{					String property = System.getProperty(sub);					if (property != null)						retval = new Argument(Argument.STRING, property);					else						retval = new Argument(Argument.STRING, "undef");				}				catch (SecurityException e)				{					retval = new Argument(Argument.STRING, "undef");				}			}		}		else		{			/*			 * Search back through stack for a context defining			 * this variable.			 */			i = mStack.size() - 1;			Context context;						while (i >= 0 && retval == null)			{				context = (Context)mStack.get(i);				i--;				retval = context.getVariableValue(varName);			}		}		return(retval);	}