minor cleanup
This commit is contained in:
parent
8bda5d511a
commit
ccbf8d2b4c
|
|
@ -39,13 +39,6 @@ disenstacken ? [uncons ?] loop pop
|
|||
swons swap cons
|
||||
infra swons swaack [i] dip swaack'''.splitlines()
|
||||
|
||||
##
|
||||
##for line in defs:
|
||||
## name, body = line.split(None, 1)
|
||||
## print(f'{name}, def_{name}')
|
||||
##
|
||||
##print()
|
||||
##print()
|
||||
|
||||
print(f'''\
|
||||
/*
|
||||
|
|
@ -60,7 +53,6 @@ if sys.argv[-1] == '--header':
|
|||
name, body = line.split(None, 1)
|
||||
print(f'void def_{name}(JoyListPtr stack, JoyListPtr expression);')
|
||||
|
||||
|
||||
elif sys.argv[-1] == '--keywords':
|
||||
sys.stdout.write(open('KEYWORDS.in').read())
|
||||
for line in defs:
|
||||
|
|
@ -68,16 +60,15 @@ elif sys.argv[-1] == '--keywords':
|
|||
print(f'{name}, def_{name}')
|
||||
|
||||
else:
|
||||
|
||||
print('''
|
||||
#include "joy.h"
|
||||
#include "definitions.h"
|
||||
print('''\
|
||||
#include "joy.h"
|
||||
#include "definitions.h"
|
||||
|
||||
|
||||
/*
|
||||
Declare a bunch of list pointers to eventually hold the body expressions
|
||||
of the definitions.
|
||||
*/
|
||||
/*
|
||||
Declare a bunch of list pointers to eventually hold the body expressions
|
||||
of the definitions.
|
||||
*/
|
||||
''')
|
||||
for line in defs:
|
||||
name, body = line.split(None, 1)
|
||||
|
|
@ -87,13 +78,13 @@ else:
|
|||
|
||||
print('''
|
||||
|
||||
/*
|
||||
Next, we want an initializer function to fill out the body pointers.
|
||||
*/
|
||||
/*
|
||||
Next, we want an initializer function to fill out the body pointers.
|
||||
*/
|
||||
|
||||
void
|
||||
init_defs(void)
|
||||
{
|
||||
void
|
||||
init_defs(void)
|
||||
{
|
||||
''')
|
||||
for line in defs:
|
||||
name, body = line.split(None, 1)
|
||||
|
|
@ -104,9 +95,9 @@ else:
|
|||
|
||||
print('''
|
||||
|
||||
/*
|
||||
Last, a set of functions to go in the wordlist, one for each definition.
|
||||
*/
|
||||
/*
|
||||
Last, a set of functions to go in the wordlist, one for each definition.
|
||||
*/
|
||||
''')
|
||||
for line in defs:
|
||||
name, body = line.split(None, 1)
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@ Auto-generated file by convert_defs.py
|
|||
Do not edit.
|
||||
*/
|
||||
|
||||
|
||||
#include "joy.h"
|
||||
#include "definitions.h"
|
||||
#include "joy.h"
|
||||
#include "definitions.h"
|
||||
|
||||
|
||||
/*
|
||||
Declare a bunch of list pointers to eventually hold the body expressions
|
||||
of the definitions.
|
||||
*/
|
||||
/*
|
||||
Declare a bunch of list pointers to eventually hold the body expressions
|
||||
of the definitions.
|
||||
*/
|
||||
|
||||
JoyList def_abs_body;
|
||||
JoyList def_anamorphism_body;
|
||||
|
|
@ -36,13 +35,13 @@ JoyList def_swons_body;
|
|||
JoyList def_infra_body;
|
||||
|
||||
|
||||
/*
|
||||
Next, we want an initializer function to fill out the body pointers.
|
||||
*/
|
||||
/*
|
||||
Next, we want an initializer function to fill out the body pointers.
|
||||
*/
|
||||
|
||||
void
|
||||
init_defs(void)
|
||||
{
|
||||
void
|
||||
init_defs(void)
|
||||
{
|
||||
|
||||
def_abs_body = text_to_expression("dup 0 < [] [neg] branch");
|
||||
def_anamorphism_body = text_to_expression("[pop []] swap [dip swons] genrec");
|
||||
|
|
@ -68,9 +67,9 @@ JoyList def_infra_body;
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Last, a set of functions to go in the wordlist, one for each definition.
|
||||
*/
|
||||
/*
|
||||
Last, a set of functions to go in the wordlist, one for each definition.
|
||||
*/
|
||||
|
||||
void def_abs(__attribute__((unused)) JoyListPtr stack, JoyListPtr expression) { push_quote_onto_expression(def_abs_body, expression); }
|
||||
void def_anamorphism(__attribute__((unused)) JoyListPtr stack, JoyListPtr expression) { push_quote_onto_expression(def_anamorphism_body, expression); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue