com.sun.electric.tool.io.input
Class LibraryFiles

java.lang.Object
  extended by com.sun.electric.tool.io.input.Input
      extended by com.sun.electric.tool.io.input.LibraryFiles
Direct Known Subclasses:
ELIB, JELIB, ReadableDump

public abstract class LibraryFiles
extends Input

This class reads Library files (ELIB or readable dump) format.


Field Summary
protected  double[] cellLambda
          lambda value for each cell of the library
protected static int cellsConstructed
          number of cells constructed so far.
protected  boolean convertMosisCmosTechnologies
          true if old MOSIS CMOS technologies appear in the library
protected  int errorCount
          Number of errors in this LibraryFile
static Variable.Key IO_DUMMY_OBJECT
          key of Variable to denote a dummy cell or library
static Variable.Key IO_TRUE_LIBRARY
          key of Varible holding true library of fake cell.
protected  Library lib
          The Library being input.
protected static java.lang.String mainLibDirectory
          the path to the library being read.
protected  int nodeProtoCount
          The number of Cells in the file.
protected  Cell[] nodeProtoList
          A list of cells being read.
protected  boolean rotationMirrorBits
          true if rotation mirror bits are used
protected  java.util.List<Cell> scaledCells
          a List of scaled Cells that got created
protected  boolean scaleLambdaBy20
          true to scale lambda by 20
protected  java.util.HashMap<Technology,Technology.SizeCorrector> sizeCorrectors
          SizeCorrectors for used technologies
protected static double TINYDISTANCE
           
protected  boolean topLevelLibrary
          true if the library is the main one being read.
protected static int totalCells
          total number of cells in all read libraries
protected static boolean VERBOSE
           
protected  Version version
          the Electric version in the library file.
 
Fields inherited from class com.sun.electric.tool.io.input.Input
byteCount, dataInputStream, errorLogger, fileLength, filePath, inputStream, lineReader, READ_BUFFER_SIZE
 
Method Summary
protected  boolean canScale()
           
static void cleanupLibraryInput()
           
protected  double computeLambda(Cell cell, int cellIndex)
           
protected  void computeTech(Cell cell, java.util.Set uncomputedCells)
           
protected static java.lang.String convertGeomName(java.lang.Object value, boolean isDisplay)
          Method to conver name of Geometric object.
protected  View findOldViewName(java.lang.String viewName)
          Method to find the View to use for an old View name.
protected  Technology findTechnologyName(java.lang.String name)
           
protected  LibraryFiles getReaderForLib(Library lib)
           
static void initializeLibraryInput()
           
protected static Library readALibrary(java.net.URL fileURL, Library lib, java.lang.String libName, FileType type)
          Method to read a single library file.
protected  Library readExternalLibraryFromFilename(java.lang.String theFileName, FileType defaultType)
          Method to read an external library file, given its name as stored on disk.
 boolean readInputLibrary()
           
static Library readLibrary(java.net.URL fileURL, java.lang.String libName, FileType type, boolean quick)
          Method to read a Library from disk.
protected  boolean readProjectSettings()
          Method to read project settings from a Library.
static java.util.Map<Setting,java.lang.Object> readProjectsSettingsFromLibrary(java.net.URL fileURL, FileType type)
          Method to read a Library from disk.
static IdMapper reloadLibrary(Library lib)
          Reload a library from disk.
static void reloadLibraryCells(java.util.List<Cell> cellList)
          Reload Cells from disk.
protected  void scanNodesForRecursion(Cell cell, java.util.HashSet<Cell> markCellForNodes, NodeProto[] nil, int start, int end)
           
protected  boolean spreadLambda(Cell cell, int cellIndex)
           
 
Methods inherited from class com.sun.electric.tool.io.input.Input
changesQuiet, closeInput, eofDuring, getAKeyword, getLine, getLineFromBinary, getProgressNote, getRestOfLine, importALibrary, importLibrary, importToCurrentLibrary, initKeywordParsing, isBreakCharacter, isChangeQuiet, isNewLibraryCreated, openBinaryInput, openStringsInput, openTextInput, preprocessLine, readWholeLine, setProgressNote, setProgressValue, startProgressDialog, stopProgressDialog, updateProgressDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IO_TRUE_LIBRARY

public static final Variable.Key IO_TRUE_LIBRARY
key of Varible holding true library of fake cell.


IO_DUMMY_OBJECT

public static final Variable.Key IO_DUMMY_OBJECT
key of Variable to denote a dummy cell or library


lib

protected Library lib
The Library being input.


topLevelLibrary

protected boolean topLevelLibrary
true if the library is the main one being read.


nodeProtoCount

protected int nodeProtoCount
The number of Cells in the file.


nodeProtoList

protected Cell[] nodeProtoList
A list of cells being read.


cellLambda

protected double[] cellLambda
lambda value for each cell of the library


totalCells

protected static int totalCells
total number of cells in all read libraries


cellsConstructed

