Skip to content

Commit

Permalink
expose the TILSectionHeader used in id0 translations
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran committed Jan 14, 2025
1 parent c449322 commit 10c421a
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/til.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,24 +229,7 @@ impl Type {
// TODO it's unclear what header information id0 types use to parse tils
// maybe it just use the til sector header, or more likelly it's from
// IDBParam in the `Root Node`
let header = section::TILSectionHeader {
format: 12,
flags: section::TILSectionFlags(0),
description: IDBString::new(Vec::new()),
dependencies: Vec::new(),
size_enum: None,
size_int: 4.try_into().unwrap(),
size_bool: 1.try_into().unwrap(),
def_align: None,
size_long_double: None,
extended_sizeof_info: None,
cc: None,
cn: None,
type_ordinal_alias: None,
is_universal: true,
compiler_id: crate::id0::Compiler::Unknown,
cm: None,
};
let header = ephemeral_til_header();
let mut reader = data;
let type_raw = TypeRaw::read(&mut reader, &header)?;
match reader {
Expand Down Expand Up @@ -812,3 +795,24 @@ fn serialize_dt(value: u16) -> Result<Vec<u8>> {
result.push(hi as u8);
Ok(result)
}

pub fn ephemeral_til_header() -> TILSectionHeader {
section::TILSectionHeader {
format: 12,
flags: section::TILSectionFlags(0),
description: IDBString::new(Vec::new()),
dependencies: Vec::new(),
size_enum: None,
size_int: 4.try_into().unwrap(),
size_bool: 1.try_into().unwrap(),
def_align: None,
size_long_double: None,
extended_sizeof_info: None,
cc: None,
cn: None,
type_ordinal_alias: None,
is_universal: true,
compiler_id: crate::id0::Compiler::Unknown,
cm: None,
}
}

0 comments on commit 10c421a

Please sign in to comment.