obj->type = EDGE_OBJTYPE;
obj->u.e = e;
obj->emit_state = EMIT_EDRAW;
- if (ED_label(e) && !ED_label(e)->html && mapBool(agget(e,"labelaligned"),FALSE))
+ if (ED_label(e) && !ED_label(e)->html && mapBool(agget(e,"labelaligned"), false))
obj->labeledgealigned = TRUE;
/* We handle the edge style and penwidth here because the width
return val[i];
}
-boolean mapBool(char *p, boolean dflt)
+bool mapBool(char *p, bool dflt)
{
if (!p || (*p == '\0'))
return dflt;
if (!strcasecmp(p, "false"))
- return FALSE;
+ return false;
if (!strcasecmp(p, "no"))
- return FALSE;
+ return false;
if (!strcasecmp(p, "true"))
- return TRUE;
+ return true;
if (!strcasecmp(p, "yes"))
- return TRUE;
+ return true;
if (isdigit((int)*p))
- return atoi(p);
+ return atoi(p) != 0;
else
return dflt;
}
boolean mapbool(char *p)
{
- return mapBool (p, FALSE);
+ return mapBool(p, false) ? TRUE : FALSE;
}
pointf dotneato_closest(splines * spl, pointf pt)
int is_a_cluster (Agraph_t* g)
{
- return ((g == g->root) || (!strncasecmp(agnameof(g), "cluster", 7)) || mapBool(agget(g,"cluster"),FALSE));
+ return g == g->root || !strncasecmp(agnameof(g), "cluster", 7) ||
+ mapBool(agget(g, "cluster"), false);
}
/* setAttr:
UTILS_API char *Fgets(FILE *fp);
UTILS_API const char *safefile(const char *filename);
-UTILS_API boolean mapBool(char *, boolean);
+UTILS_API bool mapBool(char *, bool);
UTILS_API boolean mapbool(char *);
UTILS_API int maptoken(char *, char **, int *);
#include <dotgen/dot.h>
#include <limits.h>
+#include <stdbool.h>
static void dot1_rank(graph_t * g, aspect_t* asp);
static void dot2_rank(graph_t * g, aspect_t* asp);
return (!agfstnode(g));
}
-static int is_a_strong_cluster(graph_t * g)
+static bool is_a_strong_cluster(graph_t * g)
{
- int rv;
char *str = agget(g, "compact");
- /* rv = mapBool((str), TRUE); */
- rv = mapBool((str), FALSE);
- return rv;
+ return mapBool(str, false);
}
static int rankset_kind(graph_t * g)
}
remove_overlap(Ndim, A, pos, sizes, am->value, am->scaling,
- ELSCHEME_NONE, 0, NULL, NULL, mapBool (agget(g, "overlap_shrink"), TRUE));
+ ELSCHEME_NONE, 0, NULL, NULL,
+ mapBool(agget(g, "overlap_shrink"), true) ? TRUE : FALSE);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
double *npos = pos + Ndim * ND_id(n);
ap++;
}
if (ap->attrib == NULL ) {
- int v = mapBool(s,'?');
- if (v == '?') {
+ bool v = mapBool(s, false);
+ bool unmappable = v != mapBool(s, true);
+ if (unmappable) {
agerr (AGWARN, "Unrecognized overlap value \"%s\" - using false\n", s);
- v = FALSE;
+ v = false;
}
if (v) {
dp->mode = adjustMode[0].mode;
attrsym_t *G_bb = agfindgraphattr(g, "bb");
int didAdjust = 0; /* Have nodes been moved? */
int haveBackground;
- boolean translate = !mapBool(agget(g, "notranslate"), FALSE);
+ bool translate = !mapBool(agget(g, "notranslate"), false);
/* If G_bb not defined, define it */
if (!G_bb)
}
else gv_postprocess(g, 0);
} else {
- boolean noTranslate = mapBool(agget(g, "notranslate"), FALSE);
+ bool noTranslate = mapBool(agget(g, "notranslate"), false);
PSinputscale = get_inputscale (g);
neato_init_graph(g);
layoutMode = neatoMode(g);
#include <sfdpgen/uniform_stress.h>
#include <sfdpgen/stress_model.h>
#include <cgraph/strcasecmp.h>
+#include <stdbool.h>
static void sfdp_init_edge(edge_t * e)
{
ctrl->smoothing = late_smooth(g, agfindgraphattr(g, "smoothing"), SMOOTHING_NONE);
ctrl->tscheme = late_quadtree_scheme(g, agfindgraphattr(g, "quadtree"), QUAD_TREE_NORMAL);
ctrl->method = METHOD_SPRING_ELECTRICAL;
- ctrl->beautify_leaves = mapBool (agget(g, "beautify"), FALSE);
- ctrl->do_shrinking = mapBool (agget(g, "overlap_shrink"), TRUE);
+ ctrl->beautify_leaves = mapBool(agget(g, "beautify"), false) ? TRUE : FALSE;
+ ctrl->do_shrinking = mapBool(agget(g, "overlap_shrink"), true) ? TRUE : FALSE;
ctrl->rotation = late_double(g, agfindgraphattr(g, "rotation"), 0.0, -MAXDOUBLE);
ctrl->edge_labeling_scheme = late_int(g, agfindgraphattr(g, "label_scheme"), 0, 0);
if (ctrl->edge_labeling_scheme > 4) {