From eed9882bf2f7e02ddfdcdcadb0d88c7a82152abc Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 26 Aug 2022 08:59:25 -0400 Subject: [PATCH] Modified the handling of GDS library names to avoid creating cells with slashes in the name (picks up the text after the last slash). Also allowed the "gds library" command option to modify the behavior of "gds read" (previously only affected "gds write") to indicate that the GDS file is a library and that there are no top- level contents, only subcell definitions. Also: Corrected a typo from yesterday's commit that prevents magic from compiling (oops). --- VERSION | 2 +- calma/CalmaRead.c | 42 ++++++++++++++++++++++++++++++++++++------ extflat/EFantenna.c | 2 +- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index d63d5488..4f8e22d6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.317 +8.3.318 diff --git a/calma/CalmaRead.c b/calma/CalmaRead.c index caea2def..b99a453a 100644 --- a/calma/CalmaRead.c +++ b/calma/CalmaRead.c @@ -94,6 +94,8 @@ bool CalmaUnique = FALSE; /* If TRUE, then if a cell exists in * memory is renamed to a unique * identifier with a _N suffix. */ +extern bool CalmaDoLibrary; /* Also used by GDS write */ + extern void calmaUnexpected(); extern int calmaWriteInitFunc(); @@ -157,7 +159,7 @@ CalmaReadFile(file, filename) char *filename; /* The real name of the file read */ { int k, version; - char *libname = NULL; + char *libname = NULL, *libnameptr; MagWindow *mw; static int hdrSkip[] = { CALMA_FORMAT, CALMA_MASK, CALMA_ENDMASKS, CALMA_REFLIBS, CALMA_FONTS, CALMA_ATTRTABLE, @@ -216,15 +218,43 @@ CalmaReadFile(file, filename) if (!calmaSkipExact(CALMA_BGNLIB)) goto done; calmaSkipSet(skipBeforeLib); if (!calmaReadStringRecord(CALMA_LIBNAME, &libname)) goto done; - if ((libname != NULL) && (libname[0] != '\0')) + + /* Use CalmaDoLibrary similarly for input as for output; if set to */ + /* TRUE, the library name is considered meaningless and discarded; */ + /* the GDS file contents are read into memory but no view is loaded */ + + if (CalmaDoLibrary) + libnameptr = NULL; + else + libnameptr = libname; + + if ((libnameptr != NULL) && (libname[0] != '\0')) { + bool modified = FALSE; + char *sptr; + /* Avoid generating a magic name with spaces in it. . . */ /* (added by Mike Godfrey, 7/17/05) */ for (k = 0; k < strlen(libname); k++) if (libname[k] == ' ') + { libname[k] = '_'; - TxPrintf("Library name: %s\n", libname); + modified = TRUE; + } + + /* Avoid generating a magic name with slashes in it. . . */ + /* (added by Tim, 8/26/2022) */ + + if ((sptr = strrchr(libname, '/')) != NULL) + { + libnameptr = sptr + 1; + modified = TRUE; + } + + if (modified) + TxPrintf("Library name modified to make legal cell name syntax.\n"); + TxPrintf("Library name: %s\n", libnameptr); } /* Skip the reflibs, fonts, etc. cruft */ @@ -249,15 +279,15 @@ done: /* top-level cell, so magic-produced GDS can be read back */ /* with the expected cell appearing in the layout window. */ - if (libname != NULL) + if (libnameptr != NULL) { mw = CmdGetRootPoint((Point *)NULL, (Rect *)NULL); if (mw == NULL) windCheckOnlyWindow(&mw, DBWclientID); if (mw != NULL) { - if (calmaLookCell(libname, NULL) != (CellDef *)NULL) - DBWloadWindow(mw, libname, 0); + if (calmaLookCell(libnameptr, NULL) != (CellDef *)NULL) + DBWloadWindow(mw, libnameptr, 0); } freeMagic(libname); } diff --git a/extflat/EFantenna.c b/extflat/EFantenna.c index a92a32f6..532042b1 100644 --- a/extflat/EFantenna.c +++ b/extflat/EFantenna.c @@ -802,7 +802,7 @@ antennaAccumFunc(tile, aaptr) } /* NOTE: The "partial" model ignores the contribution of vias. */ - if (!(ExtCurStyle->exts_antennaModel & ANTENNAMODE_PARTIAL)) + if (!(ExtCurStyle->exts_antennaModel & ANTENNAMODEL_PARTIAL)) { if (type >= DBNumUserLayers) {