* order to reduce/remove node overlaps.
*/
+#include <assert.h>
#include <cgraph/alloc.h>
#include <neatogen/neato.h>
#include <cgraph/agxbuf.h>
#include <neatogen/quad_prog_vpsc.h>
#endif
#include <cgraph/strcasecmp.h>
+#include <stddef.h>
#define SEPFACT 0.8f /* default esep/sep */
*/
static void freeNodes(void)
{
- int i;
Info_t *ip = nodeInfo;
- for (i = 0; i < nsites; i++) {
+ for (size_t i = 0; i < nsites; i++) {
breakPoly(&ip->poly);
ip++;
}
double y_min = pp->origin.y + y;
double x_max = pp->corner.x + x;
double y_max = pp->corner.y + y;
- for (int i = 1; i < nsites; i++) {
+ for (size_t i = 1; i < nsites; i++) {
ip++;
pp = &ip->poly;
x = ip->site.coord.x;
static int makeInfo(Agraph_t * graph)
{
Agnode_t *node;
- int i;
Info_t *ip;
expand_t pmargin;
int (*polyf)(Poly *, Agnode_t *, float, float);
- nsites = agnnodes(graph);
+ assert(agnnodes(graph) >= 0);
+ nsites = (size_t)agnnodes(graph);
geominit();
nodeInfo = gv_calloc(nsites, sizeof(Info_t));
}
else polyf = makePoly;
- for (i = 0; i < nsites; i++) {
+ for (size_t i = 0; i < nsites; i++) {
ip->site.coord.x = ND_pos(node)[0];
ip->site.coord.y = ND_pos(node)[1];
*/
static void sortSites(void)
{
- int i;
Site **sp;
Info_t *ip;
sp = sites;
ip = nodeInfo;
infoinit();
- for (i = 0; i < nsites; i++) {
+ for (size_t i = 0; i < nsites; i++) {
*sp++ = &ip->site;
ip->verts = NULL;
ip->site.refcnt = 1;
static void geomUpdate(int doSort)
{
- int i;
-
if (doSort)
sortSites();
/* compute ranges */
xmin = sites[0]->coord.x;
xmax = sites[0]->coord.x;
- for (i = 1; i < nsites; i++) {
+ for (size_t i = 1; i < nsites; i++) {
xmin = fmin(xmin, sites[i]->coord.x);
xmax = fmax(xmax, sites[i]->coord.x);
}
static int countOverlap(int iter)
{
int count = 0;
- int i, j;
Info_t *ip = nodeInfo;
Info_t *jp;
- for (i = 0; i < nsites; i++)
+ for (size_t i = 0; i < nsites; i++)
nodeInfo[i].overlaps = 0;
- for (i = 0; i < nsites - 1; i++) {
+ for (size_t i = 0; i < nsites - 1; i++) {
jp = ip + 1;
- for (j = i + 1; j < nsites; j++) {
+ for (size_t j = i + 1; j < nsites; j++) {
if (polyOverlap(ip->site.coord, &ip->poly, jp->site.coord, &jp->poly)) {
count++;
ip->overlaps = 1;
double sed = dist_2(&ip->site.coord, &se);
double ned = dist_2(&ip->site.coord, &ne);
double d;
- int i;
ip++;
- for (i = 1; i < nsites; i++) {
+ for (size_t i = 1; i < nsites; i++) {
d = dist_2(&ip->site.coord, &sw);
if (d < swd) {
swd = d;
*/
static void newPos(void)
{
- int i;
Info_t *ip = nodeInfo;
addCorners();
- for (i = 0; i < nsites; i++) {
+ for (size_t i = 0; i < nsites; i++) {
if (doAll || ip->overlaps)
newpos(ip);
ip++;
static double rePos(void)
{
- int i;
Info_t *ip = nodeInfo;
double f = 1.0 + incr;
- for (i = 0; i < nsites; i++) {
+ for (size_t i = 0; i < nsites; i++) {
ip->site.coord.x *= f;
ip->site.coord.y *= f;
ip++;
*/
static void updateGraph(void)
{
- int i;
Info_t *ip;
ip = nodeInfo;
- for (i = 0; i < nsites; i++) {
+ for (size_t i = 0; i < nsites; i++) {
ND_pos(ip->node)[0] = ip->site.coord.x;
ND_pos(ip->node)[1] = ip->site.coord.y;
ip++;
* Contributors: Details at https://graphviz.org
*************************************************************************/
-
+#include <cgraph/prisize_t.h>
#include <common/render.h>
#include <stdbool.h>
#include <stdio.h>
static void PQdumphe(Halfedge * p)
{
- printf(" [%p] %p %p %d %d %d %d %f\n",
+ printf(" [%p] %p %p %d %d %d ",
p, p->ELleft, p->ELright, p->ELedge->edgenbr,
- p->ELrefcnt, p->ELpm, p->vertex ? p->vertex->sitenbr : -1,
- p->ystar);
+ p->ELrefcnt, p->ELpm);
+ if (p->vertex != 0) {
+ printf("%" PRISIZE_T, p->vertex->sitenbr);
+ } else {
+ printf("-1");
+ }
+ printf(" %f\n", p->ystar);
}
void PQdump(void)