(flo:vector-set!
nth-row
m
- (exact->inexact (char->ascii (read-char port)))))))))
+ (exact->inexact (char->integer (read-char port)))))))))
(picture-set-data! pic data)
pic))
\f
(if (>= row 0)
(let ((rowvals
(map (cond ((= pmin pmax)
- (lambda (x) x (ascii->char 0)))
+ (lambda (x) x (integer->char 0)))
(else
(let ((scale (/ 255. (- pmax pmin))))
(lambda (x)
- (ascii->char
+ (integer->char
(round->exact (* (- x pmin) scale)))))))
(flo:vector->list (vector-ref data row)))))
(begin
FLO:TRUNCATE->EXACT FLO:ROUND->EXACT
;; Random
- OBJECT-TYPE CHAR-ASCII? ASCII->CHAR CHAR->INTEGER CHAR-BITS CHAR-CODE
+ OBJECT-TYPE CHAR->INTEGER CHAR-BITS CHAR-CODE
CHAR-DOWNCASE CHAR-UPCASE INTEGER->CHAR MAKE-CHAR
PRIMITIVE-PROCEDURE-ARITY
(LAP (MOV B ,target ,source))))
(define (char->signed-8-bit-immediate character)
- (let ((ascii (char->ascii character)))
+ (let ((ascii (char->integer character)))
(if (< ascii 128) ascii (- ascii 256))))
\f
;;;; Utilities specific to rules1
(define-rule statement
(ASSIGN (REGISTER (? target))
(CHAR->ASCII (CONSTANT (? char))))
- (QUALIFIER (and (char? char) (char-ascii? char)))
+ (QUALIFIER (ascii-char? char))
(inst:load-immediate (word-target target)
(object-datum char)))
(LAP (MOV B ,target ,source))))
(define (char->signed-8-bit-immediate character)
- (let ((ascii (char->ascii character)))
+ (let ((ascii (char->integer character)))
(if (< ascii 128) ascii (- ascii 256))))
\f
;;;; Utilities specific to rules1
value)))
(define (operation/write-char port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(region-insert-char! (port/state port) char))
(define (operation/write-substring port string start end)
(if (input-event? input)
(abort-current-command input)
(begin
- (if (not (and (char? input) (char-ascii? input)))
+ (if (not (ascii-char? input))
(editor-error "Can't quote non-ASCII char:" input))
(set-command-prompt!
(string-append (command-prompt) (key-name input)))
(let ((char (read-ascii-char)))
(let ((digit (char->digit char 4)))
(if digit
- (ascii->char
+ (integer->char
(let ((digit2 (read-digit)))
(let ((digit3 (read-digit)))
(+ (* (+ (* digit 8) digit2) 8) digit3))))
(write (port/mark port) output))
(define (operation/write-char port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(region-insert-char! (port/mark port) char)
1)
(define-integrable (%window-char->image window char)
(vector-ref (%window-char-image-strings window)
- (char->ascii char)))
+ (char->integer char)))
(define-integrable (%window-point window)
(with-instance-variables buffer-window window () point))
(make-port-type
`((WRITE-CHAR
,(lambda (port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(region-insert-char! (port/state port) char)
1))
(PROMPT-FOR-CONFIRMATION
;;; Output operations
(define (operation/write-char port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(enqueue-output-string! port (string char))
1)
(prompt-for-typein (string-append prompt ": ") #f
(lambda ()
(let ((input (with-editor-interrupts-disabled keyboard-read)))
- (if (and (char? input) (char-ascii? input))
+ (if (ascii-char? input)
(set-typein-string! (key-name input) #t))
(if (input-event? input)
(abort-typein-edit input)
input))))))
- (if (not (and (char? input) (char-ascii? input)))
+ (if (not (ascii-char? input))
(editor-error "Not an ASCII character:" input))
input))
(set! phrase (string-head phrase length))
(string-fill! phrase* #\NUL)
(set! phrase* #f)))))
- ((and (char? input) (char-ascii? input))
+ ((ascii-char? input)
(set! phrase* phrase)
(set! phrase
(string-append phrase (string input)))
(define (modify-syntax-entries! syntax-table cl ch string)
(set-char-syntax! syntax-table
- (ascii-range->char-set (char->ascii cl) (char->ascii ch))
+ (ascii-range->char-set (char->integer cl)
+ (char->integer ch))
string))
(define (group-syntax-table-entries group)
(lambda (bottom top)
(let ((describe-char
(lambda (ascii)
- (emacs-key-name (ascii->char ascii) #f)))
+ (emacs-key-name (integer->char ascii) #f)))
(top (- top 1)))
(if (= bottom top)
(describe-char bottom)
(if (not (zero? match))
(begin
(write-string ", matches ")
- (write-string (emacs-key-name (ascii->char match) #f)))))
+ (write-string (emacs-key-name (integer->char match) #f)))))
(let ((decode-comment-bit
(lambda (code pos se style)
(if (not (fix:= 0 (fix:and code entry)))
(message (if (group-end? point)
""
(let ((char (mark-right-char point)))
- (let ((n (char->ascii char)))
+ (let ((n (char->integer char)))
(string-append "Char: " (key-name char)
" ("
(if (zero? n) "" "0")
(make-port window-output-port-type window))
(define (operation/write-char port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(let ((window (port/state port)))
(let ((buffer (window-buffer window))
(point (window-point window)))
(list->string (make-initialized-list length
(lambda (i)
(declare (ignore i))
- (ascii->char (random 256))))))
+ (integer->char (random 256))))))
(if (not (member "tripledes" (mcrypt-algorithm-names)))
(error "No tripledes."))
(and (char? object)
(fix:< (char->integer object) #x100)))
-(define (guarantee-8-bit-char object #!optional caller)
- caller
- (if (not (8-bit-char? object))
- (error:not-8-bit-char object)))
-
-(define (char-ascii? char)
- (let ((n (char->integer char)))
- (and (fix:< n #x100)
- n)))
-
-(define (char->ascii char)
- (guarantee-8-bit-char char 'CHAR->ASCII)
- (char->integer char))
-
-(define (ascii->char code)
- (guarantee-limited-index-fixnum code #x100 'ASCII->CHAR)
- (%make-char code 0))
-
-(define (chars->ascii chars)
- (map char->ascii chars))
+(define (ascii-char? object)
+ (and (char? object)
+ (char-ascii? object)))
+
+(define-integrable (char-ascii? char)
+ (fix:< (char->integer char) #x100))
(define (char=? x y)
(fix:= (char->integer x) (char->integer y)))
(define (get-char-syntax table char)
(vector-ref (guarantee-char-syntax-table table 'GET-CHAR-SYNTAX)
- (char->ascii char)))
+ (char->integer char)))
(define (set-char-syntax! table char string)
(let ((entries (guarantee-char-syntax-table table 'SET-CHAR-SYNTAX!))
(entry (string->char-syntax string)))
(cond ((char? char)
- (vector-set! entries (char->ascii char) entry))
+ (vector-set! entries (char->integer char) entry))
((char-set? char)
(for-each (lambda (char)
- (vector-set! entries (char->ascii char) entry))
+ (vector-set! entries (char->integer char) entry))
(char-set-members char)))
(else
(error:wrong-type-argument char "character" 'SET-CHAR-SYNTAX!)))))
(let ((match (fix:and #xff (fix:lsh entry -4))))
(if (zero? match)
" "
- (string (ascii->char match))))
+ (string (integer->char match))))
(let ((cbits (fix:and #xFF (fix:lsh entry -12))))
(string-append
(if (fix:= 0 (fix:and #x40 cbits)) "" "1")
(let ((table (make-vector 256 parse-default)))
(for-each (lambda (entry)
(vector-set! table
- (char->ascii (car entry))
+ (char->integer (car entry))
(cadr entry)))
(let ((format-string
(format-wrapper (format-object display)))
(#\@ ,(parse-modifier 'AT))
(#\: ,(parse-modifier 'COLON))
(#\%
- ,(format-wrapper (format-insert-character #\Newline)))
+ ,(format-wrapper (format-insert-character #\newline)))
(#\~ ,(format-wrapper (format-insert-character #\~)))
(#\; ,(format-wrapper format-ignore-comment))
- (#\Newline ,(format-wrapper format-ignore-whitespace))
+ (#\newline ,(format-wrapper format-ignore-whitespace))
(#\A ,format-string)
(#\a ,format-string)
(#\S ,format-object)
(let ((table (make-vector 256 false)))
(for-each (lambda (entry)
(vector-set! table
- (char->ascii (car entry))
+ (char->integer (car entry))
(cadr entry)))
`((#\B ,^B-interrupt-handler)
(#\G ,^G-interrupt-handler)
(update-checksum checksum output-string index
count))
(rcm-iter key1 count output-string index))))
- (let ((check-char (ascii->char (modulo (- checksum) ts))))
+ (let ((check-char (integer->char (modulo (- checksum) ts))))
(let ((cc-string (char->string check-char)))
(rcm key1 1 cc-string)
(string-set! output-string
(make-textual-port-type
`((WRITE-CHAR
,(lambda (port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(update (textual-port-state port) (string char) 0 1)
1))
(WRITE-SUBSTRING
(make-textual-port-type
`((WRITE-CHAR
,(lambda (port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(let ((state (textual-port-state port)))
(let ((port (binhex40-rld-state/port state))
(char* (binhex40-rld-state/char state)))
(make-textual-port-type
`((WRITE-CHAR
,(lambda (port char)
- (guarantee-8-bit-char char)
+ (guarantee 8-bit-char? char)
(case (binhex40-decon/state (textual-port-state port))
((READING-HEADER) (binhex40-decon-reading-header port char))
((COPYING-DATA) (binhex40-decon-copying-data port char))
(lambda ()
;; MIT/GNU Scheme: misc
(register-predicate! 8-bit-char? '8-bit-char '<= char?)
+ (register-predicate! ascii-char? 'ascii-char '<= 8-bit-char?)
(register-predicate! bit-string? 'bit-string)
(register-predicate! cell? 'cell)
(register-predicate! compiled-code-address? 'compiled-code-address)
(cached-procedure 16
(lambda (pattern case-fold?)
(let* ((output (list 'OUTPUT))
- (ctx (make-rgxcmpctx (map char->ascii (string->list pattern))
+ (ctx (make-rgxcmpctx (map char->integer (string->list pattern))
#f ;current-byte
(re-translation-table case-fold?)
output ;output-head
(if (not (stack-empty? ctx))
(compilation-error ctx "Unmatched \\("))
(make-compiled-regexp
- (list->string (map ascii->char (cdr (output-head ctx))))
+ (list->string (map integer->char (cdr (output-head ctx))))
case-fold?))
(begin
(compile-pattern-char ctx)
char)))
(define (input-match? byte . chars)
- (memv (ascii->char byte) chars))
+ (memv (integer->char byte) chars))
\f
;;;; Output
(caddr (list-ref (stack ctx) i)))
(define (ascii->syntax-entry ascii)
- ((ucode-primitive string->syntax-entry) (char->string (ascii->char ascii))))
+ ((ucode-primitive string->syntax-entry) (char->string (integer->char ascii))))
\f
;;;; Pattern Dispatch
(pointer-operate! (pending-exact ctx) 1+))))
(define (define-pattern-char char procedure)
- (vector-set! pattern-chars (char->ascii char) procedure)
+ (vector-set! pattern-chars (char->integer char) procedure)
unspecific)
(define pattern-chars
((vector-ref backslash-chars (input-peek-1 ctx)) ctx)))))
(define (define-backslash-char char procedure)
- (vector-set! backslash-chars (char->ascii char) procedure)
+ (vector-set! backslash-chars (char->integer char) procedure)
unspecific)
(define backslash-chars
(let ((invert?
(and (input-match? (input-peek ctx) #\^)
(begin (input-discard! ctx) #t)))
- (charset (make-string 32 (ascii->char 0))))
+ (charset (make-string 32 (integer->char 0))))
(if (input-end? ctx)
(premature-end ctx))
(let loop
(for-each
(lambda (char)
((ucode-primitive re-char-set-adjoin!) charset
- (char->ascii char)))
+ (char->integer char)))
(char-set-members
(re-compile-char-set
- (list->string (map ascii->char (reverse! chars)))
+ (list->string (map integer->char (reverse! chars)))
#f))))
(loop (cons char chars)))))
(output-start! ctx (if invert? re-code:not-char-set re-code:char-set))
;; BEGIN deprecated bindings
(error:not-wide-char error:not-unicode-char)
(guarantee-wide-char guarantee-unicode-char)
+ (wide-char? unicode-char?)
error:not-char
error:not-radix
error:not-unicode-char
guarantee-unicode-char
guarantee-unicode-scalar-value
;; END deprecated bindings
- (wide-char? unicode-char?)
8-bit-char?
- ascii->char
- char->ascii
+ ascii-char?
char->digit
char->integer
char->name
char>=?
char>?
char?
- chars->ascii
clear-char-bits
code->char
decode-utf16be-char
encode-utf32be-char!
encode-utf32le-char!
encode-utf8-char!
- guarantee-8-bit-char
initial-byte->utf8-char-length
initial-u16->utf16-char-length
initial-u32->utf32-char-length
result))))
(define (make-vector-8b length #!optional ascii)
- (make-string length (if (default-object? ascii) ascii (ascii->char ascii))))
+ (make-string length (if (default-object? ascii) ascii (integer->char ascii))))
(define (string-fill! string char #!optional start end)
(substring-fill! string
(else (error:wrong-type-argument object "string component" caller))))
(define (char->string char)
- (guarantee-8-bit-char char 'CHAR->STRING)
+ (guarantee 8-bit-char? char 'CHAR->STRING)
(make-string 1 char))
(define (list->string chars)
(let loop ((chars chars) (index 0))
(if (pair? chars)
(begin
- (guarantee-8-bit-char (car chars))
+ (guarantee 8-bit-char? (car chars))
(string-set! result index (car chars))
(loop (cdr chars) (fix:+ index 1)))
result))))
(j start* (fix:+ j 1)))
((not (fix:< i limit))
(set! index i))
- (bytevector-u8-set! bv j (char->ascii (ustring-ref string i)))))
+ (bytevector-u8-set! bv j (char->integer (ustring-ref string i)))))
n)))))
(define (make-octets-input-type)
(*unparse-string string)))
(define (char->octal char)
- (let ((qr1 (integer-divide (char->ascii char) 8)))
+ (let ((qr1 (integer-divide (char->integer char) 8)))
(let ((qr2 (integer-divide (integer-divide-quotient qr1) 8)))
(string (digit->char (integer-divide-quotient qr2) 8)
(digit->char (integer-divide-remainder qr2) 8)
(loop (fix:+ i 1)))
#t)))
-(define-integrable (char-ascii? char)
- (fix:< (char->integer char) #x80))
-
(define (min-length string-length string strings)
(do ((strings strings (cdr strings))
(n (string-length string)
&>
BIT-STRING?
CELL?
- CHAR-ASCII?
CHAR?
EQ?
EQUAL-FIXNUM?
&/
-1+
1+
- ASCII->CHAR
CELL?
- CHAR->ASCII
CHAR->INTEGER
- CHAR-ASCII?
CHAR-BITS
CHAR-CODE
CHAR-DOWNCASE
(cond ((and (= keysym (C-enum "XK_BackSpace"))
(= nbytes 1)
(= (C-> buffer "char")
- (char->ascii #\backspace)))
+ (char->integer #\backspace)))
(char->string #\Delete))
((> nbytes 0)
(let ((s (make-string nbytes)))
(let loop ((index 0))
(if (< index length)
(begin
- (string-set! result index (ascii->char (c-> scan "uchar")))
+ (string-set! result index (integer->char (c-> scan "uchar")))
(alien-byte-increment! scan (c-sizeof "uchar"))
(loop (1+ index)))))
result))
(define (xterm-write-char! xterm x y char highlight)
(let ((code (c-call "xterm_write_char"
- xterm x y (char->ascii char) highlight)))
+ xterm x y (char->integer char) highlight)))
(case code
((1) (error:bad-range-argument x 'xterm-write-char!))
((2) (error:bad-range-argument y 'xterm-write-char!))
(chars (malloc (1+ (* (c-sizeof "char") (string-length string)))
'(* char)))
(callback-id (C-callback (lambda (d) (* d pi)))))
- (C->= struct "TestStruct first" (char->ascii #\A))
+ (C->= struct "TestStruct first" (char->integer #\A))
(C->= struct "TestStruct second" pi)
- (C->= struct "TestStruct third" (char->ascii #\C))
+ (C->= struct "TestStruct third" (char->integer #\C))
(c-poke-string chars string)
(C->= struct "TestStruct fourth" chars)
(C-call "test_register_double"