/* "CodeWorker":	a scripting language for parsing and generating text.

Copyright (C) 1996-1997, 1999-2002 Cédric Lemaire

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

To contact the author: codeworker@free.fr
*/

#ifdef WIN32
#pragma warning (disable : 4786)
#endif

#include <math.h>

#include "UtlException.h"
#include "ScpStream.h"

#include "CppCompilerEnvironment.h"
#include "CGRuntime.h"
#include "CGExternalHandling.h"
#include "GrfFunction.h"
#include "GrfForeach.h"
#include "GrfParseFree.h"
#include "GrfTranslate.h"
#include "DtaProject.h"
#include "DtaDesignScript.h"
#include "DtaPatternScript.h"
#include "DtaBNFScript.h"
#include "DtaScriptVariable.h"
#include "ExprScriptVariable.h"
#include "ExprScriptFunction.h"

namespace CodeWorker {
	class ExprScriptFirst : public ExprScriptFunction {
	private:
		static unsigned int _iCounter;
		ExprScriptFirst() { _parameterTypes.push_back(INDEX_EXPRTYPE); }

	public:
		virtual ~ExprScriptFirst() {}

		virtual const char* getName() const { return "first"; }

		virtual std::string getValue(DtaScriptVariable& visibility) const {
			_iCounter++;
			ExprScriptVariable* pIndexParam = (ExprScriptVariable*) _parameters.front();
			DtaScriptIndex* pIndexExpr = visibility.getIndex(pIndexParam->getName().c_str());
			if (pIndexExpr == 0) throw UtlException("'first(" + pIndexParam->getName() + ")' has no sense: '" + pIndexParam->getName() + "' isn't declared as an index");
			GrfForeach* pForeach = pIndexExpr->getForeach();
			if (pForeach == 0) throw UtlException("'first(" + pIndexParam->getName() + ")' can't work here: '" + pIndexParam->getName() + "' is a reference to an index\nif '" + pIndexParam->getName() + "' is a function parameter, write '" + pIndexParam->getName() + " : index' in the prototype");
			if (pForeach->getCurrentPosition() == 0) return "true";
			return "";
		}

		virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
			GrfForeach* pForeach = theCompilerEnvironment.getLastForeach();
			std::string sModifier;
			if (pForeach->getSorted()) {
				sModifier = "Sorted";
				if (pForeach->getSortedNoCase()) sModifier += "NoCase";
			}
			if (bNegative) {
				CW_BODY_STREAM << "_compilerIndex" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << " != _compilerMap" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << "->begin()";
			} else {
				CW_BODY_STREAM << "_compilerIndex" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << " == _compilerMap" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << "->begin()";
			}
			return true;
		}

		static ExprScriptFunction* create(GrfBlock&, int& iArity) {
			iArity = 1;
			return new ExprScriptFirst;
		}

		static void registerFunction(DtaFunctionInfo& info) {
			info.constructor = create;
			info.pCounter = &_iCounter;
		}
	};
	unsigned int ExprScriptFirst::_iCounter = 0;

	class ExprScriptLast : public ExprScriptFunction {
	private:
		static unsigned int _iCounter;
		ExprScriptLast() { _parameterTypes.push_back(INDEX_EXPRTYPE); }

	public:
		virtual ~ExprScriptLast() {}

		virtual const char* getName() const { return "last"; }

		virtual std::string getValue(DtaScriptVariable& visibility) const {
			_iCounter++;
			ExprScriptVariable* pIndexParam = (ExprScriptVariable*) _parameters.front();
			DtaScriptIndex* pIndexExpr = visibility.getIndex(pIndexParam->getName().c_str());
			if (pIndexExpr == 0) throw UtlException("'last(" + pIndexParam->getName() + ")' has no sense: '" + pIndexParam->getName() + "' isn't declared as an index");
			GrfForeach* pForeach = pIndexExpr->getForeach();
			if (pForeach == 0) throw UtlException("'last(" + pIndexParam->getName() + ")' can't work here: '" + pIndexParam->getName() + "' is a reference to an index\nif '" + pIndexParam->getName() + "' is a function parameter, write '" + pIndexParam->getName() + " : index' in the prototype");
			if (pForeach->getCurrentPosition() + 1 >= pForeach->getArraySize()) return "true";
			return "";
		}

		virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
			GrfForeach* pForeach = theCompilerEnvironment.getLastForeach();
			std::string sModifier;
			if (pForeach->getSorted()) {
				sModifier = "Sorted";
				if (pForeach->getSortedNoCase()) sModifier += "NoCase";
			}
			if (bNegative) {
				CW_BODY_STREAM << "CGRuntime::nextIteration(_compilerIndex" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << ") != _compilerMap" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << "->end()";
			} else {
				CW_BODY_STREAM << "CGRuntime::nextIteration(_compilerIndex" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << ") == _compilerMap" << sModifier << "Foreach_" << ((ExprScriptVariable*) _parameters.front())->getName() << "->end()";
			}
			return true;
		}

		static ExprScriptFunction* create(GrfBlock&, int& iArity) {
			iArity = 1;
			return new ExprScriptLast;
		}

		static void registerFunction(DtaFunctionInfo& info) {
			info.constructor = create;
			info.pCounter = &_iCounter;
		}
	};
	unsigned int ExprScriptLast::_iCounter = 0;

	class ExprScriptKey : public ExprScriptFunction {
	private:
		static unsigned int _iCounter;
		ExprScriptKey() { _parameterTypes.push_back(INDEX_EXPRTYPE); }

	public:
		virtual ~ExprScriptKey() {}

		virtual const char* getName() const { return "key"; }

		virtual std::string getValue(DtaScriptVariable& visibility) const {
			_iCounter++;
			ExprScriptVariable* pIndexParam = (ExprScriptVariable*) _parameters.front();
			DtaScriptIndex* pIndexExpr = visibility.getIndex(pIndexParam->getName().c_str());
			if (pIndexExpr == 0) throw UtlException("'key(" + pIndexParam->getName() + ")' has no sense: '" + pIndexParam->getName() + "' isn't declared as an index");
			GrfForeach* pForeach = pIndexExpr->getForeach();
			if (pForeach == 0) throw UtlException("'key(" + pIndexParam->getName() + ")' can't work here: '" + pIndexParam->getName() + "' is a reference to an index\nif '" + pIndexParam->getName() + "' is a function parameter, write '" + pIndexParam->getName() + " : index' in the prototype");
			return pForeach->getKey();
		}

		virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
			compileCppString(theCompilerEnvironment);
			return STRING_TYPE;
		}

		virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
			if (!bNegative) CW_BODY_STREAM << "!";
			compileCpp(theCompilerEnvironment);
			CW_BODY_STREAM << ".empty()";
			return true;
		}

		virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
			CW_BODY_STREAM << "_compilerKeyForeach_" << ((ExprScriptVariable*) _parameters.front())->getName();
			return true;
		}

		static ExprScriptFunction* create(GrfBlock&, int& iArity) {
			iArity = 1;
			return new ExprScriptKey;
		}

		static void registerFunction(DtaFunctionInfo& info) {
			info.constructor = create;
			info.pCounter = &_iCounter;
		}
	};
	unsigned int ExprScriptKey::_iCounter = 0;

	class ExprScriptNot : public ExprScriptFunction {
	private:
		static unsigned int _iCounter;
		ExprScriptNot() { _parameterTypes.push_back(VALUE_EXPRTYPE); }

	public:
		virtual ~ExprScriptNot() {}

		virtual const char* getName() const { return "not"; }

		virtual std::string getValue(DtaScriptVariable& visibility) const {
			_iCounter++;
			std::string sValue = _parameters.front()->getValue(visibility);
			if (sValue.empty()) return "true";
			return "";
		}

		virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
			compileCppBoolean(theCompilerEnvironment, true);
			return BOOL_TYPE;
		}

		virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
			return _parameters.front()->compileCppBoolean(theCompilerEnvironment, !bNegative);
		}

		virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
			CW_BODY_STREAM << "((";
			compileCppBoolean(theCompilerEnvironment, false);
			CW_BODY_STREAM << ") ? \"\" : \"true\")";
			return true;
		}

		static ExprScriptFunction* create(GrfBlock&, int& iArity) {
			iArity = 1;
			return new ExprScriptNot;
		}

		static void registerFunction(DtaFunctionInfo& info) {
			info.constructor = create;
			info.pCounter = &_iCounter;
		}
	};
	unsigned int ExprScriptNot::_iCounter = 0;


//##markup##"declarations"
//##begin##"declarations"

class ExprScriptFlushOutputToSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFlushOutputToSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFlushOutputToSocket() {	}

	virtual const char* getName() const { return "flushOutputToSocket"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSocket = (*cursor)->getValue(visibility);
		int iSocket = atoi(sSocket.c_str());
		bool returnValue = CGRuntime::flushOutputToSocket(iSocket);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::flushOutputToSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFlushOutputToSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFlushOutputToSocket::_iCounter = 0;


class ExprScriptAcceptSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptAcceptSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptAcceptSocket() {	}

	virtual const char* getName() const { return "acceptSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sServerSocket = (*cursor)->getValue(visibility);
		int iServerSocket = atoi(sServerSocket.c_str());
		int returnValue = CGRuntime::acceptSocket(iServerSocket);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::acceptSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptAcceptSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptAcceptSocket::_iCounter = 0;


class ExprScriptAdd : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptAdd() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptAdd() {	}

	virtual const char* getName() const { return "add"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLeft = (*cursor)->getValue(visibility);
		double dLeft = atof(sLeft.c_str());
		++cursor;
		std::string sRight = (*cursor)->getValue(visibility);
		double dRight = atof(sRight.c_str());
		double returnValue = CGRuntime::add(dLeft, dRight);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::add(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptAdd;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptAdd::_iCounter = 0;


class ExprScriptAddGenerationTagsHandler : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptAddGenerationTagsHandler(GrfBlock& block) {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(SCRIPTFILE_BNF_EXPRTYPE);
		_parameterTypes.push_back(SCRIPTFILE_PATTERN_EXPRTYPE);
//##protect##"addGenerationTagsHandler::constructor"
		_pReaderCache = 0L;
		_pWriterCache = 0L;
//##protect##"addGenerationTagsHandler::constructor"
	}


private:
//##protect##"addGenerationTagsHandler::attributes"
	mutable DtaBNFScript*     _pReaderCache;
	mutable DtaPatternScript* _pWriterCache;
//##protect##"addGenerationTagsHandler::attributes"

public:
    virtual ~ExprScriptAddGenerationTagsHandler() {
//##protect##"addGenerationTagsHandler::destructor"
		if (_pReaderCache != 0L) delete _pReaderCache;
		if (_pWriterCache != 0L) delete _pWriterCache;
//##protect##"addGenerationTagsHandler::destructor"
	}

	virtual const char* getName() const { return "addGenerationTagsHandler"; }
	virtual void initializationDone() {
//##protect##"addGenerationTagsHandler::initializationDone"
//##protect##"addGenerationTagsHandler::initializationDone"
	}


    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		bool returnValue;
//##protect##"addGenerationTagsHandler::execute"
		std::string sKey = _parameters[0]->getValue(visibility);
		returnValue = !DtaProject::getInstance().existGenerationTagsHandler(sKey);
		if (returnValue) {
			// the reader
			DtaBNFScript* pReader;
			ExprScriptScriptFile* pBNFFileName = dynamic_cast<ExprScriptScriptFile*>(_parameters[1]);
			if (pBNFFileName->isFileName()) {
				if (_pReaderCache == 0L) {
					std::string sScriptFile = pBNFFileName->getFileName()->getValue(visibility);
					std::auto_ptr<DtaBNFScript> pScript(new DtaBNFScript);
					pScript->parseFile(sScriptFile.c_str());
					_pReaderCache = pScript.release();
				}
				pReader = _pReaderCache;
			} else {
				pReader = dynamic_cast<DtaBNFScript*>(pBNFFileName->getBody());
			}
			// the writer
			DtaPatternScript* pWriter;
			ExprScriptScriptFile* pPatternFileName = dynamic_cast<ExprScriptScriptFile*>(_parameters[2]);
			if (pPatternFileName->isFileName()) {
				if (_pWriterCache == 0L) {
					std::string sScriptFile = pPatternFileName->getFileName()->getValue(visibility);
					std::auto_ptr<DtaPatternScript> pScript(new DtaPatternScript);
					pScript->parseFile(sScriptFile.c_str());
					_pWriterCache = pScript.release();
				}
				pWriter = _pWriterCache;
			} else {
				pWriter = dynamic_cast<DtaPatternScript*>(pPatternFileName->getBody());
			}
			// register the handler
			returnValue = DtaProject::getInstance().addGenerationTagsHandler(sKey, pReader, pWriter);
		}
//##protect##"addGenerationTagsHandler::execute"
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
//##protect##"addGenerationTagsHandler::compileCppBoolean"
//##protect##"addGenerationTagsHandler::compileCppBoolean"
		return true;
	}

	static ExprScriptFunction* create(GrfBlock& block, int& iArity) {
        iArity = 3;
        return new ExprScriptAddGenerationTagsHandler(block);
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptAddGenerationTagsHandler::_iCounter = 0;


class ExprScriptByteToChar : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptByteToChar() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptByteToChar() {	}

	virtual const char* getName() const { return "byteToChar"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sByte = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::byteToChar(sByte);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::byteToChar(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptByteToChar;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptByteToChar::_iCounter = 0;


class ExprScriptBytesToLong : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptBytesToLong() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptBytesToLong() {	}

	virtual const char* getName() const { return "bytesToLong"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sBytes = (*cursor)->getValue(visibility);
		unsigned long returnValue = CGRuntime::bytesToLong(sBytes);
		char tcNumber[16];
		sprintf(tcNumber, "%Lu", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppUnsignedLong(theCompilerEnvironment);
		return ULONG_TYPE;
	}

	virtual bool compileCppUnsignedLong(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::bytesToLong(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptBytesToLong;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptBytesToLong::_iCounter = 0;


class ExprScriptBytesToShort : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptBytesToShort() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptBytesToShort() {	}

	virtual const char* getName() const { return "bytesToShort"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sBytes = (*cursor)->getValue(visibility);
		unsigned short returnValue = CGRuntime::bytesToShort(sBytes);
		char tcNumber[16];
		sprintf(tcNumber, "%hu", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppUnsignedShort(theCompilerEnvironment);
		return USHORT_TYPE;
	}

	virtual bool compileCppUnsignedShort(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::bytesToShort(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptBytesToShort;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptBytesToShort::_iCounter = 0;


class ExprScriptCanonizePath : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCanonizePath() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCanonizePath() {	}

	virtual const char* getName() const { return "canonizePath"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPath = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::canonizePath(sPath);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::canonizePath(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptCanonizePath;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCanonizePath::_iCounter = 0;


class ExprScriptChangeDirectory : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptChangeDirectory() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptChangeDirectory() {	}

	virtual const char* getName() const { return "changeDirectory"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPath = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::changeDirectory(sPath);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::changeDirectory(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptChangeDirectory;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptChangeDirectory::_iCounter = 0;


class ExprScriptChangeFileTime : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptChangeFileTime() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptChangeFileTime() {	}

	virtual const char* getName() const { return "changeFileTime"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		++cursor;
		std::string sAccessTime = (*cursor)->getValue(visibility);
		++cursor;
		std::string sModificationTime = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::changeFileTime(sFilename, sAccessTime, sModificationTime);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::changeFileTime(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptChangeFileTime;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptChangeFileTime::_iCounter = 0;


class ExprScriptCharAt : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCharAt() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCharAt() {	}

	virtual const char* getName() const { return "charAt"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sIndex = (*cursor)->getValue(visibility);
		int iIndex = atoi(sIndex.c_str());
		std::string returnValue = CGRuntime::charAt(sText, iIndex);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::charAt(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCharAt;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCharAt::_iCounter = 0;


class ExprScriptCharToByte : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCharToByte() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCharToByte() {	}

	virtual const char* getName() const { return "charToByte"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sChar = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::charToByte(sChar);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::charToByte(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptCharToByte;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCharToByte::_iCounter = 0;


class ExprScriptCharToInt : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCharToInt() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCharToInt() {	}

	virtual const char* getName() const { return "charToInt"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sChar = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::charToInt(sChar);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::charToInt(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptCharToInt;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCharToInt::_iCounter = 0;


class ExprScriptChmod : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptChmod() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptChmod() {	}

	virtual const char* getName() const { return "chmod"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		++cursor;
		std::string sMode = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::chmod(sFilename, sMode);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::chmod(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptChmod;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptChmod::_iCounter = 0;


class ExprScriptCeil : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCeil() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCeil() {	}

	virtual const char* getName() const { return "ceil"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sNumber = (*cursor)->getValue(visibility);
		double dNumber = atof(sNumber.c_str());
		int returnValue = CGRuntime::ceil(dNumber);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::ceil(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptCeil;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCeil::_iCounter = 0;


class ExprScriptCompareDate : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCompareDate() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCompareDate() {	}

	virtual const char* getName() const { return "compareDate"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sDate1 = (*cursor)->getValue(visibility);
		++cursor;
		std::string sDate2 = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::compareDate(sDate1, sDate2);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::compareDate(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCompareDate;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCompareDate::_iCounter = 0;


class ExprScriptCompleteDate : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCompleteDate() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCompleteDate() {	}

	virtual const char* getName() const { return "completeDate"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sDate = (*cursor)->getValue(visibility);
		++cursor;
		std::string sFormat = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::completeDate(sDate, sFormat);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::completeDate(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCompleteDate;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCompleteDate::_iCounter = 0;


class ExprScriptCompleteLeftSpaces : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCompleteLeftSpaces() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCompleteLeftSpaces() {	}

	virtual const char* getName() const { return "completeLeftSpaces"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::completeLeftSpaces(sText, iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::completeLeftSpaces(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCompleteLeftSpaces;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCompleteLeftSpaces::_iCounter = 0;


class ExprScriptCompleteRightSpaces : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCompleteRightSpaces() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCompleteRightSpaces() {	}

	virtual const char* getName() const { return "completeRightSpaces"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::completeRightSpaces(sText, iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::completeRightSpaces(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCompleteRightSpaces;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCompleteRightSpaces::_iCounter = 0;


class ExprScriptComposeAdaLikeString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptComposeAdaLikeString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptComposeAdaLikeString() {	}

	virtual const char* getName() const { return "composeAdaLikeString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::composeAdaLikeString(sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::composeAdaLikeString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptComposeAdaLikeString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptComposeAdaLikeString::_iCounter = 0;


class ExprScriptComposeCLikeString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptComposeCLikeString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptComposeCLikeString() {	}

	virtual const char* getName() const { return "composeCLikeString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::composeCLikeString(sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::composeCLikeString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptComposeCLikeString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptComposeCLikeString::_iCounter = 0;


class ExprScriptComposeHTMLLikeString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptComposeHTMLLikeString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptComposeHTMLLikeString() {	}

	virtual const char* getName() const { return "composeHTMLLikeString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::composeHTMLLikeString(sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::composeHTMLLikeString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptComposeHTMLLikeString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptComposeHTMLLikeString::_iCounter = 0;


class ExprScriptComposeSQLLikeString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptComposeSQLLikeString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptComposeSQLLikeString() {	}

	virtual const char* getName() const { return "composeSQLLikeString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::composeSQLLikeString(sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::composeSQLLikeString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptComposeSQLLikeString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptComposeSQLLikeString::_iCounter = 0;


class ExprScriptComputeMD5 : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptComputeMD5() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptComputeMD5() {	}

	virtual const char* getName() const { return "computeMD5"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::computeMD5(sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::computeMD5(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptComputeMD5;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptComputeMD5::_iCounter = 0;


class ExprScriptCopySmartFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCopySmartFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCopySmartFile() {	}

	virtual const char* getName() const { return "copySmartFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSourceFileName = (*cursor)->getValue(visibility);
		++cursor;
		std::string sDestinationFileName = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::copySmartFile(sSourceFileName, sDestinationFileName);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::copySmartFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCopySmartFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCopySmartFile::_iCounter = 0;


class ExprScriptCoreString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCoreString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCoreString() {	}

	virtual const char* getName() const { return "coreString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPos = (*cursor)->getValue(visibility);
		int iPos = atoi(sPos.c_str());
		++cursor;
		std::string sLastRemoved = (*cursor)->getValue(visibility);
		int iLastRemoved = atoi(sLastRemoved.c_str());
		std::string returnValue = CGRuntime::coreString(sText, iPos, iLastRemoved);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::coreString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptCoreString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCoreString::_iCounter = 0;


class ExprScriptCountStringOccurences : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCountStringOccurences() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCountStringOccurences() {	}

	virtual const char* getName() const { return "countStringOccurences"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sString = (*cursor)->getValue(visibility);
		++cursor;
		std::string sText = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::countStringOccurences(sString, sText);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::countStringOccurences(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCountStringOccurences;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCountStringOccurences::_iCounter = 0;


class ExprScriptCreateDirectory : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCreateDirectory() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCreateDirectory() {	}

	virtual const char* getName() const { return "createDirectory"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPath = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::createDirectory(sPath);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::createDirectory(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptCreateDirectory;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCreateDirectory::_iCounter = 0;


class ExprScriptCreateINETClientSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCreateINETClientSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCreateINETClientSocket() {	}

	virtual const char* getName() const { return "createINETClientSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sRemoteAddress = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPort = (*cursor)->getValue(visibility);
		int iPort = atoi(sPort.c_str());
		int returnValue = CGRuntime::createINETClientSocket(sRemoteAddress, iPort);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::createINETClientSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCreateINETClientSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCreateINETClientSocket::_iCounter = 0;


class ExprScriptCreateINETServerSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCreateINETServerSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCreateINETServerSocket() {	}

	virtual const char* getName() const { return "createINETServerSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPort = (*cursor)->getValue(visibility);
		int iPort = atoi(sPort.c_str());
		++cursor;
		std::string sBackLog = (*cursor)->getValue(visibility);
		int iBackLog = atoi(sBackLog.c_str());
		int returnValue = CGRuntime::createINETServerSocket(iPort, iBackLog);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::createINETServerSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCreateINETServerSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCreateINETServerSocket::_iCounter = 0;


class ExprScriptCreateVirtualFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCreateVirtualFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCreateVirtualFile() {	}

	virtual const char* getName() const { return "createVirtualFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sHandle = (*cursor)->getValue(visibility);
		++cursor;
		std::string sContent = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::createVirtualFile(sHandle, sContent);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::createVirtualFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptCreateVirtualFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCreateVirtualFile::_iCounter = 0;


class ExprScriptCreateVirtualTemporaryFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCreateVirtualTemporaryFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptCreateVirtualTemporaryFile() {	}

	virtual const char* getName() const { return "createVirtualTemporaryFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sContent = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::createVirtualTemporaryFile(sContent);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::createVirtualTemporaryFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptCreateVirtualTemporaryFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCreateVirtualTemporaryFile::_iCounter = 0;


class ExprScriptDecodeURL : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptDecodeURL() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptDecodeURL() {	}

	virtual const char* getName() const { return "decodeURL"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sURL = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::decodeURL(sURL);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::decodeURL(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptDecodeURL;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptDecodeURL::_iCounter = 0;


class ExprScriptDecrement : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptDecrement() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptDecrement() {	}

	virtual const char* getName() const { return "decrement"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pNumber = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		double dNumber = pNumber->getDoubleValue();
		double returnValue = CGRuntime::decrement(dNumber);
		pNumber->setValue(dNumber);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::decrement(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptDecrement;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptDecrement::_iCounter = 0;


class ExprScriptDeleteFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptDeleteFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptDeleteFile() {	}

	virtual const char* getName() const { return "deleteFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::deleteFile(sFilename);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::deleteFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptDeleteFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptDeleteFile::_iCounter = 0;


class ExprScriptDeleteVirtualFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptDeleteVirtualFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptDeleteVirtualFile() {	}

	virtual const char* getName() const { return "deleteVirtualFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sHandle = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::deleteVirtualFile(sHandle);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::deleteVirtualFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptDeleteVirtualFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptDeleteVirtualFile::_iCounter = 0;


class ExprScriptDiv : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptDiv() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptDiv() {	}

	virtual const char* getName() const { return "div"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sDividend = (*cursor)->getValue(visibility);
		double dDividend = atof(sDividend.c_str());
		++cursor;
		std::string sDivisor = (*cursor)->getValue(visibility);
		double dDivisor = atof(sDivisor.c_str());
		double returnValue = CGRuntime::div(dDividend, dDivisor);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::div(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptDiv;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptDiv::_iCounter = 0;


class ExprScriptEncodeURL : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptEncodeURL() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptEncodeURL() {	}

	virtual const char* getName() const { return "encodeURL"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sURL = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::encodeURL(sURL);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::encodeURL(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptEncodeURL;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptEncodeURL::_iCounter = 0;


class ExprScriptEndl : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptEndl() {
	}

public:
    virtual ~ExprScriptEndl() {	}

	virtual const char* getName() const { return "endl"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::endl();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::endl(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptEndl;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptEndl::_iCounter = 0;


class ExprScriptEndString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptEndString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptEndString() {	}

	virtual const char* getName() const { return "endString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sEnd = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::endString(sText, sEnd);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::endString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptEndString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptEndString::_iCounter = 0;


class ExprScriptEqual : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptEqual() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptEqual() {	}

	virtual const char* getName() const { return "equal"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLeft = (*cursor)->getValue(visibility);
		double dLeft = atof(sLeft.c_str());
		++cursor;
		std::string sRight = (*cursor)->getValue(visibility);
		double dRight = atof(sRight.c_str());
		bool returnValue = CGRuntime::equal(dLeft, dRight);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::equal(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptEqual;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptEqual::_iCounter = 0;


class ExprScriptEqualsIgnoreCase : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptEqualsIgnoreCase() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptEqualsIgnoreCase() {	}

	virtual const char* getName() const { return "equalsIgnoreCase"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLeft = (*cursor)->getValue(visibility);
		++cursor;
		std::string sRight = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::equalsIgnoreCase(sLeft, sRight);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::equalsIgnoreCase(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptEqualsIgnoreCase;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptEqualsIgnoreCase::_iCounter = 0;


class ExprScriptEqualTrees : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptEqualTrees() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptEqualTrees() {	}

	virtual const char* getName() const { return "equalTrees"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pFirstTree = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		DtaScriptVariable* pSecondTree = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		bool returnValue = CGRuntime::equalTrees(pFirstTree, pSecondTree);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::equalTrees(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptEqualTrees;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptEqualTrees::_iCounter = 0;


class ExprScriptExecuteStringQuiet : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExecuteStringQuiet() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExecuteStringQuiet() {	}

	virtual const char* getName() const { return "executeStringQuiet"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pThis = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sCommand = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::executeStringQuiet(pThis, sCommand);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::executeStringQuiet(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptExecuteStringQuiet;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExecuteStringQuiet::_iCounter = 0;


class ExprScriptExistEnv : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExistEnv() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExistEnv() {	}

	virtual const char* getName() const { return "existEnv"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sVariable = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::existEnv(sVariable);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::existEnv(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptExistEnv;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExistEnv::_iCounter = 0;


class ExprScriptExistFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExistFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExistFile() {	}

	virtual const char* getName() const { return "existFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFileName = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::existFile(sFileName);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::existFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptExistFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExistFile::_iCounter = 0;


class ExprScriptExistVirtualFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExistVirtualFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExistVirtualFile() {	}

	virtual const char* getName() const { return "existVirtualFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sHandle = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::existVirtualFile(sHandle);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::existVirtualFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptExistVirtualFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExistVirtualFile::_iCounter = 0;


class ExprScriptExistVariable : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExistVariable() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExistVariable() {	}

	virtual const char* getName() const { return "existVariable"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pVariable = visibility.getNoWarningExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		bool returnValue = CGRuntime::existVariable(pVariable);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::existVariable(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptExistVariable;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExistVariable::_iCounter = 0;


class ExprScriptExp : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExp() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExp() {	}

	virtual const char* getName() const { return "exp"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sX = (*cursor)->getValue(visibility);
		double dX = atof(sX.c_str());
		double returnValue = CGRuntime::exp(dX);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::exp(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptExp;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExp::_iCounter = 0;


class ExprScriptExploreDirectory : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExploreDirectory() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExploreDirectory() {	}

	virtual const char* getName() const { return "exploreDirectory"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pDirectory = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sPath = (*cursor)->getValue(visibility);
		++cursor;
		std::string sSubfolders = (*cursor)->getValue(visibility);
		bool bSubfolders = !sSubfolders.empty();
		bool returnValue = CGRuntime::exploreDirectory(pDirectory, sPath, bSubfolders);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::exploreDirectory(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppBoolean(theCompilerEnvironment, false);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptExploreDirectory;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExploreDirectory::_iCounter = 0;


class ExprScriptExtractGenerationHeader : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExtractGenerationHeader() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExtractGenerationHeader() {	}

	virtual const char* getName() const { return "extractGenerationHeader"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		++cursor;
		DtaScriptVariable* pGenerator = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sGenerator;
		const char* tsGenerator = pGenerator->getValue();
		if (tsGenerator != 0L) sGenerator = tsGenerator;
		++cursor;
		DtaScriptVariable* pVersion = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sVersion;
		const char* tsVersion = pVersion->getValue();
		if (tsVersion != 0L) sVersion = tsVersion;
		++cursor;
		DtaScriptVariable* pDate = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sDate;
		const char* tsDate = pDate->getValue();
		if (tsDate != 0L) sDate = tsDate;
		std::string returnValue = CGRuntime::extractGenerationHeader(sFilename, sGenerator, sVersion, sDate);
		pGenerator->setValue(sGenerator.c_str());
		pVersion->setValue(sVersion.c_str());
		pDate->setValue(sDate.c_str());
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::extractGenerationHeader(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 4;
        return new ExprScriptExtractGenerationHeader;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExtractGenerationHeader::_iCounter = 0;


class ExprScriptFileCreation : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFileCreation() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFileCreation() {	}

	virtual const char* getName() const { return "fileCreation"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::fileCreation(sFilename);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::fileCreation(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFileCreation;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFileCreation::_iCounter = 0;


class ExprScriptFileLastAccess : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFileLastAccess() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFileLastAccess() {	}

	virtual const char* getName() const { return "fileLastAccess"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::fileLastAccess(sFilename);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::fileLastAccess(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFileLastAccess;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFileLastAccess::_iCounter = 0;


class ExprScriptFileLastModification : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFileLastModification() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFileLastModification() {	}

	virtual const char* getName() const { return "fileLastModification"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::fileLastModification(sFilename);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::fileLastModification(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFileLastModification;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFileLastModification::_iCounter = 0;


class ExprScriptFileLines : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFileLines() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFileLines() {	}

	virtual const char* getName() const { return "fileLines"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::fileLines(sFilename);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::fileLines(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFileLines;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFileLines::_iCounter = 0;


class ExprScriptFileMode : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFileMode() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFileMode() {	}

	virtual const char* getName() const { return "fileMode"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::fileMode(sFilename);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::fileMode(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFileMode;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFileMode::_iCounter = 0;


class ExprScriptFileSize : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFileSize() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFileSize() {	}

	virtual const char* getName() const { return "fileSize"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::fileSize(sFilename);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::fileSize(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFileSize;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFileSize::_iCounter = 0;


class ExprScriptFindElement : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFindElement() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFindElement() {	}

	virtual const char* getName() const { return "findElement"; }
	virtual int getThisPosition() const { return 1; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sValue = (*cursor)->getValue(visibility);
		++cursor;
		DtaScriptVariable* pVariable = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		bool returnValue = CGRuntime::findElement(sValue, pVariable);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::findElement(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptFindElement;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFindElement::_iCounter = 0;


class ExprScriptFindFirstChar : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFindFirstChar() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFindFirstChar() {	}

	virtual const char* getName() const { return "findFirstChar"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sSomeChars = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::findFirstChar(sText, sSomeChars);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::findFirstChar(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptFindFirstChar;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFindFirstChar::_iCounter = 0;


class ExprScriptFindFirstSubstringIntoKeys : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFindFirstSubstringIntoKeys() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFindFirstSubstringIntoKeys() {	}

	virtual const char* getName() const { return "findFirstSubstringIntoKeys"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSubstring = (*cursor)->getValue(visibility);
		++cursor;
		DtaScriptVariable* pArray = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		int returnValue = CGRuntime::findFirstSubstringIntoKeys(sSubstring, pArray);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::findFirstSubstringIntoKeys(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptFindFirstSubstringIntoKeys;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFindFirstSubstringIntoKeys::_iCounter = 0;


class ExprScriptFindLastString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFindLastString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFindLastString() {	}

	virtual const char* getName() const { return "findLastString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sFind = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::findLastString(sText, sFind);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::findLastString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptFindLastString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFindLastString::_iCounter = 0;


class ExprScriptFindNextString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFindNextString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFindNextString() {	}

	virtual const char* getName() const { return "findNextString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sFind = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPosition = (*cursor)->getValue(visibility);
		int iPosition = atoi(sPosition.c_str());
		int returnValue = CGRuntime::findNextString(sText, sFind, iPosition);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::findNextString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptFindNextString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFindNextString::_iCounter = 0;


class ExprScriptFindNextSubstringIntoKeys : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFindNextSubstringIntoKeys() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFindNextSubstringIntoKeys() {	}

	virtual const char* getName() const { return "findNextSubstringIntoKeys"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSubstring = (*cursor)->getValue(visibility);
		++cursor;
		DtaScriptVariable* pArray = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sNext = (*cursor)->getValue(visibility);
		int iNext = atoi(sNext.c_str());
		int returnValue = CGRuntime::findNextSubstringIntoKeys(sSubstring, pArray, iNext);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::findNextSubstringIntoKeys(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptFindNextSubstringIntoKeys;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFindNextSubstringIntoKeys::_iCounter = 0;


class ExprScriptFindString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFindString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFindString() {	}

	virtual const char* getName() const { return "findString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sFind = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::findString(sText, sFind);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::findString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptFindString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFindString::_iCounter = 0;


class ExprScriptFloor : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFloor() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFloor() {	}

	virtual const char* getName() const { return "floor"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sNumber = (*cursor)->getValue(visibility);
		double dNumber = atof(sNumber.c_str());
		int returnValue = CGRuntime::floor(dNumber);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::floor(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptFloor;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFloor::_iCounter = 0;


class ExprScriptFormatDate : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptFormatDate() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptFormatDate() {	}

	virtual const char* getName() const { return "formatDate"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sDate = (*cursor)->getValue(visibility);
		++cursor;
		std::string sFormat = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::formatDate(sDate, sFormat);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::formatDate(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptFormatDate;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptFormatDate::_iCounter = 0;


class ExprScriptGetArraySize : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetArraySize() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetArraySize() {	}

	virtual const char* getName() const { return "getArraySize"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pVariable = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		int returnValue = CGRuntime::getArraySize(pVariable);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getArraySize(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetArraySize;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetArraySize::_iCounter = 0;


class ExprScriptGetCommentBegin : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetCommentBegin() {
	}

public:
    virtual ~ExprScriptGetCommentBegin() {	}

	virtual const char* getName() const { return "getCommentBegin"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getCommentBegin();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getCommentBegin(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetCommentBegin;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetCommentBegin::_iCounter = 0;


class ExprScriptGetCommentEnd : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetCommentEnd() {
	}

public:
    virtual ~ExprScriptGetCommentEnd() {	}

	virtual const char* getName() const { return "getCommentEnd"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getCommentEnd();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getCommentEnd(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetCommentEnd;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetCommentEnd::_iCounter = 0;


class ExprScriptGetCurrentDirectory : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetCurrentDirectory() {
	}

public:
    virtual ~ExprScriptGetCurrentDirectory() {	}

	virtual const char* getName() const { return "getCurrentDirectory"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getCurrentDirectory();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getCurrentDirectory(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetCurrentDirectory;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetCurrentDirectory::_iCounter = 0;


class ExprScriptGetEnv : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetEnv() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetEnv() {	}

	virtual const char* getName() const { return "getEnv"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sVariable = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::getEnv(sVariable);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getEnv(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetEnv;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetEnv::_iCounter = 0;


class ExprScriptGetGenerationHeader : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetGenerationHeader() {
	}

public:
    virtual ~ExprScriptGetGenerationHeader() {	}

	virtual const char* getName() const { return "getGenerationHeader"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getGenerationHeader();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getGenerationHeader(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetGenerationHeader;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetGenerationHeader::_iCounter = 0;


class ExprScriptGetHTTPRequest : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetHTTPRequest() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetHTTPRequest() {	}

	virtual const char* getName() const { return "getHTTPRequest"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sURL = (*cursor)->getValue(visibility);
		++cursor;
		DtaScriptVariable* pHTTPSession = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		DtaScriptVariable* pArguments = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string returnValue = CGRuntime::getHTTPRequest(sURL, pHTTPSession, pArguments);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getHTTPRequest(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptGetHTTPRequest;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetHTTPRequest::_iCounter = 0;


class ExprScriptGetIncludePath : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetIncludePath() {
	}

public:
    virtual ~ExprScriptGetIncludePath() {	}

	virtual const char* getName() const { return "getIncludePath"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getIncludePath();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getIncludePath(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetIncludePath;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetIncludePath::_iCounter = 0;


class ExprScriptGetLastDelay : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetLastDelay() {
	}

public:
    virtual ~ExprScriptGetLastDelay() {	}

	virtual const char* getName() const { return "getLastDelay"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		double returnValue = CGRuntime::getLastDelay();
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getLastDelay(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetLastDelay;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetLastDelay::_iCounter = 0;


class ExprScriptGetNow : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetNow() {
	}

public:
    virtual ~ExprScriptGetNow() {	}

	virtual const char* getName() const { return "getNow"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getNow();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getNow(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetNow;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetNow::_iCounter = 0;


class ExprScriptGetProperty : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetProperty() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetProperty() {	}

	virtual const char* getName() const { return "getProperty"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sDefine = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::getProperty(sDefine);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getProperty(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetProperty;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetProperty::_iCounter = 0;


class ExprScriptGetShortFilename : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetShortFilename() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetShortFilename() {	}

	virtual const char* getName() const { return "getShortFilename"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPathFilename = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::getShortFilename(sPathFilename);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getShortFilename(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetShortFilename;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetShortFilename::_iCounter = 0;


class ExprScriptGetTextMode : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetTextMode() {
	}

public:
    virtual ~ExprScriptGetTextMode() {	}

	virtual const char* getName() const { return "getTextMode"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getTextMode();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getTextMode(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetTextMode;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetTextMode::_iCounter = 0;


class ExprScriptGetVariableAttributes : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetVariableAttributes() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetVariableAttributes() {	}

	virtual const char* getName() const { return "getVariableAttributes"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pVariable = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		DtaScriptVariable* pList = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		int returnValue = CGRuntime::getVariableAttributes(pVariable, pList);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getVariableAttributes(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptGetVariableAttributes;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetVariableAttributes::_iCounter = 0;


class ExprScriptGetVersion : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetVersion() {
	}

public:
    virtual ~ExprScriptGetVersion() {	}

	virtual const char* getName() const { return "getVersion"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getVersion();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getVersion(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetVersion;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetVersion::_iCounter = 0;


class ExprScriptGetWorkingPath : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetWorkingPath() {
	}

public:
    virtual ~ExprScriptGetWorkingPath() {	}

	virtual const char* getName() const { return "getWorkingPath"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getWorkingPath();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getWorkingPath(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetWorkingPath;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetWorkingPath::_iCounter = 0;


class ExprScriptGetWriteMode : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetWriteMode() {
	}

public:
    virtual ~ExprScriptGetWriteMode() {	}

	virtual const char* getName() const { return "getWriteMode"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getWriteMode();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getWriteMode(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetWriteMode;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetWriteMode::_iCounter = 0;


class ExprScriptHexaToDecimal : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptHexaToDecimal() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptHexaToDecimal() {	}

	virtual const char* getName() const { return "hexaToDecimal"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sHexaNumber = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::hexaToDecimal(sHexaNumber);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::hexaToDecimal(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptHexaToDecimal;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptHexaToDecimal::_iCounter = 0;


class ExprScriptHostToNetworkLong : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptHostToNetworkLong() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptHostToNetworkLong() {	}

	virtual const char* getName() const { return "hostToNetworkLong"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sBytes = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::hostToNetworkLong(sBytes);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::hostToNetworkLong(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptHostToNetworkLong;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptHostToNetworkLong::_iCounter = 0;


class ExprScriptHostToNetworkShort : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptHostToNetworkShort() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptHostToNetworkShort() {	}

	virtual const char* getName() const { return "hostToNetworkShort"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sBytes = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::hostToNetworkShort(sBytes);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::hostToNetworkShort(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptHostToNetworkShort;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptHostToNetworkShort::_iCounter = 0;


class ExprScriptIncrement : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptIncrement() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptIncrement() {	}

	virtual const char* getName() const { return "increment"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pNumber = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		double dNumber = pNumber->getDoubleValue();
		double returnValue = CGRuntime::increment(dNumber);
		pNumber->setValue(dNumber);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::increment(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptIncrement;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptIncrement::_iCounter = 0;


class ExprScriptIndentFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptIndentFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptIndentFile() {	}

	virtual const char* getName() const { return "indentFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFile = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::indentFile(sFile);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::indentFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptIndentFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptIndentFile::_iCounter = 0;


class ExprScriptInf : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptInf() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptInf() {	}

	virtual const char* getName() const { return "inf"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLeft = (*cursor)->getValue(visibility);
		double dLeft = atof(sLeft.c_str());
		++cursor;
		std::string sRight = (*cursor)->getValue(visibility);
		double dRight = atof(sRight.c_str());
		bool returnValue = CGRuntime::inf(dLeft, dRight);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::inf(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptInf;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptInf::_iCounter = 0;


class ExprScriptInputKey : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptInputKey() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptInputKey() {	}

	virtual const char* getName() const { return "inputKey"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sEcho = (*cursor)->getValue(visibility);
		bool bEcho = !sEcho.empty();
		std::string returnValue = CGRuntime::inputKey(bEcho);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::inputKey(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppBoolean(theCompilerEnvironment, false);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptInputKey;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptInputKey::_iCounter = 0;


class ExprScriptInputLine : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptInputLine() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptInputLine() {	}

	virtual const char* getName() const { return "inputLine"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sEcho = (*cursor)->getValue(visibility);
		bool bEcho = !sEcho.empty();
		std::string returnValue = CGRuntime::inputLine(bEcho);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::inputLine(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppBoolean(theCompilerEnvironment, false);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptInputLine;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptInputLine::_iCounter = 0;


class ExprScriptIsEmpty : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptIsEmpty() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptIsEmpty() {	}

	virtual const char* getName() const { return "isEmpty"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pArray = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		bool returnValue = CGRuntime::isEmpty(pArray);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::isEmpty(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptIsEmpty;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptIsEmpty::_iCounter = 0;


class ExprScriptIsIdentifier : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptIsIdentifier() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptIsIdentifier() {	}

	virtual const char* getName() const { return "isIdentifier"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sIdentifier = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::isIdentifier(sIdentifier);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::isIdentifier(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptIsIdentifier;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptIsIdentifier::_iCounter = 0;


class ExprScriptIsNegative : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptIsNegative() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptIsNegative() {	}

	virtual const char* getName() const { return "isNegative"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sNumber = (*cursor)->getValue(visibility);
		double dNumber = atof(sNumber.c_str());
		bool returnValue = CGRuntime::isNegative(dNumber);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::isNegative(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptIsNegative;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptIsNegative::_iCounter = 0;


class ExprScriptIsPositive : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptIsPositive() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptIsPositive() {	}

	virtual const char* getName() const { return "isPositive"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sNumber = (*cursor)->getValue(visibility);
		double dNumber = atof(sNumber.c_str());
		bool returnValue = CGRuntime::isPositive(dNumber);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::isPositive(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptIsPositive;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptIsPositive::_iCounter = 0;


class ExprScriptJoinStrings : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptJoinStrings() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptJoinStrings() {	}

	virtual const char* getName() const { return "joinStrings"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pList = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sSeparator = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::joinStrings(pList, sSeparator);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::joinStrings(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptJoinStrings;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptJoinStrings::_iCounter = 0;


class ExprScriptLeftString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLeftString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLeftString() {	}

	virtual const char* getName() const { return "leftString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::leftString(sText, iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::leftString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptLeftString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLeftString::_iCounter = 0;


class ExprScriptLengthString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLengthString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLengthString() {	}

	virtual const char* getName() const { return "lengthString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::lengthString(sText);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::lengthString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptLengthString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLengthString::_iCounter = 0;


class ExprScriptLoadBinaryFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLoadBinaryFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLoadBinaryFile() {	}

	virtual const char* getName() const { return "loadBinaryFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFile = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::loadBinaryFile(sFile);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::loadBinaryFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptLoadBinaryFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLoadBinaryFile::_iCounter = 0;


class ExprScriptLoadFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLoadFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLoadFile() {	}

	virtual const char* getName() const { return "loadFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFile = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::loadFile(sFile);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::loadFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptLoadFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLoadFile::_iCounter = 0;


class ExprScriptLoadVirtualFile : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLoadVirtualFile() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLoadVirtualFile() {	}

	virtual const char* getName() const { return "loadVirtualFile"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sHandle = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::loadVirtualFile(sHandle);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::loadVirtualFile(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptLoadVirtualFile;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLoadVirtualFile::_iCounter = 0;


class ExprScriptLog : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLog() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLog() {	}

	virtual const char* getName() const { return "log"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sX = (*cursor)->getValue(visibility);
		double dX = atof(sX.c_str());
		double returnValue = CGRuntime::log(dX);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::log(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptLog;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLog::_iCounter = 0;


class ExprScriptLongToBytes : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLongToBytes() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLongToBytes() {	}

	virtual const char* getName() const { return "longToBytes"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLong = (*cursor)->getValue(visibility);
		char* tcLong;
		unsigned long ulLong = strtoul(sLong.c_str(), &tcLong, 10);
		std::string returnValue = CGRuntime::longToBytes(ulLong);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::longToBytes(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppUnsignedLong(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptLongToBytes;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLongToBytes::_iCounter = 0;


class ExprScriptMidString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptMidString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptMidString() {	}

	virtual const char* getName() const { return "midString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPos = (*cursor)->getValue(visibility);
		int iPos = atoi(sPos.c_str());
		++cursor;
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::midString(sText, iPos, iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::midString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptMidString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptMidString::_iCounter = 0;


class ExprScriptMod : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptMod() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptMod() {	}

	virtual const char* getName() const { return "mod"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sDividend = (*cursor)->getValue(visibility);
		int iDividend = atoi(sDividend.c_str());
		++cursor;
		std::string sDivisor = (*cursor)->getValue(visibility);
		int iDivisor = atoi(sDivisor.c_str());
		int returnValue = CGRuntime::mod(iDividend, iDivisor);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::mod(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptMod;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptMod::_iCounter = 0;


class ExprScriptMult : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptMult() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptMult() {	}

	virtual const char* getName() const { return "mult"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLeft = (*cursor)->getValue(visibility);
		double dLeft = atof(sLeft.c_str());
		++cursor;
		std::string sRight = (*cursor)->getValue(visibility);
		double dRight = atof(sRight.c_str());
		double returnValue = CGRuntime::mult(dLeft, dRight);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::mult(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptMult;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptMult::_iCounter = 0;


class ExprScriptNetworkLongToHost : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptNetworkLongToHost() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptNetworkLongToHost() {	}

	virtual const char* getName() const { return "networkLongToHost"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sBytes = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::networkLongToHost(sBytes);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::networkLongToHost(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptNetworkLongToHost;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptNetworkLongToHost::_iCounter = 0;


class ExprScriptNetworkShortToHost : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptNetworkShortToHost() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptNetworkShortToHost() {	}

	virtual const char* getName() const { return "networkShortToHost"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sBytes = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::networkShortToHost(sBytes);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::networkShortToHost(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptNetworkShortToHost;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptNetworkShortToHost::_iCounter = 0;


class ExprScriptOctalToDecimal : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptOctalToDecimal() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptOctalToDecimal() {	}

	virtual const char* getName() const { return "octalToDecimal"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sOctalNumber = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::octalToDecimal(sOctalNumber);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::octalToDecimal(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptOctalToDecimal;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptOctalToDecimal::_iCounter = 0;


class ExprScriptParseFreeQuiet : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptParseFreeQuiet(GrfBlock& block) {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
//##protect##"parseFreeQuiet::constructor"
		_pParseFree = new GrfParseFree;
		_pParseFree->setParent(&block);
//##protect##"parseFreeQuiet::constructor"
	}


private:
//##protect##"parseFreeQuiet::attributes"
	GrfParseFree* _pParseFree;
//##protect##"parseFreeQuiet::attributes"

public:
    virtual ~ExprScriptParseFreeQuiet() {
//##protect##"parseFreeQuiet::destructor"
		delete _pParseFree;
//##protect##"parseFreeQuiet::destructor"
	}

	virtual const char* getName() const { return "parseFreeQuiet"; }
	virtual void initializationDone() {
//##protect##"parseFreeQuiet::initializationDone"
		_pParseFree->setDesignFileName(_parameters[0]);
		_pParseFree->setThis((ExprScriptVariable*) _parameters[1]);
		_pParseFree->setInputFileName(_parameters[2]);
		_parameters = std::vector<ExprScriptExpression*>();
//##protect##"parseFreeQuiet::initializationDone"
	}


    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue;
//##protect##"parseFreeQuiet::execute"
		CGQuietOutput quiet;
		_pParseFree->execute(visibility);
		returnValue = quiet.getOutput();
//##protect##"parseFreeQuiet::execute"
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
//##protect##"parseFreeQuiet::compileCppString"
		int iCursor = theCompilerEnvironment.newCursor();
		char tcFunction[80];
		sprintf(tcFunction, "_compiler_internal_parseFreeQuiet%d", iCursor);
		std::string sDefinition = "std::string ";
		sDefinition += tcFunction;
		sDefinition += "(CppParsingTree_var pThisTree, const std::string& sFilename) {\n";
		sDefinition += "\tCGQuietOutput quiet;\n";
		ScpStream* pOwner;
		CW_BODY_STREAM.insertText(sDefinition, CW_BODY_STREAM.getFloatingLocation("INSERT AREA", pOwner));
		CW_BODY_STREAM << tcFunction << "(";
		_pParseFree->getThis()->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		_pParseFree->getInputFileName()->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		int iLocation = CW_BODY_STREAM.getOutputLocation();
		_pParseFree->compileCppForQuiet(theCompilerEnvironment);
		sDefinition = CW_BODY_STREAM.readBuffer() + iLocation;
		CW_BODY_STREAM.resize(iLocation);
		sDefinition += "\treturn quiet.getOutput();\n}\n";
		CW_BODY_STREAM.insertText(sDefinition, CW_BODY_STREAM.getFloatingLocation("INSERT AREA", pOwner));
//##protect##"parseFreeQuiet::compileCppString"
		return true;
	}

	static ExprScriptFunction* create(GrfBlock& block, int& iArity) {
        iArity = 3;
        return new ExprScriptParseFreeQuiet(block);
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptParseFreeQuiet::_iCounter = 0;


class ExprScriptPathFromPackage : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptPathFromPackage() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptPathFromPackage() {	}

	virtual const char* getName() const { return "pathFromPackage"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPackage = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::pathFromPackage(sPackage);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::pathFromPackage(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptPathFromPackage;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptPathFromPackage::_iCounter = 0;


class ExprScriptPostHTTPRequest : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptPostHTTPRequest() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptPostHTTPRequest() {	}

	virtual const char* getName() const { return "postHTTPRequest"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sURL = (*cursor)->getValue(visibility);
		++cursor;
		DtaScriptVariable* pHTTPSession = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		DtaScriptVariable* pArguments = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string returnValue = CGRuntime::postHTTPRequest(sURL, pHTTPSession, pArguments);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::postHTTPRequest(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptPostHTTPRequest;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptPostHTTPRequest::_iCounter = 0;


class ExprScriptPow : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptPow() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptPow() {	}

	virtual const char* getName() const { return "pow"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sX = (*cursor)->getValue(visibility);
		double dX = atof(sX.c_str());
		++cursor;
		std::string sY = (*cursor)->getValue(visibility);
		double dY = atof(sY.c_str());
		double returnValue = CGRuntime::pow(dX, dY);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::pow(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptPow;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptPow::_iCounter = 0;


class ExprScriptRandomInteger : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRandomInteger() {
	}

public:
    virtual ~ExprScriptRandomInteger() {	}

	virtual const char* getName() const { return "randomInteger"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::randomInteger();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::randomInteger(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptRandomInteger;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRandomInteger::_iCounter = 0;


class ExprScriptReceiveBinaryFromSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReceiveBinaryFromSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReceiveBinaryFromSocket() {	}

	virtual const char* getName() const { return "receiveBinaryFromSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSocket = (*cursor)->getValue(visibility);
		int iSocket = atoi(sSocket.c_str());
		++cursor;
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::receiveBinaryFromSocket(iSocket, iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::receiveBinaryFromSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptReceiveBinaryFromSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReceiveBinaryFromSocket::_iCounter = 0;


class ExprScriptReceiveFromSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReceiveFromSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReceiveFromSocket() {	}

	virtual const char* getName() const { return "receiveFromSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSocket = (*cursor)->getValue(visibility);
		int iSocket = atoi(sSocket.c_str());
		++cursor;
		DtaScriptVariable* pIsText = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		bool bIsText = pIsText->getBooleanValue();
		std::string returnValue = CGRuntime::receiveFromSocket(iSocket, bIsText);
		pIsText->setValue(bIsText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::receiveFromSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptReceiveFromSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReceiveFromSocket::_iCounter = 0;


class ExprScriptReceiveTextFromSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReceiveTextFromSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReceiveTextFromSocket() {	}

	virtual const char* getName() const { return "receiveTextFromSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSocket = (*cursor)->getValue(visibility);
		int iSocket = atoi(sSocket.c_str());
		++cursor;
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::receiveTextFromSocket(iSocket, iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::receiveTextFromSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptReceiveTextFromSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReceiveTextFromSocket::_iCounter = 0;


class ExprScriptRelativePath : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRelativePath() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRelativePath() {	}

	virtual const char* getName() const { return "relativePath"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPath = (*cursor)->getValue(visibility);
		++cursor;
		std::string sReference = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::relativePath(sPath, sReference);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::relativePath(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptRelativePath;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRelativePath::_iCounter = 0;


class ExprScriptRemoveDirectory : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRemoveDirectory() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRemoveDirectory() {	}

	virtual const char* getName() const { return "removeDirectory"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sPath = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::removeDirectory(sPath);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::removeDirectory(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptRemoveDirectory;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRemoveDirectory::_iCounter = 0;


class ExprScriptRemoveGenerationTagsHandler : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRemoveGenerationTagsHandler() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRemoveGenerationTagsHandler() {	}

	virtual const char* getName() const { return "removeGenerationTagsHandler"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sKey = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::removeGenerationTagsHandler(sKey);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::removeGenerationTagsHandler(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptRemoveGenerationTagsHandler;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRemoveGenerationTagsHandler::_iCounter = 0;


class ExprScriptRepeatString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRepeatString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRepeatString() {	}

	virtual const char* getName() const { return "repeatString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sOccurrences = (*cursor)->getValue(visibility);
		int iOccurrences = atoi(sOccurrences.c_str());
		std::string returnValue = CGRuntime::repeatString(sText, iOccurrences);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::repeatString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptRepeatString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRepeatString::_iCounter = 0;


class ExprScriptReplaceString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReplaceString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReplaceString() {	}

	virtual const char* getName() const { return "replaceString"; }
	virtual int getThisPosition() const { return 2; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sOld = (*cursor)->getValue(visibility);
		++cursor;
		std::string sNew = (*cursor)->getValue(visibility);
		++cursor;
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::replaceString(sOld, sNew, sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::replaceString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptReplaceString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReplaceString::_iCounter = 0;


class ExprScriptReplaceTabulations : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReplaceTabulations() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReplaceTabulations() {	}

	virtual const char* getName() const { return "replaceTabulations"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sTab = (*cursor)->getValue(visibility);
		int iTab = atoi(sTab.c_str());
		std::string returnValue = CGRuntime::replaceTabulations(sText, iTab);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::replaceTabulations(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptReplaceTabulations;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReplaceTabulations::_iCounter = 0;


class ExprScriptResolveFilePath : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptResolveFilePath() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptResolveFilePath() {	}

	virtual const char* getName() const { return "resolveFilePath"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sFilename = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::resolveFilePath(sFilename);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::resolveFilePath(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptResolveFilePath;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptResolveFilePath::_iCounter = 0;


class ExprScriptRightString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRightString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRightString() {	}

	virtual const char* getName() const { return "rightString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::rightString(sText, iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::rightString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptRightString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRightString::_iCounter = 0;


class ExprScriptRsubString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRsubString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRsubString() {	}

	virtual const char* getName() const { return "rsubString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPos = (*cursor)->getValue(visibility);
		int iPos = atoi(sPos.c_str());
		std::string returnValue = CGRuntime::rsubString(sText, iPos);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::rsubString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptRsubString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRsubString::_iCounter = 0;


class ExprScriptScanDirectories : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptScanDirectories() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptScanDirectories() {	}

	virtual const char* getName() const { return "scanDirectories"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pDirectory = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sPath = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPattern = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::scanDirectories(pDirectory, sPath, sPattern);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::scanDirectories(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 3;
        return new ExprScriptScanDirectories;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptScanDirectories::_iCounter = 0;


class ExprScriptScanFiles : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptScanFiles() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptScanFiles() {	}

	virtual const char* getName() const { return "scanFiles"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pFiles = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sPath = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPattern = (*cursor)->getValue(visibility);
		++cursor;
		std::string sSubfolders = (*cursor)->getValue(visibility);
		bool bSubfolders = !sSubfolders.empty();
		bool returnValue = CGRuntime::scanFiles(pFiles, sPath, sPattern, bSubfolders);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::scanFiles(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppBoolean(theCompilerEnvironment, false);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 4;
        return new ExprScriptScanFiles;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptScanFiles::_iCounter = 0;


class ExprScriptSendBinaryToSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSendBinaryToSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSendBinaryToSocket() {	}

	virtual const char* getName() const { return "sendBinaryToSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSocket = (*cursor)->getValue(visibility);
		int iSocket = atoi(sSocket.c_str());
		++cursor;
		std::string sBytes = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::sendBinaryToSocket(iSocket, sBytes);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::sendBinaryToSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptSendBinaryToSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSendBinaryToSocket::_iCounter = 0;


class ExprScriptSendHTTPRequest : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSendHTTPRequest() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSendHTTPRequest() {	}

	virtual const char* getName() const { return "sendHTTPRequest"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sURL = (*cursor)->getValue(visibility);
		++cursor;
		DtaScriptVariable* pHTTPSession = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string returnValue = CGRuntime::sendHTTPRequest(sURL, pHTTPSession);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::sendHTTPRequest(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptSendHTTPRequest;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSendHTTPRequest::_iCounter = 0;


class ExprScriptSendTextToSocket : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSendTextToSocket() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSendTextToSocket() {	}

	virtual const char* getName() const { return "sendTextToSocket"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sSocket = (*cursor)->getValue(visibility);
		int iSocket = atoi(sSocket.c_str());
		++cursor;
		std::string sText = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::sendTextToSocket(iSocket, sText);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::sendTextToSocket(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptSendTextToSocket;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSendTextToSocket::_iCounter = 0;


class ExprScriptSelectGenerationTagsHandler : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSelectGenerationTagsHandler() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSelectGenerationTagsHandler() {	}

	virtual const char* getName() const { return "selectGenerationTagsHandler"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sKey = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::selectGenerationTagsHandler(sKey);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::selectGenerationTagsHandler(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptSelectGenerationTagsHandler;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSelectGenerationTagsHandler::_iCounter = 0;


class ExprScriptShortToBytes : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptShortToBytes() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptShortToBytes() {	}

	virtual const char* getName() const { return "shortToBytes"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sShort = (*cursor)->getValue(visibility);
		unsigned short ulShort = (unsigned short) atoi(sShort.c_str());
		std::string returnValue = CGRuntime::shortToBytes(ulShort);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::shortToBytes(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppUnsignedShort(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptShortToBytes;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptShortToBytes::_iCounter = 0;


class ExprScriptStartString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptStartString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptStartString() {	}

	virtual const char* getName() const { return "startString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sStart = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::startString(sText, sStart);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::startString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptStartString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptStartString::_iCounter = 0;


class ExprScriptSub : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSub() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSub() {	}

	virtual const char* getName() const { return "sub"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLeft = (*cursor)->getValue(visibility);
		double dLeft = atof(sLeft.c_str());
		++cursor;
		std::string sRight = (*cursor)->getValue(visibility);
		double dRight = atof(sRight.c_str());
		double returnValue = CGRuntime::sub(dLeft, dRight);
		return CGRuntime::toString(returnValue);
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppDouble(theCompilerEnvironment);
		return DOUBLE_TYPE;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(int) ";
		return compileCppDouble(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppDouble(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::sub(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptSub;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSub::_iCounter = 0;


class ExprScriptSubString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSubString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSubString() {	}

	virtual const char* getName() const { return "subString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		++cursor;
		std::string sPos = (*cursor)->getValue(visibility);
		int iPos = atoi(sPos.c_str());
		std::string returnValue = CGRuntime::subString(sText, iPos);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::subString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptSubString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSubString::_iCounter = 0;


class ExprScriptSup : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSup() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSup() {	}

	virtual const char* getName() const { return "sup"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLeft = (*cursor)->getValue(visibility);
		double dLeft = atof(sLeft.c_str());
		++cursor;
		std::string sRight = (*cursor)->getValue(visibility);
		double dRight = atof(sRight.c_str());
		bool returnValue = CGRuntime::sup(dLeft, dRight);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::sup(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppDouble(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptSup;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSup::_iCounter = 0;


class ExprScriptSystem : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSystem() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptSystem() {	}

	virtual const char* getName() const { return "system"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sCommand = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::system(sCommand);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::system(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptSystem;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSystem::_iCounter = 0;


class ExprScriptToLowerString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptToLowerString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptToLowerString() {	}

	virtual const char* getName() const { return "toLowerString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::toLowerString(sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toLowerString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptToLowerString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptToLowerString::_iCounter = 0;


class ExprScriptToUpperString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptToUpperString() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptToUpperString() {	}

	virtual const char* getName() const { return "toUpperString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::toUpperString(sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toUpperString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptToUpperString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptToUpperString::_iCounter = 0;


class ExprScriptTranslateString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptTranslateString(GrfBlock& block) {
		_parameterTypes.push_back(SCRIPTFILE_TRANSLATE_EXPRTYPE);
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
//##protect##"translateString::constructor"
		_pTranslateString = new GrfTranslate;
		_pTranslateString->setParent(&block);
//##protect##"translateString::constructor"
	}


private:
//##protect##"translateString::attributes"
	GrfTranslate* _pTranslateString;
//##protect##"translateString::attributes"

public:
    virtual ~ExprScriptTranslateString() {
//##protect##"translateString::destructor"
		delete _pTranslateString;
//##protect##"translateString::destructor"
	}

	virtual const char* getName() const { return "translateString"; }
	virtual void initializationDone() {
//##protect##"translateString::initializationDone"
		_pTranslateString->setPatternFileName((ExprScriptScriptFile*) _parameters[0]);
		_pTranslateString->setThis((ExprScriptVariable*) _parameters[1]);
		_pTranslateString->setInputFileName(_parameters[2]);
		_parameters = std::vector<ExprScriptExpression*>();
//##protect##"translateString::initializationDone"
	}


    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue;
//##protect##"translateString::execute"
		returnValue = _pTranslateString->translateString(visibility);
//##protect##"translateString::execute"
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
//##protect##"translateString::compileCppString"
//##protect##"translateString::compileCppString"
		return true;
	}

	static ExprScriptFunction* create(GrfBlock& block, int& iArity) {
        iArity = 3;
        return new ExprScriptTranslateString(block);
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptTranslateString::_iCounter = 0;


class ExprScriptTrimLeft : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptTrimLeft() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptTrimLeft() {	}

	virtual const char* getName() const { return "trimLeft"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pString = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sString;
		const char* tsString = pString->getValue();
		if (tsString != 0L) sString = tsString;
		int returnValue = CGRuntime::trimLeft(sString);
		pString->setValue(sString.c_str());
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::trimLeft(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptTrimLeft;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptTrimLeft::_iCounter = 0;


class ExprScriptTrimRight : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptTrimRight() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptTrimRight() {	}

	virtual const char* getName() const { return "trimRight"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pString = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sString;
		const char* tsString = pString->getValue();
		if (tsString != 0L) sString = tsString;
		int returnValue = CGRuntime::trimRight(sString);
		pString->setValue(sString.c_str());
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::trimRight(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptTrimRight;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptTrimRight::_iCounter = 0;


class ExprScriptTrim : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptTrim() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptTrim() {	}

	virtual const char* getName() const { return "trim"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pString = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sString;
		const char* tsString = pString->getValue();
		if (tsString != 0L) sString = tsString;
		int returnValue = CGRuntime::trim(sString);
		pString->setValue(sString.c_str());
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::trim(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptTrim;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptTrim::_iCounter = 0;


class ExprScriptTruncateAfterString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptTruncateAfterString() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptTruncateAfterString() {	}

	virtual const char* getName() const { return "truncateAfterString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pVariable = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::truncateAfterString(pVariable, sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::truncateAfterString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptTruncateAfterString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptTruncateAfterString::_iCounter = 0;


class ExprScriptTruncateBeforeString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptTruncateBeforeString() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptTruncateBeforeString() {	}

	virtual const char* getName() const { return "truncateBeforeString"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pVariable = visibility.getExistingVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		++cursor;
		std::string sText = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::truncateBeforeString(pVariable, sText);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::truncateBeforeString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptTruncateBeforeString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptTruncateBeforeString::_iCounter = 0;


class ExprScriptUUID : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptUUID() {
	}

public:
    virtual ~ExprScriptUUID() {	}

	virtual const char* getName() const { return "UUID"; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::UUID();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::UUID(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptUUID;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptUUID::_iCounter = 0;


class ExprScriptCountInputCols : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCountInputCols() {
	}

public:
    virtual ~ExprScriptCountInputCols() {	}

	virtual const char* getName() const { return "countInputCols"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::countInputCols();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::countInputCols(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptCountInputCols;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCountInputCols::_iCounter = 0;


class ExprScriptCountInputLines : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCountInputLines() {
	}

public:
    virtual ~ExprScriptCountInputLines() {	}

	virtual const char* getName() const { return "countInputLines"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::countInputLines();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::countInputLines(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptCountInputLines;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCountInputLines::_iCounter = 0;


class ExprScriptGetInputFilename : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetInputFilename() {
	}

public:
    virtual ~ExprScriptGetInputFilename() {	}

	virtual const char* getName() const { return "getInputFilename"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getInputFilename();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getInputFilename(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetInputFilename;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetInputFilename::_iCounter = 0;


class ExprScriptGetLastReadChars : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetLastReadChars() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetLastReadChars() {	}

	virtual const char* getName() const { return "getLastReadChars"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::getLastReadChars(iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getLastReadChars(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetLastReadChars;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetLastReadChars::_iCounter = 0;


class ExprScriptGetInputLocation : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetInputLocation() {
	}

public:
    virtual ~ExprScriptGetInputLocation() {	}

	virtual const char* getName() const { return "getInputLocation"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::getInputLocation();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getInputLocation(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetInputLocation;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetInputLocation::_iCounter = 0;


class ExprScriptLookAhead : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptLookAhead() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptLookAhead() {	}

	virtual const char* getName() const { return "lookAhead"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::lookAhead(sText);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::lookAhead(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptLookAhead;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptLookAhead::_iCounter = 0;


class ExprScriptPeekChar : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptPeekChar() {
	}

public:
    virtual ~ExprScriptPeekChar() {	}

	virtual const char* getName() const { return "peekChar"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::peekChar();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::peekChar(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptPeekChar;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptPeekChar::_iCounter = 0;


class ExprScriptReadAdaString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadAdaString() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadAdaString() {	}

	virtual const char* getName() const { return "readAdaString"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pText = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sText;
		const char* tsText = pText->getValue();
		if (tsText != 0L) sText = tsText;
		bool returnValue = CGRuntime::readAdaString(sText);
		pText->setValue(sText.c_str());
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readAdaString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadAdaString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadAdaString::_iCounter = 0;


class ExprScriptReadByte : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadByte() {
	}

public:
    virtual ~ExprScriptReadByte() {	}

	virtual const char* getName() const { return "readByte"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::readByte();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readByte(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptReadByte;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadByte::_iCounter = 0;


class ExprScriptReadBytes : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadBytes() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadBytes() {	}

	virtual const char* getName() const { return "readBytes"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::readBytes(iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readBytes(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadBytes;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadBytes::_iCounter = 0;


class ExprScriptReadCChar : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadCChar() {
	}

public:
    virtual ~ExprScriptReadCChar() {	}

	virtual const char* getName() const { return "readCChar"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::readCChar();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readCChar(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptReadCChar;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadCChar::_iCounter = 0;


class ExprScriptReadChar : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadChar() {
	}

public:
    virtual ~ExprScriptReadChar() {	}

	virtual const char* getName() const { return "readChar"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::readChar();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readChar(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptReadChar;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadChar::_iCounter = 0;


class ExprScriptReadCharAsInt : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadCharAsInt() {
	}

public:
    virtual ~ExprScriptReadCharAsInt() {	}

	virtual const char* getName() const { return "readCharAsInt"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::readCharAsInt();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readCharAsInt(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptReadCharAsInt;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadCharAsInt::_iCounter = 0;


class ExprScriptReadChars : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadChars() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadChars() {	}

	virtual const char* getName() const { return "readChars"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sLength = (*cursor)->getValue(visibility);
		int iLength = atoi(sLength.c_str());
		std::string returnValue = CGRuntime::readChars(iLength);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readChars(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadChars;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadChars::_iCounter = 0;


class ExprScriptReadIdentifier : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadIdentifier() {
	}

public:
    virtual ~ExprScriptReadIdentifier() {	}

	virtual const char* getName() const { return "readIdentifier"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::readIdentifier();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readIdentifier(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptReadIdentifier;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadIdentifier::_iCounter = 0;


class ExprScriptReadIfEqualTo : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadIfEqualTo() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadIfEqualTo() {	}

	virtual const char* getName() const { return "readIfEqualTo"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::readIfEqualTo(sText);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readIfEqualTo(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadIfEqualTo;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadIfEqualTo::_iCounter = 0;


class ExprScriptReadIfEqualToIgnoreCase : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadIfEqualToIgnoreCase() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadIfEqualToIgnoreCase() {	}

	virtual const char* getName() const { return "readIfEqualToIgnoreCase"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::readIfEqualToIgnoreCase(sText);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readIfEqualToIgnoreCase(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadIfEqualToIgnoreCase;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadIfEqualToIgnoreCase::_iCounter = 0;


class ExprScriptReadIfEqualToIdentifier : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadIfEqualToIdentifier() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadIfEqualToIdentifier() {	}

	virtual const char* getName() const { return "readIfEqualToIdentifier"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sIdentifier = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::readIfEqualToIdentifier(sIdentifier);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readIfEqualToIdentifier(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadIfEqualToIdentifier;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadIfEqualToIdentifier::_iCounter = 0;


class ExprScriptReadLine : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadLine() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadLine() {	}

	virtual const char* getName() const { return "readLine"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pText = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sText;
		const char* tsText = pText->getValue();
		if (tsText != 0L) sText = tsText;
		bool returnValue = CGRuntime::readLine(sText);
		pText->setValue(sText.c_str());
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readLine(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadLine;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadLine::_iCounter = 0;


class ExprScriptReadNextText : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadNextText() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadNextText() {	}

	virtual const char* getName() const { return "readNextText"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sText = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::readNextText(sText);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readNextText(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadNextText;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadNextText::_iCounter = 0;


class ExprScriptReadNumber : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadNumber() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadNumber() {	}

	virtual const char* getName() const { return "readNumber"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pNumber = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		double dNumber = pNumber->getDoubleValue();
		bool returnValue = CGRuntime::readNumber(dNumber);
		pNumber->setValue(dNumber);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readNumber(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadNumber;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadNumber::_iCounter = 0;


class ExprScriptReadString : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadString() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadString() {	}

	virtual const char* getName() const { return "readString"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pText = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		std::string sText;
		const char* tsText = pText->getValue();
		if (tsText != 0L) sText = tsText;
		bool returnValue = CGRuntime::readString(sText);
		pText->setValue(sText.c_str());
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::readString(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		dynamic_cast<ExprScriptVariable*>(*cursor)->compileCppForSet(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadString;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadString::_iCounter = 0;


class ExprScriptReadUptoJustOneChar : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadUptoJustOneChar() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptReadUptoJustOneChar() {	}

	virtual const char* getName() const { return "readUptoJustOneChar"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sOneAmongChars = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::readUptoJustOneChar(sOneAmongChars);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readUptoJustOneChar(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptReadUptoJustOneChar;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadUptoJustOneChar::_iCounter = 0;


class ExprScriptReadWord : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptReadWord() {
	}

public:
    virtual ~ExprScriptReadWord() {	}

	virtual const char* getName() const { return "readWord"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::readWord();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::readWord(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptReadWord;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptReadWord::_iCounter = 0;


class ExprScriptSkipBlanks : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSkipBlanks() {
	}

public:
    virtual ~ExprScriptSkipBlanks() {	}

	virtual const char* getName() const { return "skipBlanks"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		bool returnValue = CGRuntime::skipBlanks();
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::skipBlanks(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptSkipBlanks;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSkipBlanks::_iCounter = 0;


class ExprScriptSkipEmptyCpp : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSkipEmptyCpp() {
	}

public:
    virtual ~ExprScriptSkipEmptyCpp() {	}

	virtual const char* getName() const { return "skipEmptyCpp"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		bool returnValue = CGRuntime::skipEmptyCpp();
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::skipEmptyCpp(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptSkipEmptyCpp;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSkipEmptyCpp::_iCounter = 0;


class ExprScriptSkipEmptyCppExceptDoxygen : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSkipEmptyCppExceptDoxygen() {
	}

public:
    virtual ~ExprScriptSkipEmptyCppExceptDoxygen() {	}

	virtual const char* getName() const { return "skipEmptyCppExceptDoxygen"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		bool returnValue = CGRuntime::skipEmptyCppExceptDoxygen();
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::skipEmptyCppExceptDoxygen(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptSkipEmptyCppExceptDoxygen;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSkipEmptyCppExceptDoxygen::_iCounter = 0;


class ExprScriptSkipEmptyHTML : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSkipEmptyHTML() {
	}

public:
    virtual ~ExprScriptSkipEmptyHTML() {	}

	virtual const char* getName() const { return "skipEmptyHTML"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		bool returnValue = CGRuntime::skipEmptyHTML();
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::skipEmptyHTML(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptSkipEmptyHTML;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSkipEmptyHTML::_iCounter = 0;


class ExprScriptSkipEmptyLaTeX : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptSkipEmptyLaTeX() {
	}

public:
    virtual ~ExprScriptSkipEmptyLaTeX() {	}

	virtual const char* getName() const { return "skipEmptyLaTeX"; }
	virtual bool isAParseFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		bool returnValue = CGRuntime::skipEmptyLaTeX();
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::skipEmptyLaTeX(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptSkipEmptyLaTeX;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptSkipEmptyLaTeX::_iCounter = 0;


class ExprScriptCountOutputCols : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCountOutputCols() {
	}

public:
    virtual ~ExprScriptCountOutputCols() {	}

	virtual const char* getName() const { return "countOutputCols"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::countOutputCols();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::countOutputCols(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptCountOutputCols;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCountOutputCols::_iCounter = 0;


class ExprScriptCountOutputLines : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptCountOutputLines() {
	}

public:
    virtual ~ExprScriptCountOutputLines() {	}

	virtual const char* getName() const { return "countOutputLines"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::countOutputLines();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::countOutputLines(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptCountOutputLines;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptCountOutputLines::_iCounter = 0;


class ExprScriptExistFloatingLocation : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptExistFloatingLocation() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptExistFloatingLocation() {	}

	virtual const char* getName() const { return "existFloatingLocation"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sKey = (*cursor)->getValue(visibility);
		++cursor;
		std::string sParent = (*cursor)->getValue(visibility);
		bool bParent = !sParent.empty();
		bool returnValue = CGRuntime::existFloatingLocation(sKey, bParent);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::existFloatingLocation(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ", ";
		++cursor;
		(*cursor)->compileCppBoolean(theCompilerEnvironment, false);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 2;
        return new ExprScriptExistFloatingLocation;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptExistFloatingLocation::_iCounter = 0;


class ExprScriptGetFloatingLocation : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetFloatingLocation() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetFloatingLocation() {	}

	virtual const char* getName() const { return "getFloatingLocation"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sKey = (*cursor)->getValue(visibility);
		int returnValue = CGRuntime::getFloatingLocation(sKey);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getFloatingLocation(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetFloatingLocation;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetFloatingLocation::_iCounter = 0;


class ExprScriptGetLastWrittenChars : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetLastWrittenChars() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetLastWrittenChars() {	}

	virtual const char* getName() const { return "getLastWrittenChars"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sNbChars = (*cursor)->getValue(visibility);
		int iNbChars = atoi(sNbChars.c_str());
		std::string returnValue = CGRuntime::getLastWrittenChars(iNbChars);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getLastWrittenChars(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppInt(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetLastWrittenChars;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetLastWrittenChars::_iCounter = 0;


class ExprScriptGetMarkupKey : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetMarkupKey() {
	}

public:
    virtual ~ExprScriptGetMarkupKey() {	}

	virtual const char* getName() const { return "getMarkupKey"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getMarkupKey();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getMarkupKey(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetMarkupKey;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetMarkupKey::_iCounter = 0;


class ExprScriptGetMarkupValue : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetMarkupValue() {
	}

public:
    virtual ~ExprScriptGetMarkupValue() {	}

	virtual const char* getName() const { return "getMarkupValue"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getMarkupValue();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getMarkupValue(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetMarkupValue;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetMarkupValue::_iCounter = 0;


class ExprScriptGetOutputFilename : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetOutputFilename() {
	}

public:
    virtual ~ExprScriptGetOutputFilename() {	}

	virtual const char* getName() const { return "getOutputFilename"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::string returnValue = CGRuntime::getOutputFilename();
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getOutputFilename(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetOutputFilename;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetOutputFilename::_iCounter = 0;


class ExprScriptGetOutputLocation : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetOutputLocation() {
	}

public:
    virtual ~ExprScriptGetOutputLocation() {	}

	virtual const char* getName() const { return "getOutputLocation"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		int returnValue = CGRuntime::getOutputLocation();
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getOutputLocation(";
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 0;
        return new ExprScriptGetOutputLocation;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetOutputLocation::_iCounter = 0;


class ExprScriptGetProtectedArea : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetProtectedArea() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetProtectedArea() {	}

	virtual const char* getName() const { return "getProtectedArea"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sProtection = (*cursor)->getValue(visibility);
		std::string returnValue = CGRuntime::getProtectedArea(sProtection);
		return returnValue;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppString(theCompilerEnvironment);
		return STRING_TYPE;
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getProtectedArea(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetProtectedArea;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetProtectedArea::_iCounter = 0;


class ExprScriptGetProtectedAreaKeys : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptGetProtectedAreaKeys() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptGetProtectedAreaKeys() {	}

	virtual const char* getName() const { return "getProtectedAreaKeys"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pKeys = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		int returnValue = CGRuntime::getProtectedAreaKeys(pKeys);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::getProtectedAreaKeys(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptGetProtectedAreaKeys;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptGetProtectedAreaKeys::_iCounter = 0;


class ExprScriptIndentText : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptIndentText() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptIndentText() {	}

	virtual const char* getName() const { return "indentText"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sMode = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::indentText(sMode);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::indentText(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptIndentText;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptIndentText::_iCounter = 0;


class ExprScriptNewFloatingLocation : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptNewFloatingLocation() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptNewFloatingLocation() {	}

	virtual const char* getName() const { return "newFloatingLocation"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sKey = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::newFloatingLocation(sKey);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::newFloatingLocation(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptNewFloatingLocation;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptNewFloatingLocation::_iCounter = 0;


class ExprScriptRemainingProtectedAreas : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRemainingProtectedAreas() {
		_parameterTypes.push_back(VARIABLE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRemainingProtectedAreas() {	}

	virtual const char* getName() const { return "remainingProtectedAreas"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		DtaScriptVariable* pKeys = visibility.getVariable(*dynamic_cast<ExprScriptVariable*>(*cursor));
		int returnValue = CGRuntime::remainingProtectedAreas(pKeys);
		char tcNumber[16];
		sprintf(tcNumber, "%d", returnValue);
		return tcNumber;
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppInt(theCompilerEnvironment);
		return INT_TYPE;
	}

	virtual bool compileCppDouble(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "(double) ";
		return compileCppInt(theCompilerEnvironment);
	}

	virtual bool compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::toString(";
		bool bSuccess = compileCppInt(theCompilerEnvironment);
		if (bSuccess) CW_BODY_STREAM << ")";
		return bSuccess;
	}

	virtual bool compileCppInt(CppCompilerEnvironment& theCompilerEnvironment) const {
		CW_BODY_STREAM << "CGRuntime::remainingProtectedAreas(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptRemainingProtectedAreas;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRemainingProtectedAreas::_iCounter = 0;


class ExprScriptRemoveProtectedArea : public ExprScriptFunction {
private:
	static unsigned int _iCounter;
    ExprScriptRemoveProtectedArea() {
		_parameterTypes.push_back(VALUE_EXPRTYPE);
	}

public:
    virtual ~ExprScriptRemoveProtectedArea() {	}

	virtual const char* getName() const { return "removeProtectedArea"; }
	virtual bool isAGenerateFunction() const { return true; }

    virtual std::string getValue(DtaScriptVariable& visibility) const {
		_iCounter++;
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		std::string sProtectedAreaName = (*cursor)->getValue(visibility);
		bool returnValue = CGRuntime::removeProtectedArea(sProtectedAreaName);
		return (returnValue ? "true" : "");
    }

	virtual EXPRESSION_RETURN_TYPE compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		compileCppBoolean(theCompilerEnvironment, false);
		return BOOL_TYPE;
	}

	virtual bool compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (bNegative) CW_BODY_STREAM << "!";
		CW_BODY_STREAM << "CGRuntime::removeProtectedArea(";
		std::vector<ExprScriptExpression*>::const_iterator cursor = _parameters.begin();
		(*cursor)->compileCppString(theCompilerEnvironment);
		CW_BODY_STREAM << ")";
		return true;
	}

	static ExprScriptFunction* create(GrfBlock&, int& iArity) {
        iArity = 1;
        return new ExprScriptRemoveProtectedArea;
	}

	static void registerFunction(DtaFunctionInfo& info) {
		info.constructor = create;
		info.pCounter = &_iCounter;
	}
};
unsigned int ExprScriptRemoveProtectedArea::_iCounter = 0;

//##end##"declarations"



	ExprScriptFunction::ExprScriptFunction(GrfFunction* pPrototype) : _pPrototype(pPrototype), _pTemplate(0L), _bIsExternal(false) {
		if (_pPrototype != 0L) {
			_parameterTypes = _pPrototype->getParameterTypes();
		}
	}

	ExprScriptFunction::~ExprScriptFunction() {
		clearParameters();
		delete _pTemplate;
	}

	void ExprScriptFunction::clearParameters() {
		for (std::vector<ExprScriptExpression*>::iterator i = _parameters.begin(); i != _parameters.end(); i++) delete (*i);
		_parameters = std::vector<ExprScriptExpression*>();
	}

std::map<std::string, DtaFunctionInfo>& ExprScriptFunction::getFunctionRegister() {
	static std::map<std::string, DtaFunctionInfo> _functionRegister;
	static bool _bInitialization = false;
	if (!_bInitialization) {
		_bInitialization = true;
//##markup##"registration"
//##begin##"registration"
		ExprScriptFlushOutputToSocket::registerFunction(_functionRegister["flushOutputToSocket"]);
		ExprScriptAcceptSocket::registerFunction(_functionRegister["acceptSocket"]);
		ExprScriptAdd::registerFunction(_functionRegister["add"]);
		ExprScriptAddGenerationTagsHandler::registerFunction(_functionRegister["addGenerationTagsHandler"]);
		ExprScriptByteToChar::registerFunction(_functionRegister["byteToChar"]);
		ExprScriptBytesToLong::registerFunction(_functionRegister["bytesToLong"]);
		ExprScriptBytesToShort::registerFunction(_functionRegister["bytesToShort"]);
		ExprScriptCanonizePath::registerFunction(_functionRegister["canonizePath"]);
		ExprScriptChangeDirectory::registerFunction(_functionRegister["changeDirectory"]);
		ExprScriptChangeFileTime::registerFunction(_functionRegister["changeFileTime"]);
		ExprScriptCharAt::registerFunction(_functionRegister["charAt"]);
		ExprScriptCharToByte::registerFunction(_functionRegister["charToByte"]);
		ExprScriptCharToInt::registerFunction(_functionRegister["charToInt"]);
		ExprScriptChmod::registerFunction(_functionRegister["chmod"]);
		ExprScriptCeil::registerFunction(_functionRegister["ceil"]);
		ExprScriptCompareDate::registerFunction(_functionRegister["compareDate"]);
		ExprScriptCompleteDate::registerFunction(_functionRegister["completeDate"]);
		ExprScriptCompleteLeftSpaces::registerFunction(_functionRegister["completeLeftSpaces"]);
		ExprScriptCompleteRightSpaces::registerFunction(_functionRegister["completeRightSpaces"]);
		ExprScriptComposeAdaLikeString::registerFunction(_functionRegister["composeAdaLikeString"]);
		ExprScriptComposeCLikeString::registerFunction(_functionRegister["composeCLikeString"]);
		ExprScriptComposeHTMLLikeString::registerFunction(_functionRegister["composeHTMLLikeString"]);
		ExprScriptComposeSQLLikeString::registerFunction(_functionRegister["composeSQLLikeString"]);
		ExprScriptComputeMD5::registerFunction(_functionRegister["computeMD5"]);
		ExprScriptCopySmartFile::registerFunction(_functionRegister["copySmartFile"]);
		ExprScriptCoreString::registerFunction(_functionRegister["coreString"]);
		ExprScriptCountStringOccurences::registerFunction(_functionRegister["countStringOccurences"]);
		ExprScriptCreateDirectory::registerFunction(_functionRegister["createDirectory"]);
		ExprScriptCreateINETClientSocket::registerFunction(_functionRegister["createINETClientSocket"]);
		ExprScriptCreateINETServerSocket::registerFunction(_functionRegister["createINETServerSocket"]);
		ExprScriptCreateVirtualFile::registerFunction(_functionRegister["createVirtualFile"]);
		ExprScriptCreateVirtualTemporaryFile::registerFunction(_functionRegister["createVirtualTemporaryFile"]);
		ExprScriptDecodeURL::registerFunction(_functionRegister["decodeURL"]);
		ExprScriptDecrement::registerFunction(_functionRegister["decrement"]);
		ExprScriptDeleteFile::registerFunction(_functionRegister["deleteFile"]);
		ExprScriptDeleteVirtualFile::registerFunction(_functionRegister["deleteVirtualFile"]);
		ExprScriptDiv::registerFunction(_functionRegister["div"]);
		ExprScriptEncodeURL::registerFunction(_functionRegister["encodeURL"]);
		ExprScriptEndl::registerFunction(_functionRegister["endl"]);
		ExprScriptEndString::registerFunction(_functionRegister["endString"]);
		ExprScriptEqual::registerFunction(_functionRegister["equal"]);
		ExprScriptEqualsIgnoreCase::registerFunction(_functionRegister["equalsIgnoreCase"]);
		ExprScriptEqualTrees::registerFunction(_functionRegister["equalTrees"]);
		ExprScriptExecuteStringQuiet::registerFunction(_functionRegister["executeStringQuiet"]);
		ExprScriptExistEnv::registerFunction(_functionRegister["existEnv"]);
		ExprScriptExistFile::registerFunction(_functionRegister["existFile"]);
		ExprScriptExistVirtualFile::registerFunction(_functionRegister["existVirtualFile"]);
		ExprScriptExistVariable::registerFunction(_functionRegister["existVariable"]);
		ExprScriptExp::registerFunction(_functionRegister["exp"]);
		ExprScriptExploreDirectory::registerFunction(_functionRegister["exploreDirectory"]);
		ExprScriptExtractGenerationHeader::registerFunction(_functionRegister["extractGenerationHeader"]);
		ExprScriptFileCreation::registerFunction(_functionRegister["fileCreation"]);
		ExprScriptFileLastAccess::registerFunction(_functionRegister["fileLastAccess"]);
		ExprScriptFileLastModification::registerFunction(_functionRegister["fileLastModification"]);
		ExprScriptFileLines::registerFunction(_functionRegister["fileLines"]);
		ExprScriptFileMode::registerFunction(_functionRegister["fileMode"]);
		ExprScriptFileSize::registerFunction(_functionRegister["fileSize"]);
		ExprScriptFindElement::registerFunction(_functionRegister["findElement"]);
		ExprScriptFindFirstChar::registerFunction(_functionRegister["findFirstChar"]);
		ExprScriptFindFirstSubstringIntoKeys::registerFunction(_functionRegister["findFirstSubstringIntoKeys"]);
		ExprScriptFindLastString::registerFunction(_functionRegister["findLastString"]);
		ExprScriptFindNextString::registerFunction(_functionRegister["findNextString"]);
		ExprScriptFindNextSubstringIntoKeys::registerFunction(_functionRegister["findNextSubstringIntoKeys"]);
		ExprScriptFindString::registerFunction(_functionRegister["findString"]);
		ExprScriptFirst::registerFunction(_functionRegister["first"]);
		ExprScriptFloor::registerFunction(_functionRegister["floor"]);
		ExprScriptFormatDate::registerFunction(_functionRegister["formatDate"]);
		ExprScriptGetArraySize::registerFunction(_functionRegister["getArraySize"]);
		ExprScriptGetCommentBegin::registerFunction(_functionRegister["getCommentBegin"]);
		ExprScriptGetCommentEnd::registerFunction(_functionRegister["getCommentEnd"]);
		ExprScriptGetCurrentDirectory::registerFunction(_functionRegister["getCurrentDirectory"]);
		ExprScriptGetEnv::registerFunction(_functionRegister["getEnv"]);
		ExprScriptGetGenerationHeader::registerFunction(_functionRegister["getGenerationHeader"]);
		ExprScriptGetHTTPRequest::registerFunction(_functionRegister["getHTTPRequest"]);
		ExprScriptGetIncludePath::registerFunction(_functionRegister["getIncludePath"]);
		ExprScriptGetLastDelay::registerFunction(_functionRegister["getLastDelay"]);
		ExprScriptGetNow::registerFunction(_functionRegister["getNow"]);
		ExprScriptGetProperty::registerFunction(_functionRegister["getProperty"]);
		ExprScriptGetShortFilename::registerFunction(_functionRegister["getShortFilename"]);
		ExprScriptGetTextMode::registerFunction(_functionRegister["getTextMode"]);
		ExprScriptGetVariableAttributes::registerFunction(_functionRegister["getVariableAttributes"]);
		ExprScriptGetVersion::registerFunction(_functionRegister["getVersion"]);
		ExprScriptGetWorkingPath::registerFunction(_functionRegister["getWorkingPath"]);
		ExprScriptGetWriteMode::registerFunction(_functionRegister["getWriteMode"]);
		ExprScriptHexaToDecimal::registerFunction(_functionRegister["hexaToDecimal"]);
		ExprScriptHostToNetworkLong::registerFunction(_functionRegister["hostToNetworkLong"]);
		ExprScriptHostToNetworkShort::registerFunction(_functionRegister["hostToNetworkShort"]);
		ExprScriptIncrement::registerFunction(_functionRegister["increment"]);
		ExprScriptIndentFile::registerFunction(_functionRegister["indentFile"]);
		ExprScriptInf::registerFunction(_functionRegister["inf"]);
		ExprScriptInputKey::registerFunction(_functionRegister["inputKey"]);
		ExprScriptInputLine::registerFunction(_functionRegister["inputLine"]);
		ExprScriptIsEmpty::registerFunction(_functionRegister["isEmpty"]);
		ExprScriptIsIdentifier::registerFunction(_functionRegister["isIdentifier"]);
		ExprScriptIsNegative::registerFunction(_functionRegister["isNegative"]);
		ExprScriptIsPositive::registerFunction(_functionRegister["isPositive"]);
		ExprScriptJoinStrings::registerFunction(_functionRegister["joinStrings"]);
		ExprScriptKey::registerFunction(_functionRegister["key"]);
		ExprScriptLast::registerFunction(_functionRegister["last"]);
		ExprScriptLeftString::registerFunction(_functionRegister["leftString"]);
		ExprScriptLengthString::registerFunction(_functionRegister["lengthString"]);
		ExprScriptLoadBinaryFile::registerFunction(_functionRegister["loadBinaryFile"]);
		ExprScriptLoadFile::registerFunction(_functionRegister["loadFile"]);
		ExprScriptLoadVirtualFile::registerFunction(_functionRegister["loadVirtualFile"]);
		ExprScriptLog::registerFunction(_functionRegister["log"]);
		ExprScriptLongToBytes::registerFunction(_functionRegister["longToBytes"]);
		ExprScriptMidString::registerFunction(_functionRegister["midString"]);
		ExprScriptMod::registerFunction(_functionRegister["mod"]);
		ExprScriptMult::registerFunction(_functionRegister["mult"]);
		ExprScriptNetworkLongToHost::registerFunction(_functionRegister["networkLongToHost"]);
		ExprScriptNetworkShortToHost::registerFunction(_functionRegister["networkShortToHost"]);
		ExprScriptNot::registerFunction(_functionRegister["not"]);
		ExprScriptOctalToDecimal::registerFunction(_functionRegister["octalToDecimal"]);
		ExprScriptParseFreeQuiet::registerFunction(_functionRegister["parseFreeQuiet"]);
		ExprScriptPathFromPackage::registerFunction(_functionRegister["pathFromPackage"]);
		ExprScriptPostHTTPRequest::registerFunction(_functionRegister["postHTTPRequest"]);
		ExprScriptPow::registerFunction(_functionRegister["pow"]);
		ExprScriptRandomInteger::registerFunction(_functionRegister["randomInteger"]);
		ExprScriptReceiveBinaryFromSocket::registerFunction(_functionRegister["receiveBinaryFromSocket"]);
		ExprScriptReceiveFromSocket::registerFunction(_functionRegister["receiveFromSocket"]);
		ExprScriptReceiveTextFromSocket::registerFunction(_functionRegister["receiveTextFromSocket"]);
		ExprScriptRelativePath::registerFunction(_functionRegister["relativePath"]);
		ExprScriptRemoveDirectory::registerFunction(_functionRegister["removeDirectory"]);
		ExprScriptRemoveGenerationTagsHandler::registerFunction(_functionRegister["removeGenerationTagsHandler"]);
		ExprScriptRepeatString::registerFunction(_functionRegister["repeatString"]);
		ExprScriptReplaceString::registerFunction(_functionRegister["replaceString"]);
		ExprScriptReplaceTabulations::registerFunction(_functionRegister["replaceTabulations"]);
		ExprScriptResolveFilePath::registerFunction(_functionRegister["resolveFilePath"]);
		ExprScriptRightString::registerFunction(_functionRegister["rightString"]);
		ExprScriptRsubString::registerFunction(_functionRegister["rsubString"]);
		ExprScriptScanDirectories::registerFunction(_functionRegister["scanDirectories"]);
		ExprScriptScanFiles::registerFunction(_functionRegister["scanFiles"]);
		ExprScriptSendBinaryToSocket::registerFunction(_functionRegister["sendBinaryToSocket"]);
		ExprScriptSendHTTPRequest::registerFunction(_functionRegister["sendHTTPRequest"]);
		ExprScriptSendTextToSocket::registerFunction(_functionRegister["sendTextToSocket"]);
		ExprScriptSelectGenerationTagsHandler::registerFunction(_functionRegister["selectGenerationTagsHandler"]);
		ExprScriptShortToBytes::registerFunction(_functionRegister["shortToBytes"]);
		ExprScriptStartString::registerFunction(_functionRegister["startString"]);
		ExprScriptSub::registerFunction(_functionRegister["sub"]);
		ExprScriptSubString::registerFunction(_functionRegister["subString"]);
		ExprScriptSup::registerFunction(_functionRegister["sup"]);
		ExprScriptSystem::registerFunction(_functionRegister["system"]);
		ExprScriptToLowerString::registerFunction(_functionRegister["toLowerString"]);
		ExprScriptToUpperString::registerFunction(_functionRegister["toUpperString"]);
		ExprScriptTranslateString::registerFunction(_functionRegister["translateString"]);
		ExprScriptTrimLeft::registerFunction(_functionRegister["trimLeft"]);
		ExprScriptTrimRight::registerFunction(_functionRegister["trimRight"]);
		ExprScriptTrim::registerFunction(_functionRegister["trim"]);
		ExprScriptTruncateAfterString::registerFunction(_functionRegister["truncateAfterString"]);
		ExprScriptTruncateBeforeString::registerFunction(_functionRegister["truncateBeforeString"]);
		ExprScriptUUID::registerFunction(_functionRegister["UUID"]);
		ExprScriptCountInputCols::registerFunction(_functionRegister["countInputCols"]);
		ExprScriptCountInputLines::registerFunction(_functionRegister["countInputLines"]);
		ExprScriptGetInputFilename::registerFunction(_functionRegister["getInputFilename"]);
		ExprScriptGetLastReadChars::registerFunction(_functionRegister["getLastReadChars"]);
		ExprScriptGetInputLocation::registerFunction(_functionRegister["getInputLocation"]);
		ExprScriptLookAhead::registerFunction(_functionRegister["lookAhead"]);
		ExprScriptPeekChar::registerFunction(_functionRegister["peekChar"]);
		ExprScriptReadAdaString::registerFunction(_functionRegister["readAdaString"]);
		ExprScriptReadByte::registerFunction(_functionRegister["readByte"]);
		ExprScriptReadBytes::registerFunction(_functionRegister["readBytes"]);
		ExprScriptReadCChar::registerFunction(_functionRegister["readCChar"]);
		ExprScriptReadChar::registerFunction(_functionRegister["readChar"]);
		ExprScriptReadCharAsInt::registerFunction(_functionRegister["readCharAsInt"]);
		ExprScriptReadChars::registerFunction(_functionRegister["readChars"]);
		ExprScriptReadIdentifier::registerFunction(_functionRegister["readIdentifier"]);
		ExprScriptReadIfEqualTo::registerFunction(_functionRegister["readIfEqualTo"]);
		ExprScriptReadIfEqualToIgnoreCase::registerFunction(_functionRegister["readIfEqualToIgnoreCase"]);
		ExprScriptReadIfEqualToIdentifier::registerFunction(_functionRegister["readIfEqualToIdentifier"]);
		ExprScriptReadLine::registerFunction(_functionRegister["readLine"]);
		ExprScriptReadNextText::registerFunction(_functionRegister["readNextText"]);
		ExprScriptReadNumber::registerFunction(_functionRegister["readNumber"]);
		ExprScriptReadString::registerFunction(_functionRegister["readString"]);
		ExprScriptReadUptoJustOneChar::registerFunction(_functionRegister["readUptoJustOneChar"]);
		ExprScriptReadWord::registerFunction(_functionRegister["readWord"]);
		ExprScriptSkipBlanks::registerFunction(_functionRegister["skipBlanks"]);
		ExprScriptSkipEmptyCpp::registerFunction(_functionRegister["skipEmptyCpp"]);
		ExprScriptSkipEmptyCppExceptDoxygen::registerFunction(_functionRegister["skipEmptyCppExceptDoxygen"]);
		ExprScriptSkipEmptyHTML::registerFunction(_functionRegister["skipEmptyHTML"]);
		ExprScriptSkipEmptyLaTeX::registerFunction(_functionRegister["skipEmptyLaTeX"]);
		ExprScriptCountOutputCols::registerFunction(_functionRegister["countOutputCols"]);
		ExprScriptCountOutputLines::registerFunction(_functionRegister["countOutputLines"]);
		ExprScriptExistFloatingLocation::registerFunction(_functionRegister["existFloatingLocation"]);
		ExprScriptGetFloatingLocation::registerFunction(_functionRegister["getFloatingLocation"]);
		ExprScriptGetLastWrittenChars::registerFunction(_functionRegister["getLastWrittenChars"]);
		ExprScriptGetMarkupKey::registerFunction(_functionRegister["getMarkupKey"]);
		ExprScriptGetMarkupValue::registerFunction(_functionRegister["getMarkupValue"]);
		ExprScriptGetOutputFilename::registerFunction(_functionRegister["getOutputFilename"]);
		ExprScriptGetOutputLocation::registerFunction(_functionRegister["getOutputLocation"]);
		ExprScriptGetProtectedArea::registerFunction(_functionRegister["getProtectedArea"]);
		ExprScriptGetProtectedAreaKeys::registerFunction(_functionRegister["getProtectedAreaKeys"]);
		ExprScriptIndentText::registerFunction(_functionRegister["indentText"]);
		ExprScriptNewFloatingLocation::registerFunction(_functionRegister["newFloatingLocation"]);
		ExprScriptRemainingProtectedAreas::registerFunction(_functionRegister["remainingProtectedAreas"]);
		ExprScriptRemoveProtectedArea::registerFunction(_functionRegister["removeProtectedArea"]);
//##end##"registration"
	}
	return _functionRegister;
}

	void ExprScriptFunction::addParameter(ExprScriptExpression* pParameter) {
		_parameters.push_back(pParameter);
	}

	EXPRESSION_TYPE ExprScriptFunction::getParameterType(unsigned int iIndex) const {
		if ((iIndex < 0) || (iIndex >= _parameterTypes.size())) return UNKNOWN_EXPRTYPE;
		return _parameterTypes[iIndex];
	}

	int ExprScriptFunction::getArity() const {
		return _parameterTypes.size();
	}

	const char* ExprScriptFunction::getName() const {
		if (_pPrototype != 0L) return _pPrototype->getFunctionName();
		return "";
	}

	int ExprScriptFunction::getThisPosition() const { return 0; }
	void ExprScriptFunction::initializationDone() {}

	std::string ExprScriptFunction::getValue(DtaScriptVariable& visibility) const {
		if (_pTemplate != 0L) {
			std::string sInstantiationKey = _pTemplate->getValue(visibility);
			GrfFunction* pFunction = _pPrototype->getInstantiatedFunction(visibility, sInstantiationKey);
			if (pFunction != 0L) return pFunction->launchExecution(visibility, *this, sInstantiationKey);
			throw UtlException("template function '" +  _pPrototype->getName() + "<\"" + sInstantiationKey + "\">' hasn't been implemented");
		}
		if (_pPrototype == 0L) throw UtlException("ExprScriptFunction::getValue() -> must be implemented into derivated classes\nFor custom functions, see class GrfFunction");
		return _pPrototype->launchExecution(visibility, *this);
	}

ExprScriptFunction* ExprScriptFunction::create(GrfBlock& block, ScpStream& script, const std::string& sFunction, const std::string& sTemplate, bool bGenericKey, int& iArity) {
    ExprScriptFunction* pFunction = 0L;
	iArity = -1;
	std::string sFunctionName;
//##markup##"create::deprecated"
//##begin##"create::deprecated"
	if (sFunction == "getVariableSize") {
		std::string sErrorMessage = "warning: function 'getVariableSize' has been deprecated since version 1.30 -> replace it by function 'getArraySize'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "getArraySize";
	} else if (sFunction == "today") {
		std::string sErrorMessage = "warning: function 'today' has been deprecated since version 2.09 -> replace it by function 'getNow'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "getNow";
	} else if (sFunction == "getDefineTarget") {
		std::string sErrorMessage = "warning: function 'getDefineTarget' has been deprecated since version 1.30 -> replace it by function 'getProperty'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "getProperty";
	} else if (sFunction == "trimLeftString") {
		std::string sErrorMessage = "warning: function 'trimLeftString' has been deprecated since version 1.40 -> replace it by function 'trimLeft'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "trimLeft";
	} else if (sFunction == "trimRightString") {
		std::string sErrorMessage = "warning: function 'trimRightString' has been deprecated since version 1.40 -> replace it by function 'trimRight'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "trimRight";
	} else if (sFunction == "trimString") {
		std::string sErrorMessage = "warning: function 'trimString' has been deprecated since version 1.40 -> replace it by function 'trim'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "trim";
	} else if (sFunction == "readLastChars") {
		std::string sErrorMessage = "warning: function 'readLastChars' has been deprecated since version 1.30 -> replace it by function 'getLastReadChars'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "getLastReadChars";
	} else if (sFunction == "getLocation") {
		std::string sErrorMessage = "warning: function 'getLocation' has been deprecated since version 3.7.1 -> replace it by function 'getInputLocation'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "getInputLocation";
	} else if (sFunction == "getMarkerKey") {
		std::string sErrorMessage = "warning: function 'getMarkerKey' has been deprecated since version 2.14 -> replace it by function 'getMarkupKey'" + CGRuntime::endl();
		sErrorMessage += DtaProject::getInstance().getTraceStack(script);
		if (DtaProject::getInstance().addWarning(sErrorMessage) == 1) CGRuntime::traceLine(sErrorMessage);
		sFunctionName = "getMarkupKey";
//##end##"create::deprecated"
	} else sFunctionName = sFunction;
	if (getFunctionRegister().find(sFunctionName) != getFunctionRegister().end()) {
		if (!sTemplate.empty()) throw UtlException("predefined function '" + sFunction + "' cannot instantiate template function '" + sFunction + "<" + sTemplate + ">'");
		pFunction = getFunctionRegister()[sFunctionName].constructor(block, iArity);
	} else {
		GrfFunction* pPrototype = block.getFunction(sFunctionName, sTemplate, bGenericKey, iArity);
		if (pPrototype != 0L) {
			pFunction = new ExprScriptFunction(pPrototype);
		}
	}
    return pFunction;
}

ExprScriptFunction* ExprScriptFunction::createMethod(GrfBlock& block, ScpStream& script, const std::string& sFunction, const std::string& sTemplate, bool bGenericKey, int& iArity) {
//##markup##"createMethod"
//##begin##"createMethod"
	if (sFunction == "size") return create(block, script, "getArraySize", sTemplate, bGenericKey, iArity);
	if (sFunction == "length") return create(block, script, "lengthString", sTemplate, bGenericKey, iArity);
	if (sFunction == "empty") return create(block, script, "isEmpty", sTemplate, bGenericKey, iArity);
//##end##"createMethod"
	return create(block, script, sFunction, sTemplate, bGenericKey, iArity);
}

	void ExprScriptFunction::clearCounters() {
		for (std::map<std::string, DtaFunctionInfo>::iterator i = getFunctionRegister().begin(); i != getFunctionRegister().end(); i++) {
			*(i->second.pCounter) = 0;
		}
	}

	EXPRESSION_RETURN_TYPE ExprScriptFunction::compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
		bool bDispatchedYet = true;
		if (_pPrototype != 0L) {
			if (_pPrototype->isATemplateInstantiation()) {
				CW_BODY_STREAM << DtaScript::convertFilenameAsIdentifier(CppCompilerEnvironment::getRadical(theCompilerEnvironment.getFunctionModule(_pPrototype->getFunctionName()))) << "::_compilerTemplateFunction_" << _pPrototype->getFunctionName() << "_compilerInstantiation_";
				ExprScriptConstant* pConstant = dynamic_cast<ExprScriptConstant*>(_pTemplate);
				DtaScriptVariable visibility;
				if ((pConstant != 0L) && !pConstant->getConstant().empty() && (_pPrototype->getInstantiatedFunction(visibility, pConstant->getConstant()) != 0L)) {
					CW_BODY_STREAM << theCompilerEnvironment.convertTemplateKey(pConstant->getConstant()) << "(";
				} else {
					CW_BODY_STREAM << "(";
					_pTemplate->compileCppString(theCompilerEnvironment);
					bDispatchedYet = false;
				}
			} else {
				CW_BODY_STREAM << DtaScript::convertFilenameAsIdentifier(CppCompilerEnvironment::getRadical(theCompilerEnvironment.getFunctionModule(_pPrototype->getFunctionName()))) << "::_compilerFunction_" << _pPrototype->getFunctionName() << "(";
			}
		} else CW_BODY_STREAM << "CGRuntime::" << getName() << "(";
		int iIndex = 0;
		for (std::vector<ExprScriptExpression*>::const_iterator i = _parameters.begin(); i != _parameters.end(); i++) {
			if ((i != _parameters.begin()) || !bDispatchedYet) CW_BODY_STREAM << ", ";
			if (_parameterTypes[iIndex] == VALUE_EXPRTYPE) (*i)->compileCpp(theCompilerEnvironment);
			else dynamic_cast<ExprScriptVariable*>(*i)->compileCppForSet(theCompilerEnvironment);
			iIndex++;
		}
		CW_BODY_STREAM << ")";
		return STRING_TYPE;
	}

	bool ExprScriptFunction::compileCppBoolean(CppCompilerEnvironment& theCompilerEnvironment, bool bNegative) const {
		if (!bNegative) CW_BODY_STREAM << "!";
		compileCpp(theCompilerEnvironment);
		CW_BODY_STREAM << ".empty()";
		return (_pPrototype != 0L);
	}

	bool ExprScriptFunction::compileCppString(CppCompilerEnvironment& theCompilerEnvironment) const {
		ScpStream* pOwner;
		int iInsertAreaLocation = CW_BODY_STREAM.getFloatingLocation("INSERT AREA", pOwner);
		int iLocation = CW_BODY_STREAM.getOutputLocation();
		EXPRESSION_RETURN_TYPE returnType = compileCpp(theCompilerEnvironment);
		if (returnType != STRING_TYPE) {
			CW_BODY_STREAM.insertText("CGRuntime::toString(", iLocation + (CW_BODY_STREAM.getFloatingLocation("INSERT AREA", pOwner) - iInsertAreaLocation));
			CW_BODY_STREAM << ")";
		}
		return (_pPrototype != 0L);
	}

	std::string ExprScriptFunction::toString() const {
		std::string sSerialize;
		if (_pPrototype != 0L) sSerialize = _pPrototype->getFunctionName();
		else sSerialize = getName();
		if (_pTemplate != 0L) sSerialize += "<" + _pTemplate->toString() + ">";
		sSerialize += "(";
		int iIndex = 0;
		for (std::vector<ExprScriptExpression*>::const_iterator i = _parameters.begin(); i != _parameters.end(); i++) {
			if (i != _parameters.begin()) sSerialize += ", ";
			sSerialize += (*i)->toString();
			iIndex++;
		}
		return sSerialize + ")";
	}
}
