From 75ba7db666535282ea7bc603aac64a973a490aa9 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Sat, 18 Mar 2023 11:41:16 -0700 Subject: [PATCH] Move pop_list(). --- implementations/uvm-ncc/joy.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/implementations/uvm-ncc/joy.c b/implementations/uvm-ncc/joy.c index 61d70e9..c9aa909 100644 --- a/implementations/uvm-ncc/joy.c +++ b/implementations/uvm-ncc/joy.c @@ -362,17 +362,37 @@ ht_has(char *str, u32 index, u32 length) /******************************************************************************/ + +u32 +pop_list(u32 stack) +{ + if (!stack) { + error = NOT_ENOUGH_VALUES_ON_STACK; + return 0; + } + u32 list = head(stack); + if (TYPE_OF(list) != joyList) { + error = NOT_A_LIST; + return 0; + } + return list; +} + + u32 push_symbol(char *symbol, u32 stack) { return cons(JOY_VALUE(joySymbol, ht_insert(symbol)), stack); } + + u32 push_int(u32 n, u32 stack) { return cons(JOY_VALUE(joyInt, n), stack); } + /******************************************************************************/ bool @@ -557,22 +577,6 @@ joy_eval(char *symbol, u32 stack, u32 expression) } -u32 -pop_list(u32 stack) -{ - if (!stack) { - error = NOT_ENOUGH_VALUES_ON_STACK; - return 0; - } - u32 list = head(stack); - if (TYPE_OF(list) != joyList) { - error = NOT_A_LIST; - return 0; - } - return list; -} - - u64 swaack(u32 stack) { -- 2.11.0