Added process-context library

This commit is contained in:
Justin Ethier 2016-01-10 22:01:34 -05:00
parent 8d92592d82
commit a68a25630d
3 changed files with 29 additions and 0 deletions

View file

@ -15,6 +15,7 @@ SMODULES = \
scheme/eval \
scheme/file \
scheme/load \
scheme/process-context \
scheme/read \
scheme/time \
scheme/write \
@ -82,6 +83,7 @@ bootstrap: icyc
cp scheme/eval.c $(BOOTSTRAP_DIR)/scheme
cp scheme/file.c $(BOOTSTRAP_DIR)/scheme
cp scheme/load.c $(BOOTSTRAP_DIR)/scheme
cp scheme/process-context.c $(BOOTSTRAP_DIR)/scheme
cp scheme/time.c $(BOOTSTRAP_DIR)/scheme
cp scheme/cyclone/common.c $(BOOTSTRAP_DIR)/scheme/cyclone
cp icyc.scm $(BOOTSTRAP_DIR)

View file

@ -10,6 +10,7 @@
(scheme load)
(scheme read)
(scheme write)
(scheme process-context)
(scheme time)
(scheme eval))
(cond-expand

View file

@ -0,0 +1,26 @@
(define-library (scheme process-context)
(export
command-line
)
; (import (scheme base)
; )
(begin
(define-c command-line
"(void *data, int argc, closure _, object k)"
;; TODO: consolidate with Cyc_command_line_arguments from runtime.c
" int i;
object lis = nil;
for (i = _cyc_argc; i > 0; i--) {
object ps = alloca(sizeof(string_type));
object pl = alloca(sizeof(cons_type));
make_string(s, _cyc_argv[i - 1]);
memcpy(ps, &s, sizeof(string_type));
((list)pl)->hdr.mark = gc_color_red;
((list)pl)->hdr.grayed = 0;
((list)pl)->tag = cons_tag;
((list)pl)->cons_car = ps;
((list)pl)->cons_cdr = lis;
lis = pl;
}
return_closcall1(data, k, lis); ")
))