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 s

⟦9bb46bfe5⟧ TextFile

    Length: 3439 (0xd6f)
    Types: TextFile
    Names: »string.scm.4«

Derivation

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

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) String Operations

(declare (usual-integrations))
\f


;;;; Primitives

(define make-empty-string (make-primitive-procedure 'MAKE-EMPTY-STRING))
(define make-filled-string (make-primitive-procedure 'MAKE-FILLED-STRING))
(define string-size (make-primitive-procedure 'STRING-LENGTH))
(define string-ref (make-primitive-procedure 'STRING-REF))
(define string-set! (make-primitive-procedure 'STRING-SET!))
(define string-position (make-primitive-procedure 'STRING-POSITION))

(define string-equal? (make-primitive-procedure 'STRING-EQUAL?))
(define string-less? (make-primitive-procedure 'STRING-LESS?))
(define substring-search (make-primitive-procedure 'SUBSTRING-SEARCH))
(define substring (make-primitive-procedure 'SUBSTRING))
(define insert-string (make-primitive-procedure 'INSERT-STRING))

(define insert-string! (make-primitive-procedure 'INSERT-STRING!))
(define truncate-string! (make-primitive-procedure 'TRUNCATE-STRING!))

(define string-upcase (make-primitive-procedure 'STRING-UPCASE))
(define list->string (make-primitive-procedure 'LIST->STRING))
\f


(define string? (microcode-type-predicate 'STRING))

(define string->list
  (let ((substring->list (make-primitive-procedure 'SUBSTRING->LIST)))
    (named-lambda (string->list string)
      (substring->list string 0 (string-size string)))))

(define (string-copy string)
  (substring string 0 (string-size string)))

(define (character->string . characters)
  (list->string characters))

(define (string-append . strings)
  (let loop ((accumulator "")
	     (strings strings))
    (if (null? strings)
	accumulator
	(loop (insert-string accumulator
			     (string-size accumulator)
			     (car strings))
	      (cdr strings)))))

(define (string-maximum-size string)
  (if (string? string)
      (* (-1+ (primitive-datum (system-vector-size string))) 4)
      (error "Wrong type argument" 'STRING-MAXIMUM-SIZE string)))