A little macro.
This commit is contained in:
parent
f06c261e81
commit
5258f4d894
|
|
@ -97,6 +97,9 @@ struct user_def *user_defs = NULL;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define PUSH(node, stack) (node)->tail = *(stack); *(stack) = (node);
|
||||||
|
|
||||||
|
|
||||||
JoyList
|
JoyList
|
||||||
make_non_list_node(char *text, size_t size)
|
make_non_list_node(char *text, size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -154,8 +157,7 @@ void
|
||||||
push_quote(JoyList el, JoyListPtr stack)
|
push_quote(JoyList el, JoyListPtr stack)
|
||||||
{
|
{
|
||||||
JoyList node = make_list_node(el);
|
JoyList node = make_list_node(el);
|
||||||
node->tail = *stack;
|
PUSH(node, stack)
|
||||||
*stack = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -243,8 +245,7 @@ push_thing(JoyTypePtr term, JoyListPtr stack)
|
||||||
{
|
{
|
||||||
JoyList node = newJoyList;
|
JoyList node = newJoyList;
|
||||||
node->head = term;
|
node->head = term;
|
||||||
node->tail = *stack;
|
PUSH(node, stack)
|
||||||
*stack = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -302,8 +303,7 @@ fn(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression)
|
||||||
i1 = pop_int(s1Ptr);
|
i1 = pop_int(s1Ptr);
|
||||||
mpz_add(node->head->value.i, node->head->value.i, *i1);
|
mpz_add(node->head->value.i, node->head->value.i, *i1);
|
||||||
}
|
}
|
||||||
node->tail = *stack;
|
PUSH(node, stack)
|
||||||
*stack = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -544,8 +544,7 @@ push_quote_onto_expression(JoyList el, JoyListPtr expression)
|
||||||
JoyList node;
|
JoyList node;
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
node = make_list_node(el);
|
node = make_list_node(el);
|
||||||
node->tail = *expression;
|
PUSH(node, expression)
|
||||||
*expression = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -616,8 +615,7 @@ lshift(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression)
|
||||||
a = pop_int(stack);
|
a = pop_int(stack);
|
||||||
node = newIntNode();
|
node = newIntNode();
|
||||||
mpz_mul_2exp(node->head->value.i, *a, mpz_get_ui(*b));
|
mpz_mul_2exp(node->head->value.i, *a, mpz_get_ui(*b));
|
||||||
node->tail = *stack;
|
PUSH(node, stack)
|
||||||
*stack = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -634,8 +632,7 @@ rshift(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression)
|
||||||
a = pop_int(stack);
|
a = pop_int(stack);
|
||||||
node = newIntNode();
|
node = newIntNode();
|
||||||
mpz_fdiv_q_2exp(node->head->value.i, *a, mpz_get_ui(*b));
|
mpz_fdiv_q_2exp(node->head->value.i, *a, mpz_get_ui(*b));
|
||||||
node->tail = *stack;
|
PUSH(node, stack)
|
||||||
*stack = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue