Printing of bignums basically done, not tested.

This commit is contained in:
Simon Brooke 2018-12-29 23:44:28 +00:00
parent 342f0308d3
commit 489f008044
14 changed files with 244 additions and 164 deletions

View file

@ -30,35 +30,35 @@
void bind_function( wchar_t *name, struct cons_pointer ( *executable )
( struct stack_frame *,
struct cons_pointer, struct cons_pointer ) ) {
struct cons_pointer n = c_string_to_lisp_symbol( name );
inc_ref(n);
struct cons_pointer n = c_string_to_lisp_symbol( name );
inc_ref( n );
/* TODO: where a function is not compiled from source, we could cache
* the name on the source pointer. Would make stack frames potentially
* more readable and aid debugging generally. */
/* TODO: where a function is not compiled from source, we could cache
* the name on the source pointer. Would make stack frames potentially
* more readable and aid debugging generally. */
deep_bind( n, make_function( NIL, executable ) );
dec_ref(n);
dec_ref( n );
}
void bind_special( wchar_t *name, struct cons_pointer ( *executable )
( struct stack_frame *,
struct cons_pointer, struct cons_pointer ) ) {
struct cons_pointer n = c_string_to_lisp_symbol( name );
inc_ref(n);
struct cons_pointer n = c_string_to_lisp_symbol( name );
inc_ref( n );
deep_bind( n, make_special( NIL, executable ) );
deep_bind( n, make_special( NIL, executable ) );
dec_ref(n);
dec_ref( n );
}
void bind_value( wchar_t *name, struct cons_pointer value) {
struct cons_pointer n = c_string_to_lisp_symbol( name );
inc_ref(n);
void bind_value( wchar_t *name, struct cons_pointer value ) {
struct cons_pointer n = c_string_to_lisp_symbol( name );
inc_ref( n );
deep_bind( n, value );
deep_bind( n, value );
dec_ref(n);
dec_ref( n );
}
int main( int argc, char *argv[] ) {
@ -107,8 +107,8 @@ int main( int argc, char *argv[] ) {
/*
* privileged variables (keywords)
*/
bind_value( L"nil" , NIL );
bind_value( L"t" , TRUE );
bind_value( L"nil", NIL );
bind_value( L"t", TRUE );
/*
* primitive function operations
@ -153,14 +153,14 @@ int main( int argc, char *argv[] ) {
bind_special( L"quote", &lisp_quote );
bind_special( L"set!", &lisp_set_shriek );
debug_print(L"Initialised oblist\n", DEBUG_BOOTSTRAP);
debug_dump_object(oblist, DEBUG_BOOTSTRAP);
debug_print( L"Initialised oblist\n", DEBUG_BOOTSTRAP );
debug_dump_object( oblist, DEBUG_BOOTSTRAP );
repl( stdin, stdout, stderr, show_prompt );
debug_print(L"Freeing oblist\n", DEBUG_BOOTSTRAP);
dec_ref(oblist);
debug_dump_object(oblist, DEBUG_BOOTSTRAP);
debug_print( L"Freeing oblist\n", DEBUG_BOOTSTRAP );
dec_ref( oblist );
debug_dump_object( oblist, DEBUG_BOOTSTRAP );
if ( dump_at_end ) {