Added (exit)

This commit is contained in:
Justin Ethier 2015-03-13 23:42:41 -04:00
parent 2d362dcc0c
commit 5bd3deefa1
5 changed files with 8 additions and 2 deletions

2
TODO
View file

@ -1,7 +1,5 @@
Working TODO list:
- Add an (exit) primitive in the compiler and interpreter
- Issues with detecting cycles:
- (equal?) loops forever when comparing two different circular lists
- printing *global-environment* in the repl still loops forever

View file

@ -433,6 +433,7 @@
((eq? p '<=) "__num_lte")
((eq? p 'apply) "apply")
((eq? p '%halt) "__halt")
((eq? p 'exit) "__halt")
((eq? p 'error) "Cyc_error")
((eq? p 'current-input-port) "Cyc_io_current_input_port")
((eq? p 'open-input-file) "Cyc_io_open_input_file")

View file

@ -199,6 +199,7 @@
(list '<= <=)
(list 'apply apply)
(list '%halt %halt)
(list 'exit exit)
(list 'error error)
(list 'cons cons)
(list 'cell-get cell-get)

View file

@ -1171,6 +1171,10 @@ static void _Cyc_91get_91cvar(object cont, object args) {
printf("not implemented\n"); exit(1); }
static void _Cyc_91set_91cvar_67(object cont, object args) {
printf("not implemented\n"); exit(1); }
/* Note we cannot use _exit (per convention) because it is reserved by C */
static void _cyc_exit(object cont, object args) {
__halt(car(args));
}
static void __75halt(object cont, object args) {
printf("not implemented\n"); exit(1); }
static void _cell_91get(object cont, object args) {
@ -1263,6 +1267,7 @@ defprimitive(_125_123, >=, &__125_123); /* >= */
defprimitive(_121_123, <=, &__121_123); /* <= */
defprimitive(apply, apply, &_apply); /* apply */
defprimitive(_75halt, %halt, &__75halt); /* %halt */
defprimitive(exit, exit, &_cyc_exit); /* exit */
defprimitive(error, error, &_error); /* error */
defprimitive(cons, cons, &_cons); /* cons */
defprimitive(cell_91get, cell-get, &_cell_91get); /* cell-get */

View file

@ -517,6 +517,7 @@
apply
%halt
error
exit
cons
cell-get
set-global!