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

Copyright (C) 1996-1997, 1999-2004 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
*/
#ifndef _DOTNET_h_
#define _DOTNET_h_


#ifdef CODEWORKER_DOT_NET
#	pragma managed
#	using <mscorlib.dll>
#	include <windows.h>
#	include "_vcclrit.h"

namespace CodeWorker {
#	pragma unmanaged
	class CGCompiledCommonScript;
	class CGCompiledTemplateScript;
	class CGCompiledBNFScript;
	class CGCompiledTranslationScript;
	class DtaScriptVariable;
#	pragma managed

	public __gc class ParsingTree_var {
#pragma unmanaged
		public:
			DtaScriptVariable* _pInternalNode;
#pragma managed

		public:
			inline ParsingTree_var() : _pInternalNode(NULL) {}

			System::String* getValue();
			void setValue(ParsingTree_var* pTree);
	};

	public __gc class ParsingTree_value : public ParsingTree_var {
		public:
			ParsingTree_value();
			ParsingTree_value(bool bValue);
			ParsingTree_value(int iValue);
			ParsingTree_value(double dValue);
			ParsingTree_value(System::String* tcValue);
			ParsingTree_value(ParsingTree_var* pTree);
			~ParsingTree_value();
	};



	public __gc class CompiledCommonScript {
#pragma unmanaged
		private:
			CGCompiledCommonScript __nogc* _pScript;
#pragma managed

		public:
			CompiledCommonScript();
			virtual ~CompiledCommonScript();

			void buildFromFile(System::String* pFilename);
			void buildFromString(System::String* pText);

			void execute(ParsingTree_var* pContext);
	};


	public __gc class CompiledTemplateScript {
		private:
			CGCompiledTemplateScript* _pScript;

		public:
			CompiledTemplateScript(System::String* sFile);
			virtual ~CompiledTemplateScript();

			void generate(ParsingTree_var* pContext, System::String* sOutputFile);
			void generateString(ParsingTree_var* pContext, System::String* sOutputText);
			void expand(ParsingTree_var* pContext, System::String* sOutputFile);
	};

	public __gc class CompiledBNFScript {
		private:
			CGCompiledBNFScript* _pScript;

		public:
			CompiledBNFScript(System::String* sFile);
			virtual ~CompiledBNFScript();

			void parse(ParsingTree_var* pContext, System::String* sParsedFile);
			void parseString(ParsingTree_var* pContext, System::String* sText);
	};

	public __gc class CompiledTranslationScript {
		private:
			CGCompiledTranslationScript* _pScript;

		public:
			CompiledTranslationScript(System::String* sFile);
			virtual ~CompiledTranslationScript();

			System::String* translateString(ParsingTree_var* pContext, System::String* sInputText);
			void translate(ParsingTree_var* pContext, System::String* sParsedFile, System::String* sOutputFile);
	};
}

#endif //CODEWORKER_DOT_NET
#endif
