///home/berryj/link/bin/genMethods "-g" "-t" "Graph*" "-I" "LINK/graph/Graph.h" "-d" "graph" "-y" "display_graphptr" "-m" "mark_graphptr" "-w" "free_graphptr" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/graph/Graph.h>

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

void display_graphptr(SCM, SCM, int);
void mark_graphptr(SCM);
void free_graphptr(SCM);

typedef Graph* _Graph_;

#define _Graph_DATA(x) ((Graph**) (EXTDATA(x)))
#define _Graph_IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Graph* >::type))
#define _Graph_ISNT_DATA(x) (!_Graph_IS_DATA(x))

#define _Graph_CXX_DATA(x) (*(Graph**) (EXTDATA(VAL(x))))
#define _Graph_CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Graph* >::type))
#define _Graph_CXX_ISNT_DATA(x) (!_Graph_CXX_IS_DATA(x))


static SCM is_Graph_(SCM i)
{
	if (_Graph_CXX_IS_DATA(i))
		return Truth;
	return Ntruth;
}

PRIMITIVE STk_init__Graph_()
{
	Wrapper<_Graph_>::type = STk_new_CXXwrapper_id(
			Wrapper<_Graph_>::name, 
			"",
			(void (*)(SCM x, SCM port, int mode))
			display_graphptr,
			(void (*)(SCM x))mark_graphptr,
			(void (*)(SCM x))free_graphptr);
	Tcl_InitHashTable(&Register<_Graph_>::objTable, TCL_ONE_WORD_KEYS);
	STk_add_new_cpp_primitive("Graph?", tc_subr_1,
	(PRIMITIVE (*)(...))  is_Graph_);
	return UNDEFINED;
}

void genExtra_Graph_Methods(void);

PRIMITIVE STk_init_methods__Graph_()
{
	genExtra_Graph_Methods();
	return UNDEFINED;
}
