returns a version of \fIs\fP appropriate to be used as an identifier
in a dot file.
.TP
+\fBhtml\fP(\fIg\fP : \fBgraph_t\fP, \fIs\fP : \fBstring\fP) : \fBstring\fP
+returns a ``magic'' version of \fIs\fP as an HTML string. This will typically be
+used to attach an HTML-like label to a graph object. Note that the returned string
+lives in \fIg\fP. In particular, it will be freed when \fIg\fP is closed, and to
+act as an HTML string, it has to be used with an object of \fIg\fP. In addition,
+note that the
+angle bracket quotes should not be part of \fIs\fP. These will be added if
+\fIg\fP is written in concrete DOT format.
+.TP
\fBxOf\fP(\fIs\fP : \fBstring\fP) : \fBstring\fP
returns the string "\fIx\fP" if \fIs\fP has the form "\fIx\fP,\fIy\fP",
where both \fIx\fP and \fIy\fP are numeric.
Colon\(hyseparated list of directories to be searched to find
the file specified by the \-f option.
.SH BUGS AND WARNINGS
-Scripts should be careful deleting nodes during \fBN{}\fP and \fBE{}\fp
+Scripts should be careful deleting nodes during \fBN{}\fP and \fBE{}\fP
blocks using BFS and DFS traversals as these rely on stacks and queues of
nodes.
.PP
return exstring(pgm, sfstruse(tmps));
}
+/* toHtml:
+ * Create a string marked as HTML
+ */
+char *toHtml(Agraph_t* g, char *arg)
+{
+ return agstrdup_html (g, arg);
+}
+
/* canon:
* Canonicalize a string for printing.
*/
return p;
}
+
#include <stdlib.h>
#ifdef WIN32
#include "compat.h"
extern int closeFile(Expr_t *, int);
extern char *readLine(Expr_t *, int);
extern char *canon(Expr_t * pgm, char *);
+ extern char *toHtml(Agraph_t*, char *);
extern char *toLower(Expr_t * pgm, char *, Sfio_t*);
extern char *toUpper(Expr_t * pgm, char *, Sfio_t*);
extern int deleteObj(Agraph_t * g, Agobj_t * obj);
case F_canon:
v.string = canon(pgm, args[0].string);
break;
+ case F_html:
+ gp = INT2PTR(Agraph_t *, args[0].integer);
+ if (gp) {
+ v.string = toHtml(gp, args[1].string);
+ } else {
+ error(ERROR_WARNING, "NULL graph passed to html()");
+ v.string = 0;
+ }
+ break;
case F_tolower:
v.string = toLower(pgm, args[0].string, state->tmp);
break;
F_yof "yOf" FUNCTION S|A(1,S)
F_llof "llOf" FUNCTION S|A(1,S)
F_urof "urOf" FUNCTION S|A(1,S)
+F_html "html" FUNCTION S|A(1,G)|A(2,S)
F_canon "canon" FUNCTION S|A(1,S)
F_get "aget" FUNCTION S|A(1,O)|A(2,S)
F_set "aset" FUNCTION I|A(1,O)|A(2,S)|A(3,S)