TYPEMAP
Tk_Window		T_TK_WINDOW
Tk_Image		T_TK_IMAGE
TkWindow *		T_TKWINDOW
Display *		T_IVOBJ
Screen *		T_IVOBJ
Visual *		T_IVOBJ
Window			T_IVOBJ
Colormap		T_IVOBJ
GC			T_IVOBJ
Font			T_IVOBJ
Atom			T_IV
HANDLE			T_IV
BOOL			T_IV
HWND			T_TK_HWND
FILE *			T_NIO
hash_ptr *		T_PTR
Tk_3DBorder		T_IVOBJ
Tk_Uid			T_TK_UID
Tcl_Interp *		T_TK_INTERP
Tk_Font			T_TK_FONT
EventAndKeySym *	T_TK_XEVENT
LangCallback *		T_TK_CALLBACK

INPUT 
T_PVOBJ
	if (sv_object($arg)) {
	    STRLEN sz;
	    $var = ($type) SvPV((SV*)SvRV($arg),sz);
	    if (sz != sizeof(*$var))
	     croak(\"$var too small for $type\");
	}
	else
	    croak(\"$var is not an object\")

T_TK_WINDOW
	$var = SVtoWindow($arg)

T_TK_CALLBACK
	$var = LangMakeCallback($arg)


T_TK_HWND
	$var = SVtoHWND($arg)

T_TK_XEVENT
	$var = SVtoEventAndKeySym($arg)

T_TK_FONT
	$var = SVtoFont($arg)

T_TK_IMAGE
	$var = SVtoImage($arg)

T_TKWINDOW
	$var = (TkWindow *) SVtoWindow($arg)

T_TK_INTERP
	$var = WindowCommand($arg,NULL,1)->interp

T_TK_UID
	$var = Tk_GetUid(SvPV($arg,na))

T_IVOBJ
	if (sv_isa($arg, \"${ntype}\")) {
	    $var = ($type)(SvIV(SvRV($arg)));
	}
	else {
	    $var = ($type) NULL;
	    croak(\"$var is not of type ${ntype}\");
	}    

T_NIO
	if (sv_isa($arg, \"${Package}\")) {
	    $var = IoIFP(sv_2io(SvRV($arg)));
	}
	else
	    croak(\"$var is not of type ${Package}\")


OUTPUT
T_IVOBJ
	sv_setref_iv($arg, \"${ntype}\", (IV) $var);

T_TK_UID
	sv_setpv($arg,$var);

T_TK_WINDOW
	sv_setsv($arg,TkToWidget($var,NULL));

T_TKWINDOW
	sv_setsv($arg,TkToWidget((Tk_Window) $var,NULL));


