This commit is contained in:
2026-08-02 13:11:42 +03:00
parent 4f043fc1c0
commit 0e40f7f1cd
14 changed files with 716 additions and 219 deletions
+23 -1
View File
@@ -75,6 +75,18 @@ impl WordSize {
}
}
pub fn from_label(s: &str) -> Option<Self> {
match s.trim().to_ascii_uppercase().as_str() {
"QWORD" => Some(WordSize::Qword),
"DWORD" => Some(WordSize::Dword),
"DINT" => Some(WordSize::Dint),
"WORD" => Some(WordSize::Word),
"INT" => Some(WordSize::Int),
"BYTE" => Some(WordSize::Byte),
_ => None,
}
}
pub fn cycle(self) -> Self {
match self {
WordSize::Qword => WordSize::Dword,
@@ -310,7 +322,17 @@ impl Programmer {
}
self.typing = false;
}
self.word_size = self.word_size.cycle();
self.set_word_size(self.word_size.cycle());
}
pub fn set_word_size(&mut self, size: WordSize) {
if self.typing {
if let Ok(v) = parse_entry(&self.entry, self.base) {
self.value = v;
}
self.typing = false;
}
self.word_size = size;
self.value &= self.word_size.mask();
if let Some(p) = self.pending.as_mut() {
*p &= self.word_size.mask();