return rv;
}
-int late_bool(void *obj, attrsym_t * attr, int def)
+bool late_bool(void *obj, attrsym_t * attr, int def)
{
if (attr == NULL)
return def;
*/
char *safefile(char *filename)
{
- static int onetime = TRUE;
+ static bool 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, use_stdlib = TRUE;
+ int i;
+ bool 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];
}
-int mapbool(char *p)
+bool 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);
}
noClip(edge_t *e, attrsym_t* sym)
{
char *str;
- bool rv = FALSE;
+ bool rv = false;
- if (sym) { /* mapbool isn't a good fit, because we want "" to mean TRUE */
+ 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;
}
return pt;
}
-/* return TRUE if edge has label */
+/* return true if edge has label */
int common_init_edge(edge_t * e)
{
char *s;
/* 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;
}
rc = agxbputc(&xb, c);
c = *(unsigned char*)s++;
}
+ else {
+ agerr(AGERR, "Invalid UTF8 found in input. Perhaps \"-Gcharset=latin1\" is needed?\n");
+ exit(EXIT_FAILURE);
+ }
/*
+ * (if we didn't just exit)
* A two-byte-character lead-byte not followed by trail-byte
* represents itself.
*/
rc = agxbputc(&xb, c);
c = *(unsigned char*)s++;
}
+ else {
+ agerr(AGERR, "Invalid UTF8 found in input. Perhaps \"-Gcharset=latin1\" is needed?\n");
+ exit(EXIT_FAILURE);
+ }
/*
+ * (if we didn't just exit)
* A three-byte-character lead-byte not followed by
* two trail-bytes represents itself.
*/
}
else {
- /* UTF8 codes > 3 bytes not supported */
- assert (0);
+ agerr(AGERR, "UTF8 codes > 3 bytes are not currently supported\n");
+ exit(EXIT_FAILURE);
}
rc = agxbputc(&xb, c);
}
bb = ND_bb(n);
if (! OVERLAP(b, bb))
- return FALSE;
+ return false;
P2PF(ND_coord_i(n),p);
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)
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)
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 int late_bool(void *, Agsym_t *, int);
+ extern bool 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 int mapbool(char *);
+ extern bool mapbool(char *);
extern int maptoken(char *, char **, int *);
extern int test_toggle(void);