//genMethods "-t" "Testobj*" "-h" "Array" "-I" "LINK/basic/Array.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/Array.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef Array<Testobj* > _Array_Testobj__;

#define _Array_Testobj__DATA(x) ((Array<Testobj* >*) (EXTDATA(x)))
#define _Array_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Array<Testobj* > >::type))
#define _Array_Testobj__ISNT_DATA(x) (!_Array_Testobj__IS_DATA(x))

#define _Array_Testobj__CXX_DATA(x) (*(Array<Testobj* >*) (EXTDATA(VAL(x))))
#define _Array_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Array<Testobj* > >::type))
#define _Array_Testobj__CXX_ISNT_DATA(x) (!_Array_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_Array_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "Collection" "-I" "LINK/basic/SetFuncs.h" "-I" "LINK/basic/Collection.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/SetFuncs.h>

#include <LINK/basic/Collection.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef Collection<Testobj* > _Collection_Testobj__;

#define _Collection_Testobj__DATA(x) ((Collection<Testobj* >*) (EXTDATA(x)))
#define _Collection_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Collection<Testobj* > >::type))
#define _Collection_Testobj__ISNT_DATA(x) (!_Collection_Testobj__IS_DATA(x))

#define _Collection_Testobj__CXX_DATA(x) (*(Collection<Testobj* >*) (EXTDATA(VAL(x))))
#define _Collection_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Collection<Testobj* > >::type))
#define _Collection_Testobj__CXX_ISNT_DATA(x) (!_Collection_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_Collection_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "Container" "-I" "LINK/basic/Container.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/Container.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef Container<Testobj* > _Container_Testobj__;

#define _Container_Testobj__DATA(x) ((Container<Testobj* >*) (EXTDATA(x)))
#define _Container_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Container<Testobj* > >::type))
#define _Container_Testobj__ISNT_DATA(x) (!_Container_Testobj__IS_DATA(x))

#define _Container_Testobj__CXX_DATA(x) (*(Container<Testobj* >*) (EXTDATA(VAL(x))))
#define _Container_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Container<Testobj* > >::type))
#define _Container_Testobj__CXX_ISNT_DATA(x) (!_Container_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_Container_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "List" "-I" "LINK/basic/List.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/List.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef List<Testobj* > _List_Testobj__;

#define _List_Testobj__DATA(x) ((List<Testobj* >*) (EXTDATA(x)))
#define _List_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<List<Testobj* > >::type))
#define _List_Testobj__ISNT_DATA(x) (!_List_Testobj__IS_DATA(x))

#define _List_Testobj__CXX_DATA(x) (*(List<Testobj* >*) (EXTDATA(VAL(x))))
#define _List_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<List<Testobj* > >::type))
#define _List_Testobj__CXX_ISNT_DATA(x) (!_List_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_List_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "MSet" "-r" "Collection<Testobj*>" "-I" "LINK/basic/MSet.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/MSet.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef MSet<Testobj* > _MSet_Testobj__;

#define _MSet_Testobj__DATA(x) ((MSet<Testobj* >*) (EXTDATA(x)))
#define _MSet_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<MSet<Testobj* > >::type))
#define _MSet_Testobj__ISNT_DATA(x) (!_MSet_Testobj__IS_DATA(x))

#define _MSet_Testobj__CXX_DATA(x) (*(MSet<Testobj* >*) (EXTDATA(VAL(x))))
#define _MSet_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<MSet<Testobj* > >::type))
#define _MSet_Testobj__CXX_ISNT_DATA(x) (!_MSet_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_MSet_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "Sequence" "-r" "Collection<Testobj*>" "-I" "LINK/basic/Sequence.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/Sequence.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef Sequence<Testobj* > _Sequence_Testobj__;

#define _Sequence_Testobj__DATA(x) ((Sequence<Testobj* >*) (EXTDATA(x)))
#define _Sequence_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Sequence<Testobj* > >::type))
#define _Sequence_Testobj__ISNT_DATA(x) (!_Sequence_Testobj__IS_DATA(x))

#define _Sequence_Testobj__CXX_DATA(x) (*(Sequence<Testobj* >*) (EXTDATA(VAL(x))))
#define _Sequence_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Sequence<Testobj* > >::type))
#define _Sequence_Testobj__CXX_ISNT_DATA(x) (!_Sequence_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_Sequence_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "Set" "-r" "MSet<Testobj*>" "-I" "LINK/basic/Set.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/Set.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef Set<Testobj* > _Set_Testobj__;

#define _Set_Testobj__DATA(x) ((Set<Testobj* >*) (EXTDATA(x)))
#define _Set_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Set<Testobj* > >::type))
#define _Set_Testobj__ISNT_DATA(x) (!_Set_Testobj__IS_DATA(x))

