mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-20 14:19:17 +02:00
Added Cyc-read-line
This commit is contained in:
parent
ea0e6fa7ae
commit
ad0c7e4b74
6 changed files with 20 additions and 3 deletions
|
@ -1,7 +1,16 @@
|
|||
## Add a primitive
|
||||
|
||||
- Add function/definitions to runtime.h and runtime.c
|
||||
- sudo make install-includes
|
||||
- sudo make install-libs
|
||||
- Add to prim? section in transforms.scm. Some functions may need to added to the next section in the file, so they are not constant-folded (IE, evaluated at compile time).
|
||||
- Add to the c-compile-primitive section in cgen.scm.
|
||||
- cyclone scheme/cyclone/transforms.sld && cyclone scheme/cyclone/cgen.sld
|
||||
- sudo cp scheme/cyclone/transforms.* /usr/local/share/cyclone/scheme/cyclone/
|
||||
and cgen
|
||||
- run cyclone to build sld's again
|
||||
- cyclone cyclone.scm , install new cyclone
|
||||
|
||||
|
||||
- TODO: compile files in what order? And copy them where? I think sld files need to be built and copied, and then cyclone and icyc need to be rebuilt linking against them?
|
||||
- TODO: what about eval.scm?
|
||||
|
|
|
@ -364,7 +364,7 @@ extern const object primitive_file_91exists_127;
|
|||
extern const object primitive_delete_91file;
|
||||
extern const object primitive_read_91char;
|
||||
extern const object primitive_peek_91char;
|
||||
extern const object primtitive_Cyc_91read_91line;
|
||||
extern const object primitive_Cyc_91read_91line;
|
||||
extern const object primitive_Cyc_91write_91char;
|
||||
extern const object primitive_Cyc_91write;
|
||||
extern const object primitive_Cyc_91display;
|
||||
|
|
|
@ -445,6 +445,7 @@
|
|||
((eq? p 'delete-file) "Cyc_io_delete_file")
|
||||
((eq? p 'read-char) "Cyc_io_read_char")
|
||||
((eq? p 'peek-char) "Cyc_io_peek_char")
|
||||
((eq? p 'Cyc-read-line) "Cyc_io_read_line")
|
||||
((eq? p 'Cyc-display) "Cyc_display_va")
|
||||
((eq? p 'Cyc-write) "Cyc_write_va")
|
||||
((eq? p 'Cyc-write-char) "Cyc_write_char")
|
||||
|
@ -559,6 +560,7 @@
|
|||
((eq? p 'string-length) "integer_type")
|
||||
((eq? p 'substring) "string_type")
|
||||
((eq? p 'apply) "object")
|
||||
((eq? p 'Cyc-read-line) "object")
|
||||
((eq? p 'command-line-arguments) "object")
|
||||
((eq? p 'make-vector) "object")
|
||||
(else #f)))
|
||||
|
@ -582,17 +584,18 @@
|
|||
string-length substring
|
||||
+ - * / apply
|
||||
command-line-arguments
|
||||
Cyc-read-line
|
||||
cons length vector-length cell))))
|
||||
|
||||
;; Pass continuation as the function's first parameter?
|
||||
(define (prim:cont? exp)
|
||||
(and (prim? exp)
|
||||
(member exp '(apply command-line-arguments make-vector))))
|
||||
(member exp '(Cyc-read-line apply command-line-arguments make-vector))))
|
||||
;; TODO: this is a hack, right answer is to include information about
|
||||
;; how many args each primitive is supposed to take
|
||||
(define (prim:cont-has-args? exp)
|
||||
(and (prim? exp)
|
||||
(member exp '(apply make-vector))))
|
||||
(member exp '(Cyc-read-line apply make-vector))))
|
||||
|
||||
;; Pass an integer arg count as the function's first parameter?
|
||||
(define (prim:arg-count? exp)
|
||||
|
|
|
@ -606,6 +606,7 @@
|
|||
delete-file
|
||||
read-char
|
||||
peek-char
|
||||
Cyc-read-line
|
||||
Cyc-write-char
|
||||
Cyc-write
|
||||
Cyc-display))
|
||||
|
@ -654,6 +655,7 @@
|
|||
delete-file
|
||||
read-char
|
||||
peek-char
|
||||
Cyc-read-line
|
||||
Cyc-write-char
|
||||
Cyc-write
|
||||
Cyc-display)))
|
||||
|
|
|
@ -292,6 +292,7 @@
|
|||
(list 'delete-file delete-file)
|
||||
(list 'read-char read-char)
|
||||
(list 'peek-char peek-char)
|
||||
(list 'Cyc-read-line Cyc-read-line)
|
||||
(list 'Cyc-write-char Cyc-write-char)
|
||||
(list 'Cyc-write Cyc-write)
|
||||
(list 'Cyc-display Cyc-display)))
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
(scheme file)
|
||||
(scheme write))
|
||||
|
||||
(define fp (open-input-file "test.scm"))
|
||||
(write (Cyc-read-line fp))
|
||||
(write
|
||||
(string-set! "abc" 1 #\x))
|
||||
;
|
||||
|
|
Loading…
Add table
Reference in a new issue