Skip to content

Commit

Permalink
Model change/fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
uberFoo committed Feb 16, 2024
1 parent 9c909db commit 7bc6fdf
Show file tree
Hide file tree
Showing 15 changed files with 310 additions and 357 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sarzak"
version = "2.13.14"
version = "2.13.15"
edition = "2021"
authors = ["Keith T. Star <[email protected]>"]
categories = ["compilers", "memory-management"]
Expand Down
3 changes: 0 additions & 3 deletions src/v2/lu_dog/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub mod field_access_target;
pub mod field_expression;
pub mod float_literal;
pub mod for_loop;
pub mod format_bits;
pub mod format_bit;
pub mod format_string;
pub mod from;
Expand Down Expand Up @@ -165,8 +164,6 @@ pub use crate::v2::lu_dog::field_expression::FieldExpression;
pub use crate::v2::lu_dog::field_expression::FieldExpressionEnum;
pub use crate::v2::lu_dog::float_literal::FloatLiteral;
pub use crate::v2::lu_dog::for_loop::ForLoop;
pub use crate::v2::lu_dog::format_bits::FormatBits;
pub use crate::v2::lu_dog::format_bits::FormatBitsEnum;
pub use crate::v2::lu_dog::format_bit::FormatBit;
pub use crate::v2::lu_dog::format_bit::FormatBitEnum;
pub use crate::v2::lu_dog::format_string::FormatString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// {"magic":"","directive":{"Start":{"directive":"allow-editing","tag":"format_bits-struct-definition-file"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-use-statements"}}}
// {"magic":"","directive":{"Start":{"directive":"allow-editing","tag":"format_bit-struct-definition-file"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-use-statements"}}}
use std::cell::RefCell;
use std::rc::Rc;
use uuid::Uuid;
Expand All @@ -12,67 +12,65 @@ use serde::{Deserialize, Serialize};
use crate::v2::lu_dog::store::ObjectStore as LuDogStore;
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}

// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-enum-definition"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-hybrid-struct-definition"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-hybrid-struct-definition"}}}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct FormatBits {
pub subtype: FormatBitsEnum,
pub struct FormatBit {
pub subtype: FormatBitEnum,
pub id: Uuid,
/// R111: [`FormatBits`] 'comprise' [`FormatString`]
/// R111: [`FormatBit`] 'comprise' [`FormatString`]
pub format_string: Uuid,
/// R113: [`FormatBits`] 'next' [`FormatBits`]
/// R113: [`FormatBit`] 'next' [`FormatBit`]
pub next: Option<Uuid>,
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-hybrid-enum-definition"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-hybrid-enum-definition"}}}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum FormatBitsEnum {
pub enum FormatBitEnum {
ExpressionBit(Uuid),
StringBit(Uuid),
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-implementation"}}}
impl FormatBits {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-new-impl"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-new_expression_bit"}}}
/// Inter a new FormatBits in the store, and return it's `id`.
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-implementation"}}}
impl FormatBit {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-new_expression_bit"}}}
/// Inter a new FormatBit in the store, and return it's `id`.
pub fn new_expression_bit(
format_string: &Rc<RefCell<FormatString>>,
next: Option<&Rc<RefCell<FormatBits>>>,
next: Option<&Rc<RefCell<FormatBit>>>,
subtype: &Rc<RefCell<ExpressionBit>>,
store: &mut LuDogStore,
) -> Rc<RefCell<FormatBits>> {
) -> Rc<RefCell<FormatBit>> {
let id = Uuid::new_v4();
let new = Rc::new(RefCell::new(FormatBits {
let new = Rc::new(RefCell::new(FormatBit {
format_string: format_string.borrow().id,
next: next.map(|format_bits| format_bits.borrow().id),
subtype: FormatBitsEnum::ExpressionBit(subtype.borrow().id), // b
next: next.map(|format_bit| format_bit.borrow().id),
subtype: FormatBitEnum::ExpressionBit(subtype.borrow().id), // b
id,
}));
store.inter_format_bits(new.clone());
store.inter_format_bit(new.clone());
new
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-new_string_bit"}}}
/// Inter a new FormatBits in the store, and return it's `id`.
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-new_string_bit"}}}
/// Inter a new FormatBit in the store, and return it's `id`.
pub fn new_string_bit(
format_string: &Rc<RefCell<FormatString>>,
next: Option<&Rc<RefCell<FormatBits>>>,
next: Option<&Rc<RefCell<FormatBit>>>,
subtype: &Rc<RefCell<StringBit>>,
store: &mut LuDogStore,
) -> Rc<RefCell<FormatBits>> {
) -> Rc<RefCell<FormatBit>> {
let id = Uuid::new_v4();
let new = Rc::new(RefCell::new(FormatBits {
let new = Rc::new(RefCell::new(FormatBit {
format_string: format_string.borrow().id,
next: next.map(|format_bits| format_bits.borrow().id),
subtype: FormatBitsEnum::StringBit(subtype.borrow().id), // b
next: next.map(|format_bit| format_bit.borrow().id),
subtype: FormatBitEnum::StringBit(subtype.borrow().id), // b
id,
}));
store.inter_format_bits(new.clone());
store.inter_format_bit(new.clone());
new
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-forward-to-format_string"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-forward-to-format_string"}}}
/// Navigate to [`FormatString`] across R111(1-*)
pub fn r111_format_string<'a>(
&'a self,
Expand All @@ -81,29 +79,28 @@ impl FormatBits {
vec![store.exhume_format_string(&self.format_string).unwrap()]
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`FormatBits`] across R113(1-*c)
pub fn r113_format_bits<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<FormatBits>>> {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`FormatBit`] across R113(1-*c)
pub fn r113_format_bit<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<FormatBit>>> {
match self.next {
Some(ref next) => vec![store.exhume_format_bits(&next).unwrap()],
Some(ref next) => vec![store.exhume_format_bit(&next).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-get-id-impl"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-backward-one-bi-cond-to-format_bits"}}}
/// Navigate to [`FormatBits`] across R113(1c-1c)
pub fn r113c_format_bits<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<FormatBits>>> {
let format_bits = store
.iter_format_bits()
.find(|format_bits| format_bits.borrow().next == Some(self.id));
match format_bits {
Some(ref format_bits) => vec![format_bits.clone()],
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-backward-one-bi-cond-to-format_bit"}}}
/// Navigate to [`FormatBit`] across R113(1c-1c)
pub fn r113c_format_bit<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<FormatBit>>> {
let format_bit = store
.iter_format_bit()
.find(|format_bit| format_bit.borrow().next == Some(self.id));
match format_bit {
Some(ref format_bit) => vec![format_bit.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-backward-one-to-format_string"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-backward-one-to-format_string"}}}
/// Navigate to [`FormatString`] across R112(1-1)
pub fn r112_format_string<'a>(
&'a self,
Expand All @@ -112,8 +109,6 @@ impl FormatBits {
vec![store
.iter_format_string()
.find(|format_string| format_string.borrow().first_format_bit == Some(self.id))
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-backward-one-to-format_string"}}}
.unwrap()]
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
Expand Down
3 changes: 0 additions & 3 deletions src/v2/lu_dog_ndrwlock_vec/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub mod field_access_target;
pub mod field_expression;
pub mod float_literal;
pub mod for_loop;
pub mod format_bits;
pub mod format_bit;
pub mod format_string;
pub mod from;
Expand Down Expand Up @@ -165,8 +164,6 @@ pub use crate::v2::lu_dog_ndrwlock_vec::field_expression::FieldExpression;
pub use crate::v2::lu_dog_ndrwlock_vec::field_expression::FieldExpressionEnum;
pub use crate::v2::lu_dog_ndrwlock_vec::float_literal::FloatLiteral;
pub use crate::v2::lu_dog_ndrwlock_vec::for_loop::ForLoop;
pub use crate::v2::lu_dog_ndrwlock_vec::format_bits::FormatBits;
pub use crate::v2::lu_dog_ndrwlock_vec::format_bits::FormatBitsEnum;
pub use crate::v2::lu_dog_ndrwlock_vec::format_bit::FormatBit;
pub use crate::v2::lu_dog_ndrwlock_vec::format_bit::FormatBitEnum;
pub use crate::v2::lu_dog_ndrwlock_vec::format_string::FormatString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// {"magic":"","directive":{"Start":{"directive":"allow-editing","tag":"format_bits-struct-definition-file"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-use-statements"}}}
// {"magic":"","directive":{"Start":{"directive":"allow-editing","tag":"format_bit-struct-definition-file"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-use-statements"}}}
use no_deadlocks::RwLock;
use std::sync::Arc;
use uuid::Uuid;
Expand All @@ -12,63 +12,63 @@ use serde::{Deserialize, Serialize};
use crate::v2::lu_dog_ndrwlock_vec::store::ObjectStore as LuDogNdrwlockVecStore;
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}

// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-hybrid-struct-definition"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-hybrid-struct-definition"}}}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct FormatBits {
pub subtype: FormatBitsEnum,
pub struct FormatBit {
pub subtype: FormatBitEnum,
pub id: usize,
/// R111: [`FormatBits`] 'comprise' [`FormatString`]
/// R111: [`FormatBit`] 'comprise' [`FormatString`]
pub format_string: usize,
/// R113: [`FormatBits`] 'next' [`FormatBits`]
/// R113: [`FormatBit`] 'next' [`FormatBit`]
pub next: Option<usize>,
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-hybrid-enum-definition"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-hybrid-enum-definition"}}}
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum FormatBitsEnum {
pub enum FormatBitEnum {
ExpressionBit(usize),
StringBit(usize),
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-implementation"}}}
impl FormatBits {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-new_expression_bit"}}}
/// Inter a new FormatBits in the store, and return it's `id`.
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-implementation"}}}
impl FormatBit {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-new_expression_bit"}}}
/// Inter a new FormatBit in the store, and return it's `id`.
pub fn new_expression_bit(
format_string: &Arc<RwLock<FormatString>>,
next: Option<&Arc<RwLock<FormatBits>>>,
next: Option<&Arc<RwLock<FormatBit>>>,
subtype: &Arc<RwLock<ExpressionBit>>,
store: &mut LuDogNdrwlockVecStore,
) -> Arc<RwLock<FormatBits>> {
store.inter_format_bits(|id| {
Arc::new(RwLock::new(FormatBits {
) -> Arc<RwLock<FormatBit>> {
store.inter_format_bit(|id| {
Arc::new(RwLock::new(FormatBit {
format_string: format_string.read().unwrap().id,
next: next.map(|format_bits| format_bits.read().unwrap().id),
subtype: FormatBitsEnum::ExpressionBit(subtype.read().unwrap().id), // b
next: next.map(|format_bit| format_bit.read().unwrap().id),
subtype: FormatBitEnum::ExpressionBit(subtype.read().unwrap().id), // b
id,
}))
})
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-new_string_bit"}}}
/// Inter a new FormatBits in the store, and return it's `id`.
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-new_string_bit"}}}
/// Inter a new FormatBit in the store, and return it's `id`.
pub fn new_string_bit(
format_string: &Arc<RwLock<FormatString>>,
next: Option<&Arc<RwLock<FormatBits>>>,
next: Option<&Arc<RwLock<FormatBit>>>,
subtype: &Arc<RwLock<StringBit>>,
store: &mut LuDogNdrwlockVecStore,
) -> Arc<RwLock<FormatBits>> {
store.inter_format_bits(|id| {
Arc::new(RwLock::new(FormatBits {
) -> Arc<RwLock<FormatBit>> {
store.inter_format_bit(|id| {
Arc::new(RwLock::new(FormatBit {
format_string: format_string.read().unwrap().id,
next: next.map(|format_bits| format_bits.read().unwrap().id),
subtype: FormatBitsEnum::StringBit(subtype.read().unwrap().id), // b
next: next.map(|format_bit| format_bit.read().unwrap().id),
subtype: FormatBitEnum::StringBit(subtype.read().unwrap().id), // b
id,
}))
})
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-forward-to-format_string"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-forward-to-format_string"}}}
/// Navigate to [`FormatString`] across R111(1-*)
pub fn r111_format_string<'a>(
&'a self,
Expand All @@ -77,34 +77,34 @@ impl FormatBits {
vec![store.exhume_format_string(&self.format_string).unwrap()]
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`FormatBits`] across R113(1-*c)
pub fn r113_format_bits<'a>(
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-forward-cond-to-next"}}}
/// Navigate to [`FormatBit`] across R113(1-*c)
pub fn r113_format_bit<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<FormatBits>>> {
) -> Vec<Arc<RwLock<FormatBit>>> {
match self.next {
Some(ref next) => vec![store.exhume_format_bits(&next).unwrap()],
Some(ref next) => vec![store.exhume_format_bit(&next).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-backward-one-bi-cond-to-format_bits"}}}
/// Navigate to [`FormatBits`] across R113(1c-1c)
pub fn r113c_format_bits<'a>(
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-backward-one-bi-cond-to-format_bit"}}}
/// Navigate to [`FormatBit`] across R113(1c-1c)
pub fn r113c_format_bit<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<FormatBits>>> {
let format_bits = store
.iter_format_bits()
.find(|format_bits| format_bits.read().unwrap().next == Some(self.id));
match format_bits {
Some(ref format_bits) => vec![format_bits.clone()],
) -> Vec<Arc<RwLock<FormatBit>>> {
let format_bit = store
.iter_format_bit()
.find(|format_bit| format_bit.read().unwrap().next == Some(self.id));
match format_bit {
Some(ref format_bit) => vec![format_bit.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-backward-one-to-format_string"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-struct-impl-nav-backward-one-to-format_string"}}}
/// Navigate to [`FormatString`] across R112(1-1)
pub fn r112_format_string<'a>(
&'a self,
Expand All @@ -116,12 +116,10 @@ impl FormatBits {
.unwrap()]
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-struct-impl-nav-backward-one-to-format_string"}}}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bits-implementation"}}}
impl PartialEq for FormatBits {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"format_bit-implementation"}}}
impl PartialEq for FormatBit {
fn eq(&self, other: &Self) -> bool {
self.subtype == other.subtype
&& self.format_string == other.format_string
Expand Down
3 changes: 0 additions & 3 deletions src/v2/lu_dog_pl_vec/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub mod field_access_target;
pub mod field_expression;
pub mod float_literal;
pub mod for_loop;
pub mod format_bits;
pub mod format_bit;
pub mod format_string;
pub mod from;
Expand Down Expand Up @@ -165,8 +164,6 @@ pub use crate::v2::lu_dog_pl_vec::field_expression::FieldExpression;
pub use crate::v2::lu_dog_pl_vec::field_expression::FieldExpressionEnum;
pub use crate::v2::lu_dog_pl_vec::float_literal::FloatLiteral;
pub use crate::v2::lu_dog_pl_vec::for_loop::ForLoop;
pub use crate::v2::lu_dog_pl_vec::format_bits::FormatBits;
pub use crate::v2::lu_dog_pl_vec::format_bits::FormatBitsEnum;
pub use crate::v2::lu_dog_pl_vec::format_bit::FormatBit;
pub use crate::v2::lu_dog_pl_vec::format_bit::FormatBitEnum;
pub use crate::v2::lu_dog_pl_vec::format_string::FormatString;
Expand Down
Loading

0 comments on commit 7bc6fdf

Please sign in to comment.