Commit Graph

663 Commits

Author SHA1 Message Date
Timothy Sample d088464510 compat: Add 'call-with-input-string' for Mes.
* gash/compat.scm [mes] (call-with-input-string): New procedure.
2023-02-08 14:29:13 -06:00
Timothy Sample efe0522d06 compat: Add 'thunk?' for Mes.
* gash/compat.scm [mes] (thunk?): New procedure.
2023-02-08 14:29:13 -06:00
Timothy Sample a584a5bd9c compat: Add Mes shims for the 'eval' module.
* gash/compat.scm [mes] (string-concatenate-reverse): New procedure.
[mes] (char-pred): New procedure.
[mes] (string-any): New procedure.
[mes] (string-every): Allow character sets and characters as the
predicated (using 'char-pred').
2023-02-08 14:29:13 -06:00
Timothy Sample 4f3ae9e083 built-ins: echo: Import '(gash compat)'.
* gash/built-ins/echo.scm: Import '(gash compat)'.
2023-02-08 14:29:13 -06:00
Timothy Sample 309f9a8893 compat: Add shims for the 'shell' module.
* gash/compat.scm [mes] (X_OK): New variable.
[mes] (program-arguments): New procedure.
[mes] (delete-duplicates!): New procedure.
[mes] (flush-all-ports): New procedure.
[mes] (file-port?): New procedure.
[mes] (input-port?): New procedure.
[mes] (output-port?): New procedure.
[mes] (dup): Redefine to support an optional 'new' argument.
2023-02-08 14:29:13 -06:00
Timothy Sample 83f3369603 compat: srfi-43: Adjust for Mes.
* gash/compat/srfi-43.scm (shared-shims): New macro.
[if-guile-version-below (2 0 10)]: Use it.
[mes]: Likewise.
2023-02-08 14:29:13 -06:00
Timothy Sample ca3b6d354c built-ins: utils: Import SRFI 14 for Mes.
* gash/built-ins/utils.scm: Import '(srfi srfi-14)'.
2023-02-08 14:29:13 -06:00
Timothy Sample 26cf4933c9 config: Tell Mes not to complain about '%version'.
* gash/config.scm.in [mes]: Mark '%version' as a replacement.
2023-02-08 14:29:13 -06:00
Timothy Sample 386d12aa21 wip! environment: Port to Mes.
TODO: Implement 'canonicalize-path'.

* gash/compat.scm [mes] (make-prompt-tag): New procedure.
[mes] (canonicalize-path): New procedure.
* gash/compat/hash-table.scm (shared-shims): New macro.
[if-guile-version-below (2 0 10)]: Use it.
[mes]: Likewise.
* gash/environment.scm: Import '(gash compat)' and '(srfi srfi-14)'.
2023-02-08 14:29:13 -06:00
Timothy Sample 0c554b6b13 parser: Port to Mes.
* gash/compat.scm [mes] (the-eof-object): New variable.
[mes] (noop): New procedure.
* gash/parser.scm: Import '(gash compat)'; remove '(srfi srfi-14)'
import.
(eof-object): Remove procedure.
(make-parser): Replace 'eof-object' with 'the-eof-object'.
(call-with-backquoted-input-port): Likewise.
2023-02-08 14:29:13 -06:00
Timothy Sample e37ef0faba lexer: Port to Mes.
* gash/compat.scm [mes] (define-inlinable): New syntax.
[mes] (*fluid-accessor*): New variable.
[mes] (make-parameter): New procedure.
[mes] (parameterize): New syntax.
[mes] (set-port-line!): New procedure.
[mes] (string-every): New procedure.
* gash/compat/textual-ports.scm [mes] (<soft-input-port>): New
record type.
[mes] (make-soft-port): New procedure.
[mes] (push-soft-input-port-buffer!): New procedure.
[mes] (pop-soft-input-port-buffer!): New procedure.
[mes] (get-char): New procedure.
[mes] (unget-char): New procedure.
[mes] (lookahead-char): New procedure.
* gash/lexer.scm: Import '(gash compat)' and '(srfi srfi-14)'.
2023-02-08 14:29:05 -06:00
Timothy Sample ead347128a compat: Support Mes.
* gash/compat.scm (if-guile-version-below) [mes]: Do nothing.
(when-mes): New syntax.
* .dir-locals.el: Tell Emacs how to indent it.
2022-04-28 15:47:36 -06:00
Timothy Sample a3123ab02a Update NEWS for 0.3.0.
* NEWS (release 0.3.0): New section.
2022-02-11 11:18:55 -05:00
Timothy Sample ec009a89bb Update ChangeLog copyright years.
* ChangeLog: Update copyright years for Timothy Sample.
2022-02-11 10:43:58 -05:00
Timothy Sample d0d90d0956 Support Guile 3.0.
* configure.ac (GUILE_PKG): Add '3.0'.
* guix.scm: Use 'guile-3.0' for the Gash package.
2022-02-11 10:22:19 -05:00
Timothy Sample eae0953f31 parser: Simplify default port handling.
* gash/parser.scm (read-sh, read-sh-all): Set the default value for
the 'port' argument in the usual way (rather than doing it
manually).
2021-06-23 14:27:40 -04:00
Timothy Sample 57d21182e2 parser: Fix port name typo.
* gash/parser.scm (read-sh): Read from 'current-input-port' instead
of 'current-output-port'.
2021-06-23 14:19:20 -04:00
Timothy Sample 87229e4b3a Add arithmetic expansion.
* gash/arithmetic.scm: New file.
* Makefile.am (SOURCES): Add it.
* gash/lexer.scm (get-arithmetic-expansion): New procedure.
(get-expansion): Check for "$((" and use the new procedure to read an
arithmetic expansion.
* gash/eval.scm (word->qword): Handle '<sh-arithmetic>'.
* tests/unit/eval.scm: Add tests.
* tests/spec/Makefile.am (TESTS): Add 'arith'.
* tests/spec/oil.scm: Patch seven of its tests and filter out fifteen
others.
* doc/gash.texi, doc/syntax.txt: Add '<sh-arithmetic>' syntax.
2021-05-26 13:16:50 -04:00
Timothy Sample d3244e0ec0 Move evaluation code from 'word' to 'eval'.
This adjustment paves the way for writing a compiler.

