From b7c07685c35657924b47ff9e80b5ab3b303edc00 Mon Sep 17 00:00:00 2001 From: Peter Fidelman Date: Sat, 26 Mar 2022 15:05:00 -0700 Subject: [PATCH] call --- frustration.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frustration.rs b/frustration.rs index c7153cd..95c3c08 100644 --- a/frustration.rs +++ b/frustration.rs @@ -51,9 +51,10 @@ struct TableEntry { } // NOTE: lazy_static or SyncLazy would allow nicer init -const PRIMITIVES: [TableEntry; 12] = [ +const PRIMITIVES: [TableEntry; 13] = [ TableEntry {f: ret , name: ShortName {bytes: *b"ret", length: 3}, dict: false, immediate: false}, - TableEntry {f: lit , name: ShortName {bytes: *b"lit", length: 3}, dict: false, immediate: false}, + TableEntry {f: lit , name: ShortName {bytes: *b"lit", length: 3}, dict: false, immediate: false}, + TableEntry {f: call , name: ShortName {bytes: *b"cal", length: 4}, dict: true, immediate: false}, TableEntry {f: dot , name: ShortName {bytes: *b". ", length: 1}, dict: true, immediate: false}, TableEntry {f: comma_ , name: ShortName {bytes: *b", ", length: 1}, dict: true, immediate: false}, TableEntry {f: store , name: ShortName {bytes: *b"! ", length: 1}, dict: true, immediate: false}, @@ -180,6 +181,11 @@ fn from_r(c: &mut Core) -> u16 { return c.rstack[c.trs]; } +fn call(c: &mut Core) { + to_r(c, c.ip); + c.ip = pop(c); +} + // note: this is an inline primitive, not a dict entry fn ret(c: &mut Core) { if c.trs == 0 {