11#include "../tcl-compat.h"
34 return (
size_t)written;
42 if (sscanf(
cmd,
"graph%p", &g) != 1 || !g)
49 if (sscanf(
cmd,
"node%p", &n) != 1 || !n)
56 if (sscanf(
cmd,
"edge%p", &e) != 1 || !e)
68 case AGRAPH: snprintf(buf,
sizeof(buf),
"graph%p", obj);
break;
69 case AGNODE: snprintf(buf,
sizeof(buf),
"node%p", obj);
break;
71 case AGOUTEDGE: snprintf(buf,
sizeof(buf),
"edge%p", obj);
break;
144 if (strcmp(a->
name,
"label") == 0 && val[0] ==
'<') {
145 size_t len = strlen(val);
146 if (val[
len-1] ==
'>') {
159 for (
Tcl_Size i = 0; i < argc; i++) {
169 for (
Tcl_Size i = 0; i < argc; i++) {
171 if (strcmp(argv[i],
"key") == 0) {
190 for (
Tcl_Size i = 0; i < argc; i++) {
207 Tcl_AppendElement(interp, a->
name);
214 Tcl_AppendElement(interp, a->
name);
221 Tcl_AppendElement(interp, a->
name);
237 if (strcasecmp(
engine,
"nop") == 0) {
248 char **argv_ret =
gv_calloc((
size_t)argc,
sizeof(
char *));
249 for (
int i = 0; i < argc; ++i) {
256 for (
int i = 0; i < argc; ++i) {
Memory allocation wrappers that exit on failure.
static char * gv_strdup(const char *original)
static void * gv_calloc(size_t nmemb, size_t size)
static double len(glCompPoint p)
Agsym_t * agattr_text(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up text attributes of a graph
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
permits traversing the list of attributes of a given type
int agxset(void *obj, Agsym_t *sym, const char *value)
#define agfindedgeattr(g, a)
Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
#define agfindgraphattr(g, a)
int agisdirected(Agraph_t *g)
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
#define agfindnodeattr(g, a)
Agraph_t * agraphof(void *obj)
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
int agdelete(Agraph_t *g, void *obj)
deletes object. Equivalent to agclose, agdelnode, and agdeledge for obj being a graph,...
Agraph_t * agroot(void *obj)
char * agstrdup_html(Agraph_t *, const char *)
returns a pointer to a reference-counted HTML-like copy of the argument string, creating one if neces...
Agraph_t * agfstsubg(Agraph_t *g)
Agraph_t * agnxtsubg(Agraph_t *subg)
int agdelsubg(Agraph_t *g, Agraph_t *sub)
int gvFreeLayout(GVC_t *gvc, graph_t *g)
int gvLayout(GVC_t *gvc, graph_t *g, const char *engine)
Graphviz context library.
static gvloadimage_engine_t engine
platform abstraction for case-insensitive string functions
context used to convey information between commands and a renderer
struct Tcl_Interp * interp
TCL interpreter.
void tcldot_layout(GVC_t *gvc, Agraph_t *g, const char *engine)
static void myagxset(void *obj, Agsym_t *a, const char *val)
void listNodeAttrs(Tcl_Interp *interp, Agraph_t *g)
void listGraphAttrs(Tcl_Interp *interp, Agraph_t *g)
void setgraphattributes(Agraph_t *g, char *argv[], Tcl_Size argc)
void deleteEdge(gctx_t *gctx, Agraph_t *g, Agedge_t *e)
void deleteNode(gctx_t *gctx, Agraph_t *g, Agnode_t *n)
size_t Tcldot_channel_writer(GVJ_t *job, const char *s, size_t len)
char * obj2cmd(void *obj)
Agraph_t * cmd2g(const char *cmd)
void deleteGraph(gctx_t *gctx, Agraph_t *g)
static void deleteGraphNodes(gctx_t *gctx, Agraph_t *g)
size_t Tcldot_string_writer(GVJ_t *job, const char *s, size_t len)
void listEdgeAttrs(Tcl_Interp *interp, Agraph_t *g)
Agedge_t * cmd2e(const char *cmd)
void setnodeattributes(Agraph_t *g, Agnode_t *n, char *argv[], Tcl_Size argc)
void setedgeattributes(Agraph_t *g, Agedge_t *e, char *argv[], Tcl_Size argc)
static void deleteNodeEdges(gctx_t *gctx, Agraph_t *g, Agnode_t *n)
void tcldot_argv_free(int argc, char *argv[])
free the strings pointed to by argv
char ** tcldot_argv_dup(int argc, const char *argv[])
duplicate the strings pointed to by argv as non-const strings
Agnode_t * cmd2n(const char *cmd)