Added Cyc-stdout

This commit is contained in:
Justin Ethier 2015-06-10 23:02:39 -04:00
parent e7c050ef2c
commit e8ff0509ea
6 changed files with 12 additions and 3 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -24,3 +24,4 @@
(lambda () (values 1 1))
(lambda (a) (write a)))
(write (Cyc-stdout))

View file

@ -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