From 7d9167257a64313b70e3915333cabe4cea7d87e9 Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Mon, 16 Mar 2026 12:50:17 -0400 Subject: [PATCH] Corrected an error caused by a recent commit that was attempting to avoid bogus values for array pitch in the direction in which a cell is not arrayed: If the array declares an ANGLE of 90 or 270, then rows and columns are effectively swapped for the purpose of figuring out which coordinate direction should be ignored in the input. The original example did not use ANGLE and so the exception was not handled. --- VERSION | 2 +- calma/CalmaRdcl.c | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index d2da60ef..22af1b01 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.621 +8.3.623 diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 016d6a62..5db40879 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -789,8 +789,8 @@ calmaElementSref( char *filename) { int nbytes, rtype, cols, rows, nref, n, i, savescale; - int xlo, ylo, xhi, yhi, xsep, ysep; - bool madeinst = FALSE; + int xlo, ylo, xhi, yhi, xsep, ysep, angle; + bool madeinst = FALSE, rotated = FALSE; char *sname = NULL; bool isArray = FALSE; bool dolookahead = FALSE; @@ -990,6 +990,14 @@ calmaElementSref( refarray[2].p_x = refarray[2].p_y = 0; } + /* If the array is given an angle, then the meaning of rows and + * columns needs to be swapped for the purpose of ignoring + * X or Y values in the case of a 1-row or 1-column entry. + */ + angle = GeoTransAngle(&trans, 0); + if ((angle == 90) || (angle == 270) || (angle == -90) || (angle == -270)) + rotated = TRUE; + /* If this is a cell reference, then we scale to magic coordinates * and place the cell in the magic database. However, if this is * a cell to be flattened a la "gds flatten", then we keep the GDS @@ -1000,6 +1008,7 @@ calmaElementSref( * is problematic, and probably incorrect. */ + for (n = 0; n < nref; n++) { savescale = calmaReadScale1; @@ -1011,17 +1020,17 @@ calmaElementSref( * them as needed. */ - if ((n > 0) && (rows == 1)) + if ((n > 0) && ((!rotated && (rows == 1)) || (rotated && (cols == 1)))) { calmaReadX(&refarray[n], 1); calmaSkipBytes(4); - refarray[n].p_y = 0; + refarray[n].p_y = refarray[0].p_y; } - else if ((n > 0) && (cols == 1)) + else if ((n > 0) && ((!rotated && (cols == 1)) || (rotated && (rows == 1)))) { calmaSkipBytes(4); calmaReadY(&refarray[n], 1); - refarray[n].p_x = 0; + refarray[n].p_x = refarray[0].p_x; } else calmaReadPoint(&refarray[n], 1);