]> granicus.if.org Git - graphviz/commitdiff
API BREAK: remove 'NOT' macro
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 14 Jan 2022 01:08:48 +0000 (17:08 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 15 Jan 2022 17:16:13 +0000 (09:16 -0800)
15 files changed:
CHANGELOG.md
lib/cgraph/cgraph.h
lib/cgraph/cmpnd.c
lib/cgraph/edge.c
lib/cgraph/graph.c
lib/cgraph/pend.c
lib/cgraph/rec.c
lib/cgraph/write.c
lib/common/logic.h
lib/common/ns.c
lib/common/shapes.c
lib/common/types.h
lib/dotgen/mincross.c
lib/pathplan/pathutil.h
tclpkg/tclpathplan/tclpathplan.c

index c92f42c076142aaa98fe49665dc66dc8ee6bed99..8bdcf44e5b510a1ee06b8b8a83c6dab88ccbeb58 100644 (file)
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   symbol to be set to ensure correct linking.
 - **Breaking**: Graphviz headers no longer define the constant `MAXSHORT`. A
   drop-in replacement is `SHRT_MAX` in the C standard library’s limits.h.
+- **Breaking**: Graphviz headers no longer define the `NOT` macro. A drop-in
+  replacement is the C/C++ operator `!`.
 - **Breaking**: Graphviz headers no longer (re-)define the C constants `INT_MIN`
   and `INT_MAX`. Replacements can be found in the C standard library’s limits.h.
 - **Breaking**: Graphviz headers no longer define the constant `_DUMMY_ELEM`.
index 208037b5b6859c393b40602c05270f384260cd85..4d1a5feea64dce935bdf5d0c9c0bc3ebcec180a9 100644 (file)
@@ -35,9 +35,6 @@ extern "C" {
 #ifndef TRUE
 #define TRUE (!FALSE)
 #endif
-#ifndef NOT
-#define        NOT(x)                  (!(x))
-#endif
 #ifndef NIL
 #define NIL(type)              ((type)0)
 #endif
index ca048fcbe06c4b48f12c0d2df2cce1407832b8ca..5434c95e3c54a1cfbeb8dbb237b080eeafb6fdc0 100644 (file)
@@ -304,7 +304,7 @@ int agexpose(Agnode_t * cmpnode)
 
     /* skip if this is not a collapsed subgraph */
     noderec = (Agcmpnode_t *) aggetrec(cmpnode, Descriptor_id, FALSE);
-    if (noderec == NULL || NOT(noderec->collapsed))
+    if (noderec == NULL || !noderec->collapsed)
        return FAILURE;
 
     /* undo aghide (above) in reverse order.  first, expose subgraph */
@@ -342,7 +342,7 @@ int agexpose(Agnode_t * cmpnode)
 Agraph_t *agcmpgraph_of(Agnode_t * n)
 {
     Agcmpnode_t *noderec = (Agcmpnode_t *) aggetrec(n, Descriptor_id, FALSE);
-    if (noderec && NOT(noderec->collapsed))
+    if (noderec && !noderec->collapsed)
        return noderec->subg;
     else
        return NULL;
index b27ab6b0be215ab55e03542bd9c08f591d31b808..1676bf366b9063ea3f6c7a8ee09324374b3a6774 100644 (file)
@@ -270,7 +270,7 @@ Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name,
     int have_id;
 
     have_id = agmapnametoid(g, AGEDGE, name, &my_id, FALSE);
-    if (have_id || (name == NULL && (NOT(cflag) || agisstrict(g)))) {
+    if (have_id || (name == NULL && (!cflag || agisstrict(g)))) {
        /* probe for pre-existing edge */
        Agtag_t key;
        key = Tag;
index a094acd8fcbdb166a3000bc88961c3da6b796dee..b965b318caf86c664f0cf35c57b7da34e6a74705 100644 (file)
@@ -182,7 +182,7 @@ int agisdirected(Agraph_t * g)
 
 int agisundirected(Agraph_t * g)
 {
-    return NOT(agisdirected(g));
+    return !agisdirected(g);
 }
 
 int agisstrict(Agraph_t * g)
index a7cf03fdaafb9e0d68120a0b231ee0e6619bd382..24f707c1386c21c81b2086033b25916d809bddc7 100644 (file)
@@ -258,7 +258,7 @@ static void cb(Dict_t * dict, cb_t callback_kind)
 static void agrelease_callbacks(Agraph_t * g)
 {
     pendingset_t *pending;
-    if (NOT(g->clos->callbacks_enabled)) {
+    if (!g->clos->callbacks_enabled) {
        g->clos->callbacks_enabled = TRUE;
        pending = agbindrec(g, DRName, sizeof(pendingset_t), false);
        /* this destroys objects in the opposite of their order of creation */
@@ -278,7 +278,7 @@ static void agrelease_callbacks(Agraph_t * g)
 
 int agcallbacks(Agraph_t * g, int flag)
 {
-    if (flag && NOT(g->clos->callbacks_enabled))
+    if (flag && !g->clos->callbacks_enabled)
        agrelease_callbacks(g);
     if (g->clos->callbacks_enabled) {
        g->clos->callbacks_enabled = flag != 0;
index c16c1fe68682f8fdf753530f621950e604b447b7..81f463a11f88565db2498eb1e48457e88257b065 100644 (file)
@@ -77,7 +77,7 @@ static void objputrec(Agobj_t * obj, void *arg)
            firstrec->next = newrec;
        }
     }
-    if (NOT(obj->tag.mtflock))
+    if (!obj->tag.mtflock)
        set_data(obj, newrec, false);
 }
 
index d6cd8b23bfbdd26c06ae48132f2e738df220ec41..902fc0192cd543027036e8c4c47e6adf7f66ca53 100644 (file)
@@ -287,7 +287,7 @@ static int write_hdr(Agraph_t * g, iochan_t * ofile, int top)
     bool hasName = true;
 
     strict = "";
-    if (NOT(top) && agparent(g))
+    if (!top && agparent(g))
        kind = "sub";
     else {
        root = true;
@@ -431,7 +431,7 @@ static int write_edge_name(Agedge_t * e, iochan_t * ofile, int terminate)
 
     p = agnameof(e);
     g = agraphof(e);
-    if (NOT(EMPTY(p))) {
+    if (!EMPTY(p)) {
        if (!terminate) {
            Level++;
        }
@@ -520,7 +520,7 @@ static int write_node(Agnode_t * n, iochan_t * ofile, Dict_t * d)
     g = agraphof(n);
     CHKRV(indent(g, ofile));
     CHKRV(write_nodename(n, ofile));
-    if (NOT(attrs_written(n)))
+    if (!attrs_written(n))
        CHKRV(write_nondefault_attrs(n, ofile, d));
     return ioput(g, ofile, ";\n");
 }
@@ -597,7 +597,7 @@ static int write_edge(Agedge_t * e, iochan_t * ofile, Dict_t * d)
     CHKRV(ioput(g, ofile, (agisdirected(agraphof(t)) ? " -> " : " -- ")));
     CHKRV(write_nodename(h, ofile));
     CHKRV(write_port(e, ofile, Headport));
-    if (NOT(attrs_written(e))) {
+    if (!attrs_written(e)) {
        CHKRV(write_nondefault_attrs(e, ofile, d));
     } else {
        CHKRV(write_edge_name(e, ofile, TRUE));
index f5e119f2a0a6bf07f8d1929bde8472dcb684b780..b6ea30f41060565ef80c99354a360be560176f46 100644 (file)
@@ -16,10 +16,6 @@ extern "C" {
 
 #include <stdbool.h>
 
-#ifndef NOT
-#define NOT(v) (!(v))
-#endif
-
 #ifndef FALSE
 #define        FALSE (0)
 #endif
index 38738de11b865427ef86a44cf77b084cf1679ffe..430da327a36e9a4e33cb24c98e40337e1ca43701 100644 (file)
@@ -554,7 +554,7 @@ static Agnode_t *treeupdate(Agnode_t * v, Agnode_t * w, int cutvalue, int dir)
        if (v == agtail(e))
            d = dir;
        else
-           d = NOT(dir);
+           d = !dir;
        if (d)
            ED_cutvalue(e) += cutvalue;
        else
index f96a5535110bb5787dc0902f3a5a41b873c95449..15392b9907a1d5a0136476cdeec1fa9e71472f18 100644 (file)
@@ -3268,7 +3268,7 @@ static field_t *parse_reclbl(node_t * n, int LR, int flag, char *text)
            if (mode != 0 || !*reclblp)
                return parse_error(rv, tmpport);
            mode = HASTABLE;
-           if (!(rv->fld[fi++] = parse_reclbl(n, NOT(LR), FALSE, text)))
+           if (!(rv->fld[fi++] = parse_reclbl(n, !LR, FALSE, text)))
                return parse_error(rv, tmpport);
            break;
        case '}':
@@ -3523,7 +3523,7 @@ static void record_init(node_t * n)
     int sides = BOTTOM | RIGHT | TOP | LEFT;
 
     /* Always use rankdir to determine how records are laid out */
-    flip = NOT(GD_realflip(agraphof(n)));
+    flip = !GD_realflip(agraphof(n));
     reclblp = ND_label(n)->text;
     len = strlen(reclblp);
     /* For some forgotten reason, an empty label is parsed into a space, so
index 5c5d0cb0f69a6131ce2cf686ad50f02cd24f20f2..d7cf6c20d9da1e871e657595fa57dc6256a6de13 100644 (file)
 #include <signal.h>
 
 typedef unsigned char boolean;
-#ifndef NOT
-#define NOT(v) (!(v))
-#endif
 #ifndef FALSE
 #define FALSE 0
 #endif
 #ifndef TRUE
-#define TRUE NOT(FALSE)
+#define TRUE (!FALSE)
 #endif
 
 #include "geom.h"
index 4bbe3dfe7348aaa5b0a6a61eb01cfc72513edf05..139fc3d98eb5006739706be9241a3dd088133032 100644 (file)
@@ -1218,8 +1218,7 @@ static void flat_search(graph_t * g, node_t * v)
     hascl = GD_n_cluster(dot_root(g)) > 0;
     if (ND_flat_out(v).list)
        for (i = 0; (e = ND_flat_out(v).list[i]); i++) {
-           if (hascl
-               && NOT(agcontains(g, agtail(e)) && agcontains(g, aghead(e))))
+           if (hascl && !(agcontains(g, agtail(e)) && agcontains(g, aghead(e))))
                continue;
            if (ED_weight(e) == 0)
                continue;
index 99b8ba327756c05e8664bfb9c8579180f59fcb61..3326cbad3c9a340b21de0b2ec6bf0717183f93dd 100644 (file)
 extern "C" {
 #endif
 
-#ifndef NOT
-#define NOT(x) (!(x))
-#endif
 #ifndef FALSE
 #define FALSE  0
-#define TRUE   (NOT(FALSE))
+#define TRUE   (!FALSE)
 #endif
 
 #ifdef GVDLL
index 609cfd4c1e686608ac792c82c49dfa0368ca0795..83eecd95bda2f402a157b81f0843225795e9cbca 100644 (file)
@@ -110,7 +110,7 @@ static int vc_refresh(vgpane_t * vgp)
        obs = malloc(vgp->Npoly * sizeof(Ppoly_t));
        for (i = 0; i < vgp->Npoly; i++)
            obs[i] = &(vgp->poly[i].boundary);
-       if (NOT(Plegal_arrangement(obs, vgp->Npoly)))
+       if (!Plegal_arrangement(obs, vgp->Npoly))
            fprintf(stderr, "bad arrangement\n");
        else
            vgp->vc = Pobsopen(obs, vgp->Npoly);