From f3478cba7b8367fcf130657017fcb010cccd6b33 Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Sun, 1 Mar 2026 11:29:25 -0500 Subject: [PATCH] Fixed a few issues related to the "save .tcl": (1) Dimension properties were not output correctly. (2) Magic insisted that the output file was .tcl, not .tcl, although the error was only in the messaging (3) Magic was incorrectly renaming the cell to .tcl after writing the file. --- VERSION | 2 +- commands/CmdSubrs.c | 13 ++++++++----- database/DBio.c | 12 ++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/VERSION b/VERSION index 73d0b208..85bfd89e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.611 +8.3.612 diff --git a/commands/CmdSubrs.c b/commands/CmdSubrs.c index d871ca50..5ff6d199 100644 --- a/commands/CmdSubrs.c +++ b/commands/CmdSubrs.c @@ -761,13 +761,16 @@ cmdSaveCell( if (!tryRename || (fileName == NULL) || (strcmp(cellDef->cd_name, fileName) == 0)) goto cleanup; - /* Rename the cell */ - if (!DBCellRenameDef(cellDef, fileName)) + /* Rename the cell, unless fileName is a .tcl file (scripted output) */ + if ((strlen(fileName) <= 4) || strcmp(fileName + strlen(fileName) - 4, ".tcl")) { - /* This should never happen */ - TxError("Magic error: there is already a cell named \"%s\"\n", + if (!DBCellRenameDef(cellDef, fileName)) + { + /* This should never happen */ + TxError("Magic error: there is already a cell named \"%s\"\n", fileName); - goto cleanup; + goto cleanup; + } } if (EditCellUse && (cellDef == EditCellUse->cu_def)) diff --git a/database/DBio.c b/database/DBio.c index 9c065f2b..cc4ec1ad 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -4384,8 +4384,6 @@ ioerror: return (FALSE); } SigEnableInterrupts(); - TxPrintf("Saved cell %s as a sequence of magic commands (file %s.tcl).\n", - cellDef->cd_name, cellDef->cd_name); return (TRUE); } @@ -4527,7 +4525,7 @@ dbWritePropCommandsFunc(key, proprec, cdarg) break; case PROPERTY_TYPE_INTEGER: - fprintf(f, "property integer "); + fprintf(f, "property integer %s ", key); for (i = 0; i < proprec->prop_len; i++) fprintf(f, "%d ", proprec->prop_value.prop_integer[i]); fprintf(f, "\n"); @@ -4535,15 +4533,15 @@ dbWritePropCommandsFunc(key, proprec, cdarg) case PROPERTY_TYPE_DIMENSION: windCheckOnlyWindow(&w, DBWclientID); - fprintf(f, "property dimension "); + fprintf(f, "property dimension %s ", key); for (i = 0; i < proprec->prop_len; i++) - fprintf(f, "%d ", DBWPrintValue(proprec->prop_value.prop_integer[i], + fprintf(f, "%s ", DBWPrintValue(proprec->prop_value.prop_integer[i], w, ((i % 2) == 0) ? TRUE : FALSE)); fprintf(f, "\n"); break; case PROPERTY_TYPE_DOUBLE: - fprintf(f, "property double "); + fprintf(f, "property double %s ", key); for (i = 0; i < proprec->prop_len; i++) fprintf(f, "%"DLONG_PREFIX"d ", proprec->prop_value.prop_double[i]); fprintf(f, "\n"); @@ -4624,6 +4622,8 @@ DBCellWrite(cellDef, fileName) { result = DBCellWriteCommandFile(cellDef, realf); fclose(realf); + TxPrintf("Saved cell %s as a sequence of magic commands " + "(file %s).\n", cellDef->cd_name, fileName); return result; } }