diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-11-10 09:12:35 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-11-10 09:12:35 +0100 |
| commit | 0b0663e0c9dc664f35ffead3b395ffd2009fd98c (patch) | |
| tree | f9e10437ebe7e13e527ce1a6a2b456c105bcc5c0 /crates/gipfel-core/src/profile.rs | |
| parent | 02546370ec4458eef59a8f636fe05b57961d56ab (diff) | |
| parent | 31a47fc4393856a0a0380b2fdcf79f9dac72ad56 (diff) | |
Merge branch 'wasm-spike'
# Conflicts:
# crates/gipfel-core/src/metadata.rs
Diffstat (limited to 'crates/gipfel-core/src/profile.rs')
| -rw-r--r-- | crates/gipfel-core/src/profile.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/gipfel-core/src/profile.rs b/crates/gipfel-core/src/profile.rs index e8bda68..2eff8f6 100644 --- a/crates/gipfel-core/src/profile.rs +++ b/crates/gipfel-core/src/profile.rs @@ -112,7 +112,19 @@ pub fn sanitize_name(name: &str) -> Result<(), Error> { Ok(()) } -/// Parse a prefs file into ordered (name, profile) pairs. Tolerant: +/// Parse a prefs file into ordered (name, profile) pairs. Tolerant: comments +/// (`;`), the root group `[.]`, blank lines and unknown keys are ignored; +/// values are parsed with Rust's `f64` (superset of C `%g`). +pub fn parse_prefs(text: &str) -> Vec<(String, Profile)> { + parse(text) +} + +/// Serialize profiles in FLTK's layout so the C version can read our file. +pub fn serialize_prefs(profiles: &[(String, Profile)]) -> String { + serialize(profiles) +} + +/// Parse a prefs file into ordered (name, profile) pairs. Tolerant: /// comments (`;`), the root group `[.]`, blank lines and unknown keys are /// ignored; values are parsed with Rust's `f64` (superset of C `%g`). fn parse(text: &str) -> Vec<(String, Profile)> { |
