(zilch): document most exported symbols

Change-Id: I6a6a6964d3be7b8c6306a21d810c639f30253d38
This commit is contained in:
puck 2025-06-23 12:22:20 +00:00
parent 6a1efc6a92
commit a80266d9d8
13 changed files with 186 additions and 81 deletions

View file

@ -1,3 +1,4 @@
;; Helpers to create store paths that contain files, symlinks, and/or directories.
(define-library (zilch file)
(import
(scheme base) (scheme case-lambda)
@ -17,8 +18,8 @@
(define-record-printer (<z-file> file out)
(if (z-file-executable file)
(fprintf out "#<z-file (executable)>")
(fprintf out "#<z-file>")))
(fprintf out "#<z-file ~S (executable)>" (z-file-contents file))
(fprintf out "#<z-file ~S>" (z-file-contents file))))
(define-record-type <z-directory>
(make-z-directory contents cache)
@ -43,13 +44,13 @@
(define (env-pair<? l r) (string<? (car l) (car r)))
;; Create a `<z-file>` object with given contents and optional `executable` flag.
;; The contents may either be a string or a `<zexp>`.
;; The contents may either be a string or a `zexp`.
(define zfile
(case-lambda
((contents) (make-z-file contents #f #f))
((contents executable) (make-z-file contents executable #f))))
;; Create a `<z-symlink>` record. The target may be any string, *or* a `<zexp>` containing one.
;; Create a `<z-symlink>` record. The target may be any string, or a `<zexp>` of a string.
(define (zsymlink target) (make-z-symlink target #f))
;; Create a `<z-directory>` record. The contents is an alist of file name -> zfile/zsymlink/zdir.
@ -188,7 +189,7 @@
;; Serialize a file-like (`zfile`, `zsymlink`, `zdir`) to a `<store-path>`.
;; This function should not depend on the system of the builder.
;;
;; TODO(puck): due to limitations, whatever you pass in ends up at `<store-path>/-` instead.
;; Due to limitations, whatever you pass in ends up at `<store-path>/-` instead.
(define (zfile->store val)
(define cached
(cond