#endif
#define ABS(a) ((a) >= 0 ? (a) : -(a))
-#ifndef MAXINT
-#define MAXINT ((int)(~(unsigned)0 >> 1))
+#ifndef INT_MAX
+#define INT_MAX ((int)(~(unsigned)0 >> 1))
#endif
+
+#ifndef INT_MIN
+#define INT_MIN (-INT_MAX - 1)
+#endif
+
#ifndef MAXSHORT
#define MAXSHORT (0x7fff)
#endif
+
#ifndef MAXDOUBLE
-#define MAXDOUBLE 1.7976931348623157e+308
+#define MAXDOUBLE 1.7976931348623157e+308
#endif
+
#ifndef MAXFLOAT
-#define MAXFLOAT ((float)3.40282347e+38)
+#define MAXFLOAT ((float)3.40282347e+38)
#endif
#ifdef BETWEEN
#define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c)))
#ifndef M_PI
-#define M_PI 3.14159265358979323846
+#define M_PI 3.14159265358979323846
#endif
+
#ifndef PI
-#define PI M_PI
+#define PI M_PI
#endif
#define ROUND(f) ((f>=0)?(int)(f + .5):(int)(f - .5))
rowg = agopen("rowg", AGDIGRAPH);
colg = agopen("colg", AGDIGRAPH);
makeGraphs(tbl, rowg, colg);
- rank(rowg, 2, MAXINT);
- rank(colg, 2, MAXINT);
+ rank(rowg, 2, INT_MAX);
+ rank(colg, 2, INT_MAX);
setSizes(tbl, rowg, colg);
closeGraphs(rowg, colg);
}
outsearch = TRUE;
}
Enter = NULL;
- Slack = MAXINT;
+ Slack = INT_MAX;
Low = ND_low(v);
Lim = ND_lim(v);
if (outsearch)
{
node_t *n;
- Minrank = MAXINT;
- Maxrank = -MAXINT;
+ Minrank = INT_MAX;
+ Maxrank = -INT_MAX;
for (n = GD_nlist(G); n; n = ND_next(n)) {
if (ND_node_type(n) == NORMAL) {
Minrank = MIN(Minrank, ND_rank(n));
case 'e':
theta = -PI * 0.25;
defined = TRUE;
- if (ictxt) p = compassPoint (ictxt, -MAXINT, MAXINT);
+ if (ictxt) p = compassPoint (ictxt, -INT_MAX, INT_MAX);
else p.x = b.UR.x;
side = sides & (BOTTOM | RIGHT);
break;
case 'w':
theta = -PI * 0.75;
defined = TRUE;
- if (ictxt) p = compassPoint (ictxt, -MAXINT, -MAXINT);
+ if (ictxt) p = compassPoint (ictxt, -INT_MAX, -INT_MAX);
else p.x = b.LL.x;
side = sides & (BOTTOM | LEFT);
break;
case 'e':
defined = TRUE;
theta = PI * 0.25;
- if (ictxt) p = compassPoint (ictxt, MAXINT, MAXINT);
+ if (ictxt) p = compassPoint (ictxt, INT_MAX, INT_MAX);
else p.x = b.UR.x;
side = sides & (TOP | RIGHT);
break;
case 'w':
defined = TRUE;
theta = PI * 0.75;
- if (ictxt) p = compassPoint (ictxt, MAXINT, -MAXINT);
+ if (ictxt) p = compassPoint (ictxt, INT_MAX, -INT_MAX);
else p.x = b.LL.x;
side = sides & (TOP | LEFT);
break;
point pt, s2;
int i, j;
- bb.LL = pointof(MAXINT, MAXINT);
- bb.UR = pointof(-MAXINT, -MAXINT);
+ bb.LL = pointof(INT_MAX, INT_MAX);
+ bb.UR = pointof(-INT_MAX, -INT_MAX);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
pt = coord(n);
s2.x = ND_xsize(n) / 2 + 1;
cur_cross = best_cross = ncross(g);
save_best(g);
} else
- cur_cross = best_cross = MAXINT;
+ cur_cross = best_cross = INT_MAX;
for (pass = startpass; pass <= endpass; pass++) {
if (pass <= 1) {
maxthispass = MIN(4, MaxIter);
static int nsiter2(graph_t * g)
{
- int maxiter = MAXINT;
+ int maxiter = INT_MAX;
char *s;
if ((s = agget(g, "nslimit")))
point LL, UR;
if (g == g->root) {
- LL.x = MAXINT;
- UR.x = -MAXINT;
+ LL.x = INT_MAX;
+ UR.x = -INT_MAX;
for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
if (GD_rank(g)[r].n == 0)
continue;
static void
rank1(graph_t * g)
{
- int maxiter = MAXINT;
+ int maxiter = INT_MAX;
int c;
char *s;
{
int i;
int closestVertex, neighbor;
- DistType closestDist = MAXINT;
+ DistType closestDist = INT_MAX;
/* initial distances with edge weights: */
for (i = 0; i < n; i++)
node_t *n = NULL;
edge_t *e;
int lcnt, cnt;
- int oldval = -MAXINT;
+ int oldval = -INT_MAX;
#ifdef OLD
double root_val;
#endif
}
/* construct basic chain to enforce left to right order */
- oldval = -MAXINT;
+ oldval = -INT_MAX;
lcnt = 0;
for (p = (nitem *) dtflatten(list); p;
p = (nitem *) dtlink(list, (Dtlink_t *) p)) {
p->vnode = n;
ND_alg(n) = p;
}
- oldval = -MAXINT;
+ oldval = -INT_MAX;
for (p = (nitem *) dtflatten(list); p;
p = (nitem *) dtlink(list, (Dtlink_t *) p)) {
if (oldval != p->val) { /* new pos: reset nxt */
cg = mkConstraintG(g, list, ifn, distX);
else
cg = mkNConstraintG(g, list, ifn, distX);
- rank(cg, 2, MAXINT);
+ rank(cg, 2, INT_MAX);
p = nlist;
for (i = 0; i < nnodes; i++) {
cg = mkConstraintG(g, list, ifn, distY);
else
cg = mkNConstraintG(g, list, ifn, distY);
- rank(cg, 2, MAXINT);
+ rank(cg, 2, INT_MAX);
#ifdef DEBUG
{
Agsym_t *mlsym = agedgeattr(cg, "minlen", "");
int i;
heap H;
int closestVertex, neighbor;
- DistType closestDist, prevClosestDist = MAXINT;
+ DistType closestDist, prevClosestDist = INT_MAX;
static int *index;
#ifdef OBSOLETE