Graphviz  2.31.20130618.0446
lib/common/macros.h
Go to the documentation of this file.
00001 /* $Id$ $Revision$ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 #ifndef GV_MACROS_H
00015 #define GV_MACROS_H
00016 
00017 #ifndef NOTUSED
00018 #define NOTUSED(var) (void) var
00019 #endif
00020 
00021 #ifndef NIL
00022 #define NIL(type)  ((type)0)
00023 #endif
00024 
00025 #define isPinned(n)     (ND_pinned(n) == P_PIN)
00026 #define hasPos(n)       (ND_pinned(n) > 0)
00027 #define isFixed(n)      (ND_pinned(n) > P_SET)
00028 
00029 #define SET_CLUST_NODE(n) (ND_clustnode(n) = TRUE)
00030 #define IS_CLUST_NODE(n)  (ND_clustnode(n))
00031 #define HAS_CLUST_EDGE(g) (GD_flags(g) & 1)
00032 #define SET_CLUST_EDGE(g) (GD_flags(g) |= 1)
00033 #define EDGE_TYPE(g) (GD_flags(g) & (7 << 1))
00034 
00035 #ifndef streq
00036 #define streq(a,b)              (*(a)==*(b)&&!strcmp(a,b))
00037 #endif
00038 
00039 #define XPAD(d) ((d).x += 4*GAP)
00040 #define YPAD(d) ((d).y += 2*GAP)
00041 #define PAD(d)  {XPAD(d); YPAD(d);}
00042 
00043 #define OTHERDIR(dir) ((dir == CCW) ? CW : CCW)
00044 
00045 #define NEXTSIDE(side, dir) ((dir == CCW) ? \
00046                 ((side & 0x8) ? BOTTOM : (side << 1)) : \
00047                 ((side & 0x1) ? LEFT : (side >> 1)))
00048 
00049 #endif