mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
Added Cyc-stdout
This commit is contained in:
parent
e7c050ef2c
commit
e8ff0509ea
6 changed files with 12 additions and 3 deletions
3
cgen.scm
3
cgen.scm
|
@ -423,6 +423,7 @@
|
||||||
((eq? p 'Cyc-set-cvar!) "Cyc_set_cvar")
|
((eq? p 'Cyc-set-cvar!) "Cyc_set_cvar")
|
||||||
((eq? p 'Cyc-cvar?) "Cyc_is_cvar")
|
((eq? p 'Cyc-cvar?) "Cyc_is_cvar")
|
||||||
((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle")
|
((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle")
|
||||||
|
((eq? p 'Cyc-stdout) "Cyc_stdout")
|
||||||
((eq? p '+) "Cyc_sum")
|
((eq? p '+) "Cyc_sum")
|
||||||
((eq? p '-) "Cyc_sub")
|
((eq? p '-) "Cyc_sub")
|
||||||
((eq? p '*) "Cyc_mul")
|
((eq? p '*) "Cyc_mul")
|
||||||
|
@ -526,6 +527,7 @@
|
||||||
;; EG: int v = prim();
|
;; EG: int v = prim();
|
||||||
(define (prim/c-var-assign p)
|
(define (prim/c-var-assign p)
|
||||||
(cond
|
(cond
|
||||||
|
((eq? p 'Cyc-stdout) "port_type")
|
||||||
((eq? p 'current-input-port) "port_type")
|
((eq? p 'current-input-port) "port_type")
|
||||||
((eq? p 'open-input-file) "port_type")
|
((eq? p 'open-input-file) "port_type")
|
||||||
((eq? p 'length) "integer_type")
|
((eq? p 'length) "integer_type")
|
||||||
|
@ -550,6 +552,7 @@
|
||||||
(define (prim/cvar? exp)
|
(define (prim/cvar? exp)
|
||||||
(and (prim? exp)
|
(and (prim? exp)
|
||||||
(member exp '(
|
(member exp '(
|
||||||
|
Cyc-stdout
|
||||||
current-input-port open-input-file
|
current-input-port open-input-file
|
||||||
char->integer system string->number
|
char->integer system string->number
|
||||||
string-append string-cmp list->string string->list
|
string-append string-cmp list->string string->list
|
||||||
|
|
|
@ -48,11 +48,8 @@ static void main_main (stack_size,heap_size,stack_base)
|
||||||
/* Do initializations of Lisp objects and rewrite rules.
|
/* Do initializations of Lisp objects and rewrite rules.
|
||||||
quote_list_f = mlist1(boolean_f); quote_list_t = mlist1(boolean_t); */
|
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. */
|
/* Create closure for the test function. */
|
||||||
mclosure0(run_test,&c_entry_pt);
|
mclosure0(run_test,&c_entry_pt);
|
||||||
gc_cont = &run_test;
|
gc_cont = &run_test;
|
||||||
|
|
|
@ -955,6 +955,11 @@ common_type Cyc_num_op_va_list(int argc, common_type (fn_op(object, object)), ob
|
||||||
|
|
||||||
/* I/O functions */
|
/* I/O functions */
|
||||||
|
|
||||||
|
port_type Cyc_stdout() {
|
||||||
|
make_port(_stdout, stdout, 0);
|
||||||
|
return _stdout;
|
||||||
|
}
|
||||||
|
|
||||||
port_type Cyc_io_current_input_port() {
|
port_type Cyc_io_current_input_port() {
|
||||||
make_port(p, stdin, 0);
|
make_port(p, stdin, 0);
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -59,6 +59,7 @@ extern object Cyc_global_variables;
|
||||||
object Cyc_get_global_variables();
|
object Cyc_get_global_variables();
|
||||||
object Cyc_get_cvar(object var);
|
object Cyc_get_cvar(object var);
|
||||||
object Cyc_set_cvar(object var, object value);
|
object Cyc_set_cvar(object var, object value);
|
||||||
|
port_type Cyc_stdout(void);
|
||||||
object apply(object cont, object func, object args);
|
object apply(object cont, object func, object args);
|
||||||
void Cyc_apply(int argc, closure cont, object prim, ...);
|
void Cyc_apply(int argc, closure cont, object prim, ...);
|
||||||
integer_type Cyc_string_cmp(object str1, object str2);
|
integer_type Cyc_string_cmp(object str1, object str2);
|
||||||
|
|
1
test.scm
1
test.scm
|
@ -24,3 +24,4 @@
|
||||||
(lambda () (values 1 1))
|
(lambda () (values 1 1))
|
||||||
(lambda (a) (write a)))
|
(lambda (a) (write a)))
|
||||||
|
|
||||||
|
(write (Cyc-stdout))
|
||||||
|
|
|
@ -484,6 +484,7 @@
|
||||||
Cyc-set-cvar!
|
Cyc-set-cvar!
|
||||||
Cyc-cvar? ;; Cyclone-specific
|
Cyc-cvar? ;; Cyclone-specific
|
||||||
Cyc-has-cycle?
|
Cyc-has-cycle?
|
||||||
|
Cyc-stdout
|
||||||
+
|
+
|
||||||
-
|
-
|
||||||
*
|
*
|
||||||
|
@ -570,6 +571,7 @@
|
||||||
Cyc-get-cvar
|
Cyc-get-cvar
|
||||||
Cyc-set-cvar!
|
Cyc-set-cvar!
|
||||||
Cyc-cvar?
|
Cyc-cvar?
|
||||||
|
Cyc-stdout
|
||||||
apply
|
apply
|
||||||
%halt
|
%halt
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Add table
Reference in a new issue