17 static int dotnew(ClientData clientData, Tcl_Interp * interp,
19 int argc,
char *argv[]
21 int argc, Tcl_Obj * CONST objv[]
32 Tcl_AppendResult(interp,
"wrong # args: should be \"", argv[0],
33 " graphtype ?graphname? ?attributename attributevalue? ?...?\"",
38 length = strlen(argv[1]);
39 if ((c ==
'd') && (strncmp(argv[1],
"digraph", length) == 0)) {
42 && (strncmp(argv[1],
"digraphstrict", length) == 0)) {
44 }
else if ((c ==
'g') && (strncmp(argv[1],
"graph", length) == 0)) {
47 && (strncmp(argv[1],
"graphstrict", length) == 0)) {
50 Tcl_AppendResult(interp,
"bad graphtype \"", argv[1],
"\": must be one of:",
51 "\n\tdigraph, digraphstrict, graph, graphstrict.",
NULL);
64 Tcl_AppendResult(interp,
"\nFailure to open graph.",
NULL);
73 static int dotread(ClientData clientData, Tcl_Interp * interp,
75 int argc,
char *argv[]
77 int argc, Tcl_Obj * CONST objv[]
89 Tcl_AppendResult(interp,
"Wrong # args: should be \"", argv[0],
" fileHandle\"",
NULL);
92 channel = Tcl_GetChannel(interp, argv[1], &mode);
93 if (channel ==
NULL || !(mode & TCL_READABLE)) {
94 Tcl_AppendResult(interp,
"\nChannel \"", argv[1],
"\"",
"is unreadable.",
NULL);
105 Tcl_AppendResult(interp,
"\nFailure to read graph \"", argv[1],
"\"",
NULL);
107 Tcl_AppendResult(interp,
" because of syntax errors.",
NULL);
112 Tcl_AppendResult(interp,
"\nSyntax errors in file \"", argv[1],
" \"",
NULL);
119 static int dotstring(ClientData clientData, Tcl_Interp * interp,
121 int argc,
char *argv[]
123 int argc, Tcl_Obj * CONST objv[]
137 Tcl_AppendResult(interp,
"Wrong # args: should be \"", argv[0],
" string\"",
NULL);
143 Tcl_AppendResult(interp,
"\nFailure to read string \"", argv[1],
"\"",
NULL);
145 Tcl_AppendResult(interp,
" because of syntax errors.",
NULL);
150 Tcl_AppendResult(interp,
"\nSyntax errors in string \"", argv[1],
" \"",
NULL);
157 #if defined(_BLD_tcldot) && defined(_DLL)
164 ictx = calloc(1,
sizeof(
ictx_t));
182 if (Tcl_InitStubs(interp, TCL_VERSION, 0) ==
NULL) {
186 if (Tcl_PkgRequire(interp,
"Tcl", TCL_VERSION, 0) ==
NULL) {
190 if (Tcl_PkgProvide(interp,
"Tcldot", PACKAGE_VERSION) != TCL_OK) {
195 Gdtclft_Init(interp);
202 Tcl_CreateCommand(interp,
"dotnew", dotnew,
203 (ClientData) ictx, (Tcl_CmdDeleteProc *)
NULL);
204 Tcl_CreateCommand(interp,
"dotread", dotread,
205 (ClientData) ictx, (Tcl_CmdDeleteProc *)
NULL);
206 Tcl_CreateCommand(interp,
"dotstring", dotstring,
207 (ClientData) ictx, (Tcl_CmdDeleteProc *)
NULL);
209 Tcl_CreateObjCommand(interp,
"dotnew", dotnew,
210 (ClientData) ictx, (Tcl_CmdDeleteProc *)
NULL);
211 Tcl_CreateObjCommand(interp,
"dotread", dotread,
212 (ClientData) ictx, (Tcl_CmdDeleteProc *)
NULL);
213 Tcl_CreateObjCommand(interp,
"dotstring", dotstring,
214 (ClientData) ictx, (Tcl_CmdDeleteProc *)
NULL);
CGRAPH_API Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
CGRAPH_API Agmemdisc_t AgMemDisc
CGRAPH_API Agiodisc_t AgIoDisc
int myiodisc_memiofread(void *chan, char *buf, int bufsize)
void setgraphattributes(Agraph_t *g, char *argv[], int argc)
CGRAPH_API Agdesc_t Agstrictundirected
char * obj2cmd(void *obj)
CGRAPH_API Agraph_t * agread(void *chan, Agdisc_t *disc)
int Tcldot_Init(Tcl_Interp *interp)
CGRAPH_API Agdesc_t Agundirected
CGRAPH_API Agdesc_t Agstrictdirected
CGRAPH_API Agdesc_t Agdirected
int Tcldot_builtin_Init(Tcl_Interp *interp)
lt_symlist_t lt_preloaded_symbols[]
int(* afread)(void *chan, char *buf, int bufsize)
GVC_t * gvContextPlugins(const lt_symlist_t *builtins, int demand_loading)
int myiodisc_afread(void *channel, char *ubuf, int n)
int Tcldot_SafeInit(Tcl_Interp *interp)
int(* putstr)(void *chan, const char *str)