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).
This commit is contained in:
Tim Edwards 2022-01-22 13:30:11 -05:00
parent 81ecdbf209
commit 8e80644dd7
2 changed files with 16 additions and 28 deletions

View File

@ -27,13 +27,11 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "textio/txcommands.h" #include "textio/txcommands.h"
#include "commands/commands.h" #include "commands/commands.h"
int *lefDateStamp = NULL; /* If non-NULL, defines the timestamp int lefDateStamp = -1; /* If not -1, defines the timestamp to use when creating
* to use when creating new cell defs * new cell defs from LEF or DEF. Useful when generating
* from LEF or DEF. Useful when generating * libraries to make sure that full and abstract views of
* libraries to make sure that full and * the same cell have matching timestamps.
* abstract views of the same cell have */
* matching timestamps.
*/
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
@ -218,7 +216,7 @@ CmdLef(w, cmd)
if (is_lef) if (is_lef)
LefRead(namep, lefImport, lefAnnotate, lefDateStamp); LefRead(namep, lefImport, lefAnnotate, lefDateStamp);
else else
DefRead(namep, defLabelNets, lefDateStamp); DefRead(namep, defLabelNets);
break; break;
case LEF_WRITEALL: case LEF_WRITEALL:
if (!is_lef) if (!is_lef)
@ -392,14 +390,14 @@ CmdLef(w, cmd)
if (cmd->tx_argc == 2) if (cmd->tx_argc == 2)
{ {
#ifdef MAGIC_WRAPPER #ifdef MAGIC_WRAPPER
if (lefDateStamp != NULL) if (lefDateStamp != -1)
Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(*lefDateStamp)); Tcl_SetObjResult(magicinterp, Tcl_NewIntObj(lefDateStamp));
else else
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj("default", -1)); Tcl_SetObjResult(magicinterp, Tcl_NewStringObj("default", -1));
#else #else
if (lefDateStamp != NULL) if (lefDateStamp != -1)
TxPrintf("Macros will contain a header creation date " TxPrintf("Macros will contain a header creation date "
"stamp of %d.\n", *lefDateStamp); "stamp of %d.\n", lefDateStamp);
else else
TxPrintf("Macros will contain a default header creation date " TxPrintf("Macros will contain a default header creation date "
"stamp.\n"); "stamp.\n");
@ -410,19 +408,9 @@ CmdLef(w, cmd)
goto wrongNumArgs; goto wrongNumArgs;
if (!strcmp(cmd->tx_argv[2], "default")) if (!strcmp(cmd->tx_argv[2], "default"))
{ lefDateStamp = -1;
if (lefDateStamp != NULL)
{
freeMagic((char *)lefDateStamp);
lefDateStamp = NULL;
}
}
else if (StrIsInt(cmd->tx_argv[2])) else if (StrIsInt(cmd->tx_argv[2]))
{ lefDateStamp = atoi(cmd->tx_argv[2]);
if (lefDateStamp == NULL)
lefDateStamp = (int *)mallocMagic(sizeof(int));
*lefDateStamp = atoi(cmd->tx_argv[2]);
}
else else
{ {
TxError("Unrecognizable date stamp \"%s\".\n", cmd->tx_argv[2]); TxError("Unrecognizable date stamp \"%s\".\n", cmd->tx_argv[2]);

View File

@ -1729,7 +1729,7 @@ LefReadMacro(f, mname, oscale, importForeign, doAnnotate, lefTimestamp)
bool doAnnotate; /* If true, ignore all macros that are bool doAnnotate; /* If true, ignore all macros that are
* not already CellDefs. * 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. * as the CellDef's timestamp.
*/ */
{ {
@ -1805,9 +1805,9 @@ LefReadMacro(f, mname, oscale, importForeign, doAnnotate, lefTimestamp)
else else
is_imported = TRUE; is_imported = TRUE;
} }
if (lefTimestamp != NULL) if (lefTimestamp != -1)
{ {
lefMacro->cd_timestamp = *lefTimestamp; lefMacro->cd_timestamp = lefTimestamp;
lefMacro->cd_flags = CDFIXEDSTAMP; lefMacro->cd_flags = CDFIXEDSTAMP;
} }
@ -2535,7 +2535,7 @@ LefRead(inName, importForeign, doAnnotate, lefTimestamp)
char *inName; char *inName;
bool importForeign; bool importForeign;
bool doAnnotate; bool doAnnotate;
int *lefTimestamp; int lefTimestamp;
{ {
FILE *f; FILE *f;
char *filename; char *filename;