/* libsswf_asas.h -- written by Alexis WILKE for Made to Order Software, Ltd. (c) 2005-2006 */
#ifndef LIBSSWF_ASAS_H
#define	LIBSSWF_ASAS_H

/*

Copyright (c) 2005-2006 Made to Order Software, Ltd.

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

*/

#include	"sswf/libsswf_as.h"
#include	"sswf/libsswf.h"


//#include	<wchar.h>


namespace sswf
{
namespace asas
{




class Compiler
{
public:
				Compiler(void);
				~Compiler();

	int			Compile(as::NodePtr& program, const char *code, unsigned long line, const char *filename);

	void			SetOptions(as::Options& options);

private:
	as::Options		f_default_options;
	as::Options *		f_options;
};



/*
 * Okay, the Assembler accepts an sswf::as::NodePtr tree
 * which has been compiled and converts it in a list of
 * sswf::Actions.
 *
 * As input, it takes a NodePtr and a TagDoAction set of
 * references. The assembler goes through the NodePtr
 * and generate actions that it inserts in the do action
 * tag as required for the sswf library to generate the
 * resulting Flash output.
 *
 * It is assumed that the compiler already got all the
 * errors out so that the assembler won't have to err
 * anything. At this, that's how it is right now.
 */

class Assembler
{
public:
				Assembler(void);
				~Assembler();

	int			AssembleClasses(as::NodePtr& program, TagBase& parent, bool& has_actions);
	int			Assemble(as::NodePtr& program, TagBase& tag, Vectors *actions);

	void			SetErrorStream(as::ErrorStream& error_stream);
	void			SetOptions(as::Options& options);

private:
	as::ErrorStream		f_default_error_stream;
	as::ErrorStream *	f_error_stream;
	as::Options *		f_options;
};





};	// namespace asas
};	// namespace sswf
#endif			/* #ifndef LIBSSWF_ASAS_H */
