diff --git a/cgen.scm b/cgen.scm index 8269e1b3..90866e9d 100644 --- a/cgen.scm +++ b/cgen.scm @@ -423,6 +423,7 @@ ((eq? p 'Cyc-set-cvar!) "Cyc_set_cvar") ((eq? p 'Cyc-cvar?) "Cyc_is_cvar") ((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle") + ((eq? p 'Cyc-stdout) "Cyc_stdout") ((eq? p '+) "Cyc_sum") ((eq? p '-) "Cyc_sub") ((eq? p '*) "Cyc_mul") @@ -526,6 +527,7 @@ ;; EG: int v = prim(); (define (prim/c-var-assign p) (cond + ((eq? p 'Cyc-stdout) "port_type") ((eq? p 'current-input-port) "port_type") ((eq? p 'open-input-file) "port_type") ((eq? p 'length) "integer_type") @@ -550,6 +552,7 @@ (define (prim/cvar? exp) (and (prim? exp) (member exp '( + Cyc-stdout current-input-port open-input-file char->integer system string->number string-append string-cmp list->string string->list diff --git a/runtime-main.h b/runtime-main.h index b0ba5a45..ce360427 100644 --- a/runtime-main.h +++ b/runtime-main.h @@ -48,11 +48,8 @@ static void main_main (stack_size,heap_size,stack_base) /* Do initializations of Lisp objects and rewrite rules. quote_list_f = mlist1(boolean_f); quote_list_t = mlist1(boolean_t); */ - /* Make temporary short names for certain atoms. */ { - /* Define the rules, but only those that are actually referenced. */ - /* Create closure for the test function. */ mclosure0(run_test,&c_entry_pt); gc_cont = &run_test; diff --git a/runtime.c b/runtime.c index a2b8ec41..0adcdc46 100644 --- a/runtime.c +++ b/runtime.c @@ -955,6 +955,11 @@ common_type Cyc_num_op_va_list(int argc, common_type (fn_op(object, object)), ob /* I/O functions */ +port_type Cyc_stdout() { + make_port(_stdout, stdout, 0); + return _stdout; +} + port_type Cyc_io_current_input_port() { make_port(p, stdin, 0); return p; diff --git a/runtime.h b/runtime.h index 0ccc695f..a76240c6 100644 --- a/runtime.h +++ b/runtime.h @@ -59,6 +59,7 @@ extern object Cyc_global_variables; object Cyc_get_global_variables(); object Cyc_get_cvar(object var); object Cyc_set_cvar(object var, object value); +port_type Cyc_stdout(void); object apply(object cont, object func, object args); void Cyc_apply(int argc, closure cont, object prim, ...); integer_type Cyc_string_cmp(object str1, object str2); diff --git a/test.scm b/test.scm index 7de7ba0d..373ab700 100644 --- a/test.scm +++ b/test.scm @@ -24,3 +24,4 @@ (lambda () (values 1 1)) (lambda (a) (write a))) +(write (Cyc-stdout)) diff --git a/trans.scm b/trans.scm index 7e403e50..8957e785 100644 --- a/trans.scm +++ b/trans.scm @@ -484,6 +484,7 @@ Cyc-set-cvar! Cyc-cvar? ;; Cyclone-specific Cyc-has-cycle? + Cyc-stdout + - * @@ -570,6 +571,7 @@ Cyc-get-cvar Cyc-set-cvar! Cyc-cvar? + Cyc-stdout apply %halt exit