mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-13 07:47:39 +02:00
Issue #236 - Added single-byte I/O functions
This commit is contained in:
parent
584b31460b
commit
44af2e8d98
1 changed files with 24 additions and 14 deletions
|
@ -187,10 +187,10 @@
|
||||||
; write-bytevector
|
; write-bytevector
|
||||||
;
|
;
|
||||||
; : No unicode support at this time
|
; : No unicode support at this time
|
||||||
; peek-u8
|
peek-u8
|
||||||
; read-u8
|
read-u8
|
||||||
; u8-ready?
|
; u8-ready?
|
||||||
; write-u8
|
write-u8
|
||||||
;
|
;
|
||||||
; ; No complex or rational numbers at this time
|
; ; No complex or rational numbers at this time
|
||||||
; rationalize
|
; rationalize
|
||||||
|
@ -626,17 +626,27 @@
|
||||||
(if (null? lst)
|
(if (null? lst)
|
||||||
end
|
end
|
||||||
(func (car lst) (foldr func end (cdr lst)))))
|
(func (car lst) (foldr func end (cdr lst)))))
|
||||||
;;;;
|
(define-c _read-u8
|
||||||
;; TODO: stubs for the u8 single-byte I/O functions
|
"(void *data, int argc, closure _, object k, object port)"
|
||||||
;;object Cyc_write_u8(void *data, object c, object port);
|
" Cyc_io_read_u8(data, k, port);")
|
||||||
;;object Cyc_io_read_u8(void *data, object cont, object port);
|
(define-c _peek-u8
|
||||||
;;object Cyc_io_peek_u8(void *data, object cont, object port);
|
"(void *data, int argc, closure _, object k, object port)"
|
||||||
;; (define-c get-param-objs
|
" Cyc_io_peek_u8(data, k, port);")
|
||||||
;; "(void *data, int argc, closure _, object k)"
|
(define-c _write-u8
|
||||||
;; " gc_thread_data *thd = (gc_thread_data *)data;
|
"(void *data, int argc, closure _, object k, object chr, object port)"
|
||||||
;; //Cyc_st_add(data, \"scheme/base.sld:get-param-objs\");
|
" return_closcall1(data, k, Cyc_write_u8(data, chr, port));")
|
||||||
;; return_closcall1(data, k, thd->param_objs); ")
|
(define (read-u8 . port)
|
||||||
;;;;
|
(if (null? port)
|
||||||
|
(_read-u8 (current-input-port))
|
||||||
|
(_read-u8 (car port))))
|
||||||
|
(define (peek-u8 . port)
|
||||||
|
(if (null? port)
|
||||||
|
(_peek-u8 (current-input-port))
|
||||||
|
(_peek-u8 (car port))))
|
||||||
|
(define (write-u8 chr . port)
|
||||||
|
(if (null? port)
|
||||||
|
(_write-u8 chr (current-input-port))
|
||||||
|
(_write-u8 chr (car port))))
|
||||||
(define (peek-char . port)
|
(define (peek-char . port)
|
||||||
(if (null? port)
|
(if (null? port)
|
||||||
(Cyc-peek-char (current-input-port))
|
(Cyc-peek-char (current-input-port))
|
||||||
|
|
Loading…
Add table
Reference in a new issue