Minor cleanup.
This commit is contained in:
parent
83f393a176
commit
d0a43bea52
|
|
@ -265,18 +265,10 @@ concat_lists(JoyList a, JoyList b)
|
||||||
void
|
void
|
||||||
push_thing_in_unit_list(JoyTypePtr term, JoyListPtr expression)
|
push_thing_in_unit_list(JoyTypePtr term, JoyListPtr expression)
|
||||||
{
|
{
|
||||||
JoyList x = EMPTY_LIST;
|
JoyList node = newJoyList;
|
||||||
JoyListPtr xPtr = &x;
|
node->head = term;
|
||||||
push_thing(term, xPtr); /* TODO: is this some weird error?
|
node->tail = EMPTY_LIST;
|
||||||
you get a pointer x on the stack,
|
push_quote_onto_expression(node, expression);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,10 @@ along with Thun. If not see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
enum JoyTypeType {
|
enum JoyTypeType {
|
||||||
joySymbol,
|
|
||||||
joyTrue,
|
|
||||||
joyFalse,
|
|
||||||
joyInt,
|
joyInt,
|
||||||
joyList
|
joyList,
|
||||||
|
joySymbol,
|
||||||
|
joyTrue, joyFalse
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct list_node* JoyList;
|
typedef struct list_node* JoyList;
|
||||||
|
|
@ -55,21 +54,19 @@ typedef struct list_node {
|
||||||
|
|
||||||
typedef void JoyFunc(JoyListPtr, JoyListPtr);
|
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,
|
JoyFunc add, branch, clear, cmp_joyfunc, cons, concat, dip, dup, first,
|
||||||
i_joyfunc, inscribe, loop, lshift, pop, rest, rshift, stack, swaack,
|
i_joyfunc, inscribe, loop, lshift, pop, rest, rshift, stack, swaack,
|
||||||
swap, mul, sub, fdiv_q, fdiv_r, truthy, fn;
|
swap, mul, sub, fdiv_q, fdiv_r, truthy, fn;
|
||||||
|
|
||||||
|
|
||||||
struct dict_entry {
|
struct dict_entry {
|
||||||
char *name;
|
char *name;
|
||||||
JoyFunc *func;
|
JoyFunc *func;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct dict_entry *
|
const struct dict_entry *
|
||||||
in_word_set (register const char *str, register size_t len);
|
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