/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__SQUIRREL_DEBUGGER__
#define	__SQUIRREL_DEBUGGER__


		#include "script/script_debugger.h"
		#include "squirrel.h"


namespace GS {
	namespace Script {
		class SquirrelVM;

/*
	@short	Squirrel debugger interface.
	@author	Emmanuel Julien (ejulien@nworks.fr)
*/
class	SquirrelDebugger : public IDebugger
{
protected:

		HSQUIRRELVM	vm;

		/// Insert a variable in the variable tree.
		DebuggerVariable *InsertVariable(const char *name, AutoList <DebuggerVariable *> &tree, int level);

public:

/*!
	@name	Interface.
	@{
*/
		/// Format variable parameter.
virtual	String		FormatParameter(DebuggerVariable *variable);
		/// Format safe ptr parameter.
virtual	String		FormatUserObjectParameter(CObjectType type);
		/// Convert a debugger variable to a meta string.
virtual	void		VariableToMetatagString(DebuggerVariable *, String &);

		/// Get call stack depth.
virtual	int			GetCallstackDepth();
		/// Get current script execution call frame index.
virtual	int			GetStackFrameIndex();

		/// Refresh stack locals list.
virtual	void		RefreshStackFrameLocalsCache();
		/// Get source/line info for the current debug stack frame.
virtual	void		GetStackFrameSource(const char *&, int &);
/// @}

		SquirrelDebugger(SquirrelVM &);
};

	} // Script
} // GS


#endif	// __SQUIRREL_DEBUGGER__