* gash/word.scm (eval-cmd-sub, string-not-null?, word->qword,
expand-word): Move these...
* gash/eval.scm: ...to this module.
* tests/unit/word.scm: Adjust qword tests to use 'expand-qword', and
move non-qword (evaluation) tests to...
* tests/unit/eval.scm: ...this new file, adjusting them to use
'eval-word'.
* Makefile.am (UNIT_TESTS): Add the new file.
2021-04-19 15:11:27 -04:00
Timothy Sample 2bce1ea07b Add an 'expand-qword' procedure.
* gash/word.scm (expand-qword): New procedure.
(expand-word): Rewrite in terms of 'expand-qword'.
2021-04-19 15:09:16 -04:00
Timothy Sample 1e88c314d6 Fix long lines in the examples in the manual.
* doc/gash.texi (Internal representation examples): Fix long lines
in examples.
2021-04-16 21:35:42 -04:00
Timothy Sample 18ecd7d142 Correct ice cream parsing example in the manual.
* doc/gash.texi (Internal representation examples): In the section
on pipelines, change a redirect in the result to "ice-cream.txt" to
match its input.
2021-04-16 21:31:45 -04:00
Timothy Sample 1e752e54bf Remove asynchronous commands as a missing feature.
* doc/gash.texi (Missing features): Remove asynchronous commands
from the list.
2020-08-21 16:15:17 -04:00
Timothy Sample 9f9a866b19 List variable operators as working in the manual.
* doc/gash.texi (Using Gash): Specify that all the variable
operators work.
(Missing features): Remove the bullet point about variable
operators.
2020-08-21 16:07:16 -04:00
Stephen J. Scheck 8f9b973264 Add a language specification.
* language/sh/spec.scm: New file.
* Makefile.am (SOURCES): Add it.
* doc/gash.texi (Using Gash from the Guile REPL): New section.
2020-08-21 15:49:24 -04:00
Timothy Sample 8cbb4803c8 Reset status on empty commands.
* gash/eval.scm (exp->thunk, exps->thunk): When the expression has
value '#f', reset the status.
2020-03-30 23:36:42 -04:00
Timothy Sample f22bc57996 Respect noclobber when redirecting.
* gash/shell.scm (process-redir): Respect the noclobber option.
* tests/redirects.org: Add a test.
2020-03-22 11:57:17 -04:00
Timothy Sample 01204cb807 Support printing the current umask.
* gash/built-ins/umask.scm (umask->octal-string): New procedure.
(main): Handle the no argument case.
2020-03-22 11:49:41 -04:00
Timothy Sample 855e15f928 Add the wait built-in.
* gash/built-ins/wait.scm: New file.
* Makefile.scm (SOURCES): Add it.
* geesh/built-ins.scm (*built-ins*): Add 'wait'.
2020-03-17 17:57:01 -04:00
Timothy Sample a0b6189cf3 Add basic support for asynchronous commands.
* gash/environment.scm (*last-job*): New variable.
(get-last-job): New procedure.
(set-last-job!): New procedure.
(reap-child-processes!): New procedure.
* gash/eval.scm (eval-sh): Handle '<sh-async>'.
* gash/gash.scm (main): Reap child processes.
* gash/repl.scm (run-repl): Likewise.
* gash/shell.scm (sh:async): New procedure.
* gash/word.scm (parameter-ref): Handle "!".
2020-03-17 17:15:36 -04:00
Timothy Sample 82c45abed6 Install Git in the CI environment.
* build-aux/gitlab-ci.yml (before_script): Install 'git'.
2020-02-06 21:04:50 -05:00
Timothy Sample 25cd5ac5af Use the configured system shell in tests.
* Makefile.am (AM_TESTS_ENVIRONMENT): New variable.
* tests/redirects.org (Files opened for redirect can be executed
immediately): Use an environment variable instead of hard-coding
'/bin/sh'.
2020-02-06 20:26:57 -05:00
Timothy Sample b8c29ebe6c Restore 'guix build -f guix.scm'.
This broke when we started building the 'version.texi' file
reproducibly (cf. 6f598de23a).

