The Cadence® Design Exchange Format (DEF) reader provides the following routines for opening and closing compressed DEF files. These routines are used instead of the fopen and fclose routines that are used for regular DEF 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 DEF 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 defGZipOpen and defGZipClose routines to open and close a compressed file.
for (fileCt = 0; fileCt < numInFile; fileCt++) {
defrReset();
// Open the compressed DEF file for the reader to read
if ((f = defGZipOpen(inFile[fileCt], "r")) == 0) {
fprintf(stderr, "Couldn't open input file '%s'\n", inFile[fileCt]);
return(2) ;
}
// Set case sensitive to 0 to start with, in History and PropertyDefinition
// reset it to 1.
res = defrRead((FILE*)f, inFile[fileCt], (void*)userData, 1);
if (res)
fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);
// Close the compressed DEF file.
defGZipClose(f);
(void)defrPrintUnusedCallbacks(fout);