Fixed a few issues related to the "save <file>.tcl":

(1) Dimension properties were not output correctly.
(2) Magic insisted that the output file was <cell>.tcl, not <file>.tcl,
    although the error was only in the messaging
(3) Magic was incorrectly renaming the cell to <cell>.tcl after writing
    the file.
This commit is contained in:
R. Timothy Edwards 2026-03-01 11:29:25 -05:00
parent ba5154698d
commit f3478cba7b
3 changed files with 15 additions and 12 deletions

View File

@ -1 +1 @@
8.3.611
8.3.612

View File

@ -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))

View File

@ -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;
}
}