#define _Set_Testobj__CXX_DATA(x) (*(Set<Testobj* >*) (EXTDATA(VAL(x))))
#define _Set_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Set<Testobj* > >::type))
#define _Set_Testobj__CXX_ISNT_DATA(x) (!_Set_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_Set_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "SortedArray" "-r" "Array<Testobj*>" "-I" "LINK/basic/Array.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/Array.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef SortedArray<Testobj* > _SortedArray_Testobj__;

#define _SortedArray_Testobj__DATA(x) ((SortedArray<Testobj* >*) (EXTDATA(x)))
#define _SortedArray_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<SortedArray<Testobj* > >::type))
#define _SortedArray_Testobj__ISNT_DATA(x) (!_SortedArray_Testobj__IS_DATA(x))

#define _SortedArray_Testobj__CXX_DATA(x) (*(SortedArray<Testobj* >*) (EXTDATA(VAL(x))))
#define _SortedArray_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<SortedArray<Testobj* > >::type))
#define _SortedArray_Testobj__CXX_ISNT_DATA(x) (!_SortedArray_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_SortedArray_Testobj__Methods() {}
//genMethods "-t" "Testobj*" "-h" "SortedList" "-r" "List<Testobj*>" "-I" "LINK/basic/List.h" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/List.h>

#include <LINK/userobj/Testobj.h>

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


typedef Testobj* _Testobj_;
typedef SortedList<Testobj* > _SortedList_Testobj__;

#define _SortedList_Testobj__DATA(x) ((SortedList<Testobj* >*) (EXTDATA(x)))
#define _SortedList_Testobj__IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<SortedList<Testobj* > >::type))
#define _SortedList_Testobj__ISNT_DATA(x) (!_SortedList_Testobj__IS_DATA(x))

#define _SortedList_Testobj__CXX_DATA(x) (*(SortedList<Testobj* >*) (EXTDATA(VAL(x))))
#define _SortedList_Testobj__CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<SortedList<Testobj* > >::type))
#define _SortedList_Testobj__CXX_ISNT_DATA(x) (!_SortedList_Testobj__CXX_IS_DATA(x))



// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_SortedList_Testobj__Methods() {}
//genMethods "-t" "Testobj" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" "-y" "display_testobj" "-w" "free_testobj" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/userobj/Testobj.h>

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

void display_testobj(SCM, SCM, int);
void free_testobj(SCM);

typedef Testobj _Testobj;

#define _TestobjDATA(x) ((Testobj*) (EXTDATA(x)))
#define _TestobjIS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Testobj >::type))
#define _TestobjISNT_DATA(x) (!_TestobjIS_DATA(x))

#define _TestobjCXX_DATA(x) (*(Testobj*) (EXTDATA(VAL(x))))
#define _TestobjCXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Testobj >::type))
#define _TestobjCXX_ISNT_DATA(x) (!_TestobjCXX_IS_DATA(x))


void display_testobj(SCM, SCM, int);
void mark_testobj(SCM);
void free_testobj(SCM);

#include<strstream.h>

void display_testobj(SCM c, SCM port, int mode)
{
        ostrstream oss;
        if (_TestobjDATA(c))
        	oss << *_TestobjDATA(c);
        oss << ends;
        char *buffer = oss.str();
        Puts(buffer, FILEPTR(port));
        delete buffer;
}

void mark_testobj(SCM p)
{
}

void free_testobj(SCM p)
{
        if (!EXTSTATICP(p)) {
                delete _TestobjDATA(p);
        }
}


// define your new methods above 
// and register them using STk_add_new_cpp_primitive() below

void genExtra_TestobjMethods() {}
//genMethods "-g" "-t" "Testobj*" "-I" "LINK/userobj/Testobj.h" "-d" "userobj" "-y" "display_testobjptr" "-m" "mark_testobjptr" "-w" "free_testobjptr" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/userobj/Testobj.h>

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

void display_testobjptr(SCM, SCM, int);
void mark_testobjptr(SCM);
void free_testobjptr(SCM);

typedef Testobj* _Testobj_;

#define _Testobj_DATA(x) ((Testobj**) (EXTDATA(x)))
#define _Testobj_IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Testobj* >::type))
#define _Testobj_ISNT_DATA(x) (!_Testobj_IS_DATA(x))

#define _Testobj_CXX_DATA(x) (*(Testobj**) (EXTDATA(VAL(x))))
#define _Testobj_CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Testobj* >::type))
#define _Testobj_CXX_ISNT_DATA(x) (!_Testobj_CXX_IS_DATA(x))

#include<strstream.h>

