Skip to content

Commit 3dc5018

Browse files
Changed the automatic search for tech files from the "tech" line in
a .mag file to include the original system path. This restores the ability to find the tech file for any cell created using the old SCMOS technologies. This method is as problematic as is the way all SCMOS tech files used the same name "scmos". But at least it preserves backwards-compatible behavior (behavior prior to 8.3.471). This commit corrects github issue #306.
1 parent fe9ca3a commit 3dc5018

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.3.476
1+
8.3.477

database/DBio.c

+35-18
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference)
497497
int n = 1, d = 1;
498498
HashTable dbUseTable;
499499
bool needcleanup = FALSE;
500+
bool hasrcfile = FALSE;
500501

501502
/*
502503
* It's very important to disable interrupts during the body of
@@ -556,7 +557,7 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference)
556557
* magic/ and look for a compatible techfile there.
557558
*/
558559
char *found = NULL;
559-
char *string, *techfullname;
560+
char *sptr, *string, *techfullname;
560561

561562
techfullname = mallocMagic(strlen(tech) + 6);
562563
sprintf(techfullname, "%s.tech", tech);
@@ -621,45 +622,61 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference)
621622
found = DBSearchForTech(techfullname, tech, string, 0);
622623
}
623624

624-
/* Experimental---check for a ".magicrc" file in */
625-
/* the same directory as ".tech" and source it */
626-
/* first. */
625+
/* Check for a ".magicrc" file in the same directory */
626+
/* as ".tech" and source it first. */
627627

628628
if (found)
629629
{
630630
char *rcpath;
631+
FILE *tmpf;
631632

632633
rcpath = (char *)mallocMagic(strlen(found) + strlen(tech)
633634
+ 10);
634635
sprintf(rcpath, "%s/%s.magicrc", found, tech);
635-
Tcl_EvalFile(magicinterp, rcpath);
636+
if ((tmpf = fopen(rcpath, "r")) != NULL)
637+
{
638+
fclose(tmpf);
639+
Tcl_EvalFile(magicinterp, rcpath);
640+
hasrcfile = TRUE;
641+
}
636642
freeMagic(rcpath);
637643
}
638644
#endif
639645

640646
freeMagic(techfullname);
641647
if (found)
642-
{
643-
char *sptr;
644648
PaAppend(&SysLibPath, found);
645649

646-
TxError("Loading technology %s\n", tech);
647-
if (!TechLoad(tech, 0))
648-
TxError("Error in loading technology file\n");
649-
else if ((sptr = strstr(found, "libs.tech")) != NULL)
650+
TxError("Loading technology %s\n", tech);
651+
result = TechLoad(tech, 0);
652+
if (!result)
653+
TxError("Error in loading technology file\n");
654+
else if (found)
655+
{
656+
if ((sptr = strstr(found, "libs.tech")) != NULL)
650657
{
651658
int paths = 0;
652-
/* Additional automatic handling of open_pdks- */
653-
/* style PDKs. Append the libs.ref libraries */
654-
/* to the cell search path. */
659+
660+
if (hasrcfile == FALSE)
661+
{
662+
/* Additional automatic handling of open_pdks- */
663+
/* style PDKs. Append the libs.ref libraries */
664+
/* to the cell search path. Do this only if a */
665+
/* magicrc file was not associated with the PDK */
666+
/* as the magicrc file is expected to set the */
667+
/* search path. */
655668

656-
strcpy(sptr + 5, "ref");
657-
paths = DBAddStandardCellPaths(found, 0);
658-
if (paths > 0)
659-
TxPrintf("Cell path is now \"%s\"\n", CellLibPath);
669+
strcpy(sptr + 5, "ref");
670+
paths = DBAddStandardCellPaths(found, 0);
671+
if (paths > 0)
672+
TxPrintf("Cell path is now \"%s\"\n", CellLibPath);
673+
}
660674
}
661675
freeMagic(found);
676+
}
662677
#ifdef MAGIC_WRAPPER
678+
if (result)
679+
{
663680
/* Apply tag callbacks for "tech load" command */
664681
{
665682
char *argv[2];

0 commit comments

Comments
 (0)