diff --git a/VERSION b/VERSION index 8c8933e3..b5613efc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.204 +8.3.205 diff --git a/commands/CmdE.c b/commands/CmdE.c index 7d0c8f0e..89bb3b3e 100644 --- a/commands/CmdE.c +++ b/commands/CmdE.c @@ -933,11 +933,15 @@ CmdExtract(w, cmd) "receiver termName(s) identify a receiving (input) terminal", NULL }; + + /* These must match definitions EXT_UNIQ_* in extract/extract.h: */ + static char *cmdExtUniq[] = { "all extract matching labels as unique nodes", "# extract tagged labels as unique nodes", "noports ignore ports when making labels unique", + "notopports ignore top-level ports when making labels unique", NULL }; static char *cmdExtCmd[] = diff --git a/extract/ExtMain.c b/extract/ExtMain.c index d9d499f9..facdb3d8 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -243,10 +243,11 @@ extDefPushFunc(use) * If there are, we generate unique names by appending a numeric * suffix to all but one of the offending labels. * If "option" is 1 (tagged mode), then only labels ending in the - * character "#" are forced to be unique. If "option" is 2 (noports - * mode), then port labels are not forced to be unique. Finally, - * if the label has been changed and doesn't end in a '!', we leave - * feedback. + * character "#" are forced to be unique. If "option" is 2 ("noports" + * mode), then port labels are not forced to be unique. If "option" + * is 3 ("notopports" mode), then port labels on the top level are + * not forced to be unique. Finally, if the label has been changed + * and doesn't end in a '!', we leave feedback. * * Results: * None. @@ -266,6 +267,7 @@ ExtUnique(rootUse, option) { CellDef *def; int nwarn; + int locoption; /* Make sure the entire subtree is read in */ if (DBCellReadArea(rootUse, &rootUse->cu_def->cd_bbox, TRUE)) @@ -288,6 +290,12 @@ ExtUnique(rootUse, option) nwarn = 0; while (def = (CellDef *) StackPop(extDefStack)) { + /* EXT_UNIQ_NOTOPPORTS: Use EXT_UNIQ_ALL on all cells other than the top */ + if ((option == EXT_UNIQ_NOTOPPORTS) && (StackLook(extDefStack) != NULL)) + locoption = EXT_UNIQ_ALL; + else + locoption = option; + def->cd_client = (ClientData) 0; if (!SigInterruptPending) nwarn += extUniqueCell(def, option); diff --git a/extract/ExtUnique.c b/extract/ExtUnique.c index 30776c9c..7c84149d 100644 --- a/extract/ExtUnique.c +++ b/extract/ExtUnique.c @@ -53,13 +53,13 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ * For the cell 'def', look for the same label appearing in two or more * distinct nodes. For each such label found: * - * If option is 0, then generate unique names for all + * If option is EXT_UNIQ_ALL, then generate unique names for all * but one of the nodes by appending a unique numeric * suffix to the offending labels. - * If option is 1, then generate unique names only if - * the label ends in '#'. Leave feedback for all other + * If option is EXT_UNIQ_TAGGED, then generate unique names only + * if the label ends in '#'. Leave feedback for all other * names that don't end in '!'. - * If option is 2, then generate unique names as for + * If option is EXT_UNIQ_NOPORTS, then generate unique names as for * option 0 only if the label is not a port. * * Results: @@ -186,16 +186,19 @@ extMakeUnique(def, ll, lreg, lregList, labelHash, option) * changes a label to make it unique. */ text = ll->ll_label->lab_text; - if (option == 0) + if (option == EXT_UNIQ_ALL) goto makeUnique; - else if ((option == 2) && !(ll->ll_label->lab_flags & PORT_DIR_MASK)) + else if ((option == EXT_UNIQ_NOPORTS || option == EXT_UNIQ_NOTOPPORTS) && + !(ll->ll_label->lab_flags & PORT_DIR_MASK)) goto makeUnique; cpend = strchr(text, '\0'); if (cpend > text) cpend--; if (*cpend == '#') goto makeUnique; if (*cpend == '!') return 0; - if ((option == 2) && (ll->ll_label->lab_flags & PORT_DIR_MASK)) return 0; + if (((option == EXT_UNIQ_NOPORTS) || (option == EXT_UNIQ_NOTOPPORTS)) + && (ll->ll_label->lab_flags & PORT_DIR_MASK)) + return 0; /* Generate a warning for each occurrence of this label */ nwarn = 0; diff --git a/extract/extract.h b/extract/extract.h index 84a73fff..b350e2fc 100644 --- a/extract/extract.h +++ b/extract/extract.h @@ -73,6 +73,12 @@ extern char *extDevTable[]; extern int ExtOptions; /* Bitmask of above */ +/* Options for "extract unique" */ +#define EXT_UNIQ_ALL 0 +#define EXT_UNIQ_TAGGED 1 +#define EXT_UNIQ_NOPORTS 2 +#define EXT_UNIQ_NOTOPPORTS 3 + extern bool ExtTechLine(); extern void ExtTechInit(); extern void ExtTechFinal();