From 8957d4b947e6ae622c43dceda142562ee3b0e697 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 25 Nov 2021 12:40:51 -0500 Subject: [PATCH] Slightly modified various use cases of "cellname" so that they behave as one would expect; e.g., "cellname self" returns the name of the currently edited cell if nothing is selected; "cellname rename " renames the currently edited cell to . Modified the "extract" command so that it will not extract a cell named "(UNNAMED)" but will insist that the cell must be given a proper name, much like the "writeall" command does. --- VERSION | 2 +- commands/CmdCD.c | 12 ++++++++++-- commands/CmdE.c | 15 ++++++++++++--- database/DBcellname.c | 13 +++++++++++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index df1e6b6d..9b5a4f16 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.231 +8.3.232 diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 7c26e678..17bfa425 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -1167,7 +1167,7 @@ CmdCellname(w, cmd) TxError("Unknown cell %s\n", cellname); break; } - if (locargc == 3) + if (locargc <= 3) { if (cellDef->cd_file == NULL) { @@ -1280,7 +1280,15 @@ CmdCellname(w, cmd) break; case IDX_RENAME: /* Rename the cell and mark as modified. Do not write to disk. */ - if (locargc != 4) goto badusage; + if ((locargc == 3) && (EditRootDef != NULL)) + { + /* Assume cellname is the target name, and the current */ + /* cell is the one to have its name changed. */ + cellDef = EditRootDef; + DBCellRename(cellDef->cd_name, cellname, doforce); + break; + } + else if (locargc != 4) goto badusage; DBCellRename(cellname, cmd->tx_argv[3 + ((dolist) ? 1 : 0)], doforce); break; case IDX_CREATE: diff --git a/commands/CmdE.c b/commands/CmdE.c index 698d8ae8..71bc6a2d 100644 --- a/commands/CmdE.c +++ b/commands/CmdE.c @@ -1012,7 +1012,10 @@ CmdExtract(w, cmd) if (argc == 1) { - ExtIncremental(selectedUse); + if (!strcmp(selectedUse->cu_def->cd_name, UNNAMED)) + TxError("Please name the cell before extracting.\n"); + else + ExtIncremental(selectedUse); return; } } @@ -1043,7 +1046,10 @@ CmdExtract(w, cmd) break; case EXTALL: - ExtAll(selectedUse); + if (!strcmp(selectedUse->cu_def->cd_name, UNNAMED)) + TxError("Please name the cell before extracting.\n"); + else + ExtAll(selectedUse); return; case EXTCELL: @@ -1065,7 +1071,10 @@ CmdExtract(w, cmd) TxError("No cell selected\n"); return; } - ExtParents(selectedUse); + if (!strcmp(selectedUse->cu_def->cd_name, UNNAMED)) + TxError("Please name the cell before extracting.\n"); + else + ExtParents(selectedUse); return; case EXTSHOWPARENTS: diff --git a/database/DBcellname.c b/database/DBcellname.c index 6885cd8c..72d4b8b5 100644 --- a/database/DBcellname.c +++ b/database/DBcellname.c @@ -871,8 +871,17 @@ DBCellPrint(CellName, who, dolist) } if (found == 0) { - if (!dolist) - TxPrintf("No cells selected.\n"); + if (EditRootDef == NULL) + { + if (!dolist) + TxPrintf("No cells selected.\n"); + } + else + { + dbCellPrintInfo(EditRootDef, who, dolist); + found = 1; + break; + } } } else