The Cadence® Library Exchange Format (LEF) reader provides the following routines for opening and closing compressed LEF files. These routines are used instead of the fopen and fclose routines that are used for regular LEF files.
Specifies the compressed file to open.
Specifies how to open the file. Compressed files should be opened as read only; therefore, specify "r".
Closes the compressed LEF file. If the file closes with no errors, this routine returns zero.
Specifies a pointer to the compressed file to close.
The following example uses the lefGZipOpen and lefGZipClose routines to open and close a compressed file.
for (fileCt = 0; fileCt < numInFile; fileCt++) {
lefrReset();
// Open the compressed LEF file for the reader to read
if ((f = lefGZipOpen(inFile[fileCt], "r")) == 0) {
fprintf(stderr, "Couldn't open input file '%s'\n", inFile[fileCt]);
return(2) ;
}
(void)lefrEnableReadEncrypted();
// Initialize the lef writer. Needs to be called first.
status = lefwInit(fout);
if (status != LEFW_OK)
return 1;
res = lefrRead((FILE*)f, inFile[fileCt], (void*)userData);
if (res)
fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);
// Close the compressed LEF file.
lefGZipClose(f);
(void)lefrPrintUnusedCallbacks(fout);