///home/berryj/link/bin/genMethods "-g" "-t" "char*" "-d" "basic" "-y" "display_charptr" "-w" "free_charptr" "-m" "mark_charptr" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/stkWrapper/Wrapper.h>
#include <LINK/stkWrapper/Register.h>

void display_charptr(SCM, SCM, int);
void mark_charptr(SCM);
void free_charptr(SCM);

typedef char* _char_;

#define _char_DATA(x) ((char**) (EXTDATA(x)))
#define _char_IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<char* >::type))
#define _char_ISNT_DATA(x) (!_char_IS_DATA(x))

#define _char_CXX_DATA(x) (*(char**) (EXTDATA(VAL(x))))
#define _char_CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<char* >::type))
#define _char_CXX_ISNT_DATA(x) (!_char_CXX_IS_DATA(x))


static SCM is_char_(SCM i)
{
	if (_char_CXX_IS_DATA(i))
		return Truth;
	return Ntruth;
}

PRIMITIVE STk_init__char_()
{
	Wrapper<_char_>::type = STk_new_CXXwrapper_id(
			Wrapper<_char_>::name, 
			"",
			(void (*)(SCM x, SCM port, int mode))
			display_charptr,
			(void (*)(SCM x))mark_charptr,
			(void (*)(SCM x))free_charptr);
	Tcl_InitHashTable(&Register<_char_>::objTable, TCL_ONE_WORD_KEYS);
	STk_add_new_cpp_primitive("char?", tc_subr_1,
	(PRIMITIVE (*)(...))  is_char_);
	return UNDEFINED;
}

void genExtra_char_Methods(void);

PRIMITIVE STk_init_methods__char_()
{
	genExtra_char_Methods();
	return UNDEFINED;
}
