mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Added process-context library
This commit is contained in:
parent
8d92592d82
commit
a68a25630d
3 changed files with 29 additions and 0 deletions
2
Makefile
2
Makefile
|
@ -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)
|
||||
|
|
1
icyc.scm
1
icyc.scm
|
@ -10,6 +10,7 @@
|
|||
(scheme load)
|
||||
(scheme read)
|
||||
(scheme write)
|
||||
(scheme process-context)
|
||||
(scheme time)
|
||||
(scheme eval))
|
||||
(cond-expand
|
||||
|
|
26
scheme/process-context.sld
Normal file
26
scheme/process-context.sld
Normal 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); ")
|
||||
))
|
Loading…
Add table
Reference in a new issue