#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 DFSLayoutCmd(SCM g)
{
        Graph *gr;
        if (!(gr = getGraph(g)))
                Err("dfs-layout!: bad arg 1, graph expected", g);
        DFSLayout(gr);

        return UNDEFINED;
}

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

        return UNDEFINED;
}

void gen_DFSLayout_Wrapper()
{
        STk_add_new_cpp_primitive("dfs-layout", tc_subr_1,
                               (PRIMITIVE (*)(...))DFSLayoutCmd);
        STk_add_new_cpp_primitive("dfs-layout*", tc_subr_2,
                               (PRIMITIVE (*)(...))DFSLayoutAnimCmd);
}
