Added get-u8.
This commit is contained in:
parent
2eca32fc8e
commit
043425eb20
Binary file not shown.
|
@ -94,8 +94,7 @@
|
|||
\newcommand{\idxlabeldefun}[5]{
|
||||
\vspace{1ex}
|
||||
\rule{\textwidth}{2pt}
|
||||
{\index{#1@\texttt{#2}}\label{#3}{\Large\texttt{#4}} \hfill \textbf{#5}}\\
|
||||
}
|
||||
{\index{#1@\texttt{#2}}\label{#3}{\Large\texttt{#4}}\hfill\textbf{#5}}\\}
|
||||
|
||||
|
||||
\newcommand{\idxdefun}[3]{\idxlabeldefun{#1}{#2}{#1}{#2}{#3}}
|
||||
|
@ -524,8 +523,10 @@ example shows a very simple script that uses the
|
|||
\newpage
|
||||
|
||||
\section{Installing Additional Libraries}
|
||||
|
||||
FIXME
|
||||
\subsection{\texttt{IKARUS\_LIBRARY\_PATH}}
|
||||
\index{ikarus library path@\texttt{IKARUS\_LIBRARY\_PATH}}
|
||||
FIXME
|
||||
|
||||
|
||||
%\subsection{Mac OS X}
|
||||
|
@ -1148,11 +1149,20 @@ module system is similar in spirit to that of Chez Scheme.
|
|||
\defun{module}{syntax}
|
||||
\texttt{(module M definitions ... expressions ...)}\\
|
||||
\texttt{(module definitions ... expressions ...)}
|
||||
FIXME
|
||||
|
||||
\defun{import}{syntax}
|
||||
\texttt{(import M)}
|
||||
FIXME
|
||||
|
||||
\newpage
|
||||
\section{Local Library Imports}
|
||||
\defun{import}{syntax}
|
||||
\texttt{(import import-spec* ...)}
|
||||
FIXME
|
||||
|
||||
\newpage
|
||||
|
||||
\section{\label{sec:gensyms}Gensyms}
|
||||
|
||||
Gensym stands for a \emph{generated symbol}---a fresh symbol that is
|
||||
|
@ -1241,12 +1251,14 @@ associated with the gensym argument.
|
|||
|
||||
|
||||
\idxdefun{gensym syntax}{\#\{gensym\}}{reader syntax}
|
||||
\texttt{\#\{unique-name\}}
|
||||
\index{\#\{pretty unique\}@\texttt{\#\{pretty unique\}} reader syntax}
|
||||
\\
|
||||
\texttt{\#\{pretty-name unique-name\}}
|
||||
\index{\#\{unique\}@\texttt{\#\{unique\}} reader syntax}
|
||||
\index{\#:pretty@\texttt{\#:pretty} reader syntax}
|
||||
\texttt{\#\{unique-name\}}\\
|
||||
\texttt{\#\{pretty-name unique-name\}}\\
|
||||
\\
|
||||
\texttt{\#:pretty-name}
|
||||
\index{\#:pretty@\texttt{\#:pretty} reader syntax}
|
||||
|
||||
Ikarus's \texttt{read} and \texttt{write} procedures extends the
|
||||
lexical syntax of Scheme by the ability to read and write gensyms
|
||||
|
@ -1833,9 +1845,8 @@ string-normalize-nfkc string-normalize-nfkd
|
|||
The following procedures are missing from \texttt{(rnrs arithmetic
|
||||
bitwise)}:
|
||||
\begin{Verbatim}
|
||||
bitwise-ior bitwise-xor bitwise-if
|
||||
bitwise-ior bitwise-xor bitwise-if bitwise-bit-field
|
||||
bitwise-copy-bit-field bitwise-bit-set? bitwise-copy-bit
|
||||
bitwise-first-bit-set bitwise-bit-count bitwise-bit-field
|
||||
bitwise-reverse-bit-field bitwise-rotate-bit-field bitwise-length
|
||||
\end{Verbatim}
|
||||
|
||||
|
@ -1843,14 +1854,12 @@ bitwise-reverse-bit-field bitwise-rotate-bit-field bitwise-length
|
|||
The following procedures are missing from \texttt{(rnrs arithmetic
|
||||
fixnum)}:
|
||||
\begin{Verbatim}
|
||||
fxbit-count fxbit-field fxbit-set? fxcopy-bit fxcopy-bit-field
|
||||
fxfirst-bit-set fxlength fxreverse-bit-field fxrotate-bit-field
|
||||
fxreverse-bit-field fxrotate-bit-field
|
||||
\end{Verbatim}
|
||||
|
||||
|
||||
The following procedures are missing from \texttt{(rnrs hashtables)}:
|
||||
\begin{Verbatim}
|
||||
hashtable-copy
|
||||
make-eqv-hashtable make-hashtable
|
||||
hashtable-hash-function hashtable-equivalence-function
|
||||
equal-hash string-hash string-ci-hash symbol-hash
|
||||
|
@ -1861,14 +1870,14 @@ equal-hash string-hash string-ci-hash symbol-hash
|
|||
The following procedures are missing from \texttt{(rnrs io ports)}:
|
||||
\begin{Verbatim}
|
||||
call-with-bytevector-output-port call-with-string-output-port
|
||||
binary-port? textual-port? port-eof?
|
||||
binary-port? textual-port? port-eof?
|
||||
port-has-port-position? port-position
|
||||
port-has-set-port-position!? set-port-position!
|
||||
call-with-port close-port
|
||||
get-bytevector-all get-bytevector-some
|
||||
get-bytevector-n get-bytevector-n!
|
||||
get-char put-char lookahead-char
|
||||
get-u8 lookahead-u8 put-u8
|
||||
lookahead-char
|
||||
lookahead-u8
|
||||
get-string-all get-string-n get-string-n! put-string
|
||||
get-datum put-datum
|
||||
make-custom-binary-input-port make-custom-binary-input/output-port
|
||||
|
@ -1876,7 +1885,6 @@ make-custom-binary-output-port make-custom-textual-input-port
|
|||
make-custom-textual-input/output-port make-custom-textual-output-port
|
||||
open-bytevector-input-port open-bytevector-output-port
|
||||
open-file-input-port open-file-input/output-port open-file-output-port
|
||||
open-string-input-port open-string-output-port
|
||||
output-port-buffer-mode
|
||||
transcoded-port port-transcoderput-bytevector
|
||||
standard-error-port standard-input-port standard-output-port
|
||||
|
|
Binary file not shown.
|
@ -16,7 +16,7 @@
|
|||
|
||||
(library (ikarus io-primitives)
|
||||
(export read-char unread-char peek-char write-char write-byte
|
||||
put-u8 put-char get-char
|
||||
put-u8 put-char get-char get-u8
|
||||
newline port-name input-port-name output-port-name
|
||||
close-input-port reset-input-port!
|
||||
flush-output-port close-output-port get-line)
|
||||
|
@ -25,7 +25,7 @@
|
|||
(ikarus system $fx)
|
||||
(ikarus system $ports)
|
||||
(except (ikarus) read-char unread-char peek-char write-char write-byte
|
||||
put-u8 put-char get-char
|
||||
put-u8 put-char get-char get-u8
|
||||
newline port-name input-port-name output-port-name
|
||||
close-input-port reset-input-port! flush-output-port
|
||||
close-output-port get-line))
|
||||
|
@ -108,6 +108,12 @@
|
|||
($read-char p)
|
||||
(error 'get-char "not an input-port" p))))
|
||||
|
||||
(define get-u8
|
||||
(lambda (p)
|
||||
(if (input-port? p)
|
||||
($get-u8 p)
|
||||
(error 'get-u8 "not an input-port" p))))
|
||||
|
||||
(define read-char
|
||||
(case-lambda
|
||||
[() ($read-char (current-input-port))]
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
(library (ikarus io-primitives unsafe)
|
||||
(export $write-char $write-byte $read-char $unread-char $peek-char
|
||||
(export $write-char $write-byte $read-char $get-u8 $unread-char $peek-char
|
||||
$reset-input-port! $flush-output-port
|
||||
$close-input-port $close-output-port)
|
||||
(import
|
||||
|
@ -75,6 +75,15 @@
|
|||
[else (($port-handler p) 'read-char p)]))
|
||||
(($port-handler p) 'read-char p)))))
|
||||
|
||||
(define $get-u8
|
||||
(lambda (p)
|
||||
(let ([idx ($port-index p)])
|
||||
(if ($fx< idx ($port-size p))
|
||||
(let ([b ($bytevector-u8-ref ($port-buffer p) idx)])
|
||||
($set-port-index! p ($fxadd1 idx))
|
||||
b)
|
||||
(($port-handler p) 'get-u8 p)))))
|
||||
|
||||
(define $peek-char
|
||||
(lambda (p)
|
||||
(let ([idx ($port-index p)])
|
||||
|
|
|
@ -125,6 +125,27 @@
|
|||
(error 'read-char "Cannot read from file"
|
||||
port-name)]))
|
||||
(error 'read-char "port is closed" p))))]
|
||||
[(get-u8 p)
|
||||
(unless (input-port? p)
|
||||
(error 'get-u8 "not an input port" p))
|
||||
(let ([idx ($port-index p)])
|
||||
(if ($fx< idx ($port-size p))
|
||||
(let ([b ($bytevector-u8-ref ($port-buffer p) idx)])
|
||||
($set-port-index! p ($fxadd1 idx))
|
||||
b)
|
||||
(if open?
|
||||
(let ([bytes
|
||||
(foreign-call "ikrt_read"
|
||||
fd ($port-buffer p))])
|
||||
(cond
|
||||
[($fx> bytes 0)
|
||||
($set-port-size! p bytes)
|
||||
($get-u8 p)]
|
||||
[($fx= bytes 0)
|
||||
(eof-object)]
|
||||
[else
|
||||
(error 'get-u8 "Cannot read from file" port-name)]))
|
||||
(error 'get-u8 "port is closed" p))))]
|
||||
[(peek-char p)
|
||||
(unless (input-port? p)
|
||||
(error 'peek-char "not an input port" p))
|
||||
|
|
|
@ -1 +1 @@
|
|||
1105
|
||||
1106
|
||||
|
|
|
@ -1067,7 +1067,8 @@
|
|||
[get-string-all r ip]
|
||||
[get-string-n r ip]
|
||||
[get-string-n! r ip]
|
||||
[get-u8 r ip]
|
||||
[get-u8 i r ip]
|
||||
[$get-u8 $io]
|
||||
[&i/o i r ip is fi]
|
||||
[&i/o-decoding i r ip]
|
||||
[i/o-decoding-error? i r ip]
|
||||
|
|
|
@ -573,7 +573,7 @@
|
|||
[get-string-all S ip]
|
||||
[get-string-n S ip]
|
||||
[get-string-n! S ip]
|
||||
[get-u8 S ip]
|
||||
[get-u8 C ip]
|
||||
[&i/o C ip is fi]
|
||||
[&i/o-decoding C ip]
|
||||
[i/o-decoding-error? C ip]
|
||||
|
@ -631,8 +631,8 @@
|
|||
[open-file-input-port S ip]
|
||||
[open-file-input/output-port S ip]
|
||||
[open-file-output-port S ip]
|
||||
[open-string-input-port S ip]
|
||||
[open-string-output-port S ip]
|
||||
[open-string-input-port C ip]
|
||||
[open-string-output-port C ip]
|
||||
[output-port-buffer-mode S ip]
|
||||
[port-eof? S ip]
|
||||
[port-has-port-position? S ip]
|
||||
|
|
Loading…
Reference in New Issue