19 static char *strdup_and_subst_obj0 (
char *
str,
void *obj,
int escBackslash);
26 int oldsz = lp->
u.
txt.nspans + 1;
29 span = &(lp->
u.
txt.span[lp->
u.
txt.nspans]);
31 span->
just = terminator;
32 if (line && line[0]) {
53 char c, *p, *line, *lineptr, *
str = lp->
text;
54 unsigned char byte = 0x00;
60 line = lineptr =
NULL;
62 line = lineptr =
N_GNEW(strlen(p) + 1,
char);
65 byte = (
unsigned char) c;
84 storeline(gvc, lp, line, *p);
93 }
else if (c ==
'\n') {
95 storeline(gvc, lp, line,
'n');
103 if (line != lineptr) {
105 storeline(gvc, lp, line,
'n');
142 rv->
text = strdup(str);
148 rv->
text = strdup(str);
170 rv->
text = strdup_and_subst_obj0(str, obj, 0);
199 for (i = 0; i < cnt; i++) {
200 if ((i == 0) && tlp->
str)
239 if (lp->
u.
txt.nspans < 1)
260 for (i = 0; i < lp->
u.
txt.nspans; i++) {
261 switch (lp->
u.
txt.span[i].just) {
276 p.
y -= lp->
u.
txt.span[i].size.y;
289 static char *strdup_and_subst_obj0 (
char *
str,
void *obj,
int escBackslash)
291 char c, *
s, *p, *t, *newstr;
292 char *tp_str =
"", *hp_str =
"";
293 char *g_str =
"\\G", *n_str =
"\\N", *e_str =
"\\E",
294 *h_str =
"\\H", *t_str =
"\\T", *l_str =
"\\L";
295 size_t g_len = 2, n_len = 2, e_len = 2,
296 h_len = 2, t_len = 2, l_len = 2,
297 tp_len = 0, hp_len = 0;
307 g_len = strlen(g_str);
311 if (str) l_len = strlen(l_str);
316 g_len = strlen(g_str);
318 n_len = strlen(n_str);
322 if (str) l_len = strlen(l_str);
328 g_len = strlen(g_str);
330 t_len = strlen(t_str);
332 if ((tp_str = pt.
name))
333 tp_len = strlen(tp_str);
335 h_len = strlen(h_str);
337 if ((hp_str = pt.
name))
338 hp_len = strlen(hp_str);
339 h_len = strlen(h_str);
343 if (str) l_len = strlen(l_str);
349 e_len = t_len + (tp_len?tp_len+1:0) + 2 + h_len + (hp_len?hp_len+1:0);
358 for (s = str; (c = *s++);) {
396 for (s = str, p = newstr; (c = *s++);) {
400 for (t = g_str; (*p = *t++); p++);
403 for (t = n_str; (*p = *t++); p++);
407 for (t = t_str; (*p = *t++); p++);
410 for (t = tp_str; (*p = *t++); p++);
412 for (t = e_str; (*p = *t++); p++);
413 for (t = h_str; (*p = *t++); p++);
416 for (t = hp_str; (*p = *t++); p++);
421 for (t = t_str; (*p = *t++); p++);
424 for (t = h_str; (*p = *t++); p++);
427 for (t = l_str; (*p = *t++); p++);
453 return strdup_and_subst_obj0 (str, obj, 1);
460 static int xml_isentity(
char *s)
465 if (*s ==
'x' || *s ==
'X') {
467 while ((*s >=
'0' && *s <=
'9')
468 || (*s >=
'a' && *s <=
'f')
469 || (*s >=
'A' && *s <=
'F'))
472 while (*s >=
'0' && *s <=
'9')
476 while ((*s >=
'a' && *s <=
'z')
477 || (*s >=
'A' && *s <=
'Z'))
499 static char *buf =
NULL;
500 static int bufsize = 0;
511 if (pos > (bufsize - 8)) {
517 if (*s ==
'&' && (raw || !(xml_isentity(s)))) {
523 else if (*s ==
'<') {
527 else if (*s ==
'>') {
531 else if (*s ==
'-') {
535 else if (*s ==
' ' && prev && *prev ==
' ') {
540 else if (*s ==
'"') {
544 else if (*s ==
'\'') {
548 else if ((*s ==
'\n') && raw) {
552 else if ((*s ==
'\r') && raw) {
574 static char *buf =
NULL;
575 static int bufsize = 0;
589 if (pos > (bufsize - 8)) {
595 if (*s ==
'&' && !(xml_isentity(s))) {
601 else if (*s ==
'<') {
605 else if (*s ==
'>') {
610 else if (*s ==
'-') {
614 else if (*s ==
' ' && prev && *prev ==
' ') {
620 else if (*s ==
'"') {
624 else if (*s ==
'\'') {
void free_label(textlabel_t *p)
CGRAPH_API int agobjkind(void *)
char * latin1ToUTF8(char *s)
void * grealloc(void *ptr, size_t size)
char * htmlEntityUTF8(char *s, graph_t *g)
char * xml_url_string(char *s)
CGRAPH_API int agisdirected(Agraph_t *g)
void emit_label(GVJ_t *job, emit_state_t emit_state, textlabel_t *lp)
void gvrender_end_label(GVJ_t *job)
void * gmalloc(size_t nbytes)
int make_html_label(void *obj, textlabel_t *lp)
int agerr(agerrlevel_t level, const char *fmt,...)
void gvrender_begin_label(GVJ_t *job, label_type type)
CGRAPH_API Agraph_t * agroot(void *obj)
char * strdup_and_subst_obj(char *str, void *obj)
#define ZALLOC(size, ptr, type, osize)
CGRAPH_API Agraph_t * agraphof(void *obj)
CGRAPH_API Agnode_t * agtail(Agedge_t *e)
struct textlabel_t::@20::@21 txt
void free_html_label(htmllabel_t *lp, int root)
CGRAPH_API Agnode_t * aghead(Agedge_t *e)
char * xml_string(char *s)
CGRAPH_API char * agnameof(void *)
void gvrender_set_pencolor(GVJ_t *job, char *name)
void free_textspan(textspan_t *tl, int cnt)
void gvrender_textspan(GVJ_t *job, pointf p, textspan_t *span)
void emit_html_label(GVJ_t *job, htmllabel_t *lp, textlabel_t *tp)
void(* free_layout)(void *layout)
pointf textspan_size(GVC_t *gvc, textspan_t *span)
void make_simple_label(GVC_t *gvc, textlabel_t *lp)
char * xml_string0(char *s, boolean raw)
textlabel_t * make_label(void *obj, char *str, int kind, double fontsize, char *fontname, char *fontcolor)