#include<stk.h>
#include<strstream.h>
#include<LINK/stkWrapper/LINK_STk.h>
#include<LINK/layout/Layouts.h>
#include<LINK/algorithm/Algorithms.h>
#include<LINK/graph/Graph.h>

static PRIMITIVE CircleLayoutCmd(SCM g)
{
        Graph *gr;
        if (!(gr = getGraph(g)))
                Err("circle-layout!: bad arg 1, graph expected", g);
        CircleLayout(gr);

        return UNDEFINED;
}

static PRIMITIVE CircleLayoutAnimCmd(SCM g, SCM gv)
{
        Graph *gr;
        if (!(gr = getGraph(g)))
                Err("circle-layout!: bad arg 1, graph expected", g);
        CircleLayout(gr);
	char *vname = getViewName(gv);
	path_draw(vname);
	layoutVertices(vname);

        return UNDEFINED;
}

void gen_CircleLayout_Wrapper()
{
        STk_add_new_cpp_primitive("circle-layout", tc_subr_1,
                               (PRIMITIVE (*)(...))CircleLayoutCmd);
        STk_add_new_cpp_primitive("circle-layout*", tc_subr_2,
                               (PRIMITIVE (*)(...))CircleLayoutAnimCmd);
}
