diff options
| author | tslil clingman <tslil@posteo.de> | 2022-09-27 23:06:16 +0200 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.de> | 2022-09-28 00:07:01 +0200 |
| commit | c4e7a97fd7efecdb85f362f04434ea8470a1927f (patch) | |
| tree | 29cbe7682a1b4e899cfcfe5dd6dd73109b190b8d /src/config.rs | |
| parent | 19e4b5bead91b3c5eaefec77d5f703df9c1b2305 (diff) | |
Better pre-layout -> layout
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/config.rs b/src/config.rs deleted file mode 100644 index bc86613..0000000 --- a/src/config.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Do not change -pub const NUM_KEYS: usize = 30; -pub const ROW_LENGTH: usize = 10; - -pub const KEY_CHARS: [char; NUM_KEYS] = [ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', - 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '/', '.', ',', '\'', -]; - -pub const KEY_TO_FINGER: [usize; NUM_KEYS] = [ - 0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 0, 1, 2, 3, 3, 4, 4, 5, 6, 7, -]; - -pub fn canonicalise(inp: char) -> Option<char> { - if inp.is_ascii_alphabetic() { - return Some(inp.to_ascii_uppercase()); - } else { - match inp { - '.' => Some('.'), - '>' => Some('.'), - ',' => Some(','), - '<' => Some(','), - '/' => Some('/'), - '?' => Some('/'), - '\'' => Some('\''), - '"' => Some('\''), - _ => None, - } - } -} - -const fn build_lookup_table() -> [usize; 128] { - let mut result = [0; 128]; - let mut i = 0; - - while i < NUM_KEYS { - result[KEY_CHARS[i] as usize] = i; - i += 1; - } - return result; -} - -pub const CHAR_TO_INDEX: [usize; 128] = build_lookup_table(); |
