From efb1f008791a369b45940c067cf13147d37bfd85 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 9 Oct 2017 11:51:51 -0400 Subject: [PATCH] Preliminary method to record polygons and wire paths with property records when they are read in into their own subcells using the cif/gds read options. --- calma/CalmaRdpt.c | 2 ++ cif/CIFrdpt.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 3f2a2961..5b9c7d8b 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -272,6 +272,7 @@ calmaElementBoundary() } } + CIFPropRecordPath(cifReadCellDef, pathheadp, FALSE); rp = CIFPolyToRects(pathheadp, plane, CIFPaintTable, (PaintUndoInfo *)NULL); CIFFreePath(pathheadp); @@ -605,6 +606,7 @@ calmaElementPath() } } + CIFPropRecordPath(cifReadCellDef, pathheadp, TRUE); CIFPaintWirePath(pathheadp, width, (pathtype == CALMAPATH_SQUAREFLUSH || pathtype == CALMAPATH_CUSTOM) ? FALSE : TRUE, plane, CIFPaintTable, (PaintUndoInfo *)NULL); diff --git a/cif/CIFrdpt.c b/cif/CIFrdpt.c index e9781faa..d0cf25cf 100644 --- a/cif/CIFrdpt.c +++ b/cif/CIFrdpt.c @@ -22,6 +22,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #endif /* not lint */ #include +#include #include #include /* for wire path-to-poly path conversion */ @@ -218,6 +219,63 @@ CIFParseFlash() return TRUE; } +/* + * ---------------------------------------------------------------------------- + * + * CIFPropRecordPath -- + * + * Generate a property in the current edit cell and set it to a string + * containing the values in the list at pathheadp. + * + * If "iswire" is TRUE, then all values in the path are assumed to be + * double the actual value (because path centerlines can be on half- + * lambda). + * ---------------------------------------------------------------------------- + */ + +void +CIFPropRecordPath(def, pathheadp, iswire) + CellDef *def; + CIFPath *pathheadp; +{ + extern float CIFGetOutputScale(); + CIFPath *pathp; + char *pathstr, *sptr; + int components; + float x, y, oscale, mult; + + oscale = CIFGetOutputScale(1000); /* 1000 for conversion to um */ + if (oscale == 0.0) oscale = 1.0; + mult = (iswire == TRUE) ? 0.5 : 1.0; + + pathp = pathheadp; + components = 0; + + /* Count the number of components in the path */ + while (pathp != NULL) + { + pathp = pathp->cifp_next; + components++; + } + /* Allocate enough space to hold 2 * N points at "infinity" */ + pathstr = (char *)mallocMagic(components * 40); + + pathp = pathheadp; + sptr = pathstr; + while (pathp != NULL) + { + x = (float)pathp->cifp_x * oscale * mult; + y = (float)pathp->cifp_y * oscale * mult; + sprintf(sptr, "%.3f %.3f ", x, y); + sptr = sptr + strlen(sptr); + pathp = pathp->cifp_next; + } + + /* Reallocate pathstr to be no larger than needed to hold the path contents */ + StrDup(&pathstr, pathstr); + DBPropPut(def, "path", (ClientData)pathstr); +} + /* * ---------------------------------------------------------------------------- *