#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/UHyperGraph.h>
#include<LINK/graph/Graph.h>

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

static PRIMITIVE GenUHyperGraphKUCmd(SCM n, SCM m, SCM k)
{
        Graph *gr;
        if (!INTEGERP(n))
            Err("gen-uniform-hypergraph: bad arg 1, #v (<integer>) expected",n);
        if (!INTEGERP(m))
            Err("gen-uniform-hypergraph: bad arg 1, #e (<integer>) expected",m);
        if (!INTEGERP(k))
            Err("gen-uniform-hypergraph: bad arg 1, #v (<integer>) expected",k);
	int num_verts = INTEGER(n);
	int num_edges = INTEGER(m);
	int edge_size = INTEGER(k);
        Graph *g = GenUHyperGraphKU(num_verts, num_edges, edge_size);
        Register<Graph>::createEntry(Wrapper<UBinGraph>::type,
                                     Wrapper<UBinGraph>::name, g);
        Graph **gp = new Graph*(g);

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

void gen_UHyperGraphKU_Wrapper()
{
        STk_add_new_cpp_primitive("gen-uniform-hypergraph", tc_subr_3,
                               (PRIMITIVE (*)(...))GenUHyperGraphKUCmd);
}
