From 028612b70afd3522488c54bd437bd71ac4b24633 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 14 May 2020 15:59:39 -0400 Subject: [PATCH] Added extension to "gds flatten" command option to change the limit of geometry primitives that triggers flattening (default 10). --- calma/CalmaRdcl.c | 4 +++- commands/CmdCD.c | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 789c7b08..02a97f59 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -47,6 +47,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include "calma/calma.h" int calmaNonManhattan; +int CalmaFlattenLimit = 10; extern HashTable calmaDefInitHash; @@ -410,7 +411,8 @@ calmaParseStructure(filename) * cell by painting when instanced. But---if this cell was * instanced before it was defined, then it can't be flattened. */ - if (CalmaFlattenUses && (!was_called) && (npaths < 10) && (nsrefs == 0)) + if (CalmaFlattenUses && (!was_called) && (npaths < CalmaFlattenLimit) + && (nsrefs == 0)) { /* If CDFLATGDS is already set, may need to remove */ /* existing planes and free memory. */ diff --git a/commands/CmdCD.c b/commands/CmdCD.c index c72be050..fc7b3bac 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -117,6 +117,8 @@ CmdCalma(w, cmd) CellDef *rootDef; FILE *f; + extern int CalmaFlattenLimit; + static char *gdsExts[] = {".gds", ".gds2", ".strm", "", NULL}; static char *cmdCalmaYesNo[] = { "no", "false", "off", "yes", "true", "on", 0 }; static char *cmdCalmaWarnOptions[] = { "default", "none", "align", @@ -127,7 +129,7 @@ CmdCalma(w, cmd) "arrays [yes|no] output arrays as individual subuses (like in CIF)", "contacts [yes|no] optimize output by arraying contacts as subcells", "drccheck [yes|no] mark all cells as needing DRC checking", - "flatten [yes|no] flatten simple cells (e.g., contacts) on input", + "flatten [yes|no|limit] flatten simple cells (e.g., contacts) on input", "ordering [on|off] cause cells to be read in post-order", "labels [yes|no] cause labels to be output when writing GDS-II", "lower [yes|no] allow both upper and lower case in labels", @@ -285,8 +287,17 @@ CmdCalma(w, cmd) option = Lookup(cmd->tx_argv[2], cmdCalmaYesNo); if (option < 0) - goto wrongNumArgs; - CalmaFlattenUses = (option < 3) ? FALSE : TRUE; + { + if (StrIsInt(cmd->tx_argv[2])) + { + CalmaFlattenLimit = atoi(cmd->tx_argv[2]); + CalmaFlattenUses = (CalmaFlattenLimit > 0) ? TRUE : FALSE; + } + else + goto wrongNumArgs; + } + else + CalmaFlattenUses = (option < 3) ? FALSE : TRUE; return; case CALMA_ORDERING: