From 8e80644dd76495b37bf8b2303ae7a29c757fa2a2 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 22 Jan 2022 13:30:11 -0500 Subject: [PATCH] Could not get the LEF datestamp to work correctly as a pointer, due to issues of declaring global variables; rather than track down the correct use, just reworked it so that the value is just an integer and takes -1 as the default (fixed timestamping disabled). --- lef/lefCmd.c | 36 ++++++++++++------------------------ lef/lefRead.c | 8 ++++---- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/lef/lefCmd.c b/lef/lefCmd.c index 683c3672..f6206a63 100644 --- a/lef/lefCmd.c +++ b/lef/lefCmd.c @@ -27,13 +27,11 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ #include "textio/txcommands.h" #include "commands/commands.h" -int *lefDateStamp = NULL; /* If non-NULL, defines the timestamp - * to use when creating new cell defs - * from LEF or DEF. Useful when generating - * libraries to make sure that full and - * abstract views of the same cell have - * matching timestamps. - */ +int lefDateStamp = -1; /* If not -1, defines the timestamp to use when creating + * new cell defs from LEF or DEF. Useful when generating + * libraries to make sure that full and abstract views of + * the same cell have matching timestamps. + */ /* * ---------------------------------------------------------------------------- * @@ -218,7 +216,7 @@ CmdLef(w, cmd) if (is_lef) LefRead(namep, lefImport, lefAnnotate, lefDateStamp); else - DefRead(namep, defLabelNets, lefDateStamp); + DefRead(namep, defLabelNets); break; case LEF_WRITEALL: if (!is_lef) @@ -392,14 +390,14 @@ CmdLef(w, cmd) if (cmd->tx_argc == 2) { #ifdef MAGIC_WRAPPER - if (lefDateStamp != NULL) - Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(*lefDateStamp)); + if (lefDateStamp != -1) + Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(lefDateStamp)); else Tcl_SetObjResult(magicinterp, Tcl_NewStringObj("default", -1)); #else - if (lefDateStamp != NULL) + if (lefDateStamp != -1) TxPrintf("Macros will contain a header creation date " - "stamp of %d.\n", *lefDateStamp); + "stamp of %d.\n", lefDateStamp); else TxPrintf("Macros will contain a default header creation date " "stamp.\n"); @@ -410,19 +408,9 @@ CmdLef(w, cmd) goto wrongNumArgs; if (!strcmp(cmd->tx_argv[2], "default")) - { - if (lefDateStamp != NULL) - { - freeMagic((char *)lefDateStamp); - lefDateStamp = NULL; - } - } + lefDateStamp = -1; else if (StrIsInt(cmd->tx_argv[2])) - { - if (lefDateStamp == NULL) - lefDateStamp = (int *)mallocMagic(sizeof(int)); - *lefDateStamp = atoi(cmd->tx_argv[2]); - } + lefDateStamp = atoi(cmd->tx_argv[2]); else { TxError("Unrecognizable date stamp \"%s\".\n", cmd->tx_argv[2]); diff --git a/lef/lefRead.c b/lef/lefRead.c index 4d328323..0b88da19 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -1729,7 +1729,7 @@ LefReadMacro(f, mname, oscale, importForeign, doAnnotate, lefTimestamp) bool doAnnotate; /* If true, ignore all macros that are * not already CellDefs. */ - int *lefTimestamp; /* If non-NULL, use the value pointed to + int lefTimestamp; /* If not -1, use the value pointed to * as the CellDef's timestamp. */ { @@ -1805,9 +1805,9 @@ LefReadMacro(f, mname, oscale, importForeign, doAnnotate, lefTimestamp) else is_imported = TRUE; } - if (lefTimestamp != NULL) + if (lefTimestamp != -1) { - lefMacro->cd_timestamp = *lefTimestamp; + lefMacro->cd_timestamp = lefTimestamp; lefMacro->cd_flags = CDFIXEDSTAMP; } @@ -2535,7 +2535,7 @@ LefRead(inName, importForeign, doAnnotate, lefTimestamp) char *inName; bool importForeign; bool doAnnotate; - int *lefTimestamp; + int lefTimestamp; { FILE *f; char *filename;