#ifndef __TCLOO_UTIL_DEFINED
#define __TCLOO_UTIL_DEFINED

#include <tcl.h>
#include <tclOO.h>
#include "xTcl_util.h"

// This macro is a short for the standard parameter-list of the
// Tcl_MethodCallProc conformant functions.
#define METHOD_ARGS \
	ClientData clientData, \
	Tcl_Interp* interp,\
	Tcl_ObjectContext objectContext, \
	int objc, \
	Tcl_Obj *const objv[]


	// shorthand for defining a 'std' Tcl_MethodType for a given methodName
#define DEF_METHODTYPE(methodName) \
	static TclResCode Method_##methodName( METHOD_ARGS ); \
	static const Tcl_MethodType MethodType_##methodName = { \
		TCL_OO_METHOD_VERSION_CURRENT, \
		#methodName, \
		Method_##methodName, \
		NULL, \
		NULL  \
	};


EXTERN_C Tcl_Class tcloox_getClass(Tcl_Interp* interp, const char* className);
EXTERN_C void       tcloox_registerConstructor(Tcl_Interp* interp, Tcl_Class clazz, const Tcl_MethodType* methodTypePtr);
EXTERN_C void       tcloox_registerDestructor(Tcl_Interp *interp, Tcl_Class clazz, const Tcl_MethodType *methodTypePtr);
EXTERN_C Tcl_Method tcloox_registerMethod( Tcl_Interp* interp, Tcl_Class clazz, const Tcl_MethodType* methodType );
EXTERN_C int        tcloox_registerMethods( Tcl_Interp* interp, Tcl_Class clazz, const Tcl_MethodType* methods []);
EXTERN_C int NoCloneMethod(
	Tcl_Interp* interp,		/* Tcl interpreter for error reporting */
	ClientData  metadata,	/* Metadata to be cloned */
	ClientData* newMetaData	/* Where to put the cloned metadata */
); 

#endif