Minor cleanup.
This commit is contained in:
parent
83f393a176
commit
d0a43bea52
|
|
@ -265,18 +265,10 @@ concat_lists(JoyList a, JoyList b)
|
|||
void
|
||||
push_thing_in_unit_list(JoyTypePtr term, JoyListPtr expression)
|
||||
{
|
||||
JoyList x = EMPTY_LIST;
|
||||
JoyListPtr xPtr = &x;
|
||||
push_thing(term, xPtr); /* TODO: is this some weird error?
|
||||
you get a pointer x on the stack,
|
||||
set it to NULL (EMPTY_LIST),
|
||||
then take x's address and put it in another pointer xPtr,
|
||||
doens't that leave the tail of the JoyList node created in push_thing
|
||||
pointing to the x pointer on the C stack in this function?
|
||||
And doesn't that variable go away when we return?
|
||||
How and why does this work? Is it an illusion, a bug waiting to bite?
|
||||
*/
|
||||
push_quote_onto_expression(*xPtr, expression);
|
||||
JoyList node = newJoyList;
|
||||
node->head = term;
|
||||
node->tail = EMPTY_LIST;
|
||||
push_quote_onto_expression(node, expression);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,10 @@ along with Thun. If not see <http://www.gnu.org/licenses/>.
|
|||
|
||||
|
||||
enum JoyTypeType {
|
||||
joySymbol,
|
||||
joyTrue,
|
||||
joyFalse,
|
||||
joyInt,
|
||||
joyList
|
||||
joyList,
|
||||
joySymbol,
|
||||
joyTrue, joyFalse
|
||||
};
|
||||
|
||||
typedef struct list_node* JoyList;
|
||||
|
|
@ -55,21 +54,19 @@ typedef struct list_node {
|
|||
|
||||
typedef void JoyFunc(JoyListPtr, JoyListPtr);
|
||||
|
||||
|
||||
JoyList text_to_expression(char *text);
|
||||
void push_quote_onto_expression(JoyList el, JoyListPtr expression);
|
||||
void init_defs(void);
|
||||
|
||||
|
||||
JoyFunc add, branch, clear, cmp_joyfunc, cons, concat, dip, dup, first,
|
||||
i_joyfunc, inscribe, loop, lshift, pop, rest, rshift, stack, swaack,
|
||||
swap, mul, sub, fdiv_q, fdiv_r, truthy, fn;
|
||||
|
||||
|
||||
struct dict_entry {
|
||||
struct dict_entry {
|
||||
char *name;
|
||||
JoyFunc *func;
|
||||
};
|
||||
|
||||
const struct dict_entry *
|
||||
in_word_set (register const char *str, register size_t len);
|
||||
|
||||
JoyList text_to_expression(char *text);
|
||||
void push_quote_onto_expression(JoyList el, JoyListPtr expression);
|
||||
void init_defs(void);
|
||||
|
|
|
|||
Loading…
Reference in New Issue