#ifndef lint static char sccsid[] = "@(#)chainutil.c 9.3 88/01/19 Copyright 1985 Sun Micro"; #endif /* * Copyright (c) 1985 by Sun Microsystems, Inc. */ /*- Random chain utilities test.c, Thu Jun 27 14:50:37 1985 James Gosling, Sun Microsystems */ #include #ifdef REF #include #include #endif #include "shape.h" #include "trap_step.h" dumpchain() { /*- register i, j; for (i = shape_ymin; iy = desired_y; lo = 0; hi = trap->used-1; while (lo < hi) { mid = (hi+lo+1)>>1; if (trap->start[mid].y <= desired_y) lo = mid; else hi = mid-1; } lop = &trap->start[lo]; trap->seg = lop + 2; trap->next = lop[1]; trap->x1 = lop->x1; trap->x2 = lop->x2; } printloop(l) register struct shape_arc *l; { register struct shape_arc *p; p = l; do { printf("%7.1f%7.1f; %7.1f%7.1f; %7.1f%7.1f\n", floatfr(p->A.x), floatfr(p->A.y), floatfr(p->B.x), floatfr(p->B.y), floatfr(p->C.x), floatfr(p->C.y)); p = p->next; } while(p != l); } printchain(ch) register struct shape_dcurve *ch; { while (ch != 0) { register i; register lim = ch->y1-ch->y0; printf(" %4d%4d; %4d%4d %d\n", ch->x0, ch->y0, ch->x1, ch->y1, ch->direction); for (i = 0; i<=lim; i++) printf("%10d%10d%*s*\n",i+ch->y0,ch->x[i],ch->x[i],""); ch = ch->next; } } static printtrapbodies; printtraps(t,s) register struct shape_trapezon *t; { while (t) { register struct shape_trapseg *p, *lim; register y = t->top; printf("%s: %d-%d; used %d of %d @%x\n", s, t->top, t->bottom, t->used, t->size, t); if (printtrapbodies) { p = t->segs; lim = t->segs + t->used; while (p < lim) { while (y < p->y) { printf("%4d\n", y); y++; } y++; if (p->x2 == p->x1) printf("%4d %d-%d %*s|\n", p->y, p->x1, p->x2, p->x1-t->left, ""); else printf("%4d %d-%d %*s(%*s)\n", p->y, p->x1, p->x2, p->x1-t->left, "", p->x2 - p->x1 - 1, ""); p++; } } t = t->next; } }