2022-03-20 16:28:34 -07:00
|
|
|
///
|
|
|
|
|
/// Record type and tag definitions
|
|
|
|
|
///
|
2021-12-18 21:05:00 -08:00
|
|
|
|
2022-05-08 16:41:43 -07:00
|
|
|
use crate::record::{Record, Int2, Int4, Int2Array, Int4Array, Real8, Real8Pair, DateTimePair, BitArray, ASCII, Empty};
|
2021-12-18 21:05:00 -08:00
|
|
|
|
|
|
|
|
//use std::io::Write;
|
|
|
|
|
|
|
|
|
|
// record tags
|
|
|
|
|
pub const RTAG_HEADER: u16 = 0x0002;
|
|
|
|
|
pub const RTAG_BGNLIB: u16 = 0x0102;
|
|
|
|
|
pub const RTAG_LIBNAME: u16 = 0x0206;
|
|
|
|
|
pub const RTAG_UNITS: u16 = 0x0305; // (user_units_per_db_unit, db_units_per_meter)
|
|
|
|
|
pub const RTAG_ENDLIB: u16 = 0x0400;
|
|
|
|
|
pub const RTAG_BGNSTR: u16 = 0x0502;
|
|
|
|
|
pub const RTAG_STRNAME: u16 = 0x0606;
|
|
|
|
|
pub const RTAG_ENDSTR: u16 = 0x0700;
|
|
|
|
|
pub const RTAG_BOUNDARY: u16 = 0x0800;
|
|
|
|
|
pub const RTAG_PATH: u16 = 0x0900;
|
|
|
|
|
pub const RTAG_SREF: u16 = 0x0a00;
|
|
|
|
|
pub const RTAG_AREF: u16 = 0x0b00;
|
|
|
|
|
pub const RTAG_TEXT: u16 = 0x0c00;
|
|
|
|
|
pub const RTAG_LAYER: u16 = 0x0d02;
|
|
|
|
|
pub const RTAG_DATATYPE: u16 = 0x0e02;
|
|
|
|
|
pub const RTAG_WIDTH: u16 = 0x0f03;
|
|
|
|
|
pub const RTAG_XY: u16 = 0x1003;
|
|
|
|
|
pub const RTAG_ENDEL: u16 = 0x1100;
|
|
|
|
|
pub const RTAG_SNAME: u16 = 0x1206;
|
|
|
|
|
pub const RTAG_COLROW: u16 = 0x1302;
|
|
|
|
|
pub const RTAG_NODE: u16 = 0x1500;
|
|
|
|
|
pub const RTAG_TEXTTYPE: u16 = 0x1602;
|
|
|
|
|
pub const RTAG_PRESENTATION: u16 = 0x1701;
|
|
|
|
|
pub const RTAG_SPACING: u16 = 0x1802; // unused; not sure about 02
|
|
|
|
|
pub const RTAG_STRING: u16 = 0x1906;
|
|
|
|
|
pub const RTAG_STRANS: u16 = 0x1a01;
|
|
|
|
|
pub const RTAG_MAG: u16 = 0x1b05;
|
|
|
|
|
pub const RTAG_ANGLE: u16 = 0x1c05;
|
|
|
|
|
pub const RTAG_UINTEGER: u16 = 0x1d02; // unused; not sure about 02
|
|
|
|
|
pub const RTAG_USTRING: u16 = 0x1e06; // unused; not sure about 06
|
|
|
|
|
pub const RTAG_REFLIBS: u16 = 0x1f06;
|
|
|
|
|
pub const RTAG_FONTS: u16 = 0x2006;
|
|
|
|
|
pub const RTAG_PATHTYPE: u16 = 0x2102;
|
|
|
|
|
pub const RTAG_GENERATIONS: u16 = 0x2202;
|
|
|
|
|
pub const RTAG_ATTRTABLE: u16 = 0x2306;
|
|
|
|
|
pub const RTAG_STYPTABLE: u16 = 0x2406; // unused; not sure about 06
|
|
|
|
|
pub const RTAG_STRTYPE: u16 = 0x2502; // unused
|
|
|
|
|
pub const RTAG_ELFLAGS: u16 = 0x2601;
|
|
|
|
|
pub const RTAG_ELKEY: u16 = 0x2703; // unused
|
|
|
|
|
pub const RTAG_LINKTYPE: u16 = 0x2803; // unused
|
|
|
|
|
pub const RTAG_LINKKEYS: u16 = 0x2903; // unused
|
|
|
|
|
pub const RTAG_NODETYPE: u16 = 0x2a02;
|
|
|
|
|
pub const RTAG_PROPATTR: u16 = 0x2b02;
|
|
|
|
|
pub const RTAG_PROPVALUE: u16 = 0x2c06;
|
|
|
|
|
pub const RTAG_BOX: u16 = 0x2d00;
|
|
|
|
|
pub const RTAG_BOXTYPE: u16 = 0x2e02;
|
|
|
|
|
pub const RTAG_PLEX: u16 = 0x2f03;
|
|
|
|
|
pub const RTAG_BGNEXTN: u16 = 0x3003;
|
|
|
|
|
pub const RTAG_ENDEXTN: u16 = 0x3103;
|
|
|
|
|
pub const RTAG_TAPENUM: u16 = 0x3202;
|
|
|
|
|
pub const RTAG_TAPECODE: u16 = 0x3302;
|
|
|
|
|
pub const RTAG_STRCLASS: u16 = 0x3401;
|
|
|
|
|
pub const RTAG_RESERVED: u16 = 0x3503;
|
|
|
|
|
pub const RTAG_FORMAT: u16 = 0x3602;
|
|
|
|
|
pub const RTAG_MASK: u16 = 0x3706; // list of Layers and dtypes
|
|
|
|
|
pub const RTAG_ENDMASKS: u16 = 0x3800; // end of MASKS records
|
|
|
|
|
pub const RTAG_LIBDIRSIZE: u16 = 0x3902;
|
|
|
|
|
pub const RTAG_SRFNAME: u16 = 0x3a06;
|
|
|
|
|
pub const RTAG_LIBSECUR: u16 = 0x3b02;
|
|
|
|
|
pub const RTAG_BORDER: u16 = 0x3c00;
|
|
|
|
|
pub const RTAG_SOFTFENCE: u16 = 0x3d00;
|
|
|
|
|
pub const RTAG_HARDFENCE: u16 = 0x3f00;
|
|
|
|
|
pub const RTAG_SOFTWIRE: u16 = 0x3f00;
|
|
|
|
|
pub const RTAG_HARDWIRE: u16 = 0x4000;
|
|
|
|
|
pub const RTAG_PATHPORT: u16 = 0x4100;
|
|
|
|
|
pub const RTAG_NODEPORT: u16 = 0x4200;
|
|
|
|
|
pub const RTAG_USERCONSTRAINT: u16 = 0x4300;
|
|
|
|
|
pub const RTAG_SPACERERROR: u16 = 0x4400;
|
|
|
|
|
pub const RTAG_CONTACT: u16 = 0x4500;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// data types
|
|
|
|
|
pub const DATA_TYPE_NONE: u16 = 0x00;
|
|
|
|
|
pub const DATA_TYPE_BIT: u16 = 0x01;
|
|
|
|
|
pub const DATA_TYPE_INT16: u16 = 0x02;
|
|
|
|
|
pub const DATA_TYPE_INT32: u16 = 0x03;
|
|
|
|
|
pub const DATA_TYPE_REAL32: u16 = 0x04;
|
|
|
|
|
pub const DATA_TYPE_REAL64: u16 = 0x05;
|
|
|
|
|
pub const DATA_TYPE_STR: u16 = 0x06;
|
|
|
|
|
|
|
|
|
|
pub const MAX_DATA_SIZE: usize = 8;
|
|
|
|
|
|
|
|
|
|
/// Returns the size of the given data type in bytes.
|
2022-03-20 16:28:34 -07:00
|
|
|
pub fn data_size(t: u16) -> Option<u16> {
|
2021-12-18 21:05:00 -08:00
|
|
|
match t {
|
|
|
|
|
x if x == DATA_TYPE_NONE => 0,
|
|
|
|
|
x if x == DATA_TYPE_BIT => 2,
|
|
|
|
|
x if x == DATA_TYPE_INT16 => 2,
|
|
|
|
|
x if x == DATA_TYPE_INT32 => 4,
|
|
|
|
|
x if x == DATA_TYPE_REAL32 => 4,
|
|
|
|
|
x if x == DATA_TYPE_REAL64 => 8,
|
|
|
|
|
_ => 0
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct HEADER;
|
|
|
|
|
impl Record<Int2> for HEADER {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_HEADER }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
2022-03-20 16:28:34 -07:00
|
|
|
//impl Record<Int2> for HEADER;
|
2021-12-18 21:05:00 -08:00
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct BGNLIB;
|
|
|
|
|
impl Record<DateTimePair> for BGNLIB {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_BGNLIB }
|
2025-04-12 12:06:36 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2 * 2 * 6) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct LIBNAME;
|
|
|
|
|
impl Record<ASCII> for LIBNAME {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_LIBNAME }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct UNITS;
|
|
|
|
|
impl Record<Real8Pair> for UNITS {
|
2021-12-18 21:05:00 -08:00
|
|
|
// (user_units_per_db_unit, db_units_per_meter)
|
|
|
|
|
fn tag() -> u16 { RTAG_UNITS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2 * 8) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ENDLIB;
|
|
|
|
|
impl Record<Empty> for ENDLIB {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ENDLIB }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct BGNSTR;
|
|
|
|
|
impl Record<DateTimePair> for BGNSTR {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_BGNSTR }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2 * 6) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct STRNAME;
|
|
|
|
|
impl Record<ASCII> for STRNAME {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_STRNAME }
|
2025-04-12 12:06:36 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ENDSTR;
|
|
|
|
|
impl Record<Empty> for ENDSTR {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ENDSTR }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct BOUNDARY;
|
|
|
|
|
impl Record<Empty> for BOUNDARY {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_BOUNDARY }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct PATH;
|
|
|
|
|
impl Record<Empty> for PATH {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_PATH }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct SREF;
|
|
|
|
|
impl Record<Empty> for SREF {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_SREF }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct AREF;
|
|
|
|
|
impl Record<Empty> for AREF {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_AREF }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct TEXT;
|
|
|
|
|
impl Record<Empty> for TEXT {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_TEXT }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct LAYER;
|
|
|
|
|
impl Record<Int2> for LAYER {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_LAYER }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct DATATYPE;
|
|
|
|
|
impl Record<Int2> for DATATYPE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_DATATYPE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct WIDTH;
|
|
|
|
|
impl Record<Int4> for WIDTH {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_WIDTH }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(4) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct XY;
|
|
|
|
|
impl Record<Int4Array> for XY {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_XY }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ENDEL;
|
|
|
|
|
impl Record<Empty> for ENDEL {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ENDEL }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct SNAME;
|
|
|
|
|
impl Record<ASCII> for SNAME {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_SNAME }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct COLROW;
|
|
|
|
|
impl Record<Int2Array> for COLROW {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_COLROW }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(4) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct NODE;
|
|
|
|
|
impl Record<Empty> for NODE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_NODE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct TEXTTYPE;
|
|
|
|
|
impl Record<Int2> for TEXTTYPE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_TEXTTYPE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct PRESENTATION;
|
|
|
|
|
impl Record<BitArray> for PRESENTATION {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_PRESENTATION }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct SPACING;
|
|
|
|
|
impl Record<Int2> for SPACING {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_SPACING }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct STRING;
|
|
|
|
|
impl Record<ASCII> for STRING {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_STRING }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct STRANS;
|
|
|
|
|
impl Record<BitArray> for STRANS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_STRANS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct MAG;
|
|
|
|
|
impl Record<Real8> for MAG {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_MAG }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(8) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ANGLE;
|
|
|
|
|
impl Record<Real8> for ANGLE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ANGLE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(8) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct UINTEGER;
|
|
|
|
|
impl Record<Int2> for UINTEGER {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_UINTEGER }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct USTRING;
|
|
|
|
|
impl Record<ASCII> for USTRING {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_USTRING }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct REFLIBS;
|
|
|
|
|
impl Record<ASCII> for REFLIBS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_REFLIBS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
impl REFLIBS {
|
2024-12-18 16:43:50 -08:00
|
|
|
pub fn check_size(actual_size: usize) -> Result<(), String> {
|
2021-12-18 21:05:00 -08:00
|
|
|
if actual_size % 44 == 0 {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
Err(format!("Expected record size divisible by 44, got {}", actual_size))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct FONTS;
|
|
|
|
|
impl Record<ASCII> for FONTS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_FONTS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
impl FONTS {
|
2024-12-18 16:43:50 -08:00
|
|
|
pub fn check_size(actual_size: usize) -> Result<(), String> {
|
2021-12-18 21:05:00 -08:00
|
|
|
if actual_size % 44 == 0 {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
Err(format!("Expected record size divisible by 44, got {}", actual_size))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct PATHTYPE;
|
|
|
|
|
impl Record<Int2> for PATHTYPE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_PATHTYPE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct GENERATIONS;
|
|
|
|
|
impl Record<Int2> for GENERATIONS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_GENERATIONS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ATTRTABLE;
|
|
|
|
|
impl Record<ASCII> for ATTRTABLE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ATTRTABLE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
impl ATTRTABLE {
|
2024-12-18 16:43:50 -08:00
|
|
|
pub fn check_size(actual_size: usize) -> Result<(), String> {
|
2021-12-18 21:05:00 -08:00
|
|
|
if actual_size % 44 == 0 {
|
|
|
|
|
Ok(())
|
|
|
|
|
} else {
|
|
|
|
|
Err(format!("Expected record size divisible by 44, got {}", actual_size))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct STYPTABLE;
|
|
|
|
|
impl Record<ASCII> for STYPTABLE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_STYPTABLE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct STRTYPE;
|
|
|
|
|
impl Record<Int2> for STRTYPE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_STRTYPE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ELFLAGS;
|
|
|
|
|
impl Record<BitArray> for ELFLAGS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ELFLAGS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ELKEY;
|
|
|
|
|
impl Record<Int2> for ELKEY {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ELKEY }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct LINKTYPE;
|
|
|
|
|
impl Record<Int2> for LINKTYPE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_LINKTYPE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct LINKKEYS;
|
|
|
|
|
impl Record<Int2> for LINKKEYS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_LINKKEYS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct NODETYPE;
|
|
|
|
|
impl Record<Int2> for NODETYPE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_NODETYPE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct PROPATTR;
|
|
|
|
|
impl Record<Int2> for PROPATTR {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_PROPATTR }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct PROPVALUE;
|
|
|
|
|
impl Record<ASCII> for PROPVALUE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_PROPVALUE }
|
2025-04-22 20:14:51 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct BOX;
|
|
|
|
|
impl Record<Empty> for BOX {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_BOX }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct BOXTYPE;
|
|
|
|
|
impl Record<Int2> for BOXTYPE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_BOXTYPE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct PLEX;
|
|
|
|
|
impl Record<Int4> for PLEX {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_PLEX }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(4) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct BGNEXTN;
|
|
|
|
|
impl Record<Int4> for BGNEXTN {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_BGNEXTN }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(4) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct ENDEXTN;
|
|
|
|
|
impl Record<Int4> for ENDEXTN {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ENDEXTN }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(4) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct TAPENUM;
|
|
|
|
|
impl Record<Int2> for TAPENUM {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_TAPENUM }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct TAPECODE;
|
|
|
|
|
impl Record<Int2Array> for TAPECODE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_TAPECODE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2 * 6) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct STRCLASS;
|
|
|
|
|
impl Record<Int2> for STRCLASS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_STRCLASS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct RESERVED;
|
|
|
|
|
impl Record<Int2Array> for RESERVED {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_RESERVED }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct FORMAT;
|
|
|
|
|
impl Record<Int2> for FORMAT {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_FORMAT }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct MASK;
|
|
|
|
|
impl Record<ASCII> for MASK {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_MASK }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
/// End of MASKS records
|
|
|
|
|
pub struct ENDMASKS;
|
|
|
|
|
impl Record<Empty> for ENDMASKS {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_ENDMASKS }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct LIBDIRSIZE;
|
|
|
|
|
impl Record<Int2> for LIBDIRSIZE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_LIBDIRSIZE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct SRFNAME;
|
|
|
|
|
impl Record<ASCII> for SRFNAME {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_SRFNAME }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { None }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct LIBSECUR;
|
|
|
|
|
impl Record<Int2> for LIBSECUR {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_LIBSECUR }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(2) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct BORDER;
|
|
|
|
|
impl Record<Empty> for BORDER {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_BORDER }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct SOFTFENCE;
|
|
|
|
|
impl Record<Empty> for SOFTFENCE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_SOFTFENCE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct HARDFENCE;
|
|
|
|
|
impl Record<Empty> for HARDFENCE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_HARDFENCE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct SOFTWIRE;
|
|
|
|
|
impl Record<Empty> for SOFTWIRE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_SOFTWIRE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct HARDWIRE;
|
|
|
|
|
impl Record<Empty> for HARDWIRE {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_HARDWIRE }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct PATHPORT;
|
|
|
|
|
impl Record<Empty> for PATHPORT {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_PATHPORT }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct NODEPORT;
|
|
|
|
|
impl Record<Empty> for NODEPORT {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_NODEPORT }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct USERCONSTRAINT;
|
|
|
|
|
impl Record<Empty> for USERCONSTRAINT {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_USERCONSTRAINT }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct SPACERERROR;
|
|
|
|
|
impl Record<Empty> for SPACERERROR {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_SPACERERROR }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|
|
|
|
|
|
2022-03-20 16:28:34 -07:00
|
|
|
pub struct CONTACT;
|
|
|
|
|
impl Record<Empty> for CONTACT {
|
2021-12-18 21:05:00 -08:00
|
|
|
fn tag() -> u16 { RTAG_CONTACT }
|
2022-03-20 16:28:34 -07:00
|
|
|
fn expected_size() -> Option<u16> { Some(0) }
|
2021-12-18 21:05:00 -08:00
|
|
|
}
|