use _d suffix for words that needed a special dictionary version

This commit is contained in:
psf 2022-03-27 01:12:41 -07:00
parent e204ae6da7
commit aa3a9651a1

View file

@ -61,25 +61,25 @@ const PRIMITIVES: [TableEntry; 24] = [
TableEntry {f: lit , name: None, immediate: false},
TableEntry {f: add , name: Some(ShortName {bytes: *b"+ ", length: 1}), immediate: false},
TableEntry {f: call , name: Some(ShortName {bytes: *b"cal", length: 4}), immediate: false},
TableEntry {f: comma_ , name: Some(ShortName {bytes: *b", ", length: 1}), immediate: false},
TableEntry {f: create_ , name: Some(ShortName {bytes: *b"cre", length: 6}), immediate: false},
TableEntry {f: comma_d , name: Some(ShortName {bytes: *b", ", length: 1}), immediate: false},
TableEntry {f: create_d, name: Some(ShortName {bytes: *b"cre", length: 6}), immediate: false},
TableEntry {f: div , name: Some(ShortName {bytes: *b"/ ", length: 1}), immediate: false},
TableEntry {f: dot , name: Some(ShortName {bytes: *b". ", length: 1}), immediate: false},
TableEntry {f: drop , name: Some(ShortName {bytes: *b"dro", length: 4}), immediate: false},
TableEntry {f: dup , name: Some(ShortName {bytes: *b"dup", length: 3}), immediate: false},
TableEntry {f: dump , name: Some(ShortName {bytes: *b"dum", length: 4}), immediate: false},
TableEntry {f: from_r_ , name: Some(ShortName {bytes: *b"r> ", length: 2}), immediate: false},
TableEntry {f: from_r_d, name: Some(ShortName {bytes: *b"r> ", length: 2}), immediate: false},
TableEntry {f: immediate,name: Some(ShortName {bytes: *b"imm", length: 9}), immediate: false},
TableEntry {f: lbracket, name: Some(ShortName {bytes: *b"[ ", length: 1}), immediate: true},
TableEntry {f: load , name: Some(ShortName {bytes: *b"@ ", length: 1}), immediate: false},
TableEntry {f: mul , name: Some(ShortName {bytes: *b"* ", length: 1}), immediate: false},
TableEntry {f: ret_ , name: Some(ShortName {bytes: *b"ret", length: 3}), immediate: false},
TableEntry {f: ret_d , name: Some(ShortName {bytes: *b"ret", length: 3}), immediate: false},
TableEntry {f: rbracket, name: Some(ShortName {bytes: *b"] ", length: 1}), immediate: false},
TableEntry {f: store , name: Some(ShortName {bytes: *b"! ", length: 1}), immediate: false},
TableEntry {f: sub , name: Some(ShortName {bytes: *b"- ", length: 1}), immediate: false},
TableEntry {f: swap , name: Some(ShortName {bytes: *b"swa", length: 4}), immediate: false},
TableEntry {f: tick , name: Some(ShortName {bytes: *b"' ", length: 1}), immediate: false},
TableEntry {f: to_r_ , name: Some(ShortName {bytes: *b">r ", length: 2}), immediate: false},
TableEntry {f: to_r_d , name: Some(ShortName {bytes: *b">r ", length: 2}), immediate: false},
TableEntry {f: word , name: Some(ShortName {bytes: *b"wor", length: 4}), immediate: false}
];
@ -105,7 +105,7 @@ fn create(c: &mut Core, name: ShortName) {
c.here = (addr+6) as u16;
}
fn create_(c: &mut Core) {
fn create_d(c: &mut Core) {
match &c.next_token {
Some(t) => {
let short_name = truncate_name(t);
@ -188,7 +188,7 @@ fn comma(c: &mut Core, val: u16) {
c.here += 2;
}
fn comma_(c: &mut Core) {
fn comma_d(c: &mut Core) {
let val = pop(c);
comma(c, val);
}
@ -246,7 +246,7 @@ fn to_r(c: &mut Core, val: u16) {
c.trs += 1;
}
fn to_r_(c: &mut Core) {
fn to_r_d(c: &mut Core) {
let r1 = from_r(c);
let r2 = pop(c);
to_r(c, r2);
@ -258,7 +258,7 @@ fn from_r(c: &mut Core) -> u16 {
return c.rstack[c.trs];
}
fn from_r_(c: &mut Core) {
fn from_r_d(c: &mut Core) {
let r1 = from_r(c);
let r2 = from_r(c);
to_r(c, r1);
@ -278,7 +278,7 @@ fn ret(c: &mut Core) {
c.ip = from_r(c);
}
fn ret_(c: &mut Core) {
fn ret_d(c: &mut Core) {
_ = from_r(c);
ret(c);
}