0.0.002
ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
This commit is contained in:
1 parent
f0f91540be
commit
b735900f2e
323 files changed
+134347
-343
No files matched your search
@@ -0,0 +1,42 @@
|
||||
;;; Host-level conventions shared by the Dat Scheme application layer.
|
||||
;;; S7 intentionally leaves policy and application modules to its embedding.
|
||||
|
||||
(define dat:runtime-version "1")
|
||||
|
||||
(define (dat:module-name->file name)
|
||||
(if (not (symbol? name))
|
||||
(error 'wrong-type-arg "Dat module name must be a symbol" name)
|
||||
(if (eq? name 'dat:record)
|
||||
"dat-record.scm"
|
||||
(if (eq? name 'dat:wire)
|
||||
"dat-wire.scm"
|
||||
(let* ((text (symbol->string name))
|
||||
(path (string-append text ".scm")))
|
||||
(do ((i 0 (+ i 1))) ((= i (string-length text)))
|
||||
(if (char=? (string-ref text i) #\:)
|
||||
(string-set! path i #\/)))
|
||||
path)))))
|
||||
|
||||
(define (dat:require feature)
|
||||
(let ((name (if (symbol? feature) feature (string->symbol feature))))
|
||||
(if (not (provided? name))
|
||||
(begin
|
||||
(load (dat:module-name->file name))
|
||||
(if (not (provided? name))
|
||||
(error 'dat-module-error "module did not declare its feature" name))))
|
||||
name))
|
||||
|
||||
(define (dat:with-archive archive procedure)
|
||||
(if (not (procedure? procedure))
|
||||
(error 'wrong-type-arg "expected a procedure" procedure)
|
||||
(dynamic-wind
|
||||
(lambda () #f)
|
||||
(lambda () (procedure archive))
|
||||
(lambda () (dat-close archive)))))
|
||||
|
||||
(define (dat:call-with-archive directory procedure . create?)
|
||||
(let ((archive ((if (and (pair? create?) (car create?)) dat-create dat-open)
|
||||
directory)))
|
||||
(dat:with-archive archive procedure)))
|
||||
|
||||
(provide 'dat:runtime)
|
||||
Reference in new issue
Block a user