From 88f896c121288d3ea2e6c9977cf0a115259002c1 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Fri, 8 Jul 2016 12:37:39 -0400 Subject: [PATCH] Support environment variable procedures. --- .../typed-racket/scribblings/reference/types.scrbl | 1 + typed-racket-lib/typed-racket/base-env/base-env.rkt | 8 ++++++++ typed-racket-lib/typed-racket/base-env/base-types.rkt | 1 + typed-racket-lib/typed-racket/types/abbrev.rkt | 2 ++ 4 files changed, 12 insertions(+) diff --git a/typed-racket-doc/typed-racket/scribblings/reference/types.scrbl b/typed-racket-doc/typed-racket/scribblings/reference/types.scrbl index b6b6fda0..bf689007 100644 --- a/typed-racket-doc/typed-racket/scribblings/reference/types.scrbl +++ b/typed-racket-doc/typed-racket/scribblings/reference/types.scrbl @@ -266,6 +266,7 @@ These are not part of the numeric tower. @defidform[FSemaphore] @defidform[Will-Executor] @defidform[Pseudo-Random-Generator] +@defidform[Environment-Variables] )]{ These types represent primitive Racket data. diff --git a/typed-racket-lib/typed-racket/base-env/base-env.rkt b/typed-racket-lib/typed-racket/base-env/base-env.rkt index afc413a4..248b062f 100644 --- a/typed-racket-lib/typed-racket/base-env/base-env.rkt +++ b/typed-racket-lib/typed-racket/base-env/base-env.rkt @@ -2964,6 +2964,14 @@ (->opt [(Un (-val #f) (-val 'subprocesses) -Thread)] -Fixnum)] ;; Section 15.7 +[environment-variables? (make-pred-ty -Environment-Variables)] +[current-environment-variables (-Param -Environment-Variables)] +[bytes-environment-variable-name? (asym-pred Univ B (-PS (-is-type 0 -Bytes) -tt))] +[make-environment-variables (->* null -Bytes -Environment-Variables)] +[environment-variables-ref (-> -Environment-Variables -Bytes (-opt -Bytes))] +[environment-variables-set! (->opt -Environment-Variables -Bytes (-opt -Bytes) [(-> Univ)] Univ)] +[environment-variables-names (-> -Environment-Variables (-lst -Bytes))] +[string-environment-variable-name? (asym-pred Univ B (-PS (-is-type 0 -) -tt))] [getenv (-> -String (Un -String (-val #f)))] [putenv (-> -String -String B)] diff --git a/typed-racket-lib/typed-racket/base-env/base-types.rkt b/typed-racket-lib/typed-racket/base-env/base-types.rkt index a82b6fcd..534bf3c5 100644 --- a/typed-racket-lib/typed-racket/base-env/base-types.rkt +++ b/typed-racket-lib/typed-racket/base-env/base-types.rkt @@ -160,6 +160,7 @@ [Place-Channel -Place-Channel] [Place -Place] [Will-Executor -Will-Executor] +[Environment-Variables -Environment-Variables] [Listof -Listof] diff --git a/typed-racket-lib/typed-racket/types/abbrev.rkt b/typed-racket-lib/typed-racket/types/abbrev.rkt index 5154af4a..ad2d7561 100644 --- a/typed-racket-lib/typed-racket/types/abbrev.rkt +++ b/typed-racket-lib/typed-racket/types/abbrev.rkt @@ -251,6 +251,8 @@ (define/decl -Place-Channel (Un -Place -Base-Place-Channel)) (define/decl -Will-Executor (make-Base 'Will-Executor #'will-executor? will-executor?)) +(define/decl -Environment-Variables + (make-Base 'Environment-Variables #'environment-variables? environment-variables?)) ;; Paths (define/decl -car (make-CarPE))