DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T c

⟦63ce2f6ae⟧ TextFile

    Length: 3819 (0xeeb)
    Types: TextFile
    Names: »char.scm.11«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/gnu-31mar87/scheme/scm/char.scm.11« 

TextFile

;;; -*-Scheme-*-
;;;
;;;	Copyright (c) 1984 Massachusetts Institute of Technology
;;;
;;;	This material was developed by the Scheme project at the
;;;	Massachusetts Institute of Technology, Department of
;;;	Electrical Engineering and Computer Science.  Permission to
;;;	copy this software, to redistribute it, and to use it for any
;;;	purpose is granted, subject to the following restrictions and
;;;	understandings.
;;;
;;;	1. Any copy made of this software must include this copyright
;;;	notice in full.
;;;
;;;	2. Users of this software agree to make their best efforts (a)
;;;	to return to the MIT Scheme project any improvements or
;;;	extensions that they make, so that these may be included in
;;;	future releases; and (b) to inform MIT of noteworthy uses of
;;;	this software.
;;;
;;;	3.  All materials developed as a consequence of the use of
;;;	this software shall duly acknowledge such use, in accordance
;;;	with the usual standards of acknowledging credit in academic
;;;	research.
;;;
;;;	4. MIT has made no warrantee or representation that the
;;;	operation of this software will be error-free, and MIT is
;;;	under no obligation to provide any services, by way of
;;;	maintenance, update, or otherwise.
;;;
;;;	5.  In conjunction with products arising from the use of this
;;;	material, there shall be no use of the name of the
;;;	Massachusetts Institute of Technology nor of any adaptation
;;;	thereof in any advertising, promotional, or sales literature
;;;	without prior written consent from MIT in each case.
;;;

;;;; Character Definitions

(declare (usual-integrations))
\f


(define character-equal? (make-primitive-procedure '&=))
(define character-upcase (make-primitive-procedure 'CHARACTER-UPCASE))
(define character?)

(define character-package
  (make-package character-package
		((carriage-return 
		  (access carriage-return implementation-dependencies))
		 (space (access space implementation-dependencies))
		 (line-feed (access line-feed implementation-dependencies))
		 (end-of-line (access end-of-line implementation-dependencies))
		 (tab (access tab implementation-dependencies))
		 (end-of-file (access end-of-file implementation-dependencies))
		 (input-terminator
		  (access input-terminator implementation-dependencies))
		 (form-feed (access form-feed implementation-dependencies))
		 (whitespace (access whitespace implementation-dependencies))

		 (*number-of-characters* 256.)
		 (*number-of-characters-in-ascii* 128.))

(set! character?
      (named-lambda (character? object)
	(conjunction (integer? object)
		     (< -1 object *number-of-characters*))))

(define (numerical-value char)
  (- char #/0))

(define (make-character-dispatch-vector default)
  (vector-cons *number-of-characters* default))

(define (input-terminator? char)
  (character-equal? char input-terminator))
\f


;;;; Table Generators

(define (for-each-character proc)
  (define (loop n)
    (if (not (= n *number-of-characters*))
	(sequence (proc n)
		  (loop (1+ n)))))
  (loop 0))

(define (make-character-predicate-table predicate)
  (make-initialized-vector-1b *number-of-characters* predicate))

(define ((make-character-predicate bit-table) char)
  (vector-1b-ref bit-table char))

;;; Useful bit tables:

(define *whitespace-bit*
  (make-character-predicate-table
   (lambda (char)
     (not (null? (memv char whitespace))))))

(define whitespace?
  (make-character-predicate *whitespace-bit*))

(define *alphabetic-bit*
  (make-character-predicate-table
   (lambda (char)
     (disjunction (<= #/a char #/z)
		  (<= #/A char #/Z)))))

(define alphabetic?
  (make-character-predicate *alphabetic-bit*))

(define *digit-bit*
  (make-character-predicate-table
   (lambda (char)
     (<= #/0 char #/9))))

(define digit?
  (make-character-predicate *digit-bit*))

;;; end CHARACTER-PACKAGE.
))