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)'.
This commit is contained in:
Timothy Sample 2022-04-28 15:51:24 -06:00
parent 0c554b6b13
commit 386d12aa21
3 changed files with 27 additions and 9 deletions

View File

@ -87,7 +87,9 @@
set-port-line!
string-every
the-eof-object
noop)
noop
make-prompt-tag
canonicalize-path)
(define-macro (define-inlinable . rest)
`(define ,@rest))
@ -119,4 +121,10 @@
(define the-eof-object (integer->char -1))
(define (noop . args) #f))
(define (noop . args) #f)
(define* (make-prompt-tag #:optional (stem "prompt"))
(list stem))
;; XXX: Actually implement this.
(define (canonicalize-path path) path))

View File

@ -26,14 +26,22 @@
;;;
;;; Code:
(define-macro (shared-shims)
'(begin
(export alist->hash-table)
(define (alist->hash-table alist)
(let ((table (make-hash-table)))
(for-each (lambda (pair)
(hash-set! table (car pair) (cdr pair)))
(reverse alist))
table))))
(if-guile-version-below (2 0 10)
(begin
(define-public (alist->hash-table alist)
(let ((table (make-hash-table)))
(for-each (lambda (pair)
(hash-set! table (car pair) (cdr pair)))
(reverse alist))
table)))
(shared-shims)
(begin
(use-modules (ice-9 hash-table))
(re-export alist->hash-table)))
(when-mes
(shared-shims))

View File

@ -18,9 +18,11 @@
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
(define-module (gash environment)
#:use-module (gash compat)
#:use-module (gash compat hash-table)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-14)
#:use-module (srfi srfi-26)
#:export (get-status
set-status!