diff --git a/collects/scribblings/reference/runtime.scrbl b/collects/scribblings/reference/runtime.scrbl index 84417a4894..edc9beceec 100644 --- a/collects/scribblings/reference/runtime.scrbl +++ b/collects/scribblings/reference/runtime.scrbl @@ -18,9 +18,9 @@ contain a null character; the environment variable named by @racket[name] is set to @racket[value]. The return value is @racket[#t] if the assignment succeeds, @racket[#f] otherwise.} -@defproc[(system-type [mode (or/c 'os 'gc 'link 'so-suffix 'machine) +@defproc[(system-type [mode (or/c 'os 'word 'gc 'link 'so-suffix 'machine) 'os]) - (or/c symbol? string? bytes?)]{ + (or/c symbol? string? bytes? exact-positive-integer?)]{ Returns information about the operating system, build mode, or machine for a running Racket. @@ -34,6 +34,10 @@ In @indexed-racket['os] mode, @item{@indexed-racket['macosx]} ] +In @indexed-racket['word] mode, the result is either @racket[32] or +@racket[64] to indicate whether Racket is running as a 32-bit program +or 64-bit program. + In @indexed-racket['gc] mode, the possible symbol results are: diff --git a/collects/tests/racket/basic.rktl b/collects/tests/racket/basic.rktl index 93cdde8215..70afe27c51 100644 --- a/collects/tests/racket/basic.rktl +++ b/collects/tests/racket/basic.rktl @@ -2572,6 +2572,9 @@ (test #t symbol? (system-type 'link)) (test #t relative-path? (system-library-subpath)) +(test #t pair? (memv (system-type 'word) '(32 64))) +(test (fixnum? (expt 2 32)) = (system-type 'word) 64) + (test #t 'cmdline (let ([v (current-command-line-arguments)]) (and (vector? v) (andmap string? (vector->list v))))) diff --git a/collects/typed-racket/base-env/base-env.rkt b/collects/typed-racket/base-env/base-env.rkt index 626b7d78b9..85b7be72f9 100644 --- a/collects/typed-racket/base-env/base-env.rkt +++ b/collects/typed-racket/base-env/base-env.rkt @@ -1146,7 +1146,8 @@ (-> (-val 'gc) (Un (-val 'cgc) (-val '3m))) (-> (-val 'link) (Un (-val 'static) (-val 'shared) (-val 'dll) (-val 'framework))) (-> (-val 'so-suffix) -Bytes) - (-> (-val 'machine) -String))] + (-> (-val 'machine) -String) + (-> (-val 'word) -PosInt))] [system-language+country (-> -String)] [system-library-subpath (->opt [(Un (-val #f) (-val 'cgc) (-val '3m))] -Path)] diff --git a/doc/release-notes/racket/HISTORY.txt b/doc/release-notes/racket/HISTORY.txt index 9a6001cf86..3d5c03aef8 100644 --- a/doc/release-notes/racket/HISTORY.txt +++ b/doc/release-notes/racket/HISTORY.txt @@ -1,5 +1,7 @@ Version 5.3.1.10 Added phantom byte strings +Added 'word mode to system-type +racket/gui: added display-changed to frame% Version 5.3.1.9 Changed case to use equal? instead of eqv? diff --git a/src/racket/src/string.c b/src/racket/src/string.c index ab996c12c6..839a70dc17 100644 --- a/src/racket/src/string.c +++ b/src/racket/src/string.c @@ -2349,9 +2349,14 @@ static Scheme_Object *system_type(int argc, Scheme_Object *argv[]) #endif } + sym = scheme_intern_symbol("word"); + if (SAME_OBJ(argv[0], sym)) { + return scheme_make_integer(sizeof(void*)*8); + } + sym = scheme_intern_symbol("os"); if (!SAME_OBJ(argv[0], sym)) { - scheme_wrong_contract("system-type", "(or/c 'os 'link 'machine 'gc 'so-suffix)", 0, argc, argv); + scheme_wrong_contract("system-type", "(or/c 'os 'word 'link 'machine 'gc 'so-suffix 'word)", 0, argc, argv); return NULL; } }