@@ -497,6 +497,7 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference)
497
497
int n = 1 , d = 1 ;
498
498
HashTable dbUseTable ;
499
499
bool needcleanup = FALSE;
500
+ bool hasrcfile = FALSE;
500
501
501
502
/*
502
503
* It's very important to disable interrupts during the body of
@@ -556,7 +557,7 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference)
556
557
* magic/ and look for a compatible techfile there.
557
558
*/
558
559
char * found = NULL ;
559
- char * string , * techfullname ;
560
+ char * sptr , * string , * techfullname ;
560
561
561
562
techfullname = mallocMagic (strlen (tech ) + 6 );
562
563
sprintf (techfullname , "%s.tech" , tech );
@@ -621,45 +622,61 @@ dbCellReadDef(f, cellDef, ignoreTech, dereference)
621
622
found = DBSearchForTech (techfullname , tech , string , 0 );
622
623
}
623
624
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. */
627
627
628
628
if (found )
629
629
{
630
630
char * rcpath ;
631
+ FILE * tmpf ;
631
632
632
633
rcpath = (char * )mallocMagic (strlen (found ) + strlen (tech )
633
634
+ 10 );
634
635
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
+ }
636
642
freeMagic (rcpath );
637
643
}
638
644
#endif
639
645
640
646
freeMagic (techfullname );
641
647
if (found )
642
- {
643
- char * sptr ;
644
648
PaAppend (& SysLibPath , found );
645
649
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 )
650
657
{
651
658
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. */
655
668
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
+ }
660
674
}
661
675
freeMagic (found );
676
+ }
662
677
#ifdef MAGIC_WRAPPER
678
+ if (result )
679
+ {
663
680
/* Apply tag callbacks for "tech load" command */
664
681
{
665
682
char * argv [2 ];
0 commit comments