move most of the 'scheme' collection to the 'racket' collection

This commit is contained in:
Matthew Flatt 2010-04-20 15:24:48 -06:00
parent 3f8d1dc34d
commit c95a398754
302 changed files with 922 additions and 739 deletions

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(provide add-plt-segment
get/set-dylib-path)

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(provide bytes->utf-16-bytes
utf-16-bytes->bytes)

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require "config.ss")
(provide (all-from-out "config.ss"))

View File

@ -2,7 +2,7 @@
(require syntax/moddep
mzlib/class
scheme/private/namespace
racket/private/namespace
mred)
(provide eval/annotations

View File

@ -2,7 +2,7 @@
;; All of the implementation is actually in private/class-internal.ss,
;; which provides extra (private) functionality to contract.ss.
(require scheme/private/class-internal)
(require racket/private/class-internal)
(provide (rename class-traced class)
(rename class*-traced class*)

View File

@ -1,3 +1,3 @@
(module class mzscheme
(require scheme/private/class-internal)
(require racket/private/class-internal)
(provide-public-names))

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@ -25,37 +25,37 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; provide everything from the scheme/ implementation
;; provide everything from the racket/ implementation
;; except the arrow contracts
;;
(require scheme/contract/private/base
scheme/contract/private/misc
scheme/contract/private/provide
scheme/contract/private/guts
scheme/contract/private/ds
scheme/contract/private/opt
scheme/contract/private/basic-opters)
(require racket/contract/private/base
racket/contract/private/misc
racket/contract/private/provide
racket/contract/private/guts
racket/contract/private/ds
racket/contract/private/opt
racket/contract/private/basic-opters)
(provide
opt/c define-opt/c ;(all-from "private/contract-opt.ss")
(except-out (all-from-out scheme/contract/private/ds)
(except-out (all-from-out racket/contract/private/ds)
lazy-depth-to-look)
(all-from-out scheme/contract/private/base)
(all-from-out scheme/contract/private/provide)
(except-out (all-from-out scheme/contract/private/misc)
(all-from-out racket/contract/private/base)
(all-from-out racket/contract/private/provide)
(except-out (all-from-out racket/contract/private/misc)
check-between/c
string-len/c
check-unary-between/c)
(rename-out [or/c union])
(rename-out [string-len/c string/len])
(except-out (all-from-out scheme/contract/private/guts)
(except-out (all-from-out racket/contract/private/guts)
check-flat-contract
check-flat-named-contract))
;; copied here because not provided by scheme/contract anymore
;; copied here because not provided by racket/contract anymore
(define (flat-contract/predicate? pred)
(or (flat-contract? pred)
(and (procedure? pred)

View File

@ -1,8 +1,8 @@
#lang mzscheme
(require setup/main-collects
scheme/local
scheme/bool
racket/local
racket/bool
(only scheme/base
build-string
build-list

View File

@ -1,31 +1,13 @@
#lang mzscheme
#lang racket/base
;; The `first', etc. operations in this library
;; work on pairs, not lists.
(require (only scheme/base
foldl
foldr
remv
remq
remove
remv*
remq*
remove*
findf
memf
assf
filter
sort)
(only scheme/list
cons?
empty?
empty
last-pair))
(require (only-in scheme/list
cons?
empty?
empty
last-pair))
(provide first
second

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require scheme/match/legacy-match)
(provide (all-from-out scheme/match/legacy-match))
(require racket/match/legacy-match)
(provide (all-from-out racket/match/legacy-match))

View File

@ -1,4 +1,4 @@
#lang scheme/base
(require scheme/match/match)
(provide (all-from-out scheme/match/match))
(require racket/match/match)
(provide (all-from-out racket/match/match))

View File

@ -1,8 +1,7 @@
#lang scheme/base
#lang racket/base
(require (for-syntax scheme/base)
mzlib/etc
scheme/contract/base
(require (for-syntax racket/base)
racket/contract/base
mzlib/list
"private/port.ss")
@ -118,13 +117,13 @@
;; 0 always (which implies that the `read' proc must not return
;; a pipe input port).
(define make-input-port/read-to-peek
(opt-lambda (name read fast-peek close
[location-proc #f]
[count-lines!-proc void]
[init-position 1]
[buffer-mode-proc #f]
[buffering? #f]
[on-consumed #f])
(lambda (name read fast-peek close
[location-proc #f]
[count-lines!-proc void]
[init-position 1]
[buffer-mode-proc #f]
[buffering? #f]
[on-consumed #f])
(define lock-semaphore (make-semaphore 1))
(define commit-semaphore (make-semaphore 1))
(define-values (peeked-r peeked-w) (make-pipe))
@ -440,7 +439,7 @@
(buffer-mode-proc mode)])))))
(define peeking-input-port
(opt-lambda (orig-in [name (object-name orig-in)] [delta 0])
(lambda (orig-in [name (object-name orig-in)] [delta 0])
(make-input-port/read-to-peek
name
(lambda (s)
@ -452,11 +451,11 @@
void)))
(define relocate-input-port
(opt-lambda (p line col pos [close? #t])
(lambda (p line col pos [close? #t])
(transplant-to-relocate transplant-input-port p line col pos close?)))
(define transplant-input-port
(opt-lambda (p location-proc pos [close? #t] [count-lines!-proc void])
(lambda (p location-proc pos [close? #t] [count-lines!-proc void])
(make-input-port
(object-name p)
(lambda (s)
@ -486,7 +485,7 @@
;; thread when write evts are active; otherwise, we use a lock semaphore.
;; (Actually, the lock semaphore has to be used all the time, to guard
;; the flag indicating whether the manager thread is running.)
(opt-lambda ([limit (expt 2 64)] [in-name 'pipe] [out-name 'pipe])
(lambda ([limit (expt 2 64)] [in-name 'pipe] [out-name 'pipe])
(let-values ([(r w) (make-pipe limit)]
[(more) null]
[(more-last) #f]
@ -724,7 +723,7 @@
(values in out))))
(define input-port-append
(opt-lambda (close-orig? . ports)
(lambda (close-orig? . ports)
(make-input-port
(map object-name ports)
(lambda (str)
@ -815,7 +814,7 @@
(loop half skip)))))))
(define make-limited-input-port
(opt-lambda (port limit [close-orig? #t])
(lambda (port limit [close-orig? #t])
(let ([got 0])
(make-input-port
(object-name port)
@ -1208,13 +1207,13 @@
(loop (add1 i) (add1 j))]))))]))
(define reencode-input-port
(opt-lambda (port encoding [error-bytes #f] [close? #f]
[name (object-name port)]
[newline-convert? #f]
[decode-error (lambda (msg port)
(error 'reencode-input-port
(format "~a: ~e" msg)
port))])
(lambda (port encoding [error-bytes #f] [close? #f]
[name (object-name port)]
[newline-convert? #f]
[decode-error (lambda (msg port)
(error 'reencode-input-port
(format "~a: ~e" msg)
port))])
(let ([c (let ([c (bytes-open-converter encoding "UTF-8")])
(if newline-convert? (mcons c #f) c))]
[ready-bytes (make-bytes 1024)]
@ -1345,13 +1344,13 @@
;; --------------------------------------------------
(define reencode-output-port
(opt-lambda (port encoding [error-bytes #f] [close? #f]
[name (object-name port)]
[convert-newlines-to #f]
[decode-error (lambda (msg port)
(error 'reencode-input-port
(format "~a: ~e" msg)
port))])
(lambda (port encoding [error-bytes #f] [close? #f]
[name (object-name port)]
[convert-newlines-to #f]
[decode-error (lambda (msg port)
(error 'reencode-input-port
(format "~a: ~e" msg)
port))])
(let ([c (bytes-open-converter "UTF-8" encoding)]
[ready-bytes (make-bytes 1024)]
[ready-start 0]
@ -1664,7 +1663,7 @@
;; ----------------------------------------
(define dup-output-port
(opt-lambda (p [close? #f])
(lambda (p [close? #f])
(let ([new (transplant-output-port
p
(lambda () (port-next-location p))
@ -1677,7 +1676,7 @@
new)))
(define dup-input-port
(opt-lambda (p [close? #f])
(lambda (p [close? #f])
(let ([new (transplant-input-port
p
(lambda () (port-next-location p))

View File

@ -1,7 +1,7 @@
#lang scheme/base
#lang racket/base
(provide (all-defined-out))
(require scheme/contract/private/guts)
(require racket/contract/private/guts)
(define empty-case-lambda/c
(flat-named-contract '(case->)

View File

@ -4,7 +4,7 @@
(require (for-syntax scheme/base))
(require (for-template scheme/base)
(for-template scheme/contract/private/guts)
(for-template racket/contract/private/guts)
(for-template "contract-arr-checks.ss"))
(provide make-/proc ->/h ->*/h ->d/h ->d*/h ->r/h

View File

@ -1,11 +1,11 @@
#lang scheme/base
#lang racket/base
(require scheme/contract/private/guts
scheme/contract/private/opt
(require racket/contract/private/guts
racket/contract/private/opt
"contract-arr-checks.ss")
(require (for-syntax scheme/base)
(for-syntax scheme/contract/private/opt-guts)
(for-syntax scheme/contract/private/helpers)
(require (for-syntax racket/base)
(for-syntax racket/contract/private/opt-guts)
(for-syntax racket/contract/private/helpers)
(for-syntax "contract-arr-obj-helpers.ss")
(for-syntax syntax/stx)
(for-syntax syntax/name))

View File

@ -1,11 +1,11 @@
#lang scheme/base
#lang racket/base
(provide define/contract)
(require (for-syntax scheme/base
(require (for-syntax racket/base
unstable/srcloc
(prefix-in a: scheme/contract/private/helpers))
(only-in scheme/contract/private/base contract))
(prefix-in a: racket/contract/private/helpers))
(only-in racket/contract/private/base contract))
;; First, we have the old define/contract implementation, which
;; is still used in mzlib/contract.

View File

@ -1,11 +1,11 @@
#lang scheme/base
#lang racket/base
(require "contract-arrow.ss"
scheme/contract/private/guts
scheme/private/class-internal
racket/contract/private/guts
racket/private/class-internal
"contract-arr-checks.ss")
(require (for-syntax scheme/base
scheme/contract/private/helpers
(require (for-syntax racket/base
racket/contract/private/helpers
"contract-arr-obj-helpers.ss"))
(provide mixin-contract

View File

@ -3,15 +3,14 @@
;; used by contract.ss, which is used by port.ss --- so we
;; break the cycle with this module.
(module port mzscheme
(require "../etc.ss")
(module port racket/base
(provide open-output-nowhere
relocate-output-port
transplant-output-port
transplant-to-relocate)
(define open-output-nowhere
(opt-lambda ([name 'nowhere] [specials-ok? #t])
(lambda ([name 'nowhere] [specials-ok? #t])
(make-output-port
name
always-evt
@ -42,13 +41,13 @@
close?)))
(define relocate-output-port
(opt-lambda (p line col pos [close? #t])
(lambda (p line col pos [close? #t])
(transplant-to-relocate
transplant-output-port
p line col pos close?)))
(define transplant-output-port
(opt-lambda (p location-proc pos [close? #t] [count-lines!-proc void])
(lambda (p location-proc pos [close? #t] [count-lines!-proc void])
(make-output-port
(object-name p)
p

View File

@ -7,7 +7,7 @@
(require (for-template scheme/base
"unit-keywords.ss"
"unit-runtime.ss"))
(require scheme/private/define-struct)
(require racket/private/define-struct)
(provide (struct-out var-info)
(struct-out signature)

View File

@ -1,14 +1,14 @@
#lang scheme/base
#lang racket/base
(require (for-syntax scheme/base
(require (for-syntax racket/base
syntax/boundmap
syntax/name
syntax/parse
"unit-compiletime.ss"
"unit-contract-syntax.ss"
"unit-syntax.ss")
(for-meta 2 scheme/base)
scheme/contract/base
(for-meta 2 racket/base)
racket/contract/base
"unit-utils.ss"
"unit-runtime.ss")

View File

@ -4,7 +4,7 @@
syntax/boundmap
"unit-compiletime.ss"
"unit-syntax.ss")
scheme/contract/base)
racket/contract/base)
(provide (for-syntax build-key
check-duplicate-sigs

View File

@ -4,13 +4,13 @@
mzlib/etc
mzlib/list
;; core [de]serializer:
scheme/private/serialize)
racket/private/serialize)
(provide define-serializable-struct
define-serializable-struct/versions
;; core [de]serializer:
(all-from scheme/private/serialize))
(all-from racket/private/serialize))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; define-serializable-struct

View File

@ -16,7 +16,7 @@
"private/unit-syntax.ss"))
(require mzlib/etc
scheme/contract/base
racket/contract/base
scheme/stxparam
unstable/location
"private/unit-contract.ss"

View File

@ -1,4 +1,4 @@
(module config mzscheme
(module config racket/base
(require "private/define-config.ss")
(define-parameters
(PLANET-SERVER-NAME "planet.plt-scheme.org")

View File

@ -1,4 +1,5 @@
(module define-config mzscheme
(module define-config racket/base
(require (for-syntax racket/base))
(provide define-parameters)

4
collects/racket/base.rkt Normal file
View File

@ -0,0 +1,4 @@
#lang racket/private
(require "private/base.rkt")
(provide (all-from-out "private/base.rkt"))

View File

@ -1,5 +0,0 @@
#lang racket/private
(require "private/struct.rkt")
(provide (all-from-out scheme/base)
struct)

11
collects/racket/class.rkt Normal file
View File

@ -0,0 +1,11 @@
#lang racket/base
(require "contract/private/object.rkt")
(provide (all-from-out "contract/private/object.rkt"))
;; All of the implementation is actually in private/class-internal.rkt,
;; which provides extra (private) functionality to contract.rkt.
(require "private/class-internal.rkt")
(provide-public-names)
(provide generic?)

View File

@ -9,14 +9,15 @@ differences from v3:
|#
(require scheme/contract/exists
scheme/contract/regions
"contract/private/basic-opters.ss"
"contract/base.ss")
(require racket/contract/exists
racket/contract/regions
"contract/private/basic-opters.rkt"
"contract/base.rkt"
"private/define-struct.rkt")
(provide (all-from-out "contract/base.ss")
(except-out (all-from-out scheme/contract/exists) ∃?)
(all-from-out scheme/contract/regions))
(provide (all-from-out "contract/base.rkt")
(except-out (all-from-out racket/contract/exists) ∃?)
(all-from-out racket/contract/regions))
;; ======================================================================
;; The alternate implementation disables contracts. Its useful mainly to

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
;; A stripped down version of scheme/contract for use in
;; the PLT code base where appropriate.

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require "private/guts.ss")

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
#|
@ -20,8 +20,8 @@ v4 todo:
(require "guts.ss"
"opt.ss"
scheme/stxparam)
(require (for-syntax scheme/base)
racket/stxparam)
(require (for-syntax racket/base)
(for-syntax "opt-guts.ss")
(for-syntax "helpers.ss")
(for-syntax syntax/stx)

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
#|
@ -13,8 +13,8 @@ improve method arity mismatch contract violation error messages?
recursive-contract
current-contract-region)
(require (for-syntax scheme/base)
scheme/stxparam
(require (for-syntax racket/base)
racket/stxparam
unstable/srcloc
unstable/location
"guts.ss"

View File

@ -1,9 +1,9 @@
#lang scheme/base
#lang racket/base
(require "guts.ss"
"opt.ss"
"base.ss")
(require (for-syntax scheme/base
(require (for-syntax racket/base
"opt-guts.ss"))
;;

View File

@ -1,6 +1,6 @@
#lang scheme/base
#lang racket/base
(require unstable/srcloc scheme/pretty)
(require unstable/srcloc racket/pretty)
(provide blame?
make-blame

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(provide ensure-well-formed
build-func-params
build-clauses
@ -6,8 +6,7 @@
generate-arglists)
(require "opt-guts.ss")
(require (for-template scheme/base)
(for-syntax scheme/base))
(require (for-template racket/base))
#|

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
#|
@ -18,13 +18,11 @@ it around flattened out.
|#
(require "guts.ss"
"opt.ss"
mzlib/etc)
"opt.ss")
(require (for-syntax scheme/base)
(for-syntax "ds-helpers.ss")
(for-syntax "helpers.ss")
(for-syntax "opt-guts.ss")
(for-syntax mzlib/etc))
(for-syntax "opt-guts.ss"))
(provide define-contract-struct

View File

@ -1,11 +1,11 @@
#lang scheme/base
#lang racket/base
(require "helpers.ss"
"blame.ss"
"prop.ss"
scheme/pretty)
racket/pretty)
(require (for-syntax scheme/base
(require (for-syntax racket/base
"helpers.ss"))
(provide (except-out (all-from-out "blame.ss") make-blame)

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(provide mangle-id mangle-id-for-maker
build-struct-names
@ -9,8 +9,8 @@
known-good-contract?)
(require setup/main-collects
scheme/struct-info
(for-template scheme/base))
racket/struct-info
(for-template racket/base))
;; lookup-struct-info : syntax -> (union #f (list syntax syntax (listof syntax) ...))
(define (lookup-struct-info stx provide-stx)

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require "guts.ss" "blame.ss" unstable/srcloc)

View File

@ -1,10 +1,10 @@
#lang scheme/base
#lang racket/base
(require (for-syntax scheme/base
scheme/struct-info
(require (for-syntax racket/base
racket/struct-info
"helpers.ss"
"opt-guts.ss")
scheme/promise
racket/promise
"opt.ss"
"guts.ss")

View File

@ -1,7 +1,7 @@
#lang scheme/base
(require "arrow.ss"
"guts.ss"
scheme/private/class-internal
racket/private/class-internal
scheme/stxparam)
(require (for-syntax scheme/base))

View File

@ -1,8 +1,8 @@
#lang scheme/base
#lang racket/base
(require syntax/private/boundmap ;; needs to be the private one, since the public one has contracts
(for-template scheme/base)
(for-template racket/base)
(for-template "guts.ss")
(for-syntax scheme/base))
(for-syntax racket/base))
(provide get-opter reg-opter! opter
interleave-lifts

View File

@ -1,13 +1,12 @@
#lang scheme/base
#lang racket/base
(require "guts.ss"
scheme/stxparam
mzlib/etc)
(require (for-syntax scheme/base)
racket/stxparam)
(require (for-syntax racket/base)
(for-syntax "opt-guts.ss")
(for-syntax mzlib/etc)
(for-syntax scheme/stxparam))
(for-syntax racket/stxparam))
(provide opt/c define-opt/c define/opter opt-stronger-vars-ref)
(provide opt/c define-opt/c define/opter opt-stronger-vars-ref
begin-lifted)
;; define/opter : id -> syntax
;;
@ -151,6 +150,11 @@
(vector)
(begin-lifted (box #f)))))))]))
(define-syntax (begin-lifted stx)
(syntax-case stx ()
[(_ expr)
(syntax-local-lift-expression #'expr)]))
(define-syntax-parameter define/opt-recursive-fn #f)
(define-syntax (define-opt/c stx)

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require "blame.ss")

View File

@ -1,14 +1,14 @@
#lang scheme/base
#lang racket/base
(provide provide/contract
(for-syntax make-provide/contract-transformer))
(require (for-syntax scheme/base
scheme/list
(require (for-syntax racket/base
racket/list
(prefix-in a: "helpers.ss"))
"arrow.ss"
"base.ss"
scheme/contract/exists
racket/contract/exists
"guts.ss"
unstable/location
unstable/srcloc)

View File

@ -1,19 +1,19 @@
#lang scheme/base
#lang racket/base
(provide define-struct/contract
define/contract
with-contract)
(require (for-syntax scheme/base
scheme/list
scheme/struct-info
(require (for-syntax racket/base
racket/list
racket/struct-info
syntax/define
syntax/kerncase
syntax/parse
unstable/syntax
(prefix-in a: "private/helpers.ss"))
scheme/splicing
scheme/stxparam
racket/splicing
racket/stxparam
unstable/location
"private/arrow.ss"
"private/base.ss"

View File

@ -1,4 +1,4 @@
(module control scheme/base
(module control racket/base
(require mzlib/control)
(provide (all-from-out mzlib/control)))

View File

@ -1,6 +1,6 @@
#lang scheme/base
#lang racket/base
(require (for-syntax scheme/base))
(require (for-syntax racket/base))
(provide prop:dict
dict?
@ -268,7 +268,7 @@
[else
(raise-type-error 'dict-count "dict" d)]))
(define-struct assoc-iter (head pos))
(struct assoc-iter (head pos))
(define (dict-iterate-first d)
(cond
@ -276,7 +276,7 @@
[(vector? d) (if (zero? (vector-length d))
#f
0)]
[(assoc? d) (if (null? d) #f (make-assoc-iter d d))]
[(assoc? d) (if (null? d) #f (assoc-iter d d))]
[(dict-struct? d) ((get-dict-iterate-first (dict-struct-ref d)) d)]
[else
(raise-type-error 'dict-iterate-first "dict" d)]))
@ -302,7 +302,7 @@
(let ([pos (cdr (assoc-iter-pos i))])
(if (null? pos)
#f
(make-assoc-iter d pos)))]
(assoc-iter d pos)))]
[(dict-struct? d) ((get-dict-iterate-next (dict-struct-ref d)) d i)]
[(assoc? d)
(raise-mismatch-error
@ -409,7 +409,7 @@
;; ----------------------------------------
(define-struct hash-box (key))
(struct hash-box (key))
(define custom-hash-ref
(case-lambda
@ -433,8 +433,8 @@
(let ([table (hash-set (custom-hash-table d)
((custom-hash-make-box d) k)
v)])
(make-immutable-custom-hash table
(custom-hash-make-box d))))
(immutable-custom-hash table
(custom-hash-make-box d))))
(define (custom-hash-remove! d k)
(hash-remove! (custom-hash-table d)
@ -443,8 +443,8 @@
(define (custom-hash-remove d k)
(let ([table (hash-remove (custom-hash-table d)
((custom-hash-make-box d) k))])
(make-immutable-custom-hash table
(custom-hash-make-box d))))
(immutable-custom-hash table
(custom-hash-make-box d))))
(define (custom-hash-count d)
(hash-count (custom-hash-table d)))
@ -461,7 +461,7 @@
(define (custom-hash-iterate-value d i)
(hash-iterate-value (custom-hash-table d) i))
(define-struct custom-hash (table make-box)
(struct custom-hash (table make-box)
#:property prop:dict
(vector custom-hash-ref
custom-hash-set!
@ -482,7 +482,7 @@
(lambda (a recur) (recur (custom-hash-table a)))
(lambda (a recur) (recur (custom-hash-table a)))))
(define-struct (immutable-custom-hash custom-hash) ()
(struct immutable-custom-hash custom-hash ()
#:property prop:dict
(vector custom-hash-ref
#f
@ -510,7 +510,7 @@
(procedure-arity-includes? hash2 1))
(raise-type-error who "procedure (arity 1)" hash2))
(let ()
(define-struct (box hash-box) ()
(struct box hash-box ()
#:property prop:equal+hash (list
(lambda (a b recur)
(=? (hash-box-key a) (hash-box-key b)))
@ -518,16 +518,16 @@
(hash (hash-box-key v)))
(lambda (v recur)
(hash2 (hash-box-key v)))))
(make-custom-hash table (wrap-make-box make-box))))])
(make-custom-hash table (wrap-make-box box))))])
(let ([make-custom-hash
(lambda (=? hash [hash2 (lambda (v) 10001)])
(mk hash hash2 =? 'make-custom-hash make-custom-hash (make-hash) values))]
(mk hash hash2 =? 'make-custom-hash custom-hash (make-hash) values))]
[make-immutable-custom-hash
(lambda (=? hash [hash2 (lambda (v) 10001)])
(mk hash hash2 =? 'make-immutable-custom-hash make-immutable-custom-hash #hash() values))]
(mk hash hash2 =? 'make-immutable-custom-hash immutable-custom-hash #hash() values))]
[make-weak-custom-hash
(lambda (=? hash [hash2 (lambda (v) 10001)])
(mk hash hash2 =? 'make-weak-custom-hash make-custom-hash (make-weak-hash)
(mk hash hash2 =? 'make-weak-custom-hash custom-hash (make-weak-hash)
(lambda (make-box)
(let ([ht (make-weak-hasheq)])
(lambda (v)

View File

@ -1,7 +1,7 @@
#lang scheme/base
#lang racket/base
(require syntax/modcode
(for-syntax scheme/base))
(for-syntax racket/base))
(provide enter!)
@ -29,10 +29,10 @@
(enter-require mod)
(let ([ns (module->namespace mod)])
(current-namespace ns)
(namespace-require 'scheme/enter)))
(namespace-require 'racket/enter)))
(current-namespace orig-namespace)))
(define-struct mod (name timestamp depends))
(struct mod (name timestamp depends))
(define loaded (make-hash))
@ -66,13 +66,13 @@
(or (current-load-relative-directory)
(current-directory)))))])
;; Record module timestamp and dependencies:
(let ([mod (make-mod name
(get-timestamp path)
(if code
(apply append
(map cdr (module-compiled-imports code)))
null))])
(hash-set! loaded path mod))
(let ([a-mod (mod name
(get-timestamp path)
(if code
(apply append
(map cdr (module-compiled-imports code)))
null))])
(hash-set! loaded path a-mod))
;; Evaluate the module:
(eval code))
;; Not a module:

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(provide s-exp->fasl
fasl->s-exp)

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(provide delete-directory/files
copy-directory/files
@ -22,7 +22,7 @@
write-to-file
display-lines-to-file)
(require "private/portlines.ss")
(require "private/portlines.rkt")
;; utility: sorted dirlist so functions are deterministic
(define (sorted-dirlist [dir (current-directory)])

View File

@ -1,9 +1,9 @@
#lang scheme/base
#lang racket/base
;; Foreign Scheme interface
(require '#%foreign setup/dirs scheme/unsafe/ops
(for-syntax scheme/base scheme/list syntax/stx
scheme/struct-info))
;; Foreign Racket interface
(require '#%foreign setup/dirs racket/unsafe/ops
(for-syntax racket/base racket/list syntax/stx
racket/struct-info))
;; This module is full of unsafe bindings that are not provided to requiring
;; modules. Instead, an `unsafe!' binding is provided that makes these unsafe
@ -70,7 +70,7 @@
_void _int8 _uint8 _int16 _uint16 _int32 _uint32 _int64 _uint64
_fixint _ufixint _fixnum _ufixnum
_float _double _double*
_bool _pointer _gcpointer _scheme _fpointer function-ptr
_bool _pointer _gcpointer _scheme (rename-out [_scheme _racket]) _fpointer function-ptr
(unsafe memcpy) (unsafe memmove) (unsafe memset)
(unsafe malloc-immobile-cell) (unsafe free-immobile-cell))

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require '#%futures)
(provide future?

View File

@ -1,8 +1,8 @@
#lang scheme/base
#lang racket/base
(require (for-syntax scheme/base)
scheme/control
scheme/stxparam scheme/splicing)
(require (for-syntax racket/base)
racket/control
racket/stxparam racket/splicing)
(provide yield generator generator-state in-generator infinite-generator
sequence->generator sequence->repeated-generator)

4
collects/racket/gui.rkt Normal file
View File

@ -0,0 +1,4 @@
(module gui racket
(require racket/gui/base)
(provide (all-from-out racket)
(all-from-out racket/gui/base)))

View File

@ -0,0 +1,2 @@
#lang s-exp syntax/module-reader
racket/gui

View File

@ -0,0 +1,2 @@
#lang s-exp syntax/module-reader
scheme/gui

View File

@ -1,6 +1,6 @@
#lang scheme/base
#lang racket/base
(require (for-syntax scheme/base) scheme/promise)
(require (for-syntax racket/base) racket/promise)
(provide help)

View File

@ -1,6 +1,6 @@
#lang scheme/base
#lang racket/base
(require (for-syntax scheme/base
(require (for-syntax racket/base
syntax/stx
syntax/path-spec
mzlib/private/increader

View File

@ -1,7 +1,6 @@
#lang racket
(require scheme/enter
scheme/help
"private/runtime.ss")
(require racket/enter
racket/help)
;; Set the printer:
(current-print (let ([pretty-printer
@ -11,5 +10,5 @@
pretty-printer))
(provide (all-from-out racket
scheme/enter
scheme/help))
racket/enter
racket/help))

55
collects/racket/main.rkt Normal file
View File

@ -0,0 +1,55 @@
#lang racket/private
(require racket/base
racket/contract
racket/class
racket/unit
racket/dict
racket/include
racket/pretty
racket/math
racket/match
racket/shared
racket/set
racket/tcp
racket/udp
racket/list
racket/vector
racket/string
racket/function
racket/path
racket/file
racket/port
racket/cmdline
racket/promise
racket/bool
racket/local
racket/nest
(for-syntax racket/base))
(provide (all-from-out racket/contract
racket/class
racket/unit
racket/dict
racket/include
racket/pretty
racket/math
racket/match
racket/shared
racket/base
racket/set
racket/tcp
racket/udp
racket/list
racket/vector
racket/string
racket/function
racket/path
racket/file
racket/port
racket/cmdline
racket/promise
racket/bool
racket/local
racket/nest)
(for-syntax (all-from-out racket/base)))

View File

@ -1,8 +0,0 @@
#lang racket/private
(require (except-in scheme struct struct/ctc)
(only-in mzlib/unit struct~r/ctc)
"private/struct.rkt")
(provide (all-from-out scheme)
(rename-out [struct~r/ctc struct/ctc])
struct)

View File

@ -1,7 +1,7 @@
#lang scheme/base
(require scheme/match/match
(for-syntax scheme/base))
(provide (except-out (all-from-out scheme/match/match)
#lang racket/base
(require racket/match/match
(for-syntax racket/base))
(provide (except-out (all-from-out racket/match/match)
define-match-expander)
(rename-out [define-match-expander* define-match-expander]))

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require (only-in "runtime.ss"
match-equality-test

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require (only-in "runtime.ss"
match-equality-test

View File

@ -1,9 +1,9 @@
#lang scheme/base
#lang racket/base
(require (for-template scheme/base)
(require (for-template racket/base)
syntax/boundmap
syntax/stx
scheme/struct-info
racket/struct-info
"patterns.ss"
"compiler.ss"
"parse-helper.ss"

View File

@ -1,7 +1,7 @@
#lang scheme/base
#lang racket/base
(require scheme/stxparam
(for-syntax scheme/base))
(require racket/stxparam
(for-syntax racket/base))
(provide match-equality-test
exn:misc:match?

View File

@ -1,9 +1,9 @@
#lang scheme/base
(require scheme/match/match-expander
(for-syntax scheme/base
scheme/struct-info
#lang racket/base
(require racket/match/match-expander
(for-syntax racket/base
racket/struct-info
syntax/boundmap
scheme/list))
racket/list))
(define-match-expander
struct*

View File

@ -1,4 +1,4 @@
#lang scheme/base
#lang racket/base
(require mzlib/port
"private/portlines.ss")

View File

@ -9,7 +9,7 @@
;; require this module and evaluate:
;; (current-print pretty-print-handler)
(module pretty mzscheme
(module pretty racket/base
(require mzlib/private/port)
(provide pretty-print
@ -64,18 +64,18 @@
(format "length of first list (~a) doesn't match the length of the second list (~a): "
(length symbols) (length like-symbols))
like-symbols)))
(let ([ht (if table (pretty-print-style-table-hash table) (make-hash-table))]
[new-ht (make-hash-table)])
(hash-table-for-each
(let ([ht (if table (pretty-print-style-table-hash table) (make-hasheq))]
[new-ht (make-hasheq)])
(hash-for-each
ht
(lambda (key val)
(hash-table-put! new-ht key val)))
(hash-set! new-ht key val)))
(for-each
(lambda (symbol like-symbol)
(let ((s (hash-table-get ht
like-symbol
(lambda () #f))))
(hash-table-put! new-ht symbol (or s like-symbol))))
(let ((s (hash-ref ht
like-symbol
(lambda () #f))))
(hash-set! new-ht symbol (or s like-symbol))))
symbols like-symbols)
(make-pretty-print-style-table new-ht))))
@ -233,7 +233,7 @@
(define pretty-display (make-pretty-print #t #f))
(define pretty-write (make-pretty-print #f #f))
(define-struct mark (str def))
(define-struct mark (str def) #:mutable)
(define-struct hide (val))
(define (make-tentative-output-port pport width esc)
@ -323,7 +323,7 @@
void))
p)))
(define printing-ports (make-hash-table 'weak))
(define printing-ports (make-weak-hasheq))
(define-struct print-port-info (get-content
def-box
@ -334,15 +334,15 @@
esc))
(define (register-printing-port p info)
(hash-table-put! printing-ports p (make-ephemeron p info)))
(hash-set! printing-ports p (make-ephemeron p info)))
(define (register-printing-port-like p pport)
(hash-table-put! printing-ports p
(make-ephemeron p
(ephemeron-value (hash-table-get printing-ports pport)))))
(hash-set! printing-ports p
(make-ephemeron p
(ephemeron-value (hash-ref printing-ports pport)))))
(define (get pport selector)
(let ([e (hash-table-get printing-ports pport (lambda () #f))])
(let ([e (hash-ref printing-ports pport #f)])
(selector (if e
(ephemeron-value e)
(make-print-port-info
@ -392,7 +392,8 @@
(begin
(write-string " " port)
(add-spaces (- n 8) port))
(write-string " " port 0 n))))
(write-string " " port 0 n))
(void)))
(define (prefab?! obj v)
(let ([d (prefab-struct-key obj)])
@ -413,7 +414,7 @@
(define mpair-open (if (print-mpair-curly-braces) "{" "("))
(define mpair-close (if (print-mpair-curly-braces) "}" ")"))
(define table (make-hash-table)) ; Hash table for looking for loops
(define table (make-hasheq)) ; Hash table for looking for loops
(define show-inexactness? (pretty-print-show-inexactness))
(define exact-as-decimal? (pretty-print-exact-as-decimal))
@ -459,10 +460,10 @@
(and (custom-write? obj)
(not (struct-type? obj)))
(and (struct? obj) print-struct?)
(and (hash-table? obj) print-hash-table?))
(or (hash-table-get table obj (lambda () #f))
(and (hash? obj) print-hash-table?))
(or (hash-ref table obj #f)
(begin
(hash-table-put! table obj #t)
(hash-set! table obj #t)
(let ([cycle
(cond
[(vector? obj)
@ -485,16 +486,16 @@
[(struct? obj)
(ormap loop
(vector->list (struct->vector obj)))]
[(hash-table? obj)
[(hash? obj)
(let/ec esc
(hash-table-for-each
(hash-for-each
obj
(lambda (v k)
(when (or (loop v)
(loop k))
(esc #t))))
#f)])])
(hash-table-remove! table obj)
(hash-remove! table obj)
cycle)))))))
(define __dummy__
@ -508,13 +509,13 @@
(and (custom-write? obj)
(not (struct-type? obj)))
(and (struct? obj) print-struct?)
(and (hash-table? obj) print-hash-table?))
(and (hash? obj) print-hash-table?))
;; A little confusing: use #t for not-found
(let ([p (hash-table-get table obj (lambda () #t))])
(let ([p (hash-ref table obj #t)])
(when (not (mark? p))
(if p
(begin
(hash-table-put! table obj #f)
(hash-set! table obj #f)
(cond
[(vector? obj)
(let ([len (vector-length obj)])
@ -535,15 +536,16 @@
[(struct? obj)
(for-each loop
(vector->list (struct->vector obj)))]
[(hash-table? obj)
(hash-table-for-each
[(hash? obj)
(hash-for-each
obj
(lambda (k v)
(loop k)
(loop v)))]))
(begin
(hash-table-put! table obj
(make-mark #f (box #f)))))))))))
(hash-set! table obj
(make-mark #f (box #f)))))))
(void)))))
(define cycle-counter 0)
@ -583,7 +585,7 @@
(lambda (obj pport check? c-k d-k n-k)
(let ([ref (and check?
found
(hash-table-get found obj (lambda () #f)))])
(hash-ref found obj #f))])
(if (and ref (unbox (mark-def ref)))
(if c-k
(c-k (mark-str ref))
@ -752,7 +754,7 @@
qd)))))
(parameterize ([print-struct #f])
((if display? orig-display orig-write) obj pport)))]
[(hash-table? obj)
[(hash? obj)
(if (and print-hash-table?
(not (and depth
(zero? depth))))
@ -761,13 +763,13 @@
#f #f
(lambda ()
(let ([qd (to-quoted out qd "`")])
(out (if (hash-table? obj 'equal)
"#hash"
(if (hash-table? obj 'eqv)
(out (if (hash-eq? obj)
"#hasheq"
(if (hash-eqv? obj)
"#hasheqv"
"#hasheq")))
(wr-lst (hash-table-map obj (lambda (k v)
(cons k (make-hide v))))
"#hash")))
(wr-lst (hash-map obj (lambda (k v)
(cons k (make-hide v))))
#f depth
pair? car cdr "(" ")" qd))))
(parameterize ([print-hash-table #f])
@ -840,9 +842,9 @@
(and (custom-write? obj)
(not (struct-type? obj)))
(and (struct? obj) print-struct?)
(and (hash-table? obj) print-hash-table?)))]
(and (hash? obj) print-hash-table?)))]
[graph-ref (if can-multi
(and found (hash-table-get found obj (lambda () #f)))
(and found (hash-ref found obj #f))
#f)]
[old-counter cycle-counter])
(if (and can-multi
@ -908,14 +910,14 @@
extra pp-expr #f depth
pair? car cdr pair-open pair-close
qd)))]
[(hash-table? obj)
[(hash? obj)
(let ([qd (to-quoted out qd "`")])
(out (if (hash-table? obj 'equal)
"#hash"
(if (hash-table? obj 'eqv)
(out (if (hash-eq? obj)
"#hasheq"
(if (hash-eqv? obj)
"#hasheqv"
"#hasheq")))
(pp-list (hash-table-map obj cons) extra pp-expr #f depth
"#hash")))
(pp-list (hash-map obj cons) extra pp-expr #f depth
pair? car cdr pair-open pair-close
qd))]
[(and (box? obj) print-box?)
@ -931,7 +933,7 @@
qd)
(if (and (read-macro? expr apair? acar acdr qd)
(equal? open "(")
(not (and found (hash-table-get found (acdr expr) #f))))
(not (and found (hash-ref found (acdr expr) #f))))
(begin
(out (read-macro-prefix expr acar))
(pr (read-macro-body expr acar acdr)
@ -1195,7 +1197,7 @@
(define (no-sharing? expr count apair? acdr)
(if (apair? expr)
(if (and found
(hash-table-get found (acdr expr) #f))
(hash-ref found (acdr expr) #f))
#f
(or (zero? count)
(no-sharing? (acdr expr) (sub1 count) apair? acdr)))
@ -1286,10 +1288,10 @@
(define (look-in-style-table raw-head)
(let ([head (do-remap raw-head)])
(or (hash-table-get (pretty-print-style-table-hash
(pretty-print-current-style-table))
head
#f)
(or (hash-ref (pretty-print-style-table-hash
(pretty-print-current-style-table))
head
#f)
head)))
(define (do-remap raw-head)

Some files were not shown because too many files have changed in this diff Show More