27 interp,
"wrong # args: should be \"", argv[0],
28 " graphtype ?graphname? ?attributename attributevalue? ?...?\"",
NULL);
31 if (strcmp(
"digraph", argv[1]) == 0) {
33 }
else if (strcmp(
"digraphstrict", argv[1]) == 0) {
35 }
else if (strcmp(
"graph", argv[1]) == 0) {
37 }
else if (strcmp(
"graphstrict", argv[1]) == 0) {
40 Tcl_AppendResult(interp,
"bad graphtype \"", argv[1],
"\": must be one of:",
41 "\n\tdigraph, digraphstrict, graph, graphstrict.",
NULL);
50#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 4
60 Tcl_AppendResult(interp,
"\nFailure to open graph.",
NULL);
69static int dotnew(ClientData clientData, Tcl_Interp *interp,
int argc,
77static int dotread(ClientData clientData, Tcl_Interp *interp,
int argc,
88 Tcl_AppendResult(interp,
"wrong # args: should be \"", argv[0],
89 " fileHandle\"",
NULL);
94 Tcl_AppendResult(interp,
"\nChannel \"", argv[1],
"\"",
"is unreadable.",
106 Tcl_AppendResult(interp,
"\nFailure to read graph \"", argv[1],
"\"",
NULL);
108 Tcl_AppendResult(interp,
" because of syntax errors.",
NULL);
113 Tcl_AppendResult(interp,
"\nSyntax errors in file \"", argv[1],
" \"",
121static int dotstring(ClientData clientData, Tcl_Interp *interp,
int argc,
122 const char *argv[]) {
128 Tcl_AppendResult(interp,
"wrong # args: should be \"", argv[0],
" string\"",
142 Tcl_AppendResult(interp,
"\nFailure to read string \"", argv[1],
"\"",
145 Tcl_AppendResult(interp,
" because of syntax errors.",
NULL);
150 Tcl_AppendResult(interp,
"\nSyntax errors in string \"", argv[1],
" \"",
178 if (Tcl_InitStubs(interp, TCL_VERSION, 0) ==
NULL) {
182 if (Tcl_PkgRequire(interp,
"Tcl", TCL_VERSION, 0) ==
NULL) {
188 char adjusted_version[
sizeof(PACKAGE_VERSION)] = PACKAGE_VERSION;
189 char *tilde_dev = strstr(adjusted_version,
"~dev.");
190 if (tilde_dev !=
NULL) {
192 memmove(tilde_dev + 1, tilde_dev + strlen(
"~dev."),
193 strlen(tilde_dev + strlen(
"~dev.")) + 1);
195 if (Tcl_PkgProvide(interp,
"Tcldot", adjusted_version) != TCL_OK) {
206 Tcl_CreateCommand(interp,
"dotnew",
dotnew, ictx,
free);
207 Tcl_CreateCommand(interp,
"dotread",
dotread, ictx,
NULL);
208 Tcl_CreateCommand(interp,
"dotstring",
dotstring, ictx,
NULL);
Memory allocation wrappers that exit on failure.
static char * gv_strdup(const char *original)
lt_symlist_t lt_preloaded_symbols[]
Tcl_AppInitProc Gdtclft_Init
Agdesc_t Agundirected
undirected
Agdesc_t Agstrictundirected
strict undirected
Agdesc_t Agstrictdirected
strict directed. A strict graph cannot have multi-edges or self-arcs.
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Agraph_t * agread(void *chan, Agdisc_t *disc)
constructs a new graph
Agdesc_t Agdirected
directed
GVC_t * gvContextPlugins(const lt_symlist_t *builtins, int demand_loading)
int(* afread)(void *chan, char *buf, int bufsize)
int(* putstr)(void *chan, const char *str)
int myiodisc_memiofread(void *chan, char *buf, int bufsize)
int myiodisc_afread(void *channel, char *ubuf, int n)
void setgraphattributes(Agraph_t *g, char *argv[], int argc)
char * obj2cmd(void *obj)
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 Tcldot_SafeInit(Tcl_Interp *interp)
int Tcldot_Init(Tcl_Interp *interp)
int Tcldot_builtin_Init(Tcl_Interp *interp)
static int dotstring(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
static int dotnew_internal(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
static int dotread(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
static int dotnew(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
#define Tcl_GetStringResult(interp)