The Libraries List button in the File Menu brings up the Libraries panel, which displays a listing of libraries found along the present search path. To speed the search, only files with a ``.lib'' extension are checked for the library keyword at the top of the file, so library files that do not have a ``.lib'' extension will not appear in this list. The first column in the listing contains an icon which indicates whether the library is open or closed.
Open libraries are searched to resolve cells when a layout file is being read. Closed libraries are ignored. A library is opened if it is ever listed in a content window from the Path Files Listing panel, or if a cell from that library is ever directly opened, such as by giving ``/path/library cellname'' to the Open command in the File Menu, or if opened with the Open/Close button (see below).
Libraries are an important component of the Xic cell resolution capability. Immediately after an archive file has been read into the main database, the new hierarchy is traversed to identify cells that are referenced in the hierarchy but were not defined in the file. First, the open libraries are searched, and if an unresolved cell name matches a name in a library, the cell is read into memory through the library. The library file itself is usually only an indirection mechanism, with the actual cells saved in another archive file, or as native cell files, though it is also possible to define inline cells in the library file.
If a cell is not resolved in the open libraries, then the search path is traversed for a native cell file that matches the cell name. If one is found, it is read into memory. If not found, the unresolved cell becomes an empty cell, and will otherwise behave normally in the database. A warning will be issued in the log file when a cell is found to be unresolved.
The library mechanism is also available when a Cell Hierarchy Digest (CHD) is used for file access. If the archive file source for the CHD contained unresolved references, the CHD will likewise have unresolved references. These cells can be resolved when reading with the CHD if they match an open library reference to a cell in an archive file. Presently, native and inlined cells can not resolve CHD references, except when reading into the main database.
By default, a cell that can't be resolved through a library is not an error, it will be handled appropriately. Processing will continue, with the non-references either being ignored (e.g., when flattening), or converted to empty cells (when reading into the database), or propagated to output (when writing output), depending on the operation.
However, if the Fail on Unresolved button in the Cell Hierarchy Digests pop-up, or equivalently the ChdFailOnUnresolved variable is set, an unresolved cell will halt the operation with a fatal error.
When reading a library cell into memory, the hierarchy under the cell will also be read, unless the subcell name already exists in memory in which case that subcell will not be read.
Cells read through the library mechanism have two internal attribute flags set, which affect their behavior. First, the LIBRARY flag will, by default, prevent the cell from being written when a hierarchy containing the cell is written to an archive file. This means that the file will not be self-contained, and will require the presence of the (open) library to completely resolve all cells. Second, the IMMUTABLE flag is set, which prevents a cell from being modified or renamed. Thus, library cells by default can not be edited when opened in this manner.
The flags can be switched on and off for any cell with the Set Cell Flags panel from the Flags button in the Cells Listing panel.
Libraries are listed and searched in the order opened, and shown in the listing. When resolving a reference, the first match will apply, superseding any later entries. The libraries can be selected by clicking on the entries. When a library is selected, the Open/Close and Contents buttons become enabled, which will act on the selection. The selection has no other purpose.
The Open/Close button toggles the open state of the selected library. The Open/Close button is active when a library is selected in the Libraries panel. Without a selection, the button is grayed. Clicking the open/closed folder icon in the selected row will have the same effect as pressing the button. Closing a library merely removes it from the search list, and any cells in memory from the library remain.
The Contents button is also activated when a library is selected in the Libraries panel. Pressing Contents will pop up a listing of the contents of the selected library. The entries can be cells, archives, or other libraries. The contents items can be selected by clicking on the names. When a selection is active, the Open and Place buttons become active. The Open button will load the selected cell into the main window. The Place button will pop up the Cell Placement Control panel, loaded with the selected cell, with which the cell can be instantiated. If the selected item is another library or an archive file, an intermediate ambiguity resolution pop-up will appear, and the user must select a cell to edit or place.
The above is manifestly true only if the referenced cell is in an archive file. A native cell will always be superseded by an inlined cell of the same reference name found earlier in the library search. Also, the NoReadExclusive and AddToBack variables will affect cell name resolution as in a normal open.
The No Overwrite Lib Cells button tracks the state of the NoOverwriteLibCells variable. By default, cells in memory that were read from a library can be overwritten by cells of the same name subsequently read into memory from an archive or native cell file. If this button is set, library cells (with the LIBRARY flag set) in memory will not be overwritten.
The contents listing is a drag source for drag/drop. Names from the list can be dropped into a drawing window, with an effect similar to using the Open button.
When Xic is in CHD display mode, i.e., the Display button in the Cell Hierarchy Digests panel is active, the Open and Place buttons in the contents window are not available. The Place button is not available in the Xiv feature set.