#include<stk.h>
#include<LINK/stkWrapper/LINK_STk.h>
#include<LINK/stkWrapper/Wrapper.h>
#include<LINK/stkWrapper/Register.h>
#include<LINK/generator/Generators.h>
#include<LINK/graph/UBinGraph.h>
#include<LINK/graph/Graph.h>

#include <stdio.h>
#include <stdlib.h>

static PRIMITIVE GenRandomCmd(SCM n)
{
        Graph *gr;
        if (!INTEGERP(n))
                Err("gen-random-graph: bad arg 1, <integer> expected", n);
	int sz = INTEGER(n);
        Graph *g = GenCycle(sz);
        Register<Graph>::createEntry(Wrapper<UBinGraph>::type,
                                     Wrapper<UBinGraph>::name, g);
        Graph **gp = new Graph*(g);

        return STk_make_CXXwrapper(Wrapper<UBinGraph*>::type,
                Wrapper<UBinGraph*>::name, (void *) gp, LINK_DYNAMIC);
}

void gen_Cycle_Wrapper()
{
        STk_add_new_cpp_primitive("gen-random-graph", tc_subr_1,
                               (PRIMITIVE (*)(...))GenCycleCmd);
}
