Added: Support for Array Ordering

This commit is contained in:
sewer56 2023-12-07 15:38:45 +00:00
parent d142c9d6ba
commit 22c9f8f5c5

View File

@ -568,6 +568,13 @@ pub struct ArrayDimension {
pub size: Option<NonZeroU32>, pub size: Option<NonZeroU32>,
} }
#[derive(Debug, Eq, PartialEq, Copy, Clone, IntoPrimitive, TryFromPrimitive)]
#[repr(u16)]
pub enum ArrayOrdering {
RowMajor = 0, // ORD_row_major
ColMajor = 1, // ORD_col_major
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ArrayType { pub struct ArrayType {
pub element_type: Box<Type>, pub element_type: Box<Type>,
@ -1648,6 +1655,17 @@ fn process_array_tag(tags: &TagMap, tag: &Tag) -> Result<ArrayType> {
format!("Failed to process SubscrData for tag: {:?}", tag) format!("Failed to process SubscrData for tag: {:?}", tag)
})?) })?)
} }
(AttributeKind::Ordering, val) => {
match val {
AttributeValue::Data2(d2) => {
let order = ArrayOrdering::try_from_primitive(*d2)?;
if order == ArrayOrdering::ColMajor {
log::warn!("Column Major Ordering in Tag {}, Cannot guarantee array will be correct if original source is in different programming language.", tag.key);
}
}
_ => bail!("Unhandled ArrayType attribute {:?}", attr)
}
}
_ => { _ => {
bail!("Unhandled ArrayType attribute {:?}", attr) bail!("Unhandled ArrayType attribute {:?}", attr)
} }