* guix.scm: Make sure 'make-select' includes the '.git' directory;
add 'git-minimal' to the main package's 'native-inputs'.
2020-02-06 20:21:52 -05:00
Timothy Sample 917cbf2aba Speed up getting non-whitespace IFS characters.
* gash/word.scm (split-fields): Compute 'char-set:ifs/nw' using
'string-delete' instead of 'char-set-difference'.
2020-02-04 23:19:27 -05:00
Timothy Sample b2faf08ed4 Mark 'next-char' as inlinable.
* gash/lexer.scm (next-char): Mark as inlinable.
2020-02-04 23:19:22 -05:00
Timothy Sample 9ba534ebff Speed up checking for operators.
* gash/lexer.scm (operator-prefix-char?): Compute the list of prefix
characters ahead of time.
2020-02-04 21:20:49 -05:00
Timothy Sample de485819ca Update the NEWS file.
NEWS: Update for release 0.2.0.
2019-12-15 21:56:31 -05:00
Timothy Sample b7c2153785 Make the bootstrap test work with current Guix.
* tests/bootstrap/bash-without-bash.scm (%boot0-inputs): Call the
upstream '%boot0-inputs' to get the list of packages.
2019-12-15 21:56:31 -05:00
Timothy Sample 6f598de23a Generate 'version.texi' reproducibly.
* Makefile.am ($(srcdir)/doc/version.texi): New rule (overriding one
provided by Automake).
2019-12-10 14:53:51 -05:00
Timothy Sample 98b60c0d68 Add janneke to the ChangeLog copyright notice. 2019-12-09 14:04:13 -05:00
Jan Nieuwenhuizen 45223e7d86 Allow 'make dist' in a Git worktree.
* Makefile.am (dist-hook, gen-ChangeLog): Test for mere existence of
.git instead of asserting a directory.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-12-09 14:01:24 -05:00
Timothy Sample a4cfff0641 Generate the ChangeLog reproducibly.
* build-aux/gitlog-to-changelog-repro.patch: New file.
* Makefile.am (EXTRA_DIST): Add it.
(build-aux/gitlog-to-changelog-repro): New rule.
(gen-ChangeLog): Use 'gitlog-to-changelog-repro'.
(DISTCLEANFILES): Add 'build-aux/gitlog-to-changelog-repro'.
2019-12-09 13:57:15 -05:00
Jan Nieuwenhuizen fda97e32ef Generate reproducible source tarballs.
* Makefile.am (dist-hook): Generate a '.tarball-timestamp' file.
(GZIP_ENV): Override, adding '--no-name'.
(am__tar): Override, adding flags to create reproducible source
tarballs.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-12-09 13:57:15 -05:00
Timothy Sample 82b6769285 Allow running 'make dist' from extracted tarball.
* Makefile (dist-hook): Check for '.git' before generating
'.tarball-manifest'.
2019-12-09 13:57:15 -05:00
Timothy Sample f005b1acbc Generate ChangeLog from Git.
* ChangeLog: Update Git log URL and add a copyright notice.
* Makefile.am (gen-ChangeLog): Use 'gitlog-to-changelog' to generate
the ChangeLog.
2019-12-09 13:57:15 -05:00
Jan Nieuwenhuizen 6f81266e2b gash compat textual-ports: Add put-char.
* gash/compat/textual-ports.scm: Add put-char.
2019-12-09 13:57:15 -05:00
Timothy Sample d905679e9a Initialize the current locale on Guile 2.0.
* gash/gash.scm: Initialize the current locale on Guile 2.0.
2019-12-09 13:57:09 -05:00
Timothy Sample 2d41b4ae5a Allow one-armed 'if-guile-version-below'.
* gash/compat.scm: Allow one-armed 'if-guile-version-below' syntax and
use it to simplify the conditional definitions throughout.
2019-12-09 13:53:55 -05:00
Timothy Sample 4f90afcd3d Use bindings with regular built-ins.
* gash/shell.scm (sh:exec-let): Save and set variables according to
'bindings' before executing a regular built-in.
2019-12-09 13:53:44 -05:00
Timothy Sample 8a440f35f6 Reap every process in a pipeline.
* gash/shell.scm (waitpid/any): New procedure.
(sh:pipeline): Use it to reap every process spawned while executing a
pipeline.
2019-12-09 13:36:41 -05:00