Compare commits

..
31 changed files with 2176 additions and 8531 deletions

30
.flake8
View file

@ -1,30 +0,0 @@
[flake8]
ignore =
# E501 line too long
E501,
# W391 newlines at EOF
W391,
# E241 multiple spaces after comma
E241,
# E302 expected 2 newlines
E302,
# W503 line break before binary operator (to be deprecated)
W503,
# E265 block comment should start with '# '
E265,
# E123 closing bracket does not match indentation of opening bracket's line
E123,
# E124 closing bracket does not match visual indentation
E124,
# E221 multiple spaces before operator
E221,
# E201 whitespace after '['
E201,
# E741 ambiguous variable name 'I'
E741,
per-file-ignores =
# F401 import without use
*/__init__.py: F401,
__init__.py: F401,

7
.gitignore vendored
View file

@ -1,14 +1,7 @@
*.pyc
__pycache__
*.idea
.mypy_cache/
build
dist
fatamorgana.egg-info
docs
*.gds
*.gds.gz
*.oas
*.oas.gz

2
MANIFEST.in Normal file
View file

@ -0,0 +1,2 @@
include README.md
include LICENSE.md

View file

@ -1,13 +1,12 @@
# fatamorgana
# fatamorgana
**fatamorgana** is a Python package for reading and writing OASIS format layout files.
**Homepage:** https://mpxd.net/code/jan/fatamorgana
* [PyPI](https://pypi.org/project/fatamorgana)
**Capabilities:**
* This package is a work-in-progress and is largely untested -- it works for
the tasks I usually use it for, but I can't guarantee I've even
the tasks I usually use it for, but I can't guarantee I've even
tried the features you happen to use! Use at your own risk!
* Interfaces and datastructures are subject to change!
* That said the following work for me:
@ -21,7 +20,7 @@
## Installation
**Dependencies:**
* python >=3.11
* python 3.5 or newer
* (optional) numpy
@ -30,6 +29,11 @@ Install with pip from PyPi (preferred):
pip install fatamorgana
```
Install directly from git repository:
```bash
pip install git+https://mpxd.net/code/jan/fatamorgana.git@release
```
## Documentation
Most functions and classes are documented inline.
@ -38,6 +42,7 @@ To read the inline help,
import fatamorgana
help(fatamorgana.OasisLayout)
```
The documentation is currently very sparse and I expect to improve it whenever possible!
## Examples
@ -48,7 +53,7 @@ Read an OASIS file and write it back out:
with open('test.oas', 'rb') as f:
layout = fatamorgana.OasisLayout.read(f)
with open('test_write.oas', 'wb') as f:
layout.write(f)
```

View file

@ -1 +0,0 @@
../LICENSE.md

View file

@ -1 +0,0 @@
../README.md

View file

@ -15,37 +15,14 @@
numpy to speed up reading/writing.
Dependencies:
- Python 3.11 or later
- numpy (optional, faster but no additional functionality)
To get started, try:
```python3
import fatamorgana
help(fatamorgana.OasisLayout)
```
- Python 3.5 or later
- numpy (optional, no additional functionality)
"""
from .main import (
OasisLayout as OasisLayout,
Cell as Cell,
XName as XName,
)
from .basic import (
NString as NString,
AString as AString,
Validation as Validation,
OffsetTable as OffsetTable,
OffsetEntry as OffsetEntry,
EOFError as EOFError,
SignedError as SignedError,
InvalidDataError as InvalidDataError,
InvalidRecordError as InvalidRecordError,
UnfilledModalError as UnfilledModalError,
ReuseRepetition as ReuseRepetition,
GridRepetition as GridRepetition,
ArbitraryRepetition as ArbitraryRepetition,
)
from .main import OasisLayout, Cell, XName
from .basic import NString, AString, Validation, OffsetTable, OffsetEntry, \
EOFError, SignedError, InvalidDataError, InvalidRecordError
__author__ = 'Jan Petykiewicz'
__version__ = '0.14'
version = __version__
version = '0.4'

File diff suppressed because it is too large Load diff

View file

@ -3,22 +3,18 @@ This module contains data structures and functions for reading from and
writing to whole OASIS layout files, and provides a few additional
abstractions for the data contained inside them.
"""
from typing import IO
import io
import logging
from . import records
from .records import Modals, Record
from .basic import (
OffsetEntry, OffsetTable, NString, AString, real_t, Validation,
read_magic_bytes, write_magic_bytes, read_uint, EOFError,
InvalidRecordError,
)
from .records import Modals
from .basic import OffsetEntry, OffsetTable, NString, AString, real_t, Validation, \
read_magic_bytes, write_magic_bytes, read_uint, EOFError, \
InvalidDataError, InvalidRecordError
__author__ = 'Jan Petykiewicz'
#logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
@ -27,21 +23,17 @@ class FileModals:
"""
File-scoped modal variables
"""
cellname_implicit: bool | None = None
propname_implicit: bool | None = None
xname_implicit: bool | None = None
textstring_implicit: bool | None = None
propstring_implicit: bool | None = None
cellname_implicit = None # type: bool or None
propname_implicit = None # type: bool or None
xname_implicit = None # type: bool or None
textstring_implicit = None # type: bool or None
propstring_implicit = None # type: bool or None
cellname_implicit = None # type: bool or None
property_target: list[records.Property]
within_cell: bool = False
within_cblock: bool = False
end_has_offset_table: bool = False
started: bool = False
def __init__(self, property_target: list[records.Property]) -> None:
self.property_target = property_target
within_cell = False # type: bool
within_cblock = False # type: bool
end_has_offset_table = None # type: bool
started = False # type: bool
class OasisLayout:
@ -51,56 +43,49 @@ class OasisLayout:
Names and strings are stored in dicts, indexed by reference number.
Layer names and properties are stored directly using their associated
record objects.
Cells are stored using `Cell` objects (different from `records.Cell`
record objects).
Cells are stored using Cell objects (different from Cell record objects).
Properties:
File properties:
.version AString: Version string ('1.0')
.unit real number: grid steps per micron
.validation Validation: checksum data
Names:
.cellnames Dict[int, NString]
.propnames Dict[int, NString]
.xnames Dict[int, XName]
Strings:
.textstrings Dict[int, AString]
.propstrings Dict[int, AString]
Data:
.layers List[records.LayerName]
.properties List[records.Property]
.cells List[Cell]
"""
# File properties
version: AString
"""File format version string ('1.0')"""
version = None # type: AString
unit = None # type: real_t
validation = None # type: Validation
unit: real_t
"""grid steps per micron"""
properties = None # type: List[records.Property]
cells = None # type: List[Cell]
validation: Validation
"""checksum data"""
cellnames = None # type: Dict[int, NString]
propnames = None # type: Dict[int, NString]
xnames = None # type: Dict[int, XName]
# Data
properties: list[records.Property]
"""Property values"""
textstrings = None # type: Dict[int, AString]
propstrings = None # type: Dict[int, AString]
layers = None # type: List[records.LayerName]
cells: list['Cell']
"""Layout cells"""
layers: list[records.LayerName]
"""Layer definitions"""
# Names
cellnames: dict[int, 'CellName']
"""Cell names"""
propnames: dict[int, NString]
"""Property names"""
xnames: dict[int, 'XName']
"""Custom names"""
# String storage
textstrings: dict[int, AString]
"""Text strings"""
propstrings: dict[int, AString]
"""Property strings"""
def __init__(
self,
unit: real_t,
validation: Validation | None = None,
) -> None:
def __init__(self, unit: real_t, validation: Validation = None):
"""
Args:
unit: Real number (i.e. int, float, or `Fraction`), grid steps per micron.
validation: `Validation` object containing checksum data.
Default creates a `Validation` object of the "no checksum" type.
:param unit: Real number (i.e. int, float, or Fraction), grid steps per micron.
:param validation: Validation object containing checksum data.
Default creates a Validation object of the "no checksum" type.
"""
if validation is None:
validation = Validation(0)
@ -118,19 +103,16 @@ class OasisLayout:
self.layers = []
@staticmethod
def read(stream: IO[bytes]) -> 'OasisLayout':
def read(stream: io.BufferedIOBase) -> 'OasisLayout':
"""
Read an entire .oas file into an `OasisLayout` object.
Read an entire .oas file into an OasisLayout object.
Args:
stream: Stream to read from.
Returns:
New `OasisLayout` object.
:param stream: Stream to read from.
:return: New OasisLayout object.
"""
layout = OasisLayout(unit=-1) # dummy unit
file_state = FileModals()
modals = Modals()
file_state = FileModals(layout.properties)
layout = OasisLayout(unit=None)
read_magic_bytes(stream)
@ -138,39 +120,32 @@ class OasisLayout:
pass
return layout
def read_record(
self,
stream: IO[bytes],
modals: Modals,
file_state: FileModals
) -> bool:
def read_record(self,
stream: io.BufferedIOBase,
modals: Modals,
file_state: FileModals
) -> bool:
"""
Read a single record of unspecified type from a stream, adding its
contents into this `OasisLayout` object.
contents into this OasisLayout object.
Args:
stream: Stream to read from.
modals: Modal variable data, used to fill unfilled record
fields and updated using filled record fields.
file_state: File status data.
Returns:
`True` if EOF was reached without error, `False` otherwise.
Raises:
InvalidRecordError: from unexpected records
InvalidDataError: from within record parsers
:param stream: Stream to read from.
:param modals: Modal variable data, used to fill unfilled record
fields and updated using filled record fields.
:param file_state: File status data.
:return: True if EOF was reached without error, False otherwise.
:raises: InvalidRecordError from unexpected records;
InvalidDataError from within record parsers.
"""
try:
record_id = read_uint(stream)
except EOFError:
except EOFError as e:
if file_state.within_cblock:
return True
raise
else:
raise e
logger.info(f'read_record of type {record_id} at position 0x{stream.tell():x}')
record: Record
logger.info('read_record of type {} at position 0x{:x}'.format(record_id, stream.tell()))
# CBlock
if record_id == 34:
@ -188,11 +163,12 @@ class OasisLayout:
# Make sure order is valid (eg, no out-of-cell geometry)
if not file_state.started and record_id != 1:
raise InvalidRecordError(f'Non-Start record {record_id} before Start')
raise InvalidRecordError('Non-Start record {} before Start'.format(record_id))
if record_id == 1:
if file_state.started:
raise InvalidRecordError('Duplicate Start record')
file_state.started = True
else:
file_state.started = True
if record_id == 2 and file_state.within_cblock:
raise InvalidRecordError('End within CBlock')
@ -200,28 +176,25 @@ class OasisLayout:
pass
elif record_id in range(3, 13) or record_id in (28, 29):
file_state.within_cell = False
elif record_id in range(15, 28) or record_id in (32, 33):
elif record_id in range(15, 29) or record_id in (32, 33):
if not file_state.within_cell:
raise InvalidRecordError('Geometry outside Cell')
raise Exception('Geometry outside Cell')
elif record_id in (13, 14):
file_state.within_cell = True
else:
raise InvalidRecordError(f'Unknown record id: {record_id}')
raise InvalidRecordError('Unknown record id: {}'.format(record_id))
if record_id == 0:
''' Pad '''
# Pad
pass
elif record_id == 1:
''' Start '''
record = records.Start.read(stream, record_id)
record.merge_with_modals(modals)
self.unit = record.unit
self.version = record.version
file_state.end_has_offset_table = record.offset_table is None
file_state.property_target = self.properties
# TODO Offset table strict check
elif record_id == 2:
''' End '''
record = records.End.read(stream, record_id, file_state.end_has_offset_table)
record.merge_with_modals(modals)
self.validation = record.validation
@ -229,7 +202,6 @@ class OasisLayout:
raise InvalidRecordError('Stream continues past End record')
return True
elif record_id in (3, 4):
''' CellName '''
implicit = record_id == 3
if file_state.cellname_implicit is None:
file_state.cellname_implicit = implicit
@ -241,12 +213,8 @@ class OasisLayout:
key = record.reference_number
if key is None:
key = len(self.cellnames)
cellname = CellName.from_record(record)
self.cellnames[key] = cellname
file_state.property_target = cellname.properties
self.cellnames[key] = record.nstring
elif record_id in (5, 6):
''' TextString '''
implicit = record_id == 5
if file_state.textstring_implicit is None:
file_state.textstring_implicit = implicit
@ -260,7 +228,6 @@ class OasisLayout:
key = len(self.textstrings)
self.textstrings[key] = record.astring
elif record_id in (7, 8):
''' PropName '''
implicit = record_id == 7
if file_state.propname_implicit is None:
file_state.propname_implicit = implicit
@ -274,7 +241,6 @@ class OasisLayout:
key = len(self.propnames)
self.propnames[key] = record.nstring
elif record_id in (9, 10):
''' PropString '''
implicit = record_id == 9
if file_state.propstring_implicit is None:
file_state.propstring_implicit = implicit
@ -288,17 +254,17 @@ class OasisLayout:
key = len(self.propstrings)
self.propstrings[key] = record.astring
elif record_id in (11, 12):
''' LayerName '''
record = records.LayerName.read(stream, record_id)
record.merge_with_modals(modals)
self.layers.append(record)
elif record_id in (28, 29):
''' Property '''
record = records.Property.read(stream, record_id)
record.merge_with_modals(modals)
file_state.property_target.append(record)
if not file_state.within_cell:
self.properties.append(record)
else:
self.cells[-1].properties.append(record)
elif record_id in (30, 31):
''' XName '''
implicit = record_id == 30
if file_state.xname_implicit is None:
file_state.xname_implicit = implicit
@ -311,69 +277,53 @@ class OasisLayout:
if key is None:
key = len(self.xnames)
self.xnames[key] = XName.from_record(record)
# TODO: do anything with property target?
#
# Cell and elements
#
elif record_id in (13, 14):
''' Cell '''
record = records.Cell.read(stream, record_id)
record.merge_with_modals(modals)
cell = Cell(record.name)
self.cells.append(cell)
file_state.property_target = cell.properties
self.cells.append(Cell(record.name))
elif record_id in (15, 16):
''' XYMode '''
record = records.XYMode.read(stream, record_id)
record.merge_with_modals(modals)
elif record_id in (17, 18):
''' Placement '''
record = records.Placement.read(stream, record_id)
record.merge_with_modals(modals)
self.cells[-1].placements.append(record)
file_state.property_target = record.properties
elif record_id in _GEOMETRY:
''' Geometry '''
record = _GEOMETRY[record_id].read(stream, record_id)
record.merge_with_modals(modals)
self.cells[-1].geometry.append(record)
file_state.property_target = record.properties
else:
raise InvalidRecordError(f'Unknown record id: {record_id}')
raise InvalidRecordError('Unknown record id: {}'.format(record_id))
return False
def write(self, stream: IO[bytes]) -> int:
def write(self, stream: io.BufferedIOBase) -> int:
"""
Write this object in OASIS fromat to a stream.
Args:
stream: Stream to write to.
Returns:
Number of bytes written.
Raises:
InvalidDataError: if contained records are invalid.
:param stream: Stream to write to.
:return: Number of bytes written.
:raises: InvalidDataError if contained records are invalid.
"""
modals = Modals()
size = 0
size += write_magic_bytes(stream)
size += records.Start(self.unit, self.version).dedup_write(stream, modals)
size += sum(p.dedup_write(stream, modals) for p in self.properties)
cellnames_offset = OffsetEntry(False, size)
for refnum, cn in self.cellnames.items():
size += records.CellName(cn.nstring, refnum).dedup_write(stream, modals)
size += sum(p.dedup_write(stream, modals) for p in cn.properties)
size += sum(records.CellName(name, refnum).dedup_write(stream, modals)
for refnum, name in self.cellnames.items())
propnames_offset = OffsetEntry(False, size)
size += sum(records.PropName(name, refnum).dedup_write(stream, modals)
for refnum, name in self.propnames.items())
xnames_offset = OffsetEntry(False, size)
size += sum(records.XName(x.attribute, x.bstring, refnum).dedup_write(stream, modals)
size += sum(records.XName(x.attribute, x.string, refnum).dedup_write(stream, modals)
for refnum, x in self.xnames.items())
textstrings_offset = OffsetEntry(False, size)
@ -387,6 +337,8 @@ class OasisLayout:
layernames_offset = OffsetEntry(False, size)
size += sum(r.dedup_write(stream, modals) for r in self.layers)
size += sum(p.dedup_write(stream, modals) for p in self.properties)
size += sum(c.dedup_write(stream, modals) for c in self.cells)
offset_table = OffsetTable(
@ -404,109 +356,59 @@ class OasisLayout:
class Cell:
"""
Representation of an OASIS cell.
Properties:
.name NString or int (CellName reference number)
.properties List of records.Property
.placements List of records.Placement
.geometry List of geometry record objectes
"""
name: NString | int
"""name or "CellName reference" number"""
name = None # type: NString or int
properties = None # type: List[records.Property]
placements = None # type: List[records.Placement]
geometry = None # type: List[records.geometry_t]
properties: list[records.Property]
placements: list[records.Placement]
geometry: list[records.geometry_t]
def __init__(self, name: NString or int):
"""
:param name: NString or int (CellName reference number)
"""
self.name = name
self.properties = []
self.placements = []
self.geometry = []
def __init__(
self,
name: NString | str | int,
*,
properties: list[records.Property] | None = None,
placements: list[records.Placement] | None = None,
geometry: list[records.geometry_t] | None = None,
) -> None:
self.name = name if isinstance(name, NString | int) else NString(name)
self.properties = [] if properties is None else properties
self.placements = [] if placements is None else placements
self.geometry = [] if geometry is None else geometry
def dedup_write(self, stream: IO[bytes], modals: Modals) -> int:
def dedup_write(self, stream: io.BufferedIOBase, modals: Modals) -> int:
"""
Write this cell to a stream, using the provided modal variables to
deduplicate any repeated data.
Args:
stream: Stream to write to.
modals: Modal variables to use for deduplication.
Returns:
Number of bytes written.
Raises:
InvalidDataError: if contained records are invalid.
:param stream: Stream to write to.
:param modals: Modal variables to use for deduplication.
:return: Number of bytes written.
:raises: InvalidDataError if contained records are invalid.
"""
size = records.Cell(self.name).dedup_write(stream, modals)
size += sum(p.dedup_write(stream, modals) for p in self.properties)
for placement in self.placements:
size += placement.dedup_write(stream, modals)
size += sum(p.dedup_write(stream, modals) for p in placement.properties)
for shape in self.geometry:
size += shape.dedup_write(stream, modals)
size += sum(p.dedup_write(stream, modals) for p in shape.properties)
size += sum(p.dedup_write(stream, modals) for p in self.placements)
size += sum(g.dedup_write(stream, modals) for g in self.geometry)
return size
class CellName:
"""
Representation of a CellName.
This class is effectively a simplified form of a `records.CellName`,
with the reference data stripped out.
"""
nstring: NString
properties: list[records.Property]
def __init__(
self,
nstring: NString | str,
properties: list[records.Property] | None = None,
) -> None:
"""
Args:
nstring: The contained string.
properties: Properties which apply to this CellName's cell, but
are placed following the CellName record.
"""
if isinstance(nstring, NString):
self.nstring = nstring
else:
self.nstring = NString(nstring)
self.properties = [] if properties is None else properties
@staticmethod
def from_record(record: records.CellName) -> 'CellName':
"""
Create an `CellName` object from a `records.CellName` record.
Args:
record: CellName record to use.
Returns:
A new `CellName` object.
"""
return CellName(record.nstring)
class XName:
"""
Representation of an XName.
This class is effectively a simplified form of a `records.XName`,
This class is effectively a simplified form of a records.XName,
with the reference data stripped out.
"""
attribute: int
bstring: bytes
attribute = None # type: int
bstring = None # type: bytes
def __init__(self, attribute: int, bstring: bytes) -> None:
def __init__(self, attribute: int, bstring: bytes):
"""
Args:
attribute: Attribute number.
bstring: Binary data.
:param attribute: Attribute number.
:param bstring: Binary data.
"""
self.attribute = attribute
self.bstring = bstring
@ -514,19 +416,16 @@ class XName:
@staticmethod
def from_record(record: records.XName) -> 'XName':
"""
Create an `XName` object from a `records.XName` record.
Create an XName object from a records.XName record.
Args:
record: XName record to use.
Returns:
a new `XName` object.
:param record: XName record to use.
:return: XName object.
"""
return XName(record.attribute, record.bstring)
# Mapping from record id to record class.
_GEOMETRY: dict[int, type[records.geometry_t]] = {
_GEOMETRY = {
19: records.Text,
20: records.Rectangle,
21: records.Polygon,

View file

File diff suppressed because it is too large Load diff

View file

@ -1,7 +0,0 @@
"""
Tests (run with `python3 -m pytest -rxPXs | tee results.txt`)
The test_files_* modules are meant to mimic the test cases used by KLayout,
in order to provide a secondary validation mechanism.
"""

View file

@ -1,97 +0,0 @@
"""
Build files equivalent to the test cases used by KLayout.
"""
from typing import IO
from collections.abc import Callable
from pathlib import Path
from . import (
test_files_properties, test_files_cblocks, test_files_layernames,
test_files_circles, test_files_ctrapezoids, test_files_trapezoids,
test_files_placements, test_files_paths, test_files_modals,
test_files_polygons, test_files_rectangles, test_files_empty,
test_files_texts, test_files_cells,
)
def build_file(num: str, func: Callable[[IO[bytes]], IO[bytes]]) -> None:
with Path('t' + num + '.oas').open('wb') as ff:
func(ff)
def write_all_files() -> None:
build_file('1.1', test_files_empty.write_file_1)
build_file('1.2', test_files_empty.write_file_2)
build_file('1.3', test_files_empty.write_file_3)
build_file('1.4', test_files_empty.write_file_4)
build_file('1.5', test_files_empty.write_file_5)
build_file('2.1', test_files_cells.write_file_1)
build_file('2.2', test_files_cells.write_file_2)
build_file('2.3', test_files_cells.write_file_3)
build_file('2.4', test_files_cells.write_file_4)
build_file('2.5', test_files_cells.write_file_5)
build_file('2.6', test_files_cells.write_file_6)
build_file('2.7', test_files_cells.write_file_7)
build_file('3.1', lambda f: test_files_texts.write_file_common(f, 1))
build_file('3.2', lambda f: test_files_texts.write_file_common(f, 2))
build_file('3.3', test_files_texts.write_file_3)
build_file('3.4', test_files_texts.write_file_4)
build_file('3.5', lambda f: test_files_texts.write_file_common(f, 5))
build_file('3.6', test_files_texts.write_file_6)
build_file('3.7', test_files_texts.write_file_7)
build_file('3.8', test_files_texts.write_file_8)
build_file('3.9', test_files_texts.write_file_9)
build_file('3.10', test_files_texts.write_file_10)
build_file('3.11', test_files_texts.write_file_11)
build_file('4.1', lambda f: test_files_rectangles.write_file_common(f, 1))
build_file('4.2', lambda f: test_files_rectangles.write_file_common(f, 2))
build_file('5.1', lambda f: test_files_polygons.write_file_common(f, 1))
build_file('5.2', test_files_polygons.write_file_2)
build_file('5.3', lambda f: test_files_polygons.write_file_common(f, 3))
build_file('6.1', test_files_paths.write_file_1)
build_file('7.1', test_files_trapezoids.write_file_1)
build_file('8.1', test_files_placements.write_file_1)
build_file('8.2', lambda f: test_files_placements.write_file_common(f, 2))
build_file('8.3', lambda f: test_files_placements.write_file_common(f, 3))
build_file('8.4', test_files_placements.write_file_4)
build_file('8.5', lambda f: test_files_placements.write_file_common(f, 5))
build_file('8.6', test_files_placements.write_file_6)
build_file('8.7', lambda f: test_files_placements.write_file_common(f, 7))
build_file('8.8', test_files_placements.write_file_8)
build_file('9.1', test_files_ctrapezoids.write_file_1)
build_file('9.2', test_files_ctrapezoids.write_file_2)
build_file('10.1', test_files_modals.write_file_1)
build_file('11.1', lambda f: test_files_properties.write_file_common(f, 1))
build_file('11.2', lambda f: test_files_properties.write_file_common(f, 2))
build_file('11.3', test_files_properties.write_file_3)
build_file('11.4', lambda f: test_files_properties.write_file_4_6(f, 4))
build_file('11.5', lambda f: test_files_properties.write_file_common(f, 5))
build_file('11.6', lambda f: test_files_properties.write_file_4_6(f, 6))
build_file('11.7', lambda f: test_files_properties.write_file_7_8_9(f, 7))
build_file('11.8', lambda f: test_files_properties.write_file_7_8_9(f, 8))
build_file('11.9', lambda f: test_files_properties.write_file_7_8_9(f, 9))
build_file('12.1', test_files_circles.write_file_1)
build_file('13.1', test_files_layernames.write_file_1)
build_file('13.2', test_files_layernames.write_file_2)
build_file('13.3', test_files_layernames.write_file_3)
build_file('13.4', test_files_layernames.write_file_4)
build_file('14.1', test_files_cblocks.write_file_1)
if __name__ == '__main__':
write_all_files()

View file

@ -1,196 +0,0 @@
# mypy: disable-error-code="union-attr"
from typing import IO
from io import BytesIO
from numpy.testing import assert_equal
from .utils import HEADER, FOOTER
from ..basic import write_uint, write_bstring, write_byte
from ..main import OasisLayout
def base_tests(layout: OasisLayout) -> None:
assert layout.version.string == '1.0'
assert layout.unit == 1000
assert layout.validation.checksum_type == 0
assert not layout.properties
assert not layout.propnames
assert not layout.xnames
assert not layout.textstrings
assert not layout.cellnames
assert not layout.layers
assert len(layout.cells) == 1
assert layout.cells[0].name.string == 'ABCDH'
assert not layout.cells[0].properties
def write_file_1(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'ABCDH') # Cell name
cblock_data = bytes.fromhex('''
22 00 b0 02 b2 02 13
a9 66 60 98 c3 32 89 e5 0e e3 1b 61 91 4a c6 15
ac 8f 58 3a f8 be f0 8a 5a b0 30 57 5f 64 6d e4
4f bd c8 7a 87 ed 81 f8 02 79 a0 88 68 f5 42 b6
4e be 80 99 4c 3b 99 35 97 30 4f 14 d7 3c 14 f4
52 50 e4 24 e3 0b f6 9b c2 1a 9a 27 18 57 4b 8a
04 ae 65 3f 12 04 24 36 0b 8b 2c f2 e9 14 16 3d
c6 73 92 4d 64 21 e3 0b 9e cf 9a 15 4f 59 6f 08
83 cc 5d c8 f8 91 7b 25 7f ea 4e e6 03 3c 5b a4
66 88 01 85 d8 37 b2 fc 64 bd c8 25 5a 79 92 b1
99 4b a3 93 65 26 7b 33 bf e6 69 b6 39 7c a9 4b
40 2e e1 3b 28 a6 79 82 69 41 98 f6 14 ae 60 9b
d7 4c a2 9a 3d 8c 37 f9 6c 03 3f 32 b6 68 2c 64
5c cb f3 9a 49 f3 33 e3 0c a6 dd da 29 2f 98 76
80 d4 73 df 64 f9 cb b3 58 33 60 36 d3 13 d6 9b
9c b6 9a 3b 98 5f b2 07 2e 64 dc c9 7c 91 4b 24
f8 08 cb 6e 45 8d 47 32 1d 12 77 b8 81 4a 59 17
68 6a 1f 60 df 28 ac a9 3d 85 b5 5b b6 62 0a ff
0c 69 90 7b 36 b3 6c 65 d3 9c c9 f4 40 b1 93 a5
47 e0 32 7f 8a e6 54 d6 93 6c a2 0f 14 17 c8 03
00''')
for byte in cblock_data:
write_byte(buf, byte)
buf.write(FOOTER)
return buf
def test_file_1() -> None:
buf = write_file_1(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
geometry = layout.cells[0].geometry
assert len(geometry) == 10
for ii, gg in enumerate(geometry):
msg = f'Failed on geometry {ii}'
assert gg.x == [110, 900, 1520, -370, 1690, -50, 180, 1540, 970, 2160][ii], msg
assert gg.y == [1270, 890, 2000, 1260, 1420, 850, 860, 750, 1740, 2000][ii], msg
if ii == 0:
assert gg.layer == 0, msg
else:
assert gg.layer == 1, msg
assert gg.datatype == 0, msg
assert not gg.properties, msg
assert gg.repetition is None, msg
assert geometry[0].height == 530
assert geometry[0].width == 540
assert geometry[1].height == 610
assert geometry[1].width == 680
assert_equal(geometry[2].point_list, [
[-30, -360],
[480, -50],
[180, 430],
[-630, -20],
])
assert_equal(geometry[3].point_list, [
[-30, -400],
[450, 40],
[70, -220],
[10, 210],
[740, -20],
[0, 660],
[570, 10],
[50, 500],
[630, 20],
[10, 100],
[-810, 10],
[20, -470],
[-660, 0],
[20, -470],
[-620, 10],
[0, 610],
[610, -10],
[0, -100],
[210, 10],
[40, 820],
[-1340, 60],
[30, -1370],
])
assert_equal(geometry[4].point_list, [
[40, -760],
[490, -50],
[110, 800],
[-640, 10],
])
assert_equal(geometry[5].point_list, [
[140, -380],
[340, -10],
[30, -100],
[-320, 20],
[130, -460],
[-480, -20],
[-210, 910],
[370, 40],
])
assert_equal(geometry[6].point_list, [
[720, -20],
[20, 20],
[690, 0],
[-10, 650],
[-20, 30],
[-90, -10],
[10, 70],
[470, -30],
[20, -120],
[-320, 0],
[40, -790],
[-90, -20],
[-60, 140],
[-1390, 50],
[10, 30],
])
assert_equal(geometry[7].point_list, [
[150, -830],
[-1320, 40],
[-70, 370],
[310, -30],
[10, 220],
[250, -40],
[40, -220],
[340, 10],
[-20, 290],
[-1070, 20],
[0, 230],
[1380, -60],
])
assert_equal(geometry[8].point_list, [
[330, 0],
[-10, 480],
[620, -20],
[-10, 330],
[-930, 60],
[0, -850],
])
assert_equal(geometry[9].point_list, [
[-140, -410],
[10, -140],
[270, 0],
[130, 1030],
[-500, 50],
[10, -330],
[210, -10],
[10, -190],
])

View file

@ -1,272 +0,0 @@
# mypy: disable-error-code="union-attr"
from typing import IO
from io import BytesIO
import pytest
from .utils import HEADER, FOOTER
from ..basic import write_uint, write_bstring
from ..basic import InvalidRecordError, InvalidDataError
from ..main import OasisLayout
def base_tests(layout: OasisLayout) -> None:
assert layout.version.string == '1.0'
assert layout.unit == 1000
assert layout.validation.checksum_type == 0
assert not layout.properties
assert not layout.propnames
assert not layout.xnames
assert not layout.textstrings
assert not layout.propstrings
assert not layout.layers
def write_file_1(buf: IO[bytes]) -> IO[bytes]:
"""
Single cell with explicit name 'XYZ'
"""
buf.write(HEADER)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'XYZ') # Cell name
buf.write(FOOTER)
return buf
def test_file_1() -> None:
buf = write_file_1(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cells) == 1
assert layout.cells[0].name.string == 'XYZ'
assert not layout.cellnames
def write_file_2(buf: IO[bytes]) -> IO[bytes]:
"""
Two cellnames ('XYZ', 'ABC') and two cells with name references.
"""
buf.write(HEADER)
write_uint(buf, 3) # CELLNAME record (implicit id 0)
write_bstring(buf, b'XYZ')
write_uint(buf, 3) # CELLNAME record (implicit id 1)
write_bstring(buf, b'ABC')
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 0) # Cell name 0 (XYZ)
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 1) # Cell name 1 (ABC)
buf.write(FOOTER)
return buf
def test_file_2() -> None:
buf = write_file_2(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cellnames) == 2
assert len(layout.cells) == 2
assert layout.cellnames[0].nstring.string == 'XYZ'
assert layout.cellnames[1].nstring.string == 'ABC'
assert layout.cells[0].name == 0
assert layout.cells[1].name == 1
def write_file_3(buf: IO[bytes]) -> IO[bytes]:
"""
Invalid file, contains a mix of explicit and implicit cellnames
"""
buf.write(HEADER)
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'ABC')
write_uint(buf, 1) # id 1
write_uint(buf, 3) # CELLNAME record (implicit id 0) -- Expect failure due to mix of explicit/implicit ids
write_bstring(buf, b'XYZ')
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 0) # Cell name 0 (XYZ)
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 1) # Cell name 1 (ABC)
buf.write(FOOTER)
return buf
def test_file_3() -> None:
buf = write_file_3(BytesIO())
buf.seek(0)
with pytest.raises(InvalidRecordError):
_layout = OasisLayout.read(buf)
def write_file_4(buf: IO[bytes]) -> IO[bytes]:
"""
Two cells referencing two names with explicit ids (unsorted)
"""
buf.write(HEADER)
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'ABC')
write_uint(buf, 1) # id 1
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'XYZ')
write_uint(buf, 0) # id 0
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 0) # Cell name 0 (XYZ)
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 1) # Cell name 1 (ABC)
buf.write(FOOTER)
return buf
def test_file_4() -> None:
buf = write_file_4(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cellnames) == 2
assert len(layout.cells) == 2
assert layout.cellnames[0].nstring.string == 'XYZ'
assert layout.cellnames[1].nstring.string == 'ABC'
assert layout.cells[0].name == 0
assert layout.cells[1].name == 1
def write_file_5(buf: IO[bytes]) -> IO[bytes]:
"""
Reference to non-existent cell name.
"""
buf.write(HEADER)
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'ABC')
write_uint(buf, 1) # id 1
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'XYZ')
write_uint(buf, 0) # id 0
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 0) # Cell name 0 (XYZ)
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 2) # Cell name 2 -- Reference to non-existent CELLNAME!!!
buf.write(FOOTER)
return buf
def test_file_5() -> None:
buf = write_file_5(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cellnames) == 2
assert len(layout.cells) == 2
assert layout.cellnames[0].nstring.string == 'XYZ'
assert layout.cellnames[1].nstring.string == 'ABC'
assert layout.cells[0].name == 0
assert layout.cells[1].name == 2
#TODO add optional error checking for this case
def write_file_6(buf: IO[bytes]) -> IO[bytes]:
"""
Cellname with invalid n-string.
"""
buf.write(HEADER)
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'ABC')
write_uint(buf, 1) # id 1
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b' XYZ')
write_uint(buf, 0) # id 0
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 0) # Cell name 0 (XYZ)
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 1) # Cell name 1
buf.write(FOOTER)
return buf
def test_file_6() -> None:
buf = write_file_6(BytesIO())
buf.seek(0)
with pytest.raises(InvalidDataError):
_layout = OasisLayout.read(buf)
#base_tests(layout)
#assert len(layout.cellnames) == 2
#assert len(layout.cells) == 2
#assert layout.cellnames[0].nstring.string == ' XYZ'
#assert layout.cellnames[1].nstring.string == 'ABC'
#assert layout.cells[0].name == 0
#assert layout.cells[1].name == 1
def write_file_7(buf: IO[bytes]) -> IO[bytes]:
"""
Unused cellname.
"""
buf.write(HEADER)
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'ABC')
write_uint(buf, 1) # id 1
write_uint(buf, 4) # CELLNAME record (explicit id)
write_bstring(buf, b'XYZ')
write_uint(buf, 0) # id 0
write_uint(buf, 13) # CELL record (name ref.)
write_uint(buf, 0) # Cell name 0 (XYZ)
buf.write(FOOTER)
return buf
def test_file_7() -> None:
buf = write_file_7(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cellnames) == 2
assert len(layout.cells) == 1
assert layout.cellnames[0].nstring.string == 'XYZ'
assert layout.cellnames[1].nstring.string == 'ABC'
assert layout.cells[0].name == 0

View file

@ -1,109 +0,0 @@
# mypy: disable-error-code="union-attr"
from typing import IO
from io import BytesIO
from .utils import HEADER, FOOTER
from ..basic import write_uint, write_sint, write_bstring, write_byte
from ..main import OasisLayout
def base_tests(layout: OasisLayout) -> None:
assert layout.version.string == '1.0'
assert layout.unit == 1000
assert layout.validation.checksum_type == 0
assert not layout.properties
assert not layout.propnames
assert not layout.xnames
assert not layout.textstrings
assert not layout.cellnames
assert not layout.layers
assert len(layout.cells) == 1
assert layout.cells[0].name.string == 'A'
assert not layout.cells[0].properties
def write_file_1(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0011_1011) # 00rX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, 150) # radius
write_sint(buf, -100) # geometry-x (absolute)
write_sint(buf, 200) # geometry-y (absolute)
write_uint(buf, 16) # XYRELATIVE record
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0000_1000) # 00rX_YRDL
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0010_1000) # 00rX_YRDL
write_uint(buf, 0) # radius
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0010_1000) # 00rX_YRDL
write_uint(buf, 1) # radius
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0010_1000) # 00rX_YRDL
write_uint(buf, 6) # radius
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0010_1000) # 00rX_YRDL
write_uint(buf, 20) # radius
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0010_1100) # 00rX_YRDL
write_uint(buf, 100) # radius
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 1) # repetition (3x4 matrix)
write_uint(buf, 1) # (repetition) x-dimension
write_uint(buf, 2) # (repetition) y-dimension
write_uint(buf, 400) # (repetition) x-spacing
write_uint(buf, 300) # (repetition) y-spacing
buf.write(FOOTER)
return buf
def test_file_1() -> None:
buf = write_file_1(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
geometry = layout.cells[0].geometry
assert len(geometry) == 7
for ii, gg in enumerate(geometry):
msg = f'Failed on circle {ii}'
assert gg.x == -100, msg
assert gg.y == 200 + 400 * ii, msg
assert gg.layer == 1, msg
assert gg.datatype == 2, msg
assert not gg.properties, msg
assert gg.radius == [150, 150, 0, 1, 6, 20, 100][ii], msg
if ii != 6:
assert gg.repetition is None, msg
assert geometry[6].repetition.a_count == 3, msg
assert geometry[6].repetition.b_count == 4, msg
assert geometry[6].repetition.a_vector == [400, 0], msg
assert geometry[6].repetition.b_vector == [0, 300], msg

View file

@ -1,239 +0,0 @@
# mypy: disable-error-code="union-attr"
from typing import IO
from io import BytesIO
from .utils import HEADER, FOOTER
from ..basic import write_uint, write_sint, write_bstring, write_byte
from ..main import OasisLayout
def base_tests(layout: OasisLayout) -> None:
assert layout.version.string == '1.0'
assert layout.unit == 1000
assert layout.validation.checksum_type == 0
assert not layout.properties
assert not layout.propnames
assert not layout.xnames
assert not layout.textstrings
assert not layout.cellnames
assert not layout.layers
def write_file_1(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b1111_1011) # TWHX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, 24) # ctrapezoid type
write_uint(buf, 100) # width
write_uint(buf, 200) # height
write_sint(buf, -100) # geometry-x (absolute)
write_sint(buf, 200) # geometry-y (absolute)
write_uint(buf, 16) # XYRELATIVE record
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b0000_1000) # TWHX_YRDL
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0000_0011) # SWHX_YRDL
write_uint(buf, 2) # layer
write_uint(buf, 3) # datatype
h = [250, 100]
v = [100, 250]
wh = [h] * 8 + [v] * 8 + [h] * 6 + [v] * 2 + [h] * 2
wh_en = ([0b11] * 16
+ [0b10] * 4
+ [0b01] * 2
+ [0b10] * 2
+ [0b11, 0b10]
)
for t, (x, x_en) in enumerate(zip(wh, wh_en, strict=True)):
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b1000_1011 | (x_en << 5)) # TWHX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, t) # ctrapezoid type
if x_en & 0b10:
write_uint(buf, x[0]) # width
if x_en & 0b01:
write_uint(buf, x[1]) # height
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0000_0011) # SWHX_YRDL
write_uint(buf, 2) # layer
write_uint(buf, 3) # datatype
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b0000_1100) # TWHX_YRDL
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 1) # repetition (3x4 matrix)
write_uint(buf, 1) # (repetition) x-dimension
write_uint(buf, 2) # (repetition) y-dimension
write_uint(buf, 400) # (repetition) x-spacing
write_uint(buf, 300) # (repetition) y-spacing
buf.write(FOOTER)
return buf
def test_file_1() -> None:
buf = write_file_1(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cells) == 1
assert layout.cells[0].name.string == 'A'
assert not layout.cells[0].properties
geometry = layout.cells[0].geometry
assert len(geometry) == 3 + 26 * 2 + 1
for ii, gg in enumerate(geometry):
msg = f'Failed on shape {ii}'
assert gg.x == -100, msg
assert gg.y == 200 + 400 * ((ii + 1) // 2), msg
if ii < 2 or (3 <= ii < 55 and ii % 2 == 1):
assert gg.layer == 1, msg
assert gg.datatype == 2, msg
else:
assert gg.layer == 2, msg
assert gg.datatype == 3, msg
if ii < 3:
assert gg.width == 100, msg
assert gg.height == 200, msg
assert not gg.properties, msg
if 3 <= ii < 55:
ct_type = (ii - 3) // 2
is_ctrapz = ii % 2 == 1
if is_ctrapz:
assert gg.ctrapezoid_type == ct_type, msg
if ct_type in range(16, 20):
assert gg.height == [250, None][is_ctrapz], msg
elif ct_type in (20, 21):
assert gg.width == [250, None][is_ctrapz], msg
elif ct_type in range(22, 24) or ct_type == 25:
assert gg.height == [100, None][is_ctrapz], msg
elif ct_type < 8 or 16 <= ct_type < 25 or ct_type >= 26:
assert gg.width == 250, msg
assert gg.height == 100, msg
else:
assert gg.width == 100, msg
assert gg.height == 250, msg
elif ii < 3 and ii % 2:
assert gg.ctrapezoid_type == 24, msg
elif ii == 55:
assert gg.ctrapezoid_type == 25, msg
assert geometry[55].repetition.a_count == 3
assert geometry[55].repetition.b_count == 4
assert geometry[55].repetition.a_vector == [400, 0]
assert geometry[55].repetition.b_vector == [0, 300]
def write_file_2(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
# Shouldn't access (undefined) height modal, despite not having a height.
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b1101_1011) # TWHX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, 16) # ctrapezoid type
write_uint(buf, 200) # width
write_sint(buf, -100) # geometry-x (absolute)
write_sint(buf, 200) # geometry-y (absolute)
write_uint(buf, 16) # XYRELATIVE record
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b0000_1000) # TWHX_YRDL
write_sint(buf, 400) # geometry-y (relative)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'B') # Cell name
# Shouldn't access (undefined) width modal, despite not having a width.
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b1011_1011) # TWHX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, 20) # ctrapezoid type
write_uint(buf, 200) # height
write_sint(buf, -100) # geometry-x (absolute)
write_sint(buf, 200) # geometry-y (absolute)
write_uint(buf, 16) # XYRELATIVE record
write_uint(buf, 26) # CTRAPEZOID record
write_byte(buf, 0b0000_1000) # TWHX_YRDL
write_sint(buf, 400) # geometry-y (relative)
buf.write(FOOTER)
return buf
def test_file_2() -> None:
buf = write_file_2(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cells) == 2
assert layout.cells[0].name.string == 'A'
assert layout.cells[1].name.string == 'B'
assert not layout.cells[0].properties
assert not layout.cells[1].properties
for ii, cc in enumerate(layout.cells):
for jj, gg in enumerate(cc.geometry):
msg = f'Fail in cell {ii}, ctrapezoid {jj}'
assert not gg.properties, msg
assert gg.layer == 1, msg
assert gg.datatype == 2, msg
assert gg.x == -100, msg
geometry = layout.cells[0].geometry
assert geometry[0].width == 200
assert geometry[1].width == 200
assert geometry[0].ctrapezoid_type == 16
assert geometry[1].ctrapezoid_type == 16
assert geometry[0].y == 200
assert geometry[1].y == 600
geometry = layout.cells[1].geometry
assert geometry[0].height == 200
assert geometry[1].height == 200
assert geometry[0].ctrapezoid_type == 20
assert geometry[1].ctrapezoid_type == 20
assert geometry[0].y == 200
assert geometry[1].y == 600

View file

@ -1,179 +0,0 @@
from typing import IO
from io import BytesIO
import struct
from .utils import MAGIC_BYTES, FOOTER
from ..basic import write_uint, write_bstring
from ..main import OasisLayout
def base_tests(layout: OasisLayout) -> None:
assert layout.version.string == '1.0'
assert layout.validation.checksum_type == 0
assert not layout.properties
assert not layout.cells
assert not layout.cellnames
assert not layout.propnames
assert not layout.xnames
assert not layout.textstrings
assert not layout.propstrings
assert not layout.layers
def write_file_1(buf: IO[bytes]) -> IO[bytes]:
"""
File contains one PAD record.
1000 units/micron
Offset table inside START.
"""
buf.write(MAGIC_BYTES)
write_uint(buf, 1) # START record
write_bstring(buf, b'1.0') # version
write_uint(buf, 0) # dbu real type: uint
write_uint(buf, 1000) # dbu value: 1000 per micron
write_uint(buf, 0) # offset table is present here
for _ in range(6):
write_uint(buf, 0) # offset table (0: not strict)
write_uint(buf, 0) # offset table (0: no entry present)
write_uint(buf, 0) # PAD record
buf.write(FOOTER)
return buf
def test_file_1() -> None:
buf = write_file_1(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert layout.unit == 1000
def write_file_2(buf: IO[bytes]) -> IO[bytes]:
"""
File contains no records.
1/2 unit/micron
Offset table inside START.
"""
buf.write(MAGIC_BYTES)
write_uint(buf, 1) # START record
write_bstring(buf, b'1.0') # version
write_uint(buf, 2) # dbu real type: fraction 1/x
write_uint(buf, 2) # dbu value: 1/2 per micron
write_uint(buf, 0) # offset table is present here
for _ in range(6):
write_uint(buf, 0) # offset table (0: not strict)
write_uint(buf, 0) # offset table (0: no entry present)
buf.write(FOOTER)
return buf
def test_file_2() -> None:
buf = write_file_2(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert layout.unit == 0.5
def write_file_3(buf: IO[bytes]) -> IO[bytes]:
"""
File contains no records.
10/4 unit/micron
Offset table inside START.
"""
buf.write(MAGIC_BYTES)
write_uint(buf, 1) # START record
write_bstring(buf, b'1.0') # version
write_uint(buf, 4) # dbu real type: fraction a/b
write_uint(buf, 10) # dbu value a
write_uint(buf, 4) # dbu value b: 10/4 per micron
write_uint(buf, 0) # offset table is present here
for _ in range(6):
write_uint(buf, 0) # offset table (0: not strict)
write_uint(buf, 0) # offset table (0: no entry present)
buf.write(FOOTER)
return buf
def test_file_3() -> None:
buf = write_file_3(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert layout.unit == 10 / 4
def write_file_4(buf: IO[bytes]) -> IO[bytes]:
"""
File contains no records.
12.5 unit/micron (float32)
Offset table inside START.
"""
buf.write(MAGIC_BYTES)
write_uint(buf, 1) # START record
write_bstring(buf, b'1.0') # version
write_uint(buf, 6) # dbu real type: float32
buf.write(struct.pack("<f", 12.5)) # dbu value: 12.5
write_uint(buf, 0) # offset table is present here
for _ in range(6):
write_uint(buf, 0) # offset table (0: not strict)
write_uint(buf, 0) # offset table (0: no entry present)
buf.write(FOOTER)
return buf
def test_file_4() -> None:
buf = write_file_4(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert layout.unit == 12.5
def write_file_5(buf: IO[bytes]) -> IO[bytes]:
"""
File contains no records.
12.5 unit/micron (float64)
Offset table inside START.
"""
buf.write(MAGIC_BYTES)
write_uint(buf, 1) # START record
write_bstring(buf, b'1.0') # version
write_uint(buf, 7) # dbu real type: float64
buf.write(struct.pack("<d", 12.5)) # dbu value: 12.5
write_uint(buf, 0) # offset table is present here
for _ in range(6):
write_uint(buf, 0) # offset table (0: not strict)
write_uint(buf, 0) # offset table (0: no entry present)
buf.write(FOOTER)
return buf
def test_file_5() -> None:
buf = write_file_5(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert layout.unit == 12.5

View file

@ -1,335 +0,0 @@
from typing import IO
from collections.abc import Sequence
from io import BytesIO
from .utils import HEADER, FOOTER
from ..basic import write_uint, write_sint, write_bstring, write_byte
from ..main import OasisLayout
LAYERS = [
(1, 2), (1, 5), (1, 6), (1, 8),
(5, 2), (5, 5), (5, 6), (5, 8),
(6, 2), (6, 5), (6, 6), (6, 8),
(7, 2), (7, 5), (7, 6), (7, 8),
]
def base_tests(layout: OasisLayout) -> None:
assert layout.version.string == '1.0'
assert layout.unit == 1000
assert layout.validation.checksum_type == 0
assert not layout.properties
assert not layout.propnames
assert not layout.xnames
assert not layout.textstrings
assert not layout.cellnames
assert len(layout.cells) == 1
assert layout.cells[0].name.string == 'A' # type: ignore
assert not layout.cells[0].properties
def write_names_geom(buf: IO[bytes], short: bool = False) -> IO[bytes]:
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'AA') # name
write_uint(buf, 0) # all layers
write_uint(buf, 0) # all datatypes
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'L5A') # name
write_uint(buf, 1) # layer <=5
write_uint(buf, 5) # (...)
write_uint(buf, 0) # all datatypes
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'H5A') # name
write_uint(buf, 2) # layer >=5
write_uint(buf, 5) # (...)
write_uint(buf, 0) # all datatypes
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'E5A') # name
write_uint(buf, 3) # layer ==5
write_uint(buf, 5) # (...)
write_uint(buf, 0) # all datatypes
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'I56A') # name
write_uint(buf, 4) # layer 5 to 6
write_uint(buf, 5) # (...)
write_uint(buf, 6) # (...)
write_uint(buf, 0) # all datatypes
if short:
return buf
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'E5L4') # name
write_uint(buf, 3) # layer ==5
write_uint(buf, 5) # (...)
write_uint(buf, 1) # datatype <=4
write_uint(buf, 4) # (...)
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'E5H4') # name
write_uint(buf, 3) # layer ==5
write_uint(buf, 5) # (...)
write_uint(buf, 2) # datatype >=4
write_uint(buf, 4) # (...)
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'E5E4') # name
write_uint(buf, 3) # layer ==5
write_uint(buf, 5) # (...)
write_uint(buf, 3) # datatype ==4
write_uint(buf, 4) # (...)
write_uint(buf, 11) # LAYERNAME record (geometry)
write_bstring(buf, b'E5I47') # name
write_uint(buf, 3) # layer ==5
write_uint(buf, 5) # (...)
write_uint(buf, 4) # datatype 4 to 7
write_uint(buf, 4) # (...)
write_uint(buf, 7) # (...)
return buf
def write_names_text(buf: IO[bytes], prefix: bytes = b'') -> IO[bytes]:
write_uint(buf, 12) # LAYERNAME record (geometry)
write_bstring(buf, prefix + b'AA') # name
write_uint(buf, 0) # all layers
write_uint(buf, 0) # all datatypes
write_uint(buf, 12) # LAYERNAME record (geometry)
write_bstring(buf, prefix + b'L5A') # name
write_uint(buf, 1) # layer <=5
write_uint(buf, 5) # (...)
write_uint(buf, 0) # all datatypes
write_uint(buf, 12) # LAYERNAME record (geometry)
write_bstring(buf, prefix + b'H5A') # name
write_uint(buf, 2) # layer >=5
write_uint(buf, 5) # (...)
write_uint(buf, 0) # all datatypes
write_uint(buf, 12) # LAYERNAME record (geometry)
write_bstring(buf, prefix + b'E5A') # name
write_uint(buf, 3) # layer ==5
write_uint(buf, 5) # (...)
write_uint(buf, 0) # all datatypes
write_uint(buf, 12) # LAYERNAME record (geometry)
write_bstring(buf, prefix + b'I56A') # name
write_uint(buf, 4) # layer 5 to 6
write_uint(buf, 5) # (...)
write_uint(buf, 6) # (...)
write_uint(buf, 0) # all datatypes
return buf
def write_geom(buf: IO[bytes]) -> IO[bytes]:
for ll, dt in LAYERS:
write_uint(buf, 27) # CIRCLE record
write_byte(buf, 0b0011_1011) # 00rX_YRDL
write_uint(buf, ll) # layer
write_uint(buf, dt) # datatype
write_uint(buf, 150) # radius
write_sint(buf, ll * 1000) # geometry-x (absolute)
write_sint(buf, dt * 1000) # geometry-y (absolute)
return buf
def write_text(buf: IO[bytes]) -> IO[bytes]:
for ll, dt in LAYERS:
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0101_1011) # 0CNX_YRTL
write_bstring(buf, b'A') # text-string
write_uint(buf, ll) # text-layer
write_uint(buf, dt) # text-datatype
write_sint(buf, ll * 1000) # geometry-x
write_sint(buf, dt * 1000) # geometry-y
return buf
def name_test(layers: Sequence, is_textlayer: bool) -> None:
for ii, nn in enumerate(layers):
msg = f'Fail on layername {ii}'
assert is_textlayer == nn.is_textlayer, msg
assert nn.nstring.string == ['AA', 'L5A', 'H5A', 'E5A', 'I56A',
'E5L4', 'E5H4', 'E5E4', 'E5I47'][ii], msg
assert nn.layer_interval[0] == [None, None, 5, 5, 5, 5, 5, 5, 5][ii], msg
assert nn.layer_interval[1] == [None, 5, None, 5, 6, 5, 5, 5, 5][ii], msg
assert nn.type_interval[0] == [None, None, None, None, None, None, 4, 4, 4][ii], msg
assert nn.type_interval[1] == [None, None, None, None, None, 4, None, 4, 7][ii], msg
def name_test_text(layers: Sequence) -> None:
for ii, nn in enumerate(layers):
msg = f'Fail on layername {ii}'
assert nn.is_textlayer, msg
assert nn.nstring.string == ['TAA', 'TL5A', 'TH5A', 'TE5A', 'TI56A'][ii], msg
assert nn.layer_interval[0] == [None, None, 5, 5, 5][ii], msg
assert nn.layer_interval[1] == [None, 5, None, 5, 6][ii], msg
assert nn.type_interval[0] == [None, None, None, None, None][ii], msg
assert nn.type_interval[1] == [None, None, None, None, None][ii], msg
def elem_test_geom(geometry: Sequence) -> None:
for ii, gg in enumerate(geometry):
msg = f'Failed on circle ({ii})'
assert gg.x == 1000 * LAYERS[ii][0], msg
assert gg.y == 1000 * LAYERS[ii][1], msg
assert gg.radius == 150, msg
assert gg.layer == LAYERS[ii][0], msg
assert gg.datatype == LAYERS[ii][1], msg
assert gg.repetition is None, msg
assert not gg.properties, msg
def elem_test_text(geometry: Sequence) -> None:
for ii, gg in enumerate(geometry):
msg = f'Failed on text ({ii})'
assert gg.x == 1000 * LAYERS[ii][0], msg
assert gg.y == 1000 * LAYERS[ii][1], msg
assert gg.string.string == 'A', msg
assert gg.layer == LAYERS[ii][0], msg
assert gg.datatype == LAYERS[ii][1], msg
assert gg.repetition is None, msg
assert not gg.properties, msg
def write_file_1(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_names_geom(buf)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
write_geom(buf)
buf.write(FOOTER)
return buf
def test_file_1() -> None:
buf = write_file_1(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
geometry = layout.cells[0].geometry
assert len(geometry) == len(LAYERS)
elem_test_geom(geometry)
assert len(layout.layers) == 9
name_test(layout.layers, is_textlayer=False)
def write_file_2(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_names_text(buf)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
write_text(buf)
buf.write(FOOTER)
return buf
def test_file_2() -> None:
buf = write_file_2(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
geometry = layout.cells[0].geometry
assert len(geometry) == len(LAYERS)
elem_test_text(geometry)
assert len(layout.layers) == 5
name_test(layout.layers, is_textlayer=True)
def write_file_3(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_names_text(buf, prefix=b'T')
write_names_geom(buf, short=True)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
write_text(buf)
write_geom(buf)
buf.write(FOOTER)
return buf
def write_file_4(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
write_text(buf)
write_geom(buf)
write_names_text(buf, prefix=b'T')
write_names_geom(buf, short=True)
buf.write(FOOTER)
return buf
def test_file_3() -> None:
buf = write_file_3(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
geometry = layout.cells[0].geometry
assert len(geometry) == 2 * len(LAYERS)
elem_test_text(geometry[:len(LAYERS)])
elem_test_geom(geometry[len(LAYERS):])
assert len(layout.layers) == 2 * 5
name_test_text(layout.layers[:5])
name_test(layout.layers[5:], is_textlayer=False)
def test_file_4() -> None:
buf = write_file_4(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
geometry = layout.cells[0].geometry
assert len(geometry) == 2 * len(LAYERS)
elem_test_text(geometry[:len(LAYERS)])
elem_test_geom(geometry[len(LAYERS):])
assert len(layout.layers) == 2 * 5
name_test_text(layout.layers[:5])
name_test(layout.layers[5:], is_textlayer=False)

View file

@ -1,252 +0,0 @@
# mypy: disable-error-code="union-attr"
from typing import IO
from io import BytesIO
from .utils import HEADER, FOOTER
from ..basic import write_uint, write_sint, write_bstring, write_byte
from ..main import OasisLayout
def base_tests(layout: OasisLayout) -> None:
assert layout.version.string == '1.0'
assert layout.unit == 1000
assert layout.validation.checksum_type == 0
assert not layout.properties
assert not layout.propnames
assert not layout.xnames
assert not layout.textstrings
assert not layout.cellnames
assert not layout.layers
def write_file_1(buf: IO[bytes]) -> IO[bytes]:
"""
"""
buf.write(HEADER)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'A') # Cell name
# RECTANGLE 0
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0110_0011) # SWHX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, 10) # width
write_uint(buf, 20) # height
# TEXT 1
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0100_0011) # 0CNX_YRTL
write_bstring(buf, b'A') # text string
write_uint(buf, 2) # layer
write_uint(buf, 1) # datatype
# RECTANGLE 2
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0001_1000) # SWHX_YRDL
write_sint(buf, 100) # geometry-x (absolute)
write_sint(buf, -100) # geometry-y (absolute)
# TEXT 3
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0001_1000) # 0CNX_YRTL
write_sint(buf, 100) # text-x (absolute)
write_sint(buf, -100) # text-y (absolute)
# RECTANGLE 4
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0001_1000) # SWHX_YRDL
write_sint(buf, 200) # geometry-x (absolute)
write_sint(buf, -200) # geometry-y (absolute)
# TEXT 5
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0001_1000) # 0CNX_YRTL
write_sint(buf, 200) # text-x (absolute)
write_sint(buf, -200) # text-y (absolute)
write_uint(buf, 16) # XYRELATIVE record
# RECTANGLE 6
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0001_1000) # SWHX_YRDL
write_sint(buf, 100) # geometry-x (relative)
write_sint(buf, -100) # geometry-y (relative)
# TEXT 7
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0001_1000) # 0CNX_YRTL
write_sint(buf, 100) # text-x (relative)
write_sint(buf, -100) # text-y (relative)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'B') # Cell name
# RECTANGLE 0
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0110_0011) # SWHX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, 20) # width
write_uint(buf, 10) # height
# TEXT 1
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0100_0011) # 0CNX_YRTL
write_bstring(buf, b'B') # text string
write_uint(buf, 2) # layer
write_uint(buf, 1) # datatype
# RECTANGLE 2
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0001_1000) # SWHX_YRDL
write_sint(buf, 100) # geometry-x (absolute)
write_sint(buf, 100) # geometry-y (absolute)
# TEXT 3
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0001_1000) # 0CNX_YRTL
write_sint(buf, 100) # text-x (absolute)
write_sint(buf, 100) # text-y (absolute)
# RECTANGLE 4
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0001_1000) # SWHX_YRDL
write_sint(buf, 200) # geometry-x (absolute)
write_sint(buf, 200) # geometry-y (absolute)
# TEXT 5
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0001_1000) # 0CNX_YRTL
write_sint(buf, 200) # text-x (absolute)
write_sint(buf, 200) # text-y (absolute)
write_uint(buf, 16) # XYRELATIVE record
# RECTANGLE 6
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0001_1000) # SWHX_YRDL
write_sint(buf, 100) # geometry-x (relative)
write_sint(buf, 100) # geometry-y (relative)
# TEXT 7
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0001_1000) # 0CNX_YRTL
write_sint(buf, 100) # text-x (relative)
write_sint(buf, 100) # text-y (relative)
# PLACEMENT 0
write_uint(buf, 17) # PLACEMENT (simple)
write_byte(buf, 0b1000_0000) # CNXY_RAAF
write_bstring(buf, b'A') # Cell reference
# PLACEMENT 1
write_uint(buf, 17) # PLACEMENT (simple)
write_byte(buf, 0b0011_0000) # CNXY_RAAF
write_sint(buf, 50) # placement-x (relative)
write_sint(buf, 50) # placement-y (relative)
write_uint(buf, 14) # CELL record (explicit)
write_bstring(buf, b'TOP') # Cell name
# PLACEMENT 0
write_uint(buf, 17) # PLACEMENT (simple)
write_byte(buf, 0b1000_0000) # CNXY_RAAF
write_bstring(buf, b'B') # Cell reference
# RECTANGLE 0
write_uint(buf, 20) # RECTANGLE record
write_byte(buf, 0b0110_0011) # SWHX_YRDL
write_uint(buf, 1) # layer
write_uint(buf, 2) # datatype
write_uint(buf, 50) # width
write_uint(buf, 5) # height
# TEXT 1
write_uint(buf, 19) # TEXT record
write_byte(buf, 0b0100_0011) # 0CNX_YRTL
write_bstring(buf, b'TOP') # text string
write_uint(buf, 2) # layer
write_uint(buf, 1) # datatype
buf.write(FOOTER)
return buf
def test_file_1() -> None:
buf = write_file_1(BytesIO())
buf.seek(0)
layout = OasisLayout.read(buf)
base_tests(layout)
assert len(layout.cells) == 3
assert layout.cells[0].name.string == 'A'
assert layout.cells[1].name.string == 'B'
assert layout.cells[2].name.string == 'TOP'
assert not layout.cells[0].properties
assert not layout.cells[1].properties
assert not layout.cells[2].properties
geometry = layout.cells[0].geometry
assert len(geometry) == 8
for ii, gg in enumerate(geometry):
msg = f'Failed on geometry {ii} in cell A'
if ii % 2 == 0:
assert gg.width == 10, msg
assert gg.height == 20, msg
assert gg.layer == 1, msg
assert gg.datatype == 2, msg
else:
assert gg.string.string == 'A', msg
assert gg.layer == 2, msg
assert gg.datatype == 1, msg
assert not gg.properties, msg
assert gg.x == (ii // 2) * 100, msg
assert gg.y == (ii // 2) * -100, msg
geometry = layout.cells[1].geometry
assert len(geometry) == 8
for ii, gg in enumerate(geometry):
msg = f'Failed on geometry {ii} in cell B'
if ii % 2 == 0:
assert gg.width == 20, msg
assert gg.height == 10, msg
assert gg.layer == 1, msg
assert gg.datatype == 2, msg
else:
assert gg.string.string == 'B', msg
assert gg.layer == 2, msg
assert gg.datatype == 1, msg
assert not gg.properties, msg
assert gg.x == (ii // 2) * 100, msg
assert gg.y == (ii // 2) * 100, msg
assert layout.cells[1].placements[0].name.string == 'A'
assert layout.cells[1].placements[1].name.string == 'A'
assert layout.cells[1].placements[0].x == 0
assert layout.cells[1].placements[0].y == 0
assert layout.cells[1].placements[1].x == 50
assert layout.cells[1].placements[1].y == 50
assert layout.cells[2].placements[0].name.string == 'B'
assert layout.cells[2].placements[0].x == 0
assert layout.cells[2].placements[0].y == 0
assert layout.cells[2].geometry[0].layer == 1
assert layout.cells[2].geometry[0].datatype == 2
assert layout.cells[2].geometry[0].width == 50
assert layout.cells[2].geometry[0].height == 5
assert layout.cells[2].geometry[0].x == 0
assert layout.cells[2].geometry[0].y == 0
assert layout.cells[2].geometry[1].layer == 2
assert layout.cells[2].geometry[1].datatype == 1
assert layout.cells[2].geometry[1].string.string == 'TOP'
assert layout.cells[2].geometry[1].x == 0
assert layout.cells[2].geometry[1].y == 0

Some files were not shown because too many files have changed in this diff Show more