* Added latin-1-codec, utf-8-codec, utf-16-codec to (ikarus codecs)

library.  They simply return the corresponding codec symbol.
This commit is contained in:
Abdulaziz Ghuloum 2007-10-11 21:28:08 -04:00
parent cc04411d97
commit f7beb1afe0
5 changed files with 115 additions and 71 deletions

Binary file not shown.

8
src/ikarus.codecs.ss Normal file
View File

@ -0,0 +1,8 @@
(library (ikarus codecs)
(export latin-1-codec utf-8-codec utf-16-codec)
(import (rnrs base))
(define (latin-1-codec) 'latin-1-codec)
(define (utf-8-codec) 'utf-8-codec)
(define (utf-16-codec) 'utf-16-codec))

View File

@ -1829,10 +1829,45 @@
(define disp-code-annotation 16)
(define disp-code-data 24)
(define port-tag #x3F)
(define output-port-tag #x7F)
(define input-port-tag #xBF)
(define port-mask #x3F)
(define transcoder-tag #x3F) ;;; 0011
(define transcoder-input-tag #x7F) ;;; 0111
(define transcoder-output-tag #xBF) ;;; 1011
(define transcoder-input/output-tag #xFF) ;;; 1111
(define transcoder-write-utf8-mask #x100)
(define transcoder-write-byte-mask #x200)
(define transcoder-read-utf8-mask #x400)
(define transcoder-read-byte-mask #x800)
(define transcoder-handling-mode-shift 8)
(define transcoder-handling-mode-bits 2)
(define transcoder-eol-style-shift 10)
(define transcoder-eol-style-bits 3)
(define transcoder-codec-shift 13)
(define transcoder-codec-bits 3)
(define transcoder-handling-mode:none #b00)
(define transcoder-handling-mode:ignore #b01)
(define transcoder-handling-mode:raise #b10)
(define transcoder-handling-mode:replace #b11)
(define transcoder-eol-style:none #b000)
(define transcoder-eol-style:lf #b001)
(define transcoder-eol-style:cr #b010)
(define transcoder-eol-style:crlf #b011)
(define transcoder-eol-style:nel #b100)
(define transcoder-eol-style:crnel #b101)
(define transcoder-eol-style:ls #b110)
(define transcoder-codec:none #b000)
(define transcoder-codec:latin-1 #b001)
(define transcoder-codec:utf-8 #b010)
(define transcoder-codec:utf-16 #b011)
(define port-tag #x3F) ;;; 0011_F
(define output-port-tag #x7F) ;;; 0011_F
(define input-port-tag #xBF) ;;; 1011_F
(define port-mask #x3F) ;;; 0011_F
(define port-type-mask #xFF) ;;; 1111_F
(define disp-port-buffer 4)
(define disp-port-index 8)
(define disp-port-size 12)
@ -1967,7 +2002,7 @@
"~s is not a valid location for ~s" x op))
x)]
[else
(error 'compile "cannot find location of primitive ~s" op)]))
(error #f "~s is not supported yet" op)]))
(define (primref-loc op)
(mem (fx- disp-symbol-record-proc record-tag)

View File

@ -46,6 +46,7 @@
"ikarus.numerics.ss"
"ikarus.guardians.ss"
"ikarus.command-line.ss"
"ikarus.codecs.ss"
"ikarus.io-ports.ss"
"ikarus.io-primitives.unsafe.ss"
"ikarus.io-primitives.ss"
@ -1025,7 +1026,7 @@
[make-i/o-port-error r ip is fi]
[make-i/o-read-error r ip is fi]
[make-i/o-write-error r ip is fi]
[latin-1-codec r ip]
[latin-1-codec i r ip]
[make-transcoder r ip]
[native-eol-style r ip]
[native-transcoder r ip]
@ -1058,8 +1059,8 @@
[transcoder-codec r ip]
[transcoder-eol-style r ip]
[transcoder-error-handling-mode r ip]
[utf-16-codec r ip]
[utf-8-codec r ip]
[utf-16-codec i r ip]
[utf-8-codec i r ip]
[input-port? i r is ip se]
[output-port? i r is ip se]
[current-input-port i r ip is se]

View File

@ -495,13 +495,13 @@
[with-exception-handler X ex]
[guard X ex]
;;;
[binary-port? D ip]
[buffer-mode D ip]
[buffer-mode? D ip]
[bytevector->string D ip]
[call-with-bytevector-output-port D ip]
[call-with-port D ip]
[call-with-string-output-port D ip]
[binary-port? S ip]
[buffer-mode S ip]
[buffer-mode? S ip]
[bytevector->string S ip]
[call-with-bytevector-output-port S ip]
[call-with-port S ip]
[call-with-string-output-port S ip]
;;;
[assoc C ls se]
[assp C ls]
@ -543,22 +543,22 @@
[quotient C r5 se]
[scheme-report-environment C r5 se]
;;;
[close-port D ip]
[eol-style D ip]
[error-handling-mode D ip]
[file-options D ip]
[flush-output-port D ip]
[get-bytevector-all D ip]
[get-bytevector-n D ip]
[get-bytevector-n! D ip]
[get-bytevector-some D ip]
[get-char D ip]
[get-datum D ip]
[get-line D ip]
[get-string-all D ip]
[get-string-n D ip]
[get-string-n! D ip]
[get-u8 D ip]
[close-port S ip]
[eol-style S ip]
[error-handling-mode S ip]
[file-options S ip]
[flush-output-port S ip]
[get-bytevector-all S ip]
[get-bytevector-n S ip]
[get-bytevector-n! S ip]
[get-bytevector-some S ip]
[get-char S ip]
[get-datum S ip]
[get-line S ip]
[get-string-all S ip]
[get-string-n S ip]
[get-string-n! S ip]
[get-u8 S ip]
[&i/o X ip is fi]
[&i/o-decoding X ip]
[i/o-decoding-error? X ip]
@ -586,15 +586,15 @@
[i/o-read-error? X ip is fi]
[&i/o-write X ip is fi]
[i/o-write-error? X ip is fi]
[lookahead-char D ip]
[lookahead-u8 D ip]
[lookahead-char S ip]
[lookahead-u8 S ip]
[make-bytevector C bv]
[make-custom-binary-input-port D ip]
[make-custom-binary-input-port S ip]
[make-custom-binary-input/output-port D ip]
[make-custom-binary-output-port D ip]
[make-custom-textual-input-port D ip]
[make-custom-binary-output-port S ip]
[make-custom-textual-input-port S ip]
[make-custom-textual-input/output-port D ip]
[make-custom-textual-output-port D ip]
[make-custom-textual-output-port S ip]
[make-i/o-decoding-error X ip]
[make-i/o-encoding-error X ip]
[make-i/o-error X ip is fi]
@ -607,41 +607,41 @@
[make-i/o-port-error X ip is fi]
[make-i/o-read-error X ip is fi]
[make-i/o-write-error X ip is fi]
[latin-1-codec D ip]
[make-transcoder D ip]
[native-eol-style D ip]
[native-transcoder D ip]
[open-bytevector-input-port D ip]
[open-bytevector-output-port D ip]
[open-file-input-port D ip]
[latin-1-codec C ip]
[make-transcoder S ip]
[native-eol-style S ip]
[native-transcoder S ip]
[open-bytevector-input-port S ip]
[open-bytevector-output-port S ip]
[open-file-input-port S ip]
[open-file-input/output-port D ip]
[open-file-output-port D ip]
[open-string-input-port D ip]
[open-string-output-port D ip]
[output-port-buffer-mode D ip]
[port-eof? D ip]
[port-has-port-position? D ip]
[port-has-set-port-position!? D ip]
[port-position D ip]
[port-transcoder D ip]
[port? D ip]
[put-bytevector D ip]
[put-char D ip]
[put-datum D ip]
[put-string D ip]
[put-u8 D ip]
[set-port-position! D ip]
[standard-error-port D ip]
[standard-input-port D ip]
[standard-output-port D ip]
[string->bytevector D ip]
[textual-port? D ip]
[transcoded-port D ip]
[transcoder-codec D ip]
[transcoder-eol-style D ip]
[transcoder-error-handling-mode D ip]
[utf-16-codec D ip]
[utf-8-codec D ip]
[open-file-output-port S ip]
[open-string-input-port S ip]
[open-string-output-port S ip]
[output-port-buffer-mode S ip]
[port-eof? S ip]
[port-has-port-position? S ip]
[port-has-set-port-position!? S ip]
[port-position S ip]
[port-transcoder S ip]
[port? S ip]
[put-bytevector S ip]
[put-char S ip]
[put-datum S ip]
[put-string S ip]
[put-u8 S ip]
[set-port-position! S ip]
[standard-error-port S ip]
[standard-input-port S ip]
[standard-output-port S ip]
[string->bytevector S ip]
[textual-port? S ip]
[transcoded-port S ip]
[transcoder-codec S ip]
[transcoder-eol-style S ip]
[transcoder-error-handling-mode S ip]
[utf-16-codec C ip]
[utf-8-codec C ip]
;;;
[input-port? C is ip se]
[output-port? C is ip se]