| 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 GV_MACROS_H |
| 15 | #define GV_MACROS_H |
| 16 | |
| 17 | #ifndef NOTUSED |
| 18 | #define NOTUSED(var) (void) var |
| 19 | #endif |
| 20 | |
| 21 | #ifndef NIL |
| 22 | #define NIL(type) ((type)0) |
| 23 | #endif |
| 24 | |
| 25 | #define isPinned(n) (ND_pinned(n) == P_PIN) |
| 26 | #define hasPos(n) (ND_pinned(n) > 0) |
| 27 | #define isFixed(n) (ND_pinned(n) > P_SET) |
| 28 | |
| 29 | #define CL_EDGE_TAG "cl_edge_info" |
| 30 | #define SET_CLUST_NODE(n) (ND_clustnode(n) = TRUE) |
| 31 | #define IS_CLUST_NODE(n) (ND_clustnode(n)) |
| 32 | #define HAS_CLUST_EDGE(g) (aggetrec(g, CL_EDGE_TAG, FALSE)) |
| 33 | #define EDGE_TYPE(g) (GD_flags(g) & (7 << 1)) |
| 34 | |
| 35 | #ifndef streq |
| 36 | #define streq(a,b) (*(a)==*(b)&&!strcmp(a,b)) |
| 37 | #endif |
| 38 | |
| 39 | #define XPAD(d) ((d).x += 4*GAP) |
| 40 | #define YPAD(d) ((d).y += 2*GAP) |
| 41 | #define PAD(d) {XPAD(d); YPAD(d);} |
| 42 | |
| 43 | #define OTHERDIR(dir) ((dir == CCW) ? CW : CCW) |
| 44 | |
| 45 | #define NEXTSIDE(side, dir) ((dir == CCW) ? \ |
| 46 | ((side & 0x8) ? BOTTOM : (side << 1)) : \ |
| 47 | ((side & 0x1) ? LEFT : (side >> 1))) |
| 48 | |
| 49 | #endif |
| 50 | |