Commit Graph

8 Commits

Author SHA1 Message Date
Timothy Sample 58f5644d2a Add 'arguments' field to environment
* geesh/environment.scm (<environment>): Add an 'arguments' field.
(make-environment): Add an optional 'arguments' parameter.
(with-environment-arguments): New public function.
.dir-locals.el: Indent it nicely.
2018-12-03 20:19:22 -05:00
Timothy Sample f03b438009 Keep track of functions in the environment
* geesh/environment.scm (<environment>): Add a 'functions' field.
(make-environment): Initialize it to the empty list.
(environment-function-ref): New public function.
(define-environment-function!): New public function.
2018-12-03 20:18:50 -05:00
Timothy Sample e43e6a88c4 Add 'status' field to environment
Instead of using an environment variable named '?', we will use a
special environment field called 'status'.  This lets us get rid of a
lot of number-string conversions (since an environment variable has to
have a string value).

* geesh/environment.scm (<environment>): Add a 'status' field.
(make-environment): Set it to 0 by default.
* geesh/repl.scm (run-repl): Use new field in place of '?' variable.
* geesh/shell.scm (exec-utility, sh:and, sh:exec-let, sh:for, sh:not,
sh:or, sh:pipeline, sh:subshell, sh:substitute-command): Ditto.
* geesh/word.scm (parameter-ref): New function that handles both
special parameters (e.g., '?') and variables.
(parameter-ref*): Like 'var-ref*', but for 'parameter-ref'.
(word->qword): Replace 'var-ref' and 'var-ref*' with 'parameter-ref'
and 'parameter-ref*' respectively.
2018-12-03 20:17:56 -05:00
Timothy Sample 737ed6a1b7 Add function for reading an 'environ'
* geesh/environment.scm (environ->alist): New function.
* tests/environment.scm: Test it.
2018-11-28 23:07:03 -05:00
Timothy Sample 020adfc58b Add convenience function 'var-ref*'
* geesh/environment.scm (var-ref*): New public function.
* geesh/word.scm (word->qword): Use it to simplify things.
2018-11-28 23:07:03 -05:00
Timothy Sample da1746f2d6 Add missing doc strings in environment
* geesh/environment.scm (var-ref): Add doc string.
(set-var!): Add doc string.
2018-11-28 23:07:03 -05:00
Timothy Sample cfb2b5b99b Add function for creating an 'environ'
* geesh/environment.scm (environment->environ): New function.
* tests/environment.scm: Test it.
2018-11-28 23:07:03 -05:00
Timothy Sample 6678ae1e59 Add environment
* geesh/environment.scm: New file.
* tests/environment.scm: New file.
* Makefile.am: Add them.
2018-07-15 19:46:14 -04:00