From f2ebf8a398c03debd279516ff50b6315e1597fc6 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Tue, 24 Oct 2023 00:40:44 +0000 Subject: [PATCH 1/3] Minor fixes: gxpkg, std/text/char-set, README --- doc/guide/README.md | 6 +++--- src/std/text/char-set.ss | 6 +++--- src/tools/gxpkg.ss | 15 ++++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/guide/README.md b/doc/guide/README.md index 854b25364..6e9d5107d 100644 --- a/doc/guide/README.md +++ b/doc/guide/README.md @@ -109,7 +109,7 @@ docker pull gerbil/gerbil:$(uname -m) To get to the REPL: ```bash -docker run -it gerbil/gebil:$(uname -m) +docker run -it gerbil/gerbil:$(uname -m) ``` To get a bash shell where you can compile programs: @@ -125,6 +125,6 @@ See the [Docker Gulde](docker.md) for additional information. You can install Gerbil using Nix. See [nix.md](nix.md) for more details. There are also Docker containers based on Nix, with some gerbil libraries also installed, -at `mukn/gerbil` (with the compiler) and `mukn/glow` (with many libraries installed) -(user `user` working in `/home`). +at `mukn/glow:devel` or `ghcr.io/glow-lang/glow:devel` with many libraries installed. + See the `scripts` directory of [Gerbil Clan](https://github.com/fare/gerbil-utils) for details. diff --git a/src/std/text/char-set.ss b/src/std/text/char-set.ss index b2cc73b70..6e9ec25b3 100644 --- a/src/std/text/char-set.ss +++ b/src/std/text/char-set.ss @@ -65,11 +65,11 @@ (= c #x0D))) ;; #\return ;; Whitespace as defined by C, C++ and Python. +;; To the strict-whitespace above, add two characters: +;; #\vtab (vertical tab) C'\v' and #\page (page break, form feed) C'\f' ;; : Codepoint -> Bool (def-codepoint (ascii-whitespace? c) - (or (codepoint-strict-whitespace? c) - (= c #x0B) ;; #\vtab (vertical tab) C'\v' - (= c #x0C))) ;; #\page (page break, form feed) C'\f' + (or (= c #x20) (<= #x09 c #x0D))) ;; Whitespace as defined by the underlying Scheme implementation ;; For Gambit and thus Gerbil (so far), it is the union of ASCII whitespace diff --git a/src/tools/gxpkg.ss b/src/tools/gxpkg.ss index ab6d37479..b9082d528 100644 --- a/src/tools/gxpkg.ss +++ b/src/tools/gxpkg.ss @@ -23,6 +23,7 @@ ;;; TODO: add private repos support (import :gerbil/gambit + :std/format :std/getopt :std/sugar :std/iter @@ -85,11 +86,9 @@ (def new-cmd (command 'new help: "create a new package template in the current directory" (option 'package "-p" "--package" - help: "the package prefix for your project; defaults to the current username" - default: (getenv "USER")) + help: "the package prefix for your project; defaults to the current username") (option 'name "-n" "--name" - help: "the package name; defaults to the current directory name" - default: (path-strip-directory (path-normalize* (current-directory)))) + help: "the package name; defaults to the current directory name") (option 'link "-l" "--link" help: "link this package with a public package name; for example: github.com/your-user/your-package"))) (def deps-cmd @@ -340,7 +339,13 @@ (force once) (force +pkg-root-dir+)))) -(def (pkg-new prefix name maybe-link) +(def (pkg-new package-prefix package-name maybe-link) + (def prefix (or package-prefix + (getenv "USER" #f) + (begin (eprintf "Package prefix not specified with -p or --package, and USER not defined\n") + (exit 2)))) + (def name (or package-name + (path-strip-directory (path-normalize* (current-directory))))) (def (create-template file template . args) (call-with-output-file file (lambda (output) From dbb0fdaba699f3087382a894237235b57eb211cd Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Tue, 24 Oct 2023 05:37:36 +0000 Subject: [PATCH 2/3] Factor abort out of the pkg-new --- src/tools/gxpkg.ss | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tools/gxpkg.ss b/src/tools/gxpkg.ss index b9082d528..394a6907c 100644 --- a/src/tools/gxpkg.ss +++ b/src/tools/gxpkg.ss @@ -44,6 +44,12 @@ pkg-retag pkg-plist pkg-dependents pkg-dependents*) +;; TODO: move that to general-purpose runtime support, and +;; have it throw an exception that is caught by the bottom runtime handler. +(def (abort msg) + (eprintf "~a\n" msg) + (exit 2)) + (def (main . args) (def local-flag (flag 'local "-l" "--local" @@ -342,8 +348,7 @@ (def (pkg-new package-prefix package-name maybe-link) (def prefix (or package-prefix (getenv "USER" #f) - (begin (eprintf "Package prefix not specified with -p or --package, and USER not defined\n") - (exit 2)))) + (abort "Package prefix not specified with -p or --package, and USER not defined"))) (def name (or package-name (path-strip-directory (path-normalize* (current-directory))))) (def (create-template file template . args) From 49f808f714c3beee72e8d4b714697e8fdef9176d Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Tue, 24 Oct 2023 05:42:01 +0000 Subject: [PATCH 3/3] Just use error --- src/tools/gxpkg.ss | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/tools/gxpkg.ss b/src/tools/gxpkg.ss index 394a6907c..01ac2c6a2 100644 --- a/src/tools/gxpkg.ss +++ b/src/tools/gxpkg.ss @@ -44,12 +44,6 @@ pkg-retag pkg-plist pkg-dependents pkg-dependents*) -;; TODO: move that to general-purpose runtime support, and -;; have it throw an exception that is caught by the bottom runtime handler. -(def (abort msg) - (eprintf "~a\n" msg) - (exit 2)) - (def (main . args) (def local-flag (flag 'local "-l" "--local" @@ -348,7 +342,7 @@ (def (pkg-new package-prefix package-name maybe-link) (def prefix (or package-prefix (getenv "USER" #f) - (abort "Package prefix not specified with -p or --package, and USER not defined"))) + (error "Package prefix not specified with -p or --package, and USER not defined"))) (def name (or package-name (path-strip-directory (path-normalize* (current-directory))))) (def (create-template file template . args)