1/* $Id$ $Revision$ */
2/* vim:set shiftwidth=4 ts=8: */
3
4/*************************************************************************
5 * Copyright (c) 2011 AT&T Intellectual Property
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 * Contributors: See CVS logs. Details at http://www.graphviz.org/
12 *************************************************************************/
13
14#ifndef _UTILS_H
15#define _UTILS_H 1
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21
22/*visual studio*/
23#ifdef _WIN32
24#ifndef GVC_EXPORTS
25#define extern __declspec(dllimport)
26#endif
27#endif
28/*end visual studio*/
29
30#ifndef HAVE_STRCASECMP
31 extern int strcasecmp(const char *s1, const char *s2);
32#endif
33#ifndef HAVE_STRNCASECMP
34 extern int strncasecmp(const char *s1, const char *s2, size_t n);
35#endif
36
37 extern nodequeue *new_queue(int);
38 extern void free_queue(nodequeue *);
39 extern void enqueue(nodequeue *, Agnode_t *);
40 extern Agnode_t *dequeue(nodequeue *);
41 extern pointf Bezier(pointf *, int, double, pointf *, pointf *);
42 extern void attach_attrs(graph_t * g);
43 extern void attach_attrs_and_arrows(graph_t*, int*, int*);
44 extern char *xml_string(char *str);
45 extern char *xml_string0(char *str, boolean raw);
46 extern void write_plain(GVJ_t * job, graph_t * g, FILE * f, boolean extend);
47 extern double yDir (double y);
48 extern char *ps_string(char *s, int);
49 extern char *strdup_and_subst_obj(char *str, void *obj);
50 extern char *xml_url_string(char *s);
51 extern void epsf_emit_body(GVJ_t *job, usershape_t *us);
52 extern void epsf_define(GVJ_t * job);
53 extern void undoClusterEdges(graph_t * g);
54 extern Dt_t* mkClustMap (Agraph_t* g);
55 extern Agraph_t* findCluster (Dt_t* map, char* name);
56 extern attrsym_t* safe_dcl(graph_t * g, int obj_kind, char *name, char *def);
57
58 extern int late_int(void *, Agsym_t *, int, int);
59 extern double late_double(void *, Agsym_t *, double, double);
60 extern char *late_nnstring(void *, Agsym_t *, char *);
61 extern char *late_string(void *, Agsym_t *, char *);
62 extern boolean late_bool(void *, Agsym_t *, int);
63 extern double get_inputscale (graph_t* g);
64
65 extern Agnode_t *UF_find(Agnode_t *);
66 extern Agnode_t *UF_union(Agnode_t *, Agnode_t *);
67 extern void UF_remove(Agnode_t *, Agnode_t *);
68 extern void UF_singleton(Agnode_t *);
69 extern void UF_setname(Agnode_t *, Agnode_t *);
70
71 extern char *Fgets(FILE * fp);
72 extern const char *safefile(const char *filename);
73
74 extern boolean mapBool(char *, boolean);
75 extern boolean mapbool(char *);
76 extern int maptoken(char *, char **, int *);
77
78 extern boolean findStopColor (char* colorlist, char* clrs[2], float* frac);
79 extern int test_toggle(void);
80
81 extern void common_init_node(node_t * n);
82 extern int common_init_edge(edge_t * e);
83
84 extern void updateBB(graph_t * g, textlabel_t * lp);
85 extern void compute_bb(Agraph_t *);
86 extern boxf polyBB (polygon_t* poly);
87 extern boolean overlap_node(node_t *n, boxf b);
88 extern boolean overlap_label(textlabel_t *lp, boxf b);
89 extern boolean overlap_edge(edge_t *e, boxf b);
90
91 extern void get_gradient_points(pointf * A, pointf * G, int n, float angle, int flags);
92
93 extern void processClusterEdges(graph_t * g);
94
95 extern char *latin1ToUTF8(char *);
96 extern char *htmlEntityUTF8(char *, graph_t* g);
97 extern char* utf8ToLatin1 (char* ins);
98 extern char* scanEntity (char* t, agxbuf* xb);
99
100 extern pointf dotneato_closest(splines * spl, pointf p);
101 extern pointf neato_closest(splines * spl, pointf p);
102 extern pointf spline_at_y(splines * spl, double y);
103
104 extern Agsym_t *setAttr(graph_t*, void*, char*name, char *value, Agsym_t*);
105 extern void setEdgeType (graph_t* g, int dflt);
106 extern int edgeType (char* s, int dflt);
107 extern int is_a_cluster (Agraph_t* g);
108
109 /* from postproc.c */
110 extern void gv_nodesize(Agnode_t * n, boolean flip);
111
112 /* from timing.c */
113 extern void start_timer(void);
114 extern double elapsed_sec(void);
115
116 /* from psusershape.c */
117 extern void cat_libfile(GVJ_t * job, const char **arglib, const char **stdlib);
118
119Agnodeinfo_t* ninf(Agnode_t* n);
120Agraphinfo_t* ginf(Agraph_t* g);
121Agedgeinfo_t* einf(Agedge_t* e);
122 /**/
123#ifdef _WIN32
124 extern void fix_fc(void);
125#endif
126
127#undef extern
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif /* _UTILS_H */
134