protected static int cellsConstructed
number of cells constructed so far.


scaledCells

protected java.util.List<Cell> scaledCells
a List of scaled Cells that got created


errorCount

protected int errorCount
Number of errors in this LibraryFile


version

protected Version version
the Electric version in the library file.


convertMosisCmosTechnologies

protected boolean convertMosisCmosTechnologies
true if old MOSIS CMOS technologies appear in the library


scaleLambdaBy20

protected boolean scaleLambdaBy20
true to scale lambda by 20


rotationMirrorBits

protected boolean rotationMirrorBits
true if rotation mirror bits are used


sizeCorrectors

protected java.util.HashMap<Technology,Technology.SizeCorrector> sizeCorrectors
SizeCorrectors for used technologies


mainLibDirectory

protected static java.lang.String mainLibDirectory
the path to the library being read.


VERBOSE

protected static final boolean VERBOSE
See Also:
Constant Field Values

TINYDISTANCE

protected static final double TINYDISTANCE
Method Detail

readLibrary

public static Library readLibrary(java.net.URL fileURL,
                                  java.lang.String libName,
                                  FileType type,
                                  boolean quick)
Method to read a Library from disk. This method is for reading full Electric libraries in ELIB, JELIB, and Readable Dump format. This method doesn't read project settings contained in library file.

Parameters:
fileURL - the URL to the disk file.
libName - the name to give the library (null to derive it from the file path)
type - the type of library file (ELIB, JELIB, etc.)
quick - true to read the library without verbosity (used when reading a library internally).
Returns:
the read Library, or null if an error occurred.

readProjectsSettingsFromLibrary

public static java.util.Map<Setting,java.lang.Object> readProjectsSettingsFromLibrary(java.net.URL fileURL,
                                                                                      FileType type)
Method to read a Library from disk. This method is for reading full Electric libraries in ELIB, JELIB, and Readable Dump format.

Parameters:
fileURL - the URL to the disk file.
type - the type of library file (ELIB, JELIB, etc.)
Returns:
the read Library, or null if an error occurred.

readALibrary

protected static Library readALibrary(java.net.URL fileURL,
                                      Library lib,
                                      java.lang.String libName,
                                      FileType type)
Method to read a single library file.

Parameters:
fileURL - the URL to the file.
lib - the Library to read. If the "lib" is null, this is an entry-level library read, and one is created. If "lib" is not null, this is a recursive read caused by a cross-library reference from inside another library.
type - the type of library file (ELIB, CIF, GDS, etc.)
Returns:
the read Library, or null if an error occurred.

reloadLibrary

public static IdMapper reloadLibrary(Library lib)
Reload a library from disk. Note this is different from calling reloadLibraryCells(List) with a list of Cells in the library, because it also reloads new cells from disk that are not currently in memory.

Parameters:
lib - the Library to reload.
Returns:
mapping of Library/Cell/Export ids, null if the library was renamed.

reloadLibraryCells

public static void reloadLibraryCells(java.util.List<Cell> cellList)
Reload Cells from disk. Other cells in the library will not be affected. These cells must all be from the same library.


initializeLibraryInput

public static void initializeLibraryInput()

readInputLibrary

public boolean readInputLibrary()

scanNodesForRecursion

protected void scanNodesForRecursion(Cell cell,
                                     java.util.HashSet<Cell> markCellForNodes,
                                     NodeProto[] nil,
                                     int start,
                                     int end)

readProjectSettings

protected boolean readProjectSettings()
Method to read project settings from a Library. This method is never called. Instead, it is always overridden by the appropriate read subclass.

Returns:
true on error.

findOldViewName

protected View findOldViewName(java.lang.String viewName)
Method to find the View to use for an old View name.

Parameters:
viewName - the old View name.
Returns:
the View to use (null if not found).

findTechnologyName

protected Technology findTechnologyName(java.lang.String name)

readExternalLibraryFromFilename

protected Library readExternalLibraryFromFilename(java.lang.String theFileName,
                                                  FileType defaultType)
Method to read an external library file, given its name as stored on disk. Attempts to find the file in many different ways, including asking the user.

Parameters:
theFileName - the full path to the file, as written to disk.
Returns:
a Library that was read. If library cannot be read or found, creates a Library called DUMMYname, and returns that.

cleanupLibraryInput

public static void cleanupLibraryInput()

getReaderForLib

protected LibraryFiles getReaderForLib(Library lib)

convertGeomName

protected static java.lang.String convertGeomName(java.lang.Object value,
                                                  boolean isDisplay)
Method to conver name of Geometric object.

Parameters:
value - name of object
isDisplay - true if this is displayable variable.

computeTech

protected void computeTech(Cell cell,
                           java.util.Set uncomputedCells)

computeLambda

protected double computeLambda(Cell cell,
                               int cellIndex)

spreadLambda

protected boolean spreadLambda(Cell cell,
                               int cellIndex)

canScale

protected boolean canScale()