From 3065d4cc4b28065c88f40b20d9a556d37a12df03 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 21 Jan 2022 22:17:54 -0500 Subject: [PATCH] After much pain and suffering, finally tracked down all the places that the timestamp is updated after reading in CIF or GDS, and managed to get the timestamp dirty flag to remain clear after reading when "gds datestamp" is used. This includes a modification of the timestamp update routine that only updates timestamps on a single file if only a single file is being written. --- calma/CalmaRdcl.c | 8 ++++---- cif/CIFrdcl.c | 4 ++++ commands/CmdRS.c | 4 ++-- commands/CmdSubrs.c | 2 +- commands/CmdTZ.c | 9 +++++++-- database/DBcellsrch.c | 2 -- database/DBtimestmp.c | 8 ++++++-- extract/ExtMain.c | 2 +- 8 files changed, 25 insertions(+), 14 deletions(-) diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index fc922b05..0048db80 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -550,11 +550,11 @@ calmaParseStructure(filename) DBWAreaChanged(cifReadCellDef, &cifReadCellDef->cd_bbox, DBW_ALLWINDOWS, &DBAllButSpaceBits); - DBCellSetModified(cifReadCellDef, TRUE); - /* Only mark cell as needing a timestamp update if the timestamp is zero */ - if (cifReadCellDef->cd_timestamp != 0) - cifReadCellDef->cd_flags &= ~CDGETNEWSTAMP; + /* Note: This sets the CDGETNEWSTAMP flag, but if the timestamp is + * not zero, then it gets cleared in CIFReadCellCleanup(). + */ + DBCellSetModified(cifReadCellDef, TRUE); /* * Assign use-identifiers to all the cell uses. diff --git a/cif/CIFrdcl.c b/cif/CIFrdcl.c index 1f8d337d..0f6f40e1 100644 --- a/cif/CIFrdcl.c +++ b/cif/CIFrdcl.c @@ -1660,6 +1660,10 @@ CIFReadCellCleanup(filetype) DRCCheckThis(def, TT_CHECKPAINT, &def->cd_bbox); DBWAreaChanged(def, &def->cd_bbox, DBW_ALLWINDOWS, &DBAllButSpaceBits); DBCellSetModified(def, TRUE); + + /* Only mark cell as needing a timestamp update if the timestamp is zero */ + if (def->cd_timestamp != 0) + def->cd_flags &= ~CDGETNEWSTAMP; } /* Do geometrical processing on the top-level cell. */ diff --git a/commands/CmdRS.c b/commands/CmdRS.c index a73ec632..7f68808a 100644 --- a/commands/CmdRS.c +++ b/commands/CmdRS.c @@ -209,7 +209,7 @@ CmdSave(w, cmd) else locDef = EditCellUse->cu_def; - DBUpdateStamps(); + DBUpdateStamps(locDef); if (cmd->tx_argc == 2) { char *fileName; @@ -1151,7 +1151,7 @@ CmdSelect(w, cmd) DBStdPaintTbl(TT_CHECKPAINT, PL_DRC_CHECK), (PaintUndoInfo *) NULL); - DBUpdateStamps(); + DBUpdateStamps(SelectDef); cmdSaveCell(SelectDef, cmd->tx_argv[2], FALSE, FALSE); return; diff --git a/commands/CmdSubrs.c b/commands/CmdSubrs.c index c824c5d1..d7fc1fcd 100644 --- a/commands/CmdSubrs.c +++ b/commands/CmdSubrs.c @@ -637,7 +637,7 @@ cmdSaveCell(cellDef, newName, noninteractive, tryRename) } } - DBUpdateStamps(); + DBUpdateStamps(cellDef); if (!DBCellWrite(cellDef, fileName)) { TxError("Could not write file. Cell not written.\n"); diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index e9251c17..a39e5d8e 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -1837,21 +1837,26 @@ CmdWriteall(w, cmd) /* Check if all cells exist */ if (cmd->tx_argc > 2) { + CellDef *def; int i; int notfound = 0; for (i = 2; i < cmd->tx_argc; i++) { - if (DBCellLookDef(cmd->tx_argv[i]) == NULL) + def = DBCellLookDef(cmd->tx_argv[i]); + if (def == NULL) { TxError("No such cell \"%s\".\n", cmd->tx_argv[i]); notfound++; } + else if (option != OPT_WRITEALL_NOUPDATE) + DBUpdateStamps(def); } if (notfound == cmd->tx_argc - 2) return; } } if (option != OPT_WRITEALL_NOUPDATE) - DBUpdateStamps(); + if (cmd->tx_argc <= 2) + DBUpdateStamps(NULL); argc = cmd->tx_argc; (void) DBCellSrDefs(flags, cmdWriteallFunc, (ClientData)cmd); diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index 688c09e3..d08aaecc 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -1511,8 +1511,6 @@ DBScaleEverything(scalen, scaled) int dbCellDefEnumFunc(); LinkedCellDef *lhead, *lcd; - // DBUpdateStamps(); - SigDisableInterrupts(); lhead = NULL; diff --git a/database/DBtimestmp.c b/database/DBtimestmp.c index aaf442be..4cbe9c6b 100644 --- a/database/DBtimestmp.c +++ b/database/DBtimestmp.c @@ -207,14 +207,18 @@ DBFixMismatch() */ void -DBUpdateStamps() +DBUpdateStamps(def) + CellDef *def; { extern int dbStampFunc(); extern time_t time(); DBFixMismatch(); timestamp = time((time_t *) 0); - (void) DBCellSrDefs(CDGETNEWSTAMP, dbStampFunc, (ClientData) NULL); + if (def == NULL) + (void) DBCellSrDefs(CDGETNEWSTAMP, dbStampFunc, (ClientData) NULL); + else if (def->cd_flags & CDGETNEWSTAMP) + dbStampFunc(def); } int diff --git a/extract/ExtMain.c b/extract/ExtMain.c index 96588810..effa3230 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -553,7 +553,7 @@ ExtIncremental(rootUse) DBFixMismatch(); /* Update all timestamps */ - DBUpdateStamps(); + DBUpdateStamps(NULL); /* Mark all defs as being unvisited */ (void) DBCellSrDefs(0, extDefInitFunc, (ClientData) 0);