void display_testobjptr(SCM c, SCM port, int mode)
{
        ostrstream oss;
        if (*_Testobj_DATA(c))
        	oss << **_Testobj_DATA(c);
        oss << ends;
        char *buffer = oss.str();
        Puts(buffer, FILEPTR(port));
        delete buffer;
}

void mark_testobjptr(SCM p)
{
        //cout << "mark_testobjptr" << endl;
        Register<Testobj>::markEntry(*_Testobj_DATA(p));
}

void free_testobjptr(SCM p)
{
        //cout << "free_testobjptr" << endl;
        if (!EXTSTATICP(p)) {
                delete _Testobj_DATA(p);
        }
}

static PRIMITIVE MakeTestobjCmd(SCM num)
{
        Tcl_HashEntry *p;
        SCM objptr;
        Testobj *ap, **app;
        int not_found;

        if (NINTEGERP(num))
                Err("usage:  make-testobj <integer>", NIL);
        ap = new Testobj(INTEGER(num));
        //Register<Testobj>::createEntry(ap);
        Register<Testobj>::createEntry(Wrapper<Testobj>::type, 
				       Wrapper<Testobj>::name, ap);
        app = new Testobj *(ap);
        return STk_make_CXXwrapper(Wrapper<Testobj*>::type,
                        Wrapper<Testobj*>::name, (void *) app, LINK_DYNAMIC);
}

static PRIMITIVE eqvTestobj(SCM a, SCM b)
{
  if (Wrapper<Testobj*>::compareItems(a, b) == 0)
        return Truth;
  return Ntruth;
}

static PRIMITIVE lthTestobj(SCM a, SCM b)
{
  if (Wrapper<Testobj*>::compareItems(a, b) < 0)
        return Truth;
  return Ntruth;
}

static PRIMITIVE leTestobj(SCM a, SCM b)
{
  if (Wrapper<Testobj*>::compareItems(a, b) <= 0)
        return Truth;
  return Ntruth;
}

static PRIMITIVE grTestobj(SCM a, SCM b)
{
  if (Wrapper<Testobj*>::compareItems(a, b) > 0)
        return Truth;
  return Ntruth;
}

static PRIMITIVE geTestobj(SCM a, SCM b)
{
  if (Wrapper<Testobj*>::compareItems(a, b) >= 0)
        return Truth;
  return Ntruth;
}

static PRIMITIVE GetTestobjSize(SCM a)
{
  SCM z;
  struct stat *info;

  if (_Testobj_CXX_ISNT_DATA(a))
    Err("testobj-size: bad structure ", a);
  NEWCELL(z, tc_integer);
  SET_INTEGER(z, _Testobj_CXX_DATA(a)->current_size);
  return z;
}

static SCM TestobjpCmd(SCM ctr)
{
        return _Testobj_CXX_IS_DATA(ctr) ? Truth : Ntruth;
}

// define methods above, register below

void genExtra_Testobj_Methods() 
{
        STk_add_new_cpp_primitive("make-testobj", tc_subr_1,
                                        (PRIMITIVE (*)(...))MakeTestobjCmd);
        STk_add_new_cpp_primitive("testobj-eqv?", tc_subr_2,
                                        (PRIMITIVE (*)(...))eqvTestobj);
        STk_add_new_cpp_primitive("testobj-<", tc_subr_2,
                                        (PRIMITIVE (*)(...))lthTestobj);
        STk_add_new_cpp_primitive("testobj-<=", tc_subr_2,
                                        (PRIMITIVE (*)(...))leTestobj);
        STk_add_new_cpp_primitive("testobj->", tc_subr_2,
                                        (PRIMITIVE (*)(...))grTestobj);
        STk_add_new_cpp_primitive("testobj->=", tc_subr_2,
                                        (PRIMITIVE (*)(...))geTestobj);
        STk_add_new_cpp_primitive("testobj?", tc_subr_1,
                                        (PRIMITIVE (*)(...))TestobjpCmd);
        STk_add_new_cpp_primitive("size-testobj", tc_subr_1,
                                        (PRIMITIVE (*)(...))GetTestobjSize);
        addTwoArgMethod("eqv?", Wrapper<Testobj*>::name,
                        Wrapper<Testobj*>::name, "testobj-eqv?", LINK_OVL);
        addBooleanMethod("<",
                        Wrapper<Testobj*>::name, "testobj-<", LINK_OVL);
        addBooleanMethod("<=",
                        Wrapper<Testobj*>::name, "testobj-<=", LINK_OVL);
        addBooleanMethod(">",
                        Wrapper<Testobj*>::name, "testobj->", LINK_OVL);
        addBooleanMethod(">=",
                        Wrapper<Testobj*>::name, "testobj->=", LINK_OVL);
}

