Added option "notopports" to "extract unique". The option
behaves like "extract unique all" on all cells below the topmost level of hierarchy, and "extract unique noports" on the top level.
This commit is contained in:
parent
d63a102515
commit
96b7c20c17
|
|
@ -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[] =
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue