Moved legacy code into archive, ready for a new rapid(?) prototype.
I may regret doing this!
This commit is contained in:
parent
09051a3e63
commit
914c35ead0
114 changed files with 165 additions and 1 deletions
50
archive/c/repl.c
Normal file
50
archive/c/repl.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* repl.c
|
||||
*
|
||||
* the read/eval/print loop
|
||||
*
|
||||
* (c) 2017 Simon Brooke <simon@journeyman.cc>
|
||||
* Licensed under GPL version 2.0, or, at your option, any later version.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "memory/consspaceobject.h"
|
||||
#include "debug.h"
|
||||
#include "ops/intern.h"
|
||||
#include "ops/lispops.h"
|
||||
#include "memory/stack.h"
|
||||
|
||||
/**
|
||||
* @brief Handle an interrupt signal.
|
||||
*
|
||||
* @param dummy
|
||||
*/
|
||||
void int_handler( int dummy ) {
|
||||
wprintf( L"TODO: handle ctrl-C in a more interesting way\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* The read/eval/print loop.
|
||||
*/
|
||||
void repl( ) {
|
||||
signal( SIGINT, int_handler );
|
||||
debug_print( L"Entered repl\n", DEBUG_REPL );
|
||||
|
||||
struct cons_pointer env =
|
||||
consp( oblist ) ? oblist : make_cons( oblist, NIL );
|
||||
|
||||
/* bottom of stack */
|
||||
struct cons_pointer frame_pointer = make_stack_frame( NIL, NIL, env );
|
||||
|
||||
if ( !nilp( frame_pointer ) ) {
|
||||
lisp_repl( get_stack_frame( frame_pointer ), frame_pointer, env );
|
||||
|
||||
dec_ref( frame_pointer );
|
||||
}
|
||||
|
||||
debug_print( L"Leaving repl\n", DEBUG_REPL );
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue