Graphviz 13.0.0~dev.20241222.1117
Loading...
Searching...
No Matches
tcldot.h
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11
12#include <tcl.h>
13#ifdef EXTERN
14// tcl.h defines `EXTERN` which interferes with the `EXTERN` in globals.h
15#undef EXTERN
16#endif
17#include <common/render.h>
18#include <gvc/gvc.h>
19#include <gvc/gvio.h>
20#include "../../plugin/core/tcl_context.h"
21
22/*
23 * ictx - one per tcl interpreter, may support multiple graph namespaces
24 */
25typedef struct {
26 Agdisc_t mydisc; /* must be first to allow casting mydisc to ictx */
28 uint64_t ctr; /* odd number counter for anon objects over all g's in interp */
29 Tcl_Interp *interp;
31} ictx_t;
32
33/*
34 * gctx - one for each graph in a tcl interp
35 */
36typedef struct {
37 Agraph_t *g; /* the graph */
39 uint64_t idx;
40} gctx_t;
41
42#ifdef HAVE_LIBGD
43extern void *GDHandleTable;
44extern int Gdtclft_Init(Tcl_Interp *);
45#endif
46
47extern int graphcmd(ClientData clientData, Tcl_Interp * interp, int argc, const char *argv[]);
48extern int nodecmd(ClientData clientData, Tcl_Interp * interp, int argc, const char *argv[]);
49extern int edgecmd(ClientData clientData, Tcl_Interp * interp, int argc, const char *argv[]);
50
51extern int myiodisc_afread(void* channel, char *ubuf, int n);
52extern int myiodisc_memiofread(void *chan, char *buf, int bufsize);
53extern Agiddisc_t myiddisc;
54extern Agraph_t *cmd2g(const char *cmd);
55extern Agnode_t *cmd2n(const char *cmd);
56extern Agedge_t *cmd2e(const char *cmd);
57extern char *obj2cmd(void *obj);
58extern void deleteEdge(gctx_t *gctx, Agraph_t * g, Agedge_t * e);
59extern void deleteNode(gctx_t *gctx, Agraph_t * g, Agnode_t * n);
60extern void deleteGraph(gctx_t *gctx, Agraph_t * g);
61extern void listGraphAttrs (Tcl_Interp * interp, Agraph_t* g);
62extern void listNodeAttrs (Tcl_Interp * interp, Agraph_t* g);
63extern void listEdgeAttrs (Tcl_Interp * interp, Agraph_t* g);
64
65extern void setgraphattributes(Agraph_t * g, char *argv[], int argc);
66extern void setedgeattributes(Agraph_t * g, Agedge_t * e, char *argv[], int argc);
67extern void setnodeattributes(Agraph_t * g, Agnode_t * n, char *argv[], int argc);
68
69extern size_t Tcldot_string_writer(GVJ_t *job, const char *s, size_t len);
70extern size_t Tcldot_channel_writer(GVJ_t *job, const char *s, size_t len);
71
72extern void tcldot_layout(GVC_t *gvc, Agraph_t * g, const char *engine);
73
75char **tcldot_argv_dup(int argc, const char *argv[]);
77void tcldot_argv_free(int argc, char *argv[]);
static char * cmd
Definition acyclic.c:40
Tcl_AppInitProc Gdtclft_Init
Definition gdtclft.c:41
static double len(glCompPoint p)
Definition glutils.c:150
static GVC_t * gvc
Definition gv.cpp:23
Graphviz context library.
static gvloadimage_engine_t engine
user's discipline
Definition cgraph.h:337
object ID allocator discipline
Definition cgraph.h:316
IO services.
Definition cgraph.h:327
graph or subgraph
Definition cgraph.h:425
Definition gvcint.h:80
Agraph_t * g
Definition tcldot.h:37
ictx_t * ictx
Definition tcldot.h:38
uint64_t idx
Definition tcldot.h:39
Tcl_Interp * interp
Definition tcldot.h:29
uint64_t ctr
Definition tcldot.h:28
Agdisc_t mydisc
Definition tcldot.h:26
Agiodisc_t myioDisc
Definition tcldot.h:27
GVC_t * gvc
Definition tcldot.h:30
void tcldot_layout(GVC_t *gvc, Agraph_t *g, const char *engine)
void setgraphattributes(Agraph_t *g, char *argv[], int argc)
void listNodeAttrs(Tcl_Interp *interp, Agraph_t *g)
void listGraphAttrs(Tcl_Interp *interp, Agraph_t *g)
void deleteEdge(gctx_t *gctx, Agraph_t *g, Agedge_t *e)
Definition tcldot-util.c:80
int graphcmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
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)
Definition tcldot-util.c:27
char * obj2cmd(void *obj)
Definition tcldot-util.c:66
Agraph_t * cmd2g(const char *cmd)
Definition tcldot-util.c:41
void deleteGraph(gctx_t *gctx, Agraph_t *g)
size_t Tcldot_string_writer(GVJ_t *job, const char *s, size_t len)
Definition tcldot-util.c:20
void listEdgeAttrs(Tcl_Interp *interp, Agraph_t *g)
Agedge_t * cmd2e(const char *cmd)
Definition tcldot-util.c:55
void setnodeattributes(Agraph_t *g, Agnode_t *n, char *argv[], int argc)
int myiodisc_memiofread(void *chan, char *buf, int bufsize)
Definition tcldot-io.c:88
void setedgeattributes(Agraph_t *g, Agedge_t *e, char *argv[], int argc)
int myiodisc_afread(void *channel, char *ubuf, int n)
Definition tcldot-io.c:31
int edgecmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
Agiddisc_t myiddisc
Definition tcldot-id.c:97
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
int nodecmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
Agnode_t * cmd2n(const char *cmd)
Definition tcldot-util.c:48
Definition grammar.c:93