
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;  libInit.il
;;
;;  PDK Automation System (PAS)
;;  Cadence Design Systems
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

let( ( ddObj (flag t) (libName "gpdk090") )

  printf("Loading %s/libInit.il ...\n" libName)

  if( ddGetObj(libName) then
    
     ;; load custom library initialization file
     when( ddObj = ddGetObj(libName nil nil "libInitCustomEnter.il")
	printf("\tLoading %s/%s ... " libName ddObj~>name)
	if( errset(load(ddGetObjReadPath(ddObj))) then
	   printf("done!\n")
	else
	   flag = nil
	   printf("failed!\n")
	)
     ) ; ** when ddObj **


     ;; load loadCxt.ile
     unless( fboundp('PasLoadLibContext)
	when( ddObj = ddGetObj(libName nil nil "loadCxt.ile")
	   printf("\tLoading %s/%s ... " libName ddObj~>name)
	   if( errset(load(ddGetObjReadPath(ddObj))) then
	      printf("done!\n")
	   else
	      flag = nil
	      printf("failed!\n")
	   ) ; ** if errset **
	) ; ** when ddObj **
     ) ; ** unless fboundp **
     
     ;; load library context files
     if(  fboundp('PasLoadLibContext) then
	unless( PasLoadLibContext(libName libName)
	   flag = nil
	)
	unless( PasLoadLibContext(libName "pdkUtils")
	   flag = nil
	)
     else
	flag = nil
     ) ; ** if fboundp **
     
     ;; load library .cdsenv file
     when( ddObj = ddGetObj(libName nil nil ".cdsenv")
	printf("\tLoading %s/%s ... " libName ddObj~>name)
	if( errset(PasEnvLoadFile(ddGetObjReadPath(ddObj))) then
	   printf("done!\n")
	else
	   flag = nil
	   printf("failed!\n")
	) 
     ) ; ** when ddObj **
     
     ;; load library display resource file
     when(  fboundp(`drLoadDrf)     
	when( ddObj = ddGetObj(libName nil nil "display.drf")
	   printf("\tLoading %s/%s ... " libName ddObj~>name)
	   if( errset(drLoadDrf(ddGetObjReadPath(ddObj) nil)) then
	      printf("done!\n")
	   else
	      flag = nil
	      printf("failed!\n")
	   )
	) ; ** when ddObj **
     ) ; ** when fboundp **
     
     ;; set the number of digits to be displayed to 6
     when( fboundp('aelPushSignifDigits)
	aelPushSignifDigits(6)
     )
     
     ;; load custom library initialization file (exit)
     when( ddObj = ddGetObj(libName nil nil "libInitCustomExit.il")
	printf("\tLoading %s/%s ... " libName ddObj~>name)
	if( errset(load(ddGetObjReadPath(ddObj))) then
	   printf("done!\n")
	else
	   flag = nil
	   printf("failed!\n")
	)
     ) ; ** when ddObj **
  else
     flag = nil
  ) ; ** if ddGetObj **

  if( flag then
     printf("Loaded %s/libInit.il successfully!\n" libName)
  else
     printf("Failed to load %s/libInit.il successfully!" libName)
  )
  
  t
  
) ; ** let **

