Graphviz 13.0.0~dev.20250424.1043
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1
3/*************************************************************************
4 * Copyright (c) 2011 AT&T Intellectual Property
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * https://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors: Details at https://graphviz.org
11 *************************************************************************/
12
13#pragma once
14
15#include "config.h"
16
17#include <stdbool.h>
18#include <stddef.h>
19#include <util/agxbuf.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#ifdef GVDLL
26#ifdef GVC_EXPORTS
27#define UTILS_API __declspec(dllexport)
28#else
29#define UTILS_API __declspec(dllimport)
30#endif
31#endif
32
33#ifndef UTILS_API
34#define UTILS_API /* nothing */
35#endif
36
37UTILS_API pointf Bezier(pointf *, double, pointf *, pointf *);
38
40UTILS_API double attach_attrs_and_arrows(graph_t *, bool *, bool *);
41
42UTILS_API void write_plain(GVJ_t *job, graph_t *g, FILE *f, bool extend);
43
45UTILS_API double yDir(double y, double yOff);
46UTILS_API char *ps_string(char *s, int);
47UTILS_API char *strdup_and_subst_obj(char *str, void *obj);
48UTILS_API void epsf_emit_body(GVJ_t *job, usershape_t *us);
49UTILS_API void epsf_define(GVJ_t *job);
50UTILS_API void undoClusterEdges(graph_t *g);
51UTILS_API Dt_t *mkClustMap(Agraph_t *g);
52UTILS_API Agraph_t *findCluster(Dt_t *map, char *name);
53UTILS_API attrsym_t *safe_dcl(graph_t *g, int obj_kind, char *name,
54 char *defaultValue);
55
56UTILS_API int late_int(void *obj, Agsym_t *attr, int defaultValue, int minimum);
57UTILS_API double late_double(void *obj, Agsym_t *attr, double defaultValue,
58 double minimum);
59UTILS_API char *late_nnstring(void *obj, Agsym_t *attr, char *defaultValue);
60UTILS_API char *late_string(void *obj, Agsym_t *attr, char *defaultValue);
61UTILS_API bool late_bool(void *obj, Agsym_t *attr, bool defaultValue);
62UTILS_API double get_inputscale(graph_t *g);
63
64// routines for supporting “union-find”, a.k.a. “disjoint-set forest”
65// https://en.wikipedia.org/wiki/Disjoint-set_data_structure
66UTILS_API Agnode_t *UF_find(Agnode_t *);
67UTILS_API Agnode_t *UF_union(Agnode_t *, Agnode_t *);
68UTILS_API void UF_singleton(Agnode_t *);
69UTILS_API void UF_setname(Agnode_t *, Agnode_t *);
70
71UTILS_API const char *safefile(const char *filename);
72
73UTILS_API bool mapBool(const char *p, bool defaultValue);
74UTILS_API bool mapbool(const char *p);
75UTILS_API int maptoken(char *, char **, int *);
76
77UTILS_API bool findStopColor(const char *colorlist, char *clrs[2],
78 double *frac);
79UTILS_API int test_toggle(void);
80
81UTILS_API void common_init_node(node_t *n);
82UTILS_API void common_init_edge(edge_t *e);
83
84UTILS_API void updateBB(graph_t *g, textlabel_t *lp);
85UTILS_API void compute_bb(Agraph_t *);
86UTILS_API boxf polyBB(polygon_t *poly);
87UTILS_API bool overlap_node(node_t *n, boxf b);
88UTILS_API bool overlap_label(textlabel_t *lp, boxf b);
89UTILS_API bool overlap_edge(edge_t *e, boxf b);
90
91UTILS_API void get_gradient_points(pointf *A, pointf *G, size_t n, double angle,
92 int flags);
93
94UTILS_API void processClusterEdges(graph_t *g);
95
96UTILS_API char *latin1ToUTF8(char *);
97UTILS_API char *htmlEntityUTF8(char *, graph_t *g);
98UTILS_API char *utf8ToLatin1(char *ins);
99UTILS_API char *scanEntity(char *t, agxbuf *xb);
100
101UTILS_API pointf dotneato_closest(splines *spl, pointf p);
102
103UTILS_API Agsym_t *setAttr(graph_t *, void *, char *name, char *value,
104 Agsym_t *);
105UTILS_API void setEdgeType(graph_t *g, int defaultValue);
106UTILS_API bool is_a_cluster(Agraph_t *g);
107
108/* from postproc.c */
109UTILS_API void gv_nodesize(Agnode_t *n, bool flip);
110
111#ifndef HAVE_DRAND48
112UTILS_API double drand48(void);
113#endif
114
115/* from timing.c */
116UTILS_API void start_timer(void);
117UTILS_API double elapsed_sec(void);
118
119/* from psusershape.c */
120UTILS_API void cat_libfile(GVJ_t *job, const char **arglib,
121 const char **stdlib);
122
123#undef UTILS_API
124
125#ifdef __cplusplus
126}
127#endif
static void ins(Dict_t *d, Dtlink_t **set, Agedge_t *e)
Definition edge.c:150
#define A(n, t)
Definition expr.h:76
static int flags
Definition gc.c:61
#define G
Definition gdefs.h:7
textitem scanner parser str
Definition htmlparse.y:224
graph or subgraph
Definition cgraph.h:424
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:651
Definition geom.h:41
Definition cdt.h:100
Definition grammar.c:93
void processClusterEdges(graph_t *g)
Definition utils.c:927
void undoClusterEdges(graph_t *g)
Definition utils.c:1026
char * scanEntity(char *t, agxbuf *xb)
Definition utils.c:1078
char * late_string(void *obj, Agsym_t *attr, char *defaultValue)
Definition utils.c:80
char * strdup_and_subst_obj(char *str, void *obj)
Definition labels.c:385
bool mapbool(const char *p)
Definition utils.c:337
char * htmlEntityUTF8(char *, graph_t *g)
Definition utils.c:1179
void UF_setname(Agnode_t *, Agnode_t *)
Definition utils.c:145
Agnode_t * UF_union(Agnode_t *, Agnode_t *)
Definition utils.c:110
Dt_t * mkClustMap(Agraph_t *g)
Definition utils.c:1588
void setEdgeType(graph_t *g, int defaultValue)
Definition utils.c:1419
boxf polyBB(polygon_t *poly)
Definition utils.c:601
void common_init_node(node_t *n)
Definition utils.c:423
bool overlap_label(textlabel_t *lp, boxf b)
Definition utils.c:1319
double elapsed_sec(void)
Definition timing.c:48
Agsym_t * setAttr(graph_t *, void *, char *name, char *value, Agsym_t *)
Definition utils.c:701
bool findStopColor(const char *colorlist, char *clrs[2], double *frac)
Definition emit.c:4008
bool late_bool(void *obj, Agsym_t *attr, bool defaultValue)
Definition utils.c:93
bool overlap_node(node_t *n, boxf b)
Definition utils.c:1307
Agnode_t * UF_find(Agnode_t *)
Definition utils.c:100
void UF_singleton(Agnode_t *)
Definition utils.c:138
void common_init_edge(edge_t *e)
Definition utils.c:506
const char * safefile(const char *filename)
Definition utils.c:260
pointf Bezier(pointf *, double, pointf *, pointf *)
Definition utils.c:170
void epsf_define(GVJ_t *job)
double attach_attrs_and_arrows(graph_t *, bool *, bool *)
Definition output.c:232
char * late_nnstring(void *obj, Agsym_t *attr, char *defaultValue)
Definition utils.c:86
attrsym_t * safe_dcl(graph_t *g, int obj_kind, char *name, char *defaultValue)
Definition utils.c:1061
double yDir(double y, double yOff)
Definition output.c:32
void compute_bb(Agraph_t *)
Definition utils.c:630
double get_inputscale(graph_t *g)
Definition utils.c:73
void start_timer(void)
Definition timing.c:43
void updateBB(graph_t *g, textlabel_t *lp)
Definition utils.c:621
int late_int(void *obj, Agsym_t *attr, int defaultValue, int minimum)
Definition utils.c:35
bool overlap_edge(edge_t *e, boxf b)
Definition utils.c:1354
void cat_libfile(GVJ_t *job, const char **arglib, const char **stdlib)
char * ps_string(char *s, int)
char * latin1ToUTF8(char *)
Converts string from Latin1 encoding to utf8. Also translates HTML entities.
Definition utils.c:1256
void gv_nodesize(Agnode_t *n, bool flip)
Definition utils.c:1532
bool mapBool(const char *p, bool defaultValue)
Definition utils.c:321
double late_double(void *obj, Agsym_t *attr, double defaultValue, double minimum)
Definition utils.c:50
void epsf_emit_body(GVJ_t *job, usershape_t *us)
void write_plain(GVJ_t *job, graph_t *g, FILE *f, bool extend)
Definition output.c:117
int maptoken(char *, char **, int *)
Definition utils.c:311
pointf dotneato_closest(splines *spl, pointf p)
Definition utils.c:342
void get_gradient_points(pointf *A, pointf *G, size_t n, double angle, int flags)
Definition utils.c:1442
char * utf8ToLatin1(char *ins)
Definition utils.c:1289
int test_toggle(void)
Definition utils.c:412
bool is_a_cluster(Agraph_t *g)
Definition utils.c:692
Agraph_t * findCluster(Dt_t *map, char *name)
Definition utils.c:1598
double drand48(void)
Definition utils.c:1546