$NetBSD: patch-ac,v 1.4 2007/01/22 17:41:17 dmcmahill Exp $ sunpro compilers do not like non-constant array sizes in declarations. --- src/plane.cc.orig 1998-12-07 03:28:51.000000000 -0500 +++ src/plane.cc @@ -1,6 +1,7 @@ /* Ribbon segmentation on ground plane */ #include #include +#include #include "weeks.h" #include "plane.h" #include "../include/linear.h" @@ -100,8 +101,11 @@ void filplane(Conductor *c) y1=new double[sis->pc+1]; y2=new double[sis->pc+1]; int j,i,k; - struct line line[sis->lc+1]; - struct Plane Plane[sis->pc+2]; + struct line *line; + struct Plane *Plane; + line = new struct line[sis->lc+1]; + Plane = new struct Plane[sis->pc+2]; + for (i=0;i<=sis->lc;i++) line[i].h1=line[i].h2=0.; i=1; j=1; double *sort; @@ -213,8 +217,18 @@ void filplane(Conductor *c) for (j=1;j<=l[i];j++) LX[i][j]=b[j]; } - struct space su[sis->pc+1][sis->lc+2]; - struct space sl[sis->pc+1][sis->lc+2]; + struct space **su; + struct space **sl; + su = new struct space *[sis->pc+1]; + sl = new struct space *[sis->pc+1]; + + if (su != NULL && sl != NULL) { + for (int i = 0; i < sis->pc+1; i++) { + su[i] = new struct space[sis->lc+2]; + sl[i] = new struct space[sis->lc+2]; + } + } + for (i=1;i<=sis->pc;i++) { for (j=1;j<=u[i]/2;j++) su[i][j].hl=su[i][j].hr=0.; for (j=1;j<=l[i]/2;j++) sl[i][j].hl=sl[i][j].hr=0.; @@ -334,11 +348,11 @@ void filplane(Conductor *c) for (i=1;i<=sis->pc;i++) { for (j=1;j<=l[i];j++) { if (l[i]!=2) - if (LX[i][j]!=LX[i][j+1]) fprintf(fo,"below %ld %le\n",i,LX[i][j]); + if (LX[i][j]!=LX[i][j+1]) fprintf(fo,"below %d %e\n",i,LX[i][j]); } for (j=1;j<=u[i];j++) { if (u[i]!=2) - if (UX[i][j]!=UX[i][j+1]) fprintf(fo,"above %ld %le\n",i,UX[i][j]); + if (UX[i][j]!=UX[i][j+1]) fprintf(fo,"above %d %e\n",i,UX[i][j]); } }