diff --git a/Cargo.lock b/Cargo.lock index fe21dcef..a07b0cb5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,9 +166,9 @@ checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" [[package]] name = "bytemuck" -version = "1.23.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "cassowary" @@ -471,9 +471,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "allocator-api2", "equivalent", @@ -1156,9 +1156,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.7" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" dependencies = [ "bitflags 2.9.0", "errno", @@ -1499,9 +1499,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.101" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -1564,13 +1564,13 @@ dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", - "rustix 1.0.7", + "rustix 1.0.5", "windows-sys 0.59.0", ] [[package]] name = "tengri" -version = "0.13.0" +version = "0.12.0" dependencies = [ "tengri_dsl", "tengri_input", @@ -1580,7 +1580,7 @@ dependencies = [ [[package]] name = "tengri_dsl" -version = "0.13.0" +version = "0.12.0" dependencies = [ "itertools 0.14.0", "konst", @@ -1589,21 +1589,21 @@ dependencies = [ [[package]] name = "tengri_input" -version = "0.13.0" +version = "0.12.0" dependencies = [ "tengri_dsl", ] [[package]] name = "tengri_output" -version = "0.13.0" +version = "0.12.0" dependencies = [ "tengri_dsl", ] [[package]] name = "tengri_tui" -version = "0.13.0" +version = "0.12.0" dependencies = [ "atomic_float", "better-panic", @@ -1661,9 +1661,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.22" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -1673,33 +1673,26 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.9" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.26" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "toml_write", "winnow", ] -[[package]] -name = "toml_write" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" - [[package]] name = "typewit" version = "1.11.0" @@ -1981,9 +1974,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.9" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3" +checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" dependencies = [ "memchr", ] @@ -1999,18 +1992,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", diff --git a/crates/app/src/api.rs b/crates/app/src/api.rs index a5e414da..08e4b5a0 100644 --- a/crates/app/src/api.rs +++ b/crates/app/src/api.rs @@ -8,24 +8,7 @@ macro_rules! cmd { ($cmd:expr) => {{ $cmd; None }}; } macro_rules! cmd_todo { ($msg:literal) => {{ println!($msg); None }}; } expose!([self: Tek] - ([bool] - (":mode-editor" self.is_editing()) - (":mode-clip" !self.is_editing() && self.selected.is_clip()) - (":mode-track" !self.is_editing() && self.selected.is_track()) - (":mode-scene" !self.is_editing() && self.selected.is_scene()) - (":mode-mix" !self.is_editing() && self.selected.is_mix()) - (":mode-pool-import" matches!( - self.pool.as_ref().map(|p|p.mode.as_ref()).flatten(), - Some(PoolMode::Import(..)))) - (":mode-pool-export" matches!( - self.pool.as_ref().map(|p|p.mode.as_ref()).flatten(), - Some(PoolMode::Export(..)))) - (":mode-pool-rename" matches!( - self.pool.as_ref().map(|p|p.mode.as_ref()).flatten(), - Some(PoolMode::Rename(..)))) - (":mode-pool-length" matches!( - self.pool.as_ref().map(|p|p.mode.as_ref()).flatten(), - Some(PoolMode::Length(..))))) + ([bool]) ([isize]) ([Color]) ([Arc>]) diff --git a/crates/app/src/config.rs b/crates/app/src/config.rs index 2875e0cc..f876371b 100644 --- a/crates/app/src/config.rs +++ b/crates/app/src/config.rs @@ -86,113 +86,76 @@ impl Configuration { } } - fn parse_keys (base: &impl AsRef, iter: Option>) + fn parse_keys (base: &impl AsRef, iter: Option) -> Usually>> { - if iter.is_none() { + if let Some(mut keys) = iter { + let mut map = InputMap::default(); + while let Some(token) = keys.next() { + match token.value { + Value::Exp(_, mut exp) => { + let next = exp.next(); + match next { + Some(Token { value: Value::Key(sym), .. }) => match sym { + "layer" => { + let next = exp.next(); + match next { + Some(Token { value: Value::Str(path), .. }) => { + map.add_layer(read_and_leak(path)?.into()); + }, + _ => return Err( + format!("(e4) unexpected non-string {next:?}").into() + ) + } + todo!() + }, + "layer-if" => { + let next = exp.next(); + match next { + Some(Token { value: Value::Sym(sym), .. }) => { + todo!() + }, + _ => return Err( + format!("(e4) unexpected non-symbol {next:?}").into() + ) + } + let next = exp.next(); + match next { + Some(Token { value: Value::Str(path), .. }) => { + todo!() + }, + _ => return Err( + format!("(e4) unexpected non-symbol {next:?}").into() + ) + } + todo!() + }, + _ => return Err( + format!("(e3) unexpected symbol {sym:?}").into() + ) + } + _ => return Err( + format!("(e2) unexpected exp {:?}", next.map(|x|x.value)).into() + ) + } + }, + t => return Err( + format!("(e1) unexpected token {token:?}").into() + ) + } + } + Ok(map) + } else { return Err(format!("missing keys definition").into()) } - let mut keys = iter.unwrap(); - let mut map = InputMap::default(); - while let Some(token) = keys.next() { - if let Value::Exp(_, mut exp) = token.value { - let next = exp.next(); - if let Some(Token { value: Value::Key(sym), .. }) = next { - match sym { - "layer" => { - let next = exp.next(); - if let Some(Token { value: Value::Str(path), .. }) = next { - let path = base.as_ref().parent().unwrap().join(unquote(path)); - if !std::fs::exists(&path)? { - return Err(format!("(e5) not found: {path:?}").into()) - } - map.add_layer(read_and_leak(path)?.into()); - } else { - return Err(format!("(e4) unexpected non-string {next:?}").into()) - } - }, - - "layer-if" => { - let mut cond = None; - - let next = exp.next(); - if let Some(Token { value: Value::Sym(sym), .. }) = next { - cond = Some(leak(sym)); - } else { - return Err(format!("(e4) unexpected non-symbol {next:?}").into()) - }; - - let next = exp.next(); - if let Some(Token { value: Value::Str(path), .. }) = next { - let path = base.as_ref().parent().unwrap().join(unquote(path)); - if !std::fs::exists(&path)? { - return Err(format!("(e5) not found: {path:?}").into()) - } - print!("{path:?}..."); - let keys = read_and_leak(path)?.into(); - println!("ok"); - let cond = cond.unwrap(); - map.add_layer_if( - Box::new(|state|{ - Context::get(state, &Value::Sym(cond)).unwrap_or(false) - }), - keys - ); - } else { - return Err(format!("(e4) unexpected non-symbol {next:?}").into()) - } - }, - - _ => return Err(format!("(e3) unexpected symbol {sym:?}").into()) - } - } else { - return Err(format!("(e2) unexpected exp {:?}", next.map(|x|x.value)).into()) - } - } else { - return Err(format!("(e1) unexpected token {token:?}").into()) - } - } - Ok(map) } } fn read_and_leak (path: impl AsRef) -> Usually<&'static str> { - Ok(leak(String::from_utf8(std::fs::read(path.as_ref())?)?)) + let path = path.as_ref(); + let text = String::from_utf8(std::fs::read(path)?)?; + let text: Box = text.into(); + let text: &'static str = Box::leak(text); + Ok(text) } - -fn leak (x: impl AsRef) -> &'static str { - Box::leak(x.as_ref().into()) -} - -fn unquote (x: &str) -> &str { - let mut chars = x.chars(); - chars.next(); - //chars.next_back(); - chars.as_str() -} - -macro_rules! default_config { ($path:literal) => { ($path, include_str!($path)) }; } -pub const DEFAULT_CONFIGS: &'static [(&'static str, &'static str)] = &[ - default_config!("../../../config/config_arranger.edn"), - default_config!("../../../config/config_groovebox.edn"), - default_config!("../../../config/config_sampler.edn"), - default_config!("../../../config/config_sequencer.edn"), - default_config!("../../../config/config_transport.edn"), - - default_config!("../../../config/keys_arranger.edn"), - default_config!("../../../config/keys_clip.edn"), - default_config!("../../../config/keys_clip_length.edn"), - default_config!("../../../config/keys_clip_rename.edn"), - default_config!("../../../config/keys_clock.edn"), - default_config!("../../../config/keys_editor.edn"), - default_config!("../../../config/keys_global.edn"), - default_config!("../../../config/keys_groovebox.edn"), - default_config!("../../../config/keys_mix.edn"), - default_config!("../../../config/keys_pool.edn"), - default_config!("../../../config/keys_pool_file.edn"), - default_config!("../../../config/keys_sampler.edn"), - default_config!("../../../config/keys_scene.edn"), - default_config!("../../../config/keys_sequencer.edn"), - default_config!("../../../config/keys_track.edn"), -]; diff --git a/crates/app/src/lib.rs b/crates/app/src/lib.rs index fef8fb56..ef4e3a64 100644 --- a/crates/app/src/lib.rs +++ b/crates/app/src/lib.rs @@ -15,7 +15,6 @@ #![feature(trait_alias)] #![feature(type_changing_struct_update)] #![feature(let_chains)] -#![feature(closure_lifetime_binder)] /// Standard result type. pub type Usually = std::result::Result>; /// Standard optional result type. diff --git a/deps/tengri b/deps/tengri index 21f7f6b3..0d4ba4a5 160000 --- a/deps/tengri +++ b/deps/tengri @@ -1 +1 @@ -Subproject commit 21f7f6b38afc966b7b45af442935d48c8c5067d3 +Subproject commit 0d4ba4a54ef0528a0a45b58e21a1e4aa7ed5eaf9