static int Rankdir;
-static bool Flip;
+static boolean Flip;
static point Offset;
static void place_flip_graph_label(graph_t * g);
translate_bb(GD_clust(g)[c], rankdir);
}
-void dot_nodesize(node_t * n, bool flip)
+void dot_nodesize(node_t * n, boolean flip)
{
double x, y;
int ps;
point offset;
} epsf_t;
- typedef void (*nodesizefn_t) (Agnode_t *, bool);
+ typedef void (*nodesizefn_t) (Agnode_t *, boolean);
extern void add_box(path *, box);
extern void arrow_flags(Agedge_t * e, int *sflag, int *eflag);
extern int arrowEndClip(edge_t*, point*, int, int , bezier*, int eflag);
extern int arrowStartClip(edge_t*, point* ps, int, int, bezier*, int sflag);
extern void attach_attrs(Agraph_t *);
- extern void beginpath(path *, Agedge_t *, int, pathend_t *, bool);
+ extern void beginpath(path *, Agedge_t *, int, pathend_t *, boolean);
extern void bezier_clip(inside_t * inside_context,
- bool(*insidefn) (inside_t * inside_context,
+ boolean(*insidefn) (inside_t * inside_context,
pointf p), pointf * sp,
- bool left_inside);
+ boolean left_inside);
extern shape_desc *bind_shape(char *name, node_t *);
extern void clip_and_install(edge_t *, edge_t *, point *, int,
splineInfo *);
extern char* charsetToStr (int c);
extern point coord(node_t * n);
extern void do_graph_label(graph_t * sg);
- extern void graph_init(graph_t * g, bool use_rankdir);
+ extern void graph_init(graph_t * g, boolean use_rankdir);
extern void graph_cleanup(graph_t * g);
extern void dotneato_args_initialize(GVC_t * gvc, int, char **);
extern void dotneato_usage(int);
extern void emit_jobs_eof(GVC_t * gvc);
extern void emit_map_rect(GVJ_t *job, point LL, point UR);
extern void enqueue_neighbors(nodequeue *, Agnode_t *, int);
- extern void endpath(path *, Agedge_t *, int, pathend_t *, bool);
+ extern void endpath(path *, Agedge_t *, int, pathend_t *, boolean);
extern void epsf_init(node_t * n);
extern void epsf_free(node_t * n);
extern shape_desc *find_user_shape(char *);
extern void global_def(char *,
Agsym_t * (*fun) (Agraph_t *, char *, char *));
extern int gvRenderJobs (GVC_t * gvc, graph_t * g);
- extern bool isPolygon(node_t *);
+ extern boolean isPolygon(node_t *);
extern char *strdup_and_subst_obj(char *str, void *obj);
extern char *xml_string(char *s);
extern void makeSelfEdge(path *, edge_t **, int, int, int, int,
extern void osize_label(textlabel_t *, int *, int *, int *, int *);
extern char **parse_style(char *s);
extern void place_graph_label(Agraph_t *);
- extern void place_portlabel(edge_t * e, bool head_p);
+ extern void place_portlabel(edge_t * e, boolean head_p);
extern char *ps_string(char *s, int);
extern int rank(graph_t * g, int balance, int maxiter);
extern void round_corners(GVJ_t*, char*, char*, pointf*, int, int);
extern void translate_bb(Agraph_t *, int);
extern void write_attributed_dot(graph_t *g, FILE *f);
extern void write_canonical_dot(graph_t *g, FILE *f);
- extern void write_plain(GVJ_t * job, graph_t * g, FILE * f, bool extend);
+ extern void write_plain(GVJ_t * job, graph_t * g, FILE * f, boolean extend);
#if defined(_BLD_dot) && defined(_DLL)
# define extern __EXPORT__
static void poly_init(node_t * n);
static void poly_free(node_t * n);
static port poly_port(node_t * n, char *portname, char *);
-static bool poly_inside(inside_t * inside_context, pointf p);
+static boolean poly_inside(inside_t * inside_context, pointf p);
static int poly_path(node_t* n, port* p, int side, box rv[], int *kptr);
static void poly_gencode(GVJ_t * job, node_t * n);
static void record_init(node_t * n);
static void record_free(node_t * n);
static port record_port(node_t * n, char *portname, char *);
-static bool record_inside(inside_t * inside_context, pointf p);
+static boolean record_inside(inside_t * inside_context, pointf p);
static int record_path(node_t* n, port* p, int side, box rv[], int *kptr);
static void record_gencode(GVJ_t * job, node_t * n);
static void point_init(node_t * n);
-static bool epsf_inside(inside_t * inside_context, pointf p);
+static boolean epsf_inside(inside_t * inside_context, pointf p);
static void epsf_gencode(GVJ_t * job, node_t * n);
/* polygon descriptions. "polygon" with 0 sides takes all user control */
return SH_USER;
}
-bool isPolygon(node_t * n)
+boolean isPolygon(node_t * n)
{
return (ND_shape(n) && (ND_shape(n)->fns->initfn == poly_init));
}
#define GET_PORT_BOX(n,e) ((n) == (e)->head ? ED_head_port(e).bp : ED_tail_port(e).bp)
-static bool poly_inside(inside_t * inside_context, pointf p)
+static boolean poly_inside(inside_t * inside_context, pointf p)
{
static node_t *lastn; /* last node argument */
static polygon_t *poly;
point p, ctr;
int rv = 0;
double theta = 0.0;
- bool constrain = FALSE;
+ boolean constrain = FALSE;
int side = 0;
- bool clip = TRUE;
- bool defined;
+ boolean clip = TRUE;
+ boolean defined;
if (bp) {
b = *bp;
static point *A;
static pointf *AF;
static int A_size;
- bool filled;
+ boolean filled;
char *color, *name;
if (obj->url || obj->explicit_tooltip)
* Note that this does not handle Mrecords correctly. It assumes
* everything is a rectangle.
*/
-static bool
+static boolean
record_inside(inside_t * inside_context, pointf p)
{
return rv;
}
-static bool epsf_inside(inside_t * inside_context, pointf p)
+static boolean epsf_inside(inside_t * inside_context, pointf p)
{
pointf P;
double x2;
* The points p are in node coordinates.
*/
void bezier_clip(inside_t * inside_context,
- bool(*inside) (inside_t * inside_context, pointf p),
- pointf * sp, bool left_inside)
+ boolean(*inside) (inside_t * inside_context, pointf p),
+ pointf * sp, boolean left_inside)
{
pointf seg[4], best[4], pt, opt, *left, *right;
double low, high, t, *idir, *odir;
- bool found;
+ boolean found;
int i;
if (left_inside) {
*/
static void
shape_clip0(inside_t * inside_context, node_t * n, point curve[4],
- bool left_inside)
+ boolean left_inside)
{
int i, save_real_size;
pointf c[4];
void shape_clip(node_t * n, point curve[4])
{
int save_real_size;
- bool left_inside;
+ boolean left_inside;
pointf c;
inside_t inside_context;
#define FUDGE 2
void
-beginpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
+beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
{
int side, mask;
node_t *n;
}
}
-void endpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
+void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
{
int side, mask;
node_t *n;
}
/* vladimir */
-void place_portlabel(edge_t * e, bool head_p)
+void place_portlabel(edge_t * e, boolean head_p)
/* place the {head,tail}label (depending on HEAD_P) of edge E */
/* N.B. Assume edges are normalized, so tail is at spl->list[0].list[0]
* and head is at spl->list[spl->size-l].list[bez->size-1]
#include <assert.h>
#include <signal.h>
-#include "cdt.h"
+typedef unsigned char boolean;
+#define NOT(v) (!(v))
+#define FALSE 0
+#define TRUE NOT(FALSE)
+
#include "geom.h"
-#include "pathplan.h"
-#include "color.h"
#include "gvcext.h"
+#include "pathgeom.h"
#include "textpara.h"
-#include "usershape.h"
#ifdef __cplusplus
extern "C" {
box *bp; /* if not null, points to bbox of
* rectangular area that is port target
*/
- bool defined; /* if true, edge has port info at this end */
- bool constrained; /* if true, constraints such as theta are set */
- bool clip; /* if true, clip end to node/port shape */
+ boolean defined; /* if true, edge has port info at this end */
+ boolean constrained; /* if true, constraints such as theta are set */
+ boolean clip; /* if true, clip end to node/port shape */
unsigned char order; /* for mincross */
unsigned char side; /* if port is on perimeter of node, this
* contains the bitwise OR of the sides (TOP,
} port;
typedef struct {
- bool(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */
- bool(*splineMerge) (node_t * n); /* Is n a node in the middle of an edge? */
+ boolean(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */
+ boolean(*splineMerge) (node_t * n); /* Is n a node in the middle of an edge? */
} splineInfo;
typedef struct pathend_t {
} txt;
htmllabel_t *html;
} u;
- bool set; /* true if position is set */
- bool html; /* true if html label */
+ boolean set; /* true if position is set */
+ boolean html; /* true if html label */
} textlabel_t;
typedef struct polygon_t { /* mutable shape information for a node */
void (*initfn) (node_t *); /* initializes shape from node u.shape_info structure */
void (*freefn) (node_t *); /* frees shape from node u.shape_info structure */
port(*portfn) (node_t *, char *, char *); /* finds aiming point and slope of port */
- bool(*insidefn) (inside_t * inside_context, pointf); /* clips incident gvc->e spline on shape of gvc->n */
+ boolean(*insidefn) (inside_t * inside_context, pointf); /* clips incident gvc->e spline on shape of gvc->n */
int (*pboxfn)(node_t* n, port* p, int side, box rv[], int *kptr); /* finds box path to reach port */
void (*codefn) (GVJ_t * job, node_t * n); /* emits graphics code for node */
} shape_functions;
char *name; /* as read from graph file */
shape_functions *fns;
polygon_t *polygon; /* base polygon info */
- bool usershape;
+ boolean usershape;
} shape_desc;
#ifdef WITH_CODEGENS
+#include <usershape.h>
+
struct codegen_s {
void (*reset) (void);
void (*begin_job) (FILE * ofp, graph_t * g, char **lib, char *user,
void (*beziercurve) (point * A, int n, int arrow_at_start,
int arrow_at_end, int filled);
void (*polyline) (point * A, int n);
- bool bezier_has_arrows;
+ boolean bezier_has_arrows;
void (*comment) (char *str);
- void (*usershape) (usershape_t *us, boxf b, point * A, int sides, bool filled);
+ void (*usershape) (usershape_t *us, boxf b, point * A, int sides, boolean filled);
};
struct codegen_info_s {
node_t **av; /* allocated list of nodes in rank */
int ht1, ht2; /* height below/above centerline */
int pht1, pht2; /* as above, but only primitive nodes */
- bool candidate; /* for transpose () */
- bool valid;
+ boolean candidate; /* for transpose () */
+ boolean valid;
int cache_nc; /* caches number of crossings */
adjmatrix_t *flat;
} rank_t;
point margin;
point page;
point size;
- bool filled;
- bool landscape;
- bool centered;
+ boolean filled;
+ boolean landscape;
+ boolean centered;
ratio_t ratio_kind;
} layout_t;
point border[4]; /* sizes of margins for graph labels */
unsigned char gui_state; /* Graph state for GUI ops */
unsigned char has_labels;
- bool has_images;
+ boolean has_images;
unsigned char charset; /* input character set */
int rankdir;
int ht1, ht2; /* below and above extremal ranks */
short minrank, maxrank;
/* various flags */
- bool has_flat_edges;
+ boolean has_flat_edges;
unsigned char showboxes;
- bool cluster_was_collapsed;
+ boolean cluster_was_collapsed;
int nodesep, ranksep;
node_t *ln, *rn; /* left, right nodes of bounding box */
/* for clusters */
node_t *leader, **rankleader;
- bool expanded;
+ boolean expanded;
char installed;
char set_type;
char label_pos;
- bool exact_ranksep;
+ boolean exact_ranksep;
#endif
} Agraphinfo_t;
void *alg;
char state;
unsigned char gui_state; /* Node state for GUI ops */
- bool clustnode;
+ boolean clustnode;
#ifndef DOT_ONLY
unsigned char pinned;
#endif
#ifndef NEATO_ONLY
unsigned char showboxes;
- bool has_port;
+ boolean has_port;
/* fast graph */
char node_type, mark, onstack;
#endif
#ifndef NEATO_ONLY
unsigned char showboxes;
- bool conc_opp_flag;
+ boolean conc_opp_flag;
short xpenalty;
int weight;
int cutvalue, tree_index;
#ifndef USERSHAPE_H
#define USERSHAPE_H
+#include <cdt.h>
+
#ifdef __cplusplus
extern "C" {
#endif
Dtlink_t link;
char *name;
int macro_id;
- bool must_inline;
+ boolean must_inline;
FILE *f;
imagetype_t type;
char *stringtype;
return rv;
}
-bool late_bool(void *obj, attrsym_t * attr, int def)
+boolean late_bool(void *obj, attrsym_t * attr, int def)
{
if (attr == NULL)
return def;
*/
char *safefile(char *filename)
{
- static bool onetime = true;
+ static boolean onetime = TRUE;
static char *safefilename = NULL;
char *str, *p;
"file loading is disabled because the environment contains: %s\n"
"and there is no GV_FILE_PATH variable.\n",
HTTPServerEnVar);
- onetime = false;
+ onetime = FALSE;
}
return NULL;
}
" because files are only permitted to be loaded from the \"%s\""
" directory when running in an http server.\n", filename,
Gvfilepath);
- onetime = false;
+ onetime = FALSE;
}
return safefilename;
FILE *fp;
char *p, **s, *bp;
int i;
- bool use_stdlib = true;
+ boolean use_stdlib = TRUE;
/* check for empty string to turn off stdlib */
if (arglib) {
for (i = 0; use_stdlib && ((p = arglib[i])); i++) {
if (*p == '\0')
- use_stdlib = false;
+ use_stdlib = FALSE;
}
}
if (use_stdlib)
return val[i];
}
-bool mapbool(char *p)
+boolean mapbool(char *p)
{
if (p == NULL)
- return false;
+ return FALSE;
if (!strcasecmp(p, "false"))
- return false;
+ return FALSE;
if (!strcasecmp(p, "true"))
- return true;
+ return TRUE;
return atoi(p);
}
* Return true if head/tail end of edge should not be clipped
* to node.
*/
-static bool
+static boolean
noClip(edge_t *e, attrsym_t* sym)
{
char *str;
- bool rv = false;
+ boolean rv = FALSE;
if (sym) { /* mapbool isn't a good fit, because we want "" to mean true */
str = agxget(e,sym->index);
if (str && str[0]) rv = !mapbool(str);
- else rv = false;
+ else rv = FALSE;
}
return rv;
}
/* We still accept ports beginning with colons but this is deprecated */
s = agget(e, TAIL_ID);
if (s[0])
- ND_has_port(e->tail) = true;
+ ND_has_port(e->tail) = TRUE;
ED_tail_port(e) = chkPort (ND_shape(e->tail)->fns->portfn,e->tail, s);
if (noClip(e, E_tailclip))
- ED_tail_port(e).clip = false;
+ ED_tail_port(e).clip = FALSE;
s = agget(e, HEAD_ID);
if (s[0])
- ND_has_port(e->head) = true;
+ ND_has_port(e->head) = TRUE;
ED_head_port(e) = chkPort(ND_shape(e->head)->fns->portfn,e->head, s);
if (noClip(e, E_headclip))
- ED_head_port(e).clip = false;
+ ED_head_port(e).clip = FALSE;
return r;
}
/* addLabelBB:
*/
-static box addLabelBB(box bb, textlabel_t * lp, bool flipxy)
+static box addLabelBB(box bb, textlabel_t * lp, boolean flipxy)
{
int width, height;
point p = lp->p;
return ns;
}
-bool overlap_node(node_t *n, boxf b)
+boolean overlap_node(node_t *n, boxf b)
{
boxf bb;
inside_t ictxt;
bb = ND_bb(n);
if (! OVERLAP(b, bb))
- return false;
+ return FALSE;
P2PF(ND_coord_i(n),p);
return ND_shape(n)->fns->insidefn(&ictxt, p);
}
-bool overlap_label(textlabel_t *lp, boxf b)
+boolean overlap_label(textlabel_t *lp, boxf b)
{
double sx, sy;
boxf bb;
return OVERLAP(b, bb);
}
-static bool overlap_arrow(pointf p, pointf u, double scale, int flag, boxf b)
+static boolean overlap_arrow(pointf p, pointf u, double scale, int flag, boxf b)
{
boxf bb;
bb = arrow_bb(p, u, scale, flag);
if (OVERLAP(b, bb)) {
/* FIXME - check inside arrow shape */
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool overlap_bezier(bezier bz, boxf b)
+static boolean overlap_bezier(bezier bz, boxf b)
{
int i;
point pp;
pp = bz.list[i];
P2PF(pp, p);
if (lineToBox(p, u, b) != -1)
- return true;
+ return TRUE;
u = p;
}
P2PF(bz.sp, p);
P2PF(bz.list[0], u);
if (overlap_arrow(p, u, 1, bz.sflag, b))
- return true;
+ return TRUE;
}
if (bz.eflag) {
P2PF(bz.ep, p);
P2PF(bz.list[bz.size - 1], u);
if (overlap_arrow(p, u, 1, bz.eflag, b))
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-bool overlap_edge(edge_t *e, boxf b)
+boolean overlap_edge(edge_t *e, boxf b)
{
int i;
splines *spl;
if (spl && boxf_overlap(spl->bb, b))
for (i = 0; i < spl->size; i++)
if (overlap_bezier(spl->list[i], b))
- return true;
+ return TRUE;
lp = ED_label(e);
if (lp && overlap_label(lp, b))
- return true;
+ return TRUE;
- return false;
+ return FALSE;
}
extern double late_double(void *, Agsym_t *, double, double);
extern char *late_nnstring(void *, Agsym_t *, char *);
extern char *late_string(void *, Agsym_t *, char *);
- extern bool late_bool(void *, Agsym_t *, int);
+ extern boolean late_bool(void *, Agsym_t *, int);
extern Agnode_t *UF_find(Agnode_t *);
extern Agnode_t *UF_union(Agnode_t *, Agnode_t *);
extern void cat_libfile(FILE *of, char **arglib, char **stdlib);
extern void cat_preamble(GVJ_t *job, char **arglib);
- extern bool mapbool(char *);
+ extern boolean mapbool(char *);
extern int maptoken(char *, char **, int *);
extern int test_toggle(void);
extern void updateBB(graph_t * g, textlabel_t * lp);
extern void update_bb(graph_t * g, point p);
extern void compute_bb(Agraph_t *);
- extern bool overlap_node(node_t *n, boxf b);
- extern bool overlap_label(textlabel_t *lp, boxf b);
- extern bool overlap_edge(edge_t *e, boxf b);
+ extern boolean overlap_node(node_t *n, boxf b);
+ extern boolean overlap_label(textlabel_t *lp, boxf b);
+ extern boolean overlap_edge(edge_t *e, boxf b);
extern int processClusterEdges(graph_t * g);
extern void undoClusterEdges(graph_